@wix/editor-react-components 1.2775.0 → 1.2777.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.
Files changed (37) hide show
  1. package/dist/site/components/AudioPlayer/component.js +5 -4
  2. package/dist/site/components/Breadcrumbs/component.js +1 -1
  3. package/dist/site/components/Button/component.js +1 -1
  4. package/dist/site/components/Checkbox/component.js +1 -1
  5. package/dist/site/components/CheckboxGroup/component.js +1 -1
  6. package/dist/site/components/CollapsibleText/component.js +1 -1
  7. package/dist/site/components/DatePicker/component.js +622 -7
  8. package/dist/site/components/Lottie/component.js +1 -1
  9. package/dist/site/components/Menu/component.js +1 -1
  10. package/dist/site/components/RadioButtons/component.js +1 -1
  11. package/dist/site/components/Slideshow/component.js +1 -1
  12. package/dist/site/components/TextBox/component.js +1 -1
  13. package/dist/site/components/TextInput/component.js +3 -2
  14. package/dist/site/components/TextMarquee/component.js +6 -6
  15. package/dist/site/components/TimePicker/TimePicker.types.d.ts +14 -39
  16. package/dist/site/components/TimePicker/component.js +81 -547
  17. package/dist/site/components/TimePicker/component.preview.d.ts +7 -2
  18. package/dist/site/components/TimePicker/components/TimePickerField.d.ts +1 -2
  19. package/dist/site/components/TimePicker/constants.d.ts +35 -68
  20. package/dist/site/components/TimePicker/css.css +17 -169
  21. package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +3 -5
  22. package/dist/site/components/TimePicker/manifest.js +246 -152
  23. package/dist/site/components/TimePicker/timePickerUtils.d.ts +8 -8
  24. package/dist/site/components/chunks/Button.js +466 -1055
  25. package/dist/site/components/chunks/Button2.js +284 -471
  26. package/dist/site/components/chunks/DateField.js +51 -673
  27. package/dist/site/components/chunks/Group.js +46 -160
  28. package/dist/site/components/chunks/I18nProvider.js +1 -1
  29. package/dist/site/components/chunks/Input.js +2 -2
  30. package/dist/site/components/chunks/constants2.js +40 -70
  31. package/dist/site/components/chunks/filterDOMProps.js +13 -13
  32. package/dist/site/components/chunks/useFocusable.js +70 -0
  33. package/dist/site/components/chunks/usePress.js +825 -0
  34. package/package.json +2 -2
  35. package/dist/site/components/TimePicker/hooks/useTimeConstraints.d.ts +0 -8
  36. package/dist/site/components/chunks/VisuallyHidden.js +0 -47
  37. package/dist/site/components/chunks/{RequiredIndicator.js → useValidatedField.js} +19 -19
@@ -1,48 +1,18 @@
1
- import { C as CSS_PROPERTIES, b as DISPLAY_GROUPS, D as DATA, E as ELEMENTS, L as LAYOUT, A as Archetype } from "../chunks/chunk-EVX7ZUBD.js";
2
- import { c as DisplayNames, d as defaultValues, e as DesignStates, s as selectors } from "../chunks/constants2.js";
1
+ import { b as DISPLAY_GROUPS, D as DATA, E as ELEMENTS, L as LAYOUT, A as Archetype } from "../chunks/chunk-EVX7ZUBD.js";
2
+ import { b as DisplayNames, c as Descriptions, d as TEXT_PROP_STATIC_VALUE_MAX_LENGTH, P as PREVIEW_ERROR_MESSAGE, s as selectors, D as DesignStates } from "../chunks/constants2.js";
3
3
  import { w as withSpec, g as getSelector } from "../chunks/manifest.js";
4
4
  import { I as IS_SUPPORT_DESIGN_STATE_SPEC } from "../chunks/specs.js";
