@snack-uikit/fields 0.30.0 → 0.32.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 (150) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +184 -152
  3. package/dist/cjs/components/FieldDate/FieldDate.d.ts +15 -24
  4. package/dist/cjs/components/FieldDate/FieldDate.js +53 -41
  5. package/dist/cjs/components/FieldDate/index.d.ts +0 -1
  6. package/dist/cjs/components/FieldDate/index.js +1 -9
  7. package/dist/cjs/components/FieldSecure/FieldSecure.d.ts +1 -1
  8. package/dist/cjs/components/FieldSelect/hooks.d.ts +2 -2
  9. package/dist/cjs/components/FieldSelect/hooks.js +7 -3
  10. package/dist/cjs/components/FieldSelect/styles.module.css +6 -18
  11. package/dist/cjs/components/FieldSlider/FieldSlider.d.ts +1 -1
  12. package/dist/cjs/components/FieldText/FieldText.d.ts +1 -1
  13. package/dist/cjs/components/FieldTextArea/FieldTextArea.d.ts +1 -1
  14. package/dist/cjs/components/FieldTime/FieldTime.d.ts +30 -0
  15. package/dist/cjs/components/FieldTime/FieldTime.js +298 -0
  16. package/dist/cjs/components/FieldTime/index.d.ts +1 -0
  17. package/dist/cjs/components/{FieldDate/hooks → FieldTime}/index.js +1 -1
  18. package/dist/cjs/components/FieldTime/styles.module.css +27 -0
  19. package/dist/cjs/components/index.d.ts +6 -5
  20. package/dist/cjs/components/index.js +6 -5
  21. package/dist/cjs/constants/dateFields.d.ts +24 -0
  22. package/dist/cjs/constants/dateFields.js +152 -0
  23. package/dist/cjs/constants/index.d.ts +2 -0
  24. package/dist/cjs/constants/index.js +26 -0
  25. package/dist/cjs/hooks/dateHandlers/index.d.ts +3 -0
  26. package/dist/cjs/hooks/dateHandlers/index.js +27 -0
  27. package/dist/cjs/{components/FieldDate/hooks → hooks/dateHandlers}/useDateField.d.ts +13 -5
  28. package/dist/cjs/{components/FieldDate/hooks → hooks/dateHandlers}/useDateField.js +49 -34
  29. package/dist/cjs/hooks/dateHandlers/useDateFieldHelpersForMode.d.ts +18 -0
  30. package/dist/cjs/hooks/dateHandlers/useDateFieldHelpersForMode.js +113 -0
  31. package/dist/cjs/hooks/index.d.ts +1 -0
  32. package/dist/cjs/hooks/index.js +1 -0
  33. package/dist/cjs/hooks/useCopyButton.js +1 -1
  34. package/dist/cjs/{types.d.ts → types/allFields.d.ts} +1 -1
  35. package/dist/cjs/types/dateFields.d.ts +11 -0
  36. package/dist/cjs/types/index.d.ts +2 -0
  37. package/dist/cjs/types/index.js +26 -0
  38. package/dist/cjs/utils/dateFields.d.ts +10 -0
  39. package/dist/cjs/utils/dateFields.js +71 -0
  40. package/dist/esm/components/FieldDate/FieldDate.d.ts +15 -24
  41. package/dist/esm/components/FieldDate/FieldDate.js +39 -31
  42. package/dist/esm/components/FieldDate/index.d.ts +0 -1
  43. package/dist/esm/components/FieldDate/index.js +0 -1
  44. package/dist/esm/components/FieldSecure/FieldSecure.d.ts +1 -1
  45. package/dist/esm/components/FieldSelect/hooks.d.ts +2 -2
  46. package/dist/esm/components/FieldSelect/hooks.js +9 -3
  47. package/dist/esm/components/FieldSelect/styles.module.css +6 -18
  48. package/dist/esm/components/FieldSlider/FieldSlider.d.ts +1 -1
  49. package/dist/esm/components/FieldText/FieldText.d.ts +1 -1
  50. package/dist/esm/components/FieldTextArea/FieldTextArea.d.ts +1 -1
  51. package/dist/esm/components/FieldTime/FieldTime.d.ts +30 -0
  52. package/dist/esm/components/FieldTime/FieldTime.js +161 -0
  53. package/dist/esm/components/FieldTime/index.d.ts +1 -0
  54. package/dist/esm/components/FieldTime/index.js +1 -0
  55. package/dist/esm/components/FieldTime/styles.module.css +27 -0
  56. package/dist/esm/components/index.d.ts +6 -5
  57. package/dist/esm/components/index.js +6 -5
  58. package/dist/esm/constants/dateFields.d.ts +24 -0
  59. package/dist/esm/constants/dateFields.js +103 -0
  60. package/dist/esm/constants/index.d.ts +2 -0
  61. package/dist/esm/constants/index.js +2 -0
  62. package/dist/esm/hooks/dateHandlers/index.d.ts +3 -0
  63. package/dist/esm/hooks/dateHandlers/index.js +3 -0
  64. package/dist/esm/{components/FieldDate/hooks → hooks/dateHandlers}/useDateField.d.ts +13 -5
  65. package/dist/esm/{components/FieldDate/hooks → hooks/dateHandlers}/useDateField.js +48 -35
  66. package/dist/esm/hooks/dateHandlers/useDateFieldHelpersForMode.d.ts +18 -0
  67. package/dist/esm/hooks/dateHandlers/useDateFieldHelpersForMode.js +95 -0
  68. package/dist/esm/hooks/index.d.ts +1 -0
  69. package/dist/esm/hooks/index.js +1 -0
  70. package/dist/esm/hooks/useCopyButton.js +1 -1
  71. package/dist/esm/{types.d.ts → types/allFields.d.ts} +1 -1
  72. package/dist/esm/types/dateFields.d.ts +11 -0
  73. package/dist/esm/types/index.d.ts +2 -0
  74. package/dist/esm/types/index.js +2 -0
  75. package/dist/esm/utils/dateFields.d.ts +10 -0
  76. package/dist/esm/utils/dateFields.js +59 -0
  77. package/package.json +16 -16
  78. package/src/components/FieldColor/styles.module.scss +9 -10
  79. package/src/components/FieldDate/FieldDate.tsx +72 -52
  80. package/src/components/FieldDate/index.ts +0 -1
  81. package/src/components/FieldDate/styles.module.scss +10 -11
  82. package/src/components/FieldDecorator/styles.module.scss +44 -45
  83. package/src/components/FieldSelect/hooks.ts +15 -3
  84. package/src/components/FieldSelect/styles.module.scss +20 -20
  85. package/src/components/FieldSlider/styles.module.scss +4 -4
  86. package/src/components/FieldTextArea/styles.module.scss +18 -18
  87. package/src/components/FieldTime/FieldTime.tsx +350 -0
  88. package/src/components/FieldTime/index.ts +1 -0
  89. package/src/components/FieldTime/styles.module.scss +41 -0
  90. package/src/components/index.ts +6 -5
  91. package/src/constants/dateFields.ts +127 -0
  92. package/src/constants/index.ts +2 -0
  93. package/src/helperComponents/ButtonCopyValue/styles.module.scss +2 -2
  94. package/src/helperComponents/ButtonField/styles.module.scss +9 -9
  95. package/src/helperComponents/ButtonFieldList/styles.module.scss +2 -2
  96. package/src/helperComponents/ButtonHideValue/styles.module.scss +2 -2
  97. package/src/helperComponents/FieldContainerPrivate/styles.module.scss +24 -26
  98. package/src/helperComponents/TextArea/styles.module.scss +5 -5
  99. package/src/hooks/dateHandlers/index.ts +3 -0
  100. package/src/{components/FieldDate/hooks → hooks/dateHandlers}/useDateField.ts +93 -47
  101. package/src/hooks/dateHandlers/useDateFieldHelpersForMode.ts +145 -0
  102. package/src/hooks/index.ts +1 -0
  103. package/src/hooks/styles.module.scss +5 -5
  104. package/src/hooks/useCopyButton.tsx +1 -1
  105. package/src/styles.module.scss +15 -15
  106. package/src/{types.ts → types/allFields.ts} +1 -1
  107. package/src/types/dateFields.ts +14 -0
  108. package/src/types/index.ts +2 -0
  109. package/src/utils/dateFields.ts +75 -0
  110. package/dist/cjs/components/FieldDate/constants.d.ts +0 -10
  111. package/dist/cjs/components/FieldDate/constants.js +0 -49
  112. package/dist/cjs/components/FieldDate/hooks/index.d.ts +0 -1
  113. package/dist/cjs/components/FieldDate/hooks/useDateFieldHelpers.d.ts +0 -10
  114. package/dist/cjs/components/FieldDate/hooks/useDateFieldHelpers.js +0 -82
  115. package/dist/cjs/components/FieldDate/types.d.ts +0 -6
  116. package/dist/cjs/components/FieldDate/utils.d.ts +0 -9
  117. package/dist/cjs/components/FieldDate/utils.js +0 -56
  118. package/dist/esm/components/FieldDate/constants.d.ts +0 -10
  119. package/dist/esm/components/FieldDate/constants.js +0 -28
  120. package/dist/esm/components/FieldDate/hooks/index.d.ts +0 -1
  121. package/dist/esm/components/FieldDate/hooks/index.js +0 -1
  122. package/dist/esm/components/FieldDate/hooks/useDateFieldHelpers.d.ts +0 -10
  123. package/dist/esm/components/FieldDate/hooks/useDateFieldHelpers.js +0 -66
  124. package/dist/esm/components/FieldDate/types.d.ts +0 -6
  125. package/dist/esm/components/FieldDate/utils.d.ts +0 -9
  126. package/dist/esm/components/FieldDate/utils.js +0 -43
  127. package/src/components/FieldDate/constants.ts +0 -33
  128. package/src/components/FieldDate/hooks/index.ts +0 -1
  129. package/src/components/FieldDate/hooks/useDateFieldHelpers.ts +0 -96
  130. package/src/components/FieldDate/types.ts +0 -6
  131. package/src/components/FieldDate/utils.ts +0 -49
  132. /package/dist/cjs/{constants.d.ts → constants/allFields.d.ts} +0 -0
  133. /package/dist/cjs/{constants.js → constants/allFields.js} +0 -0
  134. /package/dist/cjs/{components/FieldDate/hooks → hooks/dateHandlers}/useFocusHandlers.d.ts +0 -0
  135. /package/dist/cjs/{components/FieldDate/hooks → hooks/dateHandlers}/useFocusHandlers.js +0 -0
  136. /package/dist/cjs/{components/FieldDate/hooks → hooks/dateHandlers}/useHandlers.d.ts +0 -0
  137. /package/dist/cjs/{components/FieldDate/hooks → hooks/dateHandlers}/useHandlers.js +0 -0
  138. /package/dist/cjs/{components/FieldDate/types.js → types/allFields.js} +0 -0
  139. /package/dist/cjs/{types.js → types/dateFields.js} +0 -0
  140. /package/dist/esm/{constants.d.ts → constants/allFields.d.ts} +0 -0
  141. /package/dist/esm/{constants.js → constants/allFields.js} +0 -0
  142. /package/dist/esm/{components/FieldDate/hooks → hooks/dateHandlers}/useFocusHandlers.d.ts +0 -0
  143. /package/dist/esm/{components/FieldDate/hooks → hooks/dateHandlers}/useFocusHandlers.js +0 -0
  144. /package/dist/esm/{components/FieldDate/hooks → hooks/dateHandlers}/useHandlers.d.ts +0 -0
  145. /package/dist/esm/{components/FieldDate/hooks → hooks/dateHandlers}/useHandlers.js +0 -0
  146. /package/dist/esm/{components/FieldDate/types.js → types/allFields.js} +0 -0
  147. /package/dist/esm/{types.js → types/dateFields.js} +0 -0
  148. /package/src/{constants.ts → constants/allFields.ts} +0 -0
  149. /package/src/{components/FieldDate/hooks → hooks/dateHandlers}/useFocusHandlers.ts +0 -0
  150. /package/src/{components/FieldDate/hooks → hooks/dateHandlers}/useHandlers.ts +0 -0
