@economic/taco 0.0.6-alpha.0 → 0.0.10-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/Accordion.d.ts +9 -9
- package/dist/components/Backdrop/Backdrop.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +11 -10
- package/dist/components/Dialog/Context.d.ts +2 -1
- package/dist/components/Dialog/Dialog.d.ts +20 -10
- package/dist/components/Dialog/components/Content.d.ts +9 -8
- package/dist/components/Hanger/Hanger.d.ts +4 -1
- package/dist/components/IconButton/IconButton.d.ts +5 -1
- package/dist/components/Menu/Menu.d.ts +3 -1
- package/dist/components/Popover/Popover.d.ts +4 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/esm/components/Accordion/Accordion.js +14 -9
- package/dist/esm/components/Accordion/Accordion.js.map +1 -1
- package/dist/esm/components/Backdrop/Backdrop.js +5 -4
- package/dist/esm/components/Backdrop/Backdrop.js.map +1 -1
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Button/util.js +20 -10
- package/dist/esm/components/Button/util.js.map +1 -1
- package/dist/esm/components/Calendar/Calendar.js +1 -1
- package/dist/esm/components/Combobox/Combobox.js +1 -1
- package/dist/esm/components/Datepicker/Datepicker.js +2 -2
- package/dist/esm/components/Dialog/Context.js +2 -1
- package/dist/esm/components/Dialog/Context.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +18 -16
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Dialog/components/Content.js +46 -19
- package/dist/esm/components/Dialog/components/Content.js.map +1 -1
- package/dist/esm/components/Dialog/components/Drawer.js +3 -1
- package/dist/esm/components/Dialog/components/Drawer.js.map +1 -1
- package/dist/esm/components/Dialog/components/Extra.js +3 -1
- package/dist/esm/components/Dialog/components/Extra.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js +6 -6
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/components/Input/Input.js +1 -1
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/components/Menu/Menu.js +8 -2
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/Pagination/PageNumbers.js +1 -1
- package/dist/esm/components/Pagination/Pagination.js +1 -1
- package/dist/esm/components/Popover/Popover.js +3 -4
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +7 -7
- package/dist/esm/components/Table/components/Table.js +1 -2
- package/dist/esm/components/Table/components/Table.js.map +1 -1
- package/dist/esm/components/Table/components/WindowedTable.js +0 -1
- package/dist/esm/components/Table/components/WindowedTable.js.map +1 -1
- package/dist/esm/components/Table/hooks/useTable.js +4 -1
- package/dist/esm/components/Table/hooks/useTable.js.map +1 -1
- package/dist/esm/components/Toast/Toast.js +1 -1
- package/dist/esm/components/Tour/Tour.js +2 -2
- package/dist/esm/index.css +45 -45
- package/dist/esm/index.js +7 -7
- package/dist/index.css +45 -45
- package/dist/taco.cjs.development.js +1850 -1793
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +1073 -542
@@ -9,16 +9,16 @@ var React__default = _interopDefault(React);
|
|
9
9
|
var cn = _interopDefault(require('classnames'));
|
10
10
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
11
11
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
12
|
-
var
|
12
|
+
var ReactDayPicker = _interopDefault(require('react-day-picker'));
|
13
13
|
var uuid = require('uuid');
|
14
14
|
var framerMotion = require('framer-motion');
|
15
|
-
var DialogPrimitive = require('@radix-ui/react-dialog');
|
16
|
-
var interactions = require('@react-aria/interactions');
|
17
|
-
var ReactDayPicker = _interopDefault(require('react-day-picker'));
|
18
15
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
16
|
+
var PopoverPrimitive = require('@radix-ui/react-popover');
|
19
17
|
var keycode = _interopDefault(require('keycode'));
|
20
18
|
var debounce = _interopDefault(require('lodash/debounce'));
|
21
19
|
var dateFns = require('date-fns');
|
20
|
+
var DialogPrimitive = require('@radix-ui/react-dialog');
|
21
|
+
var interactions = require('@react-aria/interactions');
|
22
22
|
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
23
23
|
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
24
24
|
var reactTable = require('react-table');
|
@@ -3108,7 +3108,9 @@ var Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
|
3108
3108
|
|
3109
3109
|
var _excluded$1 = ["id"],
|
3110
3110
|
_excluded2 = ["id", "defaultId", "onChange", "as"];
|
3111
|
-
var AccordionContext = /*#__PURE__*/React__default.createContext({
|
3111
|
+
var AccordionContext = /*#__PURE__*/React__default.createContext({
|
3112
|
+
as: 'h2'
|
3113
|
+
});
|
3112
3114
|
var StyledTrigger = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
3113
3115
|
var isExpanded = !!props['aria-expanded'];
|
3114
3116
|
var className = cn('w-full inline-flex justify-between items-center align-middle', 'focus:rounded-sm focus:border-blue focus:yt-focus', props.className);
|
@@ -3123,8 +3125,7 @@ var Trigger = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
|
3123
3125
|
var children = props.children;
|
3124
3126
|
|
3125
3127
|
var _React$useContext = React__default.useContext(AccordionContext),
|
3126
|
-
|
3127
|
-
Heading = _React$useContext$as === void 0 ? 'h2' : _React$useContext$as;
|
3128
|
+
Heading = _React$useContext.as;
|
3128
3129
|
|
3129
3130
|
return React__default.createElement(AccordionPrimitive.Header, {
|
3130
3131
|
asChild: true
|
@@ -3154,9 +3155,15 @@ var Accordion = function Accordion(props) {
|
|
3154
3155
|
var id = props.id,
|
3155
3156
|
defaultId = props.defaultId,
|
3156
3157
|
onChange = props.onChange,
|
3157
|
-
as = props.as,
|
3158
|
+
_props$as = props.as,
|
3159
|
+
as = _props$as === void 0 ? 'h2' : _props$as,
|
3158
3160
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
3159
3161
|
|
3162
|
+
var context = React__default.useMemo(function () {
|
3163
|
+
return {
|
3164
|
+
as: as
|
3165
|
+
};
|
3166
|
+
}, [as]);
|
3160
3167
|
var valueProps;
|
3161
3168
|
|
3162
3169
|
if (defaultId) {
|
@@ -3173,25 +3180,24 @@ var Accordion = function Accordion(props) {
|
|
3173
3180
|
var type = Array.isArray(valueProps.defaultValue) || Array.isArray(valueProps.value) ? 'multiple' : 'single';
|
3174
3181
|
var className = cn('divide-y divide-grey', props.className);
|
3175
3182
|
return React__default.createElement(AccordionContext.Provider, {
|
3176
|
-
value:
|
3177
|
-
as: as
|
3178
|
-
}
|
3183
|
+
value: context
|
3179
3184
|
}, React__default.createElement(AccordionPrimitive.Root, Object.assign({}, otherProps, valueProps, {
|
3180
3185
|
"data-taco": "accordion",
|
3181
|
-
|
3182
|
-
|
3186
|
+
className: className,
|
3187
|
+
type: type
|
3183
3188
|
})));
|
3184
3189
|
};
|
3185
3190
|
Accordion.Item = Item;
|
3186
3191
|
Accordion.Trigger = Trigger;
|
3187
3192
|
Accordion.Content = Content;
|
3188
3193
|
|
3189
|
-
var Backdrop = function Backdrop(props) {
|
3194
|
+
var Backdrop = /*#__PURE__*/React.forwardRef(function Backdrop(props, ref) {
|
3190
3195
|
var className = cn('fixed inset-0 cursor-default overflow-y-auto bg-[rgba(50,46,62,0.8)] animate-[fade-in_150ms] aria-hidden:hidden', props.className);
|
3191
3196
|
return React.createElement("div", Object.assign({}, props, {
|
3192
|
-
className: className
|
3197
|
+
className: className,
|
3198
|
+
ref: ref
|
3193
3199
|
}));
|
3194
|
-
};
|
3200
|
+
});
|
3195
3201
|
|
3196
3202
|
var VisuallyHidden = /*#__PURE__*/React.forwardRef(function VisuallyHidden(props, ref) {
|
3197
3203
|
return React.createElement("span", Object.assign({}, props, {
|
@@ -3341,42 +3347,143 @@ var Tooltip = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
3341
3347
|
}), title)));
|
3342
3348
|
});
|
3343
3349
|
|
3344
|
-
var _excluded$5 = ["
|
3345
|
-
var
|
3346
|
-
return
|
3347
|
-
|
3348
|
-
|
3349
|
-
|
3350
|
-
|
3351
|
-
|
3352
|
-
|
3353
|
-
|
3354
|
-
|
3355
|
-
|
3356
|
-
|
3357
|
-
|
3358
|
-
|
3359
|
-
|
3360
|
-
|
3361
|
-
|
3362
|
-
|
3363
|
-
|
3364
|
-
|
3365
|
-
|
3366
|
-
|
3367
|
-
|
3350
|
+
var _excluded$5 = ["dialog", "hanger", "menu", "popover", "tooltip"];
|
3351
|
+
var getButtonClasses = function getButtonClasses() {
|
3352
|
+
return 'min-h-[theme(spacing.8)] min-w-[theme(spacing.8)] leading-6 inline-flex items-center justify-center transition-all delay-100 ease-in border';
|
3353
|
+
};
|
3354
|
+
var getAppearanceClasses = function getAppearanceClasses(value, icon) {
|
3355
|
+
if (icon === void 0) {
|
3356
|
+
icon = false;
|
3357
|
+
}
|
3358
|
+
|
3359
|
+
switch (value) {
|
3360
|
+
case 'primary':
|
3361
|
+
return "yt-blue-solid border-blue\n focus:bg-blue focus:text-white focus:yt-focus\n active:bg-blue-dark active:text-white \n hover:bg-blue-light hover:border-blue-light hover:text-white\n hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white\n disabled:hover:yt-blue-solid";
|
3362
|
+
|
3363
|
+
case 'danger':
|
3364
|
+
return "yt-red-solid border-red\n focus:bg-red focus:text-white focus:yt-focus-red\n active:bg-red-dark active:text-white \n hover:bg-red-light hover:text-white\n hover:focus:bg-red-light hover:focus:text-white\n disabled:hover:yt-red-solid";
|
3365
|
+
|
3366
|
+
case 'ghost':
|
3367
|
+
return "yt-blue-inverted\n focus:bg-transparent focus:text-blue focus:yt-focus\n active:bg-blue-lightest active:border-blue active:text-blue-dark \n hover:bg-blue-lightest hover:border-blue-light hover:text-blue-light\n hover:focus:bg-blue-lightest hover:focus:border-blue-light hover:focus:text-blue-light\n disabled:hover:yt-blue-inverted";
|
3368
|
+
|
3369
|
+
case 'discrete':
|
3370
|
+
{
|
3371
|
+
if (icon) {
|
3372
|
+
return "bg-transparent text-black border-transparent\n focus:text-black focus:yt-focus\n active:text-black\n hover:text-grey-darkest\n hover:focus:text-grey-darkest\n disabled:hover:yt-transparent";
|
3373
|
+
}
|
3374
|
+
|
3375
|
+
return "yt-transparent border-transparent\n focus:text-blue focus:yt-focus\n active:text-blue-dark\n hover:text-blue-light\n hover:focus:text-blue-light\n disabled:hover:yt-transparent";
|
3376
|
+
}
|
3377
|
+
|
3378
|
+
default:
|
3379
|
+
return "yt-grey-solid border-grey\n focus:bg-grey focus:yt-focus\n active:bg-grey-dark active:text-black\n hover:bg-grey-light hover:text-grey-darkest\n hover:focus:bg-grey-light hover:focus:text-grey-darkest\n disabled:hover:yt-grey-solid";
|
3380
|
+
}
|
3381
|
+
};
|
3382
|
+
var createButton = function createButton(props, className, ref) {
|
3383
|
+
var dialog = props.dialog,
|
3384
|
+
hanger = props.hanger,
|
3385
|
+
menu = props.menu,
|
3386
|
+
popover = props.popover,
|
3387
|
+
tooltip = props.tooltip,
|
3368
3388
|
otherProps = _objectWithoutPropertiesLoose(props, _excluded$5);
|
3369
3389
|
|
3370
|
-
var
|
3371
|
-
return React.createElement(PopoverPrimitive.Content, Object.assign({}, otherProps, {
|
3390
|
+
var button = React__default.createElement(Button, Object.assign({}, otherProps, {
|
3372
3391
|
className: className,
|
3373
|
-
side: side,
|
3374
|
-
sideOffset: 1,
|
3375
|
-
style: _extends({}, props.style, {
|
3376
|
-
zIndex: 996
|
3377
|
-
}),
|
3378
3392
|
ref: ref
|
3379
3393
|
}));
|
3394
|
+
|
3395
|
+
if (typeof dialog === 'function') {
|
3396
|
+
button = dialog({
|
3397
|
+
trigger: button
|
3398
|
+
});
|
3399
|
+
}
|
3400
|
+
|
3401
|
+
if (typeof hanger === 'function') {
|
3402
|
+
button = hanger({
|
3403
|
+
anchor: button
|
3404
|
+
});
|
3405
|
+
}
|
3406
|
+
|
3407
|
+
if (typeof menu === 'function') {
|
3408
|
+
button = menu({
|
3409
|
+
trigger: button
|
3410
|
+
});
|
3411
|
+
}
|
3412
|
+
|
3413
|
+
if (typeof popover === 'function') {
|
3414
|
+
button = popover({
|
3415
|
+
trigger: button
|
3416
|
+
});
|
3417
|
+
}
|
3418
|
+
|
3419
|
+
if (tooltip) {
|
3420
|
+
button = React__default.createElement(Tooltip, {
|
3421
|
+
title: tooltip
|
3422
|
+
}, button);
|
3423
|
+
}
|
3424
|
+
|
3425
|
+
return button;
|
3426
|
+
};
|
3427
|
+
|
3428
|
+
var _excluded$6 = ["appearance", "icon", "rounded"];
|
3429
|
+
var IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref) {
|
3430
|
+
var appearance = props.appearance,
|
3431
|
+
icon = props.icon,
|
3432
|
+
_props$rounded = props.rounded,
|
3433
|
+
rounded = _props$rounded === void 0 ? false : _props$rounded,
|
3434
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$6);
|
3435
|
+
|
3436
|
+
var className = cn(getButtonClasses(), getAppearanceClasses(appearance, true), {
|
3437
|
+
'rounded-full': rounded,
|
3438
|
+
rounded: !rounded,
|
3439
|
+
'cursor-not-allowed opacity-50': props.disabled,
|
3440
|
+
'focus:yt-focus active:focus:yt-focus': !props.disabled
|
3441
|
+
}, props.className);
|
3442
|
+
|
3443
|
+
if (!icon) {
|
3444
|
+
return null;
|
3445
|
+
}
|
3446
|
+
|
3447
|
+
return createButton(_extends({}, otherProps, {
|
3448
|
+
children: React.createElement(Icon, {
|
3449
|
+
name: icon,
|
3450
|
+
className: "m-0 p-0"
|
3451
|
+
}),
|
3452
|
+
'data-taco': 'icon-button'
|
3453
|
+
}), className, ref);
|
3454
|
+
});
|
3455
|
+
|
3456
|
+
var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
3457
|
+
var children = props.children,
|
3458
|
+
state = props.state,
|
3459
|
+
onClose = props.onClose;
|
3460
|
+
var className = cn('bg-white relative flex items-center px-4 h-12 shadow-lg z-10', props.className);
|
3461
|
+
return React.createElement("div", {
|
3462
|
+
className: className,
|
3463
|
+
"data-taco": "banner",
|
3464
|
+
ref: ref
|
3465
|
+
}, getBannerIcon(state), children, onClose ? React.createElement(IconButton, {
|
3466
|
+
className: "ml-auto",
|
3467
|
+
icon: "close",
|
3468
|
+
appearance: "discrete",
|
3469
|
+
onClick: onClose
|
3470
|
+
}) : null);
|
3471
|
+
});
|
3472
|
+
|
3473
|
+
var _excluded$7 = ["appearance", "fluid"];
|
3474
|
+
var Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
3475
|
+
var appearance = props.appearance,
|
3476
|
+
fluid = props.fluid,
|
3477
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$7);
|
3478
|
+
|
3479
|
+
var className = cn(getButtonClasses(), getAppearanceClasses(appearance), 'rounded px-3', {
|
3480
|
+
'cursor-not-allowed opacity-50': props.disabled,
|
3481
|
+
'focus:yt-focus active:focus:yt-focus': !props.disabled,
|
3482
|
+
'w-full': fluid
|
3483
|
+
}, props.className);
|
3484
|
+
return createButton(_extends({}, otherProps, {
|
3485
|
+
'data-taco': 'button'
|
3486
|
+
}), className, ref);
|
3380
3487
|
});
|
3381
3488
|
|
3382
3489
|
function useTimer(duration, callback) {
|
@@ -3433,12 +3540,12 @@ function useTimer(duration, callback) {
|
|
3433
3540
|
};
|
3434
3541
|
}
|
3435
3542
|
|
3436
|
-
var _excluded$
|
3543
|
+
var _excluded$8 = ["delay", "label"];
|
3437
3544
|
var Spinner$1 = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
3438
3545
|
var _props$delay = props.delay,
|
3439
3546
|
delay = _props$delay === void 0 ? 500 : _props$delay,
|
3440
3547
|
label = props.label,
|
3441
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
3548
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$8);
|
3442
3549
|
|
3443
3550
|
var _React$useState = React__default.useState(!delay),
|
3444
3551
|
visible = _React$useState[0],
|
@@ -3521,13 +3628,13 @@ var getBadgeIcon = function getBadgeIcon(type) {
|
|
3521
3628
|
}
|
3522
3629
|
};
|
3523
3630
|
|
3524
|
-
var _excluded$
|
3631
|
+
var _excluded$9 = ["content", "lastUpdated", "onClose", "options"];
|
3525
3632
|
var Toast = function Toast(_ref) {
|
3526
3633
|
var content = _ref.content,
|
3527
3634
|
lastUpdated = _ref.lastUpdated,
|
3528
3635
|
handleClose = _ref.onClose,
|
3529
3636
|
options = _ref.options,
|
3530
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
3637
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
3531
3638
|
|
3532
3639
|
var _useLocalization = useLocalization(),
|
3533
3640
|
texts = _useLocalization.texts;
|
@@ -3590,7 +3697,7 @@ var Toast = function Toast(_ref) {
|
|
3590
3697
|
}));
|
3591
3698
|
};
|
3592
3699
|
|
3593
|
-
var _excluded$
|
3700
|
+
var _excluded$a = ["children"];
|
3594
3701
|
var DEFAULT_AUTO_CLOSE_TIMEOUT = 7500;
|
3595
3702
|
var ToastContext = /*#__PURE__*/React.createContext({});
|
3596
3703
|
|
@@ -3616,7 +3723,7 @@ var insertToastWithoutDuplicates = function insertToastWithoutDuplicates(current
|
|
3616
3723
|
|
3617
3724
|
var ToastProvider = function ToastProvider(_ref) {
|
3618
3725
|
var children = _ref.children,
|
3619
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
3726
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
|
3620
3727
|
|
3621
3728
|
var _React$useState = React.useState([]),
|
3622
3729
|
toasts = _React$useState[0],
|
@@ -3877,112 +3984,195 @@ var useLocalization = function useLocalization() {
|
|
3877
3984
|
return useTaco().localization;
|
3878
3985
|
};
|
3879
3986
|
|
3880
|
-
|
3881
|
-
return function (value) {
|
3882
|
-
refs.forEach(function (ref) {
|
3883
|
-
if (typeof ref === 'function') {
|
3884
|
-
ref(value);
|
3885
|
-
} else if (ref != null) {
|
3886
|
-
ref.current = value;
|
3887
|
-
}
|
3888
|
-
});
|
3889
|
-
};
|
3890
|
-
}
|
3987
|
+
var _excluded$b = ["onChange", "value"];
|
3891
3988
|
|
3892
|
-
var
|
3893
|
-
|
3894
|
-
|
3895
|
-
|
3896
|
-
}
|
3897
|
-
var Anchor = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
3898
|
-
var _props$children;
|
3989
|
+
var renderDay = function renderDay(day, modifiers) {
|
3990
|
+
return modifiers.disabled ? React.createElement("span", {
|
3991
|
+
className: "dot"
|
3992
|
+
}) : day.getDate();
|
3993
|
+
};
|
3899
3994
|
|
3900
|
-
|
3901
|
-
|
3995
|
+
var thisYear = /*#__PURE__*/new Date().getFullYear();
|
3996
|
+
var years = [];
|
3902
3997
|
|
3903
|
-
|
3904
|
-
|
3905
|
-
|
3906
|
-
}
|
3998
|
+
for (var i = thisYear - 10; i <= thisYear + 10; i += 1) {
|
3999
|
+
years.push(i);
|
4000
|
+
}
|
3907
4001
|
|
3908
|
-
|
3909
|
-
|
3910
|
-
|
3911
|
-
|
3912
|
-
|
3913
|
-
|
3914
|
-
var Content$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
3915
|
-
var _useLocalization = useLocalization(),
|
3916
|
-
texts = _useLocalization.texts;
|
4002
|
+
var Navbar = /*#__PURE__*/React.memo(function (_ref) {
|
4003
|
+
var onMonthChange = _ref.onMonthChange,
|
4004
|
+
onNextClick = _ref.onNextClick,
|
4005
|
+
onPreviousClick = _ref.onPreviousClick,
|
4006
|
+
_ref$value = _ref.value,
|
4007
|
+
value = _ref$value === void 0 ? new Date() : _ref$value;
|
3917
4008
|
|
3918
|
-
var
|
4009
|
+
var _useLocalization = useLocalization(),
|
4010
|
+
_useLocalization$text = _useLocalization.texts.calendar,
|
4011
|
+
actions = _useLocalization$text.actions,
|
4012
|
+
months = _useLocalization$text.months;
|
3919
4013
|
|
3920
|
-
var
|
3921
|
-
event.
|
4014
|
+
var handleChange = function handleChange(event) {
|
4015
|
+
var _event$target$form = event.target.form,
|
4016
|
+
year = _event$target$form.year,
|
4017
|
+
month = _event$target$form.month;
|
4018
|
+
onMonthChange(new Date(year.value, month.value));
|
3922
4019
|
};
|
3923
4020
|
|
3924
|
-
return React.createElement(
|
3925
|
-
className:
|
3926
|
-
|
3927
|
-
|
3928
|
-
|
3929
|
-
|
3930
|
-
|
3931
|
-
|
3932
|
-
|
3933
|
-
|
3934
|
-
|
3935
|
-
|
3936
|
-
|
3937
|
-
|
3938
|
-
|
3939
|
-
|
3940
|
-
|
3941
|
-
|
3942
|
-
|
3943
|
-
|
3944
|
-
|
3945
|
-
|
3946
|
-
|
3947
|
-
|
3948
|
-
|
3949
|
-
|
3950
|
-
|
3951
|
-
|
3952
|
-
|
3953
|
-
|
3954
|
-
}, React.createElement(
|
3955
|
-
|
3956
|
-
|
3957
|
-
|
4021
|
+
return React.createElement("div", {
|
4022
|
+
className: "flex justify-between items-center mb-2"
|
4023
|
+
}, React.createElement("form", {
|
4024
|
+
className: "inline-flex space-x-1"
|
4025
|
+
}, React.createElement("select", {
|
4026
|
+
className: "h-8 px-2",
|
4027
|
+
name: "month",
|
4028
|
+
onChange: handleChange,
|
4029
|
+
value: value.getMonth()
|
4030
|
+
}, months.map(function (month, i) {
|
4031
|
+
return React.createElement("option", {
|
4032
|
+
value: i
|
4033
|
+
}, month);
|
4034
|
+
})), React.createElement("select", {
|
4035
|
+
className: "h-8 px-2",
|
4036
|
+
name: "year",
|
4037
|
+
onChange: handleChange,
|
4038
|
+
value: value.getFullYear()
|
4039
|
+
}, years.map(function (year) {
|
4040
|
+
return React.createElement("option", {
|
4041
|
+
value: year
|
4042
|
+
}, String(year));
|
4043
|
+
}))), React.createElement("div", null, React.createElement(IconButton, {
|
4044
|
+
appearance: "discrete",
|
4045
|
+
icon: "chevron-left",
|
4046
|
+
"aria-label": actions.previousMonth,
|
4047
|
+
onClick: function onClick() {
|
4048
|
+
return onPreviousClick();
|
4049
|
+
},
|
4050
|
+
rounded: true
|
4051
|
+
}), React.createElement(IconButton, {
|
4052
|
+
appearance: "discrete",
|
4053
|
+
icon: "chevron-right",
|
4054
|
+
"aria-label": actions.nextMonth,
|
4055
|
+
onClick: function onClick() {
|
4056
|
+
return onNextClick();
|
4057
|
+
},
|
4058
|
+
rounded: true
|
4059
|
+
})));
|
3958
4060
|
});
|
3959
|
-
|
3960
|
-
|
4061
|
+
var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
4062
|
+
var handleChange = props.onChange,
|
4063
|
+
value = props.value,
|
4064
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
3961
4065
|
|
3962
|
-
|
3963
|
-
|
3964
|
-
|
3965
|
-
|
3966
|
-
|
3967
|
-
|
3968
|
-
|
3969
|
-
|
3970
|
-
|
3971
|
-
|
3972
|
-
|
3973
|
-
|
3974
|
-
|
4066
|
+
var _useLocalization2 = useLocalization(),
|
4067
|
+
locale = _useLocalization2.locale,
|
4068
|
+
texts = _useLocalization2.texts;
|
4069
|
+
|
4070
|
+
var _React$useState = React.useState(value !== null && value !== void 0 ? value : new Date()),
|
4071
|
+
visibleMonth = _React$useState[0],
|
4072
|
+
setVisibleMonth = _React$useState[1];
|
4073
|
+
|
4074
|
+
React.useEffect(function () {
|
4075
|
+
if (visibleMonth !== value) {
|
4076
|
+
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
4077
|
+
}
|
4078
|
+
}, [value]);
|
4079
|
+
|
4080
|
+
var handleDayClick = function handleDayClick(date, modifiers, event) {
|
4081
|
+
if (modifiers.outside || modifiers.disabled) {
|
4082
|
+
return;
|
4083
|
+
}
|
4084
|
+
|
4085
|
+
handleChange(date, event);
|
4086
|
+
};
|
4087
|
+
|
4088
|
+
var handleCalendarClickToday = function handleCalendarClickToday() {
|
4089
|
+
var today = new Date(); // set to midday to avoid UTC offset causing dates to be mismatched server side
|
4090
|
+
|
4091
|
+
today.setHours(12);
|
4092
|
+
today.setMinutes(0);
|
4093
|
+
today.setSeconds(0);
|
4094
|
+
handleChange(today);
|
4095
|
+
};
|
4096
|
+
|
4097
|
+
var className = cn('flex bg-white text-xs p-4', otherProps.className);
|
4098
|
+
return React.createElement("div", {
|
4099
|
+
"data-taco": "calendar"
|
4100
|
+
}, React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
4101
|
+
className: className,
|
4102
|
+
month: visibleMonth,
|
4103
|
+
selectedDays: value,
|
4104
|
+
locale: locale.substring(0, 2),
|
4105
|
+
firstDayOfWeek: 1,
|
4106
|
+
months: texts.calendar.months,
|
4107
|
+
weekdaysShort: texts.calendar.weekdaysShort,
|
4108
|
+
navbarElement: function navbarElement(navProps) {
|
4109
|
+
return React.createElement(Navbar, Object.assign({}, navProps, {
|
4110
|
+
onMonthChange: setVisibleMonth,
|
4111
|
+
value: visibleMonth
|
4112
|
+
}));
|
4113
|
+
},
|
4114
|
+
onDayClick: handleDayClick,
|
4115
|
+
onMonthChange: setVisibleMonth,
|
4116
|
+
onTodayButtonClick: handleCalendarClickToday,
|
4117
|
+
captionElement: function captionElement() {
|
4118
|
+
return null;
|
4119
|
+
},
|
4120
|
+
todayButton: texts.calendar.actions.today,
|
4121
|
+
showOutsideDays: true,
|
4122
|
+
renderDay: renderDay,
|
4123
|
+
numberOfMonths: 1,
|
4124
|
+
ref: ref
|
4125
|
+
})));
|
3975
4126
|
});
|
3976
|
-
var useCurrentDialog = function useCurrentDialog() {
|
3977
|
-
return React.useContext(DialogContext);
|
3978
|
-
};
|
3979
4127
|
|
3980
|
-
var
|
3981
|
-
|
3982
|
-
|
3983
|
-
|
3984
|
-
|
3985
|
-
|
4128
|
+
var _excluded$c = ["checked", "highlighted", "indeterminate", "invalid", "label", "onChange"];
|
4129
|
+
var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
4130
|
+
var checked = props.checked,
|
4131
|
+
highlighted = props.highlighted,
|
4132
|
+
indeterminate = props.indeterminate,
|
4133
|
+
invalid = props.invalid,
|
4134
|
+
label = props.label,
|
4135
|
+
onChange = props.onChange,
|
4136
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
4137
|
+
|
4138
|
+
var className = cn('h-5 w-5 border rounded text-sm', {
|
4139
|
+
'mr-2': !!label,
|
4140
|
+
'border-grey-dark text-blue focus:border-blue focus:yt-focus': !props.disabled && !invalid,
|
4141
|
+
'border-grey text-blue-light cursor-not-allowed': props.disabled,
|
4142
|
+
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
4143
|
+
'border-red text-red focus:border-red focus:yt-focus-red': invalid && !props.disabled
|
4144
|
+
}, props.className);
|
4145
|
+
var handleChange;
|
4146
|
+
|
4147
|
+
if (onChange) {
|
4148
|
+
handleChange = function handleChange(checked) {
|
4149
|
+
return onChange(checked === 'indeterminate' ? false : checked);
|
4150
|
+
};
|
4151
|
+
}
|
4152
|
+
|
4153
|
+
var element = React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, {
|
4154
|
+
"data-taco": "checkbox",
|
4155
|
+
checked: indeterminate ? 'indeterminate' : checked,
|
4156
|
+
className: className,
|
4157
|
+
onCheckedChange: handleChange,
|
4158
|
+
ref: ref
|
4159
|
+
}), React.createElement(CheckboxPrimitive.Indicator, {
|
4160
|
+
className: "flex h-full w-full"
|
4161
|
+
}, React.createElement(Icon, {
|
4162
|
+
name: indeterminate ? 'line' : 'tick',
|
4163
|
+
className: "!h-full !w-full"
|
4164
|
+
})));
|
4165
|
+
|
4166
|
+
if (label) {
|
4167
|
+
var labelClassName = cn('flex items-center cursor-pointer', {
|
4168
|
+
'cursor-not-allowed text-grey-dark': props.disabled
|
4169
|
+
});
|
4170
|
+
return React.createElement("label", {
|
4171
|
+
className: labelClassName
|
4172
|
+
}, element, label);
|
4173
|
+
}
|
4174
|
+
|
4175
|
+
return element;
|
3986
4176
|
});
|
3987
4177
|
|
3988
4178
|
var useProxiedRef = function useProxiedRef(ref) {
|
@@ -3999,1896 +4189,1673 @@ var useProxiedRef = function useProxiedRef(ref) {
|
|
3999
4189
|
return internalRef;
|
4000
4190
|
};
|
4001
4191
|
|
4002
|
-
var
|
4003
|
-
var
|
4004
|
-
x: 0,
|
4005
|
-
y: 0
|
4006
|
-
}),
|
4007
|
-
position = _React$useState[0],
|
4008
|
-
setPosition = _React$useState[1];
|
4192
|
+
var getInputClasses = function getInputClasses(props) {
|
4193
|
+
var _cn;
|
4009
4194
|
|
4010
|
-
|
4011
|
-
|
4012
|
-
|
4195
|
+
return cn('peer bg-white text-black text-sm border font-normal not-italic no-underline rounded inline-flex leading-6 px-2 relative w-full text-ellipsis transition-all delay-100 ease-in flex items-center', (_cn = {
|
4196
|
+
'cursor-not-allowed text-black bg-grey': props.readOnly,
|
4197
|
+
'border-grey text-opacity-25 cursor-not-allowed': props.disabled
|
4198
|
+
}, _cn[getStateClasses$1(props.state)] = !props.disabled, _cn['bg-[rgba(255,255,0,0.075)]'] = props.highlighted && props.disabled, _cn['bg-[rgba(255,255,0,0.2)]'] = props.highlighted && !props.disabled, _cn));
|
4199
|
+
};
|
4200
|
+
var getStateClasses$1 = function getStateClasses(value) {
|
4201
|
+
switch (value) {
|
4202
|
+
case 'success':
|
4203
|
+
return 'border-green hover:shadow-[0_0_0.15rem_theme(colors.green.DEFAULT)] focus:border-green-light focus:yt-focus-green active:border-green-dark';
|
4013
4204
|
|
4014
|
-
|
4205
|
+
case 'error':
|
4206
|
+
return 'border-red hover:shadow-[0_0_0.15rem_theme(colors.red.DEFAULT)] focus:border-red-light focus:yt-focus-red active:border-red-dark';
|
4015
4207
|
|
4016
|
-
|
4017
|
-
|
4018
|
-
return;
|
4019
|
-
}
|
4208
|
+
case 'warning':
|
4209
|
+
return 'border-yellow-dark hover:shadow-[0_0_0.15rem_theme(colors.yellow.dark)] focus:yt-focus-yellow active:border-yellow-dark';
|
4020
4210
|
|
4021
|
-
|
4022
|
-
|
4023
|
-
y = _ref.y;
|
4024
|
-
x += event.deltaX;
|
4025
|
-
y += event.deltaY;
|
4026
|
-
return {
|
4027
|
-
x: x,
|
4028
|
-
y: y
|
4029
|
-
};
|
4030
|
-
});
|
4031
|
-
}
|
4032
|
-
}),
|
4033
|
-
moveProps = _useMove.moveProps;
|
4211
|
+
case 'information':
|
4212
|
+
return 'border-blue hover:shadow-[0_0_0.15rem_theme(colors.blue.dark)] focus:border-blue-light focus:yt-focus active:border-blue-dark';
|
4034
4213
|
|
4035
|
-
|
4036
|
-
|
4037
|
-
|
4038
|
-
};
|
4214
|
+
default:
|
4215
|
+
return 'border-grey-dark hover:shadow-[0_0_0.1rem_theme(colors.grey.darker)] focus:border-blue-light focus:yt-focus active:border-blue-dark';
|
4216
|
+
}
|
4039
4217
|
};
|
4218
|
+
var getButtonStateClasses = function getButtonStateClasses(value) {
|
4219
|
+
switch (value) {
|
4220
|
+
case 'success':
|
4221
|
+
return '!border-green focus:!border-green-light focus:yt-focus-green peer-focus:!border-green-light peer-focus:peer-active:!border-green-dark';
|
4040
4222
|
|
4041
|
-
|
4042
|
-
|
4043
|
-
return React.useContext(MenuContext);
|
4044
|
-
};
|
4223
|
+
case 'error':
|
4224
|
+
return '!border-red focus:!border-red-light focus:yt-focus-red peer-focus:!border-red-light peer-focus:peer-active:!border-red-dark';
|
4045
4225
|
|
4046
|
-
|
4047
|
-
|
4048
|
-
var _props$as = props.as,
|
4049
|
-
Tag = _props$as === void 0 ? 'span' : _props$as,
|
4050
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$a);
|
4226
|
+
case 'warning':
|
4227
|
+
return '!border-yellow-dark focus:!border-yellow-dark focus:yt-focus-yellow peer-focus:peer-active:!border-yellow-dark';
|
4051
4228
|
|
4052
|
-
|
4053
|
-
|
4054
|
-
className: className,
|
4055
|
-
"data-taco": "group",
|
4056
|
-
ref: ref
|
4057
|
-
}));
|
4058
|
-
});
|
4229
|
+
case 'information':
|
4230
|
+
return '!border-blue focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4059
4231
|
|
4060
|
-
|
4061
|
-
|
4062
|
-
|
4063
|
-
|
4064
|
-
|
4065
|
-
|
4066
|
-
var
|
4067
|
-
|
4068
|
-
|
4069
|
-
|
4070
|
-
|
4071
|
-
|
4072
|
-
|
4073
|
-
var
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4077
|
-
|
4078
|
-
|
4232
|
+
default:
|
4233
|
+
return '!border-grey-dark focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4234
|
+
}
|
4235
|
+
};
|
4236
|
+
|
4237
|
+
var _excluded$d = ["button", "icon", "highlighted", "state", "autoFocus"];
|
4238
|
+
var Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
4239
|
+
var button = props.button,
|
4240
|
+
icon = props.icon,
|
4241
|
+
state = props.state,
|
4242
|
+
autoFocus = props.autoFocus,
|
4243
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$d);
|
4244
|
+
|
4245
|
+
var inputRef = useProxiedRef(ref);
|
4246
|
+
var hasContainer = button || icon;
|
4247
|
+
var className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
|
4248
|
+
'pr-8': !!hasContainer
|
4249
|
+
}, !hasContainer && otherProps.className);
|
4250
|
+
React.useEffect(function () {
|
4251
|
+
if (autoFocus && inputRef.current) {
|
4252
|
+
inputRef.current.focus();
|
4253
|
+
}
|
4254
|
+
}, []);
|
4255
|
+
var input = React.createElement("input", Object.assign({}, otherProps, {
|
4256
|
+
className: className,
|
4257
|
+
"data-taco": "input",
|
4258
|
+
ref: inputRef
|
4079
4259
|
}));
|
4080
|
-
});
|
4081
|
-
var Content$2 = /*#__PURE__*/React.forwardRef(function DialogContent(props, ref) {
|
4082
|
-
var dialog = useCurrentDialog();
|
4083
|
-
var internalRef = useProxiedRef(ref);
|
4084
4260
|
|
4085
|
-
|
4086
|
-
|
4087
|
-
dragHandleProps = _useDraggable.handleProps;
|
4261
|
+
if (hasContainer) {
|
4262
|
+
var extra;
|
4088
4263
|
|
4089
|
-
|
4090
|
-
|
4091
|
-
|
4264
|
+
if (button) {
|
4265
|
+
var _button$props$disable, _cn;
|
4266
|
+
|
4267
|
+
var disabled = (_button$props$disable = button.props.disabled) !== null && _button$props$disable !== void 0 ? _button$props$disable : otherProps.disabled;
|
4268
|
+
var buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', (_cn = {}, _cn[getButtonStateClasses(state)] = !props.disabled, _cn), button.props.className);
|
4269
|
+
extra = React.cloneElement(button, {
|
4270
|
+
className: buttonClassName,
|
4271
|
+
disabled: disabled
|
4272
|
+
});
|
4273
|
+
} else if (icon) {
|
4274
|
+
var iconClassName = cn('items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2', {
|
4275
|
+
'text-grey-dark': props.disabled,
|
4276
|
+
'text-grey-darkest': !props.disabled
|
4277
|
+
});
|
4278
|
+
extra = typeof icon === 'string' ? React.createElement(Icon, {
|
4279
|
+
className: iconClassName,
|
4280
|
+
name: icon
|
4281
|
+
}) : React.cloneElement(icon, {
|
4282
|
+
className: cn(iconClassName, icon.props.className)
|
4283
|
+
});
|
4284
|
+
}
|
4092
4285
|
|
4286
|
+
var containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
|
4287
|
+
return React.createElement("div", {
|
4288
|
+
className: containerClassName,
|
4289
|
+
"data-taco": "input-container"
|
4290
|
+
}, input, extra);
|
4291
|
+
}
|
4093
4292
|
|
4094
|
-
|
4095
|
-
|
4293
|
+
return input;
|
4294
|
+
});
|
4096
4295
|
|
4097
|
-
|
4098
|
-
|
4099
|
-
|
4100
|
-
};
|
4296
|
+
var getNextIndexFromKeycode = function getNextIndexFromKeycode(keyCode, length, index, direction) {
|
4297
|
+
if (direction === void 0) {
|
4298
|
+
direction = 'vertical';
|
4101
4299
|
}
|
4102
4300
|
|
4103
|
-
var
|
4104
|
-
|
4105
|
-
'w-xs': dialog.size === 'xs',
|
4106
|
-
'w-sm': dialog.size === 'sm',
|
4107
|
-
'w-md': dialog.size === 'md',
|
4108
|
-
'w-lg': dialog.size === 'lg'
|
4109
|
-
});
|
4110
|
-
var containerClassName = cn('bg-white p-6 rounded relative z-[999]', 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]', {
|
4111
|
-
'rounded-b-none': !!dialog.elements.extra
|
4112
|
-
}, props.className); // the chosen behaviour in taco is that outside clicks do not close the dialog
|
4301
|
+
var previousKey = direction === 'horizontal' ? 'left' : 'up';
|
4302
|
+
var nextKey = direction === 'horizontal' ? 'right' : 'down';
|
4113
4303
|
|
4114
|
-
|
4115
|
-
|
4116
|
-
|
4304
|
+
switch (keyCode) {
|
4305
|
+
case keycode(previousKey):
|
4306
|
+
return index !== undefined ? index - 1 < 0 ? 0 : index - 1 : index;
|
4117
4307
|
|
4118
|
-
|
4308
|
+
case keycode(nextKey):
|
4309
|
+
return index !== undefined ? index + 1 >= length ? index : index + 1 : index;
|
4119
4310
|
|
4120
|
-
|
4121
|
-
|
4122
|
-
|
4123
|
-
|
4124
|
-
|
4125
|
-
|
4126
|
-
|
4311
|
+
case keycode('home'):
|
4312
|
+
return 0;
|
4313
|
+
|
4314
|
+
case keycode('end'):
|
4315
|
+
return length - 1;
|
4316
|
+
|
4317
|
+
default:
|
4318
|
+
return;
|
4319
|
+
}
|
4320
|
+
};
|
4321
|
+
var useListKeyboardNavigation = function useListKeyboardNavigation(length, options) {
|
4322
|
+
if (length === void 0) {
|
4323
|
+
length = 0;
|
4127
4324
|
}
|
4128
4325
|
|
4129
|
-
|
4130
|
-
|
4131
|
-
|
4132
|
-
|
4133
|
-
|
4134
|
-
onInteractOutside: handleInteractOutside,
|
4135
|
-
onCloseAutoFocus: handleCloseAutoFocus,
|
4136
|
-
ref: ref,
|
4137
|
-
style: _extends({}, props.style, {
|
4138
|
-
left: dialog.draggable ? "calc(50% + " + position.x + "px)" : undefined,
|
4139
|
-
top: dialog.draggable ? "calc(50% + " + position.y + "px)" : undefined
|
4140
|
-
})
|
4141
|
-
}), React.createElement("div", {
|
4142
|
-
className: containerClassName,
|
4143
|
-
"data-taco": "dialog"
|
4144
|
-
}, output, dialog.draggable && React.createElement("div", Object.assign({}, dragHandleProps, {
|
4145
|
-
"aria-label": texts.dialog.drag,
|
4146
|
-
className: "yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center"
|
4147
|
-
})), React.createElement(DialogPrimitive.Close, {
|
4148
|
-
asChild: true,
|
4149
|
-
onClick: dialog.onClose
|
4150
|
-
}, React.createElement(IconButton, {
|
4151
|
-
appearance: "discrete",
|
4152
|
-
"aria-label": texts.dialog.close,
|
4153
|
-
className: "absolute top-0 right-0 mt-2 mr-2",
|
4154
|
-
icon: "close"
|
4155
|
-
}))), dialog.elements.drawer, dialog.elements.extra))));
|
4156
|
-
});
|
4326
|
+
if (options === void 0) {
|
4327
|
+
options = {
|
4328
|
+
direction: 'vertical'
|
4329
|
+
};
|
4330
|
+
}
|
4157
4331
|
|
4158
|
-
var
|
4159
|
-
|
4332
|
+
var _React$useState = React__default.useState(options.initialIndex),
|
4333
|
+
index = _React$useState[0],
|
4334
|
+
setIndex = _React$useState[1];
|
4160
4335
|
|
4161
|
-
var
|
4162
|
-
|
4163
|
-
className: "absolute top-0 z-[998] -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left",
|
4164
|
-
"data-taco": "dialog-drawer",
|
4165
|
-
"aria-hidden": !((_dialog$drawer = dialog.drawer) !== null && _dialog$drawer !== void 0 && _dialog$drawer.open),
|
4166
|
-
variants: {
|
4167
|
-
visible: {
|
4168
|
-
left: '100%',
|
4169
|
-
display: 'block',
|
4170
|
-
transition: {
|
4171
|
-
ease: 'easeOut',
|
4172
|
-
duration: 0.2
|
4173
|
-
}
|
4174
|
-
},
|
4175
|
-
hidden: {
|
4176
|
-
left: '0%',
|
4177
|
-
transition: {
|
4178
|
-
ease: 'easeOut',
|
4179
|
-
duration: 0.2
|
4180
|
-
},
|
4181
|
-
transitionEnd: {
|
4182
|
-
display: 'none'
|
4183
|
-
}
|
4184
|
-
}
|
4185
|
-
},
|
4186
|
-
animate: (_dialog$drawer2 = dialog.drawer) !== null && _dialog$drawer2 !== void 0 && _dialog$drawer2.open ? 'visible' : 'hidden',
|
4187
|
-
ref: ref
|
4188
|
-
}));
|
4189
|
-
});
|
4336
|
+
var getNextIndex = function getNextIndex(event) {
|
4337
|
+
var nextIndex = getNextIndexFromKeycode(event.keyCode, length, index, options.direction);
|
4190
4338
|
|
4191
|
-
|
4192
|
-
|
4193
|
-
|
4194
|
-
"data-taco": "dialog-extra",
|
4195
|
-
ref: ref
|
4196
|
-
}));
|
4197
|
-
});
|
4339
|
+
if (nextIndex !== undefined) {
|
4340
|
+
event.preventDefault();
|
4341
|
+
}
|
4198
4342
|
|
4199
|
-
|
4343
|
+
return nextIndex;
|
4344
|
+
};
|
4200
4345
|
|
4201
|
-
|
4202
|
-
return React.useMemo(function () {
|
4203
|
-
var children = [];
|
4204
|
-
var drawer;
|
4205
|
-
var extra;
|
4206
|
-
React.Children.forEach(initialChildren, function (child) {
|
4207
|
-
if (child.type.displayName === 'Drawer') {
|
4208
|
-
drawer = child;
|
4209
|
-
} else if (child.type.displayName === 'Extra') {
|
4210
|
-
extra = child;
|
4211
|
-
} else {
|
4212
|
-
children.push(child);
|
4213
|
-
}
|
4214
|
-
});
|
4215
|
-
return [children, drawer, extra];
|
4216
|
-
}, [initialChildren]);
|
4346
|
+
return [index, setIndex, getNextIndex];
|
4217
4347
|
};
|
4218
4348
|
|
4219
|
-
var
|
4220
|
-
var
|
4221
|
-
_props$draggable = props.draggable,
|
4222
|
-
draggable = _props$draggable === void 0 ? false : _props$draggable,
|
4223
|
-
onClose = props.onClose,
|
4224
|
-
defaultOpen = props.open,
|
4225
|
-
_props$size = props.size,
|
4226
|
-
size = _props$size === void 0 ? 'sm' : _props$size,
|
4227
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$b);
|
4349
|
+
var scrollToChildElement = function scrollToChildElement(parent, child) {
|
4350
|
+
var clientHeight = parent.clientHeight;
|
4228
4351
|
|
4229
|
-
|
4230
|
-
|
4231
|
-
|
4232
|
-
|
4352
|
+
if (parent.scrollHeight > clientHeight) {
|
4353
|
+
var scrollTop = parent.scrollTop;
|
4354
|
+
var scrollBottom = clientHeight + scrollTop;
|
4355
|
+
var childBottom = child.offsetTop + child.offsetHeight;
|
4233
4356
|
|
4234
|
-
|
4235
|
-
|
4236
|
-
|
4357
|
+
if (childBottom > scrollBottom) {
|
4358
|
+
parent.scrollTop = childBottom - clientHeight;
|
4359
|
+
} else if (child.offsetTop < scrollTop) {
|
4360
|
+
parent.scrollTop = child.offsetTop;
|
4361
|
+
}
|
4362
|
+
}
|
4363
|
+
};
|
4237
4364
|
|
4238
|
-
|
4239
|
-
|
4240
|
-
|
4365
|
+
var useListScrollTo = function useListScrollTo(internalRef, itemRefs) {
|
4366
|
+
var scrollTo = function scrollTo(index) {
|
4367
|
+
if (internalRef && internalRef.current) {
|
4368
|
+
if (index !== undefined) {
|
4369
|
+
var activeRef = itemRefs[index];
|
4241
4370
|
|
4242
|
-
|
4243
|
-
|
4244
|
-
close: function close() {
|
4245
|
-
return setOpen(false);
|
4246
|
-
},
|
4247
|
-
draggable: draggable,
|
4248
|
-
drawer: {
|
4249
|
-
open: drawerOpen,
|
4250
|
-
toggle: function toggle() {
|
4251
|
-
return setDrawerOpen(function (isDrawerOpen) {
|
4252
|
-
return !isDrawerOpen;
|
4253
|
-
});
|
4371
|
+
if (activeRef && activeRef.current) {
|
4372
|
+
scrollToChildElement(internalRef.current, activeRef.current);
|
4254
4373
|
}
|
4255
|
-
}
|
4256
|
-
|
4257
|
-
|
4258
|
-
|
4259
|
-
},
|
4260
|
-
onClose: onClose,
|
4261
|
-
props: otherProps,
|
4262
|
-
size: size,
|
4263
|
-
ref: ref
|
4264
|
-
};
|
4265
|
-
}, [open, drawerOpen, drawer, extra, otherProps]);
|
4266
|
-
return React.createElement(DialogContext.Provider, {
|
4267
|
-
value: context
|
4268
|
-
}, React.createElement(DialogPrimitive.Root, {
|
4269
|
-
children: children,
|
4270
|
-
open: open,
|
4271
|
-
onOpenChange: setOpen
|
4272
|
-
}));
|
4273
|
-
});
|
4274
|
-
Dialog.Trigger = Trigger$1;
|
4275
|
-
Dialog.Content = Content$2;
|
4276
|
-
Dialog.Title = Title;
|
4277
|
-
Dialog.Footer = Footer;
|
4278
|
-
Dialog.Extra = Extra;
|
4279
|
-
Dialog.Drawer = Drawer;
|
4280
|
-
Dialog.Close = Close$1;
|
4281
|
-
|
4282
|
-
var _excluded$c = ["children"];
|
4283
|
-
var PopoverContext = /*#__PURE__*/React.createContext({
|
4284
|
-
props: {},
|
4285
|
-
ref: null
|
4286
|
-
});
|
4287
|
-
var Trigger$2 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4288
|
-
var _props$children;
|
4289
|
-
|
4290
|
-
var context = React.useContext(PopoverContext);
|
4291
|
-
var children = props.children;
|
4292
|
-
|
4293
|
-
if (React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
4294
|
-
console.warn("Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '" + props.children.type.name + "' in React.forwardRef()? Taco has wrapped '" + props.children.type.name + "' in a 'span' to maintain functionality, but this may cause unintended behaviour");
|
4295
|
-
children = React.createElement("span", null, props.children);
|
4296
|
-
}
|
4297
|
-
|
4298
|
-
return React.createElement(PopoverPrimitive.Trigger, Object.assign({}, context.props, props, {
|
4299
|
-
children: children,
|
4300
|
-
ref: mergeRefs([context.ref, ref]),
|
4301
|
-
asChild: true
|
4302
|
-
}));
|
4303
|
-
});
|
4304
|
-
var RenderPropWrapper = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
4305
|
-
var children = _ref.children,
|
4306
|
-
onClick = _ref.onClick;
|
4307
|
-
|
4308
|
-
var close = function close() {
|
4309
|
-
onClick(new CustomEvent('hide'));
|
4374
|
+
} else {
|
4375
|
+
internalRef.current.scrollTop = 0;
|
4376
|
+
}
|
4377
|
+
}
|
4310
4378
|
};
|
4311
4379
|
|
4312
|
-
return
|
4313
|
-
|
4314
|
-
|
4315
|
-
|
4316
|
-
});
|
4317
|
-
var Content$3 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4318
|
-
var className = cn('bg-white focus:border-blue-light', props.className);
|
4319
|
-
var output;
|
4320
|
-
|
4321
|
-
if (typeof props.children === 'function') {
|
4322
|
-
output = React.createElement(PopoverPrimitive.Close, {
|
4323
|
-
asChild: true
|
4324
|
-
}, React.createElement(RenderPropWrapper, null, props.children));
|
4325
|
-
} else {
|
4326
|
-
output = props.children;
|
4327
|
-
}
|
4380
|
+
return {
|
4381
|
+
scrollTo: scrollTo
|
4382
|
+
};
|
4383
|
+
};
|
4328
4384
|
|
4329
|
-
|
4330
|
-
|
4331
|
-
|
4332
|
-
|
4333
|
-
|
4334
|
-
className: "text-white"
|
4335
|
-
}));
|
4336
|
-
});
|
4337
|
-
var Close$2 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4338
|
-
return React.createElement(PopoverPrimitive.Close, Object.assign({}, props, {
|
4339
|
-
ref: ref,
|
4340
|
-
asChild: true
|
4341
|
-
}));
|
4342
|
-
});
|
4343
|
-
var Popover = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
4344
|
-
var children = props.children,
|
4345
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
4385
|
+
var _excluded$e = ["data", "disabled", "highlighted", "id", "loading", "onChange", "onClick", "onFocus", "onKeyDown", "readOnly", "scrollOnFocus", "state", "value", "multiselect", "selectedIndexes", "allOptionsSelected"],
|
4386
|
+
_excluded2$1 = ["children", "icon"];
|
4387
|
+
var getId = function getId(id, value) {
|
4388
|
+
return id + "_" + value;
|
4389
|
+
};
|
4346
4390
|
|
4347
|
-
|
4348
|
-
|
4349
|
-
props: otherProps,
|
4350
|
-
ref: ref
|
4351
|
-
};
|
4352
|
-
}, [otherProps]);
|
4353
|
-
return React.createElement(PopoverContext.Provider, {
|
4354
|
-
value: context
|
4355
|
-
}, React.createElement(PopoverPrimitive.Root, {
|
4356
|
-
children: children
|
4357
|
-
}));
|
4358
|
-
});
|
4359
|
-
Popover.Trigger = Trigger$2;
|
4360
|
-
Popover.Content = Content$3;
|
4361
|
-
Popover.Close = Close$2;
|
4391
|
+
var getNextEnabledItem = function getNextEnabledItem(event, data, index) {
|
4392
|
+
var nextIndex = getNextIndexFromKeycode(event.keyCode, data.length, index);
|
4362
4393
|
|
4363
|
-
|
4364
|
-
|
4365
|
-
|
4366
|
-
}
|
4367
|
-
|
4368
|
-
|
4369
|
-
icon = false;
|
4394
|
+
if (nextIndex) {
|
4395
|
+
if (nextIndex === index) {
|
4396
|
+
return index;
|
4397
|
+
} else if (data[nextIndex] && data[nextIndex].disabled) {
|
4398
|
+
return getNextEnabledItem(event, data, nextIndex);
|
4399
|
+
}
|
4370
4400
|
}
|
4371
4401
|
|
4372
|
-
|
4373
|
-
|
4374
|
-
return "yt-blue-solid border-blue\n focus:bg-blue focus:text-white focus:yt-focus\n active:bg-blue-dark active:text-white \n hover:bg-blue-light hover:border-blue-light hover:text-white\n hover:focus:bg-blue-light hover:focus:border-blue-light hover:focus:text-white\n disabled:hover:yt-blue-solid";
|
4375
|
-
|
4376
|
-
case 'danger':
|
4377
|
-
return "yt-red-solid border-red\n focus:bg-red focus:text-white focus:yt-focus-red\n active:bg-red-dark active:text-white \n hover:bg-red-light hover:text-white\n hover:focus:bg-red-light hover:focus:text-white\n disabled:hover:yt-red-solid";
|
4402
|
+
return nextIndex;
|
4403
|
+
};
|
4378
4404
|
|
4379
|
-
|
4380
|
-
|
4405
|
+
var ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(props, ref) {
|
4406
|
+
var data = props.data,
|
4407
|
+
disabled = props.disabled,
|
4408
|
+
id = props.id,
|
4409
|
+
loading = props.loading,
|
4410
|
+
setCurrentIndex = props.onChange,
|
4411
|
+
onClick = props.onClick,
|
4412
|
+
onFocus = props.onFocus,
|
4413
|
+
onKeyDown = props.onKeyDown,
|
4414
|
+
readOnly = props.readOnly,
|
4415
|
+
_props$scrollOnFocus = props.scrollOnFocus,
|
4416
|
+
scrollOnFocus = _props$scrollOnFocus === void 0 ? false : _props$scrollOnFocus,
|
4417
|
+
currentIndex = props.value,
|
4418
|
+
multiselect = props.multiselect,
|
4419
|
+
_props$selectedIndexe = props.selectedIndexes,
|
4420
|
+
selectedIndexes = _props$selectedIndexe === void 0 ? [] : _props$selectedIndexe,
|
4421
|
+
_props$allOptionsSele = props.allOptionsSelected,
|
4422
|
+
allOptionsSelected = _props$allOptionsSele === void 0 ? false : _props$allOptionsSele,
|
4423
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$e);
|
4381
4424
|
|
4382
|
-
|
4383
|
-
|
4384
|
-
|
4385
|
-
|
4386
|
-
|
4425
|
+
var listRef = useProxiedRef(ref);
|
4426
|
+
var itemRefs = React.useMemo(function () {
|
4427
|
+
return data.map(function () {
|
4428
|
+
return React.createRef();
|
4429
|
+
});
|
4430
|
+
}, [data]);
|
4387
4431
|
|
4388
|
-
|
4389
|
-
|
4432
|
+
var _useLocalization = useLocalization(),
|
4433
|
+
texts = _useLocalization.texts;
|
4390
4434
|
|
4391
|
-
|
4392
|
-
|
4393
|
-
}
|
4394
|
-
};
|
4395
|
-
var createButton = function createButton(props, className, ref) {
|
4396
|
-
var dialog = props.dialog,
|
4397
|
-
hanger = props.hanger,
|
4398
|
-
popover = props.popover,
|
4399
|
-
tooltip = props.tooltip,
|
4400
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$d);
|
4435
|
+
var _useListScrollTo = useListScrollTo(listRef, itemRefs),
|
4436
|
+
scrollTo = _useListScrollTo.scrollTo;
|
4401
4437
|
|
4402
|
-
|
4403
|
-
|
4404
|
-
|
4405
|
-
}));
|
4438
|
+
React.useEffect(function () {
|
4439
|
+
scrollTo(currentIndex);
|
4440
|
+
}, [currentIndex]);
|
4406
4441
|
|
4407
|
-
|
4408
|
-
|
4409
|
-
}
|
4442
|
+
var handleKeyDown = function handleKeyDown(event) {
|
4443
|
+
var nextIndex = getNextEnabledItem(event, data, currentIndex);
|
4410
4444
|
|
4411
|
-
|
4412
|
-
|
4413
|
-
|
4445
|
+
if (nextIndex !== undefined && nextIndex !== currentIndex) {
|
4446
|
+
event.preventDefault();
|
4447
|
+
scrollTo(nextIndex);
|
4448
|
+
setCurrentIndex(nextIndex);
|
4449
|
+
}
|
4414
4450
|
|
4415
|
-
|
4416
|
-
|
4417
|
-
|
4451
|
+
if (onKeyDown) {
|
4452
|
+
event.persist();
|
4453
|
+
var index = nextIndex !== undefined ? nextIndex : currentIndex;
|
4454
|
+
onKeyDown(event, index);
|
4455
|
+
}
|
4456
|
+
};
|
4418
4457
|
|
4419
|
-
|
4420
|
-
|
4421
|
-
|
4422
|
-
}, button);
|
4423
|
-
}
|
4458
|
+
var handleClick = function handleClick(index) {
|
4459
|
+
return function (event) {
|
4460
|
+
setCurrentIndex(index);
|
4424
4461
|
|
4425
|
-
|
4426
|
-
|
4462
|
+
if (onClick) {
|
4463
|
+
event.persist();
|
4464
|
+
onClick(event, index);
|
4465
|
+
}
|
4466
|
+
};
|
4467
|
+
};
|
4427
4468
|
|
4428
|
-
var
|
4429
|
-
|
4430
|
-
|
4431
|
-
|
4432
|
-
_props$rounded = props.rounded,
|
4433
|
-
rounded = _props$rounded === void 0 ? false : _props$rounded,
|
4434
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$e);
|
4469
|
+
var handleFocus = function handleFocus(event) {
|
4470
|
+
if (scrollOnFocus) {
|
4471
|
+
scrollTo(currentIndex);
|
4472
|
+
}
|
4435
4473
|
|
4436
|
-
|
4437
|
-
|
4438
|
-
|
4439
|
-
|
4440
|
-
|
4441
|
-
}, props.className);
|
4474
|
+
if (onFocus) {
|
4475
|
+
event.persist();
|
4476
|
+
onFocus(event);
|
4477
|
+
}
|
4478
|
+
};
|
4442
4479
|
|
4443
|
-
|
4444
|
-
|
4445
|
-
|
4480
|
+
var getOptionCheckedState = function getOptionCheckedState(optionValue, index) {
|
4481
|
+
if (optionValue === '#ALL-OPTIONS#') {
|
4482
|
+
return allOptionsSelected;
|
4483
|
+
} else if (!optionValue || !selectedIndexes) {
|
4484
|
+
return false;
|
4485
|
+
} else {
|
4486
|
+
return selectedIndexes.findIndex(function (i) {
|
4487
|
+
return i === index;
|
4488
|
+
}) !== -1;
|
4489
|
+
}
|
4490
|
+
};
|
4446
4491
|
|
4447
|
-
|
4448
|
-
|
4449
|
-
|
4450
|
-
|
4451
|
-
|
4452
|
-
|
4453
|
-
|
4454
|
-
|
4455
|
-
|
4456
|
-
|
4457
|
-
|
4458
|
-
|
4459
|
-
|
4460
|
-
|
4461
|
-
|
4462
|
-
className: className,
|
4463
|
-
"data-taco": "banner",
|
4464
|
-
ref: ref
|
4465
|
-
}, getBannerIcon(state), children, onClose ? React.createElement(IconButton, {
|
4466
|
-
className: "ml-auto",
|
4467
|
-
icon: "close",
|
4468
|
-
appearance: "discrete",
|
4469
|
-
onClick: onClose
|
4470
|
-
}) : null);
|
4471
|
-
});
|
4472
|
-
|
4473
|
-
var _excluded$f = ["appearance", "fluid"];
|
4474
|
-
var Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
4475
|
-
var appearance = props.appearance,
|
4476
|
-
fluid = props.fluid,
|
4477
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$f);
|
4478
|
-
|
4479
|
-
var className = cn(getButtonClasses(), getAppearanceClasses(appearance), 'rounded px-3', {
|
4480
|
-
'cursor-not-allowed opacity-50': props.disabled,
|
4481
|
-
'focus:yt-focus active:focus:yt-focus': !props.disabled,
|
4482
|
-
'w-full': fluid
|
4483
|
-
}, props.className);
|
4484
|
-
return createButton(_extends({}, otherProps, {
|
4485
|
-
'data-taco': 'button'
|
4486
|
-
}), className, ref);
|
4487
|
-
});
|
4488
|
-
|
4489
|
-
var _excluded$g = ["onChange", "value"];
|
4490
|
-
|
4491
|
-
var renderDay = function renderDay(day, modifiers) {
|
4492
|
-
return modifiers.disabled ? React.createElement("span", {
|
4493
|
-
className: "dot"
|
4494
|
-
}) : day.getDate();
|
4495
|
-
};
|
4496
|
-
|
4497
|
-
var thisYear = /*#__PURE__*/new Date().getFullYear();
|
4498
|
-
var years = [];
|
4499
|
-
|
4500
|
-
for (var i = thisYear - 10; i <= thisYear + 10; i += 1) {
|
4501
|
-
years.push(i);
|
4502
|
-
}
|
4503
|
-
|
4504
|
-
var Navbar = /*#__PURE__*/React.memo(function (_ref) {
|
4505
|
-
var onMonthChange = _ref.onMonthChange,
|
4506
|
-
onNextClick = _ref.onNextClick,
|
4507
|
-
onPreviousClick = _ref.onPreviousClick,
|
4508
|
-
_ref$value = _ref.value,
|
4509
|
-
value = _ref$value === void 0 ? new Date() : _ref$value;
|
4510
|
-
|
4511
|
-
var _useLocalization = useLocalization(),
|
4512
|
-
_useLocalization$text = _useLocalization.texts.calendar,
|
4513
|
-
actions = _useLocalization$text.actions,
|
4514
|
-
months = _useLocalization$text.months;
|
4515
|
-
|
4516
|
-
var handleChange = function handleChange(event) {
|
4517
|
-
var _event$target$form = event.target.form,
|
4518
|
-
year = _event$target$form.year,
|
4519
|
-
month = _event$target$form.month;
|
4520
|
-
onMonthChange(new Date(year.value, month.value));
|
4521
|
-
};
|
4522
|
-
|
4523
|
-
return React.createElement("div", {
|
4524
|
-
className: "flex justify-between items-center mb-2"
|
4525
|
-
}, React.createElement("form", {
|
4526
|
-
className: "inline-flex space-x-1"
|
4527
|
-
}, React.createElement("select", {
|
4528
|
-
className: "h-8 px-2",
|
4529
|
-
name: "month",
|
4530
|
-
onChange: handleChange,
|
4531
|
-
value: value.getMonth()
|
4532
|
-
}, months.map(function (month, i) {
|
4533
|
-
return React.createElement("option", {
|
4534
|
-
value: i
|
4535
|
-
}, month);
|
4536
|
-
})), React.createElement("select", {
|
4537
|
-
className: "h-8 px-2",
|
4538
|
-
name: "year",
|
4539
|
-
onChange: handleChange,
|
4540
|
-
value: value.getFullYear()
|
4541
|
-
}, years.map(function (year) {
|
4542
|
-
return React.createElement("option", {
|
4543
|
-
value: year
|
4544
|
-
}, String(year));
|
4545
|
-
}))), React.createElement("div", null, React.createElement(IconButton, {
|
4546
|
-
appearance: "discrete",
|
4547
|
-
icon: "chevron-left",
|
4548
|
-
"aria-label": actions.previousMonth,
|
4549
|
-
onClick: function onClick() {
|
4550
|
-
return onPreviousClick();
|
4551
|
-
},
|
4552
|
-
rounded: true
|
4553
|
-
}), React.createElement(IconButton, {
|
4554
|
-
appearance: "discrete",
|
4555
|
-
icon: "chevron-right",
|
4556
|
-
"aria-label": actions.nextMonth,
|
4557
|
-
onClick: function onClick() {
|
4558
|
-
return onNextClick();
|
4559
|
-
},
|
4560
|
-
rounded: true
|
4561
|
-
})));
|
4562
|
-
});
|
4563
|
-
var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
4564
|
-
var handleChange = props.onChange,
|
4565
|
-
value = props.value,
|
4566
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$g);
|
4567
|
-
|
4568
|
-
var _useLocalization2 = useLocalization(),
|
4569
|
-
locale = _useLocalization2.locale,
|
4570
|
-
texts = _useLocalization2.texts;
|
4571
|
-
|
4572
|
-
var _React$useState = React.useState(value !== null && value !== void 0 ? value : new Date()),
|
4573
|
-
visibleMonth = _React$useState[0],
|
4574
|
-
setVisibleMonth = _React$useState[1];
|
4575
|
-
|
4576
|
-
React.useEffect(function () {
|
4577
|
-
if (visibleMonth !== value) {
|
4578
|
-
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
4579
|
-
}
|
4580
|
-
}, [value]);
|
4581
|
-
|
4582
|
-
var handleDayClick = function handleDayClick(date, modifiers, event) {
|
4583
|
-
if (modifiers.outside || modifiers.disabled) {
|
4584
|
-
return;
|
4585
|
-
}
|
4586
|
-
|
4587
|
-
handleChange(date, event);
|
4588
|
-
};
|
4589
|
-
|
4590
|
-
var handleCalendarClickToday = function handleCalendarClickToday() {
|
4591
|
-
var today = new Date(); // set to midday to avoid UTC offset causing dates to be mismatched server side
|
4492
|
+
var list = _extends({}, otherProps, {
|
4493
|
+
className: cn('inline-flex flex-col list-none !p-0 m-0 overflow-y-auto h-auto', getInputClasses(props), {
|
4494
|
+
'yt-list--multiselect': multiselect,
|
4495
|
+
'pointer-events-none': disabled,
|
4496
|
+
'cursor-not-allowed': disabled || readOnly
|
4497
|
+
}, otherProps.className),
|
4498
|
+
disabled: disabled,
|
4499
|
+
id: id,
|
4500
|
+
onFocus: !disabled && !readOnly ? handleFocus : undefined,
|
4501
|
+
onKeyDown: !disabled && !readOnly ? handleKeyDown : undefined,
|
4502
|
+
readOnly: readOnly,
|
4503
|
+
ref: listRef,
|
4504
|
+
role: 'listbox',
|
4505
|
+
tabIndex: otherProps.tabIndex || 0
|
4506
|
+
});
|
4592
4507
|
|
4593
|
-
|
4594
|
-
|
4595
|
-
|
4596
|
-
|
4597
|
-
|
4508
|
+
var options = data.map(function (option, index) {
|
4509
|
+
var depth = option.path ? option.path.split('.').length - 1 : 0;
|
4510
|
+
return {
|
4511
|
+
'aria-selected': multiselect ? getOptionCheckedState(String(option.value), index) : currentIndex === index,
|
4512
|
+
'data-focused': currentIndex === index,
|
4513
|
+
children: option.text,
|
4514
|
+
className: cn('flex items-center px-3 w-full cursor-pointer bg-white flex-[0_0_2rem] focus:wcag-blue focus:border-blue', {
|
4515
|
+
'sticky top-0 font-bold': depth === 0 && !!option.hasChildren
|
4516
|
+
}),
|
4517
|
+
disabled: option.disabled,
|
4518
|
+
icon: option.icon,
|
4519
|
+
id: getId(id, option.value),
|
4520
|
+
key: getId(id, option.value),
|
4521
|
+
onClick: !disabled && !readOnly ? handleClick(index) : undefined,
|
4522
|
+
ref: itemRefs[index],
|
4523
|
+
role: 'option',
|
4524
|
+
style: depth > 0 ? {
|
4525
|
+
paddingLeft: depth + 1 + "rem"
|
4526
|
+
} : undefined
|
4527
|
+
};
|
4528
|
+
});
|
4529
|
+
return React.createElement("ul", Object.assign({}, list, {
|
4530
|
+
"data-taco": "scrollable-list"
|
4531
|
+
}), loading ? React.createElement("li", {
|
4532
|
+
className: "yt-list__empty"
|
4533
|
+
}, React.createElement("span", null, React.createElement(Spinner$1, {
|
4534
|
+
delay: 0
|
4535
|
+
})), React.createElement("span", null, texts.listbox.loading)) : options.length ? options.map(function (_ref) {
|
4536
|
+
var children = _ref.children,
|
4537
|
+
icon = _ref.icon,
|
4538
|
+
optionProps = _objectWithoutPropertiesLoose(_ref, _excluded2$1);
|
4598
4539
|
|
4599
|
-
|
4600
|
-
|
4601
|
-
|
4602
|
-
|
4603
|
-
|
4604
|
-
|
4605
|
-
|
4606
|
-
|
4607
|
-
|
4608
|
-
|
4609
|
-
|
4610
|
-
|
4611
|
-
return React.createElement(Navbar, Object.assign({}, navProps, {
|
4612
|
-
onMonthChange: setVisibleMonth,
|
4613
|
-
value: visibleMonth
|
4614
|
-
}));
|
4615
|
-
},
|
4616
|
-
onDayClick: handleDayClick,
|
4617
|
-
onMonthChange: setVisibleMonth,
|
4618
|
-
onTodayButtonClick: handleCalendarClickToday,
|
4619
|
-
captionElement: function captionElement() {
|
4620
|
-
return null;
|
4621
|
-
},
|
4622
|
-
todayButton: texts.calendar.actions.today,
|
4623
|
-
showOutsideDays: true,
|
4624
|
-
renderDay: renderDay,
|
4625
|
-
numberOfMonths: 1,
|
4626
|
-
ref: ref
|
4627
|
-
})));
|
4540
|
+
return React.createElement("li", Object.assign({}, optionProps), icon, React.createElement("span", {
|
4541
|
+
className: "flex-grow truncate text-left"
|
4542
|
+
}, children), multiselect && React.createElement(Checkbox, {
|
4543
|
+
checked: optionProps['aria-selected'],
|
4544
|
+
onChange: function onChange() {
|
4545
|
+
return null;
|
4546
|
+
},
|
4547
|
+
className: "pointer-events-none ml-2 flex items-center justify-end overflow-visible p-px"
|
4548
|
+
}));
|
4549
|
+
}) : React.createElement("li", {
|
4550
|
+
className: "yt-list__empty"
|
4551
|
+
}, React.createElement("span", null, texts.listbox.empty)));
|
4628
4552
|
});
|
4629
4553
|
|
4630
|
-
|
4631
|
-
var
|
4632
|
-
var
|
4633
|
-
highlighted = props.highlighted,
|
4634
|
-
indeterminate = props.indeterminate,
|
4635
|
-
invalid = props.invalid,
|
4636
|
-
label = props.label,
|
4637
|
-
onChange = props.onChange,
|
4638
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$h);
|
4639
|
-
|
4640
|
-
var className = cn('h-5 w-5 border rounded text-sm', {
|
4641
|
-
'mr-2': !!label,
|
4642
|
-
'border-grey-dark text-blue focus:border-blue focus:yt-focus': !props.disabled && !invalid,
|
4643
|
-
'border-grey text-blue-light cursor-not-allowed': props.disabled,
|
4644
|
-
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
4645
|
-
'border-red text-red focus:border-red focus:yt-focus-red': invalid && !props.disabled
|
4646
|
-
}, props.className);
|
4647
|
-
var handleChange;
|
4648
|
-
|
4649
|
-
if (onChange) {
|
4650
|
-
handleChange = function handleChange(checked) {
|
4651
|
-
return onChange(checked === 'indeterminate' ? false : checked);
|
4652
|
-
};
|
4653
|
-
}
|
4654
|
-
|
4655
|
-
var element = React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, {
|
4656
|
-
"data-taco": "checkbox",
|
4657
|
-
checked: indeterminate ? 'indeterminate' : checked,
|
4658
|
-
className: className,
|
4659
|
-
onCheckedChange: handleChange,
|
4660
|
-
ref: ref
|
4661
|
-
}), React.createElement(CheckboxPrimitive.Indicator, {
|
4662
|
-
className: "flex h-full w-full"
|
4663
|
-
}, React.createElement(Icon, {
|
4664
|
-
name: indeterminate ? 'line' : 'tick',
|
4665
|
-
className: "!h-full !w-full"
|
4666
|
-
})));
|
4554
|
+
// returns a custom event compatible with all browsers
|
4555
|
+
var createCustomEvent = function createCustomEvent(eventType) {
|
4556
|
+
var customEvent;
|
4667
4557
|
|
4668
|
-
if (
|
4669
|
-
|
4670
|
-
|
4558
|
+
if (typeof Event === 'function') {
|
4559
|
+
customEvent = new Event(eventType, {
|
4560
|
+
bubbles: true
|
4671
4561
|
});
|
4672
|
-
|
4673
|
-
|
4674
|
-
|
4562
|
+
} else {
|
4563
|
+
customEvent = document.createEvent('Event');
|
4564
|
+
customEvent.initEvent(eventType, true, true);
|
4675
4565
|
}
|
4676
4566
|
|
4677
|
-
return
|
4678
|
-
}
|
4567
|
+
return customEvent;
|
4568
|
+
}; // returns a custom keyboard event compatible with all browsers
|
4679
4569
|
|
4680
|
-
var
|
4681
|
-
var
|
4570
|
+
var createCustomKeyboardEvent = function createCustomKeyboardEvent(event) {
|
4571
|
+
var customKeyboardEvent;
|
4682
4572
|
|
4683
|
-
|
4684
|
-
|
4685
|
-
|
4686
|
-
|
4687
|
-
|
4688
|
-
|
4689
|
-
|
4690
|
-
|
4691
|
-
|
4573
|
+
if (typeof KeyboardEvent === 'function') {
|
4574
|
+
customKeyboardEvent = new KeyboardEvent(event.type, event);
|
4575
|
+
} else {
|
4576
|
+
customKeyboardEvent = document.createEvent('Event');
|
4577
|
+
customKeyboardEvent.initEvent(event.type, true, true);
|
4578
|
+
customKeyboardEvent.keyCode = event.keyCode;
|
4579
|
+
customKeyboardEvent.charCode = event.charCode;
|
4580
|
+
}
|
4581
|
+
|
4582
|
+
return customKeyboardEvent;
|
4583
|
+
};
|
4584
|
+
var setInputValueByRef = function setInputValueByRef(input, value, event) {
|
4585
|
+
if (event === void 0) {
|
4586
|
+
event = 'change';
|
4587
|
+
}
|
4692
4588
|
|
4693
|
-
|
4694
|
-
|
4589
|
+
if (!input) {
|
4590
|
+
return;
|
4591
|
+
}
|
4695
4592
|
|
4696
|
-
|
4697
|
-
|
4593
|
+
var previousValue = input.value;
|
4594
|
+
input.value = value || '';
|
4595
|
+
var tracker = input._valueTracker;
|
4698
4596
|
|
4699
|
-
|
4700
|
-
|
4597
|
+
if (tracker) {
|
4598
|
+
tracker.setValue(previousValue);
|
4599
|
+
} // 'change' instead of 'input', see https://github.com/facebook/react/issues/11488#issuecomment-381590324
|
4701
4600
|
|
4702
|
-
|
4703
|
-
|
4704
|
-
}
|
4601
|
+
|
4602
|
+
input.dispatchEvent(createCustomEvent(event));
|
4705
4603
|
};
|
4706
|
-
var getButtonStateClasses = function getButtonStateClasses(value) {
|
4707
|
-
switch (value) {
|
4708
|
-
case 'success':
|
4709
|
-
return '!border-green focus:!border-green-light focus:yt-focus-green peer-focus:!border-green-light peer-focus:peer-active:!border-green-dark';
|
4710
4604
|
|
4711
|
-
|
4712
|
-
|
4605
|
+
var _excluded$f = ["hasChildren", "path"];
|
4606
|
+
var setInputValueByRef$1 = function setInputValueByRef$1(input, value, event) {
|
4607
|
+
if (event === void 0) {
|
4608
|
+
event = 'change';
|
4609
|
+
}
|
4713
4610
|
|
4714
|
-
|
4715
|
-
|
4611
|
+
setInputValueByRef(input, value !== undefined && value !== null ? String(value) : '', event);
|
4612
|
+
};
|
4716
4613
|
|
4717
|
-
|
4718
|
-
|
4614
|
+
var getValue = function getValue(value) {
|
4615
|
+
return value === undefined || value === null ? '' : String(value);
|
4616
|
+
};
|
4719
4617
|
|
4720
|
-
|
4721
|
-
|
4722
|
-
|
4618
|
+
var getIndexFromValue = function getIndexFromValue(data, value) {
|
4619
|
+
var index = data.findIndex(function (option) {
|
4620
|
+
return getValue(option.value) === getValue(value);
|
4621
|
+
});
|
4622
|
+
return index > -1 ? index : undefined;
|
4623
|
+
};
|
4624
|
+
var getSelectedIndexesFromValue = function getSelectedIndexesFromValue(data, value) {
|
4625
|
+
if (typeof value !== 'string') return [];
|
4626
|
+
return value.split(',').map(function (v) {
|
4627
|
+
return data.findIndex(function (o) {
|
4628
|
+
return String(o.value) === v;
|
4629
|
+
});
|
4630
|
+
}).filter(function (v) {
|
4631
|
+
return v !== -1;
|
4632
|
+
});
|
4633
|
+
};
|
4634
|
+
var findByValue = function findByValue(data, value) {
|
4635
|
+
return data.find(function (option) {
|
4636
|
+
return getValue(option.value) === getValue(value);
|
4637
|
+
});
|
4723
4638
|
};
|
4639
|
+
var searchForString = function searchForString(child, value, strategy) {
|
4640
|
+
if (strategy === void 0) {
|
4641
|
+
strategy = 'includes';
|
4642
|
+
}
|
4724
4643
|
|
4725
|
-
|
4726
|
-
var
|
4727
|
-
var button = props.button,
|
4728
|
-
icon = props.icon,
|
4729
|
-
state = props.state,
|
4730
|
-
autoFocus = props.autoFocus,
|
4731
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$i);
|
4644
|
+
try {
|
4645
|
+
var _child$props;
|
4732
4646
|
|
4733
|
-
|
4734
|
-
|
4735
|
-
var className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
|
4736
|
-
'pr-8': !!hasContainer
|
4737
|
-
}, !hasContainer && otherProps.className);
|
4738
|
-
React.useEffect(function () {
|
4739
|
-
if (autoFocus && inputRef.current) {
|
4740
|
-
inputRef.current.focus();
|
4741
|
-
}
|
4742
|
-
}, []);
|
4743
|
-
var input = React.createElement("input", Object.assign({}, otherProps, {
|
4744
|
-
className: className,
|
4745
|
-
"data-taco": "input",
|
4746
|
-
ref: inputRef
|
4747
|
-
}));
|
4647
|
+
if (typeof child !== 'string' && (_child$props = child.props) !== null && _child$props !== void 0 && _child$props.children) {
|
4648
|
+
var _child$props2, _child$props3;
|
4748
4649
|
|
4749
|
-
|
4750
|
-
|
4650
|
+
if (Array.isArray((_child$props2 = child.props) === null || _child$props2 === void 0 ? void 0 : _child$props2.children)) {
|
4651
|
+
return !!child.props.children.find(function (subChild) {
|
4652
|
+
return searchForString(subChild, value, strategy);
|
4653
|
+
});
|
4654
|
+
}
|
4751
4655
|
|
4752
|
-
|
4753
|
-
|
4656
|
+
return searchForString((_child$props3 = child.props) === null || _child$props3 === void 0 ? void 0 : _child$props3.children, value, strategy);
|
4657
|
+
} else {
|
4658
|
+
var _String;
|
4754
4659
|
|
4755
|
-
|
4756
|
-
var buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', (_cn = {}, _cn[getButtonStateClasses(state)] = !props.disabled, _cn), button.props.className);
|
4757
|
-
extra = React.cloneElement(button, {
|
4758
|
-
className: buttonClassName,
|
4759
|
-
disabled: disabled
|
4760
|
-
});
|
4761
|
-
} else if (icon) {
|
4762
|
-
var iconClassName = cn('items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2', {
|
4763
|
-
'text-grey-dark': props.disabled,
|
4764
|
-
'text-grey-darkest': !props.disabled
|
4765
|
-
});
|
4766
|
-
extra = typeof icon === 'string' ? React.createElement(Icon, {
|
4767
|
-
className: iconClassName,
|
4768
|
-
name: icon
|
4769
|
-
}) : React.cloneElement(icon, {
|
4770
|
-
className: cn(iconClassName, icon.props.className)
|
4771
|
-
});
|
4660
|
+
return child.toString().toLowerCase()[strategy]((_String = String(value)) === null || _String === void 0 ? void 0 : _String.toLowerCase());
|
4772
4661
|
}
|
4662
|
+
} catch (_unused) {
|
4663
|
+
return false;
|
4664
|
+
}
|
4665
|
+
};
|
4773
4666
|
|
4774
|
-
|
4775
|
-
|
4776
|
-
|
4777
|
-
"data-taco": "input-container"
|
4778
|
-
}, input, extra);
|
4667
|
+
var getIndexInRangeByValue = function getIndexInRangeByValue(data, query, firstIndex, lastIndex) {
|
4668
|
+
if (lastIndex === void 0) {
|
4669
|
+
lastIndex = data.length;
|
4779
4670
|
}
|
4780
4671
|
|
4781
|
-
|
4782
|
-
|
4672
|
+
var index = data.slice(firstIndex, lastIndex).findIndex(function (option) {
|
4673
|
+
if (option.disabled) {
|
4674
|
+
return false;
|
4675
|
+
}
|
4783
4676
|
|
4784
|
-
|
4785
|
-
|
4786
|
-
|
4787
|
-
|
4677
|
+
return searchForString(option.text, query, 'startsWith');
|
4678
|
+
});
|
4679
|
+
return index > -1 ? index + firstIndex : -1;
|
4680
|
+
};
|
4788
4681
|
|
4789
|
-
|
4790
|
-
var
|
4682
|
+
var findNextIndexByValue = function findNextIndexByValue(data, query, activeIndex) {
|
4683
|
+
var firstIndex = activeIndex === undefined ? 0 : activeIndex + 1;
|
4684
|
+
var index = getIndexInRangeByValue(data, query, firstIndex);
|
4791
4685
|
|
4792
|
-
|
4793
|
-
|
4794
|
-
|
4686
|
+
if (index === -1) {
|
4687
|
+
index = getIndexInRangeByValue(data, query, 0, activeIndex);
|
4688
|
+
}
|
4795
4689
|
|
4796
|
-
|
4797
|
-
|
4690
|
+
return index;
|
4691
|
+
};
|
4692
|
+
var getActiveDescendant = function getActiveDescendant(data, currentIndex, id) {
|
4693
|
+
return currentIndex !== undefined && data[currentIndex] ? getId(id, data[currentIndex].value) : undefined;
|
4694
|
+
};
|
4695
|
+
var useFlattenedData = function useFlattenedData(data) {
|
4696
|
+
return React__default.useMemo(function () {
|
4697
|
+
var items = [];
|
4798
4698
|
|
4799
|
-
|
4800
|
-
|
4699
|
+
var flatten = function flatten(item, path, parentPath, parentDisabled) {
|
4700
|
+
var currentPath = parentPath ? parentPath + "." + path : "" + path;
|
4701
|
+
var isItemDisabled = parentDisabled || item.disabled;
|
4702
|
+
items.push(_extends({}, item, {
|
4703
|
+
disabled: isItemDisabled,
|
4704
|
+
path: currentPath,
|
4705
|
+
hasChildren: !!item.children
|
4706
|
+
}));
|
4801
4707
|
|
4802
|
-
|
4803
|
-
|
4708
|
+
if (item.children) {
|
4709
|
+
item.children.forEach(function (childItem, childPath) {
|
4710
|
+
return flatten(childItem, childPath, currentPath, isItemDisabled);
|
4711
|
+
});
|
4712
|
+
}
|
4713
|
+
};
|
4804
4714
|
|
4805
|
-
|
4806
|
-
|
4807
|
-
|
4715
|
+
data.forEach(function (item, index) {
|
4716
|
+
flatten(item, index);
|
4717
|
+
});
|
4718
|
+
return items;
|
4719
|
+
}, [data]);
|
4808
4720
|
};
|
4809
|
-
var
|
4810
|
-
if (
|
4811
|
-
|
4812
|
-
}
|
4721
|
+
var sanitizeItem = function sanitizeItem(item) {
|
4722
|
+
if (item) {
|
4723
|
+
var rest = _objectWithoutPropertiesLoose(item, _excluded$f);
|
4813
4724
|
|
4814
|
-
|
4815
|
-
options = {
|
4816
|
-
direction: 'vertical'
|
4817
|
-
};
|
4725
|
+
return rest;
|
4818
4726
|
}
|
4819
4727
|
|
4820
|
-
|
4821
|
-
|
4822
|
-
|
4728
|
+
return undefined;
|
4729
|
+
};
|
4730
|
+
var getOptionParents = function getOptionParents(data, path) {
|
4731
|
+
var _path$split;
|
4823
4732
|
|
4824
|
-
var
|
4825
|
-
var nextIndex = getNextIndexFromKeycode(event.keyCode, length, index, options.direction);
|
4733
|
+
var indexes = (_path$split = path === null || path === void 0 ? void 0 : path.split('.')) !== null && _path$split !== void 0 ? _path$split : [];
|
4826
4734
|
|
4827
|
-
|
4828
|
-
|
4829
|
-
|
4735
|
+
if (indexes.length > 1) {
|
4736
|
+
// we don't want to map the current item
|
4737
|
+
indexes.pop(); // we need to rebuild the path as we map
|
4830
4738
|
|
4831
|
-
|
4832
|
-
|
4739
|
+
var lastPath;
|
4740
|
+
return indexes.map(function (i) {
|
4741
|
+
lastPath = lastPath ? [lastPath, i].join('.') : i;
|
4742
|
+
return sanitizeItem(data.find(function (i) {
|
4743
|
+
return i.path === lastPath;
|
4744
|
+
}));
|
4745
|
+
});
|
4746
|
+
}
|
4833
4747
|
|
4834
|
-
return
|
4748
|
+
return null;
|
4835
4749
|
};
|
4750
|
+
var filterData = function filterData(data, value) {
|
4751
|
+
if (value === void 0) {
|
4752
|
+
value = '';
|
4753
|
+
}
|
4836
4754
|
|
4837
|
-
|
4838
|
-
|
4839
|
-
|
4840
|
-
if (parent.scrollHeight > clientHeight) {
|
4841
|
-
var scrollTop = parent.scrollTop;
|
4842
|
-
var scrollBottom = clientHeight + scrollTop;
|
4843
|
-
var childBottom = child.offsetTop + child.offsetHeight;
|
4844
|
-
|
4845
|
-
if (childBottom > scrollBottom) {
|
4846
|
-
parent.scrollTop = childBottom - clientHeight;
|
4847
|
-
} else if (child.offsetTop < scrollTop) {
|
4848
|
-
parent.scrollTop = child.offsetTop;
|
4849
|
-
}
|
4755
|
+
if (value === '' || value === null) {
|
4756
|
+
return data;
|
4850
4757
|
}
|
4851
|
-
};
|
4852
4758
|
|
4853
|
-
var
|
4854
|
-
var scrollTo = function scrollTo(index) {
|
4855
|
-
if (internalRef && internalRef.current) {
|
4856
|
-
if (index !== undefined) {
|
4857
|
-
var activeRef = itemRefs[index];
|
4759
|
+
var filteredOptionValues = new Set();
|
4858
4760
|
|
4859
|
-
|
4860
|
-
|
4861
|
-
|
4862
|
-
} else {
|
4863
|
-
internalRef.current.scrollTop = 0;
|
4864
|
-
}
|
4761
|
+
var shouldFilterOption = function shouldFilterOption(option) {
|
4762
|
+
if (option.disabled) {
|
4763
|
+
return false;
|
4865
4764
|
}
|
4866
|
-
};
|
4867
4765
|
|
4868
|
-
|
4869
|
-
scrollTo: scrollTo
|
4766
|
+
return searchForString(option.text, String(value));
|
4870
4767
|
};
|
4871
|
-
};
|
4872
|
-
|
4873
|
-
var _excluded$j = ["data", "disabled", "highlighted", "id", "loading", "onChange", "onClick", "onFocus", "onKeyDown", "readOnly", "scrollOnFocus", "state", "value", "multiselect", "selectedIndexes", "allOptionsSelected"],
|
4874
|
-
_excluded2$1 = ["children", "icon"];
|
4875
|
-
var getId = function getId(id, value) {
|
4876
|
-
return id + "_" + value;
|
4877
|
-
};
|
4878
4768
|
|
4879
|
-
|
4880
|
-
|
4769
|
+
data.forEach(function (option) {
|
4770
|
+
if (shouldFilterOption(option)) {
|
4771
|
+
var parents = getOptionParents(data, option.path);
|
4772
|
+
filteredOptionValues.add(option.value);
|
4881
4773
|
|
4882
|
-
|
4883
|
-
|
4884
|
-
|
4885
|
-
|
4886
|
-
|
4774
|
+
if (parents !== null) {
|
4775
|
+
parents.forEach(function (option) {
|
4776
|
+
return filteredOptionValues.add(option === null || option === void 0 ? void 0 : option.value);
|
4777
|
+
});
|
4778
|
+
}
|
4887
4779
|
}
|
4888
|
-
}
|
4889
|
-
|
4890
|
-
|
4780
|
+
});
|
4781
|
+
return data.filter(function (_ref) {
|
4782
|
+
var value = _ref.value;
|
4783
|
+
return filteredOptionValues.has(value);
|
4784
|
+
});
|
4891
4785
|
};
|
4892
4786
|
|
4893
|
-
var
|
4894
|
-
|
4895
|
-
|
4896
|
-
|
4897
|
-
loading = props.loading,
|
4898
|
-
setCurrentIndex = props.onChange,
|
4899
|
-
onClick = props.onClick,
|
4900
|
-
onFocus = props.onFocus,
|
4901
|
-
onKeyDown = props.onKeyDown,
|
4902
|
-
readOnly = props.readOnly,
|
4903
|
-
_props$scrollOnFocus = props.scrollOnFocus,
|
4904
|
-
scrollOnFocus = _props$scrollOnFocus === void 0 ? false : _props$scrollOnFocus,
|
4905
|
-
currentIndex = props.value,
|
4906
|
-
multiselect = props.multiselect,
|
4907
|
-
_props$selectedIndexe = props.selectedIndexes,
|
4908
|
-
selectedIndexes = _props$selectedIndexe === void 0 ? [] : _props$selectedIndexe,
|
4909
|
-
_props$allOptionsSele = props.allOptionsSelected,
|
4910
|
-
allOptionsSelected = _props$allOptionsSele === void 0 ? false : _props$allOptionsSele,
|
4911
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$j);
|
4787
|
+
var _excluded$g = ["aria-label", "aria-labelledby", "data", "defaultValue", "disabled", "id", "inline", "loading", "onChange", "onClick", "onKeyDown", "onSearch", "readOnly", "value"];
|
4788
|
+
var debouncer = /*#__PURE__*/debounce(function (f) {
|
4789
|
+
return f();
|
4790
|
+
}, 200);
|
4912
4791
|
|
4913
|
-
|
4914
|
-
|
4915
|
-
|
4916
|
-
return React.createRef();
|
4917
|
-
});
|
4918
|
-
}, [data]);
|
4792
|
+
var convertToInputValue = function convertToInputValue(value) {
|
4793
|
+
return String(value !== null && value !== void 0 ? value : '');
|
4794
|
+
};
|
4919
4795
|
|
4920
|
-
|
4921
|
-
|
4796
|
+
var useCombobox = function useCombobox(_ref, ref) {
|
4797
|
+
var ariaLabelledBy = _ref['aria-labelledby'],
|
4798
|
+
_ref$data = _ref.data,
|
4799
|
+
unfilteredData = _ref$data === void 0 ? [] : _ref$data,
|
4800
|
+
defaultValue = _ref.defaultValue,
|
4801
|
+
disabled = _ref.disabled,
|
4802
|
+
inline = _ref.inline,
|
4803
|
+
onChange = _ref.onChange,
|
4804
|
+
onClick = _ref.onClick,
|
4805
|
+
onKeyDown = _ref.onKeyDown,
|
4806
|
+
onSearch = _ref.onSearch,
|
4807
|
+
readOnly = _ref.readOnly,
|
4808
|
+
value = _ref.value,
|
4809
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$g);
|
4922
4810
|
|
4923
|
-
var
|
4924
|
-
|
4811
|
+
var inputRef = useProxiedRef(ref);
|
4812
|
+
var listRef = React.useRef(null);
|
4925
4813
|
|
4926
|
-
React.
|
4927
|
-
|
4928
|
-
|
4814
|
+
var _React$useState = React.useState(false),
|
4815
|
+
open = _React$useState[0],
|
4816
|
+
setOpen = _React$useState[1];
|
4929
4817
|
|
4930
|
-
var
|
4931
|
-
|
4818
|
+
var listId = React.useMemo(function () {
|
4819
|
+
return uuid.v4();
|
4820
|
+
}, []);
|
4932
4821
|
|
4933
|
-
|
4934
|
-
|
4935
|
-
|
4936
|
-
setCurrentIndex(nextIndex);
|
4937
|
-
}
|
4822
|
+
var _React$useState2 = React.useState(convertToInputValue(value)),
|
4823
|
+
inputValue = _React$useState2[0],
|
4824
|
+
setInputValue = _React$useState2[1];
|
4938
4825
|
|
4939
|
-
|
4940
|
-
|
4941
|
-
|
4942
|
-
|
4943
|
-
|
4944
|
-
};
|
4826
|
+
var shouldFilterData = !onSearch && (!inline || inline && inputValue !== convertToInputValue(value));
|
4827
|
+
var flattenedData = useFlattenedData(unfilteredData);
|
4828
|
+
var data = React.useMemo(function () {
|
4829
|
+
return shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData;
|
4830
|
+
}, [shouldFilterData, inputValue, flattenedData]); // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state
|
4945
4831
|
|
4946
|
-
var
|
4947
|
-
|
4948
|
-
setCurrentIndex
|
4832
|
+
var _React$useState3 = React.useState(inputValue !== undefined ? getIndexFromValue(data, inputValue) : undefined),
|
4833
|
+
currentIndex = _React$useState3[0],
|
4834
|
+
setCurrentIndex = _React$useState3[1];
|
4949
4835
|
|
4950
|
-
|
4951
|
-
|
4952
|
-
|
4836
|
+
var setInputValueByIndex = function setInputValueByIndex(index) {
|
4837
|
+
if (index !== undefined) {
|
4838
|
+
var option = data[index];
|
4839
|
+
|
4840
|
+
if (option && !option.disabled) {
|
4841
|
+
setInputValueByRef$1(inputRef.current, option.value, 'focusout');
|
4953
4842
|
}
|
4954
|
-
}
|
4843
|
+
}
|
4955
4844
|
};
|
4956
4845
|
|
4957
|
-
var
|
4958
|
-
if (
|
4959
|
-
|
4846
|
+
var setCurrentValue = function setCurrentValue(index) {
|
4847
|
+
if (index === undefined) {
|
4848
|
+
return;
|
4960
4849
|
}
|
4961
4850
|
|
4962
|
-
if
|
4963
|
-
event.persist();
|
4964
|
-
onFocus(event);
|
4965
|
-
}
|
4966
|
-
};
|
4851
|
+
var option = data[index]; // if the selected option is not already selected, trigger blur event
|
4967
4852
|
|
4968
|
-
|
4969
|
-
|
4970
|
-
return allOptionsSelected;
|
4971
|
-
} else if (!optionValue || !selectedIndexes) {
|
4972
|
-
return false;
|
4853
|
+
if (option.value !== value) {
|
4854
|
+
setInputValueByIndex(index);
|
4973
4855
|
} else {
|
4974
|
-
|
4975
|
-
|
4976
|
-
}) !== -1;
|
4856
|
+
// if the selected option is already selected, refill input with its value
|
4857
|
+
setInputValue(convertToInputValue(value));
|
4977
4858
|
}
|
4978
|
-
};
|
4859
|
+
}; // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set
|
4979
4860
|
|
4980
|
-
var list = _extends({}, otherProps, {
|
4981
|
-
className: cn('inline-flex flex-col list-none !p-0 m-0 overflow-y-auto h-auto', getInputClasses(props), {
|
4982
|
-
'yt-list--multiselect': multiselect,
|
4983
|
-
'pointer-events-none': disabled,
|
4984
|
-
'cursor-not-allowed': disabled || readOnly
|
4985
|
-
}, otherProps.className),
|
4986
|
-
disabled: disabled,
|
4987
|
-
id: id,
|
4988
|
-
onFocus: !disabled && !readOnly ? handleFocus : undefined,
|
4989
|
-
onKeyDown: !disabled && !readOnly ? handleKeyDown : undefined,
|
4990
|
-
readOnly: readOnly,
|
4991
|
-
ref: listRef,
|
4992
|
-
role: 'listbox',
|
4993
|
-
tabIndex: otherProps.tabIndex || 0
|
4994
|
-
});
|
4995
4861
|
|
4996
|
-
|
4997
|
-
|
4998
|
-
|
4999
|
-
|
5000
|
-
|
5001
|
-
children: option.text,
|
5002
|
-
className: cn('flex items-center px-3 w-full cursor-pointer bg-white flex-[0_0_2rem] focus:wcag-blue focus:border-blue', {
|
5003
|
-
'sticky top-0 font-bold': depth === 0 && !!option.hasChildren
|
5004
|
-
}),
|
5005
|
-
disabled: option.disabled,
|
5006
|
-
icon: option.icon,
|
5007
|
-
id: getId(id, option.value),
|
5008
|
-
key: getId(id, option.value),
|
5009
|
-
onClick: !disabled && !readOnly ? handleClick(index) : undefined,
|
5010
|
-
ref: itemRefs[index],
|
5011
|
-
role: 'option',
|
5012
|
-
style: depth > 0 ? {
|
5013
|
-
paddingLeft: depth + 1 + "rem"
|
5014
|
-
} : undefined
|
5015
|
-
};
|
5016
|
-
});
|
5017
|
-
return React.createElement("ul", Object.assign({}, list, {
|
5018
|
-
"data-taco": "scrollable-list"
|
5019
|
-
}), loading ? React.createElement("li", {
|
5020
|
-
className: "yt-list__empty"
|
5021
|
-
}, React.createElement("span", null, React.createElement(Spinner$1, {
|
5022
|
-
delay: 0
|
5023
|
-
})), React.createElement("span", null, texts.listbox.loading)) : options.length ? options.map(function (_ref) {
|
5024
|
-
var children = _ref.children,
|
5025
|
-
icon = _ref.icon,
|
5026
|
-
optionProps = _objectWithoutPropertiesLoose(_ref, _excluded2$1);
|
4862
|
+
React.useEffect(function () {
|
4863
|
+
if (defaultValue && !value) {
|
4864
|
+
setInputValueByIndex(getIndexFromValue(data, defaultValue));
|
4865
|
+
}
|
4866
|
+
}, [data]); // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc
|
5027
4867
|
|
5028
|
-
|
5029
|
-
|
5030
|
-
|
5031
|
-
|
5032
|
-
|
5033
|
-
|
5034
|
-
|
5035
|
-
|
5036
|
-
|
5037
|
-
|
5038
|
-
|
5039
|
-
},
|
5040
|
-
});
|
4868
|
+
React.useEffect(function () {
|
4869
|
+
if (value !== undefined && value !== inputValue) {
|
4870
|
+
setInputValue(convertToInputValue(value));
|
4871
|
+
}
|
4872
|
+
}, [value]);
|
4873
|
+
React.useEffect(function () {
|
4874
|
+
if (onSearch) {
|
4875
|
+
debouncer(function () {
|
4876
|
+
onSearch(inputValue);
|
4877
|
+
});
|
4878
|
+
}
|
4879
|
+
}, [inputValue]); // show listbox based on input value
|
5041
4880
|
|
5042
|
-
|
5043
|
-
|
5044
|
-
|
4881
|
+
React.useEffect(function () {
|
4882
|
+
// don't show the popover if the internal (input) value already is the current value
|
4883
|
+
// this prevents the popover showing after selecting a value or pressing escape
|
4884
|
+
var isCurrentValue = value !== undefined && value !== null && inputValue === String(value);
|
5045
4885
|
|
5046
|
-
|
5047
|
-
|
5048
|
-
bubbles: true
|
5049
|
-
});
|
5050
|
-
} else {
|
5051
|
-
customEvent = document.createEvent('Event');
|
5052
|
-
customEvent.initEvent(eventType, true, true);
|
5053
|
-
}
|
4886
|
+
if (inputValue && data.length && !isCurrentValue) {
|
4887
|
+
setCurrentIndex(0);
|
5054
4888
|
|
5055
|
-
|
5056
|
-
|
4889
|
+
if (!open) {
|
4890
|
+
setOpen(true);
|
4891
|
+
}
|
4892
|
+
} else {
|
4893
|
+
setOpen(false);
|
4894
|
+
}
|
4895
|
+
}, [inputValue, data]);
|
4896
|
+
React.useEffect(function () {
|
4897
|
+
if (open) {
|
4898
|
+
setCurrentIndex(getIndexFromValue(data, inputValue) || 0);
|
4899
|
+
} else {
|
4900
|
+
setCurrentIndex(undefined);
|
4901
|
+
}
|
4902
|
+
}, [open]); // event handlers
|
5057
4903
|
|
5058
|
-
var
|
5059
|
-
|
4904
|
+
var handleInputBlur = function handleInputBlur(event) {
|
4905
|
+
event.persist();
|
5060
4906
|
|
5061
|
-
|
5062
|
-
|
5063
|
-
|
5064
|
-
|
5065
|
-
customKeyboardEvent.initEvent(event.type, true, true);
|
5066
|
-
customKeyboardEvent.keyCode = event.keyCode;
|
5067
|
-
customKeyboardEvent.charCode = event.charCode;
|
5068
|
-
}
|
4907
|
+
if (event.relatedTarget === listRef.current) {
|
4908
|
+
event.preventDefault();
|
4909
|
+
return;
|
4910
|
+
}
|
5069
4911
|
|
5070
|
-
|
5071
|
-
|
5072
|
-
|
5073
|
-
|
5074
|
-
event = 'change';
|
5075
|
-
}
|
4912
|
+
if (onChange && event.target.value !== value) {
|
4913
|
+
var item = findByValue(flattenedData, event.target.value);
|
4914
|
+
event.detail = sanitizeItem(item);
|
4915
|
+
var parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
5076
4916
|
|
5077
|
-
|
5078
|
-
|
5079
|
-
|
4917
|
+
if (parents !== null && parents.length > 0) {
|
4918
|
+
event.detail.parents = parents;
|
4919
|
+
}
|
5080
4920
|
|
5081
|
-
|
5082
|
-
|
5083
|
-
var tracker = input._valueTracker;
|
4921
|
+
onChange(event);
|
4922
|
+
}
|
5084
4923
|
|
5085
|
-
|
5086
|
-
|
5087
|
-
|
4924
|
+
if (props.onBlur) {
|
4925
|
+
props.onBlur(event);
|
4926
|
+
}
|
4927
|
+
};
|
5088
4928
|
|
4929
|
+
var handleInputChange = function handleInputChange(event) {
|
4930
|
+
setInputValue(event.target.value);
|
4931
|
+
};
|
5089
4932
|
|
5090
|
-
|
5091
|
-
|
4933
|
+
var handleInputClick = function handleInputClick(event) {
|
4934
|
+
if (inline || !open && inputValue && data.length) {
|
4935
|
+
setOpen(true);
|
4936
|
+
}
|
5092
4937
|
|
5093
|
-
|
5094
|
-
|
5095
|
-
|
5096
|
-
|
5097
|
-
}
|
4938
|
+
if (onClick) {
|
4939
|
+
event.persist();
|
4940
|
+
onClick(event);
|
4941
|
+
}
|
4942
|
+
};
|
5098
4943
|
|
5099
|
-
|
5100
|
-
|
4944
|
+
var handleInputKeyDown = function handleInputKeyDown(event) {
|
4945
|
+
event.persist();
|
5101
4946
|
|
5102
|
-
|
5103
|
-
|
5104
|
-
|
4947
|
+
switch (event.keyCode) {
|
4948
|
+
case keycode('backspace'):
|
4949
|
+
{
|
4950
|
+
return;
|
4951
|
+
}
|
5105
4952
|
|
5106
|
-
|
5107
|
-
|
5108
|
-
|
5109
|
-
|
5110
|
-
|
5111
|
-
|
5112
|
-
|
5113
|
-
if (typeof value !== 'string') return [];
|
5114
|
-
return value.split(',').map(function (v) {
|
5115
|
-
return data.findIndex(function (o) {
|
5116
|
-
return String(o.value) === v;
|
5117
|
-
});
|
5118
|
-
}).filter(function (v) {
|
5119
|
-
return v !== -1;
|
5120
|
-
});
|
5121
|
-
};
|
5122
|
-
var findByValue = function findByValue(data, value) {
|
5123
|
-
return data.find(function (option) {
|
5124
|
-
return getValue(option.value) === getValue(value);
|
5125
|
-
});
|
5126
|
-
};
|
5127
|
-
var searchForString = function searchForString(child, value, strategy) {
|
5128
|
-
if (strategy === void 0) {
|
5129
|
-
strategy = 'includes';
|
5130
|
-
}
|
4953
|
+
case keycode('escape'):
|
4954
|
+
{
|
4955
|
+
event.preventDefault();
|
4956
|
+
setInputValue(convertToInputValue(value));
|
4957
|
+
setOpen(false);
|
4958
|
+
return;
|
4959
|
+
}
|
5131
4960
|
|
5132
|
-
|
5133
|
-
|
4961
|
+
case keycode('tab'):
|
4962
|
+
case keycode('enter'):
|
4963
|
+
{
|
4964
|
+
if (event.keyCode !== keycode('tab')) {
|
4965
|
+
event.preventDefault();
|
4966
|
+
}
|
5134
4967
|
|
5135
|
-
|
5136
|
-
|
4968
|
+
setCurrentValue(currentIndex);
|
4969
|
+
setOpen(false);
|
4970
|
+
return;
|
4971
|
+
}
|
5137
4972
|
|
5138
|
-
|
5139
|
-
|
5140
|
-
|
5141
|
-
|
5142
|
-
|
4973
|
+
case keycode('up'):
|
4974
|
+
case keycode('down'):
|
4975
|
+
case keycode('home'):
|
4976
|
+
case keycode('end'):
|
4977
|
+
{
|
4978
|
+
if (open) {
|
4979
|
+
event.preventDefault();
|
4980
|
+
}
|
5143
4981
|
|
5144
|
-
|
5145
|
-
|
5146
|
-
|
4982
|
+
break;
|
4983
|
+
}
|
4984
|
+
} // we aren't focused on the list, so manually forward the keydown event to it
|
5147
4985
|
|
5148
|
-
|
4986
|
+
|
4987
|
+
if (listRef.current) {
|
4988
|
+
listRef.current.dispatchEvent(createCustomKeyboardEvent(event));
|
5149
4989
|
}
|
5150
|
-
} catch (_unused) {
|
5151
|
-
return false;
|
5152
|
-
}
|
5153
|
-
};
|
5154
4990
|
|
5155
|
-
|
5156
|
-
|
5157
|
-
|
5158
|
-
|
4991
|
+
if (inline && !open) {
|
4992
|
+
if (event.keyCode === keycode('up') || event.keyCode === keycode('down')) {
|
4993
|
+
event.preventDefault();
|
4994
|
+
var initialIndex = event.keyCode === keycode('up') ? data.length - 1 : 0;
|
4995
|
+
setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
|
4996
|
+
setOpen(true);
|
4997
|
+
}
|
4998
|
+
}
|
5159
4999
|
|
5160
|
-
|
5161
|
-
|
5162
|
-
|
5000
|
+
if (!event.isDefaultPrevented() && onKeyDown) {
|
5001
|
+
event.persist();
|
5002
|
+
onKeyDown(event);
|
5163
5003
|
}
|
5004
|
+
};
|
5164
5005
|
|
5165
|
-
|
5166
|
-
|
5167
|
-
|
5168
|
-
};
|
5006
|
+
var handleListboxChange = function handleListboxChange(index) {
|
5007
|
+
setCurrentIndex(index);
|
5008
|
+
};
|
5169
5009
|
|
5170
|
-
var
|
5171
|
-
|
5172
|
-
|
5010
|
+
var handleListboxClick = function handleListboxClick(event, index) {
|
5011
|
+
event.preventDefault();
|
5012
|
+
setCurrentValue(index);
|
5013
|
+
setOpen(false);
|
5014
|
+
};
|
5173
5015
|
|
5174
|
-
|
5175
|
-
|
5176
|
-
|
5016
|
+
var combobox = {
|
5017
|
+
'aria-expanded': open,
|
5018
|
+
'aria-owns': listId,
|
5019
|
+
'aria-haspopup': 'listbox',
|
5020
|
+
role: 'combobox'
|
5021
|
+
};
|
5177
5022
|
|
5178
|
-
|
5023
|
+
var input = _extends({}, props, {
|
5024
|
+
'aria-controls': listId,
|
5025
|
+
// Indicates that the autocomplete behavior of the text input is to suggest a list of possible values in a popup and that the suggestions
|
5026
|
+
// are related to the string that is present in the textbox
|
5027
|
+
'aria-autocomplete': 'list',
|
5028
|
+
// Enables assistive technologies to know which element the application regards as focused while DOM focus remains on the input element
|
5029
|
+
'aria-activedescendant': currentIndex !== undefined && data[currentIndex] ? getId(listId, String(data[currentIndex].value)) : undefined,
|
5030
|
+
'aria-labelledby': ariaLabelledBy,
|
5031
|
+
disabled: disabled,
|
5032
|
+
onBlur: !disabled && !readOnly ? handleInputBlur : undefined,
|
5033
|
+
onChange: !disabled && !readOnly ? handleInputChange : undefined,
|
5034
|
+
onClick: !disabled && !readOnly ? handleInputClick : undefined,
|
5035
|
+
onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,
|
5036
|
+
readOnly: readOnly,
|
5037
|
+
ref: inputRef,
|
5038
|
+
type: 'text',
|
5039
|
+
value: inputValue || ''
|
5040
|
+
});
|
5041
|
+
|
5042
|
+
var list = {
|
5043
|
+
'aria-labelledby': ariaLabelledBy,
|
5044
|
+
data: data,
|
5045
|
+
disabled: disabled,
|
5046
|
+
id: listId,
|
5047
|
+
onChange: handleListboxChange,
|
5048
|
+
onClick: handleListboxClick,
|
5049
|
+
ref: listRef,
|
5050
|
+
scrollOnFocus: false,
|
5051
|
+
tabIndex: -1,
|
5052
|
+
value: currentIndex
|
5053
|
+
};
|
5054
|
+
return {
|
5055
|
+
combobox: combobox,
|
5056
|
+
input: input,
|
5057
|
+
list: list,
|
5058
|
+
popover: {
|
5059
|
+
open: open,
|
5060
|
+
onOpenChange: setOpen
|
5061
|
+
}
|
5062
|
+
};
|
5179
5063
|
};
|
5180
|
-
|
5181
|
-
|
5064
|
+
|
5065
|
+
var getVisibility = function getVisibility(element) {
|
5066
|
+
return Boolean(element && (element.offsetWidth || element.offsetHeight || element.getClientRects().length));
|
5182
5067
|
};
|
5183
|
-
var useFlattenedData = function useFlattenedData(data) {
|
5184
|
-
return React__default.useMemo(function () {
|
5185
|
-
var items = [];
|
5186
5068
|
|
5187
|
-
|
5188
|
-
|
5189
|
-
|
5190
|
-
|
5191
|
-
disabled: isItemDisabled,
|
5192
|
-
path: currentPath,
|
5193
|
-
hasChildren: !!item.children
|
5194
|
-
}));
|
5069
|
+
var useBoundingClientRectListener = function useBoundingClientRectListener(ref) {
|
5070
|
+
var _React$useState = React.useState(undefined),
|
5071
|
+
dimensions = _React$useState[0],
|
5072
|
+
setDimensions = _React$useState[1];
|
5195
5073
|
|
5196
|
-
|
5197
|
-
item.children.forEach(function (childItem, childPath) {
|
5198
|
-
return flatten(childItem, childPath, currentPath, isItemDisabled);
|
5199
|
-
});
|
5200
|
-
}
|
5201
|
-
};
|
5074
|
+
var isRefElementVisible = getVisibility(ref.current);
|
5202
5075
|
|
5203
|
-
|
5204
|
-
|
5205
|
-
|
5206
|
-
return items;
|
5207
|
-
}, [data]);
|
5208
|
-
};
|
5209
|
-
var sanitizeItem = function sanitizeItem(item) {
|
5210
|
-
if (item) {
|
5211
|
-
var rest = _objectWithoutPropertiesLoose(item, _excluded$k);
|
5076
|
+
var _React$useState2 = React.useState(isRefElementVisible),
|
5077
|
+
visibility = _React$useState2[0],
|
5078
|
+
setVisibility = _React$useState2[1];
|
5212
5079
|
|
5213
|
-
|
5214
|
-
|
5080
|
+
var resize = function resize() {
|
5081
|
+
if (visibility) {
|
5082
|
+
var _ref$current;
|
5215
5083
|
|
5216
|
-
|
5084
|
+
setDimensions((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect());
|
5085
|
+
}
|
5086
|
+
};
|
5087
|
+
|
5088
|
+
React.useEffect(function () {
|
5089
|
+
var timeout = setTimeout(resize, 0);
|
5090
|
+
var debouncedResize = debounce(resize, 250);
|
5091
|
+
window.addEventListener('resize', debouncedResize);
|
5092
|
+
return function () {
|
5093
|
+
clearTimeout(timeout);
|
5094
|
+
window.removeEventListener('resize', debouncedResize);
|
5095
|
+
};
|
5096
|
+
}, [ref.current, visibility]);
|
5097
|
+
React.useEffect(function () {
|
5098
|
+
var newRefElementVisibility = getVisibility(ref.current);
|
5099
|
+
|
5100
|
+
if (visibility !== newRefElementVisibility) {
|
5101
|
+
// When visibility of an element changes, then the new visibility of the element can only be checked after the
|
5102
|
+
// component has rendered. That's why the visibility check is inside the useEffect. This useEffect will cause
|
5103
|
+
// the consumer to rerender and that will cause the above hook to recalculate the dimensions
|
5104
|
+
setVisibility(newRefElementVisibility);
|
5105
|
+
}
|
5106
|
+
});
|
5107
|
+
return dimensions;
|
5217
5108
|
};
|
5218
|
-
var getOptionParents = function getOptionParents(data, path) {
|
5219
|
-
var _path$split;
|
5220
5109
|
|
5221
|
-
|
5110
|
+
var _excluded$h = ["className", "style"];
|
5111
|
+
var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
5112
|
+
var externalClassName = props.className,
|
5113
|
+
style = props.style,
|
5114
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$h);
|
5222
5115
|
|
5223
|
-
|
5224
|
-
|
5225
|
-
|
5116
|
+
var _useCombobox = useCombobox(otherProps, ref),
|
5117
|
+
combobox = _useCombobox.combobox,
|
5118
|
+
input = _useCombobox.input,
|
5119
|
+
popover = _useCombobox.popover,
|
5120
|
+
list = _useCombobox.list;
|
5226
5121
|
|
5227
|
-
|
5228
|
-
|
5229
|
-
|
5230
|
-
|
5231
|
-
|
5232
|
-
|
5233
|
-
|
5234
|
-
|
5122
|
+
var internalRef = React.useRef(null);
|
5123
|
+
var selectDimensions = useBoundingClientRectListener(internalRef);
|
5124
|
+
var className = cn('inline-flex relative', {
|
5125
|
+
'yt-combobox--inline': props.inline
|
5126
|
+
}, externalClassName);
|
5127
|
+
return React.createElement("span", {
|
5128
|
+
className: className,
|
5129
|
+
"data-taco": "combobox",
|
5130
|
+
style: style
|
5131
|
+
}, React.createElement(PopoverPrimitive.Root, Object.assign({}, popover), React.createElement(PopoverPrimitive.Anchor, {
|
5132
|
+
asChild: true,
|
5133
|
+
ref: internalRef
|
5134
|
+
}, React.createElement("div", Object.assign({}, combobox, {
|
5135
|
+
className: "inline w-full",
|
5136
|
+
ref: ref
|
5137
|
+
}), React.createElement(Input, Object.assign({}, input, {
|
5138
|
+
autoComplete: "off",
|
5139
|
+
button: props.inline ? React.createElement(IconButton, {
|
5140
|
+
appearance: "discrete",
|
5141
|
+
className: "focus:!border-none focus:!shadow-none active:!border-none",
|
5142
|
+
icon: popover.open ? 'chevron-up' : 'chevron-down',
|
5143
|
+
onClick: function onClick() {
|
5144
|
+
return popover.onOpenChange(true);
|
5145
|
+
},
|
5146
|
+
tabIndex: -1
|
5147
|
+
}) : props.button
|
5148
|
+
})))), React.createElement(PopoverPrimitive.Content, {
|
5149
|
+
align: "start",
|
5150
|
+
onOpenAutoFocus: function onOpenAutoFocus(event) {
|
5151
|
+
event.preventDefault();
|
5152
|
+
},
|
5153
|
+
sideOffset: 4
|
5154
|
+
}, React.createElement(ScrollableList, Object.assign({}, list, {
|
5155
|
+
className: cn('border-blue max-h-[calc(12rem+2px)] w-auto max-w-[theme(spacing.96)]'),
|
5156
|
+
style: {
|
5157
|
+
minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
|
5158
|
+
},
|
5159
|
+
tabIndex: popover.open ? 0 : -1
|
5160
|
+
})))));
|
5161
|
+
});
|
5235
5162
|
|
5236
|
-
|
5237
|
-
|
5238
|
-
|
5239
|
-
if (value === void 0) {
|
5240
|
-
value = '';
|
5163
|
+
var format = function format(date, mask) {
|
5164
|
+
if (mask === void 0) {
|
5165
|
+
mask = 'dd.mm.yy';
|
5241
5166
|
}
|
5242
5167
|
|
5243
|
-
if (
|
5244
|
-
return
|
5168
|
+
if (!date) {
|
5169
|
+
return undefined;
|
5245
5170
|
}
|
5246
5171
|
|
5247
|
-
var
|
5172
|
+
var value = dateFns.isDate(date) ? date : dateFns.toDate(date);
|
5248
5173
|
|
5249
|
-
|
5250
|
-
|
5251
|
-
|
5252
|
-
}
|
5174
|
+
if (!dateFns.isValid(value)) {
|
5175
|
+
return undefined;
|
5176
|
+
}
|
5253
5177
|
|
5254
|
-
|
5178
|
+
var pad = function pad(v) {
|
5179
|
+
return String(v).length === 1 ? "0" + v : v.toString();
|
5255
5180
|
};
|
5256
5181
|
|
5257
|
-
|
5258
|
-
if (shouldFilterOption(option)) {
|
5259
|
-
var parents = getOptionParents(data, option.path);
|
5260
|
-
filteredOptionValues.add(option.value);
|
5261
|
-
|
5262
|
-
if (parents !== null) {
|
5263
|
-
parents.forEach(function (option) {
|
5264
|
-
return filteredOptionValues.add(option === null || option === void 0 ? void 0 : option.value);
|
5265
|
-
});
|
5266
|
-
}
|
5267
|
-
}
|
5268
|
-
});
|
5269
|
-
return data.filter(function (_ref) {
|
5270
|
-
var value = _ref.value;
|
5271
|
-
return filteredOptionValues.has(value);
|
5272
|
-
});
|
5273
|
-
};
|
5274
|
-
|
5275
|
-
var _excluded$l = ["aria-label", "aria-labelledby", "data", "defaultValue", "disabled", "id", "inline", "loading", "onChange", "onClick", "onKeyDown", "onSearch", "readOnly", "value"];
|
5276
|
-
var debouncer = /*#__PURE__*/debounce(function (f) {
|
5277
|
-
return f();
|
5278
|
-
}, 200);
|
5279
|
-
|
5280
|
-
var convertToInputValue = function convertToInputValue(value) {
|
5281
|
-
return String(value !== null && value !== void 0 ? value : '');
|
5182
|
+
return mask.replace('dd', pad(value.getDate())).replace('mm', pad(value.getMonth() + 1)).replace('yy', String(value.getFullYear()).slice(2));
|
5282
5183
|
};
|
5184
|
+
var parseFromCustomString = function parseFromCustomString(date, mask) {
|
5185
|
+
if (date === void 0) {
|
5186
|
+
date = '';
|
5187
|
+
}
|
5283
5188
|
|
5284
|
-
|
5285
|
-
|
5286
|
-
|
5287
|
-
unfilteredData = _ref$data === void 0 ? [] : _ref$data,
|
5288
|
-
defaultValue = _ref.defaultValue,
|
5289
|
-
disabled = _ref.disabled,
|
5290
|
-
inline = _ref.inline,
|
5291
|
-
onChange = _ref.onChange,
|
5292
|
-
onClick = _ref.onClick,
|
5293
|
-
onKeyDown = _ref.onKeyDown,
|
5294
|
-
onSearch = _ref.onSearch,
|
5295
|
-
readOnly = _ref.readOnly,
|
5296
|
-
value = _ref.value,
|
5297
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$l);
|
5298
|
-
|
5299
|
-
var inputRef = useProxiedRef(ref);
|
5300
|
-
var listRef = React.useRef(null);
|
5189
|
+
if (mask === void 0) {
|
5190
|
+
mask = 'dd.mm.yy';
|
5191
|
+
}
|
5301
5192
|
|
5302
|
-
|
5303
|
-
|
5304
|
-
|
5193
|
+
if (!date || !date.length) {
|
5194
|
+
return undefined;
|
5195
|
+
}
|
5305
5196
|
|
5306
|
-
var
|
5307
|
-
|
5308
|
-
|
5197
|
+
var sanitizedMask = mask.split(/[^dmy]/);
|
5198
|
+
var dd = sanitizedMask.findIndex(function (x) {
|
5199
|
+
return x === 'dd';
|
5200
|
+
});
|
5201
|
+
var mm = sanitizedMask.findIndex(function (x) {
|
5202
|
+
return x === 'mm';
|
5203
|
+
});
|
5204
|
+
var yy = sanitizedMask.findIndex(function (x) {
|
5205
|
+
return x === 'yy' || x === 'yyyy';
|
5206
|
+
});
|
5207
|
+
var day;
|
5208
|
+
var month;
|
5209
|
+
var year;
|
5309
5210
|
|
5310
|
-
var
|
5311
|
-
|
5312
|
-
|
5211
|
+
var getFullYear = function getFullYear(y) {
|
5212
|
+
if (y && y.length === 2) {
|
5213
|
+
var z = Number.parseInt(y, 10);
|
5214
|
+
return z > 50 ? "19" + y : "20" + y;
|
5215
|
+
}
|
5313
5216
|
|
5314
|
-
|
5315
|
-
|
5316
|
-
var data = React.useMemo(function () {
|
5317
|
-
return shouldFilterData ? filterData(flattenedData, inputValue) : flattenedData;
|
5318
|
-
}, [shouldFilterData, inputValue, flattenedData]); // listbox/select change value _with_ the index, but combobox changes on select of an index (click/enter), so we need state
|
5217
|
+
return y;
|
5218
|
+
};
|
5319
5219
|
|
5320
|
-
var
|
5321
|
-
currentIndex = _React$useState3[0],
|
5322
|
-
setCurrentIndex = _React$useState3[1];
|
5220
|
+
var inputParts = date.split(/\D/);
|
5323
5221
|
|
5324
|
-
|
5325
|
-
|
5326
|
-
|
5222
|
+
if (inputParts.length === 1) {
|
5223
|
+
var fullDate = inputParts[0];
|
5224
|
+
var unseparatedMask = mask.replace(/[^dmy]/g, '');
|
5225
|
+
day = fullDate.slice(unseparatedMask.indexOf('d'), unseparatedMask.lastIndexOf('d') + 1);
|
5226
|
+
month = fullDate.slice(unseparatedMask.indexOf('m'), unseparatedMask.lastIndexOf('m') + 1);
|
5227
|
+
year = getFullYear(fullDate.slice(unseparatedMask.indexOf('y'), unseparatedMask.lastIndexOf('y') + 3)); // account for full years
|
5228
|
+
} else {
|
5229
|
+
day = inputParts[dd];
|
5230
|
+
month = inputParts[mm];
|
5231
|
+
year = getFullYear(inputParts[yy]);
|
5232
|
+
}
|
5327
5233
|
|
5328
|
-
|
5329
|
-
|
5330
|
-
|
5331
|
-
|
5332
|
-
|
5234
|
+
day = Number.parseInt(day, 10);
|
5235
|
+
month = Number.parseInt(month, 10);
|
5236
|
+
year = Number.parseInt(year, 10);
|
5237
|
+
var currentDate = new Date();
|
5238
|
+
return new Date(
|
5239
|
+
/* year */
|
5240
|
+
Object.is(year, NaN) ? currentDate.getFullYear() : year,
|
5241
|
+
/* month */
|
5242
|
+
Object.is(month, NaN) ? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day
|
5333
5243
|
|
5334
|
-
|
5335
|
-
|
5336
|
-
|
5337
|
-
|
5244
|
+
/* day */
|
5245
|
+
Object.is(day, NaN) ? currentDate.getDate() : day,
|
5246
|
+
/* hours */
|
5247
|
+
12,
|
5248
|
+
/* minutes */
|
5249
|
+
0 // set to midday to avoid UTC offset causing dates to be mismatched server side
|
5250
|
+
);
|
5251
|
+
};
|
5252
|
+
var parseFromISOString = function parseFromISOString(date) {
|
5253
|
+
var tempDate = new Date(date);
|
5254
|
+
return dateFns.isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;
|
5255
|
+
};
|
5338
5256
|
|
5339
|
-
|
5257
|
+
var _excluded$i = ["defaultValue", "calendar", "onBlur", "onChange", "value"];
|
5258
|
+
var useDatepicker = function useDatepicker(_ref, ref) {
|
5259
|
+
var calendar = _ref.calendar,
|
5260
|
+
onBlur = _ref.onBlur,
|
5261
|
+
onChange = _ref.onChange,
|
5262
|
+
value = _ref.value,
|
5263
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$i);
|
5340
5264
|
|
5341
|
-
|
5342
|
-
setInputValueByIndex(index);
|
5343
|
-
} else {
|
5344
|
-
// if the selected option is already selected, refill input with its value
|
5345
|
-
setInputValue(convertToInputValue(value));
|
5346
|
-
}
|
5347
|
-
}; // ensure the external value is synced with the internal value when mounting, e.g. incase a default value was set
|
5265
|
+
var inputRef = useProxiedRef(ref);
|
5348
5266
|
|
5267
|
+
var _useLocalization = useLocalization(),
|
5268
|
+
formatting = _useLocalization.formatting;
|
5349
5269
|
|
5350
|
-
React.
|
5351
|
-
|
5352
|
-
|
5353
|
-
}
|
5354
|
-
}, [data]); // update input value if it changed 'externally', e.g. clicking/entering an item in the listbox, from a modal etc
|
5270
|
+
var _React$useState = React.useState(value ? format(value, formatting.date) : ''),
|
5271
|
+
internalValue = _React$useState[0],
|
5272
|
+
setInternalValue = _React$useState[1]; // update internal value if it changed 'externally'
|
5355
5273
|
|
5356
|
-
React.useEffect(function () {
|
5357
|
-
if (value !== undefined && value !== inputValue) {
|
5358
|
-
setInputValue(convertToInputValue(value));
|
5359
|
-
}
|
5360
|
-
}, [value]);
|
5361
|
-
React.useEffect(function () {
|
5362
|
-
if (onSearch) {
|
5363
|
-
debouncer(function () {
|
5364
|
-
onSearch(inputValue);
|
5365
|
-
});
|
5366
|
-
}
|
5367
|
-
}, [inputValue]); // show listbox based on input value
|
5368
5274
|
|
5369
5275
|
React.useEffect(function () {
|
5370
|
-
|
5371
|
-
|
5372
|
-
var isCurrentValue = value !== undefined && value !== null && inputValue === String(value);
|
5373
|
-
|
5374
|
-
if (inputValue && data.length && !isCurrentValue) {
|
5375
|
-
setCurrentIndex(0);
|
5276
|
+
if (value) {
|
5277
|
+
var formattedValue = format(value, formatting.date);
|
5376
5278
|
|
5377
|
-
if (
|
5378
|
-
|
5279
|
+
if (formattedValue !== internalValue) {
|
5280
|
+
setInternalValue(formattedValue);
|
5379
5281
|
}
|
5380
5282
|
} else {
|
5381
|
-
|
5382
|
-
}
|
5383
|
-
}, [inputValue, data]);
|
5384
|
-
React.useEffect(function () {
|
5385
|
-
if (open) {
|
5386
|
-
setCurrentIndex(getIndexFromValue(data, inputValue) || 0);
|
5387
|
-
} else {
|
5388
|
-
setCurrentIndex(undefined);
|
5283
|
+
setInternalValue('');
|
5389
5284
|
}
|
5390
|
-
}, [
|
5285
|
+
}, [value]); // event handlers
|
5391
5286
|
|
5392
5287
|
var handleInputBlur = function handleInputBlur(event) {
|
5393
5288
|
event.persist();
|
5289
|
+
var valueAsDate = parseFromCustomString(event.target.value);
|
5290
|
+
var formattedValue = valueAsDate ? format(valueAsDate) || '' : '';
|
5291
|
+
event.target.value = formattedValue;
|
5394
5292
|
|
5395
|
-
if (
|
5396
|
-
event.
|
5397
|
-
return;
|
5398
|
-
}
|
5399
|
-
|
5400
|
-
if (onChange && event.target.value !== value) {
|
5401
|
-
var item = findByValue(flattenedData, event.target.value);
|
5402
|
-
event.detail = sanitizeItem(item);
|
5403
|
-
var parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
5404
|
-
|
5405
|
-
if (parents !== null && parents.length > 0) {
|
5406
|
-
event.detail.parents = parents;
|
5407
|
-
}
|
5408
|
-
|
5293
|
+
if (onChange) {
|
5294
|
+
event.detail = valueAsDate;
|
5409
5295
|
onChange(event);
|
5296
|
+
} else {
|
5297
|
+
// update the internal value to use the formatted date
|
5298
|
+
setInternalValue(formattedValue);
|
5410
5299
|
}
|
5411
5300
|
|
5412
|
-
if (
|
5413
|
-
|
5301
|
+
if (onBlur) {
|
5302
|
+
onBlur(event);
|
5414
5303
|
}
|
5415
5304
|
};
|
5416
5305
|
|
5417
5306
|
var handleInputChange = function handleInputChange(event) {
|
5418
|
-
|
5307
|
+
setInternalValue(event.target.value);
|
5419
5308
|
};
|
5420
5309
|
|
5421
|
-
var
|
5422
|
-
|
5423
|
-
setOpen(true);
|
5424
|
-
}
|
5425
|
-
|
5426
|
-
if (onClick) {
|
5427
|
-
event.persist();
|
5428
|
-
onClick(event);
|
5429
|
-
}
|
5310
|
+
var handleChange = function handleChange(date) {
|
5311
|
+
setInputValueByRef(inputRef.current, format(date, formatting.date), 'focusout');
|
5430
5312
|
};
|
5431
5313
|
|
5432
|
-
var
|
5433
|
-
|
5434
|
-
|
5435
|
-
|
5436
|
-
|
5437
|
-
|
5438
|
-
|
5439
|
-
|
5440
|
-
|
5441
|
-
case keycode('escape'):
|
5442
|
-
{
|
5443
|
-
event.preventDefault();
|
5444
|
-
setInputValue(convertToInputValue(value));
|
5445
|
-
setOpen(false);
|
5446
|
-
return;
|
5447
|
-
}
|
5448
|
-
|
5449
|
-
case keycode('tab'):
|
5450
|
-
case keycode('enter'):
|
5451
|
-
{
|
5452
|
-
if (event.keyCode !== keycode('tab')) {
|
5453
|
-
event.preventDefault();
|
5454
|
-
}
|
5455
|
-
|
5456
|
-
setCurrentValue(currentIndex);
|
5457
|
-
setOpen(false);
|
5458
|
-
return;
|
5459
|
-
}
|
5460
|
-
|
5461
|
-
case keycode('up'):
|
5462
|
-
case keycode('down'):
|
5463
|
-
case keycode('home'):
|
5464
|
-
case keycode('end'):
|
5465
|
-
{
|
5466
|
-
if (open) {
|
5467
|
-
event.preventDefault();
|
5468
|
-
}
|
5469
|
-
|
5470
|
-
break;
|
5471
|
-
}
|
5472
|
-
} // we aren't focused on the list, so manually forward the keydown event to it
|
5473
|
-
|
5474
|
-
|
5475
|
-
if (listRef.current) {
|
5476
|
-
listRef.current.dispatchEvent(createCustomKeyboardEvent(event));
|
5477
|
-
}
|
5314
|
+
var inputProps = _extends({}, props, {
|
5315
|
+
autoComplete: 'off',
|
5316
|
+
onBlur: handleInputBlur,
|
5317
|
+
onChange: handleInputChange,
|
5318
|
+
ref: inputRef,
|
5319
|
+
type: 'text',
|
5320
|
+
value: internalValue
|
5321
|
+
});
|
5478
5322
|
|
5479
|
-
|
5480
|
-
|
5481
|
-
|
5482
|
-
|
5483
|
-
setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
|
5484
|
-
setOpen(true);
|
5485
|
-
}
|
5486
|
-
}
|
5323
|
+
var calendarProps = _extends({}, calendar, {
|
5324
|
+
onChange: handleChange,
|
5325
|
+
value: value
|
5326
|
+
});
|
5487
5327
|
|
5488
|
-
|
5489
|
-
|
5490
|
-
|
5491
|
-
}
|
5328
|
+
return {
|
5329
|
+
input: inputProps,
|
5330
|
+
calendar: calendarProps
|
5492
5331
|
};
|
5332
|
+
};
|
5493
5333
|
|
5494
|
-
|
5495
|
-
|
5496
|
-
|
5334
|
+
var _excluded$j = ["placement"];
|
5335
|
+
var UnstyledArrow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5336
|
+
return React.createElement(PopoverPrimitive.Arrow, {
|
5337
|
+
className: "pointer-events-none -mt-px",
|
5338
|
+
asChild: true,
|
5339
|
+
offset: 2,
|
5340
|
+
width: 30,
|
5341
|
+
height: 11
|
5342
|
+
}, React.createElement("svg", Object.assign({}, props, {
|
5343
|
+
ref: ref,
|
5344
|
+
viewBox: "0 19 30 11",
|
5345
|
+
style: {
|
5346
|
+
transform: 'rotateZ(180deg)'
|
5347
|
+
}
|
5348
|
+
}), React.createElement("path", {
|
5349
|
+
className: "text-grey-dark group-focus:text-blue-light fill-current",
|
5350
|
+
d: "M23.7,27.1L17,19.9C16.5,19.3,15.8,19,15,19s-1.6,0.3-2.1,0.9l-6.6,7.2C5.3,28.1,3.4,29,2,29h26 C26.7,29,24.6,28.1,23.7,27.1z"
|
5351
|
+
}), React.createElement("path", {
|
5352
|
+
className: "fill-current",
|
5353
|
+
d: "M23,27.8c1.1,1.2,3.4,2.2,5,2.2h2H0h2c1.7,0,3.9-1,5-2.2l6.6-7.2c0.7-0.8,2-0.8,2.7,0L23,27.8L23,27.8z"
|
5354
|
+
})));
|
5355
|
+
});
|
5356
|
+
var UnstyledContent = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5357
|
+
var side = props.placement,
|
5358
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$j);
|
5497
5359
|
|
5498
|
-
var
|
5499
|
-
|
5500
|
-
|
5501
|
-
|
5502
|
-
|
5360
|
+
var className = cn('border border-transparent rounded p-3 yt-shadow focus:yt-focus outline-none group ', props.className);
|
5361
|
+
return React.createElement(PopoverPrimitive.Content, Object.assign({}, otherProps, {
|
5362
|
+
className: className,
|
5363
|
+
side: side,
|
5364
|
+
sideOffset: 1,
|
5365
|
+
style: _extends({}, props.style, {
|
5366
|
+
zIndex: 996
|
5367
|
+
}),
|
5368
|
+
ref: ref
|
5369
|
+
}));
|
5370
|
+
});
|
5503
5371
|
|
5504
|
-
|
5505
|
-
|
5506
|
-
|
5507
|
-
|
5508
|
-
|
5372
|
+
function mergeRefs(refs) {
|
5373
|
+
return function (value) {
|
5374
|
+
refs.forEach(function (ref) {
|
5375
|
+
if (typeof ref === 'function') {
|
5376
|
+
ref(value);
|
5377
|
+
} else if (ref != null) {
|
5378
|
+
ref.current = value;
|
5379
|
+
}
|
5380
|
+
});
|
5509
5381
|
};
|
5382
|
+
}
|
5510
5383
|
|
5511
|
-
|
5512
|
-
|
5513
|
-
|
5514
|
-
|
5515
|
-
|
5516
|
-
|
5517
|
-
|
5518
|
-
'aria-labelledby': ariaLabelledBy,
|
5519
|
-
disabled: disabled,
|
5520
|
-
onBlur: !disabled && !readOnly ? handleInputBlur : undefined,
|
5521
|
-
onChange: !disabled && !readOnly ? handleInputChange : undefined,
|
5522
|
-
onClick: !disabled && !readOnly ? handleInputClick : undefined,
|
5523
|
-
onKeyDown: !disabled && !readOnly ? handleInputKeyDown : undefined,
|
5524
|
-
readOnly: readOnly,
|
5525
|
-
ref: inputRef,
|
5526
|
-
type: 'text',
|
5527
|
-
value: inputValue || ''
|
5528
|
-
});
|
5384
|
+
var _excluded$k = ["children", "trigger"];
|
5385
|
+
var PopoverContext = /*#__PURE__*/React.createContext({
|
5386
|
+
props: {},
|
5387
|
+
ref: null
|
5388
|
+
});
|
5389
|
+
var Trigger$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5390
|
+
var _props$children;
|
5529
5391
|
|
5530
|
-
var
|
5531
|
-
|
5532
|
-
data: data,
|
5533
|
-
disabled: disabled,
|
5534
|
-
id: listId,
|
5535
|
-
onChange: handleListboxChange,
|
5536
|
-
onClick: handleListboxClick,
|
5537
|
-
ref: listRef,
|
5538
|
-
scrollOnFocus: false,
|
5539
|
-
tabIndex: -1,
|
5540
|
-
value: currentIndex
|
5541
|
-
};
|
5542
|
-
return {
|
5543
|
-
combobox: combobox,
|
5544
|
-
input: input,
|
5545
|
-
list: list,
|
5546
|
-
popover: {
|
5547
|
-
open: open,
|
5548
|
-
onOpenChange: setOpen
|
5549
|
-
}
|
5550
|
-
};
|
5551
|
-
};
|
5392
|
+
var context = React.useContext(PopoverContext);
|
5393
|
+
var children = props.children;
|
5552
5394
|
|
5553
|
-
|
5554
|
-
|
5555
|
-
|
5395
|
+
if (React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
5396
|
+
console.warn("Popover.Trigger requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '" + props.children.type.name + "' in React.forwardRef()? Taco has wrapped '" + props.children.type.name + "' in a 'span' to maintain functionality, but this may cause unintended behaviour");
|
5397
|
+
children = React.createElement("span", null, props.children);
|
5398
|
+
}
|
5556
5399
|
|
5557
|
-
|
5558
|
-
|
5559
|
-
|
5560
|
-
|
5400
|
+
return React.createElement(PopoverPrimitive.Trigger, Object.assign({}, context.props, props, {
|
5401
|
+
children: children,
|
5402
|
+
ref: mergeRefs([context.ref, ref]),
|
5403
|
+
asChild: true
|
5404
|
+
}));
|
5405
|
+
});
|
5406
|
+
var RenderPropWrapper = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
5407
|
+
var children = _ref.children,
|
5408
|
+
onClick = _ref.onClick;
|
5561
5409
|
|
5562
|
-
var
|
5410
|
+
var close = function close() {
|
5411
|
+
onClick(new CustomEvent('hide'));
|
5412
|
+
};
|
5563
5413
|
|
5564
|
-
|
5565
|
-
|
5566
|
-
|
5414
|
+
return children({
|
5415
|
+
close: close,
|
5416
|
+
ref: ref
|
5417
|
+
});
|
5418
|
+
});
|
5419
|
+
var Content$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5420
|
+
var className = cn('bg-white focus:border-blue-light', props.className);
|
5421
|
+
var output;
|
5567
5422
|
|
5568
|
-
|
5569
|
-
|
5570
|
-
|
5423
|
+
if (typeof props.children === 'function') {
|
5424
|
+
output = React.createElement(PopoverPrimitive.Close, {
|
5425
|
+
asChild: true
|
5426
|
+
}, React.createElement(RenderPropWrapper, null, props.children));
|
5427
|
+
} else {
|
5428
|
+
output = props.children;
|
5429
|
+
}
|
5571
5430
|
|
5572
|
-
|
5573
|
-
|
5574
|
-
|
5431
|
+
return React.createElement(UnstyledContent, {
|
5432
|
+
className: className,
|
5433
|
+
placement: props.placement,
|
5434
|
+
ref: ref
|
5435
|
+
}, output, React.createElement(UnstyledArrow, {
|
5436
|
+
className: "text-white"
|
5437
|
+
}));
|
5438
|
+
});
|
5439
|
+
var Close$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5440
|
+
return React.createElement(PopoverPrimitive.Close, Object.assign({}, props, {
|
5441
|
+
ref: ref,
|
5442
|
+
asChild: true
|
5443
|
+
}));
|
5444
|
+
});
|
5445
|
+
var Popover = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5446
|
+
var children = props.children,
|
5447
|
+
trigger = props.trigger,
|
5448
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$k);
|
5575
5449
|
|
5576
|
-
React.
|
5577
|
-
|
5578
|
-
|
5579
|
-
|
5580
|
-
return function () {
|
5581
|
-
clearTimeout(timeout);
|
5582
|
-
window.removeEventListener('resize', debouncedResize);
|
5450
|
+
var context = React.useMemo(function () {
|
5451
|
+
return {
|
5452
|
+
props: otherProps,
|
5453
|
+
ref: ref
|
5583
5454
|
};
|
5584
|
-
}, [
|
5585
|
-
React.
|
5586
|
-
|
5455
|
+
}, [otherProps]);
|
5456
|
+
return React.createElement(PopoverContext.Provider, {
|
5457
|
+
value: context
|
5458
|
+
}, React.createElement(PopoverPrimitive.Root, null, trigger && React.createElement(Trigger$1, null, trigger), children));
|
5459
|
+
});
|
5460
|
+
Popover.Trigger = Trigger$1;
|
5461
|
+
Popover.Content = Content$1;
|
5462
|
+
Popover.Close = Close$1;
|
5587
5463
|
|
5588
|
-
|
5589
|
-
|
5590
|
-
|
5591
|
-
// the consumer to rerender and that will cause the above hook to recalculate the dimensions
|
5592
|
-
setVisibility(newRefElementVisibility);
|
5593
|
-
}
|
5594
|
-
});
|
5595
|
-
return dimensions;
|
5596
|
-
};
|
5464
|
+
var _excluded$l = ["className", "onReset", "style", "shortcuts", "shortcutsText"];
|
5465
|
+
var Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref) {
|
5466
|
+
var _input$disabled;
|
5597
5467
|
|
5598
|
-
var _excluded$m = ["className", "style"];
|
5599
|
-
var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
5600
5468
|
var externalClassName = props.className,
|
5469
|
+
handleReset = props.onReset,
|
5601
5470
|
style = props.style,
|
5602
|
-
|
5471
|
+
shortcuts = props.shortcuts,
|
5472
|
+
shortcutsText = props.shortcutsText,
|
5473
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$l);
|
5603
5474
|
|
5604
|
-
var
|
5605
|
-
|
5606
|
-
input =
|
5607
|
-
popover = _useCombobox.popover,
|
5608
|
-
list = _useCombobox.list;
|
5475
|
+
var _useDatepicker = useDatepicker(otherProps, ref),
|
5476
|
+
calendar = _useDatepicker.calendar,
|
5477
|
+
input = _useDatepicker.input;
|
5609
5478
|
|
5610
|
-
var
|
5611
|
-
|
5612
|
-
|
5613
|
-
|
5614
|
-
}, externalClassName);
|
5479
|
+
var _useLocalization = useLocalization(),
|
5480
|
+
texts = _useLocalization.texts;
|
5481
|
+
|
5482
|
+
var className = cn('inline-flex w-full text-black font-normal', externalClassName);
|
5615
5483
|
return React.createElement("span", {
|
5616
5484
|
className: className,
|
5617
|
-
"data-taco": "
|
5485
|
+
"data-taco": "datepicker",
|
5618
5486
|
style: style
|
5619
|
-
}, React.createElement(
|
5620
|
-
|
5621
|
-
|
5622
|
-
|
5623
|
-
|
5624
|
-
|
5625
|
-
|
5626
|
-
|
5627
|
-
|
5628
|
-
|
5629
|
-
|
5630
|
-
|
5631
|
-
|
5632
|
-
|
5633
|
-
|
5634
|
-
|
5635
|
-
|
5636
|
-
|
5637
|
-
|
5638
|
-
|
5639
|
-
|
5640
|
-
|
5641
|
-
|
5642
|
-
|
5643
|
-
|
5644
|
-
|
5645
|
-
|
5646
|
-
|
5647
|
-
|
5648
|
-
|
5487
|
+
}, React.createElement(Input, Object.assign({}, input, {
|
5488
|
+
button: React.createElement(Popover, null, React.createElement(Popover.Trigger, null, React.createElement(IconButton, {
|
5489
|
+
"aria-label": texts.datepicker.expand,
|
5490
|
+
disabled: (_input$disabled = input.disabled) !== null && _input$disabled !== void 0 ? _input$disabled : input.readOnly,
|
5491
|
+
icon: "calendar"
|
5492
|
+
})), React.createElement(Popover.Content, null, function (_ref) {
|
5493
|
+
var close = _ref.close;
|
5494
|
+
return React.createElement("div", {
|
5495
|
+
className: "flex -m-3"
|
5496
|
+
}, React.createElement(Calendar$1, Object.assign({}, calendar, {
|
5497
|
+
onChange: function onChange(date, event) {
|
5498
|
+
calendar.onChange(date, event);
|
5499
|
+
close();
|
5500
|
+
},
|
5501
|
+
tabIndex: -1
|
5502
|
+
})), shortcuts && React.createElement("div", {
|
5503
|
+
className: "border-l border-grey-dark flex flex-col"
|
5504
|
+
}, React.createElement("span", {
|
5505
|
+
className: "font-semibold text-xs m-4 flex items-center h-8 w-32 mb-3"
|
5506
|
+
}, shortcutsText !== null && shortcutsText !== void 0 ? shortcutsText : texts.datepicker.shortcuts), React.createElement("ul", null, shortcuts.map(function (shortcut, i) {
|
5507
|
+
return React.createElement("li", {
|
5508
|
+
key: i
|
5509
|
+
}, React.createElement("button", {
|
5510
|
+
className: "w-full px-4 py-1 flex items-start hover:bg-grey-light text-xs",
|
5511
|
+
onClick: function onClick(event) {
|
5512
|
+
event.persist();
|
5513
|
+
shortcut.onClick(event);
|
5514
|
+
close();
|
5515
|
+
}
|
5516
|
+
}, shortcut.text));
|
5517
|
+
})), handleReset && React.createElement("button", {
|
5518
|
+
className: "text-blue hover:text-blue-light inline-flex border-none bg-transparent text-xs cursor-pointer mt-auto my-4 mx-auto",
|
5519
|
+
onClick: function onClick(event) {
|
5520
|
+
event.persist();
|
5521
|
+
handleReset(event);
|
5522
|
+
close();
|
5523
|
+
}
|
5524
|
+
}, texts.datepicker.clear)));
|
5525
|
+
}))
|
5526
|
+
})));
|
5527
|
+
});
|
5528
|
+
|
5529
|
+
/* eslint-disable @typescript-eslint/no-empty-function */
|
5530
|
+
var DialogContext = /*#__PURE__*/React.createContext({
|
5531
|
+
closeOnEscape: true,
|
5532
|
+
draggable: false,
|
5533
|
+
drawer: undefined,
|
5534
|
+
elements: {
|
5535
|
+
drawer: undefined,
|
5536
|
+
extra: undefined
|
5537
|
+
},
|
5538
|
+
onClose: function onClose() {},
|
5539
|
+
props: {},
|
5540
|
+
ref: null,
|
5541
|
+
showCloseButton: true,
|
5542
|
+
size: 'sm'
|
5543
|
+
});
|
5544
|
+
var useCurrentDialog = function useCurrentDialog() {
|
5545
|
+
return React.useContext(DialogContext);
|
5546
|
+
};
|
5547
|
+
|
5548
|
+
var Trigger$2 = /*#__PURE__*/React.forwardRef(function DialogTrigger(props, ref) {
|
5549
|
+
var dialog = useCurrentDialog();
|
5550
|
+
return React.createElement(DialogPrimitive.Trigger, Object.assign({}, dialog.props, props, {
|
5551
|
+
ref: mergeRefs([dialog.ref, ref]),
|
5552
|
+
asChild: true
|
5553
|
+
}));
|
5649
5554
|
});
|
5650
5555
|
|
5651
|
-
var
|
5652
|
-
|
5653
|
-
|
5654
|
-
|
5556
|
+
var useDraggable = function useDraggable(ref) {
|
5557
|
+
var _React$useState = React__default.useState({
|
5558
|
+
x: 0,
|
5559
|
+
y: 0
|
5560
|
+
}),
|
5561
|
+
position = _React$useState[0],
|
5562
|
+
setPosition = _React$useState[1];
|
5655
5563
|
|
5656
|
-
|
5657
|
-
|
5658
|
-
|
5564
|
+
var _useMove = interactions.useMove({
|
5565
|
+
onMove: function onMove(event) {
|
5566
|
+
var _ref$current;
|
5659
5567
|
|
5660
|
-
|
5568
|
+
var rect = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect(); // Prevent dragging out of bounds
|
5661
5569
|
|
5662
|
-
|
5663
|
-
|
5664
|
-
|
5570
|
+
// Prevent dragging out of bounds
|
5571
|
+
if (rect && (rect.left + event.deltaX < 0 || rect.right + event.deltaX > window.innerWidth || rect.top + event.deltaY < 0 || rect.bottom + event.deltaY > window.innerHeight)) {
|
5572
|
+
return;
|
5573
|
+
}
|
5665
5574
|
|
5666
|
-
|
5667
|
-
|
5668
|
-
|
5575
|
+
setPosition(function (_ref) {
|
5576
|
+
var x = _ref.x,
|
5577
|
+
y = _ref.y;
|
5578
|
+
x += event.deltaX;
|
5579
|
+
y += event.deltaY;
|
5580
|
+
return {
|
5581
|
+
x: x,
|
5582
|
+
y: y
|
5583
|
+
};
|
5584
|
+
});
|
5585
|
+
}
|
5586
|
+
}),
|
5587
|
+
moveProps = _useMove.moveProps;
|
5669
5588
|
|
5670
|
-
return
|
5589
|
+
return {
|
5590
|
+
position: position,
|
5591
|
+
handleProps: moveProps
|
5592
|
+
};
|
5671
5593
|
};
|
5672
|
-
var parseFromCustomString = function parseFromCustomString(date, mask) {
|
5673
|
-
if (date === void 0) {
|
5674
|
-
date = '';
|
5675
|
-
}
|
5676
|
-
|
5677
|
-
if (mask === void 0) {
|
5678
|
-
mask = 'dd.mm.yy';
|
5679
|
-
}
|
5680
5594
|
|
5681
|
-
|
5682
|
-
|
5683
|
-
|
5684
|
-
|
5685
|
-
var sanitizedMask = mask.split(/[^dmy]/);
|
5686
|
-
var dd = sanitizedMask.findIndex(function (x) {
|
5687
|
-
return x === 'dd';
|
5688
|
-
});
|
5689
|
-
var mm = sanitizedMask.findIndex(function (x) {
|
5690
|
-
return x === 'mm';
|
5691
|
-
});
|
5692
|
-
var yy = sanitizedMask.findIndex(function (x) {
|
5693
|
-
return x === 'yy' || x === 'yyyy';
|
5694
|
-
});
|
5695
|
-
var day;
|
5696
|
-
var month;
|
5697
|
-
var year;
|
5595
|
+
var MenuContext = /*#__PURE__*/React.createContext(undefined);
|
5596
|
+
var useCurrentMenu = function useCurrentMenu() {
|
5597
|
+
return React.useContext(MenuContext);
|
5598
|
+
};
|
5698
5599
|
|
5699
|
-
|
5700
|
-
|
5701
|
-
|
5702
|
-
|
5703
|
-
|
5600
|
+
var Title = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
5601
|
+
var className = cn('text-center', props.className);
|
5602
|
+
return React.createElement(DialogPrimitive.Title, Object.assign({}, props, {
|
5603
|
+
className: className,
|
5604
|
+
ref: ref
|
5605
|
+
}));
|
5606
|
+
});
|
5607
|
+
var Footer = /*#__PURE__*/React.forwardRef(function DialogFooter(props, ref) {
|
5608
|
+
var className = cn('mt-8 flex justify-end', props.className);
|
5609
|
+
return React.createElement("div", Object.assign({}, props, {
|
5610
|
+
className: className,
|
5611
|
+
ref: ref
|
5612
|
+
}), props.children);
|
5613
|
+
});
|
5614
|
+
var Close$2 = /*#__PURE__*/React.forwardRef(function DialogClose(props, ref) {
|
5615
|
+
var dialog = useCurrentDialog();
|
5616
|
+
return React.createElement(DialogPrimitive.Close, Object.assign({
|
5617
|
+
onClick: dialog.onClose
|
5618
|
+
}, props, {
|
5619
|
+
ref: ref,
|
5620
|
+
asChild: true
|
5621
|
+
}));
|
5622
|
+
});
|
5623
|
+
var RenderPropWrapper$1 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
5624
|
+
var children = _ref.children,
|
5625
|
+
onClick = _ref.onClick,
|
5626
|
+
renderProps = _ref.renderProps;
|
5704
5627
|
|
5705
|
-
|
5628
|
+
var close = function close() {
|
5629
|
+
onClick(new CustomEvent('close'));
|
5706
5630
|
};
|
5707
5631
|
|
5708
|
-
|
5709
|
-
|
5710
|
-
|
5711
|
-
|
5712
|
-
|
5713
|
-
|
5714
|
-
|
5715
|
-
|
5716
|
-
} else {
|
5717
|
-
day = inputParts[dd];
|
5718
|
-
month = inputParts[mm];
|
5719
|
-
year = getFullYear(inputParts[yy]);
|
5720
|
-
}
|
5632
|
+
return children(_extends({
|
5633
|
+
close: close,
|
5634
|
+
ref: ref
|
5635
|
+
}, renderProps));
|
5636
|
+
});
|
5637
|
+
var Content$2 = /*#__PURE__*/React.forwardRef(function DialogContent(props, ref) {
|
5638
|
+
var dialog = useCurrentDialog();
|
5639
|
+
var internalRef = useProxiedRef(ref);
|
5721
5640
|
|
5722
|
-
|
5723
|
-
|
5724
|
-
|
5725
|
-
var currentDate = new Date();
|
5726
|
-
return new Date(
|
5727
|
-
/* year */
|
5728
|
-
Object.is(year, NaN) ? currentDate.getFullYear() : year,
|
5729
|
-
/* month */
|
5730
|
-
Object.is(month, NaN) ? currentDate.getMonth() : month - 1, // months are zero based in javascript, so subtract a day
|
5641
|
+
var _useDraggable = useDraggable(internalRef),
|
5642
|
+
position = _useDraggable.position,
|
5643
|
+
dragHandleProps = _useDraggable.handleProps;
|
5731
5644
|
|
5732
|
-
|
5733
|
-
|
5734
|
-
|
5735
|
-
12,
|
5736
|
-
/* minutes */
|
5737
|
-
0 // set to midday to avoid UTC offset causing dates to be mismatched server side
|
5738
|
-
);
|
5739
|
-
};
|
5740
|
-
var parseFromISOString = function parseFromISOString(date) {
|
5741
|
-
var tempDate = new Date(date);
|
5742
|
-
return dateFns.isValid(tempDate) ? parseFromCustomString(format(new Date(date))) : undefined;
|
5743
|
-
};
|
5645
|
+
var _useLocalization = useLocalization(),
|
5646
|
+
texts = _useLocalization.texts; // if the dialog was opened by a menu, we need to close the menu when the dialog closes
|
5647
|
+
// the menu is still open (and mounted) because it is the trigger for the dialog
|
5744
5648
|
|
5745
|
-
var _excluded$n = ["defaultValue", "calendar", "onBlur", "onChange", "value"];
|
5746
|
-
var useDatepicker = function useDatepicker(_ref, ref) {
|
5747
|
-
var calendar = _ref.calendar,
|
5748
|
-
onBlur = _ref.onBlur,
|
5749
|
-
onChange = _ref.onChange,
|
5750
|
-
value = _ref.value,
|
5751
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$n);
|
5752
5649
|
|
5753
|
-
var
|
5650
|
+
var menu = useCurrentMenu();
|
5651
|
+
var handleCloseAutoFocus;
|
5754
5652
|
|
5755
|
-
|
5756
|
-
|
5653
|
+
if (menu) {
|
5654
|
+
handleCloseAutoFocus = function handleCloseAutoFocus() {
|
5655
|
+
return menu.close();
|
5656
|
+
};
|
5657
|
+
}
|
5757
5658
|
|
5758
|
-
var
|
5759
|
-
|
5760
|
-
|
5659
|
+
var className = cn('bg-white rounded relative mt-16 mx-auto', {
|
5660
|
+
'w-128 text-center justify-center': dialog.size === 'dialog',
|
5661
|
+
'w-xs': dialog.size === 'xs',
|
5662
|
+
'w-sm': dialog.size === 'sm',
|
5663
|
+
'w-md': dialog.size === 'md',
|
5664
|
+
'w-lg': dialog.size === 'lg'
|
5665
|
+
});
|
5666
|
+
var containerClassName = cn('bg-white p-6 rounded relative z-[999]', 'shadow-[0_6px_9px_0_rgba(89,85,98,0.3),0_0_1px_0_rgba(89,85,98,0.2)]', {
|
5667
|
+
'rounded-b-none': !!dialog.elements.extra
|
5668
|
+
}, props.className);
|
5761
5669
|
|
5670
|
+
var handleEscapeKeyDown = function handleEscapeKeyDown(event) {
|
5671
|
+
if (!dialog.closeOnEscape) {
|
5672
|
+
event.preventDefault();
|
5673
|
+
} else if (dialog.onClose) {
|
5674
|
+
dialog.onClose();
|
5675
|
+
}
|
5676
|
+
}; // the chosen behaviour in taco is that outside clicks do not close the dialog
|
5762
5677
|
|
5763
|
-
React.useEffect(function () {
|
5764
|
-
if (value) {
|
5765
|
-
var formattedValue = format(value, formatting.date);
|
5766
5678
|
|
5767
|
-
|
5768
|
-
|
5769
|
-
|
5770
|
-
} else {
|
5771
|
-
setInternalValue('');
|
5772
|
-
}
|
5773
|
-
}, [value]); // event handlers
|
5679
|
+
var handleInteractOutside = function handleInteractOutside(event) {
|
5680
|
+
return event.preventDefault();
|
5681
|
+
};
|
5774
5682
|
|
5775
|
-
var
|
5776
|
-
event.persist();
|
5777
|
-
var valueAsDate = parseFromCustomString(event.target.value);
|
5778
|
-
var formattedValue = valueAsDate ? format(valueAsDate) || '' : '';
|
5779
|
-
event.target.value = formattedValue;
|
5683
|
+
var output;
|
5780
5684
|
|
5781
|
-
|
5782
|
-
|
5783
|
-
|
5784
|
-
}
|
5785
|
-
|
5786
|
-
|
5787
|
-
|
5685
|
+
if (typeof props.children === 'function') {
|
5686
|
+
output = React.createElement(DialogPrimitive.Close, {
|
5687
|
+
asChild: true
|
5688
|
+
}, React.createElement(RenderPropWrapper$1, {
|
5689
|
+
renderProps: {
|
5690
|
+
drawer: dialog.drawer
|
5691
|
+
}
|
5692
|
+
}, props.children));
|
5693
|
+
} else {
|
5694
|
+
output = props.children;
|
5695
|
+
}
|
5788
5696
|
|
5789
|
-
|
5790
|
-
|
5791
|
-
|
5792
|
-
|
5697
|
+
return React.createElement(DialogPrimitive.Portal, null, React.createElement(DialogPrimitive.Overlay, {
|
5698
|
+
asChild: true
|
5699
|
+
}, React.createElement(Backdrop, null, React.createElement(DialogPrimitive.Content, Object.assign({}, props, {
|
5700
|
+
className: className,
|
5701
|
+
onEscapeKeyDown: handleEscapeKeyDown,
|
5702
|
+
onInteractOutside: handleInteractOutside,
|
5703
|
+
onCloseAutoFocus: handleCloseAutoFocus,
|
5704
|
+
ref: ref,
|
5705
|
+
style: _extends({}, props.style, {
|
5706
|
+
left: dialog.draggable ? position.x + "px" : undefined,
|
5707
|
+
top: dialog.draggable ? position.y + "px" : undefined
|
5708
|
+
})
|
5709
|
+
}), React.createElement("div", {
|
5710
|
+
className: containerClassName,
|
5711
|
+
"data-taco": "dialog"
|
5712
|
+
}, output, dialog.draggable && React.createElement("div", Object.assign({}, dragHandleProps, {
|
5713
|
+
"aria-label": texts.dialog.drag,
|
5714
|
+
className: "yt-dialog__drag absolute-center-x bg-grey-light top-1.5 h-3 w-24 cursor-move rounded text-center"
|
5715
|
+
})), dialog.showCloseButton ? React.createElement(DialogPrimitive.Close, {
|
5716
|
+
onClick: dialog.onClose,
|
5717
|
+
asChild: true
|
5718
|
+
}, React.createElement(IconButton, {
|
5719
|
+
appearance: "discrete",
|
5720
|
+
"aria-label": texts.dialog.close,
|
5721
|
+
className: "absolute top-0 right-0 mt-2 mr-2",
|
5722
|
+
icon: "close"
|
5723
|
+
})) : null), dialog.elements.drawer, dialog.elements.extra))));
|
5724
|
+
});
|
5793
5725
|
|
5794
|
-
|
5795
|
-
|
5796
|
-
};
|
5726
|
+
var Drawer = /*#__PURE__*/React.forwardRef(function DialogDrawer(props, ref) {
|
5727
|
+
var _dialog$drawer, _dialog$drawer2;
|
5797
5728
|
|
5798
|
-
var
|
5799
|
-
|
5800
|
-
}
|
5729
|
+
var dialog = useCurrentDialog();
|
5730
|
+
var className = cn('absolute top-0 z-[998] -ml-[4px] hidden h-full w-full overflow-y-auto rounded-r bg-white p-6 text-left', props.className);
|
5731
|
+
return React.createElement(framerMotion.motion.div, Object.assign({}, props, {
|
5732
|
+
className: className,
|
5733
|
+
"data-taco": "dialog-drawer",
|
5734
|
+
"aria-hidden": !((_dialog$drawer = dialog.drawer) !== null && _dialog$drawer !== void 0 && _dialog$drawer.open),
|
5735
|
+
variants: {
|
5736
|
+
visible: {
|
5737
|
+
left: '100%',
|
5738
|
+
display: 'block',
|
5739
|
+
transition: {
|
5740
|
+
ease: 'easeOut',
|
5741
|
+
duration: 0.2
|
5742
|
+
}
|
5743
|
+
},
|
5744
|
+
hidden: {
|
5745
|
+
left: '0%',
|
5746
|
+
transition: {
|
5747
|
+
ease: 'easeOut',
|
5748
|
+
duration: 0.2
|
5749
|
+
},
|
5750
|
+
transitionEnd: {
|
5751
|
+
display: 'none'
|
5752
|
+
}
|
5753
|
+
}
|
5754
|
+
},
|
5755
|
+
animate: (_dialog$drawer2 = dialog.drawer) !== null && _dialog$drawer2 !== void 0 && _dialog$drawer2.open ? 'visible' : 'hidden',
|
5756
|
+
ref: ref
|
5757
|
+
}));
|
5758
|
+
});
|
5801
5759
|
|
5802
|
-
|
5803
|
-
|
5804
|
-
|
5805
|
-
|
5806
|
-
|
5807
|
-
|
5808
|
-
|
5809
|
-
|
5760
|
+
var Extra = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5761
|
+
var className = cn('bg-grey-light yt-shadow-inset absolute top-full left-0 -mt-px w-full rounded-t-none rounded-b p-6 text-left', props.className);
|
5762
|
+
return React.createElement("div", Object.assign({}, props, {
|
5763
|
+
className: className,
|
5764
|
+
"data-taco": "dialog-extra",
|
5765
|
+
ref: ref
|
5766
|
+
}));
|
5767
|
+
});
|
5810
5768
|
|
5811
|
-
|
5812
|
-
onChange: handleChange,
|
5813
|
-
value: value
|
5814
|
-
});
|
5769
|
+
var _excluded$m = ["children", "closeOnEscape", "defaultOpen", "draggable", "onChange", "onClose", "open", "showCloseButton", "size", "trigger"];
|
5815
5770
|
|
5816
|
-
|
5817
|
-
|
5818
|
-
|
5819
|
-
|
5771
|
+
var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
|
5772
|
+
return React.useMemo(function () {
|
5773
|
+
var children = [];
|
5774
|
+
var drawer;
|
5775
|
+
var extra;
|
5776
|
+
React.Children.forEach(initialChildren, function (child) {
|
5777
|
+
if (child.type.displayName === 'Drawer') {
|
5778
|
+
drawer = child;
|
5779
|
+
} else if (child.type.displayName === 'Extra') {
|
5780
|
+
extra = child;
|
5781
|
+
} else {
|
5782
|
+
children.push(child);
|
5783
|
+
}
|
5784
|
+
});
|
5785
|
+
return [children, drawer, extra];
|
5786
|
+
}, [initialChildren]);
|
5820
5787
|
};
|
5821
5788
|
|
5822
|
-
var
|
5823
|
-
var
|
5824
|
-
|
5825
|
-
|
5826
|
-
|
5827
|
-
|
5828
|
-
|
5829
|
-
|
5830
|
-
|
5831
|
-
|
5789
|
+
var Dialog = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5790
|
+
var initialChildren = props.children,
|
5791
|
+
_props$closeOnEscape = props.closeOnEscape,
|
5792
|
+
closeOnEscape = _props$closeOnEscape === void 0 ? true : _props$closeOnEscape,
|
5793
|
+
defaultOpen = props.defaultOpen,
|
5794
|
+
_props$draggable = props.draggable,
|
5795
|
+
draggable = _props$draggable === void 0 ? false : _props$draggable,
|
5796
|
+
onChange = props.onChange,
|
5797
|
+
onClose = props.onClose,
|
5798
|
+
open = props.open,
|
5799
|
+
_props$showCloseButto = props.showCloseButton,
|
5800
|
+
showCloseButton = _props$showCloseButto === void 0 ? true : _props$showCloseButto,
|
5801
|
+
_props$size = props.size,
|
5802
|
+
size = _props$size === void 0 ? 'sm' : _props$size,
|
5803
|
+
trigger = props.trigger,
|
5804
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$m);
|
5832
5805
|
|
5833
|
-
var
|
5834
|
-
|
5835
|
-
|
5806
|
+
var _useSeparatedChildren = useSeparatedChildren(initialChildren),
|
5807
|
+
children = _useSeparatedChildren[0],
|
5808
|
+
drawer = _useSeparatedChildren[1],
|
5809
|
+
extra = _useSeparatedChildren[2];
|
5836
5810
|
|
5837
|
-
var
|
5838
|
-
|
5811
|
+
var _React$useState = React.useState(false),
|
5812
|
+
drawerOpen = _React$useState[0],
|
5813
|
+
setDrawerOpen = _React$useState[1];
|
5839
5814
|
|
5840
|
-
var
|
5841
|
-
|
5842
|
-
|
5843
|
-
|
5844
|
-
|
5845
|
-
|
5846
|
-
|
5847
|
-
|
5848
|
-
|
5849
|
-
|
5850
|
-
})), React.createElement(Popover.Content, null, function (_ref) {
|
5851
|
-
var close = _ref.close;
|
5852
|
-
return React.createElement("div", {
|
5853
|
-
className: "flex -m-3"
|
5854
|
-
}, React.createElement(Calendar$1, Object.assign({}, calendar, {
|
5855
|
-
onChange: function onChange(date, event) {
|
5856
|
-
calendar.onChange(date, event);
|
5857
|
-
close();
|
5858
|
-
},
|
5859
|
-
tabIndex: -1
|
5860
|
-
})), shortcuts && React.createElement("div", {
|
5861
|
-
className: "border-l border-grey-dark flex flex-col"
|
5862
|
-
}, React.createElement("span", {
|
5863
|
-
className: "font-semibold text-xs m-4 flex items-center h-8 w-32 mb-3"
|
5864
|
-
}, shortcutsText !== null && shortcutsText !== void 0 ? shortcutsText : texts.datepicker.shortcuts), React.createElement("ul", null, shortcuts.map(function (shortcut, i) {
|
5865
|
-
return React.createElement("li", {
|
5866
|
-
key: i
|
5867
|
-
}, React.createElement("button", {
|
5868
|
-
className: "w-full px-4 py-1 flex items-start hover:bg-grey-light text-xs",
|
5869
|
-
onClick: function onClick(event) {
|
5870
|
-
event.persist();
|
5871
|
-
shortcut.onClick(event);
|
5872
|
-
close();
|
5873
|
-
}
|
5874
|
-
}, shortcut.text));
|
5875
|
-
})), handleReset && React.createElement("button", {
|
5876
|
-
className: "text-blue hover:text-blue-light inline-flex border-none bg-transparent text-xs cursor-pointer mt-auto my-4 mx-auto",
|
5877
|
-
onClick: function onClick(event) {
|
5878
|
-
event.persist();
|
5879
|
-
handleReset(event);
|
5880
|
-
close();
|
5815
|
+
var context = React.useMemo(function () {
|
5816
|
+
return {
|
5817
|
+
closeOnEscape: closeOnEscape,
|
5818
|
+
draggable: draggable,
|
5819
|
+
drawer: {
|
5820
|
+
open: drawerOpen,
|
5821
|
+
toggle: function toggle() {
|
5822
|
+
return setDrawerOpen(function (isDrawerOpen) {
|
5823
|
+
return !isDrawerOpen;
|
5824
|
+
});
|
5881
5825
|
}
|
5882
|
-
},
|
5883
|
-
|
5884
|
-
|
5826
|
+
},
|
5827
|
+
elements: {
|
5828
|
+
drawer: drawer,
|
5829
|
+
extra: extra
|
5830
|
+
},
|
5831
|
+
onClose: onClose,
|
5832
|
+
props: otherProps,
|
5833
|
+
showCloseButton: showCloseButton,
|
5834
|
+
size: size,
|
5835
|
+
ref: ref
|
5836
|
+
};
|
5837
|
+
}, [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]);
|
5838
|
+
return React.createElement(DialogContext.Provider, {
|
5839
|
+
value: context
|
5840
|
+
}, React.createElement(DialogPrimitive.Root, {
|
5841
|
+
defaultOpen: defaultOpen,
|
5842
|
+
open: open,
|
5843
|
+
onOpenChange: onChange
|
5844
|
+
}, trigger && React.createElement(Trigger$2, null, trigger), children));
|
5885
5845
|
});
|
5846
|
+
Dialog.Trigger = Trigger$2;
|
5847
|
+
Dialog.Content = Content$2;
|
5848
|
+
Dialog.Title = Title;
|
5849
|
+
Dialog.Footer = Footer;
|
5850
|
+
Dialog.Extra = Extra;
|
5851
|
+
Dialog.Drawer = Drawer;
|
5852
|
+
Dialog.Close = Close$2;
|
5886
5853
|
|
5887
|
-
var _excluded$
|
5854
|
+
var _excluded$n = ["horizontal"];
|
5888
5855
|
var Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
5889
5856
|
var _props$horizontal = props.horizontal,
|
5890
5857
|
horizontal = _props$horizontal === void 0 ? false : _props$horizontal,
|
5891
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
5858
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$n);
|
5892
5859
|
|
5893
5860
|
var className = cn('yt-form', {
|
5894
5861
|
'yt-form--horizontal flex flex-wrap': horizontal
|
@@ -5900,6 +5867,90 @@ var Form = /*#__PURE__*/React.forwardRef(function Form(props, ref) {
|
|
5900
5867
|
}));
|
5901
5868
|
});
|
5902
5869
|
|
5870
|
+
var _excluded$o = ["as"];
|
5871
|
+
var Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
5872
|
+
var _props$as = props.as,
|
5873
|
+
Tag = _props$as === void 0 ? 'span' : _props$as,
|
5874
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$o);
|
5875
|
+
|
5876
|
+
var className = cn('flex ', props.className);
|
5877
|
+
return React.createElement(Tag, Object.assign({}, otherProps, {
|
5878
|
+
className: className,
|
5879
|
+
"data-taco": "group",
|
5880
|
+
ref: ref
|
5881
|
+
}));
|
5882
|
+
});
|
5883
|
+
|
5884
|
+
var _excluded$p = ["anchor", "children"];
|
5885
|
+
var HangerContext = /*#__PURE__*/React.createContext({
|
5886
|
+
props: {},
|
5887
|
+
ref: null
|
5888
|
+
});
|
5889
|
+
var Anchor = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5890
|
+
var _props$children;
|
5891
|
+
|
5892
|
+
var context = React.useContext(HangerContext);
|
5893
|
+
var children = props.children;
|
5894
|
+
|
5895
|
+
if (React.isValidElement(props.children) && typeof ((_props$children = props.children) === null || _props$children === void 0 ? void 0 : _props$children.type) === 'function') {
|
5896
|
+
console.warn("Hanger.Anchor requires its child to forwardRef so that it can attach to the dom element. Did you mean to wrap '" + props.children.type.name + "' in React.forwardRef()? Taco has wrapped '" + props.children.type.name + "' in a 'span' to maintain functionality, but this may cause unintended behaviour");
|
5897
|
+
children = React.createElement("span", null, props.children);
|
5898
|
+
}
|
5899
|
+
|
5900
|
+
return React.createElement(PopoverPrimitive.Anchor, Object.assign({}, context.props, props, {
|
5901
|
+
children: children,
|
5902
|
+
ref: mergeRefs([context.ref, ref]),
|
5903
|
+
asChild: true
|
5904
|
+
}));
|
5905
|
+
});
|
5906
|
+
var Content$3 = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5907
|
+
var _useLocalization = useLocalization(),
|
5908
|
+
texts = _useLocalization.texts;
|
5909
|
+
|
5910
|
+
var className = cn('wcag-blue border border-transparent rounded p-3 pr-12 yt-shadow z-[996] focus:border-transparent', props.className);
|
5911
|
+
|
5912
|
+
var handleInteractOutside = function handleInteractOutside(event) {
|
5913
|
+
event.preventDefault();
|
5914
|
+
};
|
5915
|
+
|
5916
|
+
return React.createElement(UnstyledContent, {
|
5917
|
+
className: className,
|
5918
|
+
"data-taco": "hanger",
|
5919
|
+
onInteractOutside: handleInteractOutside,
|
5920
|
+
placement: props.placement,
|
5921
|
+
ref: ref
|
5922
|
+
}, props.children, React.createElement(UnstyledArrow, {
|
5923
|
+
className: "text-blue"
|
5924
|
+
}), React.createElement(PopoverPrimitive.Close, {
|
5925
|
+
asChild: true
|
5926
|
+
}, React.createElement(IconButton, {
|
5927
|
+
appearance: "primary",
|
5928
|
+
"aria-label": texts.hanger.close,
|
5929
|
+
className: "absolute top-0 right-0 ml-2 mr-2 mt-2 text-white",
|
5930
|
+
icon: "close",
|
5931
|
+
onClick: props.onClose
|
5932
|
+
})));
|
5933
|
+
});
|
5934
|
+
var Hanger = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
5935
|
+
var anchor = props.anchor,
|
5936
|
+
children = props.children,
|
5937
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$p);
|
5938
|
+
|
5939
|
+
var context = React.useMemo(function () {
|
5940
|
+
return {
|
5941
|
+
props: otherProps,
|
5942
|
+
ref: ref
|
5943
|
+
};
|
5944
|
+
}, [otherProps]);
|
5945
|
+
return React.createElement(HangerContext.Provider, {
|
5946
|
+
value: context
|
5947
|
+
}, React.createElement(PopoverPrimitive.Root, {
|
5948
|
+
defaultOpen: true
|
5949
|
+
}, anchor && React.createElement(Anchor, null, anchor), children));
|
5950
|
+
});
|
5951
|
+
Hanger.Anchor = Anchor;
|
5952
|
+
Hanger.Content = Content$3;
|
5953
|
+
|
5903
5954
|
var _excluded$q = ["onSearch"];
|
5904
5955
|
var SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput(_ref, ref) {
|
5905
5956
|
var onSearch = _ref.onSearch,
|
@@ -6833,7 +6884,12 @@ var Header = function Header(props) {
|
|
6833
6884
|
}));
|
6834
6885
|
};
|
6835
6886
|
|
6836
|
-
var
|
6887
|
+
var _excluded$B = ["children", "trigger"];
|
6888
|
+
var Menu = function Menu(externalProps) {
|
6889
|
+
var children = externalProps.children,
|
6890
|
+
trigger = externalProps.trigger,
|
6891
|
+
props = _objectWithoutPropertiesLoose(externalProps, _excluded$B);
|
6892
|
+
|
6837
6893
|
var _React$useState = React.useState(false),
|
6838
6894
|
open = _React$useState[0],
|
6839
6895
|
setOpen = _React$useState[1];
|
@@ -6874,7 +6930,7 @@ var Menu = function Menu(props) {
|
|
6874
6930
|
}, React.createElement(DropdownMenuPrimitive.Root, Object.assign({}, props, {
|
6875
6931
|
open: open,
|
6876
6932
|
onOpenChange: setOpen
|
6877
|
-
})));
|
6933
|
+
}), trigger && React.createElement(Trigger$3, null, trigger), children));
|
6878
6934
|
};
|
6879
6935
|
Menu.Trigger = Trigger$3;
|
6880
6936
|
Menu.Content = Content$4;
|
@@ -6885,7 +6941,7 @@ Menu.Separator = Separator;
|
|
6885
6941
|
Menu.Header = Header;
|
6886
6942
|
Menu.RadioGroup = RadioGroup$1;
|
6887
6943
|
|
6888
|
-
var _excluded$
|
6944
|
+
var _excluded$C = ["children", "className", "expanded", "title", "fixed", "onClick"];
|
6889
6945
|
var TreeviewItem = /*#__PURE__*/React__default.forwardRef(function (props, ref) {
|
6890
6946
|
return React__default.createElement("a", Object.assign({}, props, {
|
6891
6947
|
ref: ref
|
@@ -6899,7 +6955,7 @@ var TreeviewGroup = /*#__PURE__*/React__default.forwardRef(function (props, ref)
|
|
6899
6955
|
title = props.title,
|
6900
6956
|
fixed = props.fixed,
|
6901
6957
|
onClick = props.onClick,
|
6902
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
6958
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$C);
|
6903
6959
|
|
6904
6960
|
var _React$useState = React__default.useState(fixed || initialExpanded),
|
6905
6961
|
expanded = _React$useState[0],
|
@@ -6999,7 +7055,7 @@ var useDropTarget = function useDropTarget(onDrop) {
|
|
6999
7055
|
return [isDraggedOver, props];
|
7000
7056
|
};
|
7001
7057
|
|
7002
|
-
var _excluded$
|
7058
|
+
var _excluded$D = ["active", "children", "onDrop", "postfix", "prefix", "role"],
|
7003
7059
|
_excluded2$4 = ["children"];
|
7004
7060
|
var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
7005
7061
|
var active = props.active,
|
@@ -7008,7 +7064,7 @@ var Item$2 = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
7008
7064
|
postfix = props.postfix,
|
7009
7065
|
prefix = props.prefix,
|
7010
7066
|
role = props.role,
|
7011
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
7067
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$D);
|
7012
7068
|
|
7013
7069
|
var proxyRef = useProxiedRef(ref);
|
7014
7070
|
|
@@ -7172,7 +7228,7 @@ var PageNumbers = function PageNumbers(_ref) {
|
|
7172
7228
|
}));
|
7173
7229
|
};
|
7174
7230
|
|
7175
|
-
var _excluded$
|
7231
|
+
var _excluded$E = ["aria-label", "aria-labelledby", "data", "defaultValue", "disabled", "emptyValue", "id", "multiselect", "onClick", "onChange", "readOnly", "value"];
|
7176
7232
|
var useSelect = function useSelect(_ref, ref) {
|
7177
7233
|
var ariaLabel = _ref['aria-label'],
|
7178
7234
|
ariaLabelledBy = _ref['aria-labelledby'],
|
@@ -7187,7 +7243,7 @@ var useSelect = function useSelect(_ref, ref) {
|
|
7187
7243
|
readOnly = _ref.readOnly,
|
7188
7244
|
_ref$value = _ref.value,
|
7189
7245
|
value = _ref$value === void 0 ? emptyValue : _ref$value,
|
7190
|
-
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
7246
|
+
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded$E);
|
7191
7247
|
|
7192
7248
|
var _useLocalization = useLocalization(),
|
7193
7249
|
texts = _useLocalization.texts;
|
@@ -7369,13 +7425,13 @@ var useSelect = function useSelect(_ref, ref) {
|
|
7369
7425
|
};
|
7370
7426
|
};
|
7371
7427
|
|
7372
|
-
var _excluded$
|
7428
|
+
var _excluded$F = ["autoFocus", "className", "highlighted", "style"],
|
7373
7429
|
_excluded2$5 = ["editable"];
|
7374
7430
|
var BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref) {
|
7375
7431
|
var autoFocus = props.autoFocus,
|
7376
7432
|
externalClassName = props.className,
|
7377
7433
|
style = props.style,
|
7378
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
7434
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$F);
|
7379
7435
|
|
7380
7436
|
var _useSelect = useSelect(otherProps, ref),
|
7381
7437
|
button = _useSelect.button,
|
@@ -7524,7 +7580,7 @@ var usePagination = function usePagination(initialPageIndex, initialPageSize) {
|
|
7524
7580
|
};
|
7525
7581
|
};
|
7526
7582
|
|
7527
|
-
var _excluded$
|
7583
|
+
var _excluded$G = ["length", "pageIndex", "pageSize", "pageSizes", "setPageIndex", "setPageSize", "showPageControls", "showPageNumbers", "showPageSize", "dangerouslyHijackGlobalKeyboardNavigation"];
|
7528
7584
|
|
7529
7585
|
var getShowingLabel = function getShowingLabel(length, pageIndex, pageSize, texts) {
|
7530
7586
|
var minItemIndex = pageIndex * pageSize + 1;
|
@@ -7548,7 +7604,7 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7548
7604
|
showPageSize = _props$showPageSize === void 0 ? true : _props$showPageSize,
|
7549
7605
|
_props$dangerouslyHij = props.dangerouslyHijackGlobalKeyboardNavigation,
|
7550
7606
|
dangerouslyHijackGlobalKeyboardNavigation = _props$dangerouslyHij === void 0 ? false : _props$dangerouslyHij,
|
7551
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
7607
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$G);
|
7552
7608
|
|
7553
7609
|
var _useLocalization = useLocalization(),
|
7554
7610
|
texts = _useLocalization.texts;
|
@@ -7631,13 +7687,13 @@ var Pagination = /*#__PURE__*/React.forwardRef(function Pagination(props, ref) {
|
|
7631
7687
|
})));
|
7632
7688
|
});
|
7633
7689
|
|
7634
|
-
var _excluded$
|
7690
|
+
var _excluded$H = ["duration"];
|
7635
7691
|
var Progress = function Progress(_ref) {
|
7636
7692
|
var _cn;
|
7637
7693
|
|
7638
7694
|
var _ref$duration = _ref.duration,
|
7639
7695
|
duration = _ref$duration === void 0 ? undefined : _ref$duration,
|
7640
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
7696
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$H);
|
7641
7697
|
|
7642
7698
|
var style;
|
7643
7699
|
|
@@ -7661,7 +7717,7 @@ var Progress = function Progress(_ref) {
|
|
7661
7717
|
}));
|
7662
7718
|
};
|
7663
7719
|
|
7664
|
-
var _excluded$
|
7720
|
+
var _excluded$I = ["children"];
|
7665
7721
|
var sanitizeRowProps = function sanitizeRowProps(row, rowExpansionRenderer) {
|
7666
7722
|
var _row$subRows;
|
7667
7723
|
|
@@ -7701,7 +7757,7 @@ var getColumnsFromChildren = function getColumnsFromChildren(children, rowExpans
|
|
7701
7757
|
.map(function (_ref) {
|
7702
7758
|
var _ref$props = _ref.props,
|
7703
7759
|
groupChildren = _ref$props.children,
|
7704
|
-
props = _objectWithoutPropertiesLoose(_ref$props, _excluded$
|
7760
|
+
props = _objectWithoutPropertiesLoose(_ref$props, _excluded$I);
|
7705
7761
|
|
7706
7762
|
var column = _extends({}, props);
|
7707
7763
|
|
@@ -8198,7 +8254,7 @@ var useRowActions = function useRowActions(inlineEditingUniqueId, handlers, acti
|
|
8198
8254
|
return plugin;
|
8199
8255
|
};
|
8200
8256
|
|
8201
|
-
var _excluded$
|
8257
|
+
var _excluded$J = ["onChange"],
|
8202
8258
|
_excluded2$6 = ["onChange"];
|
8203
8259
|
|
8204
8260
|
var toggleBetween = function toggleBetween(fromRowIndex, toRowIndex) {
|
@@ -8246,7 +8302,7 @@ var useRowSelect = function useRowSelect(onSelectedRows) {
|
|
8246
8302
|
rows = _ref.rows;
|
8247
8303
|
|
8248
8304
|
var _getToggleAllRowsSele = getToggleAllRowsSelectedProps(),
|
8249
|
-
props = _objectWithoutPropertiesLoose(_getToggleAllRowsSele, _excluded$
|
8305
|
+
props = _objectWithoutPropertiesLoose(_getToggleAllRowsSele, _excluded$J);
|
8250
8306
|
|
8251
8307
|
var onChange = function onChange(checked) {
|
8252
8308
|
if (checked) {
|
@@ -8561,7 +8617,7 @@ var useRowDraggable = function useRowDraggable(onRowDrag) {
|
|
8561
8617
|
return plugin;
|
8562
8618
|
};
|
8563
8619
|
|
8564
|
-
var _excluded$
|
8620
|
+
var _excluded$K = ["children", "data", "dangerouslyHijackGlobalKeyboardNavigation", "onRowClick", "onRowDrag", "onSelectedRows", "rowClassName", "rowExpansionRenderer", "rowHeight", "selectedRows", "disableSorting", "manualSorting", "onSort", "sortRules", "disablePagination", "length", "onPaginate", "pageSize", "pageIndex", "inlineEditingUniqueId", "onRowCreate", "actions", "onRowEdit", "onRowCopy", "onRowDelete", "onRowActive", "windowed"],
|
8565
8621
|
_excluded2$7 = ["headerGroups", "rows", "sortedRows", "prepareRow", "state", "page", "gotoPage", "setPageSize"];
|
8566
8622
|
|
8567
8623
|
var useTableRowActive = function useTableRowActive(activeIndex, rows, rowExpansionRenderer, handleonRowActive) {
|
@@ -8635,6 +8691,8 @@ var useTableSortingListener = function useTableSortingListener(data, sortedRows,
|
|
8635
8691
|
|
8636
8692
|
var DEFAULT_PAGE_SIZE = 10;
|
8637
8693
|
var useTable = function useTable(props, ref) {
|
8694
|
+
var _otherProps$tabIndex;
|
8695
|
+
|
8638
8696
|
var children = props.children,
|
8639
8697
|
data = props.data,
|
8640
8698
|
onRowClick = props.onRowClick,
|
@@ -8666,7 +8724,7 @@ var useTable = function useTable(props, ref) {
|
|
8666
8724
|
onRowActive = props.onRowActive,
|
8667
8725
|
_props$windowed = props.windowed,
|
8668
8726
|
windowed = _props$windowed === void 0 ? false : _props$windowed,
|
8669
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
8727
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$K);
|
8670
8728
|
|
8671
8729
|
if (onSelectedRows && !selectedRows || !onSelectedRows && selectedRows) {
|
8672
8730
|
throw new Error('Selected rows in a Table component are fully controlled - you must pass both the `onSelectedRows` and `selectedRows` props when using row selection');
|
@@ -8767,7 +8825,8 @@ var useTable = function useTable(props, ref) {
|
|
8767
8825
|
tableProps: _extends({}, otherProps, {
|
8768
8826
|
headerGroups: headerGroups,
|
8769
8827
|
onFocus: handleFocus,
|
8770
|
-
onKeyDown: handleKeyDown
|
8828
|
+
onKeyDown: handleKeyDown,
|
8829
|
+
tabIndex: (_otherProps$tabIndex = otherProps.tabIndex) !== null && _otherProps$tabIndex !== void 0 ? _otherProps$tabIndex : 0
|
8771
8830
|
}),
|
8772
8831
|
state: state,
|
8773
8832
|
pagination: !disablePagination ? {
|
@@ -8783,7 +8842,7 @@ var useTable = function useTable(props, ref) {
|
|
8783
8842
|
};
|
8784
8843
|
};
|
8785
8844
|
|
8786
|
-
var _excluded$
|
8845
|
+
var _excluded$L = ["row", "index", "instance", "headerGroups"];
|
8787
8846
|
|
8788
8847
|
var renderCell = function renderCell(cell, row) {
|
8789
8848
|
var props = _extends({}, cell.getCellProps(), {
|
@@ -8807,7 +8866,7 @@ var Row = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
8807
8866
|
var row = _ref.row,
|
8808
8867
|
index = _ref.index,
|
8809
8868
|
instance = _ref.instance,
|
8810
|
-
rowProps = _objectWithoutPropertiesLoose(_ref, _excluded$
|
8869
|
+
rowProps = _objectWithoutPropertiesLoose(_ref, _excluded$L);
|
8811
8870
|
|
8812
8871
|
var activeIndex = rowProps.activeIndex,
|
8813
8872
|
onRowClick = rowProps.onRowClick,
|
@@ -8917,7 +8976,7 @@ var Column = function Column(_ref) {
|
|
8917
8976
|
}) : null);
|
8918
8977
|
};
|
8919
8978
|
|
8920
|
-
var _excluded$
|
8979
|
+
var _excluded$M = ["autoFocus", "children", "disableSorting", "headerGroups", "headerRef", "bodyRef"];
|
8921
8980
|
var DefaultEmptyState = function DefaultEmptyState() {
|
8922
8981
|
return null;
|
8923
8982
|
};
|
@@ -8929,7 +8988,7 @@ var BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(props,
|
|
8929
8988
|
headerGroups = props.headerGroups,
|
8930
8989
|
headerRef = props.headerRef,
|
8931
8990
|
bodyRef = props.bodyRef,
|
8932
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
8991
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$M);
|
8933
8992
|
|
8934
8993
|
React__default.useEffect(function () {
|
8935
8994
|
if (autoFocus && tableRef.current) {
|
@@ -8964,11 +9023,11 @@ var BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(props,
|
|
8964
9023
|
}, children));
|
8965
9024
|
});
|
8966
9025
|
|
8967
|
-
var _excluded$
|
9026
|
+
var _excluded$N = ["emptyStateRenderer"];
|
8968
9027
|
var Table = /*#__PURE__*/React__default.forwardRef(function Table(props, ref) {
|
8969
9028
|
var _props$emptyStateRend = props.emptyStateRenderer,
|
8970
9029
|
emptyStateRenderer = _props$emptyStateRend === void 0 ? DefaultEmptyState : _props$emptyStateRend,
|
8971
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
9030
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$N);
|
8972
9031
|
|
8973
9032
|
var tableRef = useProxiedRef(ref);
|
8974
9033
|
|
@@ -8996,8 +9055,7 @@ var Table = /*#__PURE__*/React__default.forwardRef(function Table(props, ref) {
|
|
8996
9055
|
}
|
8997
9056
|
|
8998
9057
|
return React__default.createElement(React__default.Fragment, null, paginationElement, React__default.createElement(BaseTable, Object.assign({}, tableProps, {
|
8999
|
-
ref: tableRef
|
9000
|
-
tabIndex: 0
|
9058
|
+
ref: tableRef
|
9001
9059
|
}), rows.length ? rows.map(function (row, index) {
|
9002
9060
|
prepareRow(row, index);
|
9003
9061
|
return React__default.createElement(Row, Object.assign({}, rowProps, {
|
@@ -9033,14 +9091,14 @@ PaginatedTable.Group = function () {
|
|
9033
9091
|
return null;
|
9034
9092
|
};
|
9035
9093
|
|
9036
|
-
var _excluded$
|
9094
|
+
var _excluded$O = ["height"],
|
9037
9095
|
_excluded2$8 = ["emptyStateRenderer", "length", "loadMore"];
|
9038
9096
|
var ROW_HEIGHT = 40;
|
9039
9097
|
var VariableRow = /*#__PURE__*/React__default.memo(function (_ref) {
|
9040
9098
|
var data = _ref.data,
|
9041
9099
|
index = _ref.index,
|
9042
9100
|
_ref$style = _ref.style,
|
9043
|
-
style = _objectWithoutPropertiesLoose(_ref$style, _excluded$
|
9101
|
+
style = _objectWithoutPropertiesLoose(_ref$style, _excluded$O);
|
9044
9102
|
|
9045
9103
|
var _useLocalization = useLocalization(),
|
9046
9104
|
texts = _useLocalization.texts;
|
@@ -9209,7 +9267,6 @@ var WindowedTable = /*#__PURE__*/React__default.forwardRef(function WindowedTabl
|
|
9209
9267
|
return React__default.createElement(BaseTable, Object.assign({}, tableProps, {
|
9210
9268
|
className: className,
|
9211
9269
|
headerRef: headerRef,
|
9212
|
-
tabIndex: 0,
|
9213
9270
|
ref: tableRef
|
9214
9271
|
}), list ? list : emptyStateRenderer());
|
9215
9272
|
});
|
@@ -9406,7 +9463,7 @@ var useTableRowCreation = function useTableRowCreation(data, tableRef) {
|
|
9406
9463
|
};
|
9407
9464
|
};
|
9408
9465
|
|
9409
|
-
var _excluded$
|
9466
|
+
var _excluded$P = ["id", "defaultId", "children", "onChange", "orientation"],
|
9410
9467
|
_excluded2$9 = ["id", "disabled"],
|
9411
9468
|
_excluded3 = ["id"];
|
9412
9469
|
var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {
|
@@ -9416,7 +9473,7 @@ var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {
|
|
9416
9473
|
onChange = props.onChange,
|
9417
9474
|
_props$orientation = props.orientation,
|
9418
9475
|
orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation,
|
9419
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
9476
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$P);
|
9420
9477
|
|
9421
9478
|
var className = cn('yt-tabs', "yt-tabs--" + orientation, {
|
9422
9479
|
'flex w-full': orientation === 'vertical'
|
@@ -9470,9 +9527,9 @@ Tabs.List = TabList;
|
|
9470
9527
|
Tabs.Trigger = TabTrigger;
|
9471
9528
|
Tabs.Content = TabContent;
|
9472
9529
|
|
9473
|
-
var _excluded$
|
9530
|
+
var _excluded$Q = ["defaultValue", "highlighted", "state"];
|
9474
9531
|
var Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
9475
|
-
var otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
9532
|
+
var otherProps = _objectWithoutPropertiesLoose(props, _excluded$Q);
|
9476
9533
|
|
9477
9534
|
var classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className);
|
9478
9535
|
return React.createElement("textarea", Object.assign({}, otherProps, {
|
@@ -9481,11 +9538,11 @@ var Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
|
9481
9538
|
}));
|
9482
9539
|
});
|
9483
9540
|
|
9484
|
-
var _excluded$
|
9541
|
+
var _excluded$R = ["label", "onChange"];
|
9485
9542
|
var Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
9486
9543
|
var label = props.label,
|
9487
9544
|
onChange = props.onChange,
|
9488
|
-
otherProps = _objectWithoutPropertiesLoose(props, _excluded$
|
9545
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$R);
|
9489
9546
|
|
9490
9547
|
var className = cn('group h-6 w-10 flex rounded-full inline-flex', {
|
9491
9548
|
'mr-2': !!label,
|
@@ -9512,7 +9569,7 @@ var Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
|
9512
9569
|
return element;
|
9513
9570
|
});
|
9514
9571
|
|
9515
|
-
var _excluded$
|
9572
|
+
var _excluded$S = ["autoStart", "onComplete", "onClose", "onReady", "spotlightClicks", "disableCloseOnEsc", "disableScrollParentFix"];
|
9516
9573
|
|
9517
9574
|
var Tooltip$1 = function Tooltip(_ref) {
|
9518
9575
|
var continuous = _ref.continuous,
|
@@ -9577,7 +9634,7 @@ var Tour = function Tour(props) {
|
|
9577
9634
|
disableTourSkipOnEsc = props.disableCloseOnEsc,
|
9578
9635
|
_props$disableScrollP = props.disableScrollParentFix,
|
9579
9636
|
disableScrollParentFix = _props$disableScrollP === void 0 ? false : _props$disableScrollP,
|
9580
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$
|
9637
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$S);
|
9581
9638
|
|
9582
9639
|
var steps = React.useMemo(function () {
|
9583
9640
|
return React.Children.map(props.children, function (child) {
|