@ssa-ui-kit/core 3.16.1 → 3.16.3
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/dist/components/DatePicker/components/ClearButton.d.ts +9 -0
- package/dist/components/DatePicker/components/DatePickerTimePanel.d.ts +9 -0
- package/dist/components/DatePicker/components/index.d.ts +2 -0
- package/dist/components/DatePicker/constants.d.ts +13 -0
- package/dist/components/DatePicker/hooks/useDatePicker.d.ts +9 -2
- package/dist/components/DatePicker/styles.d.ts +53 -8
- package/dist/components/DatePicker/types.d.ts +64 -3
- package/dist/components/DateRangePicker/components/DatesListWrapper.d.ts +13 -0
- package/dist/components/DateRangePicker/hooks/useDateRangePicker.d.ts +2 -0
- package/dist/components/DateRangePicker/hooks/useRangeSelection.d.ts +1 -0
- package/dist/components/DateRangePicker/styles.d.ts +1 -36
- package/dist/components/DateRangePicker/types.d.ts +19 -0
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Dropdown/types.d.ts +26 -0
- package/dist/components/DropdownToggle/DropdownToggle.d.ts +2 -2
- package/dist/components/DropdownToggle/types.d.ts +1 -0
- package/dist/components/Pagination/PaginationContext.d.ts +11 -1
- package/dist/components/Pagination/components/RowsPerPageDropdown/types.d.ts +1 -0
- package/dist/components/Pagination/hooks/index.d.ts +1 -0
- package/dist/components/Pagination/hooks/useControllableState.d.ts +37 -0
- package/dist/components/Pagination/types.d.ts +38 -0
- package/dist/index.js +805 -374
- package/dist/types/emotion.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -10356,6 +10356,8 @@ const main = {
|
|
|
10356
10356
|
//#eef1f766
|
|
10357
10357
|
greyLighter60: 'rgba(238, 241, 247, 0.6)',
|
|
10358
10358
|
//#eef1f766
|
|
10359
|
+
greyPale16: 'rgba(244, 245, 249, 0.16)',
|
|
10360
|
+
// #f4f5f9 — palette.secondary.light at 16%
|
|
10359
10361
|
greySelectedMenuItem: 'rgba(222, 225, 236, 1)',
|
|
10360
10362
|
// #dee1ec
|
|
10361
10363
|
greyFocused: 'rgba(210, 212, 219, 1)',
|
|
@@ -20590,12 +20592,35 @@ const RadioGroup = ({
|
|
|
20590
20592
|
|
|
20591
20593
|
|
|
20592
20594
|
|
|
20593
|
-
/**
|
|
20595
|
+
/** Border colors per status, mirroring Input's basic/error/success maps */
|
|
20596
|
+
const statusBorderColors = theme => ({
|
|
20597
|
+
basic: {
|
|
20598
|
+
default: theme.colors.grey,
|
|
20599
|
+
hover: theme.colors.greyDarker80,
|
|
20600
|
+
accent: theme.palette.primary.light
|
|
20601
|
+
},
|
|
20602
|
+
error: {
|
|
20603
|
+
default: theme.palette.error.light,
|
|
20604
|
+
hover: theme.palette.error.main,
|
|
20605
|
+
accent: theme.palette.error.dark
|
|
20606
|
+
},
|
|
20607
|
+
success: {
|
|
20608
|
+
default: theme.palette.success.light,
|
|
20609
|
+
hover: theme.palette.success.main,
|
|
20610
|
+
accent: theme.palette.success.dark
|
|
20611
|
+
}
|
|
20612
|
+
});
|
|
20613
|
+
|
|
20614
|
+
/** Single-select dropdown: input-like look (white bg, palette borders, accent when open/focused) */
|
|
20594
20615
|
const singleDropdownStyles = ({
|
|
20595
20616
|
theme,
|
|
20596
20617
|
isOpen,
|
|
20597
|
-
disabled
|
|
20598
|
-
|
|
20618
|
+
disabled,
|
|
20619
|
+
status = 'basic'
|
|
20620
|
+
}) => {
|
|
20621
|
+
const colors = statusBorderColors(theme)[status];
|
|
20622
|
+
return /*#__PURE__*/(0,react_namespaceObject.css)("border:1px solid ", isOpen ? colors.accent : colors.default, ";background:", disabled ? theme.palette.secondary.light : theme.colors.white, ";color:", theme.colors.greyDarker, ";svg path{stroke:", theme.colors.greyDarker80, ";}&:disabled{border-color:", theme.colors.grey, ";color:", theme.colors.grey, ";cursor:default;svg path{stroke:", theme.colors.grey, ";}}&:focus:not(:disabled){border-color:", colors.accent, ";background:", theme.colors.white, ";svg path{stroke:", theme.colors.greyDarker, ";}}&:hover:not(:disabled){border-color:", isOpen ? colors.accent : colors.hover, ";svg path{stroke:", theme.colors.greyDarker, ";}}" + ( true ? "" : 0), true ? "" : 0);
|
|
20623
|
+
};
|
|
20599
20624
|
const multipleStyles = ({
|
|
20600
20625
|
theme,
|
|
20601
20626
|
isOpen
|
|
@@ -20605,15 +20630,17 @@ const multipleStyles = ({
|
|
|
20605
20630
|
};
|
|
20606
20631
|
const DropdownToggleBase = /*#__PURE__*/base_default()("button", true ? {
|
|
20607
20632
|
target: "er3kf7h0"
|
|
20608
|
-
} : 0)("display:flex;flex-flow:row nowrap;align-items:center;justify-content:flex-start;gap:
|
|
20633
|
+
} : 0)("display:flex;flex-flow:row nowrap;align-items:center;justify-content:flex-start;gap:8px;position:relative;width:auto;height:44px;padding:0 14px;font:inherit;font-size:14px;font-weight:500;text-align:left;line-height:18px;cursor:pointer;outline:inherit;border-radius:12px;", ({
|
|
20609
20634
|
isMultiple,
|
|
20610
20635
|
isOpen,
|
|
20611
20636
|
disabled,
|
|
20637
|
+
status,
|
|
20612
20638
|
theme
|
|
20613
20639
|
}) => !isMultiple && singleDropdownStyles({
|
|
20614
20640
|
theme,
|
|
20615
20641
|
isOpen,
|
|
20616
|
-
disabled
|
|
20642
|
+
disabled,
|
|
20643
|
+
status
|
|
20617
20644
|
}), ({
|
|
20618
20645
|
isMultiple,
|
|
20619
20646
|
isOpen,
|
|
@@ -20621,10 +20648,7 @@ const DropdownToggleBase = /*#__PURE__*/base_default()("button", true ? {
|
|
|
20621
20648
|
}) => isMultiple && multipleStyles({
|
|
20622
20649
|
theme,
|
|
20623
20650
|
isOpen
|
|
20624
|
-
}), (
|
|
20625
|
-
isMultiple,
|
|
20626
|
-
theme
|
|
20627
|
-
}) => !isMultiple && /*#__PURE__*/(0,react_namespaceObject.css)("color:", theme.colors.greyDarker, ";svg path{stroke:", theme.colors.greyDarker, ";}" + ( true ? "" : 0), true ? "" : 0), ";" + ( true ? "" : 0));
|
|
20651
|
+
}), ";" + ( true ? "" : 0));
|
|
20628
20652
|
const DropdownToggle = ({
|
|
20629
20653
|
onClick,
|
|
20630
20654
|
onFocus,
|
|
@@ -20636,6 +20660,7 @@ const DropdownToggle = ({
|
|
|
20636
20660
|
ariaLabelledby,
|
|
20637
20661
|
ariaControls,
|
|
20638
20662
|
colors,
|
|
20663
|
+
status,
|
|
20639
20664
|
className,
|
|
20640
20665
|
...restProps
|
|
20641
20666
|
}) => (0,jsx_runtime_namespaceObject.jsx)(DropdownToggleBase, {
|
|
@@ -20646,6 +20671,7 @@ const DropdownToggle = ({
|
|
|
20646
20671
|
type: "button",
|
|
20647
20672
|
isMultiple: isMultiple,
|
|
20648
20673
|
selectedCount: selectedCount,
|
|
20674
|
+
status: status,
|
|
20649
20675
|
onClick: e => {
|
|
20650
20676
|
// Safari doesn't support focus on buttons 🤔
|
|
20651
20677
|
e.currentTarget.focus();
|
|
@@ -20680,7 +20706,7 @@ const DropdownArrow = ({
|
|
|
20680
20706
|
}) => (0,jsx_runtime_namespaceObject.jsx)(DropdownArrowBase, {
|
|
20681
20707
|
children: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
20682
20708
|
name: `carrot-${isUp ? 'up' : 'down'}`,
|
|
20683
|
-
size:
|
|
20709
|
+
size: 16,
|
|
20684
20710
|
"data-testid": `dropdown-arrow-${isUp ? 'up' : 'down'}`,
|
|
20685
20711
|
...restProps
|
|
20686
20712
|
})
|
|
@@ -20712,7 +20738,7 @@ const DropdownOption_multipleStyles = ({
|
|
|
20712
20738
|
};
|
|
20713
20739
|
const DropdownOption = /*#__PURE__*/base_default()("li", true ? {
|
|
20714
20740
|
target: "e784n6w0"
|
|
20715
|
-
} : 0)("overflow:hidden;height:
|
|
20741
|
+
} : 0)("overflow:hidden;height:40px;padding:8px 12px;border:none;background:", ({
|
|
20716
20742
|
isActive,
|
|
20717
20743
|
theme
|
|
20718
20744
|
}) => isActive ? theme.colors.greySelectedMenuItem : 'inherit', ";&:hover{background:", ({
|
|
@@ -20736,7 +20762,7 @@ function DropdownOptions_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tri
|
|
|
20736
20762
|
|
|
20737
20763
|
const DropdownOptionsBase = /*#__PURE__*/base_default()("ul", true ? {
|
|
20738
20764
|
target: "e1qg2z4z0"
|
|
20739
|
-
} : 0)("position:absolute;width:100%;min-width:max-content;list-style:none;padding:
|
|
20765
|
+
} : 0)("position:absolute;width:100%;min-width:max-content;list-style:none;padding:4px;", ({
|
|
20740
20766
|
placement = 'bottom'
|
|
20741
20767
|
}) => placement === 'top' ? 'bottom: 100%; top: auto; margin: 0 0 4px;' : 'top: 100%; bottom: auto; margin: 4px 0 0;', " background:", ({
|
|
20742
20768
|
theme
|
|
@@ -20748,8 +20774,8 @@ const DropdownOptionsBase = /*#__PURE__*/base_default()("ul", true ? {
|
|
|
20748
20774
|
theme
|
|
20749
20775
|
}) => `drop-shadow(-4px 4px 14px ${theme.colors.greyDarker14})`, ";" + ( true ? "" : 0));
|
|
20750
20776
|
const dropdownOptionButton = true ? {
|
|
20751
|
-
name: "
|
|
20752
|
-
styles: "display:flex;align-items:center;gap:8px;cursor:pointer;font:inherit;font-size:0.
|
|
20777
|
+
name: "x6i489",
|
|
20778
|
+
styles: "display:flex;align-items:center;gap:8px;cursor:pointer;font:inherit;font-size:0.875rem;font-weight:500;outline:inherit;text-align:left;width:100%;padding:0;margin:0;background:none;color:inherit;border:none"
|
|
20753
20779
|
} : 0;
|
|
20754
20780
|
const avatarWrapper = true ? {
|
|
20755
20781
|
name: "1z0rm8f",
|
|
@@ -21084,6 +21110,15 @@ function Dropdown_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to s
|
|
|
21084
21110
|
|
|
21085
21111
|
|
|
21086
21112
|
|
|
21113
|
+
|
|
21114
|
+
|
|
21115
|
+
|
|
21116
|
+
const DropdownFieldWrapper = /*#__PURE__*/base_default()("div", true ? {
|
|
21117
|
+
target: "eizhqtp2"
|
|
21118
|
+
} : 0)( true ? {
|
|
21119
|
+
name: "1bj7yge",
|
|
21120
|
+
styles: "display:inline-flex;flex-direction:column;align-items:flex-start"
|
|
21121
|
+
} : 0);
|
|
21087
21122
|
const DropdownBase = /*#__PURE__*/base_default()("div", true ? {
|
|
21088
21123
|
target: "eizhqtp1"
|
|
21089
21124
|
} : 0)( true ? {
|
|
@@ -21201,8 +21236,14 @@ const Dropdown = ({
|
|
|
21201
21236
|
placeholder = 'Select something',
|
|
21202
21237
|
maxHeight = 200,
|
|
21203
21238
|
avatarBorder = false,
|
|
21239
|
+
label,
|
|
21240
|
+
helperText,
|
|
21241
|
+
errors,
|
|
21242
|
+
success,
|
|
21243
|
+
icon,
|
|
21204
21244
|
dropdownProps: componentProps
|
|
21205
21245
|
}) => {
|
|
21246
|
+
const status = success ? 'success' : errors ? 'error' : 'basic';
|
|
21206
21247
|
const {
|
|
21207
21248
|
dropdownPosition = DropdownPositions.auto
|
|
21208
21249
|
} = componentProps ?? {};
|
|
@@ -21284,38 +21325,54 @@ const Dropdown = ({
|
|
|
21284
21325
|
image: rawAvatar,
|
|
21285
21326
|
border: avatarBorder
|
|
21286
21327
|
}) : /*#__PURE__*/external_react_default().isValidElement(rawAvatar) ? rawAvatar : null : null;
|
|
21287
|
-
const
|
|
21288
|
-
|
|
21328
|
+
const leadingElement = !(0,utils_namespaceObject.isNill)(selectedAvatar) ? selectedAvatar : icon ? (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
21329
|
+
name: icon,
|
|
21330
|
+
size: 16,
|
|
21331
|
+
color: isDisabled ? theme.colors.grey : theme.colors.greyDarker80
|
|
21332
|
+
}) : null;
|
|
21333
|
+
const toggleContent = !(0,utils_namespaceObject.isNill)(leadingElement) ? (0,jsx_runtime_namespaceObject.jsxs)(SelectedContent, {
|
|
21334
|
+
children: [leadingElement, (0,jsx_runtime_namespaceObject.jsx)("span", {
|
|
21289
21335
|
style: {
|
|
21290
21336
|
minWidth: 0
|
|
21291
21337
|
},
|
|
21292
21338
|
children: value
|
|
21293
21339
|
})]
|
|
21294
21340
|
}) : value;
|
|
21295
|
-
return (0,jsx_runtime_namespaceObject.
|
|
21296
|
-
|
|
21297
|
-
|
|
21298
|
-
|
|
21299
|
-
|
|
21300
|
-
|
|
21301
|
-
children:
|
|
21302
|
-
...componentProps?.
|
|
21303
|
-
|
|
21304
|
-
|
|
21305
|
-
|
|
21306
|
-
|
|
21307
|
-
|
|
21308
|
-
|
|
21309
|
-
|
|
21310
|
-
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
|
|
21314
|
-
|
|
21315
|
-
|
|
21316
|
-
|
|
21317
|
-
|
|
21318
|
-
|
|
21341
|
+
return (0,jsx_runtime_namespaceObject.jsxs)(DropdownFieldWrapper, {
|
|
21342
|
+
children: [label ? (0,jsx_runtime_namespaceObject.jsx)(Label_Label, {
|
|
21343
|
+
isDisabled: isDisabled,
|
|
21344
|
+
children: label
|
|
21345
|
+
}) : null, (0,jsx_runtime_namespaceObject.jsx)(Dropdown_context.Provider, {
|
|
21346
|
+
value: contextValue,
|
|
21347
|
+
children: (0,jsx_runtime_namespaceObject.jsxs)(DropdownBase, {
|
|
21348
|
+
...componentProps?.base,
|
|
21349
|
+
ref: dropdownRef,
|
|
21350
|
+
"data-testid": "dropdown",
|
|
21351
|
+
children: [(0,jsx_runtime_namespaceObject.jsxs)(DropdownToggle_DropdownToggle, {
|
|
21352
|
+
...componentProps?.toggleButton,
|
|
21353
|
+
className: className,
|
|
21354
|
+
isOpen: isOpen,
|
|
21355
|
+
disabled: isDisabled,
|
|
21356
|
+
status: status,
|
|
21357
|
+
onClick: setIsOpen.bind(null, !isOpen),
|
|
21358
|
+
onFocus: setIsFocused.bind(null, true),
|
|
21359
|
+
colors: colors,
|
|
21360
|
+
ariaLabelledby: `dropdown-label-${dropdownId}`,
|
|
21361
|
+
ariaControls: `dropdown-popup-${dropdownId}`,
|
|
21362
|
+
children: [toggleContent, (0,jsx_runtime_namespaceObject.jsx)(DropdownArrow_DropdownArrow, {
|
|
21363
|
+
...componentProps?.toggleButtonArrow,
|
|
21364
|
+
isUp: isOpen
|
|
21365
|
+
})]
|
|
21366
|
+
}), isOpen ? (0,jsx_runtime_namespaceObject.jsx)(DropdownOptions_DropdownOptions, {
|
|
21367
|
+
children: items
|
|
21368
|
+
}) : null]
|
|
21369
|
+
})
|
|
21370
|
+
}), helperText || errors ? (0,jsx_runtime_namespaceObject.jsx)(FormHelperText_FormHelperText, {
|
|
21371
|
+
role: "status",
|
|
21372
|
+
status: status,
|
|
21373
|
+
disabled: isDisabled,
|
|
21374
|
+
children: errors?.message || helperText
|
|
21375
|
+
}) : null]
|
|
21319
21376
|
});
|
|
21320
21377
|
};
|
|
21321
21378
|
/* harmony default export */ const Dropdown_Dropdown = (Dropdown);
|
|
@@ -23384,15 +23441,99 @@ const highlightInputMatch = (item, keyword) => {
|
|
|
23384
23441
|
const external_luxon_namespaceObject = require("luxon");
|
|
23385
23442
|
;// ./src/components/DatePicker/styles.ts
|
|
23386
23443
|
|
|
23444
|
+
function DatePicker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
23445
|
+
|
|
23446
|
+
|
|
23447
|
+
/*
|
|
23448
|
+
* Calendar cell styles shared by **DatePicker** and **DateRangePicker**.
|
|
23449
|
+
*
|
|
23450
|
+
* `DateRangePicker/styles.ts` re-exports the three cell components from here
|
|
23451
|
+
* rather than redeclaring them, so a token or geometry fix only has to be made
|
|
23452
|
+
* once. Both pickers drive the "selected" look through the same
|
|
23453
|
+
* `isCalendarDateSelected` prop — the single-date pickers pass their
|
|
23454
|
+
* `isCalendarYear` / `isCalendarMonth` flag into it.
|
|
23455
|
+
*/
|
|
23456
|
+
|
|
23457
|
+
/**
|
|
23458
|
+
* Which edge of a highlighted range a cell sits on. Drives the cell's corner
|
|
23459
|
+
* rounding so start/end cells form a single connected pill with the range
|
|
23460
|
+
* cells between them, matching the Figma `Range Selected Start/End` variants.
|
|
23461
|
+
*
|
|
23462
|
+
* - **`start`** — rounded on the left only
|
|
23463
|
+
* - **`end`** — rounded on the right only
|
|
23464
|
+
* - **`both`** — a standalone selection (or a one-cell range), fully rounded
|
|
23465
|
+
*/
|
|
23466
|
+
|
|
23467
|
+
const getCellRadius = (rangeEdge, isHighlighted) => {
|
|
23468
|
+
if (rangeEdge === 'start') return '6px 0 0 6px';
|
|
23469
|
+
if (rangeEdge === 'end') return '0 6px 6px 0';
|
|
23470
|
+
if (rangeEdge === 'both') return '6px';
|
|
23471
|
+
return isHighlighted ? '0' : '6px';
|
|
23472
|
+
};
|
|
23387
23473
|
|
|
23474
|
+
/**
|
|
23475
|
+
* Works out which edge of a highlighted range a selected cell sits on.
|
|
23476
|
+
*
|
|
23477
|
+
* A range only has distinct edges when both anchors exist, so without an
|
|
23478
|
+
* active range (or when both anchors land on the same cell) the cell is
|
|
23479
|
+
* fully rounded. `mode` says which anchor *this* picker holds, which is what
|
|
23480
|
+
* decides whether its own value rounds on the left or the right.
|
|
23481
|
+
*/
|
|
23482
|
+
const getRangeEdge = ({
|
|
23483
|
+
isFirstSelected,
|
|
23484
|
+
isSecondSelected,
|
|
23485
|
+
isRangeActive,
|
|
23486
|
+
mode
|
|
23487
|
+
}) => {
|
|
23488
|
+
if (!isFirstSelected && !isSecondSelected) return undefined;
|
|
23489
|
+
if (!isRangeActive || isFirstSelected && isSecondSelected) return 'both';
|
|
23490
|
+
const isStart = mode === 'dateFrom' ? isFirstSelected : isSecondSelected;
|
|
23491
|
+
return isStart ? 'start' : 'end';
|
|
23492
|
+
};
|
|
23493
|
+
|
|
23494
|
+
/**
|
|
23495
|
+
* Time panel shown beside the calendar. Figma lays the hours and minutes out
|
|
23496
|
+
* as rows of two 56×40 cells with an 8px gap; two scrolling columns in one
|
|
23497
|
+
* scroll container produce the same result while keeping the lists independent.
|
|
23498
|
+
*/
|
|
23499
|
+
const TimePanel = /*#__PURE__*/base_default()("div", true ? {
|
|
23500
|
+
target: "e19kqgld5"
|
|
23501
|
+
} : 0)( true ? {
|
|
23502
|
+
name: "1xp7lsd",
|
|
23503
|
+
styles: "display:flex;gap:8px;align-self:stretch;padding:24px 24px 0 0;height:100%;overflow:hidden"
|
|
23504
|
+
} : 0);
|
|
23505
|
+
|
|
23506
|
+
/**
|
|
23507
|
+
* Each column scrolls on its own so the hours list can be moved without
|
|
23508
|
+
* dragging the minutes along with it.
|
|
23509
|
+
*/
|
|
23510
|
+
const TimeColumn = /*#__PURE__*/base_default()("div", true ? {
|
|
23511
|
+
target: "e19kqgld4"
|
|
23512
|
+
} : 0)( true ? {
|
|
23513
|
+
name: "1m7q518",
|
|
23514
|
+
styles: "display:flex;flex-direction:column;flex-shrink:0;height:100%;overflow-y:auto;scrollbar-width:none;&::-webkit-scrollbar{display:none;}"
|
|
23515
|
+
} : 0);
|
|
23516
|
+
const TimeCell = /*#__PURE__*/base_default()("div", true ? {
|
|
23517
|
+
target: "e19kqgld3"
|
|
23518
|
+
} : 0)("display:flex;align-items:center;justify-content:center;flex-shrink:0;width:56px;height:40px;border-radius:6px;font-size:14px;font-weight:500;line-height:18px;cursor:pointer;user-select:none;color:", ({
|
|
23519
|
+
theme,
|
|
23520
|
+
isSelected
|
|
23521
|
+
}) => isSelected ? theme.colors.white : theme.colors.greyDarker, ";background:", ({
|
|
23522
|
+
theme,
|
|
23523
|
+
isSelected
|
|
23524
|
+
}) => isSelected ? theme.palette.primary.main : 'none', ";&:hover{background:", ({
|
|
23525
|
+
theme,
|
|
23526
|
+
isSelected
|
|
23527
|
+
}) => isSelected ? theme.palette.primary.main : theme.palette.secondary.light, ";}" + ( true ? "" : 0));
|
|
23388
23528
|
const DaysViewCell = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
|
|
23389
23529
|
target: "e19kqgld2"
|
|
23390
|
-
} : 0)("position:relative;width:40px;height:40px;justify-content:center;font-size:14px;font-weight:500;border-radius:", ({
|
|
23530
|
+
} : 0)("position:relative;width:40px;height:40px;justify-content:center;font-size:14px;font-weight:500;line-height:18px;border-radius:", ({
|
|
23531
|
+
rangeEdge,
|
|
23391
23532
|
isHighlighted
|
|
23392
|
-
}) => isHighlighted
|
|
23533
|
+
}) => getCellRadius(rangeEdge, isHighlighted), ";border:", ({
|
|
23393
23534
|
theme,
|
|
23394
23535
|
isCalendarDateNow
|
|
23395
|
-
}) => isCalendarDateNow ? `1px solid ${theme.colors.
|
|
23536
|
+
}) => isCalendarDateNow ? `1px solid ${theme.colors.grey}` : 'none', ";color:", ({
|
|
23396
23537
|
theme,
|
|
23397
23538
|
isCalendarDateSelected
|
|
23398
23539
|
}) => isCalendarDateSelected ? theme.colors.white : theme.colors.greyDarker, ";background:", ({
|
|
@@ -23404,90 +23545,58 @@ const DaysViewCell = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
|
|
|
23404
23545
|
theme,
|
|
23405
23546
|
isCalendarDateSelected,
|
|
23406
23547
|
isHighlighted
|
|
23407
|
-
}) => isHighlighted && !isCalendarDateSelected && theme.
|
|
23408
|
-
theme
|
|
23409
|
-
}) => theme.colors.greyLighter, ";color:", ({
|
|
23548
|
+
}) => isHighlighted && !isCalendarDateSelected && theme.colors.blueLighter20, ";&:hover{background:", ({
|
|
23410
23549
|
theme
|
|
23411
|
-
}) => theme.
|
|
23412
|
-
isCalendarFirstDateSelected,
|
|
23413
|
-
isCalendarSecondDateSelected
|
|
23414
|
-
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
|
|
23415
|
-
isCalendarFirstDateSelected
|
|
23416
|
-
}) => isCalendarFirstDateSelected ? '0' : 'auto', ";right:", ({
|
|
23417
|
-
isCalendarSecondDateSelected
|
|
23418
|
-
}) => isCalendarSecondDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
|
|
23550
|
+
}) => theme.palette.secondary.light, ";color:", ({
|
|
23419
23551
|
theme
|
|
23420
|
-
}) => theme.
|
|
23552
|
+
}) => theme.colors.greyDarker, ";}}&:hover{border:", ({
|
|
23421
23553
|
theme,
|
|
23422
23554
|
isCalendarDateNow
|
|
23423
|
-
}) => isCalendarDateNow && `1px solid ${theme.colors.
|
|
23555
|
+
}) => isCalendarDateNow && `1px solid ${theme.colors.grey}`, ";}" + ( true ? "" : 0));
|
|
23424
23556
|
const YearsViewCell = /*#__PURE__*/base_default()("div", true ? {
|
|
23425
23557
|
target: "e19kqgld1"
|
|
23426
23558
|
} : 0)("display:flex;justify-content:center;position:relative;align-items:center;width:70px;height:40px;border-radius:", ({
|
|
23427
|
-
|
|
23428
|
-
|
|
23429
|
-
}) =>
|
|
23430
|
-
theme,
|
|
23431
|
-
isCalendarYear,
|
|
23432
|
-
isCalendarSecondDateSelected
|
|
23433
|
-
}) => (isCalendarYear || isCalendarSecondDateSelected) && theme.colors.white, ";background:", ({
|
|
23559
|
+
rangeEdge,
|
|
23560
|
+
isHighlighted
|
|
23561
|
+
}) => getCellRadius(rangeEdge, isHighlighted), ";font-size:14px;font-weight:500;line-height:18px;user-select:none;cursor:pointer;color:", ({
|
|
23434
23562
|
theme,
|
|
23435
|
-
|
|
23436
|
-
|
|
23437
|
-
}) => isCalendarYear || isCalendarSecondDateSelected ? theme.palette.primary.main : 'none', ";background:", ({
|
|
23563
|
+
isCalendarDateSelected
|
|
23564
|
+
}) => isCalendarDateSelected ? theme.colors.white : theme.colors.greyDarker, ";background:", ({
|
|
23438
23565
|
theme,
|
|
23439
|
-
|
|
23440
|
-
|
|
23441
|
-
}) =>
|
|
23442
|
-
theme
|
|
23443
|
-
|
|
23566
|
+
isCalendarDateSelected,
|
|
23567
|
+
isHighlighted
|
|
23568
|
+
}) => {
|
|
23569
|
+
if (isCalendarDateSelected) return theme.palette.primary.main;
|
|
23570
|
+
return isHighlighted ? theme.colors.blueLighter20 : 'none';
|
|
23571
|
+
}, ";&:hover{background:", ({
|
|
23444
23572
|
theme
|
|
23445
|
-
}) => theme.
|
|
23446
|
-
isCalendarFirstDateSelected,
|
|
23447
|
-
isCalendarSecondDateSelected
|
|
23448
|
-
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
|
|
23449
|
-
isCalendarSecondDateSelected
|
|
23450
|
-
}) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
|
|
23451
|
-
isCalendarFirstDateSelected
|
|
23452
|
-
}) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
|
|
23573
|
+
}) => theme.palette.secondary.light, ";color:", ({
|
|
23453
23574
|
theme
|
|
23454
|
-
}) => theme.
|
|
23575
|
+
}) => theme.colors.greyDarker, ";border-radius:6px;}" + ( true ? "" : 0));
|
|
23455
23576
|
const MonthsViewCell = /*#__PURE__*/base_default()("div", true ? {
|
|
23456
23577
|
target: "e19kqgld0"
|
|
23457
|
-
} : 0)("display:flex;justify-content:center;position:relative;align-items:center;width:
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
}) =>
|
|
23578
|
+
} : 0)("display:flex;justify-content:center;position:relative;align-items:center;width:93.33px;height:40px;border-radius:", ({
|
|
23579
|
+
rangeEdge,
|
|
23580
|
+
isHighlighted
|
|
23581
|
+
}) => getCellRadius(rangeEdge, isHighlighted), ";font-size:14px;font-weight:500;line-height:18px;cursor:pointer;color:", ({
|
|
23461
23582
|
theme,
|
|
23462
|
-
|
|
23463
|
-
|
|
23464
|
-
}) => (isCalendarMonth || isCalendarSecondDateSelected) && theme.colors.white, ";user-select:none;background:", ({
|
|
23583
|
+
isCalendarDateSelected
|
|
23584
|
+
}) => isCalendarDateSelected ? theme.colors.white : theme.colors.greyDarker, ";user-select:none;background:", ({
|
|
23465
23585
|
theme,
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
}) => isCalendarMonth || isCalendarSecondDateSelected ? theme.palette.primary.main : 'none', ";&[aria-disabled='true']{cursor:default;pointer-events:none;color:", ({
|
|
23586
|
+
isCalendarDateSelected
|
|
23587
|
+
}) => isCalendarDateSelected ? theme.palette.primary.main : 'none', ";&[aria-disabled='true']{cursor:default;pointer-events:none;color:", ({
|
|
23469
23588
|
theme
|
|
23470
23589
|
}) => theme.colors.greyDarker, ";background:", ({
|
|
23471
23590
|
theme
|
|
23472
23591
|
}) => theme.colors.grey, ";}&[aria-disabled='false']{background:", ({
|
|
23473
23592
|
theme,
|
|
23474
23593
|
isHighlighted,
|
|
23475
|
-
|
|
23476
|
-
|
|
23477
|
-
}) => isHighlighted && !isCalendarMonth && !isCalendarSecondDateSelected && theme.palette.primary.main.replace('rgb(', 'rgba(').replace(')', ', 0.2)'), ";&:hover{background:", ({
|
|
23478
|
-
theme
|
|
23479
|
-
}) => theme.colors.greyLighter, ";color:", ({
|
|
23594
|
+
isCalendarDateSelected
|
|
23595
|
+
}) => isHighlighted && !isCalendarDateSelected && theme.colors.blueLighter20, ";&:hover{background:", ({
|
|
23480
23596
|
theme
|
|
23481
|
-
}) => theme.
|
|
23482
|
-
isCalendarFirstDateSelected,
|
|
23483
|
-
isCalendarSecondDateSelected
|
|
23484
|
-
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
|
|
23485
|
-
isCalendarSecondDateSelected
|
|
23486
|
-
}) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
|
|
23487
|
-
isCalendarFirstDateSelected
|
|
23488
|
-
}) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
|
|
23597
|
+
}) => theme.palette.secondary.light, ";color:", ({
|
|
23489
23598
|
theme
|
|
23490
|
-
}) => theme.
|
|
23599
|
+
}) => theme.colors.greyDarker, ";}}" + ( true ? "" : 0));
|
|
23491
23600
|
;// ./src/components/DatePicker/utils/dates.ts
|
|
23492
23601
|
|
|
23493
23602
|
const getDaysForCalendarMonth = date => {
|
|
@@ -23588,6 +23697,20 @@ const INVALID_DATE = 'Invalid date';
|
|
|
23588
23697
|
const FULL_DATE_LENGTH = 10;
|
|
23589
23698
|
const FULL_MONTH_DATE_LENGTH = 7;
|
|
23590
23699
|
const FULL_YEAR_DATE_LENGTH = 4;
|
|
23700
|
+
|
|
23701
|
+
/**
|
|
23702
|
+
* Time support is layered on top of a date format rather than being a separate
|
|
23703
|
+
* set of formats, so `showTimePicker` works with any picker type without
|
|
23704
|
+
* widening the shared `DateFormat` union (which `JsonSchemaForm` validates
|
|
23705
|
+
* against).
|
|
23706
|
+
*/
|
|
23707
|
+
const TIME_MASK_FORMAT_SUFFIX = ' HH:mm';
|
|
23708
|
+
const TIME_MASK_SUFFIX = ' __:__';
|
|
23709
|
+
const TIME_LENGTH = 6;
|
|
23710
|
+
const HOURS_IN_DAY = 24;
|
|
23711
|
+
const MINUTES_IN_HOUR = 60;
|
|
23712
|
+
/** 15-minute steps by default; pass `minuteStep={1}` for the Figma-literal list. */
|
|
23713
|
+
const DEFAULT_MINUTE_STEP = 15;
|
|
23591
23714
|
const PICKER_TYPE = {
|
|
23592
23715
|
DAYS: 'days',
|
|
23593
23716
|
MONTHS: 'months',
|
|
@@ -23626,13 +23749,16 @@ const useDatePickerMask = ({
|
|
|
23626
23749
|
selectionEnd,
|
|
23627
23750
|
value: currentValue
|
|
23628
23751
|
}) => {
|
|
23629
|
-
|
|
23752
|
+
// `showTimePicker` appends a ` __:__` suffix onto the date mask, so
|
|
23753
|
+
// strip it before comparing against the bare date masks below.
|
|
23754
|
+
const dateMask = mask.split(' ')[0];
|
|
23755
|
+
if (dateMask === DEFAULT_MASK || dateMask === DEFAULT_MONTH_MASK || dateMask === DEFAULT_YEAR_MASK) {
|
|
23630
23756
|
const newValue = currentValue.slice(0, selectionStart) + data + currentValue.slice(selectionEnd);
|
|
23631
23757
|
const updatedValue = (0,mask_namespaceObject.format)(newValue, {
|
|
23632
23758
|
mask,
|
|
23633
23759
|
replacement
|
|
23634
23760
|
});
|
|
23635
|
-
const splittedValue = updatedValue.split('/');
|
|
23761
|
+
const splittedValue = updatedValue.split(' ')[0].split('/');
|
|
23636
23762
|
const isChecked = processDate({
|
|
23637
23763
|
day: formatIndexes['day'] !== -1 ? splittedValue[formatIndexes['day']] : '',
|
|
23638
23764
|
month: formatIndexes['month'] !== -1 ? splittedValue[formatIndexes['month']] : '',
|
|
@@ -23696,7 +23822,8 @@ const useDatePicker = ({
|
|
|
23696
23822
|
onClose,
|
|
23697
23823
|
onError,
|
|
23698
23824
|
onChange,
|
|
23699
|
-
value: externalValue
|
|
23825
|
+
value: externalValue,
|
|
23826
|
+
showTimePicker = false
|
|
23700
23827
|
}) => {
|
|
23701
23828
|
const {
|
|
23702
23829
|
clearErrors,
|
|
@@ -23706,9 +23833,31 @@ const useDatePicker = ({
|
|
|
23706
23833
|
const inputValue = (0,external_react_hook_form_namespaceObject.useWatch)({
|
|
23707
23834
|
name
|
|
23708
23835
|
});
|
|
23709
|
-
const config = (0,external_react_namespaceObject.useMemo)(() =>
|
|
23710
|
-
|
|
23711
|
-
|
|
23836
|
+
const config = (0,external_react_namespaceObject.useMemo)(() => {
|
|
23837
|
+
const base = CONFIG[pickerType] || CONFIG[PICKER_TYPE.DAYS];
|
|
23838
|
+
if (!showTimePicker) return base;
|
|
23839
|
+
|
|
23840
|
+
// Time is layered onto the picker's own config rather than being a fourth
|
|
23841
|
+
// picker type, so `HH:mm` composes with days, months, or years. The unit
|
|
23842
|
+
// moves to 'minute' so emitted values stop being floored to midnight.
|
|
23843
|
+
return {
|
|
23844
|
+
...base,
|
|
23845
|
+
mask: `${base.mask}${TIME_MASK_SUFFIX}`,
|
|
23846
|
+
length: base.length + TIME_LENGTH,
|
|
23847
|
+
unit: 'minute'
|
|
23848
|
+
};
|
|
23849
|
+
}, [pickerType, showTimePicker]);
|
|
23850
|
+
|
|
23851
|
+
// The date half of the format, kept separate because `formatIndexes` and the
|
|
23852
|
+
// min/max parsing below both split on '/' and would choke on a time suffix.
|
|
23853
|
+
const dateFormat = propFormat || config.format;
|
|
23854
|
+
const format = showTimePicker ? `${dateFormat}${TIME_MASK_FORMAT_SUFFIX}` : dateFormat;
|
|
23855
|
+
const luxonFormat = (0,external_react_namespaceObject.useMemo)(() => {
|
|
23856
|
+
// Only the date half may be uppercased — `mm` in `HH:mm` is minutes, and
|
|
23857
|
+
// a blanket /mm/gi replace would turn it into a month token.
|
|
23858
|
+
const luxonDate = dateFormat.replace(/mm/gi, 'MM');
|
|
23859
|
+
return showTimePicker ? `${luxonDate}${TIME_MASK_FORMAT_SUFFIX}` : luxonDate;
|
|
23860
|
+
}, [dateFormat, showTimePicker]);
|
|
23712
23861
|
const [isLoading, setLoading] = (0,external_react_namespaceObject.useState)(true);
|
|
23713
23862
|
const [dateTime, setDateTime] = (0,external_react_namespaceObject.useState)();
|
|
23714
23863
|
const [lastChangedDate, setLastChangedDate] = (0,external_react_namespaceObject.useState)();
|
|
@@ -23724,7 +23873,7 @@ const useDatePicker = ({
|
|
|
23724
23873
|
});
|
|
23725
23874
|
const wasOpenRef = (0,external_react_namespaceObject.useRef)(undefined);
|
|
23726
23875
|
const formatIndexes = (0,external_react_namespaceObject.useMemo)(() => {
|
|
23727
|
-
const parts =
|
|
23876
|
+
const parts = dateFormat.split('/').map(p => p.trim().toLowerCase()).filter(Boolean);
|
|
23728
23877
|
const year = parts.findIndex(p => p === 'yyyy');
|
|
23729
23878
|
if (year === -1) throw new Error('DatePicker format must contain year');
|
|
23730
23879
|
return {
|
|
@@ -23732,7 +23881,7 @@ const useDatePicker = ({
|
|
|
23732
23881
|
month: parts.findIndex(p => p === 'mm'),
|
|
23733
23882
|
year
|
|
23734
23883
|
};
|
|
23735
|
-
}, [
|
|
23884
|
+
}, [dateFormat]);
|
|
23736
23885
|
const {
|
|
23737
23886
|
dateMinDT,
|
|
23738
23887
|
dateMaxDT,
|
|
@@ -23748,11 +23897,13 @@ const useDatePicker = ({
|
|
|
23748
23897
|
});
|
|
23749
23898
|
return {
|
|
23750
23899
|
dateMinDT: toDT(minP),
|
|
23751
|
-
|
|
23900
|
+
// With a time component, the max day itself must stay selectable for
|
|
23901
|
+
// any time up to its last minute, not just 00:00.
|
|
23902
|
+
dateMaxDT: showTimePicker ? toDT(maxP).endOf('day') : toDT(maxP),
|
|
23752
23903
|
dateMinParts: minP,
|
|
23753
23904
|
dateMaxParts: maxP
|
|
23754
23905
|
};
|
|
23755
|
-
}, [dateMin, dateMax, config, formatIndexes]);
|
|
23906
|
+
}, [dateMin, dateMax, config, formatIndexes, showTimePicker]);
|
|
23756
23907
|
const maskInputRef = useDatePickerMask({
|
|
23757
23908
|
maskOptions: {
|
|
23758
23909
|
mask: config.mask,
|
|
@@ -23848,6 +23999,51 @@ const useDatePicker = ({
|
|
|
23848
23999
|
return newDT;
|
|
23849
24000
|
});
|
|
23850
24001
|
}, [config.length, luxonFormat, dateMinDT, dateMaxDT, name, setError, clearErrors, safeOnChange, safeOnError]);
|
|
24002
|
+
|
|
24003
|
+
// The value the clear button restores. With no `defaultValue` this is the
|
|
24004
|
+
// empty string, so "reset" and "clear" collapse into the same behaviour.
|
|
24005
|
+
const resetValue = defaultValue ?? '';
|
|
24006
|
+
|
|
24007
|
+
// Drives the clear button's visibility: there is nothing to undo while the
|
|
24008
|
+
// field still holds its default.
|
|
24009
|
+
const isDirty = (inputValue ?? '') !== resetValue;
|
|
24010
|
+
const resetToDefault = (0,external_react_namespaceObject.useCallback)(() => {
|
|
24011
|
+
const nextDT = resetValue ? external_luxon_namespaceObject.DateTime.fromFormat(resetValue, luxonFormat) : undefined;
|
|
24012
|
+
const validDT = nextDT?.isValid ? nextDT : undefined;
|
|
24013
|
+
|
|
24014
|
+
// Keep the processing refs in step with the value we're writing, so the
|
|
24015
|
+
// input-sync effect doesn't re-process a stale string and undo the reset.
|
|
24016
|
+
lastProcessedValueRef.current = resetValue;
|
|
24017
|
+
lastExternalValueRef.current = resetValue;
|
|
24018
|
+
clearErrors(name);
|
|
24019
|
+
setValue(name, resetValue);
|
|
24020
|
+
setDateTime(validDT);
|
|
24021
|
+
safeOnChange(validDT);
|
|
24022
|
+
safeOnError(null);
|
|
24023
|
+
}, [resetValue, luxonFormat, name, clearErrors, setValue, safeOnChange, safeOnError]);
|
|
24024
|
+
|
|
24025
|
+
/**
|
|
24026
|
+
* Commits an hour/minute pick from the time panel, keeping the currently
|
|
24027
|
+
* selected day. Falls back to the visible calendar day (then today) so a
|
|
24028
|
+
* time can be chosen before a date.
|
|
24029
|
+
*/
|
|
24030
|
+
const setTime = (0,external_react_namespaceObject.useCallback)(({
|
|
24031
|
+
hour,
|
|
24032
|
+
minute
|
|
24033
|
+
}) => {
|
|
24034
|
+
const base = dateTime ?? calendarViewDateTime ?? external_luxon_namespaceObject.DateTime.now();
|
|
24035
|
+
const next = base.set({
|
|
24036
|
+
hour: hour ?? base.hour,
|
|
24037
|
+
minute: minute ?? base.minute,
|
|
24038
|
+
second: 0,
|
|
24039
|
+
millisecond: 0
|
|
24040
|
+
});
|
|
24041
|
+
if (!next.isValid || next < dateMinDT || next > dateMaxDT) return;
|
|
24042
|
+
clearErrors(name);
|
|
24043
|
+
setDateTime(next);
|
|
24044
|
+
setCalendarViewDateTime(next);
|
|
24045
|
+
safeOnChange(next);
|
|
24046
|
+
}, [dateTime, calendarViewDateTime, dateMinDT, dateMaxDT, name, clearErrors, safeOnChange]);
|
|
23851
24047
|
const handleBlur = e => {
|
|
23852
24048
|
// Force validation on blur - catches incomplete inputs when user leaves the field
|
|
23853
24049
|
processValue(e.currentTarget.value, true);
|
|
@@ -23936,7 +24132,11 @@ const useDatePicker = ({
|
|
|
23936
24132
|
dateMaxDT,
|
|
23937
24133
|
dateTime,
|
|
23938
24134
|
isOpen,
|
|
24135
|
+
isDirty,
|
|
23939
24136
|
inputValue,
|
|
24137
|
+
resetToDefault,
|
|
24138
|
+
setTime,
|
|
24139
|
+
showTimePicker,
|
|
23940
24140
|
calendarViewDateTime,
|
|
23941
24141
|
maskInputRef,
|
|
23942
24142
|
calendarType,
|
|
@@ -24016,6 +24216,8 @@ const DatePickerProvider = ({
|
|
|
24016
24216
|
...rest,
|
|
24017
24217
|
...restHook,
|
|
24018
24218
|
pickerType: hookPickerType || rest.pickerType || PICKER_TYPE.DAYS,
|
|
24219
|
+
// Resolved by the hook and may carry a ` HH:mm` suffix, so it is a
|
|
24220
|
+
// plain string rather than the date-only `DatePickerFormat` union.
|
|
24019
24221
|
format: hookFormat || rest.format || DEFAULT_MASK_FORMAT,
|
|
24020
24222
|
formatIndexes,
|
|
24021
24223
|
inputRef: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([maskInputRef, rest.inputRef]),
|
|
@@ -24029,6 +24231,7 @@ const DatePickerProvider = ({
|
|
|
24029
24231
|
|
|
24030
24232
|
const useDatePickerContext = () => (0,external_react_namespaceObject.useContext)(DatePickerContext);
|
|
24031
24233
|
;// ./src/components/DatePicker/components/DaysView.tsx
|
|
24234
|
+
|
|
24032
24235
|
function DaysView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
24033
24236
|
|
|
24034
24237
|
|
|
@@ -24037,20 +24240,14 @@ function DaysView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to s
|
|
|
24037
24240
|
|
|
24038
24241
|
|
|
24039
24242
|
|
|
24243
|
+
|
|
24040
24244
|
var DaysView_ref = true ? {
|
|
24041
|
-
name: "
|
|
24042
|
-
styles: "
|
|
24043
|
-
} : 0;
|
|
24044
|
-
var DaysView_ref2 = true ? {
|
|
24045
|
-
name: "yzljcr",
|
|
24046
|
-
styles: "width:40px;height:40px;justify-content:center;font-size:12px;font-weight:600;cursor:default;user-select:none"
|
|
24047
|
-
} : 0;
|
|
24048
|
-
var _ref3 = true ? {
|
|
24049
|
-
name: "1pxryto",
|
|
24050
|
-
styles: "flex-wrap:wrap;padding-left:9px"
|
|
24245
|
+
name: "1qemjat",
|
|
24246
|
+
styles: "flex-wrap:wrap"
|
|
24051
24247
|
} : 0;
|
|
24052
24248
|
const DaysView = () => {
|
|
24053
24249
|
const weekDays = getWeekDays();
|
|
24250
|
+
const theme = (0,react_namespaceObject.useTheme)();
|
|
24054
24251
|
const {
|
|
24055
24252
|
dateTime,
|
|
24056
24253
|
calendarViewDateTime,
|
|
@@ -24058,6 +24255,7 @@ const DaysView = () => {
|
|
|
24058
24255
|
dateMaxDT,
|
|
24059
24256
|
lastChangedDate,
|
|
24060
24257
|
highlightDates,
|
|
24258
|
+
showTimePicker,
|
|
24061
24259
|
setCalendarViewDateTime,
|
|
24062
24260
|
setDateTime,
|
|
24063
24261
|
setIsOpen,
|
|
@@ -24086,18 +24284,32 @@ const DaysView = () => {
|
|
|
24086
24284
|
setCalendarViewDateTime(newDate);
|
|
24087
24285
|
setDateTime(newDate);
|
|
24088
24286
|
safeOnChange?.(newDate);
|
|
24089
|
-
|
|
24287
|
+
|
|
24288
|
+
// With a time panel open, closing here would make the hours/minutes
|
|
24289
|
+
// unreachable — the popover closes on outside click instead.
|
|
24290
|
+
if (!showTimePicker) {
|
|
24291
|
+
setIsOpen(false);
|
|
24292
|
+
}
|
|
24090
24293
|
}
|
|
24091
24294
|
};
|
|
24092
24295
|
return (0,jsx_runtime_namespaceObject.jsxs)((external_react_default()).Fragment, {
|
|
24093
24296
|
children: [(0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
|
|
24094
|
-
css: DaysView_ref,
|
|
24095
24297
|
children: weekDays.map((weekDay, index) => (0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
|
|
24096
|
-
css:
|
|
24298
|
+
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
24299
|
+
width: 40,
|
|
24300
|
+
height: 40,
|
|
24301
|
+
justifyContent: 'center',
|
|
24302
|
+
fontSize: 12,
|
|
24303
|
+
fontWeight: 600,
|
|
24304
|
+
lineHeight: '16px',
|
|
24305
|
+
color: theme.colors.greyDarker80,
|
|
24306
|
+
cursor: 'default',
|
|
24307
|
+
userSelect: 'none'
|
|
24308
|
+
}, true ? "" : 0, true ? "" : 0),
|
|
24097
24309
|
children: weekDay
|
|
24098
24310
|
}, `week-day-${weekDay}-${index}`))
|
|
24099
24311
|
}), (0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
|
|
24100
|
-
css:
|
|
24312
|
+
css: DaysView_ref,
|
|
24101
24313
|
onClick: handleDaySelect,
|
|
24102
24314
|
children: dates.map((currentDate, index) => {
|
|
24103
24315
|
const currentDT = external_luxon_namespaceObject.DateTime.fromJSDate(currentDate);
|
|
@@ -24125,13 +24337,18 @@ const DaysView = () => {
|
|
|
24125
24337
|
isAriaDisabled = currentDT > dateMaxDT || !isCalendarMonth;
|
|
24126
24338
|
}
|
|
24127
24339
|
}
|
|
24340
|
+
const rangeEdge = getRangeEdge({
|
|
24341
|
+
isFirstSelected: isCalendarFirstDateSelected,
|
|
24342
|
+
isSecondSelected: isCalendarSecondDateSelected,
|
|
24343
|
+
isRangeActive: isHighlightEnabled && !!otherDateDT && !!dateTime,
|
|
24344
|
+
mode: highlightDates?.mode
|
|
24345
|
+
});
|
|
24128
24346
|
return (0,jsx_runtime_namespaceObject.jsx)(DaysViewCell, {
|
|
24129
24347
|
"aria-disabled": isAriaDisabled,
|
|
24130
24348
|
"aria-label": ariaLabel,
|
|
24131
24349
|
isCalendarDateNow: isCalendarDateNow,
|
|
24132
24350
|
isCalendarDateSelected: isCalendarDateSelected,
|
|
24133
|
-
|
|
24134
|
-
isCalendarSecondDateSelected: isCalendarSecondDateSelected,
|
|
24351
|
+
rangeEdge: rangeEdge,
|
|
24135
24352
|
isHighlighted: isHighlightDate,
|
|
24136
24353
|
children: calendarDay
|
|
24137
24354
|
}, `day-${currentDate.getFullYear()}-${currentDate.getMonth()}-${currentDate.getDate()}-${index}`);
|
|
@@ -24204,7 +24421,6 @@ const MonthsView = () => {
|
|
|
24204
24421
|
css: MonthsView_ref,
|
|
24205
24422
|
onClick: handleMonthSelect,
|
|
24206
24423
|
children: MONTHS.map((month, index) => {
|
|
24207
|
-
const isCalendarMonth = calendarViewDateTime ? calendarViewDateTime.month === index + 1 : false;
|
|
24208
24424
|
const currentMonthDT = external_luxon_namespaceObject.DateTime.fromObject({
|
|
24209
24425
|
year: calendarViewDateTime?.year,
|
|
24210
24426
|
month: index + 1,
|
|
@@ -24215,16 +24431,22 @@ const MonthsView = () => {
|
|
|
24215
24431
|
const isAriaDisabled = isMinMonthReached || isMaxMonthReached;
|
|
24216
24432
|
const isCalendarFirstDateSelected = currentMonthDT.toFormat('yyyy-MM') === dateTime?.toFormat('yyyy-MM');
|
|
24217
24433
|
const isCalendarSecondDateSelected = currentMonthDT.toFormat('yyyy-MM') === otherDateDT?.toFormat('yyyy-MM');
|
|
24434
|
+
const isCalendarDateSelected = isCalendarFirstDateSelected || isCalendarSecondDateSelected;
|
|
24218
24435
|
let isHighlightDate = false;
|
|
24219
24436
|
if (isHighlightEnabled && lastChangedDate && otherDateDT && dateTime) {
|
|
24220
24437
|
isHighlightDate = highlightDates.mode === 'dateTo' ? otherDateDT < currentMonthDT && currentMonthDT < dateTime : dateTime < currentMonthDT && currentMonthDT < otherDateDT;
|
|
24221
24438
|
}
|
|
24439
|
+
const rangeEdge = getRangeEdge({
|
|
24440
|
+
isFirstSelected: isCalendarFirstDateSelected,
|
|
24441
|
+
isSecondSelected: isCalendarSecondDateSelected,
|
|
24442
|
+
isRangeActive: isHighlightEnabled && !!otherDateDT && !!dateTime,
|
|
24443
|
+
mode: highlightDates?.mode
|
|
24444
|
+
});
|
|
24222
24445
|
return (0,jsx_runtime_namespaceObject.jsx)(MonthsViewCell, {
|
|
24223
|
-
|
|
24446
|
+
isCalendarDateSelected: isCalendarDateSelected,
|
|
24224
24447
|
"aria-disabled": isAriaDisabled,
|
|
24225
24448
|
"aria-label": `${month}, ${calendarViewDateTime?.year}`,
|
|
24226
|
-
|
|
24227
|
-
isCalendarSecondDateSelected: isCalendarSecondDateSelected,
|
|
24449
|
+
rangeEdge: rangeEdge,
|
|
24228
24450
|
isHighlighted: isHighlightDate,
|
|
24229
24451
|
children: month
|
|
24230
24452
|
}, month);
|
|
@@ -24333,14 +24555,20 @@ const YearsView = () => {
|
|
|
24333
24555
|
}
|
|
24334
24556
|
const isCalendarFirstDateSelected = year.toString() === dateTime?.toFormat('yyyy');
|
|
24335
24557
|
const isCalendarSecondDateSelected = year.toString() === otherDateDT?.toFormat('yyyy');
|
|
24558
|
+
const isCalendarDateSelected = isCalendarFirstDateSelected || isCalendarSecondDateSelected;
|
|
24336
24559
|
let isHighlightDate = false;
|
|
24337
24560
|
if (isHighlightEnabled && lastChangedDate && otherDateDT && dateTime) {
|
|
24338
24561
|
isHighlightDate = highlightDates.mode === 'dateTo' ? otherDateDT.year < year && year < dateTime.year : dateTime.year < year && year < otherDateDT.year;
|
|
24339
24562
|
}
|
|
24563
|
+
const rangeEdge = getRangeEdge({
|
|
24564
|
+
isFirstSelected: isCalendarFirstDateSelected,
|
|
24565
|
+
isSecondSelected: isCalendarSecondDateSelected,
|
|
24566
|
+
isRangeActive: isHighlightEnabled && !!otherDateDT && !!dateTime,
|
|
24567
|
+
mode: highlightDates?.mode
|
|
24568
|
+
});
|
|
24340
24569
|
return (0,jsx_runtime_namespaceObject.jsx)(YearsViewCell, {
|
|
24341
|
-
|
|
24342
|
-
|
|
24343
|
-
isCalendarSecondDateSelected: isCalendarSecondDateSelected,
|
|
24570
|
+
isCalendarDateSelected: isCalendarDateSelected,
|
|
24571
|
+
rangeEdge: rangeEdge,
|
|
24344
24572
|
isHighlighted: isHighlightDate,
|
|
24345
24573
|
...additionalProps,
|
|
24346
24574
|
children: year
|
|
@@ -24447,7 +24675,7 @@ const DatePickerMonthsSwitch = () => {
|
|
|
24447
24675
|
children: [(0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
24448
24676
|
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
24449
24677
|
name: "carrot-left",
|
|
24450
|
-
size:
|
|
24678
|
+
size: 18,
|
|
24451
24679
|
tooltip: "Previous month",
|
|
24452
24680
|
color: isMinMonthReached ? theme.colors.grey : theme.colors.greyDarker
|
|
24453
24681
|
}),
|
|
@@ -24468,7 +24696,7 @@ const DatePickerMonthsSwitch = () => {
|
|
|
24468
24696
|
}), (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
24469
24697
|
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
24470
24698
|
name: "carrot-right",
|
|
24471
|
-
size:
|
|
24699
|
+
size: 18,
|
|
24472
24700
|
tooltip: "Next month",
|
|
24473
24701
|
color: isMaxMonthReached ? theme.colors.grey : theme.colors.greyDarker
|
|
24474
24702
|
}),
|
|
@@ -24498,8 +24726,8 @@ function DatePickerHeader_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tr
|
|
|
24498
24726
|
|
|
24499
24727
|
|
|
24500
24728
|
var DatePickerHeader_ref = true ? {
|
|
24501
|
-
name: "
|
|
24502
|
-
styles: "display:flex;justify-content:space-between;width:100%;height:32px;margin-bottom:
|
|
24729
|
+
name: "148aj7w",
|
|
24730
|
+
styles: "display:flex;justify-content:space-between;width:100%;height:32px;margin-bottom:8px"
|
|
24503
24731
|
} : 0;
|
|
24504
24732
|
const DatePickerHeader = () => {
|
|
24505
24733
|
const {
|
|
@@ -24539,7 +24767,7 @@ const DatePickerHeader = () => {
|
|
|
24539
24767
|
children: [(0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
24540
24768
|
endIcon: pickerType !== PICKER_TYPE.YEARS ? (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
24541
24769
|
name: calendarType === CALENDAR_TYPE.DAYS || calendarType === CALENDAR_TYPE.MONTHS ? 'carrot-down' : 'carrot-up',
|
|
24542
|
-
size:
|
|
24770
|
+
size: 16,
|
|
24543
24771
|
tooltip: ""
|
|
24544
24772
|
}) : null,
|
|
24545
24773
|
variant: "tertiary",
|
|
@@ -24547,11 +24775,11 @@ const DatePickerHeader = () => {
|
|
|
24547
24775
|
"data-testid": "calendar-type-change-button",
|
|
24548
24776
|
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
24549
24777
|
padding: 0,
|
|
24550
|
-
fontSize:
|
|
24778
|
+
fontSize: 16,
|
|
24551
24779
|
fontWeight: 700,
|
|
24552
|
-
lineHeight: '
|
|
24780
|
+
lineHeight: '20px',
|
|
24553
24781
|
height: 32,
|
|
24554
|
-
gap:
|
|
24782
|
+
gap: 8,
|
|
24555
24783
|
cursor: pickerType === PICKER_TYPE.YEARS ? 'default' : 'pointer',
|
|
24556
24784
|
'&:focus::before': {
|
|
24557
24785
|
display: 'none'
|
|
@@ -24561,6 +24789,94 @@ const DatePickerHeader = () => {
|
|
|
24561
24789
|
}), (0,jsx_runtime_namespaceObject.jsx)(DatePickerMonthsSwitch, {})]
|
|
24562
24790
|
});
|
|
24563
24791
|
};
|
|
24792
|
+
;// ./src/components/DatePicker/components/DatePickerTimePanel.tsx
|
|
24793
|
+
|
|
24794
|
+
|
|
24795
|
+
|
|
24796
|
+
|
|
24797
|
+
|
|
24798
|
+
const pad = value => String(value).padStart(2, '0');
|
|
24799
|
+
|
|
24800
|
+
/**
|
|
24801
|
+
* Centres a column on its selected cell by scrolling the column itself —
|
|
24802
|
+
* `scrollIntoView` can bubble up and scroll the whole page (same reason as
|
|
24803
|
+
* YearsView).
|
|
24804
|
+
*/
|
|
24805
|
+
const centreOnSelected = container => {
|
|
24806
|
+
if (!container) return;
|
|
24807
|
+
const selectedEl = container.querySelector('[aria-selected=true]');
|
|
24808
|
+
if (!selectedEl) return;
|
|
24809
|
+
const containerRect = container.getBoundingClientRect();
|
|
24810
|
+
const elRect = selectedEl.getBoundingClientRect();
|
|
24811
|
+
container.scrollTop += elRect.top - containerRect.top - container.clientHeight / 2 + elRect.height / 2;
|
|
24812
|
+
};
|
|
24813
|
+
|
|
24814
|
+
/**
|
|
24815
|
+
* Hours and minutes columns shown beside the calendar when `showTimePicker`
|
|
24816
|
+
* is set, matching the Figma `Day & Time Picker` pop-up.
|
|
24817
|
+
*
|
|
24818
|
+
* The hours and minutes columns scroll independently, so reaching a late hour
|
|
24819
|
+
* doesn't drag the minutes list out of view. Each is centred on its own
|
|
24820
|
+
* selected value when the popover opens.
|
|
24821
|
+
*/
|
|
24822
|
+
const DatePickerTimePanel = () => {
|
|
24823
|
+
const {
|
|
24824
|
+
dateTime,
|
|
24825
|
+
isOpen,
|
|
24826
|
+
minuteStep = DEFAULT_MINUTE_STEP,
|
|
24827
|
+
setTime
|
|
24828
|
+
} = useDatePickerContext();
|
|
24829
|
+
const hoursRef = (0,external_react_namespaceObject.useRef)(null);
|
|
24830
|
+
const minutesRef = (0,external_react_namespaceObject.useRef)(null);
|
|
24831
|
+
const step = Number.isFinite(minuteStep) && minuteStep > 0 && minuteStep <= 60 ? Math.floor(minuteStep) : DEFAULT_MINUTE_STEP;
|
|
24832
|
+
const hours = Array.from({
|
|
24833
|
+
length: HOURS_IN_DAY
|
|
24834
|
+
}, (_, index) => index);
|
|
24835
|
+
const minutes = Array.from({
|
|
24836
|
+
length: Math.ceil(MINUTES_IN_HOUR / step)
|
|
24837
|
+
}, (_, index) => index * step);
|
|
24838
|
+
const selectedHour = dateTime?.hour;
|
|
24839
|
+
// The selected minute rarely lands exactly on a step, so highlight the step
|
|
24840
|
+
// it belongs to rather than nothing at all.
|
|
24841
|
+
const selectedMinute = dateTime && Number.isFinite(dateTime.minute) ? Math.floor(dateTime.minute / step) * step : undefined;
|
|
24842
|
+
(0,external_react_namespaceObject.useEffect)(() => {
|
|
24843
|
+
if (!isOpen) return;
|
|
24844
|
+
centreOnSelected(hoursRef.current);
|
|
24845
|
+
centreOnSelected(minutesRef.current);
|
|
24846
|
+
}, [isOpen, selectedHour, selectedMinute]);
|
|
24847
|
+
return (0,jsx_runtime_namespaceObject.jsxs)(TimePanel, {
|
|
24848
|
+
"data-testid": "datepicker-time-panel",
|
|
24849
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(TimeColumn, {
|
|
24850
|
+
ref: hoursRef,
|
|
24851
|
+
role: "listbox",
|
|
24852
|
+
"aria-label": "Hours",
|
|
24853
|
+
children: hours.map(hour => (0,jsx_runtime_namespaceObject.jsx)(TimeCell, {
|
|
24854
|
+
role: "option",
|
|
24855
|
+
"aria-selected": selectedHour === hour,
|
|
24856
|
+
"aria-label": `${pad(hour)} hours`,
|
|
24857
|
+
isSelected: selectedHour === hour,
|
|
24858
|
+
onClick: () => setTime?.({
|
|
24859
|
+
hour
|
|
24860
|
+
}),
|
|
24861
|
+
children: pad(hour)
|
|
24862
|
+
}, `hour-${hour}`))
|
|
24863
|
+
}), (0,jsx_runtime_namespaceObject.jsx)(TimeColumn, {
|
|
24864
|
+
ref: minutesRef,
|
|
24865
|
+
role: "listbox",
|
|
24866
|
+
"aria-label": "Minutes",
|
|
24867
|
+
children: minutes.map(minute => (0,jsx_runtime_namespaceObject.jsx)(TimeCell, {
|
|
24868
|
+
role: "option",
|
|
24869
|
+
"aria-selected": selectedMinute === minute,
|
|
24870
|
+
"aria-label": `${pad(minute)} minutes`,
|
|
24871
|
+
isSelected: selectedMinute === minute,
|
|
24872
|
+
onClick: () => setTime?.({
|
|
24873
|
+
minute
|
|
24874
|
+
}),
|
|
24875
|
+
children: pad(minute)
|
|
24876
|
+
}, `minute-${minute}`))
|
|
24877
|
+
})]
|
|
24878
|
+
});
|
|
24879
|
+
};
|
|
24564
24880
|
;// ./src/components/DatePicker/components/DatePickerCalendar.tsx
|
|
24565
24881
|
function DatePickerCalendar_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
24566
24882
|
|
|
@@ -24570,8 +24886,8 @@ function DatePickerCalendar_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have
|
|
|
24570
24886
|
|
|
24571
24887
|
|
|
24572
24888
|
var DatePickerCalendar_ref = true ? {
|
|
24573
|
-
name: "
|
|
24574
|
-
styles: "height:100%;display:flex;flex-direction:column;justify-content:space-between"
|
|
24889
|
+
name: "16fpk5u",
|
|
24890
|
+
styles: "height:100%;width:100%;display:flex;flex-direction:column;justify-content:space-between"
|
|
24575
24891
|
} : 0;
|
|
24576
24892
|
const DatePickerCalendar = () => {
|
|
24577
24893
|
const theme = (0,react_namespaceObject.useTheme)();
|
|
@@ -24582,7 +24898,8 @@ const DatePickerCalendar = () => {
|
|
|
24582
24898
|
};
|
|
24583
24899
|
const {
|
|
24584
24900
|
calendarType,
|
|
24585
|
-
classNames
|
|
24901
|
+
classNames,
|
|
24902
|
+
showTimePicker
|
|
24586
24903
|
} = useDatePickerContext();
|
|
24587
24904
|
const Component = components[calendarType];
|
|
24588
24905
|
return (0,jsx_runtime_namespaceObject.jsxs)(PopoverContent, {
|
|
@@ -24591,18 +24908,59 @@ const DatePickerCalendar = () => {
|
|
|
24591
24908
|
background: theme.colors.white,
|
|
24592
24909
|
boxShadow: `-4px 4px 14px 0px ${theme.colors.greyDarker14}`,
|
|
24593
24910
|
borderRadius: 16,
|
|
24594
|
-
padding
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24911
|
+
// The calendar keeps its own 24px padding; the time panel brings its
|
|
24912
|
+
// own, so the padding moves inside when both are shown.
|
|
24913
|
+
padding: showTimePicker ? 0 : 24,
|
|
24914
|
+
paddingTop: showTimePicker ? 0 : 16,
|
|
24915
|
+
// 328 calendar + 144 time panel, per the Figma Day & Time pop-up.
|
|
24916
|
+
width: showTimePicker ? 472 : 328,
|
|
24917
|
+
height: 368,
|
|
24918
|
+
flexDirection: 'row',
|
|
24598
24919
|
alignItems: 'flex-start',
|
|
24599
24920
|
zIndex: 100
|
|
24600
24921
|
}, true ? "" : 0, true ? "" : 0),
|
|
24601
|
-
children: [(0,jsx_runtime_namespaceObject.
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
|
|
24922
|
+
children: [(0,jsx_runtime_namespaceObject.jsxs)("div", {
|
|
24923
|
+
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
24924
|
+
display: 'flex',
|
|
24925
|
+
flexDirection: 'column',
|
|
24926
|
+
alignItems: 'flex-start',
|
|
24927
|
+
flexShrink: 0,
|
|
24928
|
+
width: showTimePicker ? 328 : '100%',
|
|
24929
|
+
height: '100%',
|
|
24930
|
+
padding: showTimePicker ? '16px 24px 24px' : 0
|
|
24931
|
+
}, true ? "" : 0, true ? "" : 0),
|
|
24932
|
+
children: [(0,jsx_runtime_namespaceObject.jsx)(DatePickerHeader, {}), (0,jsx_runtime_namespaceObject.jsx)(PopoverDescription, {
|
|
24933
|
+
as: "div",
|
|
24934
|
+
css: DatePickerCalendar_ref,
|
|
24935
|
+
children: (0,jsx_runtime_namespaceObject.jsx)(Component, {})
|
|
24936
|
+
})]
|
|
24937
|
+
}), showTimePicker && (0,jsx_runtime_namespaceObject.jsx)(DatePickerTimePanel, {})]
|
|
24938
|
+
});
|
|
24939
|
+
};
|
|
24940
|
+
;// ./src/components/DatePicker/components/ClearButton.tsx
|
|
24941
|
+
|
|
24942
|
+
|
|
24943
|
+
|
|
24944
|
+
const ClearButton = ({
|
|
24945
|
+
onClick,
|
|
24946
|
+
ariaLabel,
|
|
24947
|
+
dataTestId,
|
|
24948
|
+
className,
|
|
24949
|
+
css: cssProp
|
|
24950
|
+
}) => {
|
|
24951
|
+
const theme = (0,react_namespaceObject.useTheme)();
|
|
24952
|
+
return (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
24953
|
+
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
24954
|
+
name: "cross",
|
|
24955
|
+
size: 16,
|
|
24956
|
+
color: theme.colors.greyDarker80
|
|
24957
|
+
}),
|
|
24958
|
+
"data-testid": dataTestId,
|
|
24959
|
+
onClick: onClick,
|
|
24960
|
+
variant: "tertiary",
|
|
24961
|
+
"aria-label": ariaLabel,
|
|
24962
|
+
className: className,
|
|
24963
|
+
css: ["padding:0;&:focus::before{display:none;}", cssProp, true ? "" : 0, true ? "" : 0]
|
|
24606
24964
|
});
|
|
24607
24965
|
};
|
|
24608
24966
|
;// ./src/components/DatePicker/components/DatePickerTrigger.tsx
|
|
@@ -24615,6 +24973,11 @@ function DatePickerTrigger_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have t
|
|
|
24615
24973
|
|
|
24616
24974
|
|
|
24617
24975
|
|
|
24976
|
+
|
|
24977
|
+
var DatePickerTrigger_ref = true ? {
|
|
24978
|
+
name: "sbd56d",
|
|
24979
|
+
styles: "gap:16px;align-items:center"
|
|
24980
|
+
} : 0;
|
|
24618
24981
|
const DatePickerTrigger = () => {
|
|
24619
24982
|
const {
|
|
24620
24983
|
format,
|
|
@@ -24626,7 +24989,11 @@ const DatePickerTrigger = () => {
|
|
|
24626
24989
|
inputProps,
|
|
24627
24990
|
disabled,
|
|
24628
24991
|
helperText,
|
|
24992
|
+
success,
|
|
24629
24993
|
showCalendarIcon,
|
|
24994
|
+
showClearButton,
|
|
24995
|
+
isDirty,
|
|
24996
|
+
resetToDefault,
|
|
24630
24997
|
onBlur: handleBlur,
|
|
24631
24998
|
setIsOpen,
|
|
24632
24999
|
validationSchema
|
|
@@ -24646,7 +25013,12 @@ const DatePickerTrigger = () => {
|
|
|
24646
25013
|
}
|
|
24647
25014
|
} = hookFormResult;
|
|
24648
25015
|
const fieldError = errors[name];
|
|
24649
|
-
|
|
25016
|
+
let fieldStatus = 'basic';
|
|
25017
|
+
if (fieldError?.message) {
|
|
25018
|
+
fieldStatus = 'error';
|
|
25019
|
+
} else if (success) {
|
|
25020
|
+
fieldStatus = 'success';
|
|
25021
|
+
}
|
|
24650
25022
|
const toggleOpen = () => {
|
|
24651
25023
|
setIsOpen(current => !current);
|
|
24652
25024
|
};
|
|
@@ -24679,6 +25051,20 @@ const DatePickerTrigger = () => {
|
|
|
24679
25051
|
}
|
|
24680
25052
|
}, true ? "" : 0, true ? "" : 0)
|
|
24681
25053
|
}) : undefined;
|
|
25054
|
+
const clearButton = showClearButton && isDirty && !disabled ? (0,jsx_runtime_namespaceObject.jsx)(ClearButton, {
|
|
25055
|
+
dataTestId: "datepicker-clear-button",
|
|
25056
|
+
onClick: () => resetToDefault?.(),
|
|
25057
|
+
ariaLabel: "Clear date",
|
|
25058
|
+
className: classNames?.trigger?.clearButton
|
|
25059
|
+
}) : undefined;
|
|
25060
|
+
|
|
25061
|
+
// Figma groups the trailing actions with a 16px gap; rendering them as a
|
|
25062
|
+
// single `endElement` keeps Input's absolute positioning applying to the
|
|
25063
|
+
// group rather than to each button.
|
|
25064
|
+
const actions = clearButton || calendarButton ? (0,jsx_runtime_namespaceObject.jsxs)(Wrapper_Wrapper, {
|
|
25065
|
+
css: DatePickerTrigger_ref,
|
|
25066
|
+
children: [clearButton, calendarButton]
|
|
25067
|
+
}) : undefined;
|
|
24682
25068
|
return (0,jsx_runtime_namespaceObject.jsxs)((external_react_default()).Fragment, {
|
|
24683
25069
|
children: [label && (0,jsx_runtime_namespaceObject.jsx)(Label_Label, {
|
|
24684
25070
|
htmlFor: name,
|
|
@@ -24711,7 +25097,7 @@ const DatePickerTrigger = () => {
|
|
|
24711
25097
|
name: "lhoo11",
|
|
24712
25098
|
styles: "&>span::first-letter{text-transform:uppercase;}"
|
|
24713
25099
|
} : 0),
|
|
24714
|
-
endElement:
|
|
25100
|
+
endElement: actions
|
|
24715
25101
|
})
|
|
24716
25102
|
})]
|
|
24717
25103
|
});
|
|
@@ -24914,132 +25300,33 @@ const getFormatForRangePickerType = rangePickerType => {
|
|
|
24914
25300
|
;// ./src/components/DateRangePicker/components/DatesListWrapper.tsx
|
|
24915
25301
|
|
|
24916
25302
|
|
|
25303
|
+
|
|
25304
|
+
/**
|
|
25305
|
+
* Wraps the date grid and styles the "range you are about to pick" preview
|
|
25306
|
+
* band that appears between a selected anchor and the currently hovered cell.
|
|
25307
|
+
*
|
|
25308
|
+
* The band is a translucent fill with a hairline top/bottom rule, capped with
|
|
25309
|
+
* a rounded corner at each end — so which cell is the left cap and which is
|
|
25310
|
+
* the right depends on the direction being previewed:
|
|
25311
|
+
*
|
|
25312
|
+
* - **`hover-range-from`** — hovering *before* the start anchor, so the
|
|
25313
|
+
* hovered cell is the left cap and the selected anchor is the right.
|
|
25314
|
+
* - **`hover-range-to`** — hovering *after* the end anchor, so the selected
|
|
25315
|
+
* anchor is the left cap and the hovered cell is the right.
|
|
25316
|
+
*/
|
|
24917
25317
|
const DatesListWrapper = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
|
|
24918
25318
|
target: "e10i52w40"
|
|
24919
|
-
} : 0)("flex-wrap:wrap;&>div.hover-range-from.
|
|
24920
|
-
theme
|
|
24921
|
-
}) => theme.colors.greyLighter, ";border-left:none;border-top-left-radius:6px;border-bottom-left-radius:6px;}&>div.hover-range-from:not(.selected-range-from, .date-hovered),&>div.hover-range-to:not(.selected-range-to, .date-hovered){background:", ({
|
|
24922
|
-
theme
|
|
24923
|
-
}) => theme.colors.greyLighter60, ";border-radius:0;}&>div.hover-range-from.selected-range-from::after,&>div.hover-range-from.date-hovered::after,&>div.hover-range-to.selected-range-to::after,&>div.hover-range-to.date-hovered::after{content:'';position:absolute;width:10px;height:40px;z-index:-1;background:", ({
|
|
24924
|
-
theme
|
|
24925
|
-
}) => theme.colors.greyLighter60, ";}&>div.hover-range-from.selected-range-from::after,&>div.hover-range-to.date-hovered::after{left:0;}&>div.hover-range-from.date-hovered::after,&>div.hover-range-to.selected-range-to::after{right:0;}&>div.hover-range-form.selected-range-from:has(~ div.date-hovered)::after,&>div.hover-range-to.selected-range-to:has(+ div.date-hovered)::after,&>div.date-hovered:has(+ div.selected-range-from)::after,&>div.hover-range-to.selected-range-to+div.date-hovered::after,&>div.date-hovered+div.selected-range-from::after{background:", ({
|
|
24926
|
-
theme
|
|
24927
|
-
}) => theme.colors.greyLighter, ";}" + ( true ? "" : 0));
|
|
24928
|
-
;// ./src/components/DateRangePicker/styles.ts
|
|
24929
|
-
|
|
24930
|
-
function DateRangePicker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
24931
|
-
|
|
24932
|
-
const styles_DaysViewCell = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
|
|
24933
|
-
target: "e19l41fq3"
|
|
24934
|
-
} : 0)("position:relative;width:40px;height:40px;justify-content:center;font-size:14px;font-weight:500;border-radius:", ({
|
|
24935
|
-
isHighlighted
|
|
24936
|
-
}) => isHighlighted ? 0 : '6px', ";border:", ({
|
|
24937
|
-
theme,
|
|
24938
|
-
isCalendarDateNow
|
|
24939
|
-
}) => isCalendarDateNow ? `1px solid ${theme.colors.greyFocused}` : 'none', ";color:", ({
|
|
24940
|
-
theme,
|
|
24941
|
-
isCalendarDateSelected
|
|
24942
|
-
}) => isCalendarDateSelected ? theme.colors.white : theme.colors.greyDarker, ";background:", ({
|
|
24943
|
-
theme,
|
|
24944
|
-
isCalendarDateSelected
|
|
24945
|
-
}) => isCalendarDateSelected && theme.palette.primary.main, ";cursor:pointer;user-select:none;&[aria-disabled='true']{color:", ({
|
|
24946
|
-
theme
|
|
24947
|
-
}) => theme.colors.grey, ";cursor:default;pointer-events:none;}&[aria-disabled='false']{background:", ({
|
|
24948
|
-
theme,
|
|
24949
|
-
isCalendarDateSelected,
|
|
24950
|
-
isHighlighted
|
|
24951
|
-
}) => isHighlighted && !isCalendarDateSelected && theme.palette.primary.main.replace('rgb(', 'rgba(').replace(')', ', 0.2)'), ";&:hover{background:", ({
|
|
25319
|
+
} : 0)("flex-wrap:wrap;&>div.hover-range-from:not(.selected-range-from),&>div.hover-range-to:not(.selected-range-to){background:", ({
|
|
24952
25320
|
theme
|
|
24953
|
-
}) => theme.colors.
|
|
25321
|
+
}) => theme.colors.greyPale16, ";border-top:1px solid ", ({
|
|
24954
25322
|
theme
|
|
24955
|
-
}) => theme.
|
|
24956
|
-
isCalendarFirstDateSelected,
|
|
24957
|
-
isCalendarSecondDateSelected
|
|
24958
|
-
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
|
|
24959
|
-
isCalendarSecondDateSelected
|
|
24960
|
-
}) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
|
|
24961
|
-
isCalendarFirstDateSelected
|
|
24962
|
-
}) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
|
|
24963
|
-
theme
|
|
24964
|
-
}) => theme.palette.primary.main.replace('rgb(', 'rgba(').replace(')', ', 0.2)'), ";}}&:hover{border:", ({
|
|
24965
|
-
theme,
|
|
24966
|
-
isCalendarDateNow
|
|
24967
|
-
}) => isCalendarDateNow && `1px solid ${theme.colors.greyFocused}`, ";}" + ( true ? "" : 0));
|
|
24968
|
-
const styles_YearsViewCell = /*#__PURE__*/base_default()("div", true ? {
|
|
24969
|
-
target: "e19l41fq2"
|
|
24970
|
-
} : 0)("display:flex;justify-content:center;position:relative;align-items:center;width:70px;height:40px;border-radius:", ({
|
|
24971
|
-
isCalendarFirstDateSelected,
|
|
24972
|
-
isCalendarSecondDateSelected
|
|
24973
|
-
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? '6px' : 0, ";font-size:14px;font-weight:500px;user-select:none;cursor:pointer;color:", ({
|
|
24974
|
-
theme,
|
|
24975
|
-
isCalendarYear,
|
|
24976
|
-
isCalendarFirstDateSelected,
|
|
24977
|
-
isCalendarSecondDateSelected
|
|
24978
|
-
}) => (isCalendarYear || isCalendarFirstDateSelected || isCalendarSecondDateSelected) && theme.colors.white, ";background:", ({
|
|
24979
|
-
theme,
|
|
24980
|
-
isCalendarYear,
|
|
24981
|
-
isCalendarFirstDateSelected,
|
|
24982
|
-
isCalendarSecondDateSelected
|
|
24983
|
-
}) => isCalendarYear || isCalendarFirstDateSelected || isCalendarSecondDateSelected ? theme.palette.primary.main : 'none', ";background:", ({
|
|
24984
|
-
theme,
|
|
24985
|
-
isHighlighted,
|
|
24986
|
-
isCalendarYear,
|
|
24987
|
-
isCalendarSecondDateSelected
|
|
24988
|
-
}) => isHighlighted && !isCalendarYear && !isCalendarSecondDateSelected && theme.palette.primary.main.replace('rgb(', 'rgba(').replace(')', ', 0.2)'), ";&:hover{background:", ({
|
|
24989
|
-
theme
|
|
24990
|
-
}) => theme.colors.greyLighter, ";color:", ({
|
|
24991
|
-
theme
|
|
24992
|
-
}) => theme.colors.greyDarker, ";border-radius:6px;}&::before{content:'';display:", ({
|
|
24993
|
-
isCalendarFirstDateSelected,
|
|
24994
|
-
isCalendarSecondDateSelected
|
|
24995
|
-
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
|
|
24996
|
-
isCalendarSecondDateSelected
|
|
24997
|
-
}) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
|
|
24998
|
-
isCalendarFirstDateSelected
|
|
24999
|
-
}) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
|
|
25000
|
-
theme
|
|
25001
|
-
}) => theme.palette.primary.main.replace('rgb(', 'rgba(').replace(')', ', 0.2)'), ";}" + ( true ? "" : 0));
|
|
25002
|
-
const styles_MonthsViewCell = /*#__PURE__*/base_default()("div", true ? {
|
|
25003
|
-
target: "e19l41fq1"
|
|
25004
|
-
} : 0)("display:flex;justify-content:center;position:relative;align-items:center;width:99px;height:40px;border-radius:", ({
|
|
25005
|
-
isCalendarFirstDateSelected,
|
|
25006
|
-
isCalendarSecondDateSelected
|
|
25007
|
-
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? '6px' : 0, ";font-size:14px;font-weight:500;cursor:pointer;color:", ({
|
|
25008
|
-
theme,
|
|
25009
|
-
isCalendarFirstDateSelected,
|
|
25010
|
-
isCalendarSecondDateSelected
|
|
25011
|
-
}) => (isCalendarFirstDateSelected || isCalendarSecondDateSelected) && theme.colors.white, ";user-select:none;background:", ({
|
|
25012
|
-
theme,
|
|
25013
|
-
isCalendarFirstDateSelected,
|
|
25014
|
-
isCalendarSecondDateSelected
|
|
25015
|
-
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? theme.palette.primary.main : 'none', ";&[aria-disabled='true']{cursor:default;pointer-events:none;color:", ({
|
|
25016
|
-
theme
|
|
25017
|
-
}) => theme.colors.greyDarker, ";background:", ({
|
|
25018
|
-
theme
|
|
25019
|
-
}) => theme.colors.grey, ";}&[aria-disabled='false']{background:", ({
|
|
25020
|
-
theme,
|
|
25021
|
-
isHighlighted,
|
|
25022
|
-
isCalendarSecondDateSelected
|
|
25023
|
-
}) => isHighlighted && !isCalendarSecondDateSelected && theme.palette.primary.main.replace('rgb(', 'rgba(').replace(')', ', 0.2)'), ";&:hover{background:", ({
|
|
25323
|
+
}) => theme.palette.secondary.light, ";border-bottom:1px solid ", ({
|
|
25024
25324
|
theme
|
|
25025
|
-
}) => theme.
|
|
25325
|
+
}) => theme.palette.secondary.light, ";border-radius:0;}&>div.hover-range-from.date-hovered,&>div.hover-range-to.selected-range-to{border-left:1px solid ", ({
|
|
25026
25326
|
theme
|
|
25027
|
-
}) => theme.
|
|
25028
|
-
isCalendarFirstDateSelected,
|
|
25029
|
-
isCalendarSecondDateSelected
|
|
25030
|
-
}) => isCalendarFirstDateSelected || isCalendarSecondDateSelected ? 'block' : 'none', ";position:absolute;width:10px;height:40px;left:", ({
|
|
25031
|
-
isCalendarSecondDateSelected
|
|
25032
|
-
}) => isCalendarSecondDateSelected ? '0' : 'auto', ";right:", ({
|
|
25033
|
-
isCalendarFirstDateSelected
|
|
25034
|
-
}) => isCalendarFirstDateSelected ? '0' : 'auto', ";z-index:-1;background:", ({
|
|
25327
|
+
}) => theme.palette.secondary.light, ";border-top-left-radius:6px;border-bottom-left-radius:6px;}&>div.hover-range-from.selected-range-from,&>div.hover-range-to.date-hovered{border-right:1px solid ", ({
|
|
25035
25328
|
theme
|
|
25036
|
-
}) => theme.palette.
|
|
25037
|
-
const TriggerWrapper = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
|
|
25038
|
-
target: "e19l41fq0"
|
|
25039
|
-
} : 0)( true ? {
|
|
25040
|
-
name: "1h91tay",
|
|
25041
|
-
styles: "padding:14px;cursor:default"
|
|
25042
|
-
} : 0);
|
|
25329
|
+
}) => theme.palette.secondary.light, ";border-top-right-radius:6px;border-bottom-right-radius:6px;}" + ( true ? "" : 0));
|
|
25043
25330
|
;// ./src/components/DateRangePicker/utils/dates.ts
|
|
25044
25331
|
|
|
25045
25332
|
const dates_getDaysForCalendarMonth = date => {
|
|
@@ -25329,13 +25616,16 @@ const useRangeSelection = ({
|
|
|
25329
25616
|
isCalendarDateSelected
|
|
25330
25617
|
};
|
|
25331
25618
|
};
|
|
25619
|
+
|
|
25620
|
+
// A range only has distinct start/end edges once both anchors are set.
|
|
25621
|
+
const isRangeActive = !!(dateTime[0] && dateTime[1]);
|
|
25332
25622
|
return {
|
|
25333
25623
|
handleRangeSelect,
|
|
25334
|
-
getDateSelectionState
|
|
25624
|
+
getDateSelectionState,
|
|
25625
|
+
isRangeActive
|
|
25335
25626
|
};
|
|
25336
25627
|
};
|
|
25337
25628
|
;// ./src/components/DateRangePicker/components/DaysView.tsx
|
|
25338
|
-
function components_DaysView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
25339
25629
|
|
|
25340
25630
|
|
|
25341
25631
|
|
|
@@ -25345,20 +25635,12 @@ function components_DaysView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have
|
|
|
25345
25635
|
|
|
25346
25636
|
|
|
25347
25637
|
|
|
25348
|
-
|
|
25349
|
-
|
|
25350
|
-
|
|
25351
|
-
} : 0;
|
|
25352
|
-
var components_DaysView_ref2 = true ? {
|
|
25353
|
-
name: "yzljcr",
|
|
25354
|
-
styles: "width:40px;height:40px;justify-content:center;font-size:12px;font-weight:600;cursor:default;user-select:none"
|
|
25355
|
-
} : 0;
|
|
25356
|
-
var DaysView_ref3 = true ? {
|
|
25357
|
-
name: "hisq2i",
|
|
25358
|
-
styles: "padding-left:9px"
|
|
25359
|
-
} : 0;
|
|
25638
|
+
|
|
25639
|
+
|
|
25640
|
+
|
|
25360
25641
|
const DaysView_DaysView = () => {
|
|
25361
25642
|
const weekDays = dates_getWeekDays();
|
|
25643
|
+
const theme = (0,react_namespaceObject.useTheme)();
|
|
25362
25644
|
const {
|
|
25363
25645
|
dateMinDT,
|
|
25364
25646
|
dateMaxDT,
|
|
@@ -25375,7 +25657,8 @@ const DaysView_DaysView = () => {
|
|
|
25375
25657
|
} = useRangeHighlighting();
|
|
25376
25658
|
const {
|
|
25377
25659
|
handleRangeSelect,
|
|
25378
|
-
getDateSelectionState
|
|
25660
|
+
getDateSelectionState,
|
|
25661
|
+
isRangeActive
|
|
25379
25662
|
} = useRangeSelection({
|
|
25380
25663
|
createNewDate: selectedDay => currentCalendarViewDT.set({
|
|
25381
25664
|
day: Number(selectedDay)
|
|
@@ -25394,13 +25677,21 @@ const DaysView_DaysView = () => {
|
|
|
25394
25677
|
};
|
|
25395
25678
|
return (0,jsx_runtime_namespaceObject.jsxs)((external_react_default()).Fragment, {
|
|
25396
25679
|
children: [(0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
|
|
25397
|
-
css: components_DaysView_ref,
|
|
25398
25680
|
children: weekDays.map((weekDay, index) => (0,jsx_runtime_namespaceObject.jsx)(Wrapper_Wrapper, {
|
|
25399
|
-
css:
|
|
25681
|
+
css: /*#__PURE__*/(0,react_namespaceObject.css)({
|
|
25682
|
+
width: 40,
|
|
25683
|
+
height: 40,
|
|
25684
|
+
justifyContent: 'center',
|
|
25685
|
+
fontSize: 12,
|
|
25686
|
+
fontWeight: 600,
|
|
25687
|
+
lineHeight: '16px',
|
|
25688
|
+
color: theme.colors.greyDarker80,
|
|
25689
|
+
cursor: 'default',
|
|
25690
|
+
userSelect: 'none'
|
|
25691
|
+
}, true ? "" : 0, true ? "" : 0),
|
|
25400
25692
|
children: weekDay
|
|
25401
25693
|
}, `week-day-${weekDay}-${index}`))
|
|
25402
25694
|
}), (0,jsx_runtime_namespaceObject.jsx)(DatesListWrapper, {
|
|
25403
|
-
css: DaysView_ref3,
|
|
25404
25695
|
onClick: handleDaySelect,
|
|
25405
25696
|
children: dates.map((currentDate, index) => {
|
|
25406
25697
|
const currentDT = external_luxon_namespaceObject.DateTime.fromJSDate(currentDate).startOf('day');
|
|
@@ -25430,14 +25721,18 @@ const DaysView_DaysView = () => {
|
|
|
25430
25721
|
isCalendarFirstDateSelected,
|
|
25431
25722
|
isCalendarSecondDateSelected
|
|
25432
25723
|
});
|
|
25433
|
-
return (0,jsx_runtime_namespaceObject.jsx)(
|
|
25724
|
+
return (0,jsx_runtime_namespaceObject.jsx)(DaysViewCell, {
|
|
25434
25725
|
"aria-disabled": isAriaDisabled,
|
|
25435
25726
|
"aria-label": ariaLabel,
|
|
25436
25727
|
"data-day": calendarDate,
|
|
25437
25728
|
isCalendarDateNow: isCalendarDateNow,
|
|
25438
25729
|
isCalendarDateSelected: isCalendarDateSelected,
|
|
25439
|
-
|
|
25440
|
-
|
|
25730
|
+
rangeEdge: getRangeEdge({
|
|
25731
|
+
isFirstSelected: isCalendarFirstDateSelected,
|
|
25732
|
+
isSecondSelected: isCalendarSecondDateSelected,
|
|
25733
|
+
isRangeActive,
|
|
25734
|
+
mode: 'dateFrom'
|
|
25735
|
+
}),
|
|
25441
25736
|
isHighlighted: isHighlightDate(currentDT),
|
|
25442
25737
|
className: classNames.join(' '),
|
|
25443
25738
|
onMouseEnter: () => handleDateHover(currentDT),
|
|
@@ -25457,6 +25752,7 @@ function components_MonthsView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You ha
|
|
|
25457
25752
|
|
|
25458
25753
|
|
|
25459
25754
|
|
|
25755
|
+
|
|
25460
25756
|
var components_MonthsView_ref = true ? {
|
|
25461
25757
|
name: "icns00",
|
|
25462
25758
|
styles: "padding-top:10px"
|
|
@@ -25480,7 +25776,8 @@ const MonthsView_MonthsView = () => {
|
|
|
25480
25776
|
} = useRangeHighlighting();
|
|
25481
25777
|
const {
|
|
25482
25778
|
handleRangeSelect,
|
|
25483
|
-
getDateSelectionState
|
|
25779
|
+
getDateSelectionState,
|
|
25780
|
+
isRangeActive
|
|
25484
25781
|
} = useRangeSelection({
|
|
25485
25782
|
createNewDate: selectedMonth => {
|
|
25486
25783
|
const monthNumber = constants_MONTHS.findIndex(month => month === selectedMonth);
|
|
@@ -25539,11 +25836,16 @@ const MonthsView_MonthsView = () => {
|
|
|
25539
25836
|
isCalendarFirstDateSelected,
|
|
25540
25837
|
isCalendarSecondDateSelected
|
|
25541
25838
|
});
|
|
25542
|
-
return (0,jsx_runtime_namespaceObject.jsx)(
|
|
25839
|
+
return (0,jsx_runtime_namespaceObject.jsx)(MonthsViewCell, {
|
|
25543
25840
|
"aria-disabled": isAriaDisabled,
|
|
25544
25841
|
"aria-label": `${month}, ${currentCalendarViewDT?.year}`,
|
|
25545
|
-
|
|
25546
|
-
|
|
25842
|
+
isCalendarDateSelected: isCalendarFirstDateSelected || isCalendarSecondDateSelected,
|
|
25843
|
+
rangeEdge: getRangeEdge({
|
|
25844
|
+
isFirstSelected: isCalendarFirstDateSelected,
|
|
25845
|
+
isSecondSelected: isCalendarSecondDateSelected,
|
|
25846
|
+
isRangeActive,
|
|
25847
|
+
mode: 'dateFrom'
|
|
25848
|
+
}),
|
|
25547
25849
|
isHighlighted: isHighlightDate(currentMonthDT),
|
|
25548
25850
|
className: classNames.join(' '),
|
|
25549
25851
|
onMouseEnter: () => handleDateHover(currentMonthDT),
|
|
@@ -25563,6 +25865,7 @@ function components_YearsView_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You hav
|
|
|
25563
25865
|
|
|
25564
25866
|
|
|
25565
25867
|
|
|
25868
|
+
|
|
25566
25869
|
var components_YearsView_ref = true ? {
|
|
25567
25870
|
name: "1lqam8u",
|
|
25568
25871
|
styles: "overflow-y:auto;height:280px;align-content:flex-start"
|
|
@@ -25595,7 +25898,8 @@ const YearsView_YearsView = () => {
|
|
|
25595
25898
|
} = useRangeHighlighting();
|
|
25596
25899
|
const {
|
|
25597
25900
|
handleRangeSelect,
|
|
25598
|
-
getDateSelectionState
|
|
25901
|
+
getDateSelectionState,
|
|
25902
|
+
isRangeActive
|
|
25599
25903
|
} = useRangeSelection({
|
|
25600
25904
|
createNewDate: selectedYear => {
|
|
25601
25905
|
const newYear = currentCalendarViewDT?.set({
|
|
@@ -25691,11 +25995,15 @@ const YearsView_YearsView = () => {
|
|
|
25691
25995
|
isCalendarFirstDateSelected,
|
|
25692
25996
|
isCalendarSecondDateSelected
|
|
25693
25997
|
});
|
|
25694
|
-
return (0,jsx_runtime_namespaceObject.jsx)(
|
|
25998
|
+
return (0,jsx_runtime_namespaceObject.jsx)(YearsViewCell, {
|
|
25695
25999
|
className: classNames.join(' '),
|
|
25696
|
-
|
|
25697
|
-
|
|
25698
|
-
|
|
26000
|
+
isCalendarDateSelected: isCalendarFirstDateSelected || isCalendarSecondDateSelected,
|
|
26001
|
+
rangeEdge: getRangeEdge({
|
|
26002
|
+
isFirstSelected: isCalendarFirstDateSelected,
|
|
26003
|
+
isSecondSelected: isCalendarSecondDateSelected,
|
|
26004
|
+
isRangeActive,
|
|
26005
|
+
mode: 'dateFrom'
|
|
26006
|
+
}),
|
|
25699
26007
|
isHighlighted: isHighlightDate(currentYearDT),
|
|
25700
26008
|
onMouseEnter: () => handleDateHover(currentYearDT),
|
|
25701
26009
|
onMouseLeave: () => handleDateHover(null),
|
|
@@ -25766,7 +26074,7 @@ const YearsMonthsSwitch = () => {
|
|
|
25766
26074
|
children: [(0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
25767
26075
|
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
25768
26076
|
name: "carrot-left",
|
|
25769
|
-
size:
|
|
26077
|
+
size: 18,
|
|
25770
26078
|
tooltip: `Previous ${rangePickerType === 'days' ? 'month' : 'year'}`,
|
|
25771
26079
|
color: isMinMonthReached ? theme.colors.grey : theme.colors.greyDarker
|
|
25772
26080
|
}),
|
|
@@ -25786,7 +26094,7 @@ const YearsMonthsSwitch = () => {
|
|
|
25786
26094
|
}), (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
25787
26095
|
endIcon: (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
25788
26096
|
name: "carrot-right",
|
|
25789
|
-
size:
|
|
26097
|
+
size: 18,
|
|
25790
26098
|
tooltip: `Next ${rangePickerType === 'days' ? 'month' : 'year'}`,
|
|
25791
26099
|
color: isMaxMonthReached ? theme.colors.grey : theme.colors.greyDarker
|
|
25792
26100
|
}),
|
|
@@ -25813,12 +26121,12 @@ function Header_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to str
|
|
|
25813
26121
|
|
|
25814
26122
|
|
|
25815
26123
|
var Header_ref = true ? {
|
|
25816
|
-
name: "
|
|
25817
|
-
styles: "display:flex;justify-content:space-between;width:100%;height:32px;margin-bottom:
|
|
26124
|
+
name: "148aj7w",
|
|
26125
|
+
styles: "display:flex;justify-content:space-between;width:100%;height:32px;margin-bottom:8px"
|
|
25818
26126
|
} : 0;
|
|
25819
26127
|
var Header_ref2 = true ? {
|
|
25820
|
-
name: "
|
|
25821
|
-
styles: "padding:0;font-size:
|
|
26128
|
+
name: "15si1yg",
|
|
26129
|
+
styles: "padding:0;font-size:16px;font-weight:700;line-height:20px;height:32px;gap:8px;&:focus::before{display:none;}"
|
|
25822
26130
|
} : 0;
|
|
25823
26131
|
const Header = () => {
|
|
25824
26132
|
const {
|
|
@@ -25836,7 +26144,7 @@ const Header = () => {
|
|
|
25836
26144
|
children: [(0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
25837
26145
|
endIcon: rangePickerType !== 'years' ? (0,jsx_runtime_namespaceObject.jsx)(Icon_Icon, {
|
|
25838
26146
|
name: calendarType === 'days' || calendarType === 'months' ? 'carrot-down' : 'carrot-up',
|
|
25839
|
-
size:
|
|
26147
|
+
size: 16,
|
|
25840
26148
|
tooltip: ""
|
|
25841
26149
|
}) : null,
|
|
25842
26150
|
variant: "tertiary",
|
|
@@ -26076,8 +26384,8 @@ const Calendar_DatePickerCalendar = () => {
|
|
|
26076
26384
|
borderRadius: 16,
|
|
26077
26385
|
padding: 24,
|
|
26078
26386
|
paddingTop: 16,
|
|
26079
|
-
width:
|
|
26080
|
-
height: showPresentOption ?
|
|
26387
|
+
width: 328,
|
|
26388
|
+
height: showPresentOption ? 410 : 368,
|
|
26081
26389
|
alignItems: 'flex-start',
|
|
26082
26390
|
margin: '14px 0 0 -14px',
|
|
26083
26391
|
zIndex: 100
|
|
@@ -26289,6 +26597,24 @@ const TriggerStatusArea = () => {
|
|
|
26289
26597
|
})]
|
|
26290
26598
|
});
|
|
26291
26599
|
};
|
|
26600
|
+
;// ./src/components/DateRangePicker/styles.ts
|
|
26601
|
+
|
|
26602
|
+
function DateRangePicker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
26603
|
+
|
|
26604
|
+
|
|
26605
|
+
/*
|
|
26606
|
+
* The calendar cells are identical to the single-date picker's, so they live in
|
|
26607
|
+
* `DatePicker/styles.ts` and are re-exported here. Keeping one definition means
|
|
26608
|
+
* a token, geometry, or range-edge fix lands in both pickers at once — the two
|
|
26609
|
+
* files having drifted apart is exactly what this avoids.
|
|
26610
|
+
*/
|
|
26611
|
+
|
|
26612
|
+
const TriggerWrapper = /*#__PURE__*/base_default()(Wrapper_Wrapper, true ? {
|
|
26613
|
+
target: "e19l41fq0"
|
|
26614
|
+
} : 0)( true ? {
|
|
26615
|
+
name: "1h91tay",
|
|
26616
|
+
styles: "padding:14px;cursor:default"
|
|
26617
|
+
} : 0);
|
|
26292
26618
|
;// ./src/components/DateRangePicker/components/Trigger.tsx
|
|
26293
26619
|
|
|
26294
26620
|
function Trigger_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
@@ -26301,10 +26627,15 @@ function Trigger_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to st
|
|
|
26301
26627
|
|
|
26302
26628
|
|
|
26303
26629
|
|
|
26630
|
+
|
|
26304
26631
|
var Trigger_ref = true ? {
|
|
26305
26632
|
name: "cx8u11",
|
|
26306
26633
|
styles: "margin:0 3px;cursor:pointer"
|
|
26307
26634
|
} : 0;
|
|
26635
|
+
var Trigger_ref2 = true ? {
|
|
26636
|
+
name: "oc2msk",
|
|
26637
|
+
styles: "margin:0 0 0 10px;height:auto;cursor:pointer"
|
|
26638
|
+
} : 0;
|
|
26308
26639
|
const Trigger = () => {
|
|
26309
26640
|
const {
|
|
26310
26641
|
nameFrom,
|
|
@@ -26315,7 +26646,10 @@ const Trigger = () => {
|
|
|
26315
26646
|
status,
|
|
26316
26647
|
isOpen,
|
|
26317
26648
|
showCalendarIcon,
|
|
26649
|
+
showClearButton,
|
|
26318
26650
|
showStatusArea,
|
|
26651
|
+
isDirty,
|
|
26652
|
+
resetToDefault,
|
|
26319
26653
|
classNames,
|
|
26320
26654
|
setIsOpen,
|
|
26321
26655
|
handleToggleOpen
|
|
@@ -26361,6 +26695,12 @@ const Trigger = () => {
|
|
|
26361
26695
|
}), (0,jsx_runtime_namespaceObject.jsx)(TriggerInput, {
|
|
26362
26696
|
datepickerType: "to",
|
|
26363
26697
|
className: classNames?.trigger?.inputTo
|
|
26698
|
+
}), showClearButton && isDirty && !disabled && (0,jsx_runtime_namespaceObject.jsx)(ClearButton, {
|
|
26699
|
+
dataTestId: "daterangepicker-clear-button",
|
|
26700
|
+
onClick: () => resetToDefault?.(),
|
|
26701
|
+
ariaLabel: "Clear dates",
|
|
26702
|
+
className: classNames?.trigger?.clearButton,
|
|
26703
|
+
css: Trigger_ref2
|
|
26364
26704
|
}), showCalendarIcon && (0,jsx_runtime_namespaceObject.jsx)(PopoverTrigger, {
|
|
26365
26705
|
asChild: true,
|
|
26366
26706
|
children: (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
@@ -26964,29 +27304,48 @@ const useDateRangePicker = ({
|
|
|
26964
27304
|
setIsOpen(isOpenState);
|
|
26965
27305
|
}
|
|
26966
27306
|
}, [isOpenState]);
|
|
27307
|
+
|
|
27308
|
+
/**
|
|
27309
|
+
* Applies **`defaultValue`** to every piece of range state at once. Shared
|
|
27310
|
+
* by the mount effect and the clear button, so resetting lands the picker in
|
|
27311
|
+
* exactly the state it booted in — including the "Present" end date.
|
|
27312
|
+
*/
|
|
27313
|
+
const applyDefaultValue = (0,external_react_namespaceObject.useCallback)(() => {
|
|
27314
|
+
const defaultDateTimeFrom = typeof defaultValue?.[0] === 'string' && defaultValue[0].length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(defaultValue[0], luxonFormat) : undefined;
|
|
27315
|
+
const defaultDateTimeTo = typeof defaultValue?.[1] === 'string' && defaultValue[1].length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(defaultValue[1], luxonFormat) : undefined;
|
|
27316
|
+
|
|
27317
|
+
// Handle null end date (represents "Present")
|
|
27318
|
+
const isEndPresent = defaultValue?.[1] === null;
|
|
27319
|
+
setIsEndDatePresent(isEndPresent);
|
|
27320
|
+
const newDateTime = [defaultDateTimeFrom?.isValid ? defaultDateTimeFrom.startOf('day') : undefined, isEndPresent ? undefined : defaultDateTimeTo?.isValid ? defaultDateTimeTo.startOf('day') : undefined];
|
|
27321
|
+
setDateTime(newDateTime);
|
|
27322
|
+
setLastChangedDate([newDateTime[0]?.toJSDate(), isEndPresent ? null : newDateTime[1]?.toJSDate()]);
|
|
27323
|
+
// Sync calendar view with default dates so they're visible when calendar opens
|
|
27324
|
+
setCalendarViewDateTime([newDateTime[0] || newDateTime[1] || undefined, newDateTime[1] || newDateTime[0] || undefined]);
|
|
27325
|
+
setValue(nameFrom, newDateTime[0]?.toFormat(luxonFormat) ?? '');
|
|
27326
|
+
// Keep form value empty when "Present" to avoid mask errors
|
|
27327
|
+
// "Present" is displayed via displayValue override in TriggerInput
|
|
27328
|
+
setValue(nameTo, isEndPresent ? '' : newDateTime[1]?.toFormat(luxonFormat) ?? '');
|
|
27329
|
+
return newDateTime;
|
|
27330
|
+
}, [defaultValue, expectedDateLength, luxonFormat, nameFrom, nameTo, setCalendarViewDateTime, setValue]);
|
|
27331
|
+
|
|
27332
|
+
// Whether either field has moved away from its default, which is what makes
|
|
27333
|
+
// the clear button meaningful.
|
|
27334
|
+
const isDirty = (inputValueFrom ?? '') !== (defaultValue?.[0] ?? '') || (inputValueTo ?? '') !== (defaultValue?.[1] === null ? '' : defaultValue?.[1] ?? '');
|
|
27335
|
+
const resetToDefault = (0,external_react_namespaceObject.useCallback)(() => {
|
|
27336
|
+
const newDateTime = applyDefaultValue();
|
|
27337
|
+
// A reset restarts range selection from the beginning.
|
|
27338
|
+
setRangeSelectionStep(newDateTime[0] && newDateTime[1] ? null : 'start');
|
|
27339
|
+
setLastFocusedElement('from');
|
|
27340
|
+
onChange?.([newDateTime[0]?.toJSDate(), defaultValue?.[1] === null ? null : newDateTime[1]?.toJSDate()]);
|
|
27341
|
+
}, [applyDefaultValue, defaultValue, onChange]);
|
|
26967
27342
|
(0,external_react_namespaceObject.useEffect)(() => {
|
|
26968
27343
|
// Only process defaultValue once on mount to avoid re-processing
|
|
26969
27344
|
if (Array.isArray(defaultValue) && !defaultValueProcessed.current) {
|
|
26970
|
-
|
|
26971
|
-
const defaultDateTimeTo = typeof defaultValue[1] === 'string' && defaultValue[1].length === expectedDateLength ? external_luxon_namespaceObject.DateTime.fromFormat(defaultValue[1], luxonFormat) : undefined;
|
|
26972
|
-
|
|
26973
|
-
// Handle null end date (represents "Present")
|
|
26974
|
-
const isEndPresent = defaultValue[1] === null;
|
|
26975
|
-
if (isEndPresent) {
|
|
26976
|
-
setIsEndDatePresent(true);
|
|
26977
|
-
}
|
|
26978
|
-
const newDateTime = [defaultDateTimeFrom?.isValid ? defaultDateTimeFrom.startOf('day') : undefined, isEndPresent ? undefined : defaultDateTimeTo?.isValid ? defaultDateTimeTo.startOf('day') : undefined];
|
|
26979
|
-
setDateTime(newDateTime);
|
|
26980
|
-
setLastChangedDate([newDateTime[0]?.toJSDate(), isEndPresent ? null : newDateTime[1]?.toJSDate()]);
|
|
26981
|
-
// Sync calendar view with default dates so they're visible when calendar opens
|
|
26982
|
-
setCalendarViewDateTime([newDateTime[0] || newDateTime[1] || undefined, newDateTime[1] || newDateTime[0] || undefined]);
|
|
26983
|
-
setValue(nameFrom, newDateTime[0]?.toFormat(luxonFormat));
|
|
26984
|
-
// Keep form value empty when "Present" to avoid mask errors
|
|
26985
|
-
// "Present" is displayed via displayValue override in TriggerInput
|
|
26986
|
-
setValue(nameTo, isEndPresent ? '' : newDateTime[1]?.toFormat(luxonFormat));
|
|
27345
|
+
applyDefaultValue();
|
|
26987
27346
|
defaultValueProcessed.current = true;
|
|
26988
27347
|
}
|
|
26989
|
-
}, [defaultValue,
|
|
27348
|
+
}, [defaultValue, applyDefaultValue]);
|
|
26990
27349
|
return {
|
|
26991
27350
|
formatIndexes,
|
|
26992
27351
|
dateMinParts,
|
|
@@ -27006,6 +27365,8 @@ const useDateRangePicker = ({
|
|
|
27006
27365
|
currentIndex,
|
|
27007
27366
|
currentCalendarViewDT,
|
|
27008
27367
|
isOpen,
|
|
27368
|
+
isDirty,
|
|
27369
|
+
resetToDefault,
|
|
27009
27370
|
status,
|
|
27010
27371
|
inputFromRef: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([maskInputRefFrom, inputFromRef]),
|
|
27011
27372
|
inputToRef: (0,external_floating_ui_react_namespaceObject.useMergeRefs)([maskInputRefTo, inputToRef]),
|
|
@@ -30273,7 +30634,7 @@ var FiltersMultiSelect_ref2 = true ? {
|
|
|
30273
30634
|
name: "1a5utpy",
|
|
30274
30635
|
styles: "gap:8px;flex-wrap:wrap;flex-grow:1"
|
|
30275
30636
|
} : 0;
|
|
30276
|
-
var
|
|
30637
|
+
var _ref3 = true ? {
|
|
30277
30638
|
name: "chpy5q",
|
|
30278
30639
|
styles: "with:auto;border:0 !important;padding:2px 0;height:32px;border-radius:0"
|
|
30279
30640
|
} : 0;
|
|
@@ -30384,7 +30745,7 @@ const FiltersMultiSelect = ({
|
|
|
30384
30745
|
name: "1sblf6",
|
|
30385
30746
|
styles: "width:auto!important;flex-grow:1"
|
|
30386
30747
|
} : 0),
|
|
30387
|
-
css:
|
|
30748
|
+
css: _ref3
|
|
30388
30749
|
})]
|
|
30389
30750
|
}), (0,jsx_runtime_namespaceObject.jsx)(Button_Button, {
|
|
30390
30751
|
"data-testid": "clear-all-filters",
|
|
@@ -41764,7 +42125,7 @@ var pads = {"-": "", "_": " ", "0": "0"},
|
|
|
41764
42125
|
percentRe = /^%/,
|
|
41765
42126
|
requoteRe = /[\\^$*+?|[\]().{}]/g;
|
|
41766
42127
|
|
|
41767
|
-
function
|
|
42128
|
+
function locale_pad(value, fill, width) {
|
|
41768
42129
|
var sign = value < 0 ? "-" : "",
|
|
41769
42130
|
string = (sign ? -value : value) + "",
|
|
41770
42131
|
length = string.length;
|
|
@@ -41884,23 +42245,23 @@ function parseUnixTimestampSeconds(d, string, i) {
|
|
|
41884
42245
|
}
|
|
41885
42246
|
|
|
41886
42247
|
function formatDayOfMonth(d, p) {
|
|
41887
|
-
return
|
|
42248
|
+
return locale_pad(d.getDate(), p, 2);
|
|
41888
42249
|
}
|
|
41889
42250
|
|
|
41890
42251
|
function formatHour24(d, p) {
|
|
41891
|
-
return
|
|
42252
|
+
return locale_pad(d.getHours(), p, 2);
|
|
41892
42253
|
}
|
|
41893
42254
|
|
|
41894
42255
|
function formatHour12(d, p) {
|
|
41895
|
-
return
|
|
42256
|
+
return locale_pad(d.getHours() % 12 || 12, p, 2);
|
|
41896
42257
|
}
|
|
41897
42258
|
|
|
41898
42259
|
function formatDayOfYear(d, p) {
|
|
41899
|
-
return
|
|
42260
|
+
return locale_pad(1 + src_day.count(src_year(d), d), p, 3);
|
|
41900
42261
|
}
|
|
41901
42262
|
|
|
41902
42263
|
function formatMilliseconds(d, p) {
|
|
41903
|
-
return
|
|
42264
|
+
return locale_pad(d.getMilliseconds(), p, 3);
|
|
41904
42265
|
}
|
|
41905
42266
|
|
|
41906
42267
|
function formatMicroseconds(d, p) {
|
|
@@ -41908,15 +42269,15 @@ function formatMicroseconds(d, p) {
|
|
|
41908
42269
|
}
|
|
41909
42270
|
|
|
41910
42271
|
function formatMonthNumber(d, p) {
|
|
41911
|
-
return
|
|
42272
|
+
return locale_pad(d.getMonth() + 1, p, 2);
|
|
41912
42273
|
}
|
|
41913
42274
|
|
|
41914
42275
|
function formatMinutes(d, p) {
|
|
41915
|
-
return
|
|
42276
|
+
return locale_pad(d.getMinutes(), p, 2);
|
|
41916
42277
|
}
|
|
41917
42278
|
|
|
41918
42279
|
function formatSeconds(d, p) {
|
|
41919
|
-
return
|
|
42280
|
+
return locale_pad(d.getSeconds(), p, 2);
|
|
41920
42281
|
}
|
|
41921
42282
|
|
|
41922
42283
|
function formatWeekdayNumberMonday(d) {
|
|
@@ -41925,7 +42286,7 @@ function formatWeekdayNumberMonday(d) {
|
|
|
41925
42286
|
}
|
|
41926
42287
|
|
|
41927
42288
|
function formatWeekNumberSunday(d, p) {
|
|
41928
|
-
return
|
|
42289
|
+
return locale_pad(sunday.count(src_year(d) - 1, d), p, 2);
|
|
41929
42290
|
}
|
|
41930
42291
|
|
|
41931
42292
|
function dISO(d) {
|
|
@@ -41935,7 +42296,7 @@ function dISO(d) {
|
|
|
41935
42296
|
|
|
41936
42297
|
function formatWeekNumberISO(d, p) {
|
|
41937
42298
|
d = dISO(d);
|
|
41938
|
-
return
|
|
42299
|
+
return locale_pad(thursday.count(src_year(d), d) + (src_year(d).getDay() === 4), p, 2);
|
|
41939
42300
|
}
|
|
41940
42301
|
|
|
41941
42302
|
function formatWeekdayNumberSunday(d) {
|
|
@@ -41943,53 +42304,53 @@ function formatWeekdayNumberSunday(d) {
|
|
|
41943
42304
|
}
|
|
41944
42305
|
|
|
41945
42306
|
function formatWeekNumberMonday(d, p) {
|
|
41946
|
-
return
|
|
42307
|
+
return locale_pad(monday.count(src_year(d) - 1, d), p, 2);
|
|
41947
42308
|
}
|
|
41948
42309
|
|
|
41949
42310
|
function formatYear(d, p) {
|
|
41950
|
-
return
|
|
42311
|
+
return locale_pad(d.getFullYear() % 100, p, 2);
|
|
41951
42312
|
}
|
|
41952
42313
|
|
|
41953
42314
|
function formatYearISO(d, p) {
|
|
41954
42315
|
d = dISO(d);
|
|
41955
|
-
return
|
|
42316
|
+
return locale_pad(d.getFullYear() % 100, p, 2);
|
|
41956
42317
|
}
|
|
41957
42318
|
|
|
41958
42319
|
function formatFullYear(d, p) {
|
|
41959
|
-
return
|
|
42320
|
+
return locale_pad(d.getFullYear() % 10000, p, 4);
|
|
41960
42321
|
}
|
|
41961
42322
|
|
|
41962
42323
|
function formatFullYearISO(d, p) {
|
|
41963
42324
|
var day = d.getDay();
|
|
41964
42325
|
d = (day >= 4 || day === 0) ? thursday(d) : thursday.ceil(d);
|
|
41965
|
-
return
|
|
42326
|
+
return locale_pad(d.getFullYear() % 10000, p, 4);
|
|
41966
42327
|
}
|
|
41967
42328
|
|
|
41968
42329
|
function formatZone(d) {
|
|
41969
42330
|
var z = d.getTimezoneOffset();
|
|
41970
42331
|
return (z > 0 ? "-" : (z *= -1, "+"))
|
|
41971
|
-
+
|
|
41972
|
-
+
|
|
42332
|
+
+ locale_pad(z / 60 | 0, "0", 2)
|
|
42333
|
+
+ locale_pad(z % 60, "0", 2);
|
|
41973
42334
|
}
|
|
41974
42335
|
|
|
41975
42336
|
function formatUTCDayOfMonth(d, p) {
|
|
41976
|
-
return
|
|
42337
|
+
return locale_pad(d.getUTCDate(), p, 2);
|
|
41977
42338
|
}
|
|
41978
42339
|
|
|
41979
42340
|
function formatUTCHour24(d, p) {
|
|
41980
|
-
return
|
|
42341
|
+
return locale_pad(d.getUTCHours(), p, 2);
|
|
41981
42342
|
}
|
|
41982
42343
|
|
|
41983
42344
|
function formatUTCHour12(d, p) {
|
|
41984
|
-
return
|
|
42345
|
+
return locale_pad(d.getUTCHours() % 12 || 12, p, 2);
|
|
41985
42346
|
}
|
|
41986
42347
|
|
|
41987
42348
|
function formatUTCDayOfYear(d, p) {
|
|
41988
|
-
return
|
|
42349
|
+
return locale_pad(1 + src_utcDay.count(src_utcYear(d), d), p, 3);
|
|
41989
42350
|
}
|
|
41990
42351
|
|
|
41991
42352
|
function formatUTCMilliseconds(d, p) {
|
|
41992
|
-
return
|
|
42353
|
+
return locale_pad(d.getUTCMilliseconds(), p, 3);
|
|
41993
42354
|
}
|
|
41994
42355
|
|
|
41995
42356
|
function formatUTCMicroseconds(d, p) {
|
|
@@ -41997,15 +42358,15 @@ function formatUTCMicroseconds(d, p) {
|
|
|
41997
42358
|
}
|
|
41998
42359
|
|
|
41999
42360
|
function formatUTCMonthNumber(d, p) {
|
|
42000
|
-
return
|
|
42361
|
+
return locale_pad(d.getUTCMonth() + 1, p, 2);
|
|
42001
42362
|
}
|
|
42002
42363
|
|
|
42003
42364
|
function formatUTCMinutes(d, p) {
|
|
42004
|
-
return
|
|
42365
|
+
return locale_pad(d.getUTCMinutes(), p, 2);
|
|
42005
42366
|
}
|
|
42006
42367
|
|
|
42007
42368
|
function formatUTCSeconds(d, p) {
|
|
42008
|
-
return
|
|
42369
|
+
return locale_pad(d.getUTCSeconds(), p, 2);
|
|
42009
42370
|
}
|
|
42010
42371
|
|
|
42011
42372
|
function formatUTCWeekdayNumberMonday(d) {
|
|
@@ -42014,7 +42375,7 @@ function formatUTCWeekdayNumberMonday(d) {
|
|
|
42014
42375
|
}
|
|
42015
42376
|
|
|
42016
42377
|
function formatUTCWeekNumberSunday(d, p) {
|
|
42017
|
-
return
|
|
42378
|
+
return locale_pad(utcSunday.count(src_utcYear(d) - 1, d), p, 2);
|
|
42018
42379
|
}
|
|
42019
42380
|
|
|
42020
42381
|
function UTCdISO(d) {
|
|
@@ -42024,7 +42385,7 @@ function UTCdISO(d) {
|
|
|
42024
42385
|
|
|
42025
42386
|
function formatUTCWeekNumberISO(d, p) {
|
|
42026
42387
|
d = UTCdISO(d);
|
|
42027
|
-
return
|
|
42388
|
+
return locale_pad(utcThursday.count(src_utcYear(d), d) + (src_utcYear(d).getUTCDay() === 4), p, 2);
|
|
42028
42389
|
}
|
|
42029
42390
|
|
|
42030
42391
|
function formatUTCWeekdayNumberSunday(d) {
|
|
@@ -42032,26 +42393,26 @@ function formatUTCWeekdayNumberSunday(d) {
|
|
|
42032
42393
|
}
|
|
42033
42394
|
|
|
42034
42395
|
function formatUTCWeekNumberMonday(d, p) {
|
|
42035
|
-
return
|
|
42396
|
+
return locale_pad(utcMonday.count(src_utcYear(d) - 1, d), p, 2);
|
|
42036
42397
|
}
|
|
42037
42398
|
|
|
42038
42399
|
function formatUTCYear(d, p) {
|
|
42039
|
-
return
|
|
42400
|
+
return locale_pad(d.getUTCFullYear() % 100, p, 2);
|
|
42040
42401
|
}
|
|
42041
42402
|
|
|
42042
42403
|
function formatUTCYearISO(d, p) {
|
|
42043
42404
|
d = UTCdISO(d);
|
|
42044
|
-
return
|
|
42405
|
+
return locale_pad(d.getUTCFullYear() % 100, p, 2);
|
|
42045
42406
|
}
|
|
42046
42407
|
|
|
42047
42408
|
function formatUTCFullYear(d, p) {
|
|
42048
|
-
return
|
|
42409
|
+
return locale_pad(d.getUTCFullYear() % 10000, p, 4);
|
|
42049
42410
|
}
|
|
42050
42411
|
|
|
42051
42412
|
function formatUTCFullYearISO(d, p) {
|
|
42052
42413
|
var day = d.getUTCDay();
|
|
42053
42414
|
d = (day >= 4 || day === 0) ? utcThursday(d) : utcThursday.ceil(d);
|
|
42054
|
-
return
|
|
42415
|
+
return locale_pad(d.getUTCFullYear() % 10000, p, 4);
|
|
42055
42416
|
}
|
|
42056
42417
|
|
|
42057
42418
|
function formatUTCZone() {
|
|
@@ -53992,10 +54353,47 @@ const ROWS_PER_PAGE_LIST = [{
|
|
|
53992
54353
|
}];
|
|
53993
54354
|
const DEFAULT_SELECTED_INDEX = 1;
|
|
53994
54355
|
const DEFAULT_PER_PAGE_VALUE = ROWS_PER_PAGE_LIST[DEFAULT_SELECTED_INDEX].value;
|
|
54356
|
+
;// ./src/components/Pagination/hooks/useControllableState.ts
|
|
54357
|
+
|
|
54358
|
+
/**
|
|
54359
|
+
* useControllableState - Backs a value that can be either controlled by a
|
|
54360
|
+
* parent (via `value`/`onChange`) or managed internally (via `defaultValue`).
|
|
54361
|
+
*
|
|
54362
|
+
* Mirrors the standard React controlled/uncontrolled input pattern: passing
|
|
54363
|
+
* `value` opts into controlled mode, where the returned value always matches
|
|
54364
|
+
* the prop and the setter only calls `onChange` (no internal state is
|
|
54365
|
+
* written). Omitting `value` falls back to internal state seeded from
|
|
54366
|
+
* `defaultValue`.
|
|
54367
|
+
*
|
|
54368
|
+
* @internal
|
|
54369
|
+
*/
|
|
54370
|
+
const useControllableState = ({
|
|
54371
|
+
value: controlledValue,
|
|
54372
|
+
defaultValue,
|
|
54373
|
+
onChange,
|
|
54374
|
+
name = 'value'
|
|
54375
|
+
}) => {
|
|
54376
|
+
const [uncontrolledValue, setUncontrolledValue] = (0,external_react_namespaceObject.useState)(defaultValue);
|
|
54377
|
+
const isControlled = controlledValue !== undefined;
|
|
54378
|
+
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
54379
|
+
const isControlledRef = (0,external_react_namespaceObject.useRef)(isControlled);
|
|
54380
|
+
if (false) // removed by dead control flow
|
|
54381
|
+
{}
|
|
54382
|
+
isControlledRef.current = isControlled;
|
|
54383
|
+
const setValue = (0,external_react_namespaceObject.useCallback)(next => {
|
|
54384
|
+
const resolved = typeof next === 'function' ? next(value) : next;
|
|
54385
|
+
if (!isControlled) {
|
|
54386
|
+
setUncontrolledValue(resolved);
|
|
54387
|
+
}
|
|
54388
|
+
onChange?.(resolved);
|
|
54389
|
+
}, [isControlled, onChange, value]);
|
|
54390
|
+
return [value, setValue];
|
|
54391
|
+
};
|
|
53995
54392
|
;// ./src/components/Pagination/PaginationContext.tsx
|
|
53996
54393
|
|
|
53997
54394
|
|
|
53998
54395
|
|
|
54396
|
+
|
|
53999
54397
|
/**
|
|
54000
54398
|
* Pagination context
|
|
54001
54399
|
* Provides page state and navigation functions to child components
|
|
@@ -54023,21 +54421,53 @@ const usePaginationContext = () => (0,external_react_namespaceObject.useContext)
|
|
|
54023
54421
|
*
|
|
54024
54422
|
* @example
|
|
54025
54423
|
* ```tsx
|
|
54424
|
+
* // Uncontrolled
|
|
54026
54425
|
* <PaginationContextProvider selectedPage={1} defaultPerPage={25}>
|
|
54027
54426
|
* <Pagination pagesCount={10} />
|
|
54028
54427
|
* </PaginationContextProvider>
|
|
54029
54428
|
* ```
|
|
54030
54429
|
*
|
|
54430
|
+
* @example
|
|
54431
|
+
* ```tsx
|
|
54432
|
+
* // Controlled - parent owns page/perPage state
|
|
54433
|
+
* const [page, setPage] = useState(1);
|
|
54434
|
+
* <PaginationContextProvider page={page} onPageChange={setPage}>
|
|
54435
|
+
* <Pagination pagesCount={10} />
|
|
54436
|
+
* </PaginationContextProvider>
|
|
54437
|
+
* ```
|
|
54438
|
+
*
|
|
54031
54439
|
* @see {@link Pagination} - Child component that uses this context
|
|
54032
54440
|
* @see {@link usePaginationContext} - Hook to access context values
|
|
54033
54441
|
*/
|
|
54034
54442
|
const PaginationContextProvider = ({
|
|
54035
54443
|
selectedPage,
|
|
54036
54444
|
defaultPerPage = DEFAULT_PER_PAGE_VALUE,
|
|
54445
|
+
page: controlledPage,
|
|
54446
|
+
perPage: controlledPerPage,
|
|
54447
|
+
onPageChange,
|
|
54448
|
+
onPerPageChange,
|
|
54037
54449
|
children
|
|
54038
54450
|
}) => {
|
|
54039
|
-
|
|
54040
|
-
|
|
54451
|
+
// `page` can be `undefined` (no page selected yet), but the public
|
|
54452
|
+
// `onPageChange` callback only ever needs to handle real page numbers -
|
|
54453
|
+
// Pagination never navigates to an undefined page.
|
|
54454
|
+
const handlePageChange = (0,external_react_namespaceObject.useCallback)(value => {
|
|
54455
|
+
if (value !== undefined) {
|
|
54456
|
+
onPageChange?.(value);
|
|
54457
|
+
}
|
|
54458
|
+
}, [onPageChange]);
|
|
54459
|
+
const [page, setPage] = useControllableState({
|
|
54460
|
+
value: controlledPage,
|
|
54461
|
+
defaultValue: selectedPage,
|
|
54462
|
+
onChange: handlePageChange,
|
|
54463
|
+
name: 'page'
|
|
54464
|
+
});
|
|
54465
|
+
const [perPage, setPerPage] = useControllableState({
|
|
54466
|
+
value: controlledPerPage,
|
|
54467
|
+
defaultValue: defaultPerPage,
|
|
54468
|
+
onChange: onPerPageChange,
|
|
54469
|
+
name: 'perPage'
|
|
54470
|
+
});
|
|
54041
54471
|
return (0,jsx_runtime_namespaceObject.jsx)(PaginationContext.Provider, {
|
|
54042
54472
|
value: {
|
|
54043
54473
|
page,
|
|
@@ -54100,7 +54530,7 @@ const PaginationContextProvider = ({
|
|
|
54100
54530
|
*/
|
|
54101
54531
|
|
|
54102
54532
|
const RowsPerPageDropdown = ({
|
|
54103
|
-
selectedItem
|
|
54533
|
+
selectedItem,
|
|
54104
54534
|
rowsPerPageList = ROWS_PER_PAGE_LIST,
|
|
54105
54535
|
rowsPerPageText = 'Rows per page',
|
|
54106
54536
|
dropdownPosition,
|
|
@@ -54108,11 +54538,12 @@ const RowsPerPageDropdown = ({
|
|
|
54108
54538
|
}) => {
|
|
54109
54539
|
const theme = (0,react_namespaceObject.useTheme)();
|
|
54110
54540
|
const {
|
|
54541
|
+
perPage,
|
|
54111
54542
|
setPerPage
|
|
54112
54543
|
} = usePaginationContext();
|
|
54113
54544
|
const selectedItemForDropdown = rowsPerPageList.find(({
|
|
54114
54545
|
value
|
|
54115
|
-
}) => value === selectedItem) || rowsPerPageList[0];
|
|
54546
|
+
}) => value === (selectedItem ?? perPage)) || rowsPerPageList[0];
|
|
54116
54547
|
const onChange = ({
|
|
54117
54548
|
value
|
|
54118
54549
|
}) => {
|