@@ -11,33 +11,23 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import mergeRefs from 'merge-refs';
14
- import { forwardRef, useCallback, useEffect, useMemo, useRef, useState, } from 'react';
14
+ import { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
15
15
  import { useUncontrolledProp } from 'uncontrollable';
16
16
  import { Calendar } from '@snack-uikit/calendar';
17
17
  import { Dropdown } from '@snack-uikit/dropdown';
18
18
  import { CalendarSVG } from '@snack-uikit/icons';
19
19
  import { ICON_SIZE, InputPrivate, runAfterRerender, SIZE, useButtonNavigation, useClearButton, } from '@snack-uikit/input-private';
20
20
  import { extractSupportProps } from '@snack-uikit/utils';
21
- import { CONTAINER_VARIANT, VALIDATION_STATE } from '../../constants';
21
+ import { CONTAINER_VARIANT, DEFAULT_LOCALE, SlotKey, VALIDATION_STATE } from '../../constants';
22
22
  import { FieldContainerPrivate } from '../../helperComponents';
23
- import { useCopyButton } from '../../hooks';
23
+ import { useCopyButton, useDateField, useFocusHandlers, useHandlers } from '../../hooks';
24
24
  import { getValidationState } from '../../utils/getValidationState';
25
25
  import { FieldDecorator } from '../FieldDecorator';
26
- import { DEFAULT_LOCALE, SlotKey } from './constants';
27
- import { useDateField } from './hooks';
28
- import { useFocusHandlers } from './hooks/useFocusHandlers';
29
- import { useHandlers } from './hooks/useHandlers';
30
26
  import styles from './styles.module.css';
31
- import { parseDate } from './utils';
32
- const CALENDAR_SIZE_MAP = {
33
- [SIZE.S]: 's',
34
- [SIZE.M]: 'm',
35
- [SIZE.L]: 'm',
36
- };
37
27
  export const FieldDate = forwardRef((_a, ref) => {
38
- var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onOpenChange, onChange, onFocus, onBlur: onBlurProp, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, locale = DEFAULT_LOCALE, buildCellProps, error } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "locale", "buildCellProps", "error"]);
28
+ var _b;
29
+ var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onOpenChange, onChange, onFocus, onBlur: onBlurProp, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, size = SIZE.S, validationState = VALIDATION_STATE.Default, buildCellProps, error, mode } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "size", "validationState", "buildCellProps", "error", "mode"]);
39
30
  const [isOpen, setIsOpen] = useUncontrolledProp(open, false, onOpenChange);
