@wix/editor-react-components 1.2289.0 → 1.2291.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/site/components/AccordionComponent/component.js +1 -1
- package/dist/site/components/AccordionComponent/manifest.js +2 -2
- package/dist/site/components/AnimatedIcon/manifest.js +1 -1
- package/dist/site/components/AudioPlayer/component.js +12 -10
- package/dist/site/components/AudioPlayer/manifest.js +2 -2
- package/dist/site/components/BoxContainer/component.js +1 -1
- package/dist/site/components/BoxContainer/manifest.js +1 -1
- package/dist/site/components/Breadcrumbs/component.js +2 -2
- package/dist/site/components/Breadcrumbs/manifest.js +2 -2
- package/dist/site/components/Button/manifest.js +2 -2
- package/dist/site/components/CollapsibleText/component.js +1 -1
- package/dist/site/components/CollapsibleText/manifest.js +2 -2
- package/dist/site/components/DatePicker/component.js +3290 -9827
- package/dist/site/components/DatePicker/manifest.js +1 -1
- package/dist/site/components/Dropdown/component.js +1 -1
- package/dist/site/components/Dropdown/manifest.js +2 -2
- package/dist/site/components/GoogleMap/manifest.js +1 -1
- package/dist/site/components/HTMLComponent/component.js +1 -1
- package/dist/site/components/HTMLComponent/manifest.js +1 -1
- package/dist/site/components/HipaaIcon/component.js +1 -1
- package/dist/site/components/HipaaIcon/manifest.js +1 -1
- package/dist/site/components/LinkBar/component.js +1 -1
- package/dist/site/components/LinkBar/manifest.js +2 -2
- package/dist/site/components/Logo/component.js +1 -1
- package/dist/site/components/Logo/manifest.js +1 -1
- package/dist/site/components/Logo/sdk.js +1 -1
- package/dist/site/components/Lottie/component.js +1 -1
- package/dist/site/components/Lottie/manifest.js +2 -2
- package/dist/site/components/Menu/component.js +1 -1
- package/dist/site/components/Menu/manifest.js +2 -2
- package/dist/site/components/MultiStateBox/component.js +1 -1
- package/dist/site/components/MultiStateBox/manifest.js +2 -2
- package/dist/site/components/ProgressBar/component.js +1 -1
- package/dist/site/components/ProgressBar/manifest.js +1 -1
- package/dist/site/components/ProgressBar/sdk.js +1 -1
- package/dist/site/components/Repeater/component.js +1 -1
- package/dist/site/components/Repeater/manifest.js +1 -1
- package/dist/site/components/ShareButtons/component.js +1 -1
- package/dist/site/components/ShareButtons/manifest.js +2 -2
- package/dist/site/components/Slideshow/manifest.js +1 -1
- package/dist/site/components/Tabs/component.js +1 -1
- package/dist/site/components/Tabs/manifest.js +2 -2
- package/dist/site/components/TestComp/manifest.js +1 -1
- package/dist/site/components/TextBox/component.js +1 -1
- package/dist/site/components/TextBox/manifest.js +1 -1
- package/dist/site/components/TextEffects3d/component.js +1 -1
- package/dist/site/components/TextEffects3d/manifest.js +1 -1
- package/dist/site/components/TextEffectsBauhaus/component.js +1 -1
- package/dist/site/components/TextEffectsBauhaus/manifest.js +1 -1
- package/dist/site/components/TextEffectsGlass/component.js +1 -1
- package/dist/site/components/TextEffectsGlass/manifest.js +1 -1
- package/dist/site/components/TextEffectsGlitch/component.js +1 -1
- package/dist/site/components/TextEffectsGlitch/manifest.js +1 -1
- package/dist/site/components/TextEffectsLetterPress/component.js +1 -1
- package/dist/site/components/TextEffectsLetterPress/manifest.js +1 -1
- package/dist/site/components/TextEffectsMatrix/component.js +1 -1
- package/dist/site/components/TextEffectsMatrix/manifest.js +1 -1
- package/dist/site/components/TextEffectsNeonSign/component.js +1 -1
- package/dist/site/components/TextEffectsNeonSign/manifest.js +1 -1
- package/dist/site/components/TextEffectsNoisy/component.js +1 -1
- package/dist/site/components/TextEffectsNoisy/manifest.js +1 -1
- package/dist/site/components/TextEffectsOutlineOut/component.js +2 -2
- package/dist/site/components/TextEffectsOutlineOut/manifest.js +1 -1
- package/dist/site/components/TextEffectsRetro/component.js +1 -1
- package/dist/site/components/TextEffectsRetro/manifest.js +1 -1
- package/dist/site/components/TextEffectsShook/component.js +1 -1
- package/dist/site/components/TextEffectsShook/manifest.js +1 -1
- package/dist/site/components/TextEffectsSticker/component.js +1 -1
- package/dist/site/components/TextEffectsSticker/manifest.js +2 -2
- package/dist/site/components/TextEffectsStriped/component.js +1 -1
- package/dist/site/components/TextEffectsStriped/manifest.js +1 -1
- package/dist/site/components/TextInput/TextInput.types.d.ts +3 -0
- package/dist/site/components/TextInput/component.js +190 -179
- package/dist/site/components/TextInput/component.preview.d.ts +4 -0
- package/dist/site/components/TextInput/constants.d.ts +27 -0
- package/dist/site/components/TextInput/css.css +36 -13
- package/dist/site/components/TextInput/manifest.js +103 -4
- package/dist/site/components/TimePicker/TimePicker.d.ts +3 -0
- package/dist/site/components/TimePicker/TimePicker.types.d.ts +29 -0
- package/dist/site/components/TimePicker/component.d.ts +2 -0
- package/dist/site/components/TimePicker/component.js +146 -0
- package/dist/site/components/TimePicker/component.preview.d.ts +2 -0
- package/dist/site/components/TimePicker/components/TimePickerField.d.ts +4 -0
- package/dist/site/components/TimePicker/constants.d.ts +32 -0
- package/dist/site/components/TimePicker/css.css +64 -0
- package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +10 -0
- package/dist/site/components/TimePicker/index.d.ts +2 -0
- package/dist/site/components/TimePicker/index.js +6 -0
- package/dist/site/components/TimePicker/manifest.d.ts +5 -0
- package/dist/site/components/TimePicker/manifest.js +113 -0
- package/dist/site/components/TimePicker/timePickerUtils.d.ts +15 -0
- package/dist/site/components/chunks/AnimatedIcon.js +1 -1
- package/dist/site/components/chunks/Button.js +1 -1
- package/dist/site/components/chunks/Button2.js +10 -829
- package/dist/site/components/chunks/DateField.js +6763 -0
- package/dist/site/components/chunks/Group.js +42 -155
- package/dist/site/components/chunks/I18nProvider.js +3 -3
- package/dist/site/components/chunks/Input.js +5 -5
- package/dist/site/components/chunks/Patterns.js +1 -1
- package/dist/site/components/chunks/TextEffectsShared.js +1 -1
- package/dist/site/components/chunks/constants10.js +14 -12
- package/dist/site/components/chunks/constants11.js +9 -9
- package/dist/site/components/chunks/constants12.js +10 -8
- package/dist/site/components/chunks/constants13.js +9 -13
- package/dist/site/components/chunks/constants14.js +14 -17
- package/dist/site/components/chunks/constants15.js +17 -12
- package/dist/site/components/chunks/constants16.js +11 -13
- package/dist/site/components/chunks/constants17.js +20 -66
- package/dist/site/components/chunks/constants18.js +66 -16
- package/dist/site/components/chunks/constants19.js +15 -50
- package/dist/site/components/chunks/constants2.js +30 -50
- package/dist/site/components/chunks/constants20.js +43 -45
- package/dist/site/components/chunks/constants21.js +48 -297
- package/dist/site/components/chunks/constants22.js +299 -41
- package/dist/site/components/chunks/constants23.js +44 -29
- package/dist/site/components/chunks/constants24.js +32 -17
- package/dist/site/components/chunks/constants25.js +16 -402
- package/dist/site/components/chunks/constants26.js +393 -73
- package/dist/site/components/chunks/constants27.js +80 -15
- package/dist/site/components/chunks/constants28.js +11 -42
- package/dist/site/components/chunks/constants29.js +44 -23
- package/dist/site/components/chunks/constants3.js +64 -13
- package/dist/site/components/chunks/constants30.js +28 -10
- package/dist/site/components/chunks/constants31.js +10 -132
- package/dist/site/components/chunks/constants32.js +112 -147
- package/dist/site/components/chunks/constants33.js +152 -49
- package/dist/site/components/chunks/constants34.js +53 -71
- package/dist/site/components/chunks/constants35.js +73 -77
- package/dist/site/components/chunks/constants36.js +76 -57
- package/dist/site/components/chunks/constants37.js +72 -0
- package/dist/site/components/chunks/constants4.js +10 -19
- package/dist/site/components/chunks/constants5.js +14 -14
- package/dist/site/components/chunks/constants6.js +11 -10
- package/dist/site/components/chunks/constants7.js +14 -14
- package/dist/site/components/chunks/constants8.js +22 -65
- package/dist/site/components/chunks/constants9.js +65 -20
- package/dist/site/components/chunks/filterDOMProps.js +7 -7
- package/dist/site/components/chunks/manifestBase.js +1 -1
- package/dist/site/components/chunks/manifestSdkMixins.js +3 -3
- package/dist/site/components/chunks/useFocusable.js +118 -0
- package/dist/site/components/chunks/useLocalizedStringFormatter.js +1 -1
- package/dist/site/components/chunks/usePress.js +825 -0
- package/dist/site/components/chunks/utils.js +1 -1
- package/dist/site/components/extensions.js +9 -4
- package/package.json +3 -3
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { I as INTERACTIONS, D as DATA, C as CSS_PROPERTIES, b as DISPLAY_GROUPS, L as LAYOUT, A as Archetype } from "../chunks/chunk-JPMZBG44.js";
|
|
2
|
-
import { D as DisplayNames, s as selectors } from "../chunks/
|
|
3
|
-
import { g as getSelector } from "../chunks/manifest.js";
|
|
1
|
+
import { I as INTERACTIONS, D as DATA, C as CSS_PROPERTIES, b as DISPLAY_GROUPS, N as NativeStateType, L as LAYOUT, A as Archetype } from "../chunks/chunk-JPMZBG44.js";
|
|
2
|
+
import { D as DisplayNames, a as DesignStates, s as selectors } from "../chunks/constants3.js";
|
|
3
|
+
import { w as withSpec, g as getSelector } from "../chunks/manifest.js";
|
|
4
|
+
import { I as IS_SUPPORT_DESIGN_STATE_SPEC } from "../chunks/specs.js";
|
|
5
|
+
import { m as manifestFocusable, b as manifestInputable, a as manifestChangeable } from "../chunks/manifestSdkMixins.js";
|
|
4
6
|
const manifest = {
|
|
5
7
|
id: "b8f7e3d2-4a5c-4e8f-9b2d-1c3e5f7a9b4d",
|
|
6
8
|
type: "wixEditorElements.TextInput",
|
|
@@ -24,6 +26,9 @@ const manifest = {
|
|
|
24
26
|
},
|
|
25
27
|
sdk: {
|
|
26
28
|
url: "./site/components/TextInput/sdk.ts"
|
|
29
|
+
},
|
|
30
|
+
editor: {
|
|
31
|
+
componentUrl: "./site/components/TextInput/component.preview.tsx"
|
|
27
32
|
}
|
|
28
33
|
},
|
|
29
34
|
editorElement: {
|
|
@@ -36,7 +41,59 @@ const manifest = {
|
|
|
36
41
|
disableStretching: false,
|
|
37
42
|
disablePositioning: false
|
|
38
43
|
},
|
|
44
|
+
states: {
|
|
45
|
+
hover: withSpec({
|
|
46
|
+
spec: IS_SUPPORT_DESIGN_STATE_SPEC,
|
|
47
|
+
displayName: DesignStates.root.hover.displayName,
|
|
48
|
+
className: DesignStates.root.hover.className,
|
|
49
|
+
pseudoClass: NativeStateType.hover
|
|
50
|
+
}),
|
|
51
|
+
focus: withSpec({
|
|
52
|
+
spec: IS_SUPPORT_DESIGN_STATE_SPEC,
|
|
53
|
+
displayName: DesignStates.root.focus.displayName,
|
|
54
|
+
className: DesignStates.root.focus.className,
|
|
55
|
+
pseudoClass: NativeStateType.focus
|
|
56
|
+
}),
|
|
57
|
+
error: withSpec({
|
|
58
|
+
spec: IS_SUPPORT_DESIGN_STATE_SPEC,
|
|
59
|
+
displayName: DesignStates.root.error.displayName,
|
|
60
|
+
className: DesignStates.root.error.className
|
|
61
|
+
}),
|
|
62
|
+
disabled: withSpec({
|
|
63
|
+
spec: IS_SUPPORT_DESIGN_STATE_SPEC,
|
|
64
|
+
displayName: DesignStates.root.disabled.displayName,
|
|
65
|
+
className: DesignStates.root.disabled.className,
|
|
66
|
+
pseudoClass: NativeStateType.disabled,
|
|
67
|
+
props: { isDisabled: true }
|
|
68
|
+
})
|
|
69
|
+
},
|
|
39
70
|
displayGroups: {
|
|
71
|
+
orderedDataGroup: {
|
|
72
|
+
groupType: DISPLAY_GROUPS.GROUP_TYPE.data,
|
|
73
|
+
data: {
|
|
74
|
+
items: [
|
|
75
|
+
"required",
|
|
76
|
+
"readOnly",
|
|
77
|
+
"isDisabled",
|
|
78
|
+
"autoComplete",
|
|
79
|
+
"numberSpinnerHidden",
|
|
80
|
+
"inputType",
|
|
81
|
+
"label",
|
|
82
|
+
"placeholder",
|
|
83
|
+
"tooltip",
|
|
84
|
+
"prefix",
|
|
85
|
+
"autocompleteToken",
|
|
86
|
+
"pattern",
|
|
87
|
+
"minLength",
|
|
88
|
+
"maxLength",
|
|
89
|
+
"min",
|
|
90
|
+
"max",
|
|
91
|
+
"step",
|
|
92
|
+
"phoneFormat",
|
|
93
|
+
"errorMessageType"
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
40
97
|
textPaddingGroup: {
|
|
41
98
|
groupType: DISPLAY_GROUPS.GROUP_TYPE.padding,
|
|
42
99
|
padding: {
|
|
@@ -310,6 +367,19 @@ const manifest = {
|
|
|
310
367
|
}
|
|
311
368
|
},
|
|
312
369
|
data: {
|
|
370
|
+
value: {
|
|
371
|
+
displayName: DisplayNames.data.value,
|
|
372
|
+
dataType: DATA.DATA_TYPE.text
|
|
373
|
+
},
|
|
374
|
+
isDisabled: {
|
|
375
|
+
displayName: DisplayNames.data.isDisabled,
|
|
376
|
+
dataType: DATA.DATA_TYPE.booleanValue,
|
|
377
|
+
defaultValue: false
|
|
378
|
+
},
|
|
379
|
+
name: {
|
|
380
|
+
displayName: DisplayNames.data.name,
|
|
381
|
+
dataType: DATA.DATA_TYPE.text
|
|
382
|
+
},
|
|
313
383
|
// Direction properties
|
|
314
384
|
direction: {
|
|
315
385
|
dataType: DATA.DATA_TYPE.direction
|
|
@@ -338,6 +408,13 @@ const manifest = {
|
|
|
338
408
|
}
|
|
339
409
|
},
|
|
340
410
|
// Validation properties
|
|
411
|
+
minLength: {
|
|
412
|
+
displayName: DisplayNames.data.minLength,
|
|
413
|
+
dataType: DATA.DATA_TYPE.number,
|
|
414
|
+
[DATA.DATA_TYPE.number]: {
|
|
415
|
+
min: "0"
|
|
416
|
+
}
|
|
417
|
+
},
|
|
341
418
|
maxLength: {
|
|
342
419
|
displayName: DisplayNames.data.maxLength,
|
|
343
420
|
dataType: DATA.DATA_TYPE.number
|
|
@@ -388,6 +465,13 @@ const manifest = {
|
|
|
388
465
|
maxLength: 4e3
|
|
389
466
|
}
|
|
390
467
|
},
|
|
468
|
+
tooltip: {
|
|
469
|
+
displayName: DisplayNames.data.tooltip,
|
|
470
|
+
dataType: DATA.DATA_TYPE.text,
|
|
471
|
+
[DATA.DATA_TYPE.text]: {
|
|
472
|
+
maxLength: 400
|
|
473
|
+
}
|
|
474
|
+
},
|
|
391
475
|
// Accessibility
|
|
392
476
|
a11y: {
|
|
393
477
|
dataType: DATA.DATA_TYPE.a11y,
|
|
@@ -434,7 +518,22 @@ const manifest = {
|
|
|
434
518
|
step: {
|
|
435
519
|
displayName: DisplayNames.data.step,
|
|
436
520
|
dataType: DATA.DATA_TYPE.number
|
|
437
|
-
}
|
|
521
|
+
},
|
|
522
|
+
autocompleteToken: {
|
|
523
|
+
displayName: DisplayNames.data.autocompleteToken,
|
|
524
|
+
dataType: DATA.DATA_TYPE.text,
|
|
525
|
+
[DATA.DATA_TYPE.text]: {
|
|
526
|
+
maxLength: 50
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
numberSpinnerHidden: {
|
|
530
|
+
displayName: DisplayNames.data.numberSpinnerHidden,
|
|
531
|
+
dataType: DATA.DATA_TYPE.booleanValue,
|
|
532
|
+
defaultValue: false
|
|
533
|
+
},
|
|
534
|
+
...manifestChangeable(),
|
|
535
|
+
...manifestInputable(),
|
|
536
|
+
...manifestFocusable()
|
|
438
537
|
},
|
|
439
538
|
interactions: {
|
|
440
539
|
triggers: [
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { A11y, Direction } from '@wix/editor-react-types';
|
|
2
|
+
import { SdkFunctionChangeableProps, SdkFunctionFocusableProps } from '../../../utils/functions/sdkFunctionCallbackProps';
|
|
3
|
+
import { TranslationKeys } from './constants';
|
|
4
|
+
/** A viewer-facing translatable string key. */
|
|
5
|
+
export type TranslationKey = keyof typeof TranslationKeys;
|
|
6
|
+
/** Smallest editable time unit (React Aria `granularity`). */
|
|
7
|
+
export type TimePickerGranularity = 'hour' | 'minute' | 'second';
|
|
8
|
+
export type TimePickerProps = Omit<SdkFunctionChangeableProps, 'onChange'> & SdkFunctionFocusableProps & {
|
|
9
|
+
/** Fires with the selected ISO time string (`HH:MM[:SS]`), or `''` when cleared. */
|
|
10
|
+
onChange?: (value: string) => void;
|
|
11
|
+
/** DOM `id` on the root `.timePicker` wrapper. */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Appended to the root `.timePicker`. Use this for CSS-variable and per-element overrides. */
|
|
14
|
+
className: string;
|
|
15
|
+
/**
|
|
16
|
+
* The selected time as an ISO 24h `HH:MM[:SS]` string. The empty string
|
|
17
|
+
* means no time is selected.
|
|
18
|
+
*/
|
|
19
|
+
value: string;
|
|
20
|
+
/** Writing direction applied to the root. */
|
|
21
|
+
direction?: Direction;
|
|
22
|
+
/** Accessibility attributes. `ariaLabel` labels the time picker for assistive tech. */
|
|
23
|
+
a11y?: A11y;
|
|
24
|
+
/** Platform-provided props. */
|
|
25
|
+
wix?: {
|
|
26
|
+
/** Spread on the preset wrapper. */
|
|
27
|
+
presetsWrapperProps?: Record<string, unknown>;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as clsx } from "../chunks/clsx.js";
|
|
3
|
+
import { $ as $58246871e4652552$export$c9698ec7f05a07e1, a as $40825cdb76e74f70$export$7edc06cf1783b30f, b as $40825cdb76e74f70$export$336ab7fa954c4b5f, c as $40825cdb76e74f70$export$5eaee2322dd727eb } from "../chunks/DateField.js";
|
|
4
|
+
import { $ as $2eb8e6d23f3d0cb0$export$a54013f0d02a8f82 } from "../chunks/I18nProvider.js";
|
|
5
|
+
import { useService } from "@wix/services-manager-react";
|
|
6
|
+
import { E as EnvironmentDefinition } from "../chunks/index2.js";
|
|
7
|
+
import { T as TranslationsDefinition } from "../chunks/index5.js";
|
|
8
|
+
import { a as getDataAttributes } from "../chunks/dataUtils.js";
|
|
9
|
+
import { d as directionStyles } from "../chunks/direction.module.js";
|
|
10
|
+
import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
|
|
11
|
+
import { E as EMPTY_VALUE, T as TestIds, s as selectors, a as TRANSLATIONS_NAMESPACE, D as DefaultTranslations, b as TranslationKeys } from "../chunks/constants2.js";
|
|
12
|
+
import { useState } from "react";
|
|
13
|
+
import { $ as $a049562f99e7db0e$export$eb2fcfdbd7ba97d4 } from "../chunks/Group.js";
|
|
14
|
+
const getTranslation = (translate, key, translationKeys, defaultTranslations) => {
|
|
15
|
+
const translationKey = translationKeys[key];
|
|
16
|
+
const translated = translate(translationKey);
|
|
17
|
+
return translated && translated !== translationKey ? translated : defaultTranslations[key];
|
|
18
|
+
};
|
|
19
|
+
const timePicker = "timePicker__j78My";
|
|
20
|
+
const root = "root__dzkbY";
|
|
21
|
+
const group = "group__6HZy7";
|
|
22
|
+
const field = "field__mnQwh";
|
|
23
|
+
const segment = "segment__OtazP";
|
|
24
|
+
const styles = {
|
|
25
|
+
timePicker,
|
|
26
|
+
root,
|
|
27
|
+
group,
|
|
28
|
+
field,
|
|
29
|
+
segment
|
|
30
|
+
};
|
|
31
|
+
const readString = (prop) => typeof prop === "string" ? prop : EMPTY_VALUE;
|
|
32
|
+
const toTimeValue = (iso) => {
|
|
33
|
+
if (!iso) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
return $58246871e4652552$export$c9698ec7f05a07e1(iso);
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
43
|
+
const toIso = (time, granularity) => {
|
|
44
|
+
if (!time) {
|
|
45
|
+
return EMPTY_VALUE;
|
|
46
|
+
}
|
|
47
|
+
const hoursAndMinutes = `${pad(time.hour)}:${pad(time.minute)}`;
|
|
48
|
+
return granularity === "second" ? `${hoursAndMinutes}:${pad(time.second)}` : hoursAndMinutes;
|
|
49
|
+
};
|
|
50
|
+
const useTimePickerValue = (params) => {
|
|
51
|
+
const { value, onChange } = params;
|
|
52
|
+
const valueStr = readString(value);
|
|
53
|
+
const [timeValue, setTimeValue] = useState(
|
|
54
|
+
() => toTimeValue(valueStr)
|
|
55
|
+
);
|
|
56
|
+
const [prevValueStr, setPrevValueStr] = useState(valueStr);
|
|
57
|
+
if (prevValueStr !== valueStr) {
|
|
58
|
+
setPrevValueStr(valueStr);
|
|
59
|
+
setTimeValue(toTimeValue(valueStr));
|
|
60
|
+
}
|
|
61
|
+
const handleChange = (next) => {
|
|
62
|
+
setTimeValue(next);
|
|
63
|
+
onChange(toIso(next, "minute"));
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
timeValue,
|
|
67
|
+
handleChange,
|
|
68
|
+
hasValue: Boolean(valueStr)
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const renderSegments = (segment2) => /* @__PURE__ */ jsx($40825cdb76e74f70$export$336ab7fa954c4b5f, { segment: segment2, className: styles.segment });
|
|
72
|
+
const TimePickerField = ({
|
|
73
|
+
clearButton
|
|
74
|
+
}) => /* @__PURE__ */ jsxs(
|
|
75
|
+
$a049562f99e7db0e$export$eb2fcfdbd7ba97d4,
|
|
76
|
+
{
|
|
77
|
+
className: clsx(styles.group, selectors.group),
|
|
78
|
+
"data-testid": TestIds.group,
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ jsx($40825cdb76e74f70$export$7edc06cf1783b30f, { className: styles.field, "data-testid": TestIds.field, children: renderSegments }),
|
|
81
|
+
clearButton
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
const noop = () => {
|
|
86
|
+
};
|
|
87
|
+
function TimePicker(props) {
|
|
88
|
+
const environmentService = useService(EnvironmentDefinition);
|
|
89
|
+
const { translate } = useService(TranslationsDefinition);
|
|
90
|
+
const translateByKey = translate(TRANSLATIONS_NAMESPACE);
|
|
91
|
+
const t = (key) => getTranslation(translateByKey, key, TranslationKeys, DefaultTranslations);
|
|
92
|
+
const {
|
|
93
|
+
id,
|
|
94
|
+
className = "",
|
|
95
|
+
direction,
|
|
96
|
+
a11y,
|
|
97
|
+
onChange = noop,
|
|
98
|
+
onFocus = noop,
|
|
99
|
+
onBlur = noop,
|
|
100
|
+
wix
|
|
101
|
+
} = props;
|
|
102
|
+
const { timeValue, handleChange } = useTimePickerValue({
|
|
103
|
+
value: props.value,
|
|
104
|
+
onChange
|
|
105
|
+
});
|
|
106
|
+
const locale = environmentService.language || "en-US";
|
|
107
|
+
const ariaLabel = (a11y == null ? void 0 : a11y.ariaLabel) || t("ariaLabel");
|
|
108
|
+
return /* @__PURE__ */ jsx(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
className: presetWrapperStyles.presetWrapper,
|
|
112
|
+
...(wix == null ? void 0 : wix.presetsWrapperProps) || {},
|
|
113
|
+
children: /* @__PURE__ */ jsx(
|
|
114
|
+
"div",
|
|
115
|
+
{
|
|
116
|
+
id,
|
|
117
|
+
...getDataAttributes(props),
|
|
118
|
+
className: clsx(
|
|
119
|
+
className,
|
|
120
|
+
styles.root,
|
|
121
|
+
selectors.root,
|
|
122
|
+
!direction && directionStyles.fallbackDirection
|
|
123
|
+
),
|
|
124
|
+
dir: direction || void 0,
|
|
125
|
+
lang: environmentService.language,
|
|
126
|
+
"data-testid": TestIds.root,
|
|
127
|
+
children: /* @__PURE__ */ jsx($2eb8e6d23f3d0cb0$export$a54013f0d02a8f82, { locale, children: /* @__PURE__ */ jsx(
|
|
128
|
+
$40825cdb76e74f70$export$5eaee2322dd727eb,
|
|
129
|
+
{
|
|
130
|
+
className: styles.timePicker,
|
|
131
|
+
value: timeValue,
|
|
132
|
+
onChange: handleChange,
|
|
133
|
+
"aria-label": ariaLabel,
|
|
134
|
+
onFocus,
|
|
135
|
+
onBlur,
|
|
136
|
+
children: /* @__PURE__ */ jsx(TimePickerField, { clearButton: null })
|
|
137
|
+
}
|
|
138
|
+
) })
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
TimePicker as default
|
|
146
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const DisplayNames: {
|
|
2
|
+
root: {
|
|
3
|
+
elementDisplayName: string;
|
|
4
|
+
data: {
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
elements: {
|
|
8
|
+
timeInput: string;
|
|
9
|
+
};
|
|
10
|
+
cssCustomProperties: {};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
/** The value that represents "no time selected". */
|
|
14
|
+
export declare const EMPTY_VALUE = "";
|
|
15
|
+
export declare const TRANSLATIONS_NAMESPACE = "timePicker";
|
|
16
|
+
/** Viewer-facing string keys (translated via the Translations service). */
|
|
17
|
+
export declare const TranslationKeys: {
|
|
18
|
+
readonly ariaLabel: "timePicker_aria_label";
|
|
19
|
+
};
|
|
20
|
+
/** English fallbacks used when a translation is missing. */
|
|
21
|
+
export declare const DefaultTranslations: {
|
|
22
|
+
readonly ariaLabel: "Time picker";
|
|
23
|
+
};
|
|
24
|
+
export declare const TestIds: {
|
|
25
|
+
readonly root: "timepicker-root";
|
|
26
|
+
readonly group: "timepicker-group";
|
|
27
|
+
readonly field: "timepicker-field";
|
|
28
|
+
};
|
|
29
|
+
export declare const selectors: {
|
|
30
|
+
readonly root: "timePicker";
|
|
31
|
+
readonly group: "timePicker__group";
|
|
32
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
.timePicker__j78My {
|
|
2
|
+
--field-background-color: var(--wst-primary-background-color, #ffffff);
|
|
3
|
+
--borderColor: var(--wst-system-line-1-color, #dfe5eb);
|
|
4
|
+
--borderWidth: 1px;
|
|
5
|
+
--borderStartStartRadius: 6px;
|
|
6
|
+
--borderStartEndRadius: 6px;
|
|
7
|
+
--borderEndStartRadius: 6px;
|
|
8
|
+
--borderEndEndRadius: 6px;
|
|
9
|
+
}
|
|
10
|
+
.root__dzkbY {
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
display: inline-flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
min-width: 120px;
|
|
15
|
+
max-width: 100%;
|
|
16
|
+
font: var(--font, normal normal normal 16px/1.5em madefor-text, helveticaneuew01-45ligh, helveticaneuew02-45ligh, helveticaneuew10-45ligh, sans-serif);
|
|
17
|
+
color: var(--color, #2b2b2b);
|
|
18
|
+
text-align: start;
|
|
19
|
+
}
|
|
20
|
+
.timePicker__j78My {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
}
|
|
24
|
+
.group__6HZy7 {
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 8px;
|
|
29
|
+
width: 100%;
|
|
30
|
+
padding: 8px 12px;
|
|
31
|
+
font: inherit;
|
|
32
|
+
color: inherit;
|
|
33
|
+
background: var(--field-background-color);
|
|
34
|
+
border-style: solid;
|
|
35
|
+
border-width: var(--borderWidth);
|
|
36
|
+
border-color: var(--borderColor);
|
|
37
|
+
border-start-start-radius: var(--borderStartStartRadius);
|
|
38
|
+
border-start-end-radius: var(--borderStartEndRadius);
|
|
39
|
+
border-end-start-radius: var(--borderEndStartRadius);
|
|
40
|
+
border-end-end-radius: var(--borderEndEndRadius);
|
|
41
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
42
|
+
}
|
|
43
|
+
.field__mnQwh {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
flex: 1;
|
|
46
|
+
min-width: 0;
|
|
47
|
+
gap: 1px;
|
|
48
|
+
font: inherit;
|
|
49
|
+
color: inherit;
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
}
|
|
52
|
+
.segment__OtazP {
|
|
53
|
+
padding: 0 2px;
|
|
54
|
+
border-radius: 3px;
|
|
55
|
+
font-variant-numeric: tabular-nums;
|
|
56
|
+
text-align: center;
|
|
57
|
+
outline: none;
|
|
58
|
+
}
|
|
59
|
+
.fallbackDirection__HeRgn:not([dir]) {
|
|
60
|
+
direction: var(--wix-opt-in-direction);
|
|
61
|
+
}
|
|
62
|
+
.presetWrapper__J1yzj {
|
|
63
|
+
display: contents;
|
|
64
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TimeValue } from 'react-aria-components';
|
|
2
|
+
import { TimePickerProps } from '../TimePicker.types';
|
|
3
|
+
export declare const useTimePickerValue: (params: {
|
|
4
|
+
value: TimePickerProps["value"];
|
|
5
|
+
onChange: NonNullable<TimePickerProps["onChange"]>;
|
|
6
|
+
}) => {
|
|
7
|
+
timeValue: TimeValue | null;
|
|
8
|
+
handleChange: (next: TimeValue | null) => void;
|
|
9
|
+
hasValue: boolean;
|
|
10
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { D as DATA, E as ELEMENTS, L as LAYOUT, A as Archetype } from "../chunks/chunk-JPMZBG44.js";
|
|
2
|
+
import { c as DisplayNames, s as selectors } from "../chunks/constants2.js";
|
|
3
|
+
import { g as getSelector } from "../chunks/manifest.js";
|
|
4
|
+
import { m as manifestFocusable, a as manifestChangeable } from "../chunks/manifestSdkMixins.js";
|
|
5
|
+
const cssProperties = {
|
|
6
|
+
font: {},
|
|
7
|
+
color: {},
|
|
8
|
+
textAlign: {}
|
|
9
|
+
};
|
|
10
|
+
const cssCustomProperties = {};
|
|
11
|
+
const boxBorder = {
|
|
12
|
+
borderTop: {},
|
|
13
|
+
borderBottom: {},
|
|
14
|
+
borderInlineStart: {},
|
|
15
|
+
borderInlineEnd: {},
|
|
16
|
+
borderStartStartRadius: {},
|
|
17
|
+
borderStartEndRadius: {},
|
|
18
|
+
borderEndStartRadius: {},
|
|
19
|
+
borderEndEndRadius: {}
|
|
20
|
+
};
|
|
21
|
+
const boxPadding = {
|
|
22
|
+
paddingTop: {},
|
|
23
|
+
paddingBottom: {},
|
|
24
|
+
paddingInlineStart: {},
|
|
25
|
+
paddingInlineEnd: {}
|
|
26
|
+
};
|
|
27
|
+
const manifest = {
|
|
28
|
+
id: "eb293641-a409-4f13-b122-57534b6abdab",
|
|
29
|
+
type: "wixEditorElements.TimePicker__DEV__v2",
|
|
30
|
+
description: "A time picker input. Visitors type a time into hour/minute segments or step them with arrow keys. The selected time is exposed as an ISO string and can be connected to a data field.",
|
|
31
|
+
installation: {
|
|
32
|
+
initialSize: {
|
|
33
|
+
width: {
|
|
34
|
+
sizingType: LAYOUT.SIZING_TYPE.content
|
|
35
|
+
},
|
|
36
|
+
height: {
|
|
37
|
+
sizingType: LAYOUT.SIZING_TYPE.content
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
editorElement: {
|
|
42
|
+
selector: getSelector(selectors.root),
|
|
43
|
+
displayName: DisplayNames.root.elementDisplayName,
|
|
44
|
+
archetype: Archetype.TextInput,
|
|
45
|
+
layout: {
|
|
46
|
+
resizeDirection: LAYOUT.RESIZE_DIRECTION.horizontalAndVertical,
|
|
47
|
+
contentResizeDirection: LAYOUT.CONTENT_RESIZE_DIRECTION.horizontalAndVertical,
|
|
48
|
+
disableStretching: true,
|
|
49
|
+
disablePositioning: false
|
|
50
|
+
},
|
|
51
|
+
elements: {
|
|
52
|
+
timeInput: {
|
|
53
|
+
elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
|
|
54
|
+
inlineElement: {
|
|
55
|
+
displayName: DisplayNames.root.elements.timeInput,
|
|
56
|
+
selector: getSelector(selectors.group),
|
|
57
|
+
behaviors: { selectable: false },
|
|
58
|
+
cssProperties: {
|
|
59
|
+
background: {},
|
|
60
|
+
columnGap: {},
|
|
61
|
+
...boxBorder,
|
|
62
|
+
...boxPadding
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
data: {
|
|
68
|
+
value: {
|
|
69
|
+
dataType: DATA.DATA_TYPE.localTime,
|
|
70
|
+
displayName: DisplayNames.root.data.value
|
|
71
|
+
},
|
|
72
|
+
a11y: {
|
|
73
|
+
dataType: DATA.DATA_TYPE.a11y,
|
|
74
|
+
[DATA.DATA_TYPE.a11y]: {
|
|
75
|
+
attributes: [DATA.A11Y_ATTRIBUTES.ariaLabel]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
direction: {
|
|
79
|
+
dataType: DATA.DATA_TYPE.direction
|
|
80
|
+
},
|
|
81
|
+
...manifestChangeable(),
|
|
82
|
+
...manifestFocusable()
|
|
83
|
+
},
|
|
84
|
+
displayFilters: {
|
|
85
|
+
data: {
|
|
86
|
+
hide: ["onChange", "onFocus", "onBlur"]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
cssCustomProperties,
|
|
90
|
+
cssProperties
|
|
91
|
+
},
|
|
92
|
+
resources: {
|
|
93
|
+
client: {
|
|
94
|
+
componentUrl: "./site/components/TimePicker/component.tsx",
|
|
95
|
+
dependencies: {
|
|
96
|
+
serviceDependencies: [
|
|
97
|
+
"@wix/viewer-service-environment",
|
|
98
|
+
"@wix/viewer-service-translations"
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
editor: {
|
|
103
|
+
componentUrl: "./site/components/TimePicker/component.preview.tsx"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
moduleConfiguration: {
|
|
107
|
+
package: { name: "@wix/editor-react-components", version: "^1.0.0" },
|
|
108
|
+
component: { path: "site/components/TimePicker" }
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
export {
|
|
112
|
+
manifest as default
|
|
113
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TimeValue } from 'react-aria-components';
|
|
2
|
+
import { TimePickerGranularity } from './TimePicker.types';
|
|
3
|
+
/** Reads a string prop, defaulting an unset/non-string value to empty. */
|
|
4
|
+
export declare const readString: (prop: string | undefined) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Parses an ISO `HH:MM[:SS]` into a React Aria `TimeValue` (or `null`).
|
|
7
|
+
* `parseTime` returns the top-level `@internationalized/date` type while RAC's
|
|
8
|
+
* `TimeValue` comes from its bundled copy — same shape, so bridge with a cast.
|
|
9
|
+
*/
|
|
10
|
+
export declare const toTimeValue: (iso: string) => TimeValue | null;
|
|
11
|
+
/**
|
|
12
|
+
* `TimeValue` → ISO at the active granularity's precision. `Time.toString()`
|
|
13
|
+
* always appends seconds, which would drift minute-level values to `HH:MM:00`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const toIso: (time: TimeValue | null, granularity: TimePickerGranularity) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useRef, useImperativeHandle, useCallback, useMemo } from "react";
|
|
3
3
|
import { p as parseSvg } from "./parseSvg.js";
|
|
4
|
-
import { A as AnimatedSvgIds, a as AnimatedDataAttributes, b as AnimationDirection, T as TestIds, D as DEFAULT_ANIMATION_DURATION } from "./
|
|
4
|
+
import { A as AnimatedSvgIds, a as AnimatedDataAttributes, b as AnimationDirection, T as TestIds, D as DEFAULT_ANIMATION_DURATION } from "./constants21.js";
|
|
5
5
|
import { c as cn } from "./index8.js";
|
|
6
6
|
const AnimatedSvg = forwardRef(
|
|
7
7
|
({ svgContent, reducedMotion = false, duration }, ref) => {
|
|
@@ -7,7 +7,7 @@ import { a as getDataAttributes, g as getQaDataAttributes } from "./dataUtils.js
|
|
|
7
7
|
import { f as formatClassNames } from "./classNames.js";
|
|
8
8
|
import { I as IconAnimationTriggers } from "./Button.types.js";
|
|
9
9
|
import AnimatedIconWithReducedMotion from "../AnimatedIcon/component.js";
|
|
10
|
-
import { T as TRANSITION_DURATION, S as SEMANTIC_CLASS_NAMES, a as TestIds } from "./
|
|
10
|
+
import { T as TRANSITION_DURATION, S as SEMANTIC_CLASS_NAMES, a as TestIds } from "./constants20.js";
|
|
11
11
|
import { d as activateByEnterButton, a as activateBySpaceOrEnterButton, r as removeAriaPrefix, g as getAccessibilityAttributesSpread } from "./a11y.js";
|
|
12
12
|
import { i as isValidLink } from "./Link.js";
|
|
13
13
|
const root = "root__IB9QF";
|