@drivenets/design-system 0.0.4 → 0.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/CHANGELOG.md +18 -0
- package/README.md +51 -0
- package/dist/components/ds-alert-banner/ds-alert-banner.d.ts +5 -5
- package/dist/components/ds-alert-banner/ds-alert-banner.d.ts.map +1 -1
- package/dist/components/ds-button/ds-button.d.cts +2 -2
- package/dist/components/ds-button/ds-button.d.cts.map +1 -1
- package/dist/components/ds-button/versions/ds-button-new/ds-button-new.module.cjs +18 -18
- package/dist/components/ds-button/versions/ds-button-new/ds-button-new.module.js +18 -18
- package/dist/components/ds-button/versions/ds-button-new/ds-button-new.module.js.map +1 -1
- package/dist/components/ds-confirmation/ds-confirmation.d.cts +8 -8
- package/dist/components/ds-confirmation/ds-confirmation.d.ts +8 -8
- package/dist/components/ds-date-input/ds-date-input.cjs +352 -0
- package/dist/components/ds-date-input/ds-date-input.d.cts +31 -0
- package/dist/components/ds-date-input/ds-date-input.d.cts.map +1 -0
- package/dist/components/ds-date-input/ds-date-input.d.ts +31 -0
- package/dist/components/ds-date-input/ds-date-input.d.ts.map +1 -0
- package/dist/components/ds-date-input/ds-date-input.js +351 -0
- package/dist/components/ds-date-input/ds-date-input.js.map +1 -0
- package/dist/components/ds-date-input/ds-date-input.module.cjs +29 -0
- package/dist/components/ds-date-input/ds-date-input.module.js +29 -0
- package/dist/components/ds-date-input/ds-date-input.module.js.map +1 -0
- package/dist/components/ds-date-input/ds-date-input.types.d.cts +92 -0
- package/dist/components/ds-date-input/ds-date-input.types.d.cts.map +1 -0
- package/dist/components/ds-date-input/ds-date-input.types.d.ts +92 -0
- package/dist/components/ds-date-input/ds-date-input.types.d.ts.map +1 -0
- package/dist/components/ds-date-input/ds-date-input.utils.cjs +169 -0
- package/dist/components/ds-date-input/ds-date-input.utils.js +164 -0
- package/dist/components/ds-date-input/ds-date-input.utils.js.map +1 -0
- package/dist/components/ds-date-input/index.cjs +1 -0
- package/dist/components/ds-date-input/index.d.ts +2 -0
- package/dist/components/ds-date-input/index.js +1 -0
- package/dist/components/ds-divider/ds-divider.cjs +47 -0
- package/dist/components/ds-divider/ds-divider.d.cts +8 -0
- package/dist/components/ds-divider/ds-divider.d.cts.map +1 -0
- package/dist/components/ds-divider/ds-divider.d.ts +8 -0
- package/dist/components/ds-divider/ds-divider.d.ts.map +1 -0
- package/dist/components/ds-divider/ds-divider.js +46 -0
- package/dist/components/ds-divider/ds-divider.js.map +1 -0
- package/dist/components/ds-divider/ds-divider.module.cjs +10 -0
- package/dist/components/ds-divider/ds-divider.module.js +10 -0
- package/dist/components/ds-divider/ds-divider.module.js.map +1 -0
- package/dist/components/ds-divider/ds-divider.types.d.cts +25 -0
- package/dist/components/ds-divider/ds-divider.types.d.cts.map +1 -0
- package/dist/components/ds-divider/ds-divider.types.d.ts +25 -0
- package/dist/components/ds-divider/ds-divider.types.d.ts.map +1 -0
- package/dist/components/ds-divider/index.cjs +1 -0
- package/dist/components/ds-divider/index.d.ts +2 -0
- package/dist/components/ds-divider/index.js +1 -0
- package/dist/components/ds-drawer/ds-drawer.d.cts +9 -9
- package/dist/components/ds-drawer/ds-drawer.d.ts +9 -9
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.cjs +80 -24
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.d.cts +1 -0
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.d.cts.map +1 -1
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.d.ts +1 -0
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.d.ts.map +1 -1
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.js +80 -24
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.js.map +1 -1
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.module.cjs +20 -18
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.module.js +20 -18
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.module.js.map +1 -1
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.types.d.cts +5 -1
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.types.d.cts.map +1 -1
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.types.d.ts +5 -1
- package/dist/components/ds-dropdown-menu/ds-dropdown-menu.types.d.ts.map +1 -1
- package/dist/components/ds-dropdown-menu/index.d.ts +1 -1
- package/dist/components/ds-expandable-text-input/ds-expandable-text-input.d.cts +2 -2
- package/dist/components/ds-expandable-text-input/ds-expandable-text-input.d.ts +2 -2
- package/dist/components/ds-form-control/ds-form-control.cjs +3 -0
- package/dist/components/ds-form-control/ds-form-control.d.cts +9 -7
- package/dist/components/ds-form-control/ds-form-control.d.cts.map +1 -1
- package/dist/components/ds-form-control/ds-form-control.d.ts +10 -7
- package/dist/components/ds-form-control/ds-form-control.d.ts.map +1 -1
- package/dist/components/ds-form-control/ds-form-control.js +3 -0
- package/dist/components/ds-form-control/ds-form-control.js.map +1 -1
- package/dist/components/ds-modal/ds-modal.d.cts +8 -8
- package/dist/components/ds-modal/ds-modal.d.ts +8 -8
- package/dist/components/ds-modal/ds-modal.d.ts.map +1 -1
- package/dist/components/ds-panel/ds-panel.d.cts +2 -2
- package/dist/components/ds-panel/ds-panel.d.ts +2 -2
- package/dist/components/ds-radio-group/ds-radio-group.types.d.cts +1 -1
- package/dist/components/ds-radio-group/ds-radio-group.types.d.cts.map +1 -1
- package/dist/components/ds-radio-group/ds-radio-group.types.d.ts +1 -1
- package/dist/components/ds-radio-group/ds-radio-group.types.d.ts.map +1 -1
- package/dist/components/ds-segment-group/ds-segment-group.cjs +215 -0
- package/dist/components/ds-segment-group/ds-segment-group.d.cts +26 -0
- package/dist/components/ds-segment-group/ds-segment-group.d.cts.map +1 -0
- package/dist/components/ds-segment-group/ds-segment-group.d.ts +26 -0
- package/dist/components/ds-segment-group/ds-segment-group.d.ts.map +1 -0
- package/dist/components/ds-segment-group/ds-segment-group.js +214 -0
- package/dist/components/ds-segment-group/ds-segment-group.js.map +1 -0
- package/dist/components/ds-segment-group/ds-segment-group.module.cjs +12 -0
- package/dist/components/ds-segment-group/ds-segment-group.module.js +12 -0
- package/dist/components/ds-segment-group/ds-segment-group.module.js.map +1 -0
- package/dist/components/ds-segment-group/ds-segment-group.types.cjs +2 -0
- package/dist/components/ds-segment-group/ds-segment-group.types.d.cts +52 -0
- package/dist/components/ds-segment-group/ds-segment-group.types.d.cts.map +1 -0
- package/dist/components/ds-segment-group/ds-segment-group.types.d.ts +52 -0
- package/dist/components/ds-segment-group/ds-segment-group.types.d.ts.map +1 -0
- package/dist/components/ds-segment-group/ds-segment-group.types.js +2 -0
- package/dist/components/ds-segment-group/index.cjs +2 -0
- package/dist/components/ds-segment-group/index.d.ts +2 -0
- package/dist/components/ds-segment-group/index.js +2 -0
- package/dist/components/ds-select/ds-select.d.cts +2 -2
- package/dist/components/ds-select/ds-select.d.ts +2 -2
- package/dist/components/ds-smart-tabs/ds-smart-tabs.d.cts +2 -2
- package/dist/components/ds-smart-tabs/ds-smart-tabs.d.ts +2 -2
- package/dist/components/ds-stepper/components/ds-step-content.d.ts +2 -2
- package/dist/components/ds-stepper/components/ds-step-next-button.d.ts +2 -2
- package/dist/components/ds-stepper/components/ds-step.d.cts +2 -2
- package/dist/components/ds-stepper/components/ds-step.d.ts +2 -2
- package/dist/components/ds-stepper/ds-stepper.d.cts +2 -2
- package/dist/components/ds-stepper/ds-stepper.d.ts +2 -2
- package/dist/components/ds-table/components/ds-table-cell/ds-table-cell.types.d.cts +1 -0
- package/dist/components/ds-table/components/ds-table-cell/ds-table-cell.types.d.cts.map +1 -1
- package/dist/components/ds-table/components/ds-table-cell/ds-table-cell.types.d.ts +1 -1
- package/dist/components/ds-table/ds-table.d.cts +2 -2
- package/dist/components/ds-table/ds-table.d.ts +2 -2
- package/dist/components/ds-table/filters/adapters/create-checkbox-filter-adapter.cjs +55 -0
- package/dist/components/ds-table/filters/adapters/create-checkbox-filter-adapter.d.cts +49 -0
- package/dist/components/ds-table/filters/adapters/create-checkbox-filter-adapter.d.cts.map +1 -0
- package/dist/components/ds-table/filters/adapters/create-checkbox-filter-adapter.d.ts +50 -0
- package/dist/components/ds-table/filters/adapters/create-checkbox-filter-adapter.d.ts.map +1 -0
- package/dist/components/ds-table/filters/adapters/create-checkbox-filter-adapter.js +55 -0
- package/dist/components/ds-table/filters/adapters/create-checkbox-filter-adapter.js.map +1 -0
- package/dist/components/ds-table/filters/adapters/create-dual-range-filter-adapter.cjs +87 -0
- package/dist/components/ds-table/filters/adapters/create-dual-range-filter-adapter.d.cts +44 -0
- package/dist/components/ds-table/filters/adapters/create-dual-range-filter-adapter.d.cts.map +1 -0
- package/dist/components/ds-table/filters/adapters/create-dual-range-filter-adapter.d.ts +44 -0
- package/dist/components/ds-table/filters/adapters/create-dual-range-filter-adapter.d.ts.map +1 -0
- package/dist/components/ds-table/filters/adapters/create-dual-range-filter-adapter.js +87 -0
- package/dist/components/ds-table/filters/adapters/create-dual-range-filter-adapter.js.map +1 -0
- package/dist/components/ds-table/filters/adapters/create-filter-adapter.cjs +83 -0
- package/dist/components/ds-table/filters/adapters/create-filter-adapter.d.cts +111 -0
- package/dist/components/ds-table/filters/adapters/create-filter-adapter.d.cts.map +1 -0
- package/dist/components/ds-table/filters/adapters/create-filter-adapter.d.ts +111 -0
- package/dist/components/ds-table/filters/adapters/create-filter-adapter.d.ts.map +1 -0
- package/dist/components/ds-table/filters/adapters/create-filter-adapter.js +83 -0
- package/dist/components/ds-table/filters/adapters/create-filter-adapter.js.map +1 -0
- package/dist/components/ds-table/filters/adapters/index.cjs +3 -0
- package/dist/components/ds-table/filters/adapters/index.d.ts +3 -0
- package/dist/components/ds-table/filters/adapters/index.js +3 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/checkbox-filter.cjs +22 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/checkbox-filter.d.cts +17 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/checkbox-filter.d.cts.map +1 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/checkbox-filter.d.ts +18 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/checkbox-filter.d.ts.map +1 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/checkbox-filter.js +22 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/checkbox-filter.js.map +1 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/index.cjs +1 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/index.d.ts +1 -0
- package/dist/components/ds-table/filters/components/checkbox-filter/index.js +1 -0
- package/dist/components/ds-table/filters/components/range-filter/index.cjs +1 -0
- package/dist/components/ds-table/filters/components/range-filter/index.d.ts +1 -0
- package/dist/components/ds-table/filters/components/range-filter/index.js +1 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.cjs +177 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.d.cts +14 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.d.cts.map +1 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.d.ts +16 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.d.ts.map +1 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.js +177 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.js.map +1 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.module.cjs +11 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.module.js +11 -0
- package/dist/components/ds-table/filters/components/range-filter/range-filter.module.js.map +1 -0
- package/dist/components/ds-table/filters/hooks/index.cjs +1 -0
- package/dist/components/ds-table/filters/hooks/index.d.ts +1 -0
- package/dist/components/ds-table/filters/hooks/index.js +1 -0
- package/dist/components/ds-table/filters/hooks/use-table-filters.cjs +211 -0
- package/dist/components/ds-table/filters/hooks/use-table-filters.d.cts +65 -0
- package/dist/components/ds-table/filters/hooks/use-table-filters.d.cts.map +1 -0
- package/dist/components/ds-table/filters/hooks/use-table-filters.d.ts +66 -0
- package/dist/components/ds-table/filters/hooks/use-table-filters.d.ts.map +1 -0
- package/dist/components/ds-table/filters/hooks/use-table-filters.js +211 -0
- package/dist/components/ds-table/filters/hooks/use-table-filters.js.map +1 -0
- package/dist/components/ds-table/filters/index.cjs +6 -0
- package/dist/components/ds-table/filters/index.d.ts +11 -0
- package/dist/components/ds-table/filters/index.js +6 -0
- package/dist/components/ds-table/filters/types/filter-adapter.types.d.cts +101 -0
- package/dist/components/ds-table/filters/types/filter-adapter.types.d.cts.map +1 -0
- package/dist/components/ds-table/filters/types/filter-adapter.types.d.ts +102 -0
- package/dist/components/ds-table/filters/types/filter-adapter.types.d.ts.map +1 -0
- package/dist/components/ds-table/index.cjs +5 -0
- package/dist/components/ds-table/index.d.ts +8 -0
- package/dist/components/ds-table/index.js +5 -0
- package/dist/components/ds-toggle/ds-toggle.cjs +192 -0
- package/dist/components/ds-toggle/ds-toggle.d.cts +24 -0
- package/dist/components/ds-toggle/ds-toggle.d.cts.map +1 -0
- package/dist/components/ds-toggle/ds-toggle.d.ts +24 -0
- package/dist/components/ds-toggle/ds-toggle.d.ts.map +1 -0
- package/dist/components/ds-toggle/ds-toggle.js +191 -0
- package/dist/components/ds-toggle/ds-toggle.js.map +1 -0
- package/dist/components/ds-toggle/ds-toggle.module.cjs +13 -0
- package/dist/components/ds-toggle/ds-toggle.module.js +13 -0
- package/dist/components/ds-toggle/ds-toggle.module.js.map +1 -0
- package/dist/components/ds-toggle/ds-toggle.types.d.cts +67 -0
- package/dist/components/ds-toggle/ds-toggle.types.d.cts.map +1 -0
- package/dist/components/ds-toggle/ds-toggle.types.d.ts +67 -0
- package/dist/components/ds-toggle/ds-toggle.types.d.ts.map +1 -0
- package/dist/components/ds-toggle/index.cjs +1 -0
- package/dist/components/ds-toggle/index.d.ts +2 -0
- package/dist/components/ds-toggle/index.js +1 -0
- package/dist/components/ds-vertical-tabs/ds-vertical-tabs.d.cts +5 -5
- package/dist/components/ds-vertical-tabs/ds-vertical-tabs.d.ts +5 -5
- package/dist/index.cjs +20 -0
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +13 -1
- package/dist/index.min.css +1 -1
- package/package.json +3 -2
- package/src/components/ds-button/versions/ds-button-new/ds-button-new.module.scss +0 -1
- package/src/components/ds-date-input/ds-date-input.module.scss +246 -0
- package/src/components/ds-date-input/ds-date-input.tsx +309 -0
- package/src/components/ds-date-input/ds-date-input.types.tsx +104 -0
- package/src/components/ds-date-input/ds-date-input.utils.ts +242 -0
- package/src/components/ds-date-input/index.ts +2 -0
- package/src/components/ds-divider/ds-divider.module.scss +21 -0
- package/src/components/ds-divider/ds-divider.tsx +22 -0
- package/src/components/ds-divider/ds-divider.types.ts +21 -0
- package/src/components/ds-divider/index.ts +2 -0
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.module.scss +11 -3
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.tsx +17 -1
- package/src/components/ds-dropdown-menu/ds-dropdown-menu.types.tsx +5 -0
- package/src/components/ds-form-control/ds-form-control.tsx +2 -0
- package/src/components/ds-radio-group/ds-radio-group.types.tsx +1 -1
- package/src/components/ds-segment-group/ds-segment-group.module.scss +99 -0
- package/src/components/ds-segment-group/ds-segment-group.tsx +76 -0
- package/src/components/ds-segment-group/ds-segment-group.types.tsx +64 -0
- package/src/components/ds-segment-group/index.tsx +2 -0
- package/src/components/ds-table/filters/hooks/index.ts +1 -0
- package/src/components/ds-table/index.ts +2 -0
- package/src/components/ds-toggle/ds-toggle.module.scss +154 -0
- package/src/components/ds-toggle/ds-toggle.tsx +78 -0
- package/src/components/ds-toggle/ds-toggle.types.tsx +76 -0
- package/src/components/ds-toggle/index.tsx +2 -0
- package/src/index.ts +4 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
import ds_icon_default from "../ds-icon/ds-icon.js";
|
|
2
|
+
import "../ds-icon/index.js";
|
|
3
|
+
import ds_typography_default from "../ds-typography/ds-typography.js";
|
|
4
|
+
import "../ds-typography/index.js";
|
|
5
|
+
import { dateValuesToStrings, formatDateInputValue, isoStringToDateValue, parseInputText, stringToDateValue, validateDateString } from "./ds-date-input.utils.js";
|
|
6
|
+
import ds_date_input_module_default from "./ds-date-input.module.js";
|
|
7
|
+
import { c } from "react/compiler-runtime";
|
|
8
|
+
import classNames from "classnames";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { Fragment, useRef, useState } from "react";
|
|
11
|
+
import { Portal } from "@ark-ui/react/portal";
|
|
12
|
+
import { DatePicker } from "@ark-ui/react/date-picker";
|
|
13
|
+
|
|
14
|
+
//#region src/components/ds-date-input/ds-date-input.tsx
|
|
15
|
+
/**
|
|
16
|
+
* Design system date input component with integrated calendar picker.
|
|
17
|
+
*
|
|
18
|
+
* Supports both single date and date range selection with a single text input field.
|
|
19
|
+
* Features built-in validation, manual text entry, and calendar selection.
|
|
20
|
+
*/
|
|
21
|
+
const DsDateInput = ({ range = false, placeholder, style, className, disablePortal = false, onValueChange, onOpenChange, value: _value, defaultValue: _defaultValue, min: _min, max: _max, disabled, readOnly, id, ...datePickerProps }) => {
|
|
22
|
+
const min = _min ? isoStringToDateValue(_min) : void 0;
|
|
23
|
+
const max = _max ? isoStringToDateValue(_max) : void 0;
|
|
24
|
+
const value = _value ? stringToDateValue(_value) : [];
|
|
25
|
+
const defaultValue = _defaultValue ? stringToDateValue(_defaultValue) : [];
|
|
26
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
27
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
28
|
+
const prevValue = useRef(null);
|
|
29
|
+
const inputRef = useRef(null);
|
|
30
|
+
if (!isFocused && prevValue.current !== JSON.stringify(value)) {
|
|
31
|
+
prevValue.current = JSON.stringify(value);
|
|
32
|
+
if (inputRef.current) inputRef.current.value = formatDateInputValue(value, range);
|
|
33
|
+
}
|
|
34
|
+
const clear = () => {
|
|
35
|
+
if (inputRef.current) inputRef.current.value = "";
|
|
36
|
+
onValueChange?.(void 0);
|
|
37
|
+
};
|
|
38
|
+
const handleInputChange = (e) => {
|
|
39
|
+
const text = e.target.value;
|
|
40
|
+
if (validateDateString({
|
|
41
|
+
text,
|
|
42
|
+
range,
|
|
43
|
+
min,
|
|
44
|
+
max
|
|
45
|
+
}).isValid) {
|
|
46
|
+
const parsedValue = parseInputText(text, range);
|
|
47
|
+
onValueChange?.(dateValuesToStrings(parsedValue, range));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const handleBlur = () => {
|
|
51
|
+
setIsFocused(false);
|
|
52
|
+
const text_0 = inputRef.current?.value || "";
|
|
53
|
+
if (!validateDateString({
|
|
54
|
+
text: text_0,
|
|
55
|
+
range,
|
|
56
|
+
min,
|
|
57
|
+
max
|
|
58
|
+
}).isValid) {
|
|
59
|
+
clear();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const parsedValue_0 = parseInputText(text_0, range);
|
|
63
|
+
onValueChange?.(dateValuesToStrings(parsedValue_0, range));
|
|
64
|
+
};
|
|
65
|
+
const showClearButton = !disabled && !readOnly && !!(value.length > 0 ? value : defaultValue).length;
|
|
66
|
+
const Wrapper = disablePortal ? Fragment : Portal;
|
|
67
|
+
return /* @__PURE__ */ jsxs(DatePicker.Root, {
|
|
68
|
+
value,
|
|
69
|
+
defaultValue,
|
|
70
|
+
onValueChange: (details) => {
|
|
71
|
+
onValueChange?.(dateValuesToStrings(details.value, range));
|
|
72
|
+
},
|
|
73
|
+
selectionMode: range ? "range" : "single",
|
|
74
|
+
positioning: {
|
|
75
|
+
placement: "bottom-start",
|
|
76
|
+
gutter: 4
|
|
77
|
+
},
|
|
78
|
+
closeOnSelect: !range,
|
|
79
|
+
min,
|
|
80
|
+
max,
|
|
81
|
+
disabled,
|
|
82
|
+
readOnly,
|
|
83
|
+
open: isOpen,
|
|
84
|
+
onOpenChange: (details_0) => {
|
|
85
|
+
if (!isFocused) {
|
|
86
|
+
setIsOpen(details_0.open);
|
|
87
|
+
onOpenChange?.(details_0.open);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
...datePickerProps,
|
|
91
|
+
children: [/* @__PURE__ */ jsxs(DatePicker.Control, {
|
|
92
|
+
style,
|
|
93
|
+
className: classNames(ds_date_input_module_default.dateInputControl, disabled && ds_date_input_module_default.disabled, readOnly && ds_date_input_module_default.readOnly, className),
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsx(DatePicker.Trigger, {
|
|
96
|
+
asChild: true,
|
|
97
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
className: ds_date_input_module_default.dateInputButton,
|
|
100
|
+
disabled,
|
|
101
|
+
"aria-label": "Open calendar",
|
|
102
|
+
children: /* @__PURE__ */ jsx(ds_icon_default, {
|
|
103
|
+
icon: "calendar_month",
|
|
104
|
+
size: "small"
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ jsx("input", {
|
|
109
|
+
ref: inputRef,
|
|
110
|
+
id,
|
|
111
|
+
type: "text",
|
|
112
|
+
className: ds_date_input_module_default.input,
|
|
113
|
+
placeholder: placeholder ?? (range ? "MM/DD/YYYY - MM/DD/YYYY" : "MM/DD/YYYY"),
|
|
114
|
+
defaultValue: formatDateInputValue(value.length > 0 ? value : defaultValue, range),
|
|
115
|
+
onChange: handleInputChange,
|
|
116
|
+
onBlur: handleBlur,
|
|
117
|
+
onFocus: () => setIsFocused(true),
|
|
118
|
+
disabled,
|
|
119
|
+
readOnly
|
|
120
|
+
}),
|
|
121
|
+
showClearButton && /* @__PURE__ */ jsx("button", {
|
|
122
|
+
type: "button",
|
|
123
|
+
className: ds_date_input_module_default.dateInputButton,
|
|
124
|
+
onClick: clear,
|
|
125
|
+
"aria-label": range ? "Clear date range" : "Clear date",
|
|
126
|
+
children: /* @__PURE__ */ jsx(ds_icon_default, {
|
|
127
|
+
icon: "close",
|
|
128
|
+
size: "small"
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
}), /* @__PURE__ */ jsx(Wrapper, { children: /* @__PURE__ */ jsx(DatePicker.Positioner, {
|
|
133
|
+
className: ds_date_input_module_default.positioner,
|
|
134
|
+
children: /* @__PURE__ */ jsxs(DatePicker.Content, {
|
|
135
|
+
className: ds_date_input_module_default.content,
|
|
136
|
+
children: [/* @__PURE__ */ jsx(CalendarViewControl, {}), /* @__PURE__ */ jsxs("div", {
|
|
137
|
+
className: ds_date_input_module_default.calendarView,
|
|
138
|
+
children: [
|
|
139
|
+
/* @__PURE__ */ jsx(DayView, {}),
|
|
140
|
+
/* @__PURE__ */ jsx(MonthView, {}),
|
|
141
|
+
/* @__PURE__ */ jsx(YearView, {})
|
|
142
|
+
]
|
|
143
|
+
})]
|
|
144
|
+
})
|
|
145
|
+
}) })]
|
|
146
|
+
});
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Calendar view control with navigation buttons
|
|
150
|
+
*/
|
|
151
|
+
const CalendarViewControl = () => {
|
|
152
|
+
const $ = c(3);
|
|
153
|
+
let t0;
|
|
154
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
155
|
+
t0 = /* @__PURE__ */ jsx(DatePicker.PrevTrigger, {
|
|
156
|
+
className: ds_date_input_module_default.prevTrigger,
|
|
157
|
+
children: /* @__PURE__ */ jsx(ds_icon_default, {
|
|
158
|
+
icon: "chevron_left",
|
|
159
|
+
size: "small"
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
$[0] = t0;
|
|
163
|
+
} else t0 = $[0];
|
|
164
|
+
let t1;
|
|
165
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
166
|
+
t1 = /* @__PURE__ */ jsx(DatePicker.ViewTrigger, {
|
|
167
|
+
className: ds_date_input_module_default.viewTrigger,
|
|
168
|
+
asChild: true,
|
|
169
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
170
|
+
type: "button",
|
|
171
|
+
children: /* @__PURE__ */ jsx(ds_typography_default, {
|
|
172
|
+
variant: "body-md-md",
|
|
173
|
+
asChild: true,
|
|
174
|
+
children: /* @__PURE__ */ jsx(DatePicker.RangeText, {})
|
|
175
|
+
})
|
|
176
|
+
})
|
|
177
|
+
});
|
|
178
|
+
$[1] = t1;
|
|
179
|
+
} else t1 = $[1];
|
|
180
|
+
let t2;
|
|
181
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
182
|
+
t2 = /* @__PURE__ */ jsxs(DatePicker.ViewControl, {
|
|
183
|
+
className: ds_date_input_module_default.viewControl,
|
|
184
|
+
children: [
|
|
185
|
+
t0,
|
|
186
|
+
t1,
|
|
187
|
+
/* @__PURE__ */ jsx(DatePicker.NextTrigger, {
|
|
188
|
+
className: ds_date_input_module_default.nextTrigger,
|
|
189
|
+
children: /* @__PURE__ */ jsx(ds_icon_default, {
|
|
190
|
+
icon: "chevron_right",
|
|
191
|
+
size: "small"
|
|
192
|
+
})
|
|
193
|
+
})
|
|
194
|
+
]
|
|
195
|
+
});
|
|
196
|
+
$[2] = t2;
|
|
197
|
+
} else t2 = $[2];
|
|
198
|
+
return t2;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Day view - displays calendar grid with days of the month
|
|
202
|
+
*/
|
|
203
|
+
const DayView = () => {
|
|
204
|
+
const $ = c(1);
|
|
205
|
+
let t0;
|
|
206
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
207
|
+
t0 = /* @__PURE__ */ jsx(DatePicker.View, {
|
|
208
|
+
view: "day",
|
|
209
|
+
children: /* @__PURE__ */ jsx(DatePicker.Context, { children: _temp4 })
|
|
210
|
+
});
|
|
211
|
+
$[0] = t0;
|
|
212
|
+
} else t0 = $[0];
|
|
213
|
+
return t0;
|
|
214
|
+
};
|
|
215
|
+
/**
|
|
216
|
+
* Month view - displays grid with months of the year
|
|
217
|
+
*/
|
|
218
|
+
const MonthView = () => {
|
|
219
|
+
const $ = c(1);
|
|
220
|
+
let t0;
|
|
221
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
222
|
+
t0 = /* @__PURE__ */ jsx(DatePicker.View, {
|
|
223
|
+
view: "month",
|
|
224
|
+
children: /* @__PURE__ */ jsx(DatePicker.Context, { children: _temp7 })
|
|
225
|
+
});
|
|
226
|
+
$[0] = t0;
|
|
227
|
+
} else t0 = $[0];
|
|
228
|
+
return t0;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Year view - displays grid with years in a decade
|
|
232
|
+
*/
|
|
233
|
+
const YearView = () => {
|
|
234
|
+
const $ = c(1);
|
|
235
|
+
let t0;
|
|
236
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
237
|
+
t0 = /* @__PURE__ */ jsx(DatePicker.View, {
|
|
238
|
+
view: "year",
|
|
239
|
+
children: /* @__PURE__ */ jsx(DatePicker.Context, { children: _temp0 })
|
|
240
|
+
});
|
|
241
|
+
$[0] = t0;
|
|
242
|
+
} else t0 = $[0];
|
|
243
|
+
return t0;
|
|
244
|
+
};
|
|
245
|
+
var ds_date_input_default = DsDateInput;
|
|
246
|
+
function _temp(weekDay, id) {
|
|
247
|
+
return /* @__PURE__ */ jsx(DatePicker.TableHeader, {
|
|
248
|
+
className: ds_date_input_module_default.tableHeader,
|
|
249
|
+
children: /* @__PURE__ */ jsx(ds_typography_default, {
|
|
250
|
+
variant: "body-md-md",
|
|
251
|
+
children: weekDay.short
|
|
252
|
+
})
|
|
253
|
+
}, id);
|
|
254
|
+
}
|
|
255
|
+
function _temp2(day, dayId) {
|
|
256
|
+
return /* @__PURE__ */ jsx(DatePicker.TableCell, {
|
|
257
|
+
value: day,
|
|
258
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableCellTrigger, {
|
|
259
|
+
className: ds_date_input_module_default.tableCellTrigger,
|
|
260
|
+
children: /* @__PURE__ */ jsx(ds_typography_default, {
|
|
261
|
+
className: ds_date_input_module_default.tableCellTriggerValue,
|
|
262
|
+
variant: "body-md-md",
|
|
263
|
+
children: day.day
|
|
264
|
+
})
|
|
265
|
+
})
|
|
266
|
+
}, dayId);
|
|
267
|
+
}
|
|
268
|
+
function _temp3(week, weekId) {
|
|
269
|
+
return /* @__PURE__ */ jsx(DatePicker.TableRow, {
|
|
270
|
+
className: ds_date_input_module_default.tableRow,
|
|
271
|
+
children: week.map(_temp2)
|
|
272
|
+
}, weekId);
|
|
273
|
+
}
|
|
274
|
+
function _temp4(datePicker) {
|
|
275
|
+
return /* @__PURE__ */ jsxs(DatePicker.Table, {
|
|
276
|
+
className: ds_date_input_module_default.table,
|
|
277
|
+
children: [/* @__PURE__ */ jsx(DatePicker.TableHead, {
|
|
278
|
+
className: ds_date_input_module_default.tableHead,
|
|
279
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableRow, {
|
|
280
|
+
className: ds_date_input_module_default.tableRow,
|
|
281
|
+
children: datePicker.weekDays.map(_temp)
|
|
282
|
+
})
|
|
283
|
+
}), /* @__PURE__ */ jsx(DatePicker.TableBody, {
|
|
284
|
+
className: ds_date_input_module_default.tableBody,
|
|
285
|
+
children: datePicker.weeks.map(_temp3)
|
|
286
|
+
})]
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
function _temp5(month, monthId) {
|
|
290
|
+
return /* @__PURE__ */ jsx(DatePicker.TableCell, {
|
|
291
|
+
value: month.value,
|
|
292
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableCellTrigger, {
|
|
293
|
+
className: ds_date_input_module_default.tableCellTrigger,
|
|
294
|
+
children: /* @__PURE__ */ jsx(ds_typography_default, {
|
|
295
|
+
className: ds_date_input_module_default.tableCellTriggerValue,
|
|
296
|
+
variant: "body-md-md",
|
|
297
|
+
children: month.label
|
|
298
|
+
})
|
|
299
|
+
})
|
|
300
|
+
}, monthId);
|
|
301
|
+
}
|
|
302
|
+
function _temp6(months, rowId) {
|
|
303
|
+
return /* @__PURE__ */ jsx(DatePicker.TableRow, {
|
|
304
|
+
className: ds_date_input_module_default.tableRow,
|
|
305
|
+
children: months.map(_temp5)
|
|
306
|
+
}, rowId);
|
|
307
|
+
}
|
|
308
|
+
function _temp7(datePicker) {
|
|
309
|
+
return /* @__PURE__ */ jsx(DatePicker.Table, {
|
|
310
|
+
className: ds_date_input_module_default.table,
|
|
311
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableBody, {
|
|
312
|
+
className: ds_date_input_module_default.tableBody,
|
|
313
|
+
children: datePicker.getMonthsGrid({
|
|
314
|
+
columns: 4,
|
|
315
|
+
format: "short"
|
|
316
|
+
}).map(_temp6)
|
|
317
|
+
})
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function _temp8(year, yearId) {
|
|
321
|
+
return /* @__PURE__ */ jsx(DatePicker.TableCell, {
|
|
322
|
+
value: year.value,
|
|
323
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableCellTrigger, {
|
|
324
|
+
className: ds_date_input_module_default.tableCellTrigger,
|
|
325
|
+
children: /* @__PURE__ */ jsx(ds_typography_default, {
|
|
326
|
+
className: ds_date_input_module_default.tableCellTriggerValue,
|
|
327
|
+
variant: "body-md-md",
|
|
328
|
+
children: year.label
|
|
329
|
+
})
|
|
330
|
+
})
|
|
331
|
+
}, yearId);
|
|
332
|
+
}
|
|
333
|
+
function _temp9(years, rowId) {
|
|
334
|
+
return /* @__PURE__ */ jsx(DatePicker.TableRow, {
|
|
335
|
+
className: ds_date_input_module_default.tableRow,
|
|
336
|
+
children: years.map(_temp8)
|
|
337
|
+
}, rowId);
|
|
338
|
+
}
|
|
339
|
+
function _temp0(datePicker) {
|
|
340
|
+
return /* @__PURE__ */ jsx(DatePicker.Table, {
|
|
341
|
+
className: ds_date_input_module_default.table,
|
|
342
|
+
children: /* @__PURE__ */ jsx(DatePicker.TableBody, {
|
|
343
|
+
className: ds_date_input_module_default.tableBody,
|
|
344
|
+
children: datePicker.getYearsGrid({ columns: 4 }).map(_temp9)
|
|
345
|
+
})
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
//#endregion
|
|
350
|
+
export { ds_date_input_default as default };
|
|
351
|
+
//# sourceMappingURL=ds-date-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-date-input.js","names":["ChangeEvent","Fragment","useRef","useState","DatePicker","Portal","classNames","DsDateInputProps","dateValuesToStrings","formatDateInputValue","isoStringToDateValue","parseInputText","stringToDateValue","validateDateString","DsIcon","DsTypography","styles","DsDateInput","range","placeholder","style","className","disablePortal","onValueChange","onOpenChange","value","_value","defaultValue","_defaultValue","min","_min","max","_max","disabled","readOnly","id","datePickerProps","undefined","isFocused","setIsFocused","isOpen","setIsOpen","prevValue","inputRef","HTMLInputElement","current","JSON","stringify","clear","handleInputChange","e","text","target","validation","isValid","parsedValue","handleBlur","showClearButton","length","Wrapper","details","placement","gutter","open","dateInputControl","dateInputButton","input","positioner","content","calendarView","CalendarViewControl","$","_c","t0","Symbol","for","prevTrigger","t1","viewTrigger","t2","viewControl","nextTrigger","DayView","_temp4","MonthView","_temp7","YearView","_temp0","_temp","weekDay","tableHeader","short","_temp2","day","dayId","tableCellTrigger","tableCellTriggerValue","_temp3","week","weekId","tableRow","map","datePicker","table","tableHead","weekDays","tableBody","weeks","_temp5","month","monthId","label","_temp6","months","rowId","getMonthsGrid","columns","format","_temp8","year","yearId","_temp9","years","getYearsGrid"],"sources":["../../../src/components/ds-date-input/ds-date-input.tsx"],"sourcesContent":["import { type ChangeEvent, Fragment, useRef, useState } from 'react';\nimport { DatePicker } from '@ark-ui/react/date-picker';\nimport { Portal } from '@ark-ui/react/portal';\nimport classNames from 'classnames';\nimport type { DsDateInputProps } from './ds-date-input.types';\nimport {\n\tdateValuesToStrings,\n\tformatDateInputValue,\n\tisoStringToDateValue,\n\tparseInputText,\n\tstringToDateValue,\n\tvalidateDateString,\n} from './ds-date-input.utils';\nimport { DsIcon } from '../ds-icon';\nimport { DsTypography } from '../ds-typography';\nimport styles from './ds-date-input.module.scss';\n\n/**\n * Design system date input component with integrated calendar picker.\n *\n * Supports both single date and date range selection with a single text input field.\n * Features built-in validation, manual text entry, and calendar selection.\n */\nconst DsDateInput = ({\n\trange = false,\n\tplaceholder,\n\tstyle,\n\tclassName,\n\tdisablePortal = false,\n\tonValueChange,\n\tonOpenChange,\n\tvalue: _value,\n\tdefaultValue: _defaultValue,\n\tmin: _min,\n\tmax: _max,\n\tdisabled,\n\treadOnly,\n\tid,\n\t...datePickerProps\n}: DsDateInputProps) => {\n\tconst min = _min ? isoStringToDateValue(_min) : undefined;\n\tconst max = _max ? isoStringToDateValue(_max) : undefined;\n\n\t// Convert public API (string | [string, string]) to internal API (DateValue[])\n\tconst value = _value ? stringToDateValue(_value) : [];\n\tconst defaultValue = _defaultValue ? stringToDateValue(_defaultValue) : [];\n\n\t// Local state for manual text editing\n\tconst [isFocused, setIsFocused] = useState(false);\n\tconst [isOpen, setIsOpen] = useState(false);\n\n\tconst prevValue = useRef<string | null>(null);\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\t// Reformat the input value on every value change\n\t// We don't format when the input is focused since the date value might get updated while the user is typing\n\t// but we don't want to reformat the input text for him while he's typing.\n\tif (!isFocused && prevValue.current !== JSON.stringify(value)) {\n\t\tprevValue.current = JSON.stringify(value);\n\n\t\tif (inputRef.current) {\n\t\t\tinputRef.current.value = formatDateInputValue(value, range);\n\t\t}\n\t}\n\n\tconst clear = () => {\n\t\tif (inputRef.current) {\n\t\t\tinputRef.current.value = '';\n\t\t}\n\n\t\tonValueChange?.(undefined);\n\t};\n\n\tconst handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n\t\tconst text = e.target.value;\n\n\t\t// Try to parse and validate as the user types\n\t\tconst validation = validateDateString({ text, range, min, max });\n\n\t\tif (validation.isValid) {\n\t\t\tconst parsedValue = parseInputText(text, range);\n\t\t\tonValueChange?.(dateValuesToStrings(parsedValue, range) as never);\n\t\t}\n\t};\n\n\tconst handleBlur = () => {\n\t\tsetIsFocused(false);\n\n\t\tconst text = inputRef.current?.value || '';\n\t\tconst validation = validateDateString({ text, range, min, max });\n\n\t\t// Clear invalid input on blur\n\t\tif (!validation.isValid) {\n\t\t\tclear();\n\t\t\treturn;\n\t\t}\n\n\t\tconst parsedValue = parseInputText(text, range);\n\n\t\tonValueChange?.(dateValuesToStrings(parsedValue, range) as never);\n\t};\n\n\tconst showClearButton = !disabled && !readOnly && !!(value.length > 0 ? value : defaultValue).length;\n\tconst Wrapper = disablePortal ? Fragment : Portal;\n\n\treturn (\n\t\t<DatePicker.Root\n\t\t\tvalue={value}\n\t\t\tdefaultValue={defaultValue}\n\t\t\tonValueChange={(details) => {\n\t\t\t\tonValueChange?.(dateValuesToStrings(details.value, range) as never);\n\t\t\t}}\n\t\t\tselectionMode={range ? 'range' : 'single'}\n\t\t\tpositioning={{ placement: 'bottom-start', gutter: 4 }}\n\t\t\tcloseOnSelect={!range}\n\t\t\tmin={min}\n\t\t\tmax={max}\n\t\t\tdisabled={disabled}\n\t\t\treadOnly={readOnly}\n\t\t\topen={isOpen}\n\t\t\tonOpenChange={(details) => {\n\t\t\t\t// Don't close the calendar when the user is typing\n\t\t\t\tif (!isFocused) {\n\t\t\t\t\tsetIsOpen(details.open);\n\t\t\t\t\tonOpenChange?.(details.open);\n\t\t\t\t}\n\t\t\t}}\n\t\t\t{...datePickerProps}\n\t\t>\n\t\t\t<DatePicker.Control\n\t\t\t\tstyle={style}\n\t\t\t\tclassName={classNames(\n\t\t\t\t\tstyles.dateInputControl,\n\t\t\t\t\tdisabled && styles.disabled,\n\t\t\t\t\treadOnly && styles.readOnly,\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<DatePicker.Trigger asChild>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={styles.dateInputButton}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\taria-label=\"Open calendar\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<DsIcon icon=\"calendar_month\" size=\"small\" />\n\t\t\t\t\t</button>\n\t\t\t\t</DatePicker.Trigger>\n\n\t\t\t\t<input\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\tid={id}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tclassName={styles.input}\n\t\t\t\t\tplaceholder={placeholder ?? (range ? 'MM/DD/YYYY - MM/DD/YYYY' : 'MM/DD/YYYY')}\n\t\t\t\t\tdefaultValue={formatDateInputValue(value.length > 0 ? value : defaultValue, range)}\n\t\t\t\t\tonChange={handleInputChange}\n\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\tonFocus={() => setIsFocused(true)}\n\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\treadOnly={readOnly}\n\t\t\t\t/>\n\n\t\t\t\t{showClearButton && (\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={styles.dateInputButton}\n\t\t\t\t\t\tonClick={clear}\n\t\t\t\t\t\taria-label={range ? 'Clear date range' : 'Clear date'}\n\t\t\t\t\t>\n\t\t\t\t\t\t<DsIcon icon=\"close\" size=\"small\" />\n\t\t\t\t\t</button>\n\t\t\t\t)}\n\t\t\t</DatePicker.Control>\n\n\t\t\t<Wrapper>\n\t\t\t\t<DatePicker.Positioner className={styles.positioner}>\n\t\t\t\t\t<DatePicker.Content className={styles.content}>\n\t\t\t\t\t\t<CalendarViewControl />\n\t\t\t\t\t\t<div className={styles.calendarView}>\n\t\t\t\t\t\t\t<DayView />\n\t\t\t\t\t\t\t<MonthView />\n\t\t\t\t\t\t\t<YearView />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</DatePicker.Content>\n\t\t\t\t</DatePicker.Positioner>\n\t\t\t</Wrapper>\n\t\t</DatePicker.Root>\n\t);\n};\n\n/**\n * Calendar view control with navigation buttons\n */\nconst CalendarViewControl = () => (\n\t<DatePicker.ViewControl className={styles.viewControl}>\n\t\t<DatePicker.PrevTrigger className={styles.prevTrigger}>\n\t\t\t<DsIcon icon=\"chevron_left\" size=\"small\" />\n\t\t</DatePicker.PrevTrigger>\n\t\t<DatePicker.ViewTrigger className={styles.viewTrigger} asChild>\n\t\t\t<button type=\"button\">\n\t\t\t\t<DsTypography variant=\"body-md-md\" asChild>\n\t\t\t\t\t<DatePicker.RangeText />\n\t\t\t\t</DsTypography>\n\t\t\t</button>\n\t\t</DatePicker.ViewTrigger>\n\t\t<DatePicker.NextTrigger className={styles.nextTrigger}>\n\t\t\t<DsIcon icon=\"chevron_right\" size=\"small\" />\n\t\t</DatePicker.NextTrigger>\n\t</DatePicker.ViewControl>\n);\n\n/**\n * Day view - displays calendar grid with days of the month\n */\nconst DayView = () => (\n\t<DatePicker.View view=\"day\">\n\t\t<DatePicker.Context>\n\t\t\t{(datePicker) => (\n\t\t\t\t<DatePicker.Table className={styles.table}>\n\t\t\t\t\t<DatePicker.TableHead className={styles.tableHead}>\n\t\t\t\t\t\t<DatePicker.TableRow className={styles.tableRow}>\n\t\t\t\t\t\t\t{datePicker.weekDays.map((weekDay, id) => (\n\t\t\t\t\t\t\t\t<DatePicker.TableHeader key={id} className={styles.tableHeader}>\n\t\t\t\t\t\t\t\t\t<DsTypography variant=\"body-md-md\">{weekDay.short}</DsTypography>\n\t\t\t\t\t\t\t\t</DatePicker.TableHeader>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</DatePicker.TableRow>\n\t\t\t\t\t</DatePicker.TableHead>\n\t\t\t\t\t<DatePicker.TableBody className={styles.tableBody}>\n\t\t\t\t\t\t{datePicker.weeks.map((week, weekId) => (\n\t\t\t\t\t\t\t<DatePicker.TableRow key={weekId} className={styles.tableRow}>\n\t\t\t\t\t\t\t\t{week.map((day, dayId) => (\n\t\t\t\t\t\t\t\t\t<DatePicker.TableCell key={dayId} value={day}>\n\t\t\t\t\t\t\t\t\t\t<DatePicker.TableCellTrigger className={styles.tableCellTrigger}>\n\t\t\t\t\t\t\t\t\t\t\t<DsTypography className={styles.tableCellTriggerValue} variant=\"body-md-md\">\n\t\t\t\t\t\t\t\t\t\t\t\t{day.day}\n\t\t\t\t\t\t\t\t\t\t\t</DsTypography>\n\t\t\t\t\t\t\t\t\t\t</DatePicker.TableCellTrigger>\n\t\t\t\t\t\t\t\t\t</DatePicker.TableCell>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</DatePicker.TableRow>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</DatePicker.TableBody>\n\t\t\t\t</DatePicker.Table>\n\t\t\t)}\n\t\t</DatePicker.Context>\n\t</DatePicker.View>\n);\n\n/**\n * Month view - displays grid with months of the year\n */\nconst MonthView = () => (\n\t<DatePicker.View view=\"month\">\n\t\t<DatePicker.Context>\n\t\t\t{(datePicker) => (\n\t\t\t\t<DatePicker.Table className={styles.table}>\n\t\t\t\t\t<DatePicker.TableBody className={styles.tableBody}>\n\t\t\t\t\t\t{datePicker.getMonthsGrid({ columns: 4, format: 'short' }).map((months, rowId) => (\n\t\t\t\t\t\t\t<DatePicker.TableRow key={rowId} className={styles.tableRow}>\n\t\t\t\t\t\t\t\t{months.map((month, monthId) => (\n\t\t\t\t\t\t\t\t\t<DatePicker.TableCell key={monthId} value={month.value}>\n\t\t\t\t\t\t\t\t\t\t<DatePicker.TableCellTrigger className={styles.tableCellTrigger}>\n\t\t\t\t\t\t\t\t\t\t\t<DsTypography className={styles.tableCellTriggerValue} variant=\"body-md-md\">\n\t\t\t\t\t\t\t\t\t\t\t\t{month.label}\n\t\t\t\t\t\t\t\t\t\t\t</DsTypography>\n\t\t\t\t\t\t\t\t\t\t</DatePicker.TableCellTrigger>\n\t\t\t\t\t\t\t\t\t</DatePicker.TableCell>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</DatePicker.TableRow>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</DatePicker.TableBody>\n\t\t\t\t</DatePicker.Table>\n\t\t\t)}\n\t\t</DatePicker.Context>\n\t</DatePicker.View>\n);\n\n/**\n * Year view - displays grid with years in a decade\n */\nconst YearView = () => (\n\t<DatePicker.View view=\"year\">\n\t\t<DatePicker.Context>\n\t\t\t{(datePicker) => (\n\t\t\t\t<DatePicker.Table className={styles.table}>\n\t\t\t\t\t<DatePicker.TableBody className={styles.tableBody}>\n\t\t\t\t\t\t{datePicker.getYearsGrid({ columns: 4 }).map((years, rowId) => (\n\t\t\t\t\t\t\t<DatePicker.TableRow key={rowId} className={styles.tableRow}>\n\t\t\t\t\t\t\t\t{years.map((year, yearId) => (\n\t\t\t\t\t\t\t\t\t<DatePicker.TableCell key={yearId} value={year.value}>\n\t\t\t\t\t\t\t\t\t\t<DatePicker.TableCellTrigger className={styles.tableCellTrigger}>\n\t\t\t\t\t\t\t\t\t\t\t<DsTypography className={styles.tableCellTriggerValue} variant=\"body-md-md\">\n\t\t\t\t\t\t\t\t\t\t\t\t{year.label}\n\t\t\t\t\t\t\t\t\t\t\t</DsTypography>\n\t\t\t\t\t\t\t\t\t\t</DatePicker.TableCellTrigger>\n\t\t\t\t\t\t\t\t\t</DatePicker.TableCell>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</DatePicker.TableRow>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</DatePicker.TableBody>\n\t\t\t\t</DatePicker.Table>\n\t\t\t)}\n\t\t</DatePicker.Context>\n\t</DatePicker.View>\n);\n\nexport default DsDateInput;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,MAAMiB,eAAe,EACpBC,QAAQ,OACRC,aACAC,OACAC,WACAC,gBAAgB,OAChBC,eACAC,cACAC,OAAOC,QACPC,cAAcC,eACdC,KAAKC,MACLC,KAAKC,MACLC,UACAC,UACAC,IACA,GAAGC,sBACoB;CACvB,MAAMP,MAAMC,OAAOpB,qBAAqBoB,KAAK,GAAGO;CAChD,MAAMN,MAAMC,OAAOtB,qBAAqBsB,KAAK,GAAGK;CAGhD,MAAMZ,QAAQC,SAASd,kBAAkBc,OAAO,GAAG,EAAE;CACrD,M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
+
var ds_date_input_module_default = {
|
|
4
|
+
"dateInputControl": "_dateInputControl_rkhb0_1",
|
|
5
|
+
"input": "_input_rkhb0_1",
|
|
6
|
+
"iconButton": "_iconButton_rkhb0_1",
|
|
7
|
+
"disabled": "_disabled_rkhb0_1",
|
|
8
|
+
"dateInputButton": "_dateInputButton_rkhb0_1",
|
|
9
|
+
"readOnly": "_readOnly_rkhb0_1",
|
|
10
|
+
"positioner": "_positioner_rkhb0_1",
|
|
11
|
+
"content": "_content_rkhb0_1",
|
|
12
|
+
"expand": "_expand_rkhb0_1",
|
|
13
|
+
"collapse": "_collapse_rkhb0_1",
|
|
14
|
+
"viewControl": "_viewControl_rkhb0_1",
|
|
15
|
+
"viewTrigger": "_viewTrigger_rkhb0_1",
|
|
16
|
+
"prevTrigger": "_prevTrigger_rkhb0_1",
|
|
17
|
+
"nextTrigger": "_nextTrigger_rkhb0_1",
|
|
18
|
+
"calendarView": "_calendarView_rkhb0_1",
|
|
19
|
+
"table": "_table_rkhb0_1",
|
|
20
|
+
"tableBody": "_tableBody_rkhb0_1",
|
|
21
|
+
"tableRow": "_tableRow_rkhb0_1",
|
|
22
|
+
"tableCellTrigger": "_tableCellTrigger_rkhb0_1",
|
|
23
|
+
"tableCellTriggerValue": "_tableCellTriggerValue_rkhb0_1",
|
|
24
|
+
"tableHead": "_tableHead_rkhb0_1",
|
|
25
|
+
"tableHeader": "_tableHeader_rkhb0_1"
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.default = ds_date_input_module_default;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/components/ds-date-input/ds-date-input.module.scss
|
|
2
|
+
var ds_date_input_module_default = {
|
|
3
|
+
"dateInputControl": "_dateInputControl_rkhb0_1",
|
|
4
|
+
"input": "_input_rkhb0_1",
|
|
5
|
+
"iconButton": "_iconButton_rkhb0_1",
|
|
6
|
+
"disabled": "_disabled_rkhb0_1",
|
|
7
|
+
"dateInputButton": "_dateInputButton_rkhb0_1",
|
|
8
|
+
"readOnly": "_readOnly_rkhb0_1",
|
|
9
|
+
"positioner": "_positioner_rkhb0_1",
|
|
10
|
+
"content": "_content_rkhb0_1",
|
|
11
|
+
"expand": "_expand_rkhb0_1",
|
|
12
|
+
"collapse": "_collapse_rkhb0_1",
|
|
13
|
+
"viewControl": "_viewControl_rkhb0_1",
|
|
14
|
+
"viewTrigger": "_viewTrigger_rkhb0_1",
|
|
15
|
+
"prevTrigger": "_prevTrigger_rkhb0_1",
|
|
16
|
+
"nextTrigger": "_nextTrigger_rkhb0_1",
|
|
17
|
+
"calendarView": "_calendarView_rkhb0_1",
|
|
18
|
+
"table": "_table_rkhb0_1",
|
|
19
|
+
"tableBody": "_tableBody_rkhb0_1",
|
|
20
|
+
"tableRow": "_tableRow_rkhb0_1",
|
|
21
|
+
"tableCellTrigger": "_tableCellTrigger_rkhb0_1",
|
|
22
|
+
"tableCellTriggerValue": "_tableCellTriggerValue_rkhb0_1",
|
|
23
|
+
"tableHead": "_tableHead_rkhb0_1",
|
|
24
|
+
"tableHeader": "_tableHeader_rkhb0_1"
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ds_date_input_module_default as default };
|
|
29
|
+
//# sourceMappingURL=ds-date-input.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-date-input.module.js","names":[],"sources":["../../../file:/home/runner/work/design-system/design-system/packages/design-system/src/components/ds-date-input/ds-date-input.module.scss","../../../file:/home/runner/work/design-system/design-system/packages/design-system/src/styles/shared/_input.scss","../../../file:/home/runner/work/design-system/design-system/packages/design-system/src/styles/_typography.scss","../../../file:/home/runner/work/design-system/design-system/packages/design-system/src/styles/shared/_dropdown.scss","../../../file:/home/runner/work/design-system/design-system/packages/design-system/src/styles/mixins/_bounding-box.scss"],"sourcesContent":["@use '../../styles/shared/input';\n@use '../../styles/shared/dropdown';\n\n.dateInputControl {\n\t@include input.base-input-container;\n\t@include input.input-container-states;\n\tmax-height: input.$input-text-height-default;\n\tjustify-content: space-between;\n\tpadding: var(--spacing-xs) var(--spacing-sm);\n\tgap: var(--spacing-3xs);\n\n\tborder-color: var(--form-control-border-color, var(--color-border));\n\n\t&:hover:not(.disabled) {\n\t\tborder-color: var(--form-control-border-color, var(--color-border-hover));\n\t}\n\n\t&:focus-within {\n\t\tborder-color: var(--form-control-border-color, var(--color-border-action));\n\t}\n\n\t&.disabled {\n\t\tcolor: var(--color-background-deselected);\n\t\tbackground: var(--color-background-secondary);\n\t\tborder-color: var(--color-border-disabled);\n\t\tcursor: not-allowed;\n\n\t\t.input {\n\t\t\tcolor: var(--color-font-disabled);\n\t\t}\n\n\t\t.dateInputButton {\n\t\t\tcolor: var(--color-background-disable);\n\t\t\tcursor: not-allowed;\n\t\t}\n\t}\n\n\t&.readOnly {\n\t\tbackground: var(--color-background-secondary);\n\t\tcursor: default;\n\t}\n}\n\n.input {\n\t@include input.base-input;\n\tmin-width: 0;\n\tflex: 1;\n\tpadding: 0;\n}\n\n.dateInputButton {\n\t@include input.icon-button;\n\tdisplay: flex;\n\talign-items: center;\n\tcursor: pointer;\n\tpadding: 0;\n\ttransition: color 0.2s ease;\n\n\t&:hover:not(:disabled) {\n\t\tcolor: var(--color-background-action-hover);\n\t}\n\n\t&:disabled {\n\t\tcolor: var(--color-background-disable);\n\t\tcursor: not-allowed;\n\t}\n}\n\n.positioner {\n\t@include dropdown.dropdown-viewport;\n}\n\n.content {\n\t@include dropdown.dropdown-content;\n\tpadding: var(--spacing-standard);\n}\n\n.viewControl {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tmargin-bottom: var(--spacing-xs);\n}\n\n.viewTrigger {\n\tflex: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground: transparent;\n\tborder: none;\n\tcursor: pointer;\n\tpadding: var(--spacing-2xs) var(--spacing-xs);\n\tborder-radius: var(--spacing-2xs);\n\tcolor: var(--color-font-main);\n\ttransition: background-color 0.2s;\n\n\t&:hover {\n\t\tbackground: var(--color-background-hover);\n\t}\n}\n\n.prevTrigger,\n.nextTrigger {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground: transparent;\n\tborder: none;\n\tcursor: pointer;\n\tpadding: var(--spacing-2xs);\n\tborder-radius: var(--spacing-2xs);\n\tcolor: var(--color-font-secondary);\n\ttransition: all 0.2s;\n\n\t&:hover {\n\t\tbackground: var(--color-background-hover);\n\t\tcolor: var(--color-font-main);\n\t}\n\n\t&:disabled {\n\t\tcursor: not-allowed;\n\t\topacity: 0.5;\n\t}\n}\n\n.calendarView {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: var(--spacing-xs);\n}\n\n.table {\n\twidth: 100%;\n\tborder-collapse: collapse;\n\n\t.tableBody .tableRow .tableCellTrigger:focus-visible {\n\t\t.tableCellTriggerValue {\n\t\t\toutline: 2px solid var(--color-background-action-hover);\n\t\t\tborder-radius: var(--spacing-2xs);\n\t\t\tborder-width: 0;\n\t\t}\n\t}\n}\n\n.tableHead {\n\tborder-bottom: 1px solid var(--color-border);\n}\n\n.tableHeader {\n\ttext-align: center;\n\tpadding: var(--spacing-2xs);\n\tcolor: var(--color-font-secondary);\n\tfont-weight: var(--font-weight-medium);\n}\n\n.tableRow {\n\t&:first-child {\n\t\t.tableCellTrigger {\n\t\t\tmargin-top: var(--spacing-xs);\n\t\t}\n\t}\n}\n\n.tableCellTrigger {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tcursor: pointer;\n\tuser-select: none;\n\t-webkit-tap-highlight-color: transparent;\n\toutline: none;\n\n\t.tableCellTriggerValue {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\twidth: var(--spacing-xl);\n\t\theight: var(--spacing-xl);\n\t\tmargin: var(--spacing-3xs);\n\t\tcolor: var(--color-font-main);\n\t\tborder-radius: var(--spacing-xs);\n\t}\n\n\t&:hover:not([data-disabled], [data-selected], [data-in-range], [data-in-hover-range])\n\t\t.tableCellTriggerValue {\n\t\toutline: 1px solid var(--color-border);\n\t\tbackground: var(--color-background-action-hover-weak);\n\t}\n\n\t&[data-outside-range] .tableCellTriggerValue {\n\t\tcolor: var(--color-font-disabled);\n\t}\n\n\t&[data-selected] .tableCellTriggerValue {\n\t\tbackground: var(--color-background-selected);\n\t\tcolor: var(--color-font-on-action);\n\t}\n\n\t&[data-in-range]:not([data-selected]) {\n\t\tposition: relative;\n\n\t\t.tableCellTriggerValue {\n\t\t\tbackground: var(--color-background-action-secondary-hover);\n\t\t}\n\t}\n\n\t&[data-today]:not([data-selected], [data-in-range]):hover .tableCellTriggerValue {\n\t\tborder-radius: var(--spacing-xs);\n\t}\n\n\t&[data-today]:not([data-selected]) .tableCellTriggerValue {\n\t\tposition: relative;\n\n\t\t&::after {\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\twidth: 75%;\n\t\t\tbottom: 4px;\n\t\t\tborder-bottom: 1px solid var(--color-background-brand);\n\t\t}\n\t}\n\n\t&[data-today][data-selected] .tableCellTriggerValue {\n\t\tposition: relative;\n\n\t\t&::after {\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\twidth: 75%;\n\t\t\tbottom: 4px;\n\t\t\tborder-bottom: 1px solid var(--color-background);\n\t\t}\n\t}\n\n\t&[data-disabled] .tableCellTriggerValue {\n\t\tcolor: var(--color-font-disabled);\n\t\tcursor: not-allowed;\n\t\topacity: 0.5;\n\t}\n\n\t&[data-unavailable] .tableCellTriggerValue {\n\t\ttext-decoration: line-through;\n\t\topacity: 0.4;\n\t}\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { DatePickerRootProps } from "@ark-ui/react/date-picker";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ds-date-input/ds-date-input.types.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Range-specific props with discriminated union for type safety
|
|
7
|
+
*/
|
|
8
|
+
type DsDateInputRangeProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Whether to enable range selection
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
range?: false;
|
|
14
|
+
/**
|
|
15
|
+
* Controlled value as ISO date string (YYYY-MM-DD)
|
|
16
|
+
* @example '2024-12-25'
|
|
17
|
+
*/
|
|
18
|
+
value?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Default value for uncontrolled mode
|
|
21
|
+
* @example '2024-12-25'
|
|
22
|
+
*/
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Callback when the value changes
|
|
26
|
+
* @param value - ISO date string (YYYY-MM-DD) or undefined when empty
|
|
27
|
+
* @example '2024-12-25'
|
|
28
|
+
*/
|
|
29
|
+
onValueChange?: (value: string | undefined) => void;
|
|
30
|
+
} | {
|
|
31
|
+
/**
|
|
32
|
+
* Whether to enable range selection
|
|
33
|
+
*/
|
|
34
|
+
range: true;
|
|
35
|
+
/**
|
|
36
|
+
* Controlled value as ISO date string tuple (YYYY-MM-DD)
|
|
37
|
+
* @example ['2024-12-01', '2024-12-31']
|
|
38
|
+
*/
|
|
39
|
+
value?: [string, string];
|
|
40
|
+
/**
|
|
41
|
+
* Default value for uncontrolled mode
|
|
42
|
+
* @example ['2024-12-01', '2024-12-31']
|
|
43
|
+
*/
|
|
44
|
+
defaultValue?: [string, string];
|
|
45
|
+
/**
|
|
46
|
+
* Callback when the value changes
|
|
47
|
+
* @param value - ISO date string tuple (YYYY-MM-DD) or undefined when empty
|
|
48
|
+
* @example ['2024-12-01', '2024-12-31']
|
|
49
|
+
*/
|
|
50
|
+
onValueChange?: (value: [string, string] | undefined) => void;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Base props shared across all modes
|
|
54
|
+
*/
|
|
55
|
+
type DsDateInputBaseProps = Pick<DatePickerRootProps, 'disabled' | 'readOnly' | 'id' | 'open' | 'name' | 'style'> & {
|
|
56
|
+
/**
|
|
57
|
+
* Callback when the open state changes
|
|
58
|
+
* @param open - Whether the calendar is open
|
|
59
|
+
*/
|
|
60
|
+
onOpenChange?: (open: boolean) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Minimum allowed date as ISO string (YYYY-MM-DD)
|
|
63
|
+
* @example '2024-01-01'
|
|
64
|
+
*/
|
|
65
|
+
min?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Maximum allowed date as ISO string (YYYY-MM-DD)
|
|
68
|
+
* @example '2024-12-31'
|
|
69
|
+
*/
|
|
70
|
+
max?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Placeholder text for the input
|
|
73
|
+
* @default 'MM/DD/YYYY' for single date, 'MM/DD/YYYY - MM/DD/YYYY' for range
|
|
74
|
+
*/
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Custom class name for the root container
|
|
78
|
+
*/
|
|
79
|
+
className?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Whether to disable the portal for the calendar content
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
disablePortal?: boolean;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Props for the DsDateInput component
|
|
88
|
+
*/
|
|
89
|
+
type DsDateInputProps = DsDateInputBaseProps & DsDateInputRangeProps;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { DsDateInputProps };
|
|
92
|
+
//# sourceMappingURL=ds-date-input.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-date-input.types.d.cts","names":[],"sources":["../../../src/components/ds-date-input/ds-date-input.types.tsx"],"sourcesContent":[],"mappings":";;;;;;AAAqE;AAK3C,KAArB,qBAAA,GAwDoB;EA0Cb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA1CP,oBAAA,GAAuB,KAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCW,gBAAA,GAAmB,uBAAuB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { DatePickerRootProps } from "@ark-ui/react/date-picker";
|
|
2
|
+
|
|
3
|
+
//#region src/components/ds-date-input/ds-date-input.types.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Range-specific props with discriminated union for type safety
|
|
7
|
+
*/
|
|
8
|
+
type DsDateInputRangeProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Whether to enable range selection
|
|
11
|
+
* @default false
|
|
12
|
+
*/
|
|
13
|
+
range?: false;
|
|
14
|
+
/**
|
|
15
|
+
* Controlled value as ISO date string (YYYY-MM-DD)
|
|
16
|
+
* @example '2024-12-25'
|
|
17
|
+
*/
|
|
18
|
+
value?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Default value for uncontrolled mode
|
|
21
|
+
* @example '2024-12-25'
|
|
22
|
+
*/
|
|
23
|
+
defaultValue?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Callback when the value changes
|
|
26
|
+
* @param value - ISO date string (YYYY-MM-DD) or undefined when empty
|
|
27
|
+
* @example '2024-12-25'
|
|
28
|
+
*/
|
|
29
|
+
onValueChange?: (value: string | undefined) => void;
|
|
30
|
+
} | {
|
|
31
|
+
/**
|
|
32
|
+
* Whether to enable range selection
|
|
33
|
+
*/
|
|
34
|
+
range: true;
|
|
35
|
+
/**
|
|
36
|
+
* Controlled value as ISO date string tuple (YYYY-MM-DD)
|
|
37
|
+
* @example ['2024-12-01', '2024-12-31']
|
|
38
|
+
*/
|
|
39
|
+
value?: [string, string];
|
|
40
|
+
/**
|
|
41
|
+
* Default value for uncontrolled mode
|
|
42
|
+
* @example ['2024-12-01', '2024-12-31']
|
|
43
|
+
*/
|
|
44
|
+
defaultValue?: [string, string];
|
|
45
|
+
/**
|
|
46
|
+
* Callback when the value changes
|
|
47
|
+
* @param value - ISO date string tuple (YYYY-MM-DD) or undefined when empty
|
|
48
|
+
* @example ['2024-12-01', '2024-12-31']
|
|
49
|
+
*/
|
|
50
|
+
onValueChange?: (value: [string, string] | undefined) => void;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Base props shared across all modes
|
|
54
|
+
*/
|
|
55
|
+
type DsDateInputBaseProps = Pick<DatePickerRootProps, 'disabled' | 'readOnly' | 'id' | 'open' | 'name' | 'style'> & {
|
|
56
|
+
/**
|
|
57
|
+
* Callback when the open state changes
|
|
58
|
+
* @param open - Whether the calendar is open
|
|
59
|
+
*/
|
|
60
|
+
onOpenChange?: (open: boolean) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Minimum allowed date as ISO string (YYYY-MM-DD)
|
|
63
|
+
* @example '2024-01-01'
|
|
64
|
+
*/
|
|
65
|
+
min?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Maximum allowed date as ISO string (YYYY-MM-DD)
|
|
68
|
+
* @example '2024-12-31'
|
|
69
|
+
*/
|
|
70
|
+
max?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Placeholder text for the input
|
|
73
|
+
* @default 'MM/DD/YYYY' for single date, 'MM/DD/YYYY - MM/DD/YYYY' for range
|
|
74
|
+
*/
|
|
75
|
+
placeholder?: string;
|
|
76
|
+
/**
|
|
77
|
+
* Custom class name for the root container
|
|
78
|
+
*/
|
|
79
|
+
className?: string;
|
|
80
|
+
/**
|
|
81
|
+
* Whether to disable the portal for the calendar content
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
disablePortal?: boolean;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Props for the DsDateInput component
|
|
88
|
+
*/
|
|
89
|
+
type DsDateInputProps = DsDateInputBaseProps & DsDateInputRangeProps;
|
|
90
|
+
//#endregion
|
|
91
|
+
export { DsDateInputProps };
|
|
92
|
+
//# sourceMappingURL=ds-date-input.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ds-date-input.types.d.ts","names":[],"sources":["../../../src/components/ds-date-input/ds-date-input.types.tsx"],"sourcesContent":[],"mappings":";;;;;;AAAqE;AAK3C,KAArB,qBAAA,GAwDoB;EA0Cb;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA1CP,oBAAA,GAAuB,KAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyCW,gBAAA,GAAmB,uBAAuB"}
|