40
- const [pickerAutofocus, setPickerAutofocus] = useState(false);
41
31
  const localRef = useRef(null);
42
32
  const clearButtonRef = useRef(null);
43
33
  const copyButtonRef = useRef(null);
@@ -46,16 +36,18 @@ export const FieldDate = forwardRef((_a, ref) => {
46
36
  const showAdditionalButton = Boolean(valueProp && !disabled);
47
37
  const showClearButton = showClearButtonProp && showAdditionalButton && !readonly;
48
38
  const showCopyButton = showCopyButtonProp && showAdditionalButton && readonly;
39
+ const showSeconds = mode === 'date-time' ? ((_b = rest.showSeconds) !== null && _b !== void 0 ? _b : true) : undefined;
49
40
  const fieldValidationState = getValidationState({ validationState, error });
41
+ const navigationStartRef = useRef(null);
50
42
  const checkForLeavingFocus = useCallback((event) => {
51
43
  if (event.key === 'ArrowDown') {
52
- setPickerAutofocus(true);
53
44
  setIsOpen(true);
45
+ setTimeout(() => { var _a; return (_a = navigationStartRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, 0);
54
46
  }
55
47
  }, [setIsOpen]);
56
48
  const handleClear = useCallback(() => {
57
49
  var _a, _b, _c;
58
- onChange && onChange('');
50
+ onChange && onChange(undefined);
59
51
  if ((_a = localRef.current) === null || _a === void 0 ? void 0 : _a.value) {
60
52
  localRef.current.value = '';
61
53
  }
@@ -68,8 +60,24 @@ export const FieldDate = forwardRef((_a, ref) => {
68
60
  setIsOpen(false);
69
61
  }
70
62
  }, [onChange, required, setIsOpen]);
63
+ const getStringDateValue = useCallback((date) => {
64
+ if (!date)
65
+ return '';
66
+ if (mode === 'date') {
67
+ return date.toLocaleDateString(DEFAULT_LOCALE);
68
+ }
69
+ return date.toLocaleString(DEFAULT_LOCALE, {
70
+ year: 'numeric',
71
+ month: 'numeric',
72
+ day: 'numeric',
73
+ hour: '2-digit',
74
+ minute: '2-digit',
75
+ second: showSeconds ? '2-digit' : undefined,
76
+ });
77
+ }, [mode, showSeconds]);
78
+ const valueToCopy = getStringDateValue(valueProp);
71
79
  const clearButtonSettings = useClearButton({ clearButtonRef, showClearButton, size, onClear: handleClear });
72
- const copyButtonSettings = useCopyButton({ copyButtonRef, showCopyButton, size, valueToCopy: valueProp || '' });
80
+ const copyButtonSettings = useCopyButton({ copyButtonRef, showCopyButton, size, valueToCopy });
73
81
  const calendarIcon = useMemo(() => ({
74
82
  active: false,
75
83
  show: true,
@@ -81,10 +89,12 @@ export const FieldDate = forwardRef((_a, ref) => {
81
89
  inputRef: localRef,
82
90
  onChange,
83
91
  readonly,
84
- locale,
92
+ locale: DEFAULT_LOCALE,
85
93
  setIsOpen,
94
+ mode,
95
+ showSeconds,
86
96
  });
87
- const setInputFocusFromButtons = useCallback(() => setInputFocus(SlotKey.Year), [setInputFocus]);
97
+ const setInputFocusFromButtons = useCallback(() => setInputFocus(mode === 'date' ? SlotKey.Year : SlotKey.Seconds), [mode, setInputFocus]);
88
98
  const { postfixButtons, inputTabIndex, onInputKeyDown: navigationInputKeyDownHandler, setInitialTabIndices, } = useButtonNavigation({
89
99
  setInputFocus: setInputFocusFromButtons,
90
100
  inputRef: localRef,
@@ -93,12 +103,14 @@ export const FieldDate = forwardRef((_a, ref) => {
93
103
  readonly,
94
104
  submitKeys: ['Enter', 'Space', 'Tab'],
95
105
  });
96
- // TODO: do not hardcode locale here
97
106
  const handleSelectDate = (date) => {
98
107
  var _a;
99
- onChange && onChange(date.toLocaleDateString(DEFAULT_LOCALE));
108
+ onChange && onChange(date);
100
109
  (_a = localRef.current) === null || _a === void 0 ? void 0 : _a.focus();
101
110
  setIsOpen(false);
111
+ if (localRef.current) {
112
+ localRef.current.value = getStringDateValue(date);
113
+ }
102
114
  };
103
115
  const handleCalendarFocusLeave = () => {
104
116
  setInitialTabIndices();
@@ -120,11 +132,12 @@ export const FieldDate = forwardRef((_a, ref) => {
120
132
  (_a = localRef.current) === null || _a === void 0 ? void 0 : _a.focus();
121
133
  }
122
134
  }, [open]);
135
+ // TODO input ref - determine whether to update ref based on input/non-input state
123
136
  useEffect(() => {
124
- if (localRef.current) {
125
- localRef.current.value = valueProp;
137
+ if (localRef.current && document.activeElement !== localRef.current) {
138
+ localRef.current.value = getStringDateValue(valueProp);
126
139
  }
127
- }, [valueProp]);
140
+ }, [getStringDateValue, valueProp]);
128
141
  const onFocusByKeyboard = useCallback((e) => {
129
142
  setInputFocus();
130
143
  onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
@@ -146,10 +159,5 @@ export const FieldDate = forwardRef((_a, ref) => {
146
159
  : {
147
160
  open: showDropList,
148
161
  onOpenChange: setIsOpen,
149
- }), { content: _jsx("div", { className: styles.calendarWrapper, "data-size": size, children: _jsx(Calendar, { mode: 'date', size: CALENDAR_SIZE_MAP[size], value: valueProp ? parseDate(valueProp) : undefined, onChangeValue: handleSelectDate, buildCellProps: buildCellProps, navigationStartRef: element => {
150
- if (pickerAutofocus) {
151
- element === null || element === void 0 ? void 0 : element.focus();
152
- setPickerAutofocus(false);
153
- }
154
- }, onFocusLeave: handleCalendarFocusLeave, locale: locale, "data-test-id": 'field-date__calendar' }) }), children: _jsx(FieldContainerPrivate, { className: styles.container, size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, focused: showDropList, inputRef: localRef, postfix: postfixButtons, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value || '', placeholder: mask, onChange: handleChange, onFocus: inputHandlers.onFocus, onMouseDown: inputHandlers.onMouseDown, onBlur: onBlur, onKeyDown: handleInputKeyDown, onClick: onClick, disabled: disabled, readonly: readonly, tabIndex: inputTabIndex, type: 'text', id: id, name: name, "data-test-id": 'field-date__input' }) }) })) })));
162
+ }), { content: _jsx("div", { className: styles.calendarWrapper, "data-size": size, children: _jsx(Calendar, { mode: mode, size: size, value: valueProp, showSeconds: showSeconds, onChangeValue: handleSelectDate, buildCellProps: buildCellProps, navigationStartRef: navigationStartRef, onFocusLeave: handleCalendarFocusLeave, locale: DEFAULT_LOCALE, "data-test-id": 'field-date__calendar', fitToContainer: false }) }), children: _jsx(FieldContainerPrivate, { className: styles.container, size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, focused: showDropList, inputRef: localRef, postfix: postfixButtons, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value || '', placeholder: mask, onChange: handleChange, onFocus: inputHandlers.onFocus, onMouseDown: inputHandlers.onMouseDown, onBlur: onBlur, onKeyDown: handleInputKeyDown, onClick: onClick, disabled: disabled, readonly: readonly, tabIndex: inputTabIndex, type: 'text', id: id, name: name, "data-test-id": 'field-date__input' }) }) })) })));
155
163
  });
