@wix/editor-react-components 1.2310.0 → 1.2312.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 (29) hide show
  1. package/dist/site/components/AudioPlayer/component.js +3 -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/CollapsibleText/component.js +1 -1
  5. package/dist/site/components/DatePicker/component.js +8 -965
  6. package/dist/site/components/Lottie/component.js +1 -1
  7. package/dist/site/components/Menu/component.js +1 -1
  8. package/dist/site/components/Slideshow/component.js +1 -1
  9. package/dist/site/components/TextInput/component.js +2 -3
  10. package/dist/site/components/TextMarquee/component.js +6 -6
  11. package/dist/site/components/TimePicker/TimePicker.types.d.ts +31 -0
  12. package/dist/site/components/TimePicker/component.js +119 -17
  13. package/dist/site/components/TimePicker/constants.d.ts +63 -1
  14. package/dist/site/components/TimePicker/css.css +126 -0
  15. package/dist/site/components/TimePicker/hooks/useTimeConstraints.d.ts +8 -0
  16. package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +2 -1
  17. package/dist/site/components/TimePicker/manifest.js +142 -3
  18. package/dist/site/components/TimePicker/timePickerUtils.d.ts +2 -0
  19. package/dist/site/components/chunks/Button.js +1057 -347
  20. package/dist/site/components/chunks/Button2.js +351 -285
  21. package/dist/site/components/chunks/Group.js +160 -47
  22. package/dist/site/components/chunks/Input.js +14 -14
  23. package/dist/site/components/chunks/{DateField.js → Tooltip.js} +1017 -52
  24. package/dist/site/components/chunks/VisuallyHidden.js +47 -0
  25. package/dist/site/components/chunks/constants2.js +62 -4
  26. package/dist/site/components/chunks/filterDOMProps.js +3 -3
  27. package/package.json +6 -3
  28. package/dist/site/components/chunks/useFocusable.js +0 -118
  29. package/dist/site/components/chunks/usePress.js +0 -825