5
- import { m as manifestFocusable, a as manifestChangeable } from "../chunks/manifestSdkMixins.js";
6
- import { m as manifestValidation } from "../chunks/manifest2.js";
7
- const cssProperties = {
8
- font: {},
9
- color: {},
10
- textAlign: {}
11
- };
12
- const designState = (s) => withSpec({
13
- spec: IS_SUPPORT_DESIGN_STATE_SPEC,
14
- displayName: s.displayName,
15
- className: s.className
16
- });
17
- const cssCustomProperties = {
18
- "label-spacing": {
19
- cssPropertyType: CSS_PROPERTIES.CSS_PROPERTY_TYPE.rowGap,
20
- displayName: DisplayNames.root.cssCustomProperties.labelSpacing,
21
- defaultValue: "6px"
22
- }
23
- };
24
- const fieldBorder = "1px solid var(--wst-system-line-1-color, #dfe5eb)";
25
- const timeInputCssProperties = {
26
- background: { defaultValue: "var(--wst-primary-background-color, #ffffff)" },
27
- boxShadow: { defaultValue: "none" },
28
- borderTop: { defaultValue: fieldBorder },
29
- borderBottom: { defaultValue: fieldBorder },
30
- borderInlineStart: { defaultValue: fieldBorder },
31
- borderInlineEnd: { defaultValue: fieldBorder },
32
- borderStartStartRadius: { defaultValue: "6px" },
33
- borderStartEndRadius: { defaultValue: "6px" },
34
- borderEndStartRadius: { defaultValue: "6px" },
35
- borderEndEndRadius: { defaultValue: "6px" },
36
- paddingTop: { defaultValue: "8px" },
37
- paddingBottom: { defaultValue: "8px" },
38
- paddingInlineStart: { defaultValue: "12px" },
39
- paddingInlineEnd: { defaultValue: "12px" }
40
- };
5
+ const basePresetName = "baseTimePicker";
6
+ const designState = (state) => withSpec({ spec: IS_SUPPORT_DESIGN_STATE_SPEC, ...state });
41
7
  const manifest = {
42
- id: "1b7d0433-671f-4068-b3ba-d6e7a6443833",
43
- type: "wixEditorElements.TimePicker__DEV__v3",
44
- 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.",
8
+ id: "41156bbe-2741-4a01-a715-7eba6e294f0b",
9
+ type: "wixEditorElements.TimePicker__DEV__v7",
10
+ description: Descriptions.component,
45
11
  installation: {
12
+ presets: {
13
+ small: basePresetName,
14
+ large: basePresetName
15
+ },
46
16
  initialSize: {
47
17
  width: {
48
18
  sizingType: LAYOUT.SIZING_TYPE.content
@@ -56,12 +26,121 @@ const manifest = {
56
26
  selector: getSelector(selectors.root),
57
27
  displayName: DisplayNames.root.elementDisplayName,
58
28
  archetype: Archetype.TextInput,
29
+ presets: {
30
+ [basePresetName]: {
31
+ presetCssUrl: `./site/components/TimePicker/presets/${basePresetName}.css`,
32
+ displayName: DisplayNames.root.presets.baseTimePicker,
33
+ presetDefaults: {
34
+ elements: {
35
+ label: {
36
+ cssProperties: {
37
+ marginBottom: {
38
+ defaultValue: "0px"
39
+ },
40
+ textAlign: { defaultValue: "start" },
41
+ font: {
42
+ defaultValue: "normal normal 400 16px/1.3em 'Wix Madefor Text', sans-serif"
43
+ },
44
+ color: {
45
+ defaultValue: "rgba(0, 0, 0, 1)"
46
+ }
47
+ }
48
+ },
49
+ timeInput: {
50
+ cssProperties: {
51
+ textAlign: { defaultValue: "start" },
52
+ font: {
53
+ defaultValue: "normal normal 400 16px/1.3em 'Wix Madefor Text', sans-serif"
54
+ },
55
+ color: {
56
+ defaultValue: "rgba(0, 0, 0, 1)"
57
+ },
58
+ backgroundColor: {
59
+ defaultValue: "transparent"
60
+ },
61
+ boxShadow: { defaultValue: "none" },
62
+ borderTop: {
63
+ defaultValue: "1px solid #000000"
64
+ },
65
+ borderBottom: {
66
+ defaultValue: "1px solid #000000"
67
+ },
68
+ borderInlineStart: {
69
+ defaultValue: "1px solid #000000"
70
+ },
71
+ borderInlineEnd: {
72
+ defaultValue: "1px solid #000000"
73
+ },
74
+ borderStartStartRadius: {
75
+ defaultValue: "0px"
76
+ },
77
+ borderStartEndRadius: {
78
+ defaultValue: "0px"
79
+ },
80
+ borderEndStartRadius: {
81
+ defaultValue: "0px"
82
+ },
83
+ borderEndEndRadius: {
84
+ defaultValue: "0px"
85
+ },
86
+ paddingTop: { defaultValue: "0px" },
87
+ paddingBottom: {
88
+ defaultValue: "0px"
89
+ },
90
+ paddingInlineStart: {
91
+ defaultValue: "0px"
92
+ },
93
+ paddingInlineEnd: {
94
+ defaultValue: "0px"
95
+ }
96
+ }
97
+ },
98
+ helperText: {
99
+ cssProperties: {
100
+ marginTop: { defaultValue: "0px" },
101
+ textAlign: { defaultValue: "start" },
102
+ font: {
103
+ defaultValue: "normal normal 400 14px/1.3em 'Wix Madefor Text', sans-serif"
104
+ },
105
+ color: {
106
+ defaultValue: "rgba(0, 0, 0, 1)"
107
+ }
108
+ }
109
+ },
110
+ segment: {
111
+ cssProperties: {
112
+ backgroundColor: {
113
+ defaultValue: "transparent"
114
+ },
115
+ color: {
116
+ defaultValue: "inherit"
117
+ }
118
+ }
119
+ },
120
+ errorMessage: {
121
+ cssProperties: {
122
+ marginTop: { defaultValue: "0px" },
123
+ textAlign: { defaultValue: "start" },
124
+ font: {
125
+ defaultValue: "normal normal 400 14px/1.3em 'Wix Madefor Text', sans-serif"
126
+ },
127
+ color: { defaultValue: "rgba(0, 0, 0, 1)" }
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
133
+ },
59
134
  layout: {
60
- resizeDirection: LAYOUT.RESIZE_DIRECTION.horizontalAndVertical,
135
+ resizeDirection: LAYOUT.RESIZE_DIRECTION.horizontal,
61
136
  contentResizeDirection: LAYOUT.CONTENT_RESIZE_DIRECTION.horizontalAndVertical,
62
137
  disableStretching: true,
63
138
  disablePositioning: false
64
139
  },
140
+ states: {
141
+ previewError: { props: { previewError: true } }
142
+ },
143
+ displayFilters: { states: { hide: ["previewError"] } },
65
144
  elements: {
66
145
  label: {
67
146
  elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
@@ -69,7 +148,17 @@ const manifest = {
69
148
  displayName: DisplayNames.root.elements.label,
70
149
  selector: getSelector(selectors.label),
71
150
  behaviors: { selectable: false },
72
- cssProperties: { font: {}, color: {} }
151
+ cssProperties: {
152
+ marginBottom: {},
153
+ textAlign: {},
154
+ font: {},
155
+ color: {},
156
+ letterSpacing: {},
157
+ lineHeight: {},
158
+ textDecorationLine: {},
159
+ textTransform: {},
160
+ textShadow: {}
161
+ }
73
162
  }
74
163
  },
75
164
  timeInput: {
@@ -78,21 +167,58 @@ const manifest = {
78
167
  displayName: DisplayNames.root.elements.timeInput,
79
168
  selector: getSelector(selectors.group),
80
169
  behaviors: { selectable: false },
81
- cssProperties: timeInputCssProperties,
170
+ cssProperties: {
171
+ textAlign: {},
172
+ font: {},
173
+ color: {},
174
+ letterSpacing: {},
175
+ lineHeight: {},
176
+ textDecorationLine: {},
177
+ textTransform: {},
178
+ textShadow: {},
179
+ backgroundColor: {},
180
+ boxShadow: {},
181
+ borderTop: {},
182
+ borderBottom: {},
183
+ borderInlineStart: {},
184
+ borderInlineEnd: {},
185
+ borderStartStartRadius: {},
186
+ borderStartEndRadius: {},
187
+ borderEndStartRadius: {},
188
+ borderEndEndRadius: {},
189
+ paddingTop: {},
190
+ paddingBottom: {},
191
+ paddingInlineStart: {},
192
+ paddingInlineEnd: {}
193
+ },
82
194
  states: {
83
195
  hover: designState(DesignStates.timeInput.hover),
84
196
  focus: designState(DesignStates.timeInput.focus),
197
+ error: {
198
+ ...designState(DesignStates.timeInput.error),
199
+ props: { errorMessage: PREVIEW_ERROR_MESSAGE }
200
+ },
85
201
  disabled: designState(DesignStates.timeInput.disabled)
86
202
  }
87
203
  }
88
204
  },
89
- description: {
205
+ helperText: {
90
206
  elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
91
207
  inlineElement: {
92
- displayName: DisplayNames.root.elements.description,
208
+ displayName: DisplayNames.root.elements.helperText,
93
209
  selector: getSelector(selectors.description),
94
210
  behaviors: { selectable: false },
95
- cssProperties: { font: {}, color: {} }
211
+ cssProperties: {
212
+ marginTop: {},
213
+ textAlign: {},
214
+ font: {},
215
+ color: {},
216
+ letterSpacing: {},
217
+ lineHeight: {},
218
+ textDecorationLine: {},
219
+ textTransform: {},
220
+ textShadow: {}
221
+ }
96
222
  }
97
223
  },
98
224
  segment: {
@@ -101,111 +227,72 @@ const manifest = {
101
227
  displayName: DisplayNames.root.elements.segment,
102
228
  selector: getSelector(selectors.segment),
103
229
  behaviors: { selectable: false },
104
- cssProperties: { background: {}, color: {} },
230
+ cssProperties: {
231
+ backgroundColor: {},
232
+ color: {}
233
+ },
105
234
  states: {
106
235
  focus: designState(DesignStates.segment.focus)
107
236
  }
108
237
  }
238
+ },
239
+ errorMessage: {
240
+ elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
241
+ inlineElement: {
242
+ displayName: DisplayNames.root.elements.errorMessage,
243
+ selector: getSelector(selectors.errorMessage),
244
+ behaviors: { selectable: false, removable: false },
245
+ cssProperties: {
246
+ marginTop: {},
247
+ textAlign: {},
248
+ font: {},
249
+ color: {},
250
+ letterSpacing: {},
251
+ lineHeight: {},
252
+ textDecorationLine: {},
253
+ textTransform: {},
254
+ textShadow: {}
255
+ },
256
+ visibleState: { stateKey: "previewError", elementPath: ".root" }
257
+ }
109
258
  }
110
259
  },
111
260
  data: {
112
261
  value: {
113
262
  dataType: DATA.DATA_TYPE.localTime,
114
- displayName: DisplayNames.root.data.value
115
- },
116
- defaultValue: {
117
- dataType: DATA.DATA_TYPE.localTime,
118
- displayName: DisplayNames.root.data.defaultValue
119
- },
120
- granularity: {
121
- dataType: DATA.DATA_TYPE.textEnum,
122
- displayName: DisplayNames.root.data.granularity.displayName,
123
- [DATA.DATA_TYPE.textEnum]: {
124
- options: [
125
- {
126
- value: "hour",
127
- displayName: DisplayNames.root.data.granularity.options.hour
128
- },
129
- {
130
- value: "minute",
131
- displayName: DisplayNames.root.data.granularity.options.minute
132
- },
133
- {
134
- value: "second",
135
- displayName: DisplayNames.root.data.granularity.options.second
136
- }
137
- ]
138
- },
139
- defaultValue: defaultValues.granularity
140
- },
141
- hourCycle: {
142
- dataType: DATA.DATA_TYPE.textEnum,
143
- displayName: DisplayNames.root.data.hourCycle.displayName,
144
- [DATA.DATA_TYPE.textEnum]: {
145
- options: [
146
- {
147
- value: "auto",
148
- displayName: DisplayNames.root.data.hourCycle.options.auto
149
- },
150
- {
151
- value: "12",
152
- displayName: DisplayNames.root.data.hourCycle.options.h12
153
- },
154
- {
155
- value: "24",
156
- displayName: DisplayNames.root.data.hourCycle.options.h24
157
- }
158
- ]
159
- },
160
- defaultValue: defaultValues.hourCycle
161
- },
162
- shouldForceLeadingZeros: {
163
- dataType: DATA.DATA_TYPE.booleanValue,
164
- displayName: DisplayNames.root.data.shouldForceLeadingZeros,
165
- defaultValue: defaultValues.shouldForceLeadingZeros
263
+ displayName: DisplayNames.root.data.value,
264
+ description: Descriptions.root.data.value
166
265
  },
167
266
  label: {
168
267
  dataType: DATA.DATA_TYPE.text,
169
268
  displayName: DisplayNames.root.data.label,
170
- defaultValue: defaultValues.label
269
+ [DATA.DATA_TYPE.text]: {
270
+ maxLength: TEXT_PROP_STATIC_VALUE_MAX_LENGTH
271
+ }
171
272
  },
172
- tooltip: {
273
+ helperText: {
173
274
  dataType: DATA.DATA_TYPE.text,
174
- displayName: DisplayNames.root.data.tooltip,
175
- defaultValue: defaultValues.tooltip
275
+ displayName: DisplayNames.root.data.helperText,
276
+ [DATA.DATA_TYPE.text]: {
277
+ maxLength: TEXT_PROP_STATIC_VALUE_MAX_LENGTH
278
+ },
279
+ description: Descriptions.root.data.helperText
176
280
  },
177
- description: {
281
+ errorMessage: {
178
282
  dataType: DATA.DATA_TYPE.text,
179
- displayName: DisplayNames.root.data.description,
180
- defaultValue: defaultValues.description
181
- },
182
- minTime: {
183
- dataType: DATA.DATA_TYPE.localTime,
184
- displayName: DisplayNames.root.data.minTime
185
- },
186
- maxTime: {
187
- dataType: DATA.DATA_TYPE.localTime,
188
- displayName: DisplayNames.root.data.maxTime
189
- },
190
- required: {
191
- dataType: DATA.DATA_TYPE.booleanValue,
192
- displayName: DisplayNames.root.data.required,
193
- defaultValue: defaultValues.required
283
+ displayName: DisplayNames.root.data.errorMessage,
284
+ [DATA.DATA_TYPE.text]: {
285
+ maxLength: TEXT_PROP_STATIC_VALUE_MAX_LENGTH
286
+ },
287
+ description: Descriptions.root.data.errorMessage
194
288
  },
195
289
  readOnly: {
196
290
  dataType: DATA.DATA_TYPE.booleanValue,
197
- displayName: DisplayNames.root.data.readOnly,
198
- defaultValue: defaultValues.readOnly
199
- },
200
- isDisabled: {
201
- dataType: DATA.DATA_TYPE.booleanValue,
202
- displayName: DisplayNames.root.data.disabled,
203
- defaultValue: defaultValues.disabled
291
+ displayName: DisplayNames.root.data.readOnly
204
292
  },
205
- clearable: {
293
+ disabled: {
206
294
  dataType: DATA.DATA_TYPE.booleanValue,
207
- displayName: DisplayNames.root.data.clearable,
208
- defaultValue: defaultValues.clearable
295
+ displayName: DisplayNames.root.data.disabled
209
296
  },
210
297
  a11y: {
211
298
  dataType: DATA.DATA_TYPE.a11y,
@@ -216,39 +303,46 @@ const manifest = {
216
303
  direction: {
217
304
  dataType: DATA.DATA_TYPE.direction
218
305
  },
219
- ...manifestChangeable(),
220
- ...manifestFocusable(),
221
- // The bound value is an ISO time string, so `onValidate` carries text.
222
- ...manifestValidation({ valueDataType: DATA.DATA_TYPE.text })
223
- },
224
- displayFilters: {
225
- data: {
226
- hide: ["onChange", "onFocus", "onBlur"]
306
+ onValueChange: {
307
+ dataType: DATA.DATA_TYPE.function,
308
+ displayName: DisplayNames.root.data.onValueChange,
309
+ [DATA.DATA_TYPE.function]: {
310
+ parameters: [
311
+ {
312
+ dataType: DATA.DATA_TYPE.localTime,
313
+ displayName: DisplayNames.root.parameters.value
314
+ }
315
+ ]
316
+ }
227
317
  }
228
318
  },
229
319
  displayGroups: {
320
+ partsOrder: {
321
+ groupType: DISPLAY_GROUPS.GROUP_TYPE.elements,
322
+ elements: {
323
+ items: [
324
+ "label",
325
+ "timeInput",
326
+ "segment",
327
+ "helperText",
328
+ "errorMessage"
329
+ ]
330
+ }
331
+ },
230
332
  orderedDataGroup: {
231
333
  groupType: DISPLAY_GROUPS.GROUP_TYPE.data,
232
334
  data: {
233
335
  items: [
234
- "required",
235
- "readOnly",
236
- "isDisabled",
237
- "clearable",
238
- "granularity",
239
- "hourCycle",
240
- "shouldForceLeadingZeros",
241
336
  "label",
242
- "tooltip",
243
- "description",
244
- "minTime",
245
- "maxTime"
337
+ "value",
338
+ "helperText",
339
+ "errorMessage",
340
+ "readOnly",
341
+ "disabled"
246
342
  ]
247
343
  }
248
344
  }
249
- },
250
- cssCustomProperties,
251
- cssProperties
345
+ }
252
346
  },
253
347
  resources: {
254
348
  client: {
@@ -1,17 +1,17 @@
1
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;
2
+ /** Reads a text prop, defaulting an unset/non-string value to `fallback`. */
3
+ export declare const readText: (prop: string | undefined, fallback: string) => string;
5
4
  /** Reads a boolean prop, defaulting an unset/non-boolean value to `fallback`. */
6
5
  export declare const readBool: (prop: boolean | undefined, fallback: boolean) => boolean;
7
6
  /**
8
- * Parses an ISO `HH:MM[:SS]` into a React Aria `TimeValue` (or `null`).
7
+ * Parses a local time `HH:MM[:SS]` value into a React Aria `TimeValue` (or `null`).
9
8
  * `parseTime` returns the top-level `@internationalized/date` type while RAC's
10
9
  * `TimeValue` comes from its bundled copy — same shape, so bridge with a cast.
11
10
  */
12
- export declare const toTimeValue: (iso: string) => TimeValue | null;
11
+ export declare const toTimeValue: (localTime: string | undefined) => TimeValue | null;
13
12
  /**
14
- * `TimeValue` → ISO at the active granularity's precision. `Time.toString()`
15
- * always appends seconds, which would drift minute-level values to `HH:MM:00`.
13
+ * `TimeValue` → minute-level local-time value. `Time.toString()` always appends
14
+ * seconds, which would drift values to `HH:MM:00`. An empty field maps to
15
+ * `undefined`, since no local-time value exists.
16
16
  */
17
- export declare const toIso: (time: TimeValue | null, granularity: TimePickerGranularity) => string;
17
+ export declare const toLocalTime: (time: TimeValue | null) => string | undefined;