@@ -1,2 +1 @@
1
1
  export * from './FieldDate';
2
- export { parseDate } from './utils';
@@ -1,2 +1 @@
1
1
  export * from './FieldDate';
2
- export { parseDate } from './utils';
@@ -21,5 +21,5 @@ type FieldSecureOwnProps = {
21
21
  export type FieldSecureProps = WithSupportProps<FieldSecureOwnProps & InputProps & WrapperProps>;
22
22
  export declare const FieldSecure: import("react").ForwardRefExoticComponent<{
23
23
  'data-test-id'?: string;
24
- } & import("react").AriaAttributes & FieldSecureOwnProps & Pick<Partial<InputPrivateProps>, "value" | "onChange"> & Pick<InputPrivateProps, "onFocus" | "onBlur" | "id" | "disabled" | "readonly" | "name" | "placeholder" | "autoComplete" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
24
+ } & import("react").AriaAttributes & FieldSecureOwnProps & Pick<Partial<InputPrivateProps>, "value" | "onChange"> & Pick<InputPrivateProps, "onFocus" | "onBlur" | "id" | "disabled" | "name" | "readonly" | "placeholder" | "autoComplete" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
25
25
  export {};
@@ -27,9 +27,9 @@ export declare function useSearchInput({ value, onChange, defaultValue, selected
27
27
  resetSearchOnOptionSelection?: boolean;
28
28
  }): {
29
29
  inputValue: string;
30
- setInputValue: (value: any, ...args: any[]) => ReturnType<Handler> | void;
30
+ setInputValue: (value: string) => void;
31
31
  prevInputValue: import("react").MutableRefObject<string>;
32
- onInputValueChange: (value: any, ...args: any[]) => ReturnType<Handler> | void;
32
+ onInputValueChange: (value: string) => void;
33
33
  updateInputValue: (selectedItem?: ItemWithId) => void;
34
34
  };
35
35
  export declare function useHandleDeleteItem(setValue: Handler): (item?: ItemWithId) => (e?: MouseEvent<HTMLButtonElement>) => void;
