@tedi-design-system/react 18.1.0-rc.9 → 18.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle-stats.html +1 -1
- package/index.css +1 -1
- package/package.json +12 -6
- package/src/community/components/anchor/anchor.d.ts +1 -0
- package/src/community/components/button/button.d.ts +1 -0
- package/src/community/components/card/card-content/card-content.d.ts +3 -0
- package/src/community/components/card/card-header/card-header.d.ts +3 -0
- package/src/community/components/card/card-notification/card-notification.d.ts +3 -0
- package/src/community/components/card/card.d.ts +3 -0
- package/src/community/components/dropdown/dropdown.cjs.js +1 -1
- package/src/community/components/dropdown/dropdown.d.ts +3 -0
- package/src/community/components/dropdown/dropdown.es.js +5 -6
- package/src/community/components/form/choice-group/choice-group.d.ts +3 -0
- package/src/community/components/form/file-upload/file-upload.d.ts +6 -0
- package/src/community/components/form/radio/radio.d.ts +3 -0
- package/src/community/components/form/select/select.d.ts +3 -0
- package/src/community/components/form/toggle/toggle.cjs.js +1 -1
- package/src/community/components/form/toggle/toggle.d.ts +3 -0
- package/src/community/components/form/toggle/toggle.es.js +5 -6
- package/src/community/components/layout/header/components/header-language/header-language.d.ts +3 -0
- package/src/community/components/layout/header/components/header-role/header-role.d.ts +3 -0
- package/src/community/components/layout/header/components/sidenav-toggle/sidenav-toggle.d.ts +3 -0
- package/src/community/components/layout/header/header/header.d.ts +3 -0
- package/src/community/components/layout/sidenav/sidenav.d.ts +3 -0
- package/src/community/components/map-components/button-group/button-group.module.scss.cjs.js +1 -1
- package/src/community/components/map-components/button-group/button-group.module.scss.es.js +1 -0
- package/src/community/components/map-components/left-panel/left-panel-content.cjs.js +1 -1
- package/src/community/components/map-components/left-panel/left-panel-content.d.ts +10 -5
- package/src/community/components/map-components/left-panel/left-panel-content.es.js +7 -21
- package/src/community/components/map-components/left-panel/left-panel-footer.cjs.js +1 -1
- package/src/community/components/map-components/left-panel/left-panel-footer.d.ts +11 -1
- package/src/community/components/map-components/left-panel/left-panel-footer.es.js +7 -24
- package/src/community/components/map-components/left-panel/left-panel-header.cjs.js +1 -1
- package/src/community/components/map-components/left-panel/left-panel-header.d.ts +11 -1
- package/src/community/components/map-components/left-panel/left-panel-header.es.js +7 -62
- package/src/community/components/map-components/left-panel/left-panel.cjs.js +1 -1
- package/src/community/components/map-components/left-panel/left-panel.d.ts +67 -5
- package/src/community/components/map-components/left-panel/left-panel.es.js +85 -14
- package/src/community/components/map-components/left-panel/left-panel.module.scss.cjs.js +1 -1
- package/src/community/components/map-components/left-panel/left-panel.module.scss.es.js +4 -4
- package/src/community/components/map-components/map-button/map-button.cjs.js +1 -1
- package/src/community/components/map-components/map-button/map-button.d.ts +8 -3
- package/src/community/components/map-components/map-button/map-button.es.js +42 -33
- package/src/community/components/map-components/map-button/map-button.module.scss.cjs.js +1 -1
- package/src/community/components/map-components/map-button/map-button.module.scss.es.js +3 -0
- package/src/community/components/map-components/resizer/resizer.cjs.js +1 -1
- package/src/community/components/map-components/resizer/resizer.es.js +9 -10
- package/src/community/components/status/status.d.ts +3 -0
- package/src/community/components/table/table.d.ts +3 -0
- package/src/community/components/tag/tag.d.ts +3 -0
- package/src/community/components/toggle-open/toggle-open.d.ts +3 -0
- package/src/community/components/tooltip/tooltip-trigger.cjs.js +1 -1
- package/src/community/components/tooltip/tooltip-trigger.d.ts +3 -0
- package/src/community/components/tooltip/tooltip-trigger.es.js +15 -14
- package/src/community/components/tooltip/tooltip.d.ts +3 -0
- package/src/tedi/components/buttons/button-content/button-content.cjs.js +1 -1
- package/src/tedi/components/buttons/button-content/button-content.es.js +31 -30
- package/src/tedi/components/buttons/collapse-button/collapse-button.cjs.js +1 -1
- package/src/tedi/components/buttons/collapse-button/collapse-button.es.js +2 -1
- package/src/tedi/components/content/label/label.cjs.js +1 -1
- package/src/tedi/components/content/label/label.d.ts +4 -3
- package/src/tedi/components/content/label/label.es.js +24 -27
- package/src/tedi/components/content/label/label.module.scss.cjs.js +1 -1
- package/src/tedi/components/content/label/label.module.scss.es.js +2 -1
- package/src/tedi/components/content/table/table.cjs.js +1 -1
- package/src/tedi/components/content/table/table.d.ts +8 -5
- package/src/tedi/components/content/table/table.es.js +308 -295
- package/src/tedi/components/form/checkbox/checkbox.cjs.js +1 -1
- package/src/tedi/components/form/checkbox/checkbox.es.js +64 -58
- package/src/tedi/components/form/choice-group/choice-group.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/choice-group.es.js +98 -85
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.cjs.js +1 -1
- package/src/tedi/components/form/choice-group/components/choice-group-item/choice-group-item.es.js +13 -14
- package/src/tedi/components/form/choice-input.types.d.ts +3 -2
- package/src/tedi/components/form/date-field/date-field.cjs.js +1 -1
- package/src/tedi/components/form/date-field/date-field.d.ts +15 -0
- package/src/tedi/components/form/date-field/date-field.es.js +304 -269
- package/src/tedi/components/form/file-dropzone/file-dropzone.cjs.js +1 -1
- package/src/tedi/components/form/file-dropzone/file-dropzone.es.js +90 -79
- package/src/tedi/components/form/file-upload/file-upload.cjs.js +1 -1
- package/src/tedi/components/form/file-upload/file-upload.d.ts +4 -1
- package/src/tedi/components/form/file-upload/file-upload.es.js +138 -119
- package/src/tedi/components/form/file-upload/file-upload.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/file-upload/file-upload.module.scss.es.js +1 -1
- package/src/tedi/components/form/form-label/form-label.d.ts +1 -1
- package/src/tedi/components/form/multi-value-field/multi-value-field.cjs.js +1 -1
- package/src/tedi/components/form/multi-value-field/multi-value-field.d.ts +8 -0
- package/src/tedi/components/form/multi-value-field/multi-value-field.es.js +147 -66
- package/src/tedi/components/form/multi-value-field/multi-value-field.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/multi-value-field/multi-value-field.module.scss.es.js +3 -0
- package/src/tedi/components/form/number-field/number-field.cjs.js +1 -1
- package/src/tedi/components/form/number-field/number-field.es.js +117 -112
- package/src/tedi/components/form/radio/radio.cjs.js +1 -1
- package/src/tedi/components/form/radio/radio.es.js +24 -23
- package/src/tedi/components/form/search/search.cjs.js +1 -1
- package/src/tedi/components/form/search/search.es.js +60 -40
- package/src/tedi/components/form/search/search.module.scss.cjs.js +1 -1
- package/src/tedi/components/form/search/search.module.scss.es.js +7 -3
- package/src/tedi/components/form/select/components/select-input.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-input.es.js +24 -15
- package/src/tedi/components/form/select/components/select-multi-value-remove.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-multi-value-remove.es.js +11 -11
- package/src/tedi/components/form/select/components/select-multi-value.cjs.js +1 -1
- package/src/tedi/components/form/select/components/select-multi-value.es.js +34 -30
- package/src/tedi/components/form/select/select.cjs.js +1 -1
- package/src/tedi/components/form/select/select.d.ts +14 -0
- package/src/tedi/components/form/select/select.es.js +274 -267
- package/src/tedi/components/layout/header/components/header-language/header-language.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-language/header-language.es.js +105 -0
- package/src/tedi/components/layout/header/components/header-language/header-language.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-language/header-language.module.scss.es.js +12 -0
- package/src/tedi/components/layout/header/components/header-login/header-login.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-login/header-login.es.js +36 -0
- package/src/tedi/components/layout/header/components/header-login/header-login.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-login/header-login.module.scss.es.js +8 -0
- package/src/tedi/components/layout/header/components/header-logout/header-logout.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-logout/header-logout.es.js +33 -0
- package/src/tedi/components/layout/header/components/header-logout/header-logout.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-logout/header-logout.module.scss.es.js +7 -0
- package/src/tedi/components/layout/header/components/header-mobile-button/header-mobile-button.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-mobile-button/header-mobile-button.es.js +25 -0
- package/src/tedi/components/layout/header/components/header-mobile-button/header-mobile-button.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-mobile-button/header-mobile-button.module.scss.es.js +10 -0
- package/src/tedi/components/layout/header/components/header-profile/header-profile.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-profile/header-profile.es.js +136 -0
- package/src/tedi/components/layout/header/components/header-profile/header-profile.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-profile/header-profile.module.scss.es.js +14 -0
- package/src/tedi/components/layout/header/components/header-role/header-role-representatives.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-role/header-role-representatives.es.js +89 -0
- package/src/tedi/components/layout/header/components/header-role/header-role.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-role/header-role.es.js +162 -0
- package/src/tedi/components/layout/header/components/header-role/header-role.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-role/header-role.module.scss.es.js +25 -0
- package/src/tedi/components/layout/header/components/header-search/header-search.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-search/header-search.es.js +60 -0
- package/src/tedi/components/layout/header/components/header-search/header-search.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/header/components/header-search/header-search.module.scss.es.js +9 -0
- package/src/tedi/components/layout/header/header.cjs.js +1 -0
- package/src/tedi/components/layout/header/header.es.js +63 -0
- package/src/tedi/components/layout/header/header.module.scss.cjs.js +1 -0
- package/src/tedi/components/layout/header/header.module.scss.es.js +13 -0
- package/src/tedi/components/layout/hide-at/hide-at.cjs.js +1 -0
- package/src/tedi/components/layout/hide-at/hide-at.es.js +10 -0
- package/src/tedi/components/layout/show-at/show-at.cjs.js +1 -0
- package/src/tedi/components/layout/show-at/show-at.es.js +10 -0
- package/src/tedi/components/loaders/spinner/spinner.cjs.js +1 -1
- package/src/tedi/components/loaders/spinner/spinner.d.ts +7 -0
- package/src/tedi/components/loaders/spinner/spinner.es.js +29 -18
- package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/dropdown/dropdown-trigger/dropdown-trigger.es.js +8 -7
- package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/modal/modal-trigger/modal-trigger.es.js +10 -9
- package/src/tedi/components/overlays/overlay/overlay-content.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-content.es.js +14 -12
- package/src/tedi/components/overlays/overlay/overlay-trigger.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay-trigger.es.js +20 -19
- package/src/tedi/components/overlays/overlay/overlay.cjs.js +1 -1
- package/src/tedi/components/overlays/overlay/overlay.d.ts +10 -0
- package/src/tedi/components/overlays/overlay/overlay.es.js +74 -71
- package/src/tedi/components/overlays/tooltip/index.d.ts +1 -0
- package/src/tedi/components/overlays/tooltip/info-tooltip.cjs.js +1 -0
- package/src/tedi/components/overlays/tooltip/info-tooltip.d.ts +52 -0
- package/src/tedi/components/overlays/tooltip/info-tooltip.es.js +24 -0
- package/src/tedi/components/tags/tag/tag.cjs.js +1 -1
- package/src/tedi/components/tags/tag/tag.d.ts +9 -0
- package/src/tedi/components/tags/tag/tag.es.js +18 -17
- package/src/tedi/helpers/get-element-ref.cjs.js +1 -0
- package/src/tedi/helpers/get-element-ref.d.ts +11 -0
- package/src/tedi/helpers/get-element-ref.es.js +8 -0
- package/src/tedi/helpers/hooks/use-file-upload.cjs.js +1 -1
- package/src/tedi/helpers/hooks/use-file-upload.es.js +71 -66
- package/src/tedi/index.d.ts +3 -0
- package/src/tedi/providers/label-provider/labels-map.cjs.js +1 -1
- package/src/tedi/providers/label-provider/labels-map.d.ts +69 -6
- package/src/tedi/providers/label-provider/labels-map.es.js +137 -74
- package/tedi.cjs.js +1 -1
- package/tedi.es.js +305 -281
|
@@ -1,217 +1,231 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useFloating as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Calendar as
|
|
6
|
-
import { MultiValueField as
|
|
7
|
-
import { TextField as
|
|
8
|
-
import
|
|
9
|
-
import { getLocaleDateParts as
|
|
10
|
-
import { DatePickerModal as
|
|
11
|
-
import { useBreakpointProps as
|
|
12
|
-
import { useLabels as
|
|
13
|
-
import { et as
|
|
14
|
-
import
|
|
15
|
-
import { autoUpdate as
|
|
16
|
-
import { offset as
|
|
17
|
-
import { dateMatchModifiers as
|
|
18
|
-
const
|
|
19
|
-
const { getCurrentBreakpointProps:
|
|
20
|
-
useNativePicker:
|
|
21
|
-
enableCalendar:
|
|
22
|
-
calendarTrigger:
|
|
23
|
-
numberOfMonths:
|
|
24
|
-
} =
|
|
25
|
-
id:
|
|
1
|
+
import { jsxs as Ct, Fragment as Mt, jsx as D } from "react/jsx-runtime";
|
|
2
|
+
import { useFloating as At, useClick as xt, useInteractions as Ft, useDismiss as vt, useRole as wt, FloatingPortal as Nt, FloatingFocusManager as kt } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
|
|
3
|
+
import V from "../../../../../external/classnames/index.es.js";
|
|
4
|
+
import B, { useState as _, useCallback as ue, useEffect as T, useMemo as me } from "react";
|
|
5
|
+
import { Calendar as Pt } from "../../content/calendar/calendar.es.js";
|
|
6
|
+
import { MultiValueField as Et } from "../multi-value-field/multi-value-field.es.js";
|
|
7
|
+
import { TextField as Ot } from "../textfield/textfield.es.js";
|
|
8
|
+
import g from "./date-field.module.scss.es.js";
|
|
9
|
+
import { getLocaleDateParts as Rt, buildDateRegexSource as It, resolveRangeSelection as Vt, CALENDAR_POPOVER_OFFSET as Bt, CALENDAR_POPOVER_PADDING as $e } from "./date-field-helpers.es.js";
|
|
10
|
+
import { DatePickerModal as Tt } from "./date-picker-modal/date-picker-modal.es.js";
|
|
11
|
+
import { useBreakpointProps as $t } from "../../../helpers/hooks/use-breakpoint-props.es.js";
|
|
12
|
+
import { useLabels as Lt } from "../../../providers/label-provider/use-labels.es.js";
|
|
13
|
+
import { et as jt } from "../../../../../external/react-day-picker/dist/esm/locale/et.es.js";
|
|
14
|
+
import Ht, { isBreakpointBelow as Le } from "../../../helpers/hooks/use-breakpoint.es.js";
|
|
15
|
+
import { autoUpdate as Wt } from "../../../../../external/@floating-ui/dom/dist/floating-ui.dom.es.js";
|
|
16
|
+
import { offset as Yt, flip as St, shift as Ut, size as qt } from "../../../../../external/@floating-ui/react-dom/dist/floating-ui.react-dom.es.js";
|
|
17
|
+
import { dateMatchModifiers as zt } from "../../../../../external/react-day-picker/dist/esm/utils/dateMatchModifiers.es.js";
|
|
18
|
+
const Gt = B.forwardRef(($, v) => {
|
|
19
|
+
const { getCurrentBreakpointProps: je } = $t($.defaultServerBreakpoint), { getLabel: z } = Lt(), {
|
|
20
|
+
useNativePicker: He = !1,
|
|
21
|
+
enableCalendar: m = !0,
|
|
22
|
+
calendarTrigger: L = "button",
|
|
23
|
+
numberOfMonths: G
|
|
24
|
+
} = je($), {
|
|
25
|
+
id: pe,
|
|
26
26
|
mode: s = "single",
|
|
27
|
-
label:
|
|
28
|
-
selected:
|
|
27
|
+
label: he,
|
|
28
|
+
selected: w,
|
|
29
29
|
onSelect: a,
|
|
30
|
-
disabled:
|
|
31
|
-
disabledMatchers:
|
|
32
|
-
placeholder:
|
|
33
|
-
className:
|
|
34
|
-
formatDate:
|
|
35
|
-
required:
|
|
36
|
-
showOutsideDays:
|
|
37
|
-
parseDate:
|
|
38
|
-
monthYearSelectType:
|
|
39
|
-
|
|
30
|
+
disabled: N,
|
|
31
|
+
disabledMatchers: k,
|
|
32
|
+
placeholder: We,
|
|
33
|
+
className: Ye,
|
|
34
|
+
formatDate: f,
|
|
35
|
+
required: j,
|
|
36
|
+
showOutsideDays: ge = !0,
|
|
37
|
+
parseDate: Se,
|
|
38
|
+
monthYearSelectType: ye,
|
|
39
|
+
tagsDirection: Ue,
|
|
40
|
+
showNavigation: be = !0,
|
|
40
41
|
selectionLevel: P = "days",
|
|
41
|
-
initialView:
|
|
42
|
-
locale:
|
|
42
|
+
initialView: H,
|
|
43
|
+
locale: De = jt,
|
|
43
44
|
localeCode: W = "et-EE",
|
|
44
45
|
initialMonth: Y,
|
|
45
|
-
closeOnSelect:
|
|
46
|
-
footer:
|
|
47
|
-
defaultValue:
|
|
48
|
-
minDate:
|
|
49
|
-
maxDate:
|
|
50
|
-
disablePast:
|
|
51
|
-
disableFuture:
|
|
52
|
-
shouldDisableMonth:
|
|
53
|
-
shouldDisableYear:
|
|
54
|
-
readOnly:
|
|
55
|
-
availableDays:
|
|
56
|
-
inputProps:
|
|
57
|
-
modal:
|
|
58
|
-
modalProps:
|
|
59
|
-
modalTitle:
|
|
60
|
-
disabledDateErrorMessage:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
46
|
+
closeOnSelect: qe,
|
|
47
|
+
footer: _e,
|
|
48
|
+
defaultValue: S,
|
|
49
|
+
minDate: X,
|
|
50
|
+
maxDate: J,
|
|
51
|
+
disablePast: Ce,
|
|
52
|
+
disableFuture: Me,
|
|
53
|
+
shouldDisableMonth: K,
|
|
54
|
+
shouldDisableYear: Q,
|
|
55
|
+
readOnly: E,
|
|
56
|
+
availableDays: Ae,
|
|
57
|
+
inputProps: i,
|
|
58
|
+
modal: Z = !1,
|
|
59
|
+
modalProps: ze,
|
|
60
|
+
modalTitle: Ge,
|
|
61
|
+
disabledDateErrorMessage: Xe = z("dateField.disabledDateError"),
|
|
62
|
+
invalidDateErrorMessage: Je = z("dateField.invalidDateError"),
|
|
63
|
+
useNativePicker: Xt,
|
|
64
|
+
enableCalendar: Jt,
|
|
65
|
+
calendarTrigger: Kt,
|
|
66
|
+
numberOfMonths: Qt,
|
|
67
|
+
defaultServerBreakpoint: Zt,
|
|
68
|
+
sm: er,
|
|
69
|
+
md: tr,
|
|
70
|
+
lg: rr,
|
|
71
|
+
xl: ar,
|
|
72
|
+
xxl: ir,
|
|
73
|
+
...xe
|
|
74
|
+
} = $, c = He && s === "single", Fe = Ht($.defaultServerBreakpoint), x = Le(Fe, "md"), [Ke, y] = _(w ?? S), [p, O] = _(!1), [ee, ve] = _(!1), [Qe, we] = _(H ?? P), [te, b] = _(""), [Ne, u] = _(!1), [ke, re] = _(!1), h = m && !c && !E && (Z === !0 || typeof Z == "string" && Le(Fe, Z)), Pe = x && !h && typeof G == "number" && G > 1 ? 1 : G, d = w !== void 0, n = d ? w : Ke, ae = B.useRef(null), Ee = B.useRef(null), Ze = B.useCallback(
|
|
73
75
|
(e) => {
|
|
74
|
-
|
|
76
|
+
ae.current = e, typeof v == "function" ? v(e) : v && (v.current = e);
|
|
75
77
|
},
|
|
76
|
-
[
|
|
77
|
-
),
|
|
78
|
+
[v]
|
|
79
|
+
), et = (e) => {
|
|
78
80
|
if (!e) return "";
|
|
79
|
-
const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"),
|
|
80
|
-
return `${t}-${r}-${
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}, [
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
}, [
|
|
89
|
-
const
|
|
81
|
+
const t = e.getFullYear(), r = String(e.getMonth() + 1).padStart(2, "0"), o = String(e.getDate()).padStart(2, "0");
|
|
82
|
+
return `${t}-${r}-${o}`;
|
|
83
|
+
}, tt = c && n instanceof Date ? et(n) : "", ie = ue((e, t) => e instanceof Date ? e : Array.isArray(e) && e.length > 0 ? [...e].sort((r, o) => r.getTime() - o.getTime())[0] : e && typeof e == "object" && "from" in e && e.from instanceof Date ? e.from : e && typeof e == "object" && "to" in e && e.to instanceof Date ? e.to : t ?? /* @__PURE__ */ new Date(), []), [rt, oe] = _(() => ie(n, Y));
|
|
84
|
+
T(() => {
|
|
85
|
+
p || oe(ie(n, Y));
|
|
86
|
+
}, [n, Y, p, ie]), T(() => {
|
|
87
|
+
p && we(H ?? P);
|
|
88
|
+
}, [p, P, H]), T(() => {
|
|
89
|
+
d && y(w);
|
|
90
|
+
}, [w, d]);
|
|
91
|
+
const C = me(
|
|
90
92
|
() => new Intl.DateTimeFormat(W, {
|
|
91
93
|
day: "2-digit",
|
|
92
94
|
month: "2-digit",
|
|
93
95
|
year: "numeric"
|
|
94
96
|
}),
|
|
95
97
|
[W]
|
|
96
|
-
), M =
|
|
98
|
+
), M = ue(
|
|
97
99
|
(e) => {
|
|
98
100
|
if (!e) return "";
|
|
99
|
-
if (e instanceof Date) return
|
|
100
|
-
if (Array.isArray(e)) return e.map((t) =>
|
|
101
|
+
if (e instanceof Date) return C.format(e);
|
|
102
|
+
if (Array.isArray(e)) return e.map((t) => C.format(t)).join(", ");
|
|
101
103
|
if (e.from) {
|
|
102
|
-
const t =
|
|
103
|
-
return e.to ? `${t} – ${
|
|
104
|
+
const t = C.format(e.from);
|
|
105
|
+
return e.to ? `${t} – ${C.format(e.to)}` : t;
|
|
104
106
|
}
|
|
105
107
|
return "";
|
|
106
108
|
},
|
|
107
|
-
[
|
|
108
|
-
),
|
|
109
|
+
[C]
|
|
110
|
+
), ne = qe ?? s === "single", Oe = s === "multiple" && Array.isArray(n) ? n.map((e, t) => ({
|
|
109
111
|
id: t,
|
|
110
|
-
label:
|
|
112
|
+
label: f ? f(e) : M(e),
|
|
111
113
|
date: e
|
|
112
|
-
})) : [],
|
|
114
|
+
})) : [], U = me(() => {
|
|
113
115
|
const e = [];
|
|
114
|
-
return
|
|
116
|
+
return N && (Array.isArray(N) ? e.push(...N) : e.push(N)), k && (Array.isArray(k) ? e.push(...k) : e.push(k)), X && e.push({ before: X }), J && e.push({ after: J }), Ce && e.push({ before: /* @__PURE__ */ new Date() }), Me && e.push({ after: /* @__PURE__ */ new Date() }), K && e.push((t) => K(t)), Q && e.push((t) => Q(t)), e;
|
|
115
117
|
}, [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
z,
|
|
119
|
-
G,
|
|
120
|
-
he,
|
|
121
|
-
ge,
|
|
118
|
+
N,
|
|
119
|
+
k,
|
|
122
120
|
X,
|
|
123
|
-
J
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
121
|
+
J,
|
|
122
|
+
Ce,
|
|
123
|
+
Me,
|
|
124
|
+
K,
|
|
125
|
+
Q
|
|
126
|
+
]), F = ue(
|
|
127
|
+
(e) => zt(e, U),
|
|
128
|
+
[U]
|
|
129
|
+
), at = (e, t, r, o) => {
|
|
130
|
+
const l = s === "range" ? Vt(e, n, t) : e;
|
|
131
|
+
if (u(!1), d || y(l), a == null || a(l, t, r, o), l) {
|
|
132
|
+
const A = f ? f(l) : M(l);
|
|
133
|
+
b(A);
|
|
132
134
|
} else
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
},
|
|
136
|
-
if (
|
|
137
|
-
const t = s === "range" ? { from: e, to: void 0 } : s === "multiple" ? [...Array.isArray(
|
|
138
|
-
|
|
139
|
-
const r =
|
|
140
|
-
|
|
141
|
-
},
|
|
142
|
-
const e =
|
|
143
|
-
return (
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
146
|
-
const
|
|
147
|
-
r.forEach((
|
|
148
|
-
|
|
135
|
+
b("");
|
|
136
|
+
ne && O(!1);
|
|
137
|
+
}, it = (e) => {
|
|
138
|
+
if (F(e)) return;
|
|
139
|
+
const t = s === "range" ? { from: e, to: void 0 } : s === "multiple" ? [...Array.isArray(n) ? n : [], e] : e;
|
|
140
|
+
u(!1), d || y(t), a == null || a(t, e, {}, {});
|
|
141
|
+
const r = f ? f(t) : M(t);
|
|
142
|
+
b(r), ne && O(!1);
|
|
143
|
+
}, ot = me(() => {
|
|
144
|
+
const e = Rt(C), t = new RegExp(`^${It(e)}$`), { fieldOrder: r } = e;
|
|
145
|
+
return (o) => {
|
|
146
|
+
const l = o.match(t);
|
|
147
|
+
if (!l) return;
|
|
148
|
+
const A = {};
|
|
149
|
+
r.forEach((Dt, _t) => {
|
|
150
|
+
A[Dt] = Number(l[_t + 1]);
|
|
149
151
|
});
|
|
150
|
-
const { day:
|
|
151
|
-
if (
|
|
152
|
-
const
|
|
153
|
-
if (!(isNaN(
|
|
154
|
-
return
|
|
152
|
+
const { day: fe, month: de, year: ce } = A;
|
|
153
|
+
if (fe === void 0 || de === void 0 || ce === void 0) return;
|
|
154
|
+
const I = new Date(ce, de - 1, fe);
|
|
155
|
+
if (!(isNaN(I.getTime()) || I.getFullYear() !== ce || I.getMonth() !== de - 1 || I.getDate() !== fe))
|
|
156
|
+
return I;
|
|
155
157
|
};
|
|
156
|
-
}, [
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
}, [C]), Re = (e) => (Se ?? (s === "single" ? ot : () => {
|
|
159
|
+
}))(e), Ie = (e) => s === "single" && e instanceof Date || s === "multiple" && Array.isArray(e) || s === "range" && !!e && !Array.isArray(e) && "from" in e, nt = (e) => {
|
|
160
|
+
if (b(e), re(!1), e.trim() === "") {
|
|
161
|
+
u(!1);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const t = Re(e);
|
|
165
|
+
if (!Ie(t)) {
|
|
166
|
+
u(!1);
|
|
159
167
|
return;
|
|
160
168
|
}
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
p(!1);
|
|
169
|
+
const o = t && !Array.isArray(t) && "from" in t ? t : null;
|
|
170
|
+
if (t instanceof Date && F(t) || Array.isArray(t) && t.some((A) => A instanceof Date && F(A)) || !!o && (o.from && F(o.from) || o.to && F(o.to))) {
|
|
171
|
+
u(!0);
|
|
165
172
|
return;
|
|
166
173
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
174
|
+
u(!1), d || y(t), a == null || a(t, t, {}, {}), t instanceof Date && oe(t), ne && O(!1);
|
|
175
|
+
}, st = () => {
|
|
176
|
+
if (te.trim() === "") {
|
|
177
|
+
re(!1);
|
|
170
178
|
return;
|
|
171
179
|
}
|
|
172
|
-
|
|
180
|
+
re(!Ie(Re(te)));
|
|
173
181
|
};
|
|
174
|
-
|
|
175
|
-
if (
|
|
176
|
-
const e =
|
|
177
|
-
|
|
182
|
+
T(() => {
|
|
183
|
+
if (d) {
|
|
184
|
+
const e = f ? f(n) : M(n);
|
|
185
|
+
b(e);
|
|
178
186
|
}
|
|
179
|
-
}, [
|
|
180
|
-
if (!
|
|
181
|
-
const e =
|
|
182
|
-
|
|
187
|
+
}, [n, d, f, M]), T(() => {
|
|
188
|
+
if (!d && S) {
|
|
189
|
+
const e = f ? f(S) : M(S);
|
|
190
|
+
b(e);
|
|
183
191
|
}
|
|
184
192
|
}, []);
|
|
185
|
-
const
|
|
186
|
-
open:
|
|
187
|
-
onOpenChange:
|
|
188
|
-
placement:
|
|
193
|
+
const lt = At({
|
|
194
|
+
open: p,
|
|
195
|
+
onOpenChange: O,
|
|
196
|
+
placement: L === "input" ? "bottom-start" : "bottom-end",
|
|
189
197
|
middleware: [
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
padding:
|
|
198
|
+
Yt(Bt),
|
|
199
|
+
St(),
|
|
200
|
+
Ut({ padding: $e }),
|
|
201
|
+
qt({
|
|
202
|
+
padding: $e,
|
|
195
203
|
apply({ availableWidth: e, elements: t }) {
|
|
196
204
|
const r = t.floating;
|
|
197
|
-
if (r.style.width = "", r.style.maxWidth = "", r.style.overflowX = "",
|
|
205
|
+
if (r.style.width = "", r.style.maxWidth = "", r.style.overflowX = "", x) return;
|
|
198
206
|
r.style.width = "max-content", r.getBoundingClientRect().width > e && (r.style.width = "min-content", r.style.maxWidth = `${e}px`);
|
|
199
207
|
}
|
|
200
208
|
})
|
|
201
209
|
],
|
|
202
|
-
whileElementsMounted:
|
|
203
|
-
}), { refs:
|
|
204
|
-
...
|
|
205
|
-
|
|
210
|
+
whileElementsMounted: Wt
|
|
211
|
+
}), { refs: R, context: q, x: ft, y: dt, strategy: ct } = lt, ut = xt(q), Ve = Ft([
|
|
212
|
+
...m && !c && L === "input" && !h ? [ut] : [],
|
|
213
|
+
vt(q, {
|
|
206
214
|
outsidePress: (e) => {
|
|
207
215
|
const t = e.target;
|
|
208
216
|
return !(t != null && t.closest('[role="menu"], [role="listbox"]'));
|
|
209
217
|
}
|
|
210
218
|
}),
|
|
211
|
-
|
|
212
|
-
])
|
|
219
|
+
wt(q, { role: "dialog" })
|
|
220
|
+
]);
|
|
221
|
+
B.useEffect(() => {
|
|
222
|
+
var t, r;
|
|
223
|
+
const e = s === "multiple" ? ((t = Ee.current) == null ? void 0 : t.wrapper) ?? null : ((r = ae.current) == null ? void 0 : r.input) ?? null;
|
|
224
|
+
R.setPositionReference(e ?? R.reference.current);
|
|
225
|
+
}, [s, p, R]);
|
|
226
|
+
const mt = () => {
|
|
213
227
|
var t;
|
|
214
|
-
const e = (t =
|
|
228
|
+
const e = (t = ae.current) == null ? void 0 : t.input;
|
|
215
229
|
if (e) {
|
|
216
230
|
if (typeof e.showPicker == "function")
|
|
217
231
|
try {
|
|
@@ -221,161 +235,182 @@ const Vt = oe.forwardRef((I, w) => {
|
|
|
221
235
|
}
|
|
222
236
|
e.focus();
|
|
223
237
|
}
|
|
224
|
-
},
|
|
225
|
-
!
|
|
226
|
-
},
|
|
227
|
-
if (
|
|
228
|
-
const t =
|
|
229
|
-
|
|
238
|
+
}, se = () => {
|
|
239
|
+
!m || E || (c ? mt() : h ? ve(!0) : O((e) => !e));
|
|
240
|
+
}, pt = (e) => {
|
|
241
|
+
if (u(!1), d || y(e), a == null || a(e, e, {}, {}), e) {
|
|
242
|
+
const t = f ? f(e) : M(e);
|
|
243
|
+
b(t);
|
|
230
244
|
} else
|
|
231
|
-
|
|
232
|
-
},
|
|
245
|
+
b("");
|
|
246
|
+
}, ht = (e) => {
|
|
233
247
|
if (!e) {
|
|
234
|
-
|
|
248
|
+
u(!1), d || y(void 0), a == null || a(void 0, void 0, {}, {});
|
|
235
249
|
return;
|
|
236
250
|
}
|
|
237
|
-
const [t, r,
|
|
238
|
-
if (!t || !r || !
|
|
239
|
-
const
|
|
240
|
-
if (!Number.isNaN(
|
|
241
|
-
if (
|
|
242
|
-
|
|
251
|
+
const [t, r, o] = e.split("-").map(Number);
|
|
252
|
+
if (!t || !r || !o) return;
|
|
253
|
+
const l = new Date(t, r - 1, o);
|
|
254
|
+
if (!Number.isNaN(l.getTime())) {
|
|
255
|
+
if (F(l)) {
|
|
256
|
+
u(!0);
|
|
243
257
|
return;
|
|
244
258
|
}
|
|
245
|
-
|
|
259
|
+
u(!1), d || y(l), a == null || a(l, l, {}, {});
|
|
246
260
|
}
|
|
261
|
+
}, gt = Ve.getReferenceProps(
|
|
262
|
+
h && L === "input" ? { onClick: () => se() } : void 0
|
|
263
|
+
), {
|
|
264
|
+
role: or,
|
|
265
|
+
"aria-expanded": nr,
|
|
266
|
+
"aria-haspopup": sr,
|
|
267
|
+
"aria-controls": yt,
|
|
268
|
+
...bt
|
|
269
|
+
} = gt, Be = h ? void 0 : yt, le = z("dateField.openCalendar"), Te = {
|
|
270
|
+
"aria-label": le,
|
|
271
|
+
"aria-expanded": h ? ee : p,
|
|
272
|
+
"aria-haspopup": "dialog",
|
|
273
|
+
"aria-controls": Be
|
|
247
274
|
};
|
|
248
|
-
return /* @__PURE__ */
|
|
275
|
+
return /* @__PURE__ */ Ct(Mt, { children: [
|
|
249
276
|
/* @__PURE__ */ D(
|
|
250
277
|
"div",
|
|
251
278
|
{
|
|
252
|
-
className:
|
|
253
|
-
...
|
|
254
|
-
|
|
255
|
-
),
|
|
256
|
-
ref: we.setReference,
|
|
279
|
+
className: V(g["tedi-date-field__container"], Ye),
|
|
280
|
+
...bt,
|
|
281
|
+
ref: R.setReference,
|
|
257
282
|
children: s === "multiple" ? /* @__PURE__ */ D(
|
|
258
|
-
|
|
283
|
+
Et,
|
|
259
284
|
{
|
|
260
|
-
...
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
285
|
+
...i,
|
|
286
|
+
ref: Ee,
|
|
287
|
+
id: pe,
|
|
288
|
+
label: he,
|
|
289
|
+
tagsDirection: Ue,
|
|
290
|
+
values: Oe.map((e) => e.label),
|
|
264
291
|
icon: "calendar_today",
|
|
265
|
-
onIconClick:
|
|
266
|
-
iconButtonProps:
|
|
292
|
+
onIconClick: se,
|
|
293
|
+
iconButtonProps: m ? Te : { "aria-label": le },
|
|
267
294
|
isClearable: !0,
|
|
268
|
-
required:
|
|
295
|
+
required: j,
|
|
269
296
|
onChange: (e) => {
|
|
270
|
-
if (!Array.isArray(
|
|
271
|
-
const t =
|
|
272
|
-
|
|
297
|
+
if (!Array.isArray(n)) return;
|
|
298
|
+
const t = Oe.filter((r) => e.includes(r.label)).map((r) => r.date);
|
|
299
|
+
d || y(t), a == null || a(t, {}, {}, {});
|
|
273
300
|
},
|
|
274
|
-
className:
|
|
275
|
-
[
|
|
301
|
+
className: V(g["tedi-date-field__textfield"], {
|
|
302
|
+
[g["tedi-date-field__icon--disabled"]]: !m || E
|
|
276
303
|
})
|
|
277
304
|
}
|
|
278
305
|
) : /* @__PURE__ */ D(
|
|
279
|
-
|
|
306
|
+
Ot,
|
|
280
307
|
{
|
|
281
|
-
...
|
|
282
|
-
ref:
|
|
283
|
-
id:
|
|
284
|
-
label:
|
|
285
|
-
readOnly:
|
|
286
|
-
value: c ?
|
|
287
|
-
placeholder:
|
|
308
|
+
...i,
|
|
309
|
+
ref: Ze,
|
|
310
|
+
id: pe,
|
|
311
|
+
label: he,
|
|
312
|
+
readOnly: E,
|
|
313
|
+
value: c ? tt : te,
|
|
314
|
+
placeholder: We,
|
|
288
315
|
icon: "calendar_today",
|
|
289
|
-
"aria-expanded": u && !c ? m : void 0,
|
|
290
316
|
isClearable: !0,
|
|
291
|
-
onIconClick:
|
|
292
|
-
iconButtonProps:
|
|
293
|
-
onChange: (e) => c ?
|
|
294
|
-
|
|
295
|
-
|
|
317
|
+
onIconClick: se,
|
|
318
|
+
iconButtonProps: m && !c ? Te : { "aria-label": le },
|
|
319
|
+
onChange: (e) => c ? ht(e) : nt(e),
|
|
320
|
+
onBlur: (e) => {
|
|
321
|
+
var t;
|
|
322
|
+
c || st(), (t = i == null ? void 0 : i.onBlur) == null || t.call(i, e);
|
|
323
|
+
},
|
|
324
|
+
required: j,
|
|
325
|
+
invalid: Ne || ke || (i == null ? void 0 : i.invalid),
|
|
296
326
|
helper: (() => {
|
|
297
|
-
const e =
|
|
298
|
-
return
|
|
327
|
+
const e = i == null ? void 0 : i.helper, t = Ne ? Xe : ke ? Je : null, r = t ? { text: t, type: "error" } : null;
|
|
328
|
+
return r ? e ? Array.isArray(e) ? [...e, r] : [e, r] : r : e;
|
|
299
329
|
})(),
|
|
300
|
-
className:
|
|
301
|
-
[
|
|
302
|
-
[
|
|
330
|
+
className: V(g["tedi-date-field__textfield"], {
|
|
331
|
+
[g["tedi-date-field__textfield--disabled"]]: i == null ? void 0 : i.disabled,
|
|
332
|
+
[g["tedi-date-field__icon--disabled"]]: !m || E
|
|
303
333
|
}),
|
|
304
334
|
input: {
|
|
305
|
-
...
|
|
335
|
+
...i == null ? void 0 : i.input,
|
|
306
336
|
...c && { type: "date" },
|
|
307
|
-
...
|
|
337
|
+
...m && !c && L === "input" ? {
|
|
338
|
+
role: "combobox",
|
|
339
|
+
"aria-haspopup": "dialog",
|
|
340
|
+
"aria-expanded": h ? ee : p,
|
|
341
|
+
"aria-controls": Be
|
|
342
|
+
} : {}
|
|
308
343
|
}
|
|
309
344
|
}
|
|
310
345
|
)
|
|
311
346
|
}
|
|
312
347
|
),
|
|
313
|
-
|
|
314
|
-
|
|
348
|
+
h && /* @__PURE__ */ D(
|
|
349
|
+
Tt,
|
|
315
350
|
{
|
|
316
|
-
open:
|
|
317
|
-
onOpenChange:
|
|
318
|
-
value:
|
|
319
|
-
onConfirm:
|
|
351
|
+
open: ee,
|
|
352
|
+
onOpenChange: ve,
|
|
353
|
+
value: n,
|
|
354
|
+
onConfirm: pt,
|
|
320
355
|
mode: s,
|
|
321
|
-
numberOfMonths:
|
|
322
|
-
locale:
|
|
356
|
+
numberOfMonths: Pe,
|
|
357
|
+
locale: De,
|
|
323
358
|
localeCode: W,
|
|
324
|
-
showOutsideDays:
|
|
325
|
-
disabledMatchers:
|
|
326
|
-
required:
|
|
327
|
-
availableDays:
|
|
328
|
-
footer:
|
|
329
|
-
monthYearSelectType:
|
|
330
|
-
showNavigation:
|
|
359
|
+
showOutsideDays: ge,
|
|
360
|
+
disabledMatchers: U,
|
|
361
|
+
required: j,
|
|
362
|
+
availableDays: Ae,
|
|
363
|
+
footer: _e,
|
|
364
|
+
monthYearSelectType: ye,
|
|
365
|
+
showNavigation: be,
|
|
331
366
|
selectionLevel: P,
|
|
332
|
-
initialView:
|
|
367
|
+
initialView: H,
|
|
333
368
|
initialMonth: Y,
|
|
334
|
-
modalProps:
|
|
335
|
-
...
|
|
336
|
-
title:
|
|
369
|
+
modalProps: ze,
|
|
370
|
+
...xe,
|
|
371
|
+
title: Ge
|
|
337
372
|
}
|
|
338
373
|
),
|
|
339
|
-
|
|
374
|
+
m && !c && !h && /* @__PURE__ */ D(Nt, { children: p && /* @__PURE__ */ D(kt, { context: q, modal: !1, initialFocus: -1, children: /* @__PURE__ */ D(
|
|
340
375
|
"div",
|
|
341
376
|
{
|
|
342
|
-
ref:
|
|
343
|
-
className:
|
|
344
|
-
[
|
|
377
|
+
ref: R.setFloating,
|
|
378
|
+
className: V({
|
|
379
|
+
[g["tedi-date-field__calendar-popover--fullwidth"]]: x
|
|
345
380
|
}),
|
|
346
|
-
...
|
|
381
|
+
...Ve.getFloatingProps({
|
|
347
382
|
style: {
|
|
348
|
-
position:
|
|
349
|
-
top:
|
|
350
|
-
left:
|
|
351
|
-
right:
|
|
383
|
+
position: ct,
|
|
384
|
+
top: dt ?? 0,
|
|
385
|
+
left: x ? 0 : ft ?? 0,
|
|
386
|
+
right: x ? 0 : void 0
|
|
352
387
|
}
|
|
353
388
|
}),
|
|
354
389
|
children: /* @__PURE__ */ D(
|
|
355
|
-
|
|
390
|
+
Pt,
|
|
356
391
|
{
|
|
357
|
-
...
|
|
358
|
-
numberOfMonths:
|
|
359
|
-
view:
|
|
392
|
+
...xe,
|
|
393
|
+
numberOfMonths: Pe,
|
|
394
|
+
view: Qe,
|
|
360
395
|
selectionLevel: P,
|
|
361
|
-
currentMonth:
|
|
362
|
-
setCurrentMonth:
|
|
363
|
-
setView:
|
|
396
|
+
currentMonth: rt,
|
|
397
|
+
setCurrentMonth: oe,
|
|
398
|
+
setView: we,
|
|
364
399
|
mode: s,
|
|
365
|
-
value:
|
|
366
|
-
locale:
|
|
400
|
+
value: n,
|
|
401
|
+
locale: De,
|
|
367
402
|
localeCode: W,
|
|
368
|
-
showOutsideDays:
|
|
369
|
-
disabledMatchers:
|
|
370
|
-
required:
|
|
371
|
-
availableDays:
|
|
372
|
-
footer:
|
|
373
|
-
monthYearSelectType:
|
|
374
|
-
showNavigation:
|
|
375
|
-
handleSelect:
|
|
376
|
-
applyValue:
|
|
377
|
-
className:
|
|
378
|
-
[
|
|
403
|
+
showOutsideDays: ge,
|
|
404
|
+
disabledMatchers: U,
|
|
405
|
+
required: j,
|
|
406
|
+
availableDays: Ae,
|
|
407
|
+
footer: _e,
|
|
408
|
+
monthYearSelectType: ye,
|
|
409
|
+
showNavigation: be,
|
|
410
|
+
handleSelect: at,
|
|
411
|
+
applyValue: it,
|
|
412
|
+
className: V(g["tedi-date-field__calendar"], {
|
|
413
|
+
[g["tedi-date-field__calendar--fullwidth"]]: x
|
|
379
414
|
})
|
|
380
415
|
}
|
|
381
416
|
)
|
|
@@ -383,7 +418,7 @@ const Vt = oe.forwardRef((I, w) => {
|
|
|
383
418
|
) }) })
|
|
384
419
|
] });
|
|
385
420
|
});
|
|
386
|
-
|
|
421
|
+
Gt.displayName = "DateField";
|
|
387
422
|
export {
|
|
388
|
-
|
|
423
|
+
Gt as DateField
|
|
389
424
|
};
|