@razorpay/blade 12.49.5 → 12.49.7
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/build/lib/native/components/DatePicker/DatePickerContext.js +7 -0
- package/build/lib/native/components/DatePicker/DatePickerContext.js.map +1 -0
- package/build/lib/native/components/Input/BaseInput/BaseInput.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/native/components/Input/TextInput/TextInput.js +2 -1
- package/build/lib/native/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js +37 -15
- package/build/lib/web/development/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/CalendarFooter.web.js +42 -24
- package/build/lib/web/development/components/DatePicker/CalendarFooter.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/DateInput.web.js +15 -10
- package/build/lib/web/development/components/DatePicker/DateInput.web.js.map +1 -1
- package/build/lib/web/development/components/DatePicker/DatePickerContext.js +22 -0
- package/build/lib/web/development/components/DatePicker/DatePickerContext.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetSideBar.web.js +2 -4
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetSideBar.web.js.map +1 -1
- package/build/lib/web/{production/components/DatePicker/QuickSelection/PresetDropdown.web.js → development/components/DatePicker/QuickSelection/renderPresetDropdown.web.js} +10 -9
- package/build/lib/web/development/components/DatePicker/QuickSelection/renderPresetDropdown.web.js.map +1 -0
- package/build/lib/web/development/components/DatePicker/QuickSelection/{PresetContext.js → usePresetState.js} +6 -21
- package/build/lib/web/development/components/DatePicker/QuickSelection/usePresetState.js.map +1 -0
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js +7 -3
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/TextInput/TextInput.js +5 -2
- package/build/lib/web/development/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js +37 -15
- package/build/lib/web/production/components/DatePicker/BaseDatePicker.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/CalendarFooter.web.js +42 -24
- package/build/lib/web/production/components/DatePicker/CalendarFooter.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/DateInput.web.js +15 -10
- package/build/lib/web/production/components/DatePicker/DateInput.web.js.map +1 -1
- package/build/lib/web/production/components/DatePicker/DatePickerContext.js +22 -0
- package/build/lib/web/production/components/DatePicker/DatePickerContext.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetSideBar.web.js +2 -4
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetSideBar.web.js.map +1 -1
- package/build/lib/web/{development/components/DatePicker/QuickSelection/PresetDropdown.web.js → production/components/DatePicker/QuickSelection/renderPresetDropdown.web.js} +10 -9
- package/build/lib/web/production/components/DatePicker/QuickSelection/renderPresetDropdown.web.js.map +1 -0
- package/build/lib/web/production/components/DatePicker/QuickSelection/{PresetContext.js → usePresetState.js} +6 -21
- package/build/lib/web/production/components/DatePicker/QuickSelection/usePresetState.js.map +1 -0
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js +7 -3
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/TextInput/TextInput.js +5 -2
- package/build/lib/web/production/components/Input/TextInput/TextInput.js.map +1 -1
- package/build/types/components/index.d.ts +5 -0
- package/build/types/components/index.native.d.ts +5 -0
- package/package.json +1 -1
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetContext.js.map +0 -1
- package/build/lib/web/development/components/DatePicker/QuickSelection/PresetDropdown.web.js.map +0 -1
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetContext.js.map +0 -1
- package/build/lib/web/production/components/DatePicker/QuickSelection/PresetDropdown.web.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import 'react';
|
|
1
|
+
import React__default from 'react';
|
|
2
2
|
import '../Box/BaseBox/index.js';
|
|
3
3
|
import '../Button/index.js';
|
|
4
4
|
import '../Divider/index.js';
|
|
@@ -13,36 +13,54 @@ import { MAKE_ANALYTICS_CONSTANTS } from '../../utils/makeAnalyticsAttribute/mak
|
|
|
13
13
|
var CalendarFooter = function CalendarFooter(_ref) {
|
|
14
14
|
var onApply = _ref.onApply,
|
|
15
15
|
onCancel = _ref.onCancel,
|
|
16
|
-
isButtonDisabled = _ref.isButtonDisabled
|
|
16
|
+
isButtonDisabled = _ref.isButtonDisabled,
|
|
17
|
+
footer = _ref.footer,
|
|
18
|
+
selectionType = _ref.selectionType;
|
|
17
19
|
var isMobile = useIsMobile();
|
|
20
|
+
var isSingleSelectionOrMobile = isMobile || selectionType === 'single';
|
|
21
|
+
var footerMaxWidth = React__default.useMemo(function () {
|
|
22
|
+
if (isMobile) return '100%';
|
|
23
|
+
return selectionType === 'single' ? '280px' : '390px';
|
|
24
|
+
}, [isMobile, selectionType]);
|
|
18
25
|
return /*#__PURE__*/jsxs(BaseBox, {
|
|
19
26
|
display: "flex",
|
|
20
27
|
flexDirection: "column",
|
|
21
28
|
gap: "spacing.5",
|
|
22
29
|
children: [isMobile ? null : /*#__PURE__*/jsx(Divider, {}), /*#__PURE__*/jsxs(BaseBox, {
|
|
23
|
-
width: {
|
|
24
|
-
base: '100%',
|
|
25
|
-
m: 'auto'
|
|
26
|
-
},
|
|
27
|
-
marginLeft: "auto",
|
|
28
30
|
display: "flex",
|
|
29
|
-
flexDirection:
|
|
30
|
-
gap:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
flexDirection: isSingleSelectionOrMobile ? 'column' : 'row',
|
|
32
|
+
gap: isSingleSelectionOrMobile ? 'spacing.5' : 'spacing.6',
|
|
33
|
+
justifyContent: "space-between",
|
|
34
|
+
children: [footer ? /*#__PURE__*/jsx(BaseBox, {
|
|
35
|
+
maxWidth: footerMaxWidth,
|
|
36
|
+
children: footer
|
|
37
|
+
}) : null, /*#__PURE__*/jsx(BaseBox, {
|
|
38
|
+
width: {
|
|
39
|
+
base: '100%',
|
|
40
|
+
m: 'auto'
|
|
41
|
+
},
|
|
42
|
+
marginLeft: "auto",
|
|
43
|
+
children: /*#__PURE__*/jsxs(BaseBox, {
|
|
44
|
+
display: "flex",
|
|
45
|
+
flexDirection: "row",
|
|
46
|
+
gap: isMobile ? 'spacing.5' : 'spacing.3',
|
|
47
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
48
|
+
isFullWidth: isMobile,
|
|
49
|
+
variant: "tertiary",
|
|
50
|
+
size: "medium",
|
|
51
|
+
onClick: onCancel,
|
|
52
|
+
"data-analytics-name": MAKE_ANALYTICS_CONSTANTS.DATE_PICKER.CANCEL_BUTTON,
|
|
53
|
+
children: "Cancel"
|
|
54
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
55
|
+
isDisabled: isButtonDisabled,
|
|
56
|
+
isFullWidth: isMobile,
|
|
57
|
+
variant: "primary",
|
|
58
|
+
size: "medium",
|
|
59
|
+
onClick: onApply,
|
|
60
|
+
"data-analytics-name": MAKE_ANALYTICS_CONSTANTS.DATE_PICKER.APPLY_BUTTON,
|
|
61
|
+
children: "Apply"
|
|
62
|
+
})]
|
|
63
|
+
})
|
|
46
64
|
})]
|
|
47
65
|
})]
|
|
48
66
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarFooter.web.js","sources":["../../../../../../src/components/DatePicker/CalendarFooter.web.tsx"],"sourcesContent":["import React from 'react';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Button } from '~components/Button';\nimport { Divider } from '~components/Divider';\nimport { MAKE_ANALYTICS_CONSTANTS } from '~utils/makeAnalyticsAttribute';\nimport { useIsMobile } from '~utils/useIsMobile';\n\ntype CalendarFooterProps = {\n onApply: () => void;\n onCancel: () => void;\n isButtonDisabled?: boolean;\n};\nconst CalendarFooter = ({\n onApply,\n onCancel,\n isButtonDisabled,\n}: CalendarFooterProps): React.ReactElement => {\n const isMobile = useIsMobile();\n\n return (\n <BaseBox display=\"flex\" flexDirection=\"column\" gap=\"spacing.5\">\n {isMobile ? null : <Divider />}\n <BaseBox\n width={{ base: '100%', m: 'auto' }}
|
|
1
|
+
{"version":3,"file":"CalendarFooter.web.js","sources":["../../../../../../src/components/DatePicker/CalendarFooter.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { DateSelectionType } from './types';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Button } from '~components/Button';\nimport { Divider } from '~components/Divider';\nimport { MAKE_ANALYTICS_CONSTANTS } from '~utils/makeAnalyticsAttribute';\nimport { useIsMobile } from '~utils/useIsMobile';\n\ntype CalendarFooterProps = {\n onApply: () => void;\n onCancel: () => void;\n isButtonDisabled?: boolean;\n footer?: React.ReactElement;\n selectionType?: DateSelectionType;\n};\nconst CalendarFooter = ({\n onApply,\n onCancel,\n isButtonDisabled,\n footer,\n selectionType,\n}: CalendarFooterProps): React.ReactElement => {\n const isMobile = useIsMobile();\n\n const isSingleSelectionOrMobile = isMobile || selectionType === 'single';\n const footerMaxWidth = React.useMemo(() => {\n if (isMobile) return '100%';\n return selectionType === 'single' ? '280px' : '390px';\n }, [isMobile, selectionType]);\n\n return (\n <BaseBox display=\"flex\" flexDirection=\"column\" gap=\"spacing.5\">\n {isMobile ? null : <Divider />}\n\n <BaseBox\n display=\"flex\"\n flexDirection={isSingleSelectionOrMobile ? 'column' : 'row'}\n gap={isSingleSelectionOrMobile ? 'spacing.5' : 'spacing.6'}\n justifyContent=\"space-between\"\n >\n {footer ? <BaseBox maxWidth={footerMaxWidth}>{footer}</BaseBox> : null}\n <BaseBox width={{ base: '100%', m: 'auto' }} marginLeft=\"auto\">\n <BaseBox display=\"flex\" flexDirection=\"row\" gap={isMobile ? 'spacing.5' : 'spacing.3'}>\n <Button\n isFullWidth={isMobile}\n variant=\"tertiary\"\n size=\"medium\"\n onClick={onCancel}\n data-analytics-name={MAKE_ANALYTICS_CONSTANTS.DATE_PICKER.CANCEL_BUTTON}\n >\n Cancel\n </Button>\n <Button\n isDisabled={isButtonDisabled}\n isFullWidth={isMobile}\n variant=\"primary\"\n size=\"medium\"\n onClick={onApply}\n data-analytics-name={MAKE_ANALYTICS_CONSTANTS.DATE_PICKER.APPLY_BUTTON}\n >\n Apply\n </Button>\n </BaseBox>\n </BaseBox>\n </BaseBox>\n </BaseBox>\n );\n};\n\nexport { CalendarFooter };\n"],"names":["CalendarFooter","_ref","onApply","onCancel","isButtonDisabled","footer","selectionType","isMobile","useIsMobile","isSingleSelectionOrMobile","footerMaxWidth","React","useMemo","_jsxs","BaseBox","display","flexDirection","gap","children","_jsx","Divider","justifyContent","maxWidth","width","base","m","marginLeft","Button","isFullWidth","variant","size","onClick","MAKE_ANALYTICS_CONSTANTS","DATE_PICKER","CANCEL_BUTTON","isDisabled","APPLY_BUTTON"],"mappings":";;;;;;;;;;;;AAeA,IAAMA,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAM2B;AAAA,EAAA,IAL7CC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,gBAAgB,GAAAH,IAAA,CAAhBG,gBAAgB;IAChBC,MAAM,GAAAJ,IAAA,CAANI,MAAM;IACNC,aAAa,GAAAL,IAAA,CAAbK,aAAa,CAAA;AAEb,EAAA,IAAMC,QAAQ,GAAGC,WAAW,EAAE,CAAA;AAE9B,EAAA,IAAMC,yBAAyB,GAAGF,QAAQ,IAAID,aAAa,KAAK,QAAQ,CAAA;AACxE,EAAA,IAAMI,cAAc,GAAGC,cAAK,CAACC,OAAO,CAAC,YAAM;IACzC,IAAIL,QAAQ,EA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,YAAAA,IAAI,EAAC,QAAQ;AACbC,YAAAA,OAAO,EAAE5B,QAAS;AAClB,YAAA,qBAAA,EAAqB6B,wBAAwB,CAACC,WAAW,CAACC,aAAc;AAAAhB,YAAAA,QAAA,EACzE,QAAA;AAED,WAAQ,CAAC,eACTC,GAAA,CAACQ,MAAM,EAAA;AACLQ,YAAAA,UAAU,EAAE/B,gBAAiB;AAC7BwB,YAAAA,WAAW,EAAErB,QAAS;AACtBsB,YAAAA,OAAO,EAAC,SAAS;AACjBC,YAAAA,IAAI,EAAC,QAAQ;AACbC,YAAAA,OAAO,EAAE7B,OAAQ;AACjB,YAAA,qBAAA,EAAqB8B,wBAAwB,CAACC,WAAW,CAACG,YAAa;AAAAlB,YAAAA,QAAA,EACxE,OAAA;AAED,WAAQ,CAAC,CAAA;SACF,CAAA;AAAC,OACH,CAAC,CAAA;AAAA,KACH,CAAC,CAAA;AAAA,GACH,CAAC,CAAA;AAEd;;;;"}
|
|
@@ -5,7 +5,6 @@ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProper
|
|
|
5
5
|
import React__default from 'react';
|
|
6
6
|
import { useDatesContext } from '@mantine/dates';
|
|
7
7
|
import { stripDelimiters, validateAndParseDateInput, rangeFormattedValue, getTextInputFormat, finalInputFormat, getFormattedDate, rangeInputPlaceHolder } from './utils.js';
|
|
8
|
-
import { usePresetContext } from './QuickSelection/PresetContext.js';
|
|
9
8
|
import '../Box/BaseBox/index.js';
|
|
10
9
|
import '../Input/TextInput/index.js';
|
|
11
10
|
import '../../utils/index.js';
|
|
@@ -18,9 +17,9 @@ import { isReactNative } from '../../utils/platform/isReactNative.js';
|
|
|
18
17
|
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
19
18
|
import { BaseBox } from '../Box/BaseBox/BaseBox.web.js';
|
|
20
19
|
|
|
21
|
-
var _excluded = ["format", "date", "setControlledValue", "leadingDropdown", "tags", "id"],
|
|
20
|
+
var _excluded = ["format", "date", "setControlledValue", "effectiveSelectionType", "leadingDropdown", "tags", "id"],
|
|
22
21
|
_excluded2 = ["value", "name", "isRequired", "isDisabled"],
|
|
23
|
-
_excluded3 = ["selectionType", "referenceProps", "inputRef", "date", "label", "labelPosition", "labelSuffix", "labelTrailing", "autoFocus", "name", "size", "necessityIndicator", "successText", "errorText", "helpText", "format", "placeholder", "setControlledValue", "leadingDropdown", "selectedPreset", "excludeDate", "minDate", "maxDate"];
|
|
22
|
+
_excluded3 = ["selectionType", "referenceProps", "inputRef", "date", "label", "labelPosition", "labelSuffix", "labelTrailing", "autoFocus", "name", "size", "necessityIndicator", "successText", "errorText", "helpText", "format", "placeholder", "setControlledValue", "leadingDropdown", "selectedPreset", "excludeDate", "minDate", "maxDate", "effectiveSelectionType"];
|
|
24
23
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
25
24
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
26
25
|
var _DateInput = function _DateInput(props, ref) {
|
|
@@ -28,6 +27,7 @@ var _DateInput = function _DateInput(props, ref) {
|
|
|
28
27
|
var format = props.format,
|
|
29
28
|
date = props.date,
|
|
30
29
|
setControlledValue = props.setControlledValue,
|
|
30
|
+
effectiveSelectionType = props.effectiveSelectionType,
|
|
31
31
|
leadingDropdown = props.leadingDropdown,
|
|
32
32
|
tags = props.tags,
|
|
33
33
|
id = props.id,
|
|
@@ -40,11 +40,11 @@ var _DateInput = function _DateInput(props, ref) {
|
|
|
40
40
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
41
41
|
validationError = _React$useState4[0],
|
|
42
42
|
setValidationError = _React$useState4[1];
|
|
43
|
-
var
|
|
43
|
+
var shouldShowCalendarIcon = !Boolean(leadingDropdown);
|
|
44
44
|
|
|
45
45
|
// Determine selection type: prefer preset context calculation over props
|
|
46
46
|
// This handles "Today" presets that should display as single even though data is range
|
|
47
|
-
var isRange =
|
|
47
|
+
var isRange = effectiveSelectionType === 'single' ? false : effectiveSelectionType === 'range' || props.selectionType === 'range';
|
|
48
48
|
|
|
49
49
|
// Sync internal input state with external formatted values from parent component
|
|
50
50
|
// textInputProps.value comes from DatePickerInput as formatted strings: ["25/12/2024", "31/12/2024"]
|
|
@@ -81,7 +81,7 @@ var _DateInput = function _DateInput(props, ref) {
|
|
|
81
81
|
|
|
82
82
|
// Special handling: if preset context shows single but props expect range
|
|
83
83
|
// (like "Today" preset), convert single date back to same-day range
|
|
84
|
-
if (
|
|
84
|
+
if (effectiveSelectionType === 'single' && props.selectionType === 'range' && validation.parsedValue instanceof Date) {
|
|
85
85
|
finalValue = [validation.parsedValue, validation.parsedValue];
|
|
86
86
|
}
|
|
87
87
|
setControlledValue === null || setControlledValue === void 0 || setControlledValue(finalValue);
|
|
@@ -90,7 +90,7 @@ var _DateInput = function _DateInput(props, ref) {
|
|
|
90
90
|
// Clear controlled value when input is emptied (onChange only, not onBlur)
|
|
91
91
|
setControlledValue === null || setControlledValue === void 0 || setControlledValue(isRange ? [null, null] : null);
|
|
92
92
|
}
|
|
93
|
-
}, [isRange, setControlledValue,
|
|
93
|
+
}, [isRange, setControlledValue, effectiveSelectionType, props.selectionType, format, props.excludeDate, props.minDate, props.maxDate]);
|
|
94
94
|
var handleInputChange = function handleInputChange(_ref) {
|
|
95
95
|
var value = _ref.value;
|
|
96
96
|
var inputValue = value !== null && value !== void 0 ? value : '';
|
|
@@ -133,7 +133,7 @@ var _DateInput = function _DateInput(props, ref) {
|
|
|
133
133
|
ref: ref,
|
|
134
134
|
type: "number",
|
|
135
135
|
value: isRange ? rangeFormattedValue(inputValue[0], inputValue[1]) : inputValue[0],
|
|
136
|
-
leadingIcon: CalendarIcon,
|
|
136
|
+
leadingIcon: shouldShowCalendarIcon ? CalendarIcon : undefined,
|
|
137
137
|
leading: leadingDropdown,
|
|
138
138
|
format: isRange ? getTextInputFormat(finalInputFormat(inputValue[0], inputValue[1], format), true) : getTextInputFormat(format, false),
|
|
139
139
|
validationState: validationError ? 'error' : textInputProps.validationState,
|
|
@@ -197,6 +197,7 @@ var _DatePickerInput = function _DatePickerInput(_ref5, ref) {
|
|
|
197
197
|
excludeDate = _ref5.excludeDate,
|
|
198
198
|
minDate = _ref5.minDate,
|
|
199
199
|
maxDate = _ref5.maxDate,
|
|
200
|
+
effectiveSelectionType = _ref5.effectiveSelectionType,
|
|
200
201
|
props = _objectWithoutProperties(_ref5, _excluded3);
|
|
201
202
|
var _useDatesContext = useDatesContext(),
|
|
202
203
|
locale = _useDatesContext.locale;
|
|
@@ -223,6 +224,7 @@ var _DatePickerInput = function _DatePickerInput(_ref5, ref) {
|
|
|
223
224
|
placeholder: placeholder || format,
|
|
224
225
|
popupId: referenceProps['aria-controls'],
|
|
225
226
|
isPopupExpanded: referenceProps['aria-expanded'],
|
|
227
|
+
hasPopup: referenceProps['aria-haspopup'],
|
|
226
228
|
size: size,
|
|
227
229
|
autoFocus: autoFocus,
|
|
228
230
|
value: [dateValue],
|
|
@@ -240,7 +242,8 @@ var _DatePickerInput = function _DatePickerInput(_ref5, ref) {
|
|
|
240
242
|
selectionType: selectionType,
|
|
241
243
|
excludeDate: excludeDate,
|
|
242
244
|
minDate: minDate,
|
|
243
|
-
maxDate: maxDate
|
|
245
|
+
maxDate: maxDate,
|
|
246
|
+
effectiveSelectionType: effectiveSelectionType
|
|
244
247
|
}, props), referenceProps))]
|
|
245
248
|
});
|
|
246
249
|
}
|
|
@@ -279,6 +282,7 @@ var _DatePickerInput = function _DatePickerInput(_ref5, ref) {
|
|
|
279
282
|
placeholder: rangeInputPlaceHolder(placeholder, format),
|
|
280
283
|
popupId: referenceProps['aria-controls'],
|
|
281
284
|
isPopupExpanded: referenceProps['aria-expanded'],
|
|
285
|
+
hasPopup: referenceProps['aria-haspopup'],
|
|
282
286
|
size: size,
|
|
283
287
|
autoFocus: autoFocus,
|
|
284
288
|
value: [startValue, endValue],
|
|
@@ -296,7 +300,8 @@ var _DatePickerInput = function _DatePickerInput(_ref5, ref) {
|
|
|
296
300
|
selectionType: selectionType,
|
|
297
301
|
excludeDate: excludeDate,
|
|
298
302
|
minDate: minDate,
|
|
299
|
-
maxDate: maxDate
|
|
303
|
+
maxDate: maxDate,
|
|
304
|
+
effectiveSelectionType: effectiveSelectionType
|
|
300
305
|
}, props), referenceProps))]
|
|
301
306
|
});
|
|
302
307
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateInput.web.js","sources":["../../../../../../src/components/DatePicker/DateInput.web.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport { useDatesContext } from '@mantine/dates';\nimport type { DatePickerInputProps, DateInputProps } from './types';\nimport {\n getFormattedDate,\n rangeFormattedValue,\n rangeInputPlaceHolder,\n finalInputFormat,\n getTextInputFormat,\n validateAndParseDateInput,\n stripDelimiters,\n} from './utils';\nimport { usePresetContext } from './QuickSelection/PresetContext';\nimport BaseBox from '~components/Box/BaseBox';\nimport { TextInput } from '~components/Input/TextInput';\nimport { isReactNative } from '~utils';\nimport type { BladeElementRef, DataAnalyticsAttribute } from '~utils/types';\nimport { CalendarIcon } from '~components/Icons';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * CRITICAL BEHAVIOR CASES - Verify when making changes:\n *\n * 1. VALUE PROP: Already formatted by getFormattedDate() - avoid double formatting\n * 2. USER TYPING: Should format input AND sync with calendar selection\n * 3. CALENDAR SELECTION: Should apply formatted value to input without re-formatting\n * 4. SUBMIT (no footer): Blur/Enter should select current value\n */\nconst _DateInput = (\n props: DateInputProps,\n ref: React.ForwardedRef<BladeElementRef>,\n): React.ReactElement => {\n const { format, date, setControlledValue, leadingDropdown, tags, id, ...textInputProps } = props;\n const [inputValue, setInputValue] = React.useState(['']);\n const [validationError, setValidationError] = React.useState<string | undefined>(undefined);\n\n const presetContext = usePresetContext();\n\n // Determine selection type: prefer preset context calculation over props\n // This handles \"Today\" presets that should display as single even though data is range\n const isRange =\n presetContext?.effectiveSelectionType === 'single'\n ? false\n : presetContext?.effectiveSelectionType === 'range' || props.selectionType === 'range';\n\n // Sync internal input state with external formatted values from parent component\n // textInputProps.value comes from DatePickerInput as formatted strings: [\"25/12/2024\", \"31/12/2024\"]\n // We strip delimiters for internal processing: [\"25122024\", \"31122024\"]\n // This prevents double formatting and helps to validate the input easier during user typing\n React.useEffect(() => {\n if (textInputProps.value) {\n setInputValue(\n isRange\n ? [stripDelimiters(textInputProps.value[0]), stripDelimiters(textInputProps.value[1])]\n : [stripDelimiters(textInputProps.value[0])],\n );\n }\n }, [textInputProps.value, isRange, format]);\n\n // Clear validation error only when the actual selected date changes\n // (e.g., user selected a valid date from the calendar). This avoids\n // clearing errors during typing/blur unless the value truly updated.\n React.useEffect(() => {\n setValidationError(undefined);\n }, [date]);\n\n const applyDateValue = React.useCallback(\n (inputValue: string, shouldClearWhenEmpty = false): void => {\n if (inputValue?.trim()) {\n // Validate input and get parsed dates in one atomic operation (includes all constraints)\n const validation = validateAndParseDateInput(inputValue, isRange, format, {\n excludeDate: props.excludeDate,\n minDate: props.minDate,\n maxDate: props.maxDate,\n });\n if (validation.shouldBlock) {\n return; // Block invalid input to prevent data corruption\n }\n\n // Apply the pre-parsed date values to controlled state (no redundant parsing)\n if (validation.parsedValue !== undefined) {\n let finalValue = validation.parsedValue;\n\n // Special handling: if preset context shows single but props expect range\n // (like \"Today\" preset), convert single date back to same-day range\n if (\n presetContext?.effectiveSelectionType === 'single' &&\n props.selectionType === 'range' &&\n validation.parsedValue instanceof Date\n ) {\n finalValue = [validation.parsedValue, validation.parsedValue] as [Date, Date];\n }\n\n setControlledValue?.(finalValue);\n }\n } else if (shouldClearWhenEmpty) {\n // Clear controlled value when input is emptied (onChange only, not onBlur)\n setControlledValue?.(isRange ? ([null, null] as [Date | null, Date | null]) : null);\n }\n },\n [\n isRange,\n setControlledValue,\n presetContext?.effectiveSelectionType,\n props.selectionType,\n format,\n props.excludeDate,\n props.minDate,\n props.maxDate,\n ],\n );\n\n const handleInputChange = ({ value }: { value?: string }): void => {\n const inputValue = value ?? '';\n setValidationError(undefined);\n\n if (inputValue?.trim()) {\n const validation = validateAndParseDateInput(inputValue, isRange, format, {\n excludeDate: props.excludeDate,\n minDate: props.minDate,\n maxDate: props.maxDate,\n });\n\n if (validation.shouldBlock && validation.error) {\n setValidationError(validation.error);\n }\n }\n\n // Apply changes immediately during typing (with empty clearing enabled)\n applyDateValue(inputValue, true);\n };\n\n const handleBlur = React.useCallback(\n (params: { name?: string; value?: string; event?: React.FocusEvent<HTMLInputElement> }) => {\n const currentInputValue = params.event?.target.value ?? params.value ?? '';\n setValidationError(undefined);\n\n if (currentInputValue?.trim()) {\n // Validate complete input and show errors to user on blur (includes all constraints)\n const validation = validateAndParseDateInput(currentInputValue, isRange, format, {\n excludeDate: props.excludeDate,\n minDate: props.minDate,\n maxDate: props.maxDate,\n });\n\n if (validation.shouldBlock && validation.error) {\n setValidationError(validation.error);\n return; // Don't apply invalid values\n }\n }\n\n // Apply final value on blur (without empty clearing to preserve existing dates)\n applyDateValue(currentInputValue, false);\n },\n [applyDateValue, isRange],\n );\n\n return (\n <TextInput\n {...textInputProps}\n ref={ref}\n type=\"number\"\n value={isRange ? rangeFormattedValue(inputValue[0], inputValue[1]) : inputValue[0]}\n leadingIcon={CalendarIcon}\n leading={leadingDropdown}\n format={\n isRange\n ? getTextInputFormat(finalInputFormat(inputValue[0], inputValue[1], format), true)\n : getTextInputFormat(format, false)\n }\n validationState={validationError ? 'error' : textInputProps.validationState}\n errorText={textInputProps.errorText ?? validationError}\n onChange={handleInputChange}\n onBlur={handleBlur}\n onClick={(e) => {\n if (textInputProps.isDisabled) {\n return;\n }\n textInputProps.onClick?.(e);\n }}\n onKeyDown={({ event }) => {\n // @ts-expect-error\n textInputProps.onKeyDown?.(event);\n }}\n />\n );\n};\n\nconst DateInput = React.forwardRef(_DateInput);\n\nconst HiddenInput = ({\n value,\n name,\n isRequired,\n isDisabled,\n ...rest\n}: {\n value: string;\n name?: string;\n isRequired?: boolean;\n isDisabled?: boolean;\n} & DataAnalyticsAttribute): React.ReactElement => {\n if (isReactNative()) return <></>;\n\n return (\n <input\n hidden={true}\n name={name}\n value={value}\n required={isRequired}\n disabled={isDisabled}\n readOnly\n {...makeAnalyticsAttribute(rest)}\n />\n );\n};\n\nconst _DatePickerInput = (\n {\n selectionType,\n referenceProps,\n inputRef,\n date,\n label,\n labelPosition,\n labelSuffix,\n labelTrailing,\n autoFocus,\n name,\n size = 'medium',\n necessityIndicator,\n successText,\n errorText,\n helpText,\n format,\n placeholder,\n setControlledValue,\n leadingDropdown,\n selectedPreset,\n excludeDate,\n minDate,\n maxDate,\n ...props\n }: DatePickerInputProps,\n ref: React.ForwardedRef<any>,\n): React.ReactElement => {\n const { locale } = useDatesContext();\n\n if (selectionType == 'single') {\n const dateValue = getFormattedDate({\n date,\n format,\n labelSeparator: '-',\n locale,\n type: 'default',\n });\n return (\n <BaseBox width=\"100%\">\n <HiddenInput\n value={dateValue}\n name={name}\n isRequired={props.isRequired}\n isDisabled={props.isDisabled}\n />\n <DateInput\n ref={ref as never}\n id=\"start-date\"\n labelPosition={labelPosition}\n label={label}\n placeholder={placeholder || format}\n popupId={referenceProps['aria-controls']}\n isPopupExpanded={referenceProps['aria-expanded']}\n size={size}\n autoFocus={autoFocus}\n value={[dateValue]}\n componentName=\"DatePickerInput\"\n necessityIndicator={necessityIndicator}\n successText={successText}\n errorText={errorText}\n helpText={helpText}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n leadingDropdown={leadingDropdown}\n date={date as Date | null}\n setControlledValue={setControlledValue}\n format={format}\n selectionType={selectionType}\n excludeDate={excludeDate}\n minDate={minDate}\n maxDate={maxDate}\n {...props}\n {...referenceProps}\n />\n </BaseBox>\n );\n }\n\n if (selectionType == 'range') {\n const startValue = getFormattedDate({\n type: 'default',\n date: date[0],\n format,\n labelSeparator: '-',\n locale,\n });\n const endValue = getFormattedDate({\n type: 'default',\n date: date[1],\n format,\n labelSeparator: '-',\n locale,\n });\n\n return (\n <BaseBox width=\"100%\">\n <HiddenInput\n value={`${startValue}`}\n name={name?.start}\n isRequired={props.isRequired}\n isDisabled={props.isDisabled}\n />\n\n <HiddenInput\n value={endValue}\n name={name?.end}\n isRequired={props.isRequired}\n isDisabled={props.isDisabled}\n {...makeAnalyticsAttribute(props)}\n />\n\n <DateInput\n ref={ref as never}\n id=\"range-date\"\n labelPosition={labelPosition}\n label={typeof label === 'object' ? label?.start : label}\n placeholder={rangeInputPlaceHolder(placeholder, format)}\n popupId={referenceProps['aria-controls']}\n isPopupExpanded={referenceProps['aria-expanded']}\n size={size}\n autoFocus={autoFocus}\n value={[startValue, endValue]}\n componentName=\"DatePickerInputRange\"\n necessityIndicator={necessityIndicator}\n successText={\n typeof successText === 'object'\n ? (successText as { start: string })?.start\n : successText\n }\n errorText={\n typeof errorText === 'object' ? (errorText as { start: string })?.start : errorText\n }\n helpText={\n typeof helpText === 'object' ? (helpText as { start: string })?.start : helpText\n }\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n format={format}\n leadingDropdown={leadingDropdown}\n date={date as [Date | null, Date | null]}\n setControlledValue={setControlledValue}\n selectionType={selectionType}\n excludeDate={excludeDate}\n minDate={minDate}\n maxDate={maxDate}\n {...props}\n {...referenceProps}\n />\n </BaseBox>\n );\n }\n\n return <></>;\n};\n\nconst DatePickerInput = React.forwardRef(_DatePickerInput);\nexport { DatePickerInput };\n"],"names":["_DateInput","props","ref","_textInputProps$error","format","date","setControlledValue","leadingDropdown","tags","id","textInputProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","inputValue","setInputValue","_React$useState3","undefined","_React$useState4","validationError","setValidationError","presetContext","usePresetContext","isRange","effectiveSelectionType","selectionType","useEffect","value","stripDelimiters","applyDateValue","useCallback","shouldClearWhenEmpty","arguments","length","trim","validation","validateAndParseDateInput","excludeDate","minDate","maxDate","shouldBlock","parsedValue","finalValue","Date","handleInputChange","_ref","error","handleBlur","params","_ref2","_params$event$target$","_params$event","currentInputValue","event","target","_jsx","TextInput","_objectSpread","type","rangeFormattedValue","leadingIcon","CalendarIcon","leading","getTextInputFormat","finalInputFormat","validationState","errorText","onChange","onBlur","onClick","e","_textInputProps$onCli","isDisabled","call","onKeyDown","_ref3","_textInputProps$onKey","DateInput","forwardRef","HiddenInput","_ref4","name","isRequired","rest","_excluded2","isReactNative","_Fragment","hidden","required","disabled","readOnly","makeAnalyticsAttribute","_DatePickerInput","_ref5","referenceProps","inputRef","label","labelPosition","labelSuffix","labelTrailing","autoFocus","_ref5$size","size","necessityIndicator","successText","helpText","placeholder","selectedPreset","_excluded3","_useDatesContext","useDatesContext","locale","dateValue","getFormattedDate","labelSeparator","_jsxs","BaseBox","width","children","popupId","isPopupExpanded","componentName","startValue","endValue","concat","start","end","_typeof","rangeInputPlaceHolder","DatePickerInput"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA+BA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CACdC,KAAqB,EACrBC,GAAwC,EACjB;AAAA,EAAA,IAAAC,qBAAA,CAAA;AACvB,EAAA,IAAQC,MAAM,GAA6EH,KAAK,CAAxFG,MAAM;IAAEC,IAAI,GAAuEJ,KAAK,CAAhFI,IAAI;IAAEC,kBAAkB,GAAmDL,KAAK,CAA1EK,kBAA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vCuB,QAAAA,aAAa,EAAEA,aAAc;AAC7BY,QAAAA,WAAW,EAAEA,WAAY;AACzBC,QAAAA,OAAO,EAAEA,OAAQ;AACjBC,QAAAA,OAAO,EAAEA,OAAAA;AAAQ,OAAA,EACb1C,KAAK,CAAA,EACLiG,cAAc,CACnB,CAAC,CAAA;AAAA,KACK,CAAC,CAAA;AAEd,GAAA;AAEA,EAAA,oBAAOvC,GAAA,CAAA+B,QAAA,EAAA,EAAI,CAAC,CAAA;AACd,CAAC,CAAA;AAED,IAAM2C,eAAe,gBAAGvH,cAAK,CAACoE,UAAU,CAACc,gBAAgB;;;;"}
|
|
1
|
+
{"version":3,"file":"DateInput.web.js","sources":["../../../../../../src/components/DatePicker/DateInput.web.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/no-autofocus */\n/* eslint-disable @typescript-eslint/no-unnecessary-type-assertion */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport React from 'react';\nimport { useDatesContext } from '@mantine/dates';\nimport type { DatePickerInputProps, DateInputProps } from './types';\nimport {\n getFormattedDate,\n rangeFormattedValue,\n rangeInputPlaceHolder,\n finalInputFormat,\n getTextInputFormat,\n validateAndParseDateInput,\n stripDelimiters,\n} from './utils';\nimport BaseBox from '~components/Box/BaseBox';\nimport { TextInput } from '~components/Input/TextInput';\nimport { isReactNative } from '~utils';\nimport type { BladeElementRef, DataAnalyticsAttribute } from '~utils/types';\nimport { CalendarIcon } from '~components/Icons';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\n/**\n * CRITICAL BEHAVIOR CASES - Verify when making changes:\n *\n * 1. VALUE PROP: Already formatted by getFormattedDate() - avoid double formatting\n * 2. USER TYPING: Should format input AND sync with calendar selection\n * 3. CALENDAR SELECTION: Should apply formatted value to input without re-formatting\n * 4. SUBMIT (no footer): Blur/Enter should select current value\n */\nconst _DateInput = (\n props: DateInputProps,\n ref: React.ForwardedRef<BladeElementRef>,\n): React.ReactElement => {\n const {\n format,\n date,\n setControlledValue,\n effectiveSelectionType,\n leadingDropdown,\n tags,\n id,\n ...textInputProps\n } = props;\n const [inputValue, setInputValue] = React.useState(['']);\n const [validationError, setValidationError] = React.useState<string | undefined>(undefined);\n const shouldShowCalendarIcon = !Boolean(leadingDropdown);\n\n // Determine selection type: prefer preset context calculation over props\n // This handles \"Today\" presets that should display as single even though data is range\n const isRange =\n effectiveSelectionType === 'single'\n ? false\n : effectiveSelectionType === 'range' || props.selectionType === 'range';\n\n // Sync internal input state with external formatted values from parent component\n // textInputProps.value comes from DatePickerInput as formatted strings: [\"25/12/2024\", \"31/12/2024\"]\n // We strip delimiters for internal processing: [\"25122024\", \"31122024\"]\n // This prevents double formatting and helps to validate the input easier during user typing\n React.useEffect(() => {\n if (textInputProps.value) {\n setInputValue(\n isRange\n ? [stripDelimiters(textInputProps.value[0]), stripDelimiters(textInputProps.value[1])]\n : [stripDelimiters(textInputProps.value[0])],\n );\n }\n }, [textInputProps.value, isRange, format]);\n\n // Clear validation error only when the actual selected date changes\n // (e.g., user selected a valid date from the calendar). This avoids\n // clearing errors during typing/blur unless the value truly updated.\n React.useEffect(() => {\n setValidationError(undefined);\n }, [date]);\n\n const applyDateValue = React.useCallback(\n (inputValue: string, shouldClearWhenEmpty = false): void => {\n if (inputValue?.trim()) {\n // Validate input and get parsed dates in one atomic operation (includes all constraints)\n const validation = validateAndParseDateInput(inputValue, isRange, format, {\n excludeDate: props.excludeDate,\n minDate: props.minDate,\n maxDate: props.maxDate,\n });\n if (validation.shouldBlock) {\n return; // Block invalid input to prevent data corruption\n }\n\n // Apply the pre-parsed date values to controlled state (no redundant parsing)\n if (validation.parsedValue !== undefined) {\n let finalValue = validation.parsedValue;\n\n // Special handling: if preset context shows single but props expect range\n // (like \"Today\" preset), convert single date back to same-day range\n if (\n effectiveSelectionType === 'single' &&\n props.selectionType === 'range' &&\n validation.parsedValue instanceof Date\n ) {\n finalValue = [validation.parsedValue, validation.parsedValue] as [Date, Date];\n }\n\n setControlledValue?.(finalValue);\n }\n } else if (shouldClearWhenEmpty) {\n // Clear controlled value when input is emptied (onChange only, not onBlur)\n setControlledValue?.(isRange ? ([null, null] as [Date | null, Date | null]) : null);\n }\n },\n [\n isRange,\n setControlledValue,\n effectiveSelectionType,\n props.selectionType,\n format,\n props.excludeDate,\n props.minDate,\n props.maxDate,\n ],\n );\n\n const handleInputChange = ({ value }: { value?: string }): void => {\n const inputValue = value ?? '';\n setValidationError(undefined);\n\n if (inputValue?.trim()) {\n const validation = validateAndParseDateInput(inputValue, isRange, format, {\n excludeDate: props.excludeDate,\n minDate: props.minDate,\n maxDate: props.maxDate,\n });\n\n if (validation.shouldBlock && validation.error) {\n setValidationError(validation.error);\n }\n }\n\n // Apply changes immediately during typing (with empty clearing enabled)\n applyDateValue(inputValue, true);\n };\n\n const handleBlur = React.useCallback(\n (params: { name?: string; value?: string; event?: React.FocusEvent<HTMLInputElement> }) => {\n const currentInputValue = params.event?.target.value ?? params.value ?? '';\n setValidationError(undefined);\n\n if (currentInputValue?.trim()) {\n // Validate complete input and show errors to user on blur (includes all constraints)\n const validation = validateAndParseDateInput(currentInputValue, isRange, format, {\n excludeDate: props.excludeDate,\n minDate: props.minDate,\n maxDate: props.maxDate,\n });\n\n if (validation.shouldBlock && validation.error) {\n setValidationError(validation.error);\n return; // Don't apply invalid values\n }\n }\n\n // Apply final value on blur (without empty clearing to preserve existing dates)\n applyDateValue(currentInputValue, false);\n },\n [applyDateValue, isRange],\n );\n\n return (\n <TextInput\n {...textInputProps}\n ref={ref}\n type=\"number\"\n value={isRange ? rangeFormattedValue(inputValue[0], inputValue[1]) : inputValue[0]}\n leadingIcon={shouldShowCalendarIcon ? CalendarIcon : undefined}\n leading={leadingDropdown}\n format={\n isRange\n ? getTextInputFormat(finalInputFormat(inputValue[0], inputValue[1], format), true)\n : getTextInputFormat(format, false)\n }\n validationState={validationError ? 'error' : textInputProps.validationState}\n errorText={textInputProps.errorText ?? validationError}\n onChange={handleInputChange}\n onBlur={handleBlur}\n onClick={(e) => {\n if (textInputProps.isDisabled) {\n return;\n }\n textInputProps.onClick?.(e);\n }}\n onKeyDown={({ event }) => {\n // @ts-expect-error\n textInputProps.onKeyDown?.(event);\n }}\n />\n );\n};\n\nconst DateInput = React.forwardRef(_DateInput);\n\nconst HiddenInput = ({\n value,\n name,\n isRequired,\n isDisabled,\n ...rest\n}: {\n value: string;\n name?: string;\n isRequired?: boolean;\n isDisabled?: boolean;\n} & DataAnalyticsAttribute): React.ReactElement => {\n if (isReactNative()) return <></>;\n\n return (\n <input\n hidden={true}\n name={name}\n value={value}\n required={isRequired}\n disabled={isDisabled}\n readOnly\n {...makeAnalyticsAttribute(rest)}\n />\n );\n};\n\nconst _DatePickerInput = (\n {\n selectionType,\n referenceProps,\n inputRef,\n date,\n label,\n labelPosition,\n labelSuffix,\n labelTrailing,\n autoFocus,\n name,\n size = 'medium',\n necessityIndicator,\n successText,\n errorText,\n helpText,\n format,\n placeholder,\n setControlledValue,\n leadingDropdown,\n selectedPreset,\n excludeDate,\n minDate,\n maxDate,\n effectiveSelectionType,\n ...props\n }: DatePickerInputProps,\n ref: React.ForwardedRef<any>,\n): React.ReactElement => {\n const { locale } = useDatesContext();\n\n if (selectionType == 'single') {\n const dateValue = getFormattedDate({\n date,\n format,\n labelSeparator: '-',\n locale,\n type: 'default',\n });\n return (\n <BaseBox width=\"100%\">\n <HiddenInput\n value={dateValue}\n name={name}\n isRequired={props.isRequired}\n isDisabled={props.isDisabled}\n />\n <DateInput\n ref={ref as never}\n id=\"start-date\"\n labelPosition={labelPosition}\n label={label}\n placeholder={placeholder || format}\n popupId={referenceProps['aria-controls']}\n isPopupExpanded={referenceProps['aria-expanded']}\n hasPopup={referenceProps['aria-haspopup']}\n size={size}\n autoFocus={autoFocus}\n value={[dateValue]}\n componentName=\"DatePickerInput\"\n necessityIndicator={necessityIndicator}\n successText={successText}\n errorText={errorText}\n helpText={helpText}\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n leadingDropdown={leadingDropdown}\n date={date as Date | null}\n setControlledValue={setControlledValue}\n format={format}\n selectionType={selectionType}\n excludeDate={excludeDate}\n minDate={minDate}\n maxDate={maxDate}\n effectiveSelectionType={effectiveSelectionType}\n {...props}\n {...referenceProps}\n />\n </BaseBox>\n );\n }\n\n if (selectionType == 'range') {\n const startValue = getFormattedDate({\n type: 'default',\n date: date[0],\n format,\n labelSeparator: '-',\n locale,\n });\n const endValue = getFormattedDate({\n type: 'default',\n date: date[1],\n format,\n labelSeparator: '-',\n locale,\n });\n\n return (\n <BaseBox width=\"100%\">\n <HiddenInput\n value={`${startValue}`}\n name={name?.start}\n isRequired={props.isRequired}\n isDisabled={props.isDisabled}\n />\n\n <HiddenInput\n value={endValue}\n name={name?.end}\n isRequired={props.isRequired}\n isDisabled={props.isDisabled}\n {...makeAnalyticsAttribute(props)}\n />\n\n <DateInput\n ref={ref as never}\n id=\"range-date\"\n labelPosition={labelPosition}\n label={typeof label === 'object' ? label?.start : label}\n placeholder={rangeInputPlaceHolder(placeholder, format)}\n popupId={referenceProps['aria-controls']}\n isPopupExpanded={referenceProps['aria-expanded']}\n hasPopup={referenceProps['aria-haspopup']}\n size={size}\n autoFocus={autoFocus}\n value={[startValue, endValue]}\n componentName=\"DatePickerInputRange\"\n necessityIndicator={necessityIndicator}\n successText={\n typeof successText === 'object'\n ? (successText as { start: string })?.start\n : successText\n }\n errorText={\n typeof errorText === 'object' ? (errorText as { start: string })?.start : errorText\n }\n helpText={\n typeof helpText === 'object' ? (helpText as { start: string })?.start : helpText\n }\n labelSuffix={labelSuffix}\n labelTrailing={labelTrailing}\n format={format}\n leadingDropdown={leadingDropdown}\n date={date as [Date | null, Date | null]}\n setControlledValue={setControlledValue}\n selectionType={selectionType}\n excludeDate={excludeDate}\n minDate={minDate}\n maxDate={maxDate}\n effectiveSelectionType={effectiveSelectionType}\n {...props}\n {...referenceProps}\n />\n </BaseBox>\n );\n }\n\n return <></>;\n};\n\nconst DatePickerInput = React.forwardRef(_DatePickerInput);\nexport { DatePickerInput };\n"],"names":["_DateInput","props","ref","_textInputProps$error","format","date","setControlledValue","effectiveSelectionType","leadingDropdown","tags","id","textInputProps","_objectWithoutProperties","_excluded","_React$useState","React","useState","_React$useState2","_slicedToArray","inputValue","setInputValue","_React$useState3","undefined","_React$useState4","validationError","setValidationError","shouldShowCalendarIcon","Boolean","isRange","selectionType","useEffect","value","stripDelimiters","applyDateValue","useCallback","shouldClearWhenEmpty","arguments","length","trim","validation","validateAndParseDateInput","excludeDate","minDate","maxDate","shouldBlock","parsedValue","finalValue","Date","handleInputChange","_ref","error","handleBlur","params","_ref2","_params$event$target$","_params$event","currentInputValue","event","target","_jsx","TextInput","_objectSpread","type","rangeFormattedValue","leadingIcon","CalendarIcon","leading","getTextInputFormat","finalInputFormat","validationState","errorText","onChange","onBlur","onClick","e","_textInputProps$onCli","isDisabled","call","onKeyDown","_ref3","_textInputProps$onKey","DateInput","forwardRef","HiddenInput","_ref4","name","isRequired","rest","_excluded2","isReactNative","_Fragment","hidden","required","disabled","readOnly","makeAnalyticsAttribute","_DatePickerInput","_ref5","referenceProps","inputRef","label","labelPosition","labelSuffix","labelTrailing","autoFocus","_ref5$size","size","necessityIndicator","successText","helpText","placeholder","selectedPreset","_excluded3","_useDatesContext","useDatesContext","locale","dateValue","getFormattedDate","labelSeparator","_jsxs","BaseBox","width","children","popupId","isPopupExpanded","hasPopup","componentName","startValue","endValue","concat","start","end","_typeof","rangeInputPlaceHolder","DatePickerInput"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CACdC,KAAqB,EACrBC,GAAwC,EACjB;AAAA,EAAA,IAAAC,qBAAA,CAAA;AACvB,EAAA,IACEC,MAAM,GAQJH,KAAK,CARPG,MAAM;IACNC,IAAI,GAOFJ,KAAK,CAPPI,IAAI;IACJC,kBAAkB,GAMhBL,KAAK,CANPK,kBAAkB;IAClBC,sBAAsB,GAKpBN,KAAK,CALPM,s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OAAQ;AACjBpC,QAAAA,sBAAsB,EAAEA,sBAAAA;AAAuB,OAAA,EAC3CN,KAAK,CAAA,EACLiG,cAAc,CACnB,CAAC,CAAA;AAAA,KACK,CAAC,CAAA;AAEd,GAAA;AAEA,EAAA,oBAAOvC,GAAA,CAAA+B,QAAA,EAAA,EAAI,CAAC,CAAA;AACd,CAAC,CAAA;AAED,IAAM4C,eAAe,gBAAGvH,cAAK,CAACmE,UAAU,CAACc,gBAAgB;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var DatePickerContext = /*#__PURE__*/createContext(undefined);
|
|
5
|
+
var DatePickerProvider = function DatePickerProvider(_ref) {
|
|
6
|
+
var children = _ref.children,
|
|
7
|
+
isDatePickerBodyOpen = _ref.isDatePickerBodyOpen;
|
|
8
|
+
var value = {
|
|
9
|
+
isDatePickerBodyOpen: isDatePickerBodyOpen
|
|
10
|
+
};
|
|
11
|
+
return /*#__PURE__*/jsx(DatePickerContext.Provider, {
|
|
12
|
+
value: value,
|
|
13
|
+
children: children
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
var useDatePickerContext = function useDatePickerContext() {
|
|
17
|
+
var context = useContext(DatePickerContext);
|
|
18
|
+
return context;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { DatePickerProvider, useDatePickerContext };
|
|
22
|
+
//# sourceMappingURL=DatePickerContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerContext.js","sources":["../../../../../../src/components/DatePicker/DatePickerContext.tsx"],"sourcesContent":["import React, { createContext, useContext } from 'react';\nimport type { ReactNode } from 'react';\n\ninterface DatePickerContextType {\n isDatePickerBodyOpen: boolean;\n}\n\nconst DatePickerContext = createContext<DatePickerContextType | undefined>(undefined);\n\ninterface DatePickerProviderProps {\n children: ReactNode;\n isDatePickerBodyOpen: boolean;\n}\n\nexport const DatePickerProvider: React.FC<DatePickerProviderProps> = ({\n children,\n isDatePickerBodyOpen,\n}) => {\n const value: DatePickerContextType = {\n isDatePickerBodyOpen,\n };\n\n return <DatePickerContext.Provider value={value}>{children}</DatePickerContext.Provider>;\n};\n\nexport const useDatePickerContext = (): DatePickerContextType | undefined => {\n const context = useContext(DatePickerContext);\n\n return context;\n};\n"],"names":["DatePickerContext","createContext","undefined","DatePickerProvider","_ref","children","isDatePickerBodyOpen","value","_jsx","Provider","useDatePickerContext","context","useContext"],"mappings":";;;AAOA,IAAMA,iBAAiB,gBAAGC,aAAa,CAAoCC,SAAS,CAAC,CAAA;IAOxEC,kBAAqD,GAAG,SAAxDA,kBAAqDA,CAAAC,IAAA,EAG5D;AAAA,EAAA,IAFJC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,oBAAoB,GAAAF,IAAA,CAApBE,oBAAoB,CAAA;AAEpB,EAAA,IAAMC,KAA4B,GAAG;AACnCD,IAAAA,oBAAoB,EAApBA,oBAAAA;GACD,CAAA;AAED,EAAA,oBAAOE,GAAA,CAACR,iBAAiB,CAACS,QAAQ,EAAA;AAACF,IAAAA,KAAK,EAAEA,KAAM;AAAAF,IAAAA,QAAA,EAAEA,QAAAA;AAAQ,GAA6B,CAAC,CAAA;AAC1F,EAAC;IAEYK,oBAAoB,GAAG,SAAvBA,oBAAoBA,GAA4C;AAC3E,EAAA,IAAMC,OAAO,GAAGC,UAAU,CAACZ,iBAAiB,CAAC,CAAA;AAE7C,EAAA,OAAOW,OAAO,CAAA;AAChB;;;;"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
-
import { usePresetContext } from './PresetContext.js';
|
|
3
2
|
import { QuickSelectionItem } from './QuickSelectionItem.web.js';
|
|
4
3
|
import '../../Box/index.js';
|
|
5
4
|
import '../../Box/BaseBox/index.js';
|
|
@@ -22,9 +21,8 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
22
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
22
|
var PresetSideBar = function PresetSideBar(_ref) {
|
|
24
23
|
var onSelection = _ref.onSelection,
|
|
25
|
-
isMobile = _ref.isMobile
|
|
26
|
-
|
|
27
|
-
presetStates = _usePresetContext.presetStates;
|
|
24
|
+
isMobile = _ref.isMobile,
|
|
25
|
+
presetStates = _ref.presetStates;
|
|
28
26
|
if (presetStates.length === 0) return /*#__PURE__*/jsx(Fragment, {});
|
|
29
27
|
if (isMobile) {
|
|
30
28
|
return /*#__PURE__*/jsxs(Box, {
|
package/build/lib/web/development/components/DatePicker/QuickSelection/PresetSideBar.web.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PresetSideBar.web.js","sources":["../../../../../../../src/components/DatePicker/QuickSelection/PresetSideBar.web.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"PresetSideBar.web.js","sources":["../../../../../../../src/components/DatePicker/QuickSelection/PresetSideBar.web.tsx"],"sourcesContent":["import type { PresetSideBarProps } from './types';\nimport { QuickSelectionItem } from './QuickSelectionItem.web';\nimport { Box } from '~components/Box';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Chip, ChipGroup } from '~components/Chip';\nimport { Divider } from '~components/Divider';\nimport { size } from '~tokens/global';\nimport { makeSpace } from '~utils';\nimport { makeAccessible } from '~utils/makeAccessible';\n\nconst PresetSideBar = ({\n onSelection,\n isMobile,\n presetStates,\n}: PresetSideBarProps): React.ReactElement => {\n if (presetStates.length === 0) return <></>;\n\n if (isMobile) {\n return (\n <Box>\n <Divider marginTop=\"spacing.4\" />\n <ChipGroup\n marginTop=\"spacing.7\"\n size=\"small\"\n selectionType=\"single\"\n accessibilityLabel=\"Select Presets\"\n onChange={({ values }) => {\n const selectedPreset = presetStates.find((state) => state.preset.label === values[0]);\n if (selectedPreset) {\n onSelection(selectedPreset.preset.value);\n }\n }}\n >\n {presetStates.map(({ preset }, index) => {\n return (\n <Chip value={preset.label} key={index} data-analytics-name={preset.label}>\n {preset.label}\n </Chip>\n );\n })}\n </ChipGroup>\n </Box>\n );\n }\n\n return (\n <BaseBox\n padding=\"spacing.5\"\n display=\"flex\"\n flexDirection=\"column\"\n gap=\"spacing.2\"\n backgroundColor=\"surface.background.gray.moderate\"\n minWidth={makeSpace(size[160])}\n borderRightColor=\"surface.border.gray.muted\"\n borderRightStyle=\"solid\"\n borderRightWidth=\"thin\"\n {...makeAccessible({ role: 'listbox', label: 'Select Presets' })}\n >\n {presetStates.map(({ preset, isSelected }, index) => {\n return (\n <QuickSelectionItem\n key={index}\n isSelected={isSelected}\n onClick={() => onSelection(preset.value)}\n >\n {preset.label}\n </QuickSelectionItem>\n );\n })}\n </BaseBox>\n );\n};\n\nexport { PresetSideBar };\n"],"names":["PresetSideBar","_ref","onSelection","isMobile","presetStates","length","_jsx","_Fragment","_jsxs","Box","children","Divider","marginTop","ChipGroup","size","selectionType","accessibilityLabel","onChange","_ref2","values","selectedPreset","find","state","preset","label","value","map","_ref3","index","Chip","BaseBox","_objectSpread","padding","display","flexDirection","gap","backgroundColor","minWidth","makeSpace","borderRightColor","borderRightStyle","borderRightWidth","makeAccessible","role","_ref4","isSelected","QuickSelectionItem","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAI2B;AAAA,EAAA,IAH5CC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,QAAQ,GAAAF,IAAA,CAARE,QA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../../ActionList/index.js';
|
|
4
3
|
import '../../Dropdown/index.js';
|
|
5
4
|
import { InputDropdownButton } from '../../Dropdown/InputDropdownButton.web.js';
|
|
5
|
+
import '../../Icons/index.js';
|
|
6
6
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
7
|
import { Dropdown } from '../../Dropdown/Dropdown.js';
|
|
8
|
+
import CalendarIcon from '../../Icons/CalendarIcon/CalendarIcon.js';
|
|
8
9
|
import { DropdownOverlay } from '../../Dropdown/DropdownOverlay.web.js';
|
|
9
10
|
import { ActionList } from '../../ActionList/ActionList.js';
|
|
10
11
|
import { ActionListItem } from '../../ActionList/ActionListItem.js';
|
|
11
12
|
|
|
12
|
-
var
|
|
13
|
+
var renderPresetDropdown = function renderPresetDropdown(_ref) {
|
|
13
14
|
var onSelection = _ref.onSelection,
|
|
14
|
-
onOpenCalendar = _ref.onOpenCalendar
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
selectedPresetLabel = _usePresetContext.selectedPresetLabel;
|
|
15
|
+
onOpenCalendar = _ref.onOpenCalendar,
|
|
16
|
+
presetStates = _ref.presetStates,
|
|
17
|
+
selectedPresetLabel = _ref.selectedPresetLabel;
|
|
18
18
|
return /*#__PURE__*/jsxs(Dropdown, {
|
|
19
19
|
children: [/*#__PURE__*/jsx(InputDropdownButton, {
|
|
20
|
-
value: selectedPresetLabel !== null && selectedPresetLabel !== void 0 ? selectedPresetLabel : 'Custom'
|
|
20
|
+
value: selectedPresetLabel !== null && selectedPresetLabel !== void 0 ? selectedPresetLabel : 'Custom',
|
|
21
|
+
icon: CalendarIcon
|
|
21
22
|
}), /*#__PURE__*/jsx(DropdownOverlay, {
|
|
22
23
|
children: /*#__PURE__*/jsx(ActionList, {
|
|
23
24
|
children: presetStates.map(function (_ref2) {
|
|
@@ -42,5 +43,5 @@ var PresetDropdown = function PresetDropdown(_ref) {
|
|
|
42
43
|
});
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
export {
|
|
46
|
-
//# sourceMappingURL=
|
|
46
|
+
export { renderPresetDropdown };
|
|
47
|
+
//# sourceMappingURL=renderPresetDropdown.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderPresetDropdown.web.js","sources":["../../../../../../../src/components/DatePicker/QuickSelection/renderPresetDropdown.web.tsx"],"sourcesContent":["import React from 'react';\nimport type { renderPresetDropdownProps } from './types';\nimport { ActionList, ActionListItem } from '~components/ActionList';\nimport { Dropdown, DropdownOverlay } from '~components/Dropdown';\nimport { InputDropdownButton } from '~components/Dropdown/InputDropdownButton';\nimport { CalendarIcon } from '~components/Icons';\n\nconst renderPresetDropdown = ({\n onSelection,\n onOpenCalendar,\n presetStates,\n selectedPresetLabel,\n}: renderPresetDropdownProps): React.ReactElement => {\n return (\n <Dropdown>\n <InputDropdownButton value={selectedPresetLabel ?? 'Custom'} icon={CalendarIcon} />\n <DropdownOverlay>\n <ActionList>\n {presetStates.map(({ preset, isSelected, isCustomType }) => (\n <ActionListItem\n key={preset.label}\n title={preset.label}\n value={preset.label}\n isSelected={isSelected}\n onClick={() => {\n onSelection(preset.value);\n // If this is a custom preset selection, also trigger calendar opening\n if (isCustomType && onOpenCalendar) {\n onOpenCalendar();\n }\n }}\n />\n ))}\n </ActionList>\n </DropdownOverlay>\n </Dropdown>\n );\n};\n\nexport { renderPresetDropdown };\n"],"names":["renderPresetDropdown","_ref","onSelection","onOpenCalendar","presetStates","selectedPresetLabel","_jsxs","Dropdown","children","_jsx","InputDropdownButton","value","icon","CalendarIcon","DropdownOverlay","ActionList","map","_ref2","preset","isSelected","isCustomType","ActionListItem","title","label","onClick"],"mappings":";;;;;;;;;;;;AAOA,IAAMA,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAK2B;AAAA,EAAA,IAJnDC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,YAAY,GAAAH,IAAA,CAAZG,YAAY;IACZC,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var
|
|
6
|
-
var
|
|
7
|
-
var children = _ref.children,
|
|
8
|
-
presets = _ref.presets,
|
|
4
|
+
var usePresetState = function usePresetState(_ref) {
|
|
5
|
+
var presets = _ref.presets,
|
|
9
6
|
selectedPreset = _ref.selectedPreset,
|
|
10
7
|
currentDate = _ref.currentDate;
|
|
11
|
-
|
|
8
|
+
return useMemo(function () {
|
|
12
9
|
// No presets provided → return empty state
|
|
13
10
|
if (!presets) {
|
|
14
11
|
return {
|
|
@@ -104,19 +101,7 @@ var PresetProvider = function PresetProvider(_ref) {
|
|
|
104
101
|
effectiveSelectionType: effectiveSelectionType // 'single' | 'range' based on preset analysis
|
|
105
102
|
};
|
|
106
103
|
}, [presets, selectedPreset, currentDate]); // Recalculate when any of these change
|
|
107
|
-
|
|
108
|
-
return /*#__PURE__*/jsx(PresetContext.Provider, {
|
|
109
|
-
value: contextValue,
|
|
110
|
-
children: children
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
var usePresetContext = function usePresetContext() {
|
|
114
|
-
var context = useContext(PresetContext);
|
|
115
|
-
if (!context) {
|
|
116
|
-
throw new Error('usePresetContext must be used within PresetProvider');
|
|
117
|
-
}
|
|
118
|
-
return context;
|
|
119
104
|
};
|
|
120
105
|
|
|
121
|
-
export {
|
|
122
|
-
//# sourceMappingURL=
|
|
106
|
+
export { usePresetState };
|
|
107
|
+
//# sourceMappingURL=usePresetState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePresetState.js","sources":["../../../../../../../src/components/DatePicker/QuickSelection/usePresetState.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { DatesRangeValue } from '../types';\nimport { isSamePreset } from './utils';\nimport type { PresetState, UsePresetStateProps, UsePresetStateReturn } from './types';\n\nexport const usePresetState = ({\n presets,\n selectedPreset,\n currentDate,\n}: UsePresetStateProps): UsePresetStateReturn => {\n return useMemo(() => {\n // No presets provided → return empty state\n if (!presets) {\n return {\n presetStates: [],\n selectedPresetIndex: null,\n selectedPresetLabel: null,\n isCustomSelected: false,\n effectiveSelectionType: null, // Default when no presets\n };\n }\n\n // STEP 1: Calculate each preset's value and type\n // Example: \"Last 7 days\" → [2024-01-01, 2024-01-08], isCustomType: false\n // Example: \"Custom\" → [null, null], isCustomType: true\n const presetStates: PresetState[] = presets.map((preset) => {\n let presetValue: DatesRangeValue | null = null;\n let isCustomType = false;\n\n presetValue = preset.value(currentDate); // Call function: \"Last 7 days\" → [startDate, endDate]\n // Check if preset returns valid dates (defined) or null (custom)\n isCustomType = !(presetValue?.[0] instanceof Date && presetValue?.[1] instanceof Date);\n\n return {\n preset, // Original preset object { label: \"Last 7 days\", value: fn }\n value: presetValue, // Calculated dates [2024-01-01, 2024-01-08] or [null, null]\n isSelected: false, // ⏳ Will calculate this next\n isCustomType, // true = Custom preset, false = Defined preset\n };\n });\n\n // STEP 2: Figure out which preset is currently selected\n // Example: User selected [2024-01-01, 2024-01-08] → matches \"Last 7 days\" preset\n let selectedPresetIndex: number | null = null;\n let isCustomSelected = false;\n\n if (!selectedPreset) {\n // No dates selected → find and select \"Custom\" preset by default\n selectedPresetIndex = presetStates.findIndex((state) => state.isCustomType);\n isCustomSelected = selectedPresetIndex !== -1;\n } else {\n // User has selected dates → see if they match any defined preset\n // Example: selectedPreset = [2024-01-01, 2024-01-08], check if matches \"Last 7 days\"\n selectedPresetIndex = presetStates.findIndex(\n (state) => !state.isCustomType && isSamePreset(selectedPreset, state.value),\n );\n\n if (selectedPresetIndex === -1) {\n // No match found → user made custom selection → select \"Custom\" preset\n selectedPresetIndex = presetStates.findIndex((state) => state.isCustomType);\n isCustomSelected = true;\n }\n }\n\n // STEP 3: Mark the selected preset as selected\n if (selectedPresetIndex !== -1) {\n presetStates[selectedPresetIndex].isSelected = true;\n }\n\n // STEP 4: Get the label for display\n // Example: selectedPresetIndex = 0 → presetStates[0].preset.label = \"Last 7 days\"\n const selectedPresetLabel =\n selectedPresetIndex !== -1 ? presetStates[selectedPresetIndex].preset.label : null;\n\n // STEP 5: Calculate effective selection type based on selected preset\n // If preset returns same-day range (like \"Today\"), display as single date\n let effectiveSelectionType: 'single' | 'range' = 'range'; // Default to range\n\n if (selectedPresetIndex !== -1) {\n const selectedPresetState = presetStates[selectedPresetIndex];\n\n // Check if selected preset represents same day (like \"Today\" preset)\n if (\n selectedPresetState.value?.[0] &&\n selectedPresetState.value?.[1] &&\n selectedPresetState.value[0].toDateString() === selectedPresetState.value[1].toDateString()\n ) {\n effectiveSelectionType = 'single'; // Same day = display as single\n } else {\n effectiveSelectionType = 'range'; // Different days = display as range\n }\n }\n\n // Return final calculated state - this gets shared with all components\n return {\n presetStates, // Array: [{ preset, value, isSelected, isCustomType }, ...]\n selectedPresetIndex, // Number: 0, 1, 2... or null\n selectedPresetLabel, // String: \"Last 7 days\" or \"Custom\" or null\n isCustomSelected, // Boolean: true if custom dates selected\n effectiveSelectionType, // 'single' | 'range' based on preset analysis\n };\n }, [presets, selectedPreset, currentDate]); // Recalculate when any of these change\n};\n"],"names":["usePresetState","_ref","presets","selectedPreset","currentDate","useMemo","presetStates","selectedPresetIndex","selectedPresetLabel","isCustomSelected","effectiveSelectionType","map","preset","_presetValue","_presetValue2","presetValue","isCustomType","value","Date","isSelected","findIndex","state","isSamePreset","label","_selectedPresetState$","_selectedPresetState$2","selectedPresetState","toDateString"],"mappings":";;;IAKaA,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAIsB;AAAA,EAAA,IAH/CC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,WAAW,GAAAH,IAAA,CAAXG,WAAW,CAAA;EAEX,OAAOC,OAAO,CAAC,YAAM;AACnB;IACA,IAAI,CAACH,OAAO,EAAE;MACZ,OAAO;AACLI,QAAAA,YAAY,EAAE,EAAE;AAChBC,QAAAA,mBAAmB,EAAE,IAAI;AACzBC,QAAAA,mBAAmB,EAAE,IAAI;AACzBC,QAAAA,gBAAgB,E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BC,mBAAmB,CAACT,KAAK,CAAC,CAAC,CAAC,CAACU,YAAY,EAAE,KAAKD,mBAAmB,CAACT,KAAK,CAAC,CAAC,CAAC,CAACU,YAAY,EAAE,EAC3F;QACAjB,sBAAsB,GAAG,QAAQ,CAAC;AACpC,OAAC,MAAM;QACLA,sBAAsB,GAAG,OAAO,CAAC;AACnC,OAAA;AACF,KAAA;;AAEA;IACA,OAAO;AACLJ,MAAAA,YAAY,EAAZA,YAAY;AAAE;AACdC,MAAAA,mBAAmB,EAAnBA,mBAAmB;AAAE;AACrBC,MAAAA,mBAAmB,EAAnBA,mBAAmB;AAAE;AACrBC,MAAAA,gBAAgB,EAAhBA,gBAAgB;AAAE;MAClBC,sBAAsB,EAAtBA,sBAAsB;KACvB,CAAA;GACF,EAAE,CAACR,OAAO,EAAEC,cAAc,EAAEC,WAAW,CAAC,CAAC,CAAC;AAC7C;;;;"}
|
|
@@ -291,11 +291,12 @@ var FocusRingWrapper = /*#__PURE__*/styled(BaseBox).withConfig({
|
|
|
291
291
|
})(function (_ref1) {
|
|
292
292
|
var theme = _ref1.theme,
|
|
293
293
|
currentInteraction = _ref1.currentInteraction,
|
|
294
|
-
isTableInputCell = _ref1.isTableInputCell
|
|
294
|
+
isTableInputCell = _ref1.isTableInputCell,
|
|
295
|
+
shouldAddLimitedFocus = _ref1.shouldAddLimitedFocus;
|
|
295
296
|
return {
|
|
296
297
|
borderRadius: makeBorderSize(isTableInputCell ? theme.border.radius.none : theme.border.radius.medium),
|
|
297
298
|
width: '100%',
|
|
298
|
-
'&:focus-within': !isTableInputCell ? _objectSpread(_objectSpread({}, getFocusRingStyles({
|
|
299
|
+
'&:focus-within': !isTableInputCell && (shouldAddLimitedFocus ? currentInteraction === 'focus' : true) ? _objectSpread(_objectSpread({}, getFocusRingStyles({
|
|
299
300
|
theme: theme
|
|
300
301
|
})), {}, {
|
|
301
302
|
transitionDuration: castWebType(makeMotionTime(getIn(theme.motion.duration, baseInputBorderBackgroundMotion[currentInteraction === 'focus' ? 'enter' : 'exit'].duration))),
|
|
@@ -476,6 +477,9 @@ var _BaseInput = function _BaseInput(_ref10, ref) {
|
|
|
476
477
|
}
|
|
477
478
|
}
|
|
478
479
|
var isTextArea = as === 'textarea';
|
|
480
|
+
var hasLeadingDropdown = Boolean(leadingDropDown);
|
|
481
|
+
var hasTrailingDropdown = Boolean(trailingDropDown);
|
|
482
|
+
var shouldAddLimitedFocus = hasLeadingDropdown || hasTrailingDropdown;
|
|
479
483
|
return /*#__PURE__*/jsxs(BaseBox, _objectSpread(_objectSpread(_objectSpread({
|
|
480
484
|
ref: getOuterMotionRef({
|
|
481
485
|
_motionMeta: _motionMeta,
|
|
@@ -513,6 +517,7 @@ var _BaseInput = function _BaseInput(_ref10, ref) {
|
|
|
513
517
|
currentInteraction: currentInteraction,
|
|
514
518
|
isTableInputCell: isTableInputCell,
|
|
515
519
|
className: "focus-ring-wrapper",
|
|
520
|
+
shouldAddLimitedFocus: shouldAddLimitedFocus,
|
|
516
521
|
children: /*#__PURE__*/jsxs(BaseInputWrapper, {
|
|
517
522
|
isDropdownTrigger: isDropdownTrigger,
|
|
518
523
|
isTextArea: isTextArea,
|
|
@@ -575,7 +580,6 @@ var _BaseInput = function _BaseInput(_ref10, ref) {
|
|
|
575
580
|
size: _size,
|
|
576
581
|
numberOfLines: numberOfLines,
|
|
577
582
|
isTextArea: isTextArea,
|
|
578
|
-
hasLeadingDropDown: Boolean(leadingDropDown),
|
|
579
583
|
children: /*#__PURE__*/jsx(StyledBaseInput, _objectSpread(_objectSpread({
|
|
580
584
|
as: as,
|
|
581
585
|
id: inputId,
|