@@ -52,15 +52,21 @@ export function useButtons({ readonly, showClearButton, showCopyButton, size, on
52
52
  return { postfixButtons, inputKeyDownNavigationHandler, buttonsRefs };
53
53
  }
54
54
  export function useSearchInput({ value, onChange, defaultValue, selectedOptionFormatter, resetSearchOnOptionSelection = true, }) {
55
- const [inputValue = '', setInputValue] = useValueControl({ value, onChange, defaultValue });
55
+ const [inputValue = '', setInputValueState] = useValueControl({ value, onChange, defaultValue });
56
56
  const prevInputValue = useRef(inputValue);
57
57
  const updateInputValue = useCallback((selectedItem) => {
58
58
  const newInputValue = selectedOptionFormatter(selectedItem);
59
59
  if (resetSearchOnOptionSelection && (inputValue !== newInputValue || prevInputValue.current !== newInputValue)) {
60
- setInputValue(newInputValue);
60
+ setInputValueState(newInputValue);
61
61
  prevInputValue.current = newInputValue;
62
62
  }
63
- }, [inputValue, resetSearchOnOptionSelection, selectedOptionFormatter, setInputValue]);
63
+ }, [inputValue, resetSearchOnOptionSelection, selectedOptionFormatter, setInputValueState]);
64
+ const setInputValue = useCallback((value) => {
65
+ const updatedValue = prevInputValue.current && value.includes(prevInputValue.current)
66
+ ? value.replace(prevInputValue.current, '')
67
+ : value;
68
+ setInputValueState(updatedValue);
69
+ }, [setInputValueState]);
64
70
  return { inputValue, setInputValue, prevInputValue, onInputValueChange: setInputValue, updateInputValue };
65
71
  }
66
72
  export function useHandleDeleteItem(setValue) {
@@ -72,12 +72,8 @@
72
72
  color:var(--sys-neutral-text-light, #8b8e9b);
73
73
  }
74
74
  .container[data-size=s][data-variant=single-line-container] .displayValue{
75
- width:calc(100% - (
76
- var(--space-fields-single-line-container-s-right, 6px) + var(--space-fields-single-line-container-s-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-xs, 16px) * 2)
77
- ));
78
- margin-right:calc(
79
- var(--space-fields-single-line-container-s-right, 6px) + var(--space-fields-single-line-container-s-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-xs, 16px) * 2)
80
- );
75
+ width:calc(100% - (var(--space-fields-single-line-container-s-right, 6px) + var(--space-fields-single-line-container-s-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-xs, 16px) * 2)));
76
+ margin-right:calc(var(--space-fields-single-line-container-s-right, 6px) + var(--space-fields-single-line-container-s-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-xs, 16px) * 2));
81
77
  padding-left:var(--space-fields-single-line-container-s-left, 6px);
82
78
  border-radius:var(--radius-fields-s, 12px);
83
79
  }
@@ -95,12 +91,8 @@
95
91
  color:var(--sys-neutral-text-light, #8b8e9b);
96
92
  }