@@ -4,7 +4,7 @@ var __publicField = (obj, key2, value2) => __defNormalProp(obj, typeof key2 !==
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { c as clsx } from "../chunks/clsx.js";
6
6
  import { d as directionStyles } from "../chunks/direction.module.js";
7
- import { B as Button } from "../chunks/Button.js";
7
+ import { B as Button } from "../chunks/Button2.js";
8
8
  import { s as semanticSelectors, r as rootDataDefaults, d as displayPropertyToObserve, a as ariaLabels, t as testIds, p as pauseIconSvg, b as playIconSvg, c as showButtonOnHoverDefaults } from "../chunks/constants27.js";
9
9
  import { g as getDefaultExportFromCjs } from "../chunks/_commonjsHelpers.js";
10
10
  import React__default, { useEffect, useState, useRef, useMemo } from "react";
@@ -15,7 +15,7 @@ import { i as isEmptyObject, a as getDataAttributes } from "../chunks/dataUtils.
15
15
  import { u as useResizeObserver } from "../chunks/useResizeObserver.js";
16
16
  import { d as directionStyles } from "../chunks/direction.module.js";
17
17
  import { E as EnvironmentDefinition } from "../chunks/index2.js";
18
- import { B as Button } from "../chunks/Button.js";
18
+ import { B as Button } from "../chunks/Button2.js";
19
19
  import { f as convertA11yKeysToHtmlFormat } from "../chunks/a11y.js";
20
20
  const AnchorsDefinition = defineService("@wix/viewer-service-anchors");
21
21
  const EMPTY_ANCHOR_URL = "#";
@@ -2,7 +2,7 @@ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import { useState, useRef, useEffect, useCallback, useMemo } from "react";
3
3
  import { c as clsx } from "../chunks/clsx.js";
4
4
  import { M as MOVEMENT_DIRECTION, A as AUTOPLAY_STATE, s as slideshowDataDefaults, a as semanticClassNames, S as SLIDESHOW_SLIDE_LTR_DIRECTION_EXPERIMENT } from "../chunks/Slideshow.semanticClassNames.js";
5
- import { B as Button } from "../chunks/Button.js";
5
+ import { B as Button } from "../chunks/Button2.js";
6
6
  import { p as presetWrapperStyles } from "../chunks/presetWrapper.module.js";
7
7
  import { d as directionStyles } from "../chunks/direction.module.js";
8
8
  import { useService } from "@wix/services-manager-react";
@@ -8,10 +8,9 @@ import { a as getDataAttributes } from "../chunks/dataUtils.js";
8
8
  import { s as selectors } from "../chunks/constants3.js";
9
9
  import { useService } from "@wix/services-manager-react";
10
10
  import { T as TranslationsDefinition } from "../chunks/index5.js";
11
- import { $ as $fd2148440a13ec26$export$fc1a364ae1f3ff10, a as $191c9b6d48a0a4e2$export$294aa081a6c6f55d, b as $860f7da480e22816$export$b8473d3665f3a75a, c as $d3e0e05bdfcf66bd$export$c24727297075ec6a, d as $3985021b0ad6602f$export$37fb8590cf2c088c, e as $514c0188e459b4c0$export$9afb8bc826b033ea, f as $ee014567cb39d3f0$export$ff05c3ac10437e03, g as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../chunks/Input.js";
12
- import { a as $3e6197669829fe11$export$40bfa8c7b0832715, b as $3274bf1495747a7b$export$5add1d006293d136, c as $bbaa08b3cd72f041$export$9d1611c77c2fe928, d as $23f2114a1b82827e$export$e58f029f0fbfdb29, e as $01b77f81d0f07f68$export$75b6ee27786ba447, f as $a049562f99e7db0e$export$f9c6924e160136d1, g as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../chunks/Group.js";
11
+ import { a as $fd2148440a13ec26$export$fc1a364ae1f3ff10, b as $191c9b6d48a0a4e2$export$294aa081a6c6f55d, c as $860f7da480e22816$export$b8473d3665f3a75a, d as $d3e0e05bdfcf66bd$export$c24727297075ec6a, e as $3985021b0ad6602f$export$37fb8590cf2c088c, f as $514c0188e459b4c0$export$9afb8bc826b033ea, g as $ee014567cb39d3f0$export$ff05c3ac10437e03, h as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../chunks/Input.js";
12
+ import { b as $3e6197669829fe11$export$40bfa8c7b0832715, c as $d1116acdf220c2da$export$4c014de7c8940b4c, d as $3274bf1495747a7b$export$5add1d006293d136, e as $bbaa08b3cd72f041$export$9d1611c77c2fe928, f as $23f2114a1b82827e$export$e58f029f0fbfdb29, g as $01b77f81d0f07f68$export$75b6ee27786ba447, h as $a049562f99e7db0e$export$f9c6924e160136d1, a as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../chunks/Group.js";
13
13
  import { $ as $8e9d2fae0ecb9001$export$457c3d6518dd4c6f, a as $f39a9eba43920ace$export$86427a43e3e48ebb, b as $64fa3d84918910a7$export$29f1550f4b0d4415, c as $64fa3d84918910a7$export$fabf2dc03a41866e, d as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, e as $64fa3d84918910a7$export$ef03459518577ad4, f as $64fa3d84918910a7$export$4d86445c2cf5e3, g as $65484d02dcb7eb3e$export$457c3d6518dd4c6f, h as $64fa3d84918910a7$export$2881499e37b75b9a } from "../chunks/filterDOMProps.js";
14
- import { $ as $d1116acdf220c2da$export$4c014de7c8940b4c } from "../chunks/useFocusable.js";
15
14
  import { S as SdkStateDefinition } from "../chunks/index6.js";
16
15
  const $8e6cc465cc68f603$export$698f465ec27e93df = /* @__PURE__ */ createContext(null);
17
16
  function $054f71d2330da2e3$export$712718f7aec83d5(props, ref) {
@@ -5,6 +5,12 @@ import { c as clsx } from "../chunks/clsx.js";
5
5
  import { L as Link } from "../chunks/Link.js";
6
6
  import { f as formatClassNames } from "../chunks/classNames.js";
7
7
  import { p as parseSvg } from "../chunks/parseSvg.js";
8
+ const PauseSmall = ({ size, ...props }) => /* @__PURE__ */ React.createElement("svg", { viewBox: "0 0 18 18", fill: "currentColor", width: size || "18", height: size || "18", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M7.5,5 C8.32842712,5 9,5.67157288 9,6.5 L9,11.5 C9,12.3284271 8.32842712,13 7.5,13 C6.67157288,13 6,12.3284271 6,11.5 L6,6.5 C6,5.67157288 6.67157288,5 7.5,5 Z M11.5,5 C12.3284271,5 13,5.67157288 13,6.5 L13,11.5 C13,12.3284271 12.3284271,13 11.5,13 C10.6715729,13 10,12.3284271 10,11.5 L10,6.5 C10,5.67157288 10.6715729,5 11.5,5 Z M7.5,6 C7.22385763,6 7,6.22385763 7,6.5 L7,11.5 C7,11.7761424 7.22385763,12 7.5,12 C7.77614237,12 8,11.7761424 8,11.5 L8,6.5 C8,6.22385763 7.77614237,6 7.5,6 Z M11.5,6 C11.2238576,6 11,6.22385763 11,6.5 L11,11.5 C11,11.7761424 11.2238576,12 11.5,12 C11.7761424,12 12,11.7761424 12,11.5 L12,6.5 C12,6.22385763 11.7761424,6 11.5,6 Z" }));
9
+ PauseSmall.displayName = "PauseSmall";
10
+ var PauseSmall_default = PauseSmall;
11
+ const PlaySmall = ({ size, ...props }) => /* @__PURE__ */ React.createElement("svg", { viewBox: "0 0 18 18", fill: "currentColor", width: size || "18", height: size || "18", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M6.87468837,5.45041947 L12.7318793,8.46657119 C13.20163,8.68731241 13.20163,9.26940918 12.7318793,9.53342881 L6.87468837,12.5495805 C6.58008377,12.7012867 6.00070071,12.5801226 6,12.0161517 L6,5.98384828 C6,5.65247743 6.35266876,5.20682168 6.87468837,5.45041947 Z M7,11.3602529 L11.5834735,9 L7,6.63974714 L7,11.3602529 Z" }));
12
+ PlaySmall.displayName = "PlaySmall";
13
+ var PlaySmall_default = PlaySmall;
8
14
  const semanticClassNames = {
9
15
  root: "text-marquee",
10
16
  text: "text-marquee__text"
@@ -47,12 +53,6 @@ const TestIds = {
47
53
  marqueeUnit: "marquee-unit",
48
54
  headingTag: "heading-tag"
49
55
  };
50
- const PauseSmall = ({ size, ...props }) => /* @__PURE__ */ React.createElement("svg", { viewBox: "0 0 18 18", fill: "currentColor", width: size || "18", height: size || "18", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M7.5,5 C8.32842712,5 9,5.67157288 9,6.5 L9,11.5 C9,12.3284271 8.32842712,13 7.5,13 C6.67157288,13 6,12.3284271 6,11.5 L6,6.5 C6,5.67157288 6.67157288,5 7.5,5 Z M11.5,5 C12.3284271,5 13,5.67157288 13,6.5 L13,11.5 C13,12.3284271 12.3284271,13 11.5,13 C10.6715729,13 10,12.3284271 10,11.5 L10,6.5 C10,5.67157288 10.6715729,5 11.5,5 Z M7.5,6 C7.22385763,6 7,6.22385763 7,6.5 L7,11.5 C7,11.7761424 7.22385763,12 7.5,12 C7.77614237,12 8,11.7761424 8,11.5 L8,6.5 C8,6.22385763 7.77614237,6 7.5,6 Z M11.5,6 C11.2238576,6 11,6.22385763 11,6.5 L11,11.5 C11,11.7761424 11.2238576,12 11.5,12 C11.7761424,12 12,11.7761424 12,11.5 L12,6.5 C12,6.22385763 11.7761424,6 11.5,6 Z" }));
51
- PauseSmall.displayName = "PauseSmall";
52
- var PauseSmall_default = PauseSmall;
53
- const PlaySmall = ({ size, ...props }) => /* @__PURE__ */ React.createElement("svg", { viewBox: "0 0 18 18", fill: "currentColor", width: size || "18", height: size || "18", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M6.87468837,5.45041947 L12.7318793,8.46657119 C13.20163,8.68731241 13.20163,9.26940918 12.7318793,9.53342881 L6.87468837,12.5495805 C6.58008377,12.7012867 6.00070071,12.5801226 6,12.0161517 L6,5.98384828 C6,5.65247743 6.35266876,5.20682168 6.87468837,5.45041947 Z M7,11.3602529 L11.5834735,9 L7,6.63974714 L7,11.3602529 Z" }));
54
- PlaySmall.displayName = "PlaySmall";
55
- var PlaySmall_default = PlaySmall;
56
56
  const PlayPauseButton = ({
57
57
  isPlaying,
58
58
  onToggle,
@@ -5,6 +5,8 @@ import { TranslationKeys } from './constants';
5
5
  export type TranslationKey = keyof typeof TranslationKeys;
6
6
  /** Smallest editable time unit (React Aria `granularity`). */
7
7
  export type TimePickerGranularity = 'hour' | 'minute' | 'second';
8
+ /** `auto` defers to the locale; `12`/`24` force the hour cycle. */
9
+ export type TimePickerHourCycle = 'auto' | '12' | '24';
8
10
  export type TimePickerProps = Omit<SdkFunctionChangeableProps, 'onChange'> & SdkFunctionFocusableProps & {
9
11
  /** Fires with the selected ISO time string (`HH:MM[:SS]`), or `''` when cleared. */
10
12
  onChange?: (value: string) => void;
@@ -12,11 +14,40 @@ export type TimePickerProps = Omit<SdkFunctionChangeableProps, 'onChange'> & Sdk
12
14
  id: string;
13
15
  /** Appended to the root `.timePicker`. Use this for CSS-variable and per-element overrides. */
14
16
  className: string;
17
+ /** Smallest editable unit: hour-only, hour+minute, or hour+minute+second segments. */
18
+ granularity?: TimePickerGranularity;
19
+ /** Forces a 12- or 24-hour clock; `auto` follows the locale. */
20
+ hourCycle?: TimePickerHourCycle;
21
+ /** Pads single-digit segments with a leading zero (locale default when off). */
22
+ shouldForceLeadingZeros?: boolean;
15
23
  /**
16
24
  * The selected time as an ISO 24h `HH:MM[:SS]` string. The empty string
17
25
  * means no time is selected.
18
26
  */
19
27
  value: string;
28
+ /** Optional text label rendered above the field. */
29
+ label: string;
30
+ /**
31
+ * ISO `HH:MM` time that seeds the empty field (React Aria `placeholderValue`
32
+ * — e.g. which hour the segments start at).
33
+ */
34
+ placeholder: string;
35
+ /** Site-facing helper text rendered under the field. */
36
+ description?: string;
37
+ /** Hint text revealed from an info icon next to the label. */
38
+ tooltip?: string;
39
+ /** Earliest selectable time as an ISO `HH:MM` string. */
40
+ minTime?: string;
41
+ /** Latest selectable time as an ISO `HH:MM` string. */
42
+ maxTime?: string;
43
+ /** Marks the field required for form submission. */
44
+ required?: boolean;
45
+ /** Shows the time but blocks editing. */
46
+ readOnly?: boolean;
47
+ /** Renders a clear (✕) control that empties the value. */
48
+ clearable?: boolean;
49
+ /** Disables interaction with the time picker. */
50
+ isDisabled?: boolean;
20
51
  /** Writing direction applied to the root. */
21
52
  direction?: Direction;
22
53
  /** Accessibility attributes. `ariaLabel` labels the time picker for assistive tech. */
@@ -1,6 +1,10 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useMemo } from "react";
2
3
  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 $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../chunks/Button.js";
5
+ import { $ as $58246871e4652552$export$c9698ec7f05a07e1, a as $40825cdb76e74f70$export$7edc06cf1783b30f, b as $40825cdb76e74f70$export$336ab7fa954c4b5f, c as $40825cdb76e74f70$export$5eaee2322dd727eb, d as $4e3b923658d69c60$export$8c610744efcf8a1d, e as $4e3b923658d69c60$export$28c660c63b792dea } from "../chunks/Tooltip.js";
6
+ import { $ as $a049562f99e7db0e$export$eb2fcfdbd7ba97d4, a as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../chunks/Group.js";
7
+ import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6 } from "../chunks/Input.js";
4
8
  import { $ as $2eb8e6d23f3d0cb0$export$a54013f0d02a8f82 } from "../chunks/I18nProvider.js";
5
9
  import { useService } from "@wix/services-manager-react";
6
10
  import { E as EnvironmentDefinition } from "../chunks/index2.js";
@@ -8,9 +12,9 @@ import { T as TranslationsDefinition } from "../chunks/index5.js";
8
12
  import { a as getDataAttributes } from "../chunks/dataUtils.js";
9
13
  import { d as directionStyles } from "../chunks/direction.module.js";
10
14
  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";
15
+ import { E as EMPTY_VALUE, T as TestIds, s as selectors, a as TRANSLATIONS_NAMESPACE, d as defaultValues, H as HourCycleValues, D as DefaultTranslations, b as TranslationKeys } from "../chunks/constants2.js";
16
+ import { D as DismissSmall_default } from "../chunks/DismissSmall.js";
17
+ import { I as InfoCircleSmall_default } from "../chunks/InfoCircleSmall.js";
14
18
  const getTranslation = (translate, key, translationKeys, defaultTranslations) => {
15
19
  const translationKey = translationKeys[key];
16
20
  const translated = translate(translationKey);
@@ -18,17 +22,32 @@ const getTranslation = (translate, key, translationKeys, defaultTranslations) =>
18
22
  };
19
23
  const timePicker = "timePicker__j78My";
20
24
  const root = "root__dzkbY";
25
+ const labelRow = "labelRow__qoC8g";
26
+ const label = "label__THO5j";
27
+ const tooltipButton = "tooltipButton__ISWIR";
28
+ const tooltip = "tooltip__FTZhM";
21
29
  const group = "group__6HZy7";
22
30
  const field = "field__mnQwh";
31
+ const description = "description__ePprf";
23
32
  const segment = "segment__OtazP";
33
+ const clearButton = "clearButton__Bto7s";
34
+ const clearIcon = "clearIcon__x11eI";
24
35
  const styles = {
25
36
  timePicker,
26
37
  root,
38
+ labelRow,
39
+ label,
40
+ tooltipButton,
41
+ tooltip,
27
42
  group,
28
43
  field,
29
- segment
44
+ description,
45
+ segment,
46
+ clearButton,
47
+ clearIcon
30
48
  };
31
49
  const readString = (prop) => typeof prop === "string" ? prop : EMPTY_VALUE;
50
+ const readBool = (prop, fallback) => typeof prop === "boolean" ? prop : fallback;
32
51
  const toTimeValue = (iso) => {
33
52
  if (!iso) {
34
53
  return null;
@@ -48,19 +67,20 @@ const toIso = (time, granularity) => {
48
67
  return granularity === "second" ? `${hoursAndMinutes}:${pad(time.second)}` : hoursAndMinutes;
49
68
  };
50
69
  const useTimePickerValue = (params) => {
51
- const { value, onChange } = params;
70
+ const { value, onChange, granularity } = params;
52
71
  const valueStr = readString(value);
53
72
  const [timeValue, setTimeValue] = useState(
54
73
  () => toTimeValue(valueStr)
55
74
  );
56
- const [prevValueStr, setPrevValueStr] = useState(valueStr);
57
- if (prevValueStr !== valueStr) {
58
- setPrevValueStr(valueStr);
75
+ const syncSignature = `${valueStr}::${granularity}`;
76
+ const [prevSignature, setPrevSignature] = useState(syncSignature);
77
+ if (prevSignature !== syncSignature) {
78
+ setPrevSignature(syncSignature);
59
79
  setTimeValue(toTimeValue(valueStr));
60
80
  }
61
81
  const handleChange = (next) => {
62
82
  setTimeValue(next);
63
- onChange(toIso(next, "minute"));
83
+ onChange(toIso(next, granularity));
64
84
  };
65
85
  return {
66
86
  timeValue,
@@ -68,9 +88,20 @@ const useTimePickerValue = (params) => {
68
88
  hasValue: Boolean(valueStr)
69
89
  };
70
90
  };
91
+ const useTimeConstraints = (params) => {
92
+ const minTimeStr = readString(params.minTime);
93
+ const maxTimeStr = readString(params.maxTime);
94
+ return useMemo(
95
+ () => ({
96
+ minValue: toTimeValue(minTimeStr) ?? void 0,
97
+ maxValue: toTimeValue(maxTimeStr) ?? void 0
98
+ }),
99
+ [minTimeStr, maxTimeStr]
100
+ );
101
+ };
71
102
  const renderSegments = (segment2) => /* @__PURE__ */ jsx($40825cdb76e74f70$export$336ab7fa954c4b5f, { segment: segment2, className: styles.segment });
72
103
  const TimePickerField = ({
73
- clearButton
104
+ clearButton: clearButton2
74
105
  }) => /* @__PURE__ */ jsxs(
75
106
  $a049562f99e7db0e$export$eb2fcfdbd7ba97d4,
76
107
  {
@@ -78,7 +109,7 @@ const TimePickerField = ({
78
109
  "data-testid": TestIds.group,
79
110
  children: [
80
111
  /* @__PURE__ */ jsx($40825cdb76e74f70$export$7edc06cf1783b30f, { className: styles.field, "data-testid": TestIds.field, children: renderSegments }),
81
- clearButton
112
+ clearButton2
82
113
  ]
83
114
  }
84
115
  );
@@ -92,6 +123,11 @@ function TimePicker(props) {
92
123
  const {
93
124
  id,
94
125
  className = "",
126
+ granularity = defaultValues.granularity,
127
+ hourCycle = defaultValues.hourCycle,
128
+ shouldForceLeadingZeros = defaultValues.shouldForceLeadingZeros,
129
+ readOnly = defaultValues.readOnly,
130
+ clearable = defaultValues.clearable,
95
131
  direction,
96
132
  a11y,
97
133
  onChange = noop,
@@ -99,12 +135,42 @@ function TimePicker(props) {
99
135
  onBlur = noop,
100
136
  wix
101
137
  } = props;
102
- const { timeValue, handleChange } = useTimePickerValue({
138
+ const label2 = readString(props.label);
139
+ const description2 = readString(props.description);
140
+ const tooltip2 = readString(props.tooltip);
141
+ const isDisabled = readBool(props.isDisabled, false);
142
+ const isRequired = readBool(props.required, defaultValues.required);
143
+ const placeholderStr = readString(props.placeholder);
144
+ const placeholderValue = useMemo(
145
+ () => toTimeValue(placeholderStr) ?? void 0,
146
+ [placeholderStr]
147
+ );
148
+ const { timeValue, handleChange, hasValue } = useTimePickerValue({
103
149
  value: props.value,
104
- onChange
150
+ onChange,
151
+ granularity
152
+ });
153
+ const { minValue, maxValue } = useTimeConstraints({
154
+ minTime: props.minTime,
155
+ maxTime: props.maxTime
105
156
  });
157
+ const [portalContainer, setPortalContainer] = useState(
158
+ null
159
+ );
106
160
  const locale = environmentService.language || "en-US";
107
- const ariaLabel = (a11y == null ? void 0 : a11y.ariaLabel) || t("ariaLabel");
161
+ const ariaLabel = (a11y == null ? void 0 : a11y.ariaLabel) || label2 || t("ariaLabel");
162
+ const showClear = clearable && hasValue && !isDisabled && !readOnly;
163
+ const clearButton2 = showClear ? /* @__PURE__ */ jsx(
164
+ "button",
165
+ {
166
+ type: "button",
167
+ className: styles.clearButton,
168
+ "data-testid": TestIds.clearButton,
169
+ "aria-label": t("clearButton"),
170
+ onClick: () => handleChange(null),
171
+ children: /* @__PURE__ */ jsx(DismissSmall_default, { "aria-hidden": true, className: styles.clearIcon })
172
+ }
173
+ ) : null;
108
174
  return /* @__PURE__ */ jsx(
109
175
  "div",
110
176
  {
@@ -114,6 +180,7 @@ function TimePicker(props) {
114
180
  "div",
115
181
  {
116
182
  id,
183
+ ref: setPortalContainer,
117
184
  ...getDataAttributes(props),
118
185
  className: clsx(
119
186
  className,
@@ -124,16 +191,51 @@ function TimePicker(props) {
124
191
  dir: direction || void 0,
125
192
  lang: environmentService.language,
126
193
  "data-testid": TestIds.root,
127
- children: /* @__PURE__ */ jsx($2eb8e6d23f3d0cb0$export$a54013f0d02a8f82, { locale, children: /* @__PURE__ */ jsx(
194
+ children: /* @__PURE__ */ jsx($2eb8e6d23f3d0cb0$export$a54013f0d02a8f82, { locale, children: /* @__PURE__ */ jsxs(
128
195
  $40825cdb76e74f70$export$5eaee2322dd727eb,
129
196
  {
130
197
  className: styles.timePicker,
131
198
  value: timeValue,
132
199
  onChange: handleChange,
200
+ granularity,
201
+ hourCycle: hourCycle === HourCycleValues.Auto ? void 0 : Number(hourCycle),
202
+ shouldForceLeadingZeros: shouldForceLeadingZeros || void 0,
203
+ minValue,
204
+ maxValue,
205
+ placeholderValue,
206
+ isDisabled,
207
+ isReadOnly: readOnly,
208
+ isRequired,
133
209
  "aria-label": ariaLabel,
134
210
  onFocus,
135
211
  onBlur,
136
- children: /* @__PURE__ */ jsx(TimePickerField, { clearButton: null })
212
+ children: [
213
+ label2 || tooltip2 ? /* @__PURE__ */ jsxs("div", { className: styles.labelRow, children: [
214
+ label2 ? /* @__PURE__ */ jsx($01b77f81d0f07f68$export$b04be29aa201d4f5, { className: clsx(styles.label, selectors.label), children: label2 }) : null,
215
+ tooltip2 ? /* @__PURE__ */ jsxs($4e3b923658d69c60$export$8c610744efcf8a1d, { delay: 0, children: [
216
+ /* @__PURE__ */ jsx(
217
+ $d2b4bc8c273e7be6$export$353f5b6fc5456de1,
218
+ {
219
+ className: styles.tooltipButton,
220
+ "data-testid": TestIds.tooltipButton,
221
+ "aria-label": tooltip2,
222
+ children: /* @__PURE__ */ jsx(InfoCircleSmall_default, { "aria-hidden": "true" })
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsx(
226
+ $4e3b923658d69c60$export$28c660c63b792dea,
227
+ {
228
+ className: styles.tooltip,
229
+ offset: 6,
230
+ UNSTABLE_portalContainer: portalContainer ?? void 0,
231
+ children: tooltip2
232
+ }
233
+ )
234
+ ] }) : null
235
+ ] }) : null,
236
+ /* @__PURE__ */ jsx(TimePickerField, { clearButton: clearButton2 }),
237
+ description2 ? /* @__PURE__ */ jsx($514c0188e459b4c0$export$5f1af8db9871e1d6, { slot: "description", className: styles.description, children: description2 }) : null
238
+ ]
137
239
  }
138
240
  ) })
139
241
  }
@@ -3,30 +3,92 @@ export declare const DisplayNames: {
3
3
  elementDisplayName: string;
4
4
  data: {
5
5
  value: string;
6
+ granularity: {
7
+ displayName: string;
8
+ options: {
9
+ hour: string;
10
+ minute: string;
11
+ second: string;
12
+ };
13
+ };
14
+ hourCycle: {
15
+ displayName: string;
16
+ options: {
17
+ auto: string;
18
+ h12: string;
19
+ h24: string;
20
+ };
21
+ };
22
+ shouldForceLeadingZeros: string;
23
+ tooltip: string;
24
+ label: string;
25
+ placeholder: string;
26
+ description: string;
27
+ minTime: string;
28
+ maxTime: string;
29
+ required: string;
30
+ readOnly: string;
31
+ disabled: string;
32
+ clearable: string;
6
33
  };
7
34
  elements: {
35
+ label: string;
8
36
  timeInput: string;
9
37
  };
10
- cssCustomProperties: {};
38
+ cssCustomProperties: {
39
+ labelSpacing: string;
40
+ segmentFocusBackgroundColor: string;
41
+ segmentFocusTextColor: string;
42
+ };
11
43
  };
12
44
  };
45
+ export declare const defaultValues: {
46
+ readonly granularity: "minute";
47
+ readonly hourCycle: "auto";
48
+ readonly shouldForceLeadingZeros: false;
49
+ readonly tooltip: "";
50
+ readonly label: "";
51
+ readonly placeholder: "";
52
+ readonly description: "";
53
+ readonly required: false;
54
+ readonly readOnly: false;
55
+ readonly disabled: false;
56
+ readonly clearable: false;
57
+ };
58
+ /** React Aria `granularity`: the smallest editable time unit. */
59
+ export declare const enum GranularityValues {
60
+ Hour = "hour",
61
+ Minute = "minute",
62
+ Second = "second"
63
+ }
64
+ /** `auto` defers to the locale; `12`/`24` force the hour cycle. */
65
+ export declare const enum HourCycleValues {
66
+ Auto = "auto",
67
+ H12 = "12",
68
+ H24 = "24"
69
+ }
13
70
  /** The value that represents "no time selected". */
14
71
  export declare const EMPTY_VALUE = "";
15
72
  export declare const TRANSLATIONS_NAMESPACE = "timePicker";
16
73
  /** Viewer-facing string keys (translated via the Translations service). */
17
74
  export declare const TranslationKeys: {
18
75
  readonly ariaLabel: "timePicker_aria_label";
76
+ readonly clearButton: "timePicker_clear_button";
19
77
  };
20
78
  /** English fallbacks used when a translation is missing. */
21
79
  export declare const DefaultTranslations: {
22
80
  readonly ariaLabel: "Time picker";
81
+ readonly clearButton: "Clear";
23
82
  };
24
83
  export declare const TestIds: {
25
84
  readonly root: "timepicker-root";
26
85
  readonly group: "timepicker-group";
27
86
  readonly field: "timepicker-field";
87
+ readonly clearButton: "timepicker-clear-button";
88
+ readonly tooltipButton: "timepicker-tooltip-button";
28
89
  };
29
90
  export declare const selectors: {
30
91
  readonly root: "timePicker";
92
+ readonly label: "timePicker__label";
31
93
  readonly group: "timePicker__group";
32
94
  };
@@ -1,4 +1,14 @@
1
1
  .timePicker__j78My {
2
+ --labelFont: var(
3
+ --wst-paragraph-2-font,
4
+ normal normal normal 14px/1.4em madefor-text,
5
+ helveticaneuew01-45ligh,
6
+ helveticaneuew02-45ligh,
7
+ helveticaneuew10-45ligh,
8
+ sans-serif
9
+ );
10
+ --label-text-color: var(--wst-paragraph-2-color, #2b2b2b);
11
+
2
12
  --field-background-color: var(--wst-primary-background-color, #ffffff);
3
13
  --borderColor: var(--wst-system-line-1-color, #dfe5eb);
4
14
  --borderWidth: 1px;
@@ -6,6 +16,24 @@
6
16
  --borderStartEndRadius: 6px;
7
17
  --borderEndStartRadius: 6px;
8
18
  --borderEndEndRadius: 6px;
19
+
20
+ --label-spacing: 6px;
21
+
22
+ --segment-focus-background-color: var(--wst-links-and-actions-color, #116dff);
23
+ --segment-focus-text-color: var(--wst-primary-background-color, #ffffff);
24
+
25
+ --accent-color: var(--segment-focus-background-color);
26
+
27
+ --tooltip-font: var(
28
+ --wst-paragraph-2-font,
29
+ normal normal normal 12px/1.4em madefor-text,
30
+ helveticaneuew01-45ligh,
31
+ helveticaneuew02-45ligh,
32
+ helveticaneuew10-45ligh,
33
+ sans-serif
34
+ );
35
+ --tooltip-text-color: var(--wst-primary-background-color, #ffffff);
36
+ --tooltip-background-color: var(--wst-paragraph-2-color, #2b2b2b);
9
37
  }
10
38
  .root__dzkbY {
11
39
  box-sizing: border-box;
@@ -21,6 +49,53 @@
21
49
  display: flex;
22
50
  flex-direction: column;
23
51
  }
52
+ .labelRow__qoC8g {
53
+ display: flex;
54
+ align-items: center;
55
+ gap: 6px;
56
+ margin: 0 0 var(--label-spacing);
57
+ }
58
+ .label__THO5j {
59
+ margin: 0;
60
+ font: var(--labelFont);
61
+ color: var(--label-text-color);
62
+ }
63
+ .tooltipButton__ISWIR {
64
+ flex: none;
65
+ box-sizing: border-box;
66
+ display: inline-flex;
67
+ align-items: center;
68
+ justify-content: center;
69
+ width: 16px;
70
+ height: 16px;
71
+ margin: 0;
72
+ padding: 0;
73
+ border: none;
74
+ background: transparent;
75
+ color: var(--label-text-color);
76
+ cursor: pointer;
77
+ opacity: 0.65;
78
+ }
79
+ .tooltipButton__ISWIR[data-hovered], .tooltipButton__ISWIR[data-focus-visible] {
80
+ opacity: 1;
81
+ }
82
+ .tooltipButton__ISWIR[data-focus-visible] {
83
+ border-radius: 50%;
84
+ box-shadow: 0 0 0 2px var(--accent-color);
85
+ }
86
+ .tooltipButton__ISWIR svg {
87
+ width: 16px;
88
+ height: 16px;
89
+ }
90
+ .tooltip__FTZhM {
91
+ max-width: 220px;
92
+ padding: 6px 10px;
93
+ font: var(--tooltip-font);
94
+ color: var(--tooltip-text-color);
95
+ background: var(--tooltip-background-color);
96
+ border-radius: 6px;
97
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
98
+ }
24
99
  .group__6HZy7 {
25
100
  box-sizing: border-box;
26
101
  display: flex;
@@ -40,6 +115,17 @@
40
115
  border-end-end-radius: var(--borderEndEndRadius);
41
116
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
42
117
  }
118
+ .group__6HZy7:focus-within {
119
+ border-color: var(--accent-color);
120
+ box-shadow: 0 0 0 1px var(--accent-color);
121
+ }
122
+ .group__6HZy7:hover:not(:focus-within) {
123
+ border-color: color-mix(in srgb, var(--accent-color) 45%, transparent);
124
+ }
125
+ .timePicker__j78My[data-disabled] {
126
+ opacity: 0.55;
127
+ cursor: not-allowed;
128
+ }
43
129
  .field__mnQwh {
44
130
  display: inline-flex;
45
131
  flex: 1;
@@ -49,6 +135,11 @@
49
135
  color: inherit;
50
136
  white-space: nowrap;
51
137
  }
138
+ .description__ePprf {
139
+ margin-top: 4px;
140
+ font-size: 12px;
141
+ opacity: 0.7;
142
+ }
52
143
  .segment__OtazP {
53
144
  padding: 0 2px;
54
145
  border-radius: 3px;
@@ -56,6 +147,41 @@
56
147
  text-align: center;
57
148
  outline: none;
58
149
  }
150
+ .segment__OtazP[data-type=literal] {
151
+ padding: 0;
152
+ opacity: 0.5;
153
+ }
154
+ .segment__OtazP[data-placeholder] {
155
+ color: color-mix(in srgb, currentColor 45%, transparent);
156
+ }
157
+ .segment__OtazP[data-focused] {
158
+ background: var(--accent-color);
159
+ color: var(--segment-focus-text-color);
160
+ }
161
+ .clearButton__Bto7s {
162
+ flex: none;
163
+ box-sizing: border-box;
164
+ display: inline-flex;
165
+ align-items: center;
166
+ justify-content: center;
167
+ width: 24px;
168
+ height: 24px;
169
+ margin: 0;
170
+ padding: 0;
171
+ border: none;
172
+ border-radius: 6px;
173
+ background: transparent;
174
+ color: inherit;
175
+ cursor: pointer;
176
+ transition: background 0.15s ease;
177
+ }
178
+ .clearButton__Bto7s:hover {
179
+ background: color-mix(in srgb, currentColor 12%, transparent);
180
+ }
181
+ .clearIcon__x11eI {
182
+ width: 18px;
183
+ height: 18px;
184
+ }
59
185
  .fallbackDirection__HeRgn:not([dir]) {
60
186
  direction: var(--wix-opt-in-direction);
61
187
  }
@@ -0,0 +1,8 @@
1
+ import { TimePickerProps } from '../TimePicker.types';
2
+ export declare const useTimeConstraints: (params: {
3
+ minTime: TimePickerProps["minTime"];
4
+ maxTime: TimePickerProps["maxTime"];
5
+ }) => {
6
+ minValue: import('react-aria').TimeValue | undefined;
7
+ maxValue: import('react-aria').TimeValue | undefined;
8
+ };
@@ -1,8 +1,9 @@
1
1
  import { TimeValue } from 'react-aria-components';
2
- import { TimePickerProps } from '../TimePicker.types';
2
+ import { TimePickerGranularity, TimePickerProps } from '../TimePicker.types';
3
3
  export declare const useTimePickerValue: (params: {
4
4
  value: TimePickerProps["value"];
5
5
  onChange: NonNullable<TimePickerProps["onChange"]>;
6
+ granularity: TimePickerGranularity;
6
7
  }) => {
7
8
  timeValue: TimeValue | null;
8
9
  handleChange: (next: TimeValue | null) => void;