97
93
  .container[data-size=m][data-variant=single-line-container] .displayValue{
98
- width:calc(100% - (
99
- var(--space-fields-single-line-container-m-right, 8px) + var(--space-fields-single-line-container-m-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
100
- ));
101
- margin-right:calc(
102
- var(--space-fields-single-line-container-m-right, 8px) + var(--space-fields-single-line-container-m-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
103
- );
94
+ width:calc(100% - (var(--space-fields-single-line-container-m-right, 8px) + var(--space-fields-single-line-container-m-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)));
95
+ margin-right:calc(var(--space-fields-single-line-container-m-right, 8px) + var(--space-fields-single-line-container-m-gap, 4px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2));
104
96
  padding-left:var(--space-fields-single-line-container-m-left, 8px);
105
97
  border-radius:var(--radius-fields-m, 14px);
106
98
  }
@@ -118,12 +110,8 @@
118
110
  color:var(--sys-neutral-text-light, #8b8e9b);
119
111
  }
120
112
  .container[data-size=l][data-variant=single-line-container] .displayValue{
121
- width:calc(100% - (
122
- var(--space-fields-single-line-container-l-right, 10px) + var(--space-fields-single-line-container-l-gap, 8px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
123
- ));
124
- margin-right:calc(
125
- var(--space-fields-single-line-container-l-right, 10px) + var(--space-fields-single-line-container-l-gap, 8px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)
126
- );
113
+ width:calc(100% - (var(--space-fields-single-line-container-l-right, 10px) + var(--space-fields-single-line-container-l-gap, 8px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2)));
114
+ margin-right:calc(var(--space-fields-single-line-container-l-right, 10px) + var(--space-fields-single-line-container-l-gap, 8px) + calc(var(var(--space-fields-postfix-gap, 4px)) + var(--size-icon-container-s, 24px) * 2));
127
115
  padding-left:var(--space-fields-single-line-container-l-left, 10px);
128
116
  border-radius:var(--radius-fields-l, 16px);
129
117
  }
@@ -23,5 +23,5 @@ type FieldSliderOwnProps = {
23
23
  export type FieldSliderProps = WithSupportProps<FieldSliderOwnProps & SliderProps & WrapperProps>;
24
24
  export declare const FieldSlider: import("react").ForwardRefExoticComponent<{
25
25
  'data-test-id'?: string;
26
- } & import("react").AriaAttributes & FieldSliderOwnProps & Pick<InputPrivateProps, "onFocus" | "onBlur" | "id" | "disabled" | "readonly" | "name"> & Pick<SliderComponentProps, "value" | "onChange" | "range" | "tipFormatter"> & Required<Pick<SliderComponentProps, "max" | "min" | "step" | "marks">> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
26
+ } & import("react").AriaAttributes & FieldSliderOwnProps & Pick<InputPrivateProps, "onFocus" | "onBlur" | "id" | "disabled" | "name" | "readonly"> & Pick<SliderComponentProps, "value" | "onChange" | "range" | "tipFormatter"> & Required<Pick<SliderComponentProps, "max" | "min" | "step" | "marks">> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
27
27
  export {};
@@ -27,5 +27,5 @@ type FieldTextOwnProps = {
27
27
  export type FieldTextProps = WithSupportProps<FieldTextOwnProps & InputProps & WrapperProps>;
28
28
  export declare const FieldText: import("react").ForwardRefExoticComponent<{
29
29
  'data-test-id'?: string;
30
- } & import("react").AriaAttributes & FieldTextOwnProps & Pick<Partial<InputPrivateProps>, "value" | "onChange"> & Pick<InputPrivateProps, "onFocus" | "onBlur" | "id" | "disabled" | "readonly" | "name" | "placeholder" | "autoComplete" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
30
+ } & import("react").AriaAttributes & FieldTextOwnProps & Pick<Partial<InputPrivateProps>, "value" | "onChange"> & Pick<InputPrivateProps, "onFocus" | "onBlur" | "id" | "disabled" | "name" | "readonly" | "placeholder" | "autoComplete" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
31
31
  export {};
@@ -26,5 +26,5 @@ type FieldTextAreaOwnProps = {
26
26
  export type FieldTextAreaProps = WithSupportProps<FieldTextAreaOwnProps & InputProps & WrapperProps>;
27
27
  export declare const FieldTextArea: import("react").ForwardRefExoticComponent<{
28
28
  'data-test-id'?: string;
29
- } & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "onFocus" | "onBlur" | "id" | "disabled" | "readonly" | "name" | "placeholder" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLTextAreaElement>>;
29
+ } & import("react").AriaAttributes & FieldTextAreaOwnProps & Pick<Partial<TextAreaProps>, "value"> & Pick<TextAreaProps, "onFocus" | "onBlur" | "id" | "disabled" | "name" | "readonly" | "placeholder" | "maxLength"> & WrapperProps & import("react").RefAttributes<HTMLTextAreaElement>>;
30
30
  export {};
@@ -0,0 +1,30 @@
1
+ import { TimePickerProps } from '@snack-uikit/calendar';
2
+ import { InputPrivateProps } from '@snack-uikit/input-private';
3
+ import { WithSupportProps } from '@snack-uikit/utils';
4
+ import { FieldDecoratorProps } from '../FieldDecorator';
5
+ type InputProps = Pick<InputPrivateProps, 'id' | 'name' | 'disabled' | 'readonly' | 'onFocus' | 'onBlur'>;
6
+ type WrapperProps = Pick<FieldDecoratorProps, 'className' | 'label' | 'labelTooltip' | 'required' | 'caption' | 'hint' | 'showHintIcon' | 'size' | 'validationState' | 'labelTooltipPlacement' | 'error'>;
7
+ type FieldTimeOwnProps = {
8
+ /** Открыт time-picker */
9
+ open?: boolean;
10
+ /** Колбек открытия пикера */
11
+ onOpenChange?(value: boolean): void;
12
+ /** Значение поля */
13
+ value?: TimePickerProps['value'];
14
+ /** Колбек смены значения */
15
+ onChange?: TimePickerProps['onChangeValue'];
16
+ /** Отображение кнопки копирования */
17
+ showCopyButton?: boolean;
18
+ /** Показывать ли секунды */
19
+ showSeconds?: boolean;
20
+ /**
21
+ * Отображение кнопки Очистки поля
22
+ * @default true
23
+ */
24
+ showClearButton?: boolean;
25
+ };
26
+ export type FieldTimeProps = WithSupportProps<FieldTimeOwnProps & InputProps & WrapperProps>;
27
+ export declare const FieldTime: import("react").ForwardRefExoticComponent<{
28
+ 'data-test-id'?: string;
29
+ } & import("react").AriaAttributes & FieldTimeOwnProps & InputProps & WrapperProps & import("react").RefAttributes<HTMLInputElement>>;
30
+ export {};
@@ -0,0 +1,161 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import mergeRefs from 'merge-refs';
14
+ import { forwardRef, useCallback, useEffect, useMemo, useRef } from 'react';
15
+ import { useUncontrolledProp } from 'uncontrollable';
16
+ import { TimePicker } from '@snack-uikit/calendar';
17
+ import { Dropdown } from '@snack-uikit/dropdown';
18
+ import { WatchSVG } from '@snack-uikit/icons';
19
+ import { ICON_SIZE, InputPrivate, runAfterRerender, SIZE, useButtonNavigation, useClearButton, } from '@snack-uikit/input-private';
20
+ import { extractSupportProps } from '@snack-uikit/utils';
21
+ import { CONTAINER_VARIANT, DEFAULT_LOCALE, SlotKey, TIME_MODES, VALIDATION_STATE } from '../../constants';
22
+ import { FieldContainerPrivate } from '../../helperComponents';
23
+ import { useCopyButton, useDateField, useFocusHandlers, useHandlers } from '../../hooks';
24
+ import { getValidationState } from '../../utils/getValidationState';
25
+ import { FieldDecorator } from '../FieldDecorator';
26
+ import styles from './styles.module.css';
27
+ const getStringTimeValue = (time, { showSeconds, locale }) => {
28
+ var _a, _b, _c;
29
+ if (!time) {
30
+ return '';
31
+ }
32
+ const date = new Date();
33
+ date.setHours((_a = time.hours) !== null && _a !== void 0 ? _a : 0);
34
+ date.setMinutes((_b = time.minutes) !== null && _b !== void 0 ? _b : 0);
35
+ date.setSeconds((_c = time.seconds) !== null && _c !== void 0 ? _c : 0);
36
+ return date.toLocaleTimeString(locale, {
37
+ hour: 'numeric',
38
+ minute: 'numeric',
39
+ second: showSeconds ? 'numeric' : undefined,
40
+ });
41
+ };
42
+ export const FieldTime = forwardRef((_a, ref) => {
43
+ var { id, name, value: valueProp, disabled = false, readonly = false, showCopyButton: showCopyButtonProp = true, showClearButton: showClearButtonProp = true, open, onOpenChange, onChange, onFocus, onBlur: onBlurProp, className, label, labelTooltip, labelTooltipPlacement, required = false, caption, hint, showHintIcon, showSeconds = true, size = SIZE.S, validationState = VALIDATION_STATE.Default, error } = _a, rest = __rest(_a, ["id", "name", "value", "disabled", "readonly", "showCopyButton", "showClearButton", "open", "onOpenChange", "onChange", "onFocus", "onBlur", "className", "label", "labelTooltip", "labelTooltipPlacement", "required", "caption", "hint", "showHintIcon", "showSeconds", "size", "validationState", "error"]);
44
+ const [isOpen, setIsOpen] = useUncontrolledProp(open, false, onOpenChange);
45
+ const localRef = useRef(null);
46
+ const clearButtonRef = useRef(null);
47
+ const copyButtonRef = useRef(null);
48
+ const calendarIconSize = size === SIZE.S ? ICON_SIZE.Xs : ICON_SIZE.S;
49
+ const showDropList = isOpen && !readonly && !disabled;
50
+ const showAdditionalButton = Boolean(valueProp && !disabled);
51
+ const showClearButton = showClearButtonProp && showAdditionalButton && !readonly;
52
+ const showCopyButton = showCopyButtonProp && showAdditionalButton && readonly;
53
+ const fieldValidationState = getValidationState({ validationState, error });
54
+ const navigationStartRef = useRef(null);
55
+ const checkForLeavingFocus = useCallback((event) => {
56
+ if (event.key === 'ArrowDown') {
57
+ setIsOpen(true);
58
+ setTimeout(() => { var _a; return (_a = navigationStartRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, 0);
59
+ }
60
+ }, [setIsOpen]);
61
+ const handleClear = useCallback(() => {
62
+ var _a, _b, _c;
63
+ onChange && onChange(undefined);
64
+ if ((_a = localRef.current) === null || _a === void 0 ? void 0 : _a.value) {
65
+ localRef.current.value = '';
66
+ }
67
+ if (required) {
68
+ (_b = localRef.current) === null || _b === void 0 ? void 0 : _b.focus();
69
+ setIsOpen(true);
70
+ }
71
+ else {
72
+ (_c = localRef.current) === null || _c === void 0 ? void 0 : _c.blur();
73
+ setIsOpen(false);
74
+ }
75
+ }, [onChange, required, setIsOpen]);
76
+ const valueToCopy = getStringTimeValue(valueProp, { showSeconds, locale: DEFAULT_LOCALE });
77
+ const clearButtonSettings = useClearButton({ clearButtonRef, showClearButton, size, onClear: handleClear });
78
+ const copyButtonSettings = useCopyButton({ copyButtonRef, showCopyButton, size, valueToCopy });
79
+ const calendarIcon = useMemo(() => ({
80
+ active: false,
81
+ show: true,
82
+ id: 'watchIcon',
83
+ render: props => (_jsx(WatchSVG, Object.assign({}, props, { size: calendarIconSize, className: styles.calendarIcon, "data-size": size }))),
84
+ }), [calendarIconSize, size]);
85
+ const memorizedButtons = useMemo(() => [clearButtonSettings, copyButtonSettings, calendarIcon], [clearButtonSettings, copyButtonSettings, calendarIcon]);
86
+ const { value, handleChange, handleClick: timeInputClickHandler, handleKeyDown: timeInputKeyDownHandler, handleBlur: timeInputBlurHandler, mask, setInputFocus, } = useDateField({
87
+ inputRef: localRef,
88
+ onChange,
89
+ readonly,
90
+ locale: DEFAULT_LOCALE,
91
+ setIsOpen,
92
+ mode: showSeconds ? TIME_MODES.FullTime : TIME_MODES.NoSeconds,
93
+ showSeconds,
94
+ });
95
+ const setInputFocusFromButtons = useCallback(() => setInputFocus(SlotKey.Seconds), [setInputFocus]);
96
+ const { postfixButtons, inputTabIndex, onInputKeyDown: navigationInputKeyDownHandler, setInitialTabIndices, } = useButtonNavigation({
97
+ setInputFocus: setInputFocusFromButtons,
98
+ inputRef: localRef,
99
+ postfixButtons: memorizedButtons,
100
+ onButtonKeyDown: checkForLeavingFocus,
101
+ readonly,
102
+ submitKeys: ['Enter', 'Space', 'Tab'],
103
+ });
104
+ const handleSelectTime = (time) => {
105
+ var _a;
106
+ onChange && onChange(time);
107
+ (_a = localRef.current) === null || _a === void 0 ? void 0 : _a.focus();
108
+ setIsOpen(false);
109
+ if (localRef.current) {
110
+ localRef.current.value = getStringTimeValue(time, { showSeconds, locale: DEFAULT_LOCALE });
111
+ }
112
+ };
113
+ const handleCalendarFocusLeave = () => {
114
+ setInitialTabIndices();
115
+ // TODO: find out why it works not as expected (focus is moved to the next element instead of the focused one)
116
+ // maybe floating-ui causes the problem
117
+ runAfterRerender(() => {
118
+ setInputFocus(SlotKey.Hours);
119
+ setIsOpen(false);
120
+ });
121
+ };
122
+ const handleInputKeyDown = useHandlers([
123
+ checkForLeavingFocus,
124
+ timeInputKeyDownHandler,
125
+ navigationInputKeyDownHandler,
126
+ ]);
127
+ useEffect(() => {
128
+ var _a;
129
+ if (open) {
130
+ (_a = localRef.current) === null || _a === void 0 ? void 0 : _a.focus();
131
+ }
132
+ }, [open]);
133
+ // TODO input ref - determine whether to update ref based on input/non-input state
134
+ useEffect(() => {
135
+ if (localRef.current && document.activeElement !== localRef.current) {
136
+ localRef.current.value = getStringTimeValue(valueProp, { showSeconds, locale: DEFAULT_LOCALE });
137
+ }
138
+ }, [showSeconds, valueProp]);
139
+ const onFocusByKeyboard = useCallback((e) => {
140
+ setInputFocus();
141
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(e);
142
+ }, [onFocus, setInputFocus]);
143
+ const inputHandlers = useFocusHandlers({
144
+ onFocusByClick: onFocus,
145
+ onFocusByKeyboard,
146
+ });
147
+ const onBlur = useHandlers([timeInputBlurHandler, inputHandlers.onBlur, onBlurProp]);
148
+ const onClick = useCallback((e) => {
149
+ timeInputClickHandler();
150
+ if (isOpen) {
151
+ // stop the event because want picker to stay opened
152
+ e.stopPropagation();
153
+ }
154
+ }, [timeInputClickHandler, isOpen]);
155
+ return (_jsx(FieldDecorator, Object.assign({ className: className, label: label, labelTooltip: labelTooltip, labelTooltipPlacement: labelTooltipPlacement, labelFor: id, required: required, caption: caption, hint: hint, disabled: disabled, readonly: readonly, showHintIcon: showHintIcon, size: size, error: error, validationState: fieldValidationState }, extractSupportProps(rest), { children: _jsx(Dropdown, Object.assign({ trigger: 'click', triggerClassName: styles.triggerClassName, widthStrategy: 'auto' }, (readonly || disabled
156
+ ? { open: false }
157
+ : {
158
+ open: showDropList,
159
+ onOpenChange: setIsOpen,
160
+ }), { content: _jsx(TimePicker, { size: size, value: valueProp, onChangeValue: handleSelectTime, navigationStartRef: navigationStartRef, onFocusLeave: handleCalendarFocusLeave, "data-test-id": 'field-time__timepicker', fitToContainer: false, showSeconds: showSeconds }), children: _jsx(FieldContainerPrivate, { className: styles.container, size: size, validationState: fieldValidationState, disabled: disabled, readonly: readonly, variant: CONTAINER_VARIANT.SingleLine, focused: showDropList, inputRef: localRef, postfix: postfixButtons, children: _jsx(InputPrivate, { ref: mergeRefs(ref, localRef), "data-size": size, value: value || '', placeholder: mask, onChange: handleChange, onFocus: inputHandlers.onFocus, onMouseDown: inputHandlers.onMouseDown, onBlur: onBlur, onKeyDown: handleInputKeyDown, onClick: onClick, disabled: disabled, readonly: readonly, tabIndex: inputTabIndex, type: 'text', id: id, name: name, "data-test-id": 'field-time__input' }) }) })) })));
161
+ });
@@ -0,0 +1 @@
1
+ export * from './FieldTime';
@@ -0,0 +1 @@
1
+ export * from './FieldTime';
@@ -0,0 +1,27 @@
1
+ .triggerClassName{
2
+ --offset:var(--space-drop-list-drop-offset, 4px);
3
+ display:block;
4
+ width:100%;
5
+ }
6
+
7
+ .container .calendarIcon{
8
+ color:var(--sys-neutral-text-light, #8b8e9b);
9
+ }
10
+ .container .calendarIcon[data-size=s]{
11
+ width:var(--size-icon-container-xs, 16px) !important;
12
+ height:var(--size-icon-container-xs, 16px) !important;
13
+ }
14
+ .container .calendarIcon[data-size=m]{
15
+ width:var(--size-icon-container-s, 24px) !important;
16
+ height:var(--size-icon-container-s, 24px) !important;
17
+ }
18
+ .container .calendarIcon[data-size=l]{
19
+ width:var(--size-icon-container-s, 24px) !important;
20
+ height:var(--size-icon-container-s, 24px) !important;
21
+ }
22
+ .container:hover .calendarIcon, .container:focus-within .calendarIcon, .container[data-focused] .calendarIcon{
23
+ color:var(--sys-neutral-text-support, #6d707f);
24
+ }
25
+ .container[data-disabled] .calendarIcon, .container[data-readonly] .calendarIcon{
26
+ color:var(--sys-neutral-text-disabled, #aaaebd);
27
+ }
@@ -1,9 +1,10 @@
1
+ export * from './FieldColor';
2
+ export * from './FieldDate';
1
3
  export * from './FieldDecorator';
2
- export * from './FieldText';
3
- export * from './FieldTextArea';
4
4
  export * from './FieldSecure';
5
- export * from './FieldDate';
6
5
  export * from './FieldSelect';
7
- export * from './FieldStepper';
8
6
  export * from './FieldSlider';
9
- export * from './FieldColor';
7
+ export * from './FieldStepper';
8
+ export * from './FieldText';
9
+ export * from './FieldTextArea';
10
+ export * from './FieldTime';
@@ -1,9 +1,10 @@
1
+ export * from './FieldColor';
2
+ export * from './FieldDate';
1
3
  export * from './FieldDecorator';
2
- export * from './FieldText';
3
- export * from './FieldTextArea';
4
4
  export * from './FieldSecure';
5
- export * from './FieldDate';
6
5
  export * from './FieldSelect';
7
- export * from './FieldStepper';
8
6
  export * from './FieldSlider';
9
- export * from './FieldColor';
7
+ export * from './FieldStepper';
8
+ export * from './FieldText';
9
+ export * from './FieldTextArea';
10
+ export * from './FieldTime';
@@ -0,0 +1,24 @@
1
+ import { Mode, NoSecondsMode, Slot, TimeMode } from '../types';
2
+ export declare enum SlotKey {
3
+ Day = "D",
4
+ Month = "M",
5
+ Year = "Y",
6
+ Hours = "h",
7
+ Minutes = "m",
8
+ Seconds = "s"
9
+ }
10
+ export declare const MODES: {
11
+ readonly Date: "date";
12
+ readonly DateTime: "date-time";
13
+ };
14
+ export declare const TIME_MODES: {
15
+ readonly FullTime: "full-time";
16
+ readonly NoSeconds: "no-seconds";
17
+ };
18
+ export declare const NO_SECONDS_MODE = "date-time-no-sec";
19
+ export declare const MASK: Record<Mode | TimeMode | NoSecondsMode, Record<string, string>>;
20
+ export declare const DEFAULT_LOCALE: Intl.Locale;
21
+ export declare const SLOTS: Record<Mode | TimeMode | NoSecondsMode, Record<SlotKey | string, Slot>>;
22
+ export type FocusSlot = SlotKey | 'auto';
23
+ export declare const SLOT_ORDER: Record<Mode | TimeMode | NoSecondsMode, SlotKey[]>;
24
+ export declare const SLOTS_PLACEHOLDER: Record<Mode | TimeMode | NoSecondsMode, Record<string, Partial<Record<SlotKey, string>>>>;