@economic/taco 1.26.2 → 1.28.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/Calendar/Calendar.d.ts +2 -0
- package/dist/components/Header/components/Button.d.ts +0 -2
- package/dist/components/Header/components/Link.d.ts +0 -1
- package/dist/components/Header/components/SecondaryNavigation.d.ts +2 -2
- package/dist/components/Icon/components/WorkflowTemplateBasic.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/OverflowGroup/OverflowGroup.d.ts +5 -0
- package/dist/components/Provider/Localization.d.ts +1 -0
- package/dist/components/Select2/components/Option.d.ts +1 -1
- package/dist/components/Select2/components/Search.d.ts +1 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/Toast/util.d.ts +2 -1
- package/dist/esm/index.css +3 -3
- package/dist/esm/packages/taco/src/components/Alert/Alert.js +1 -1
- package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Badge/Badge.js +1 -1
- package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js +1 -1
- package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +12 -5
- package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +1 -1
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +8 -4
- package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/Drawer.js +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Button.js +2 -6
- package/dist/esm/packages/taco/src/components/Header/components/Button.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/Link.js +3 -7
- package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +7 -114
- package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js +2 -2
- package/dist/esm/packages/taco/src/components/Header/components/SecondaryNavigation.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/Icon.js +1 -0
- package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/WorkflowTemplateBasic.js +18 -0
- package/dist/esm/packages/taco/src/components/Icon/components/WorkflowTemplateBasic.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useListbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/Menu.js +2 -2
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Header.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Item.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Link.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +75 -0
- package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +1 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +2 -2
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +3 -3
- package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
- package/dist/esm/packages/taco/src/components/Table/hooks/useTableKeyboardNavigation.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/filters/FiltersButton.js +1 -1
- package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +1 -1
- package/dist/esm/packages/taco/src/components/Tag/Tag.js +1 -1
- package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/Toast.js +2 -2
- package/dist/esm/packages/taco/src/components/Toast/Toast.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Toast/util.js +2 -1
- package/dist/esm/packages/taco/src/components/Toast/util.js.map +1 -1
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js +1 -1
- package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +8 -8
- package/dist/esm/packages/taco/src/utils/{taillwind.js → tailwind.js} +1 -1
- package/dist/esm/packages/taco/src/utils/tailwind.js.map +1 -0
- package/dist/index.css +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/taco.cjs.development.js +1245 -1302
- 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/dist/types.d.ts +1 -1
- package/dist/utils/tailwind.d.ts +6 -1
- package/package.json +4 -3
- package/types.json +11 -14
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +0 -5
- package/dist/esm/packages/taco/src/components/ButtonGroup/ButtonGroup.js +0 -46
- package/dist/esm/packages/taco/src/components/ButtonGroup/ButtonGroup.js.map +0 -1
- package/dist/esm/packages/taco/src/utils/taillwind.js.map +0 -1
- package/dist/utils/taillwind.d.ts +0 -6
|
@@ -10,9 +10,6 @@ var cn = _interopDefault(require('classnames'));
|
|
|
10
10
|
var AlertDialogPrimitive = require('@radix-ui/react-alert-dialog');
|
|
11
11
|
var AccordionPrimitive = require('@radix-ui/react-accordion');
|
|
12
12
|
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
13
|
-
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
14
|
-
var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
|
|
15
|
-
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
16
13
|
var ReactDayPicker = _interopDefault(require('react-day-picker'));
|
|
17
14
|
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
18
15
|
var uuid = require('uuid');
|
|
@@ -24,7 +21,11 @@ var interactions = require('@react-aria/interactions');
|
|
|
24
21
|
var framerMotion = require('framer-motion');
|
|
25
22
|
var focus = require('@react-aria/focus');
|
|
26
23
|
var ScrollAreaPrimitive = require('@radix-ui/react-scroll-area');
|
|
24
|
+
var reactUseControllableState = require('@radix-ui/react-use-controllable-state');
|
|
27
25
|
var HoverCardPrimitive = require('@radix-ui/react-hover-card');
|
|
26
|
+
var DropdownMenuPrimitive = require('@radix-ui/react-dropdown-menu');
|
|
27
|
+
var RadioGroupPrimitive = require('@radix-ui/react-radio-group');
|
|
28
|
+
var PrimitiveSwitch = require('@radix-ui/react-switch');
|
|
28
29
|
var reactTable = require('react-table');
|
|
29
30
|
var reactIntersectionObserver = require('react-intersection-observer');
|
|
30
31
|
var reactWindow = require('react-window');
|
|
@@ -35,7 +36,6 @@ var get = _interopDefault(require('lodash/get'));
|
|
|
35
36
|
var compact = _interopDefault(require('lodash/compact'));
|
|
36
37
|
var pullAt = _interopDefault(require('lodash/pullAt'));
|
|
37
38
|
var reactTable$1 = require('@tanstack/react-table');
|
|
38
|
-
var PrimitiveSwitch = require('@radix-ui/react-switch');
|
|
39
39
|
var ReactDOM = _interopDefault(require('react-dom'));
|
|
40
40
|
var reactVirtual = require('react-virtual');
|
|
41
41
|
var core = require('@dnd-kit/core');
|
|
@@ -44,7 +44,6 @@ var utilities = require('@dnd-kit/utilities');
|
|
|
44
44
|
var TabsPrimitive = require('@radix-ui/react-tabs');
|
|
45
45
|
var Joyride = require('react-joyride');
|
|
46
46
|
var Joyride__default = _interopDefault(Joyride);
|
|
47
|
-
var reactPortal = require('@radix-ui/react-portal');
|
|
48
47
|
|
|
49
48
|
const AVAILABLE_COLORS = ['green', 'yellow', 'red', 'blue', 'purple', 'brown', 'pink', 'orange', 'grey', 'transparent'];
|
|
50
49
|
const getColorByState = state => {
|
|
@@ -2950,6 +2949,20 @@ function IconWebsite(props, svgRef) {
|
|
|
2950
2949
|
}
|
|
2951
2950
|
var Website = /*#__PURE__*/React.forwardRef(IconWebsite);
|
|
2952
2951
|
|
|
2952
|
+
function IconWorkflowTemplateBasic(props, svgRef) {
|
|
2953
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
2954
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2955
|
+
viewBox: "0 0 24 24",
|
|
2956
|
+
ref: svgRef
|
|
2957
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
2958
|
+
fillRule: "evenodd",
|
|
2959
|
+
clipRule: "evenodd",
|
|
2960
|
+
d: "M12 1l5.762 3.12v6.161L23 13.117v6.763L17.238 23 12 20.164 6.762 23 1 19.88v-6.762l5.238-2.837V4.137L12 1zM6.761 11.183l-4.144 2.244 4.144 2.243 4.143-2.243-4.143-2.244zm4.714 3.12l-4.19 2.269v4.96l4.19-2.27v-4.96zm1.048 4.96l4.19 2.268v-4.96l-4.19-2.268v4.96zm.57-5.837l4.144 2.244 4.144-2.243-4.144-2.244-4.143 2.244zm8.858.877l-4.19 2.269v4.96l4.19-2.27v-4.96zm-9.428-1.753l4.19-2.269V5.305l-4.19 2.27v4.975zm-1.048-4.975l-4.19-2.256v4.962l4.19 2.27V7.574zm-3.62-3.133L12 6.672l4.144-2.243-4.142-2.243-4.145 2.256zm-1.618 17.09v-4.96l-4.19-2.27v4.96l4.19 2.27z",
|
|
2961
|
+
fill: "currentColor"
|
|
2962
|
+
}));
|
|
2963
|
+
}
|
|
2964
|
+
var WorkflowTemplateBasic = /*#__PURE__*/React.forwardRef(IconWorkflowTemplateBasic);
|
|
2965
|
+
|
|
2953
2966
|
function IconWorkflow(props, svgRef) {
|
|
2954
2967
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
2955
2968
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3190,6 +3203,7 @@ const icons = {
|
|
|
3190
3203
|
warning: Warning,
|
|
3191
3204
|
webshop: Webshop,
|
|
3192
3205
|
website: Website,
|
|
3206
|
+
'workflow-template-basic': WorkflowTemplateBasic,
|
|
3193
3207
|
workflow: Workflow,
|
|
3194
3208
|
zoom: Zoom
|
|
3195
3209
|
};
|
|
@@ -3208,6 +3222,7 @@ const Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
|
|
3208
3222
|
return Component ? /*#__PURE__*/React__default.createElement(Component, Object.assign({}, otherProps, {
|
|
3209
3223
|
className: className,
|
|
3210
3224
|
"data-taco": "icon",
|
|
3225
|
+
"data-icon-name": name,
|
|
3211
3226
|
focusable: "false",
|
|
3212
3227
|
ref: ref,
|
|
3213
3228
|
role: "img"
|
|
@@ -3730,6 +3745,7 @@ const defaultLocalisationTexts = {
|
|
|
3730
3745
|
calendar: {
|
|
3731
3746
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
3732
3747
|
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
3748
|
+
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
3733
3749
|
actions: {
|
|
3734
3750
|
previousMonth: 'Previous month',
|
|
3735
3751
|
nextMonth: 'Next month',
|
|
@@ -3998,1078 +4014,608 @@ const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
|
3998
4014
|
}, button);
|
|
3999
4015
|
});
|
|
4000
4016
|
|
|
4001
|
-
|
|
4002
|
-
const
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4017
|
+
const thisYear = /*#__PURE__*/new Date().getFullYear();
|
|
4018
|
+
const years = [];
|
|
4019
|
+
for (let i = thisYear - 50; i <= thisYear + 10; i += 1) {
|
|
4020
|
+
years.push(i);
|
|
4021
|
+
}
|
|
4022
|
+
const Navbar = /*#__PURE__*/React.memo(({
|
|
4023
|
+
onMonthChange,
|
|
4024
|
+
onNextClick,
|
|
4025
|
+
onPreviousClick,
|
|
4026
|
+
value = new Date()
|
|
4027
|
+
}) => {
|
|
4028
|
+
const {
|
|
4029
|
+
texts: {
|
|
4030
|
+
calendar: {
|
|
4031
|
+
actions,
|
|
4032
|
+
months
|
|
4010
4033
|
}
|
|
4011
4034
|
}
|
|
4012
|
-
}
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4035
|
+
} = useLocalization();
|
|
4036
|
+
const handleChange = function handleChange(event) {
|
|
4037
|
+
const {
|
|
4038
|
+
year,
|
|
4039
|
+
month
|
|
4040
|
+
} = event.target.form;
|
|
4041
|
+
onMonthChange(new Date(year.value, month.value));
|
|
4042
|
+
};
|
|
4043
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4044
|
+
className: "mb-1 flex items-center justify-between"
|
|
4045
|
+
}, /*#__PURE__*/React.createElement("form", {
|
|
4046
|
+
className: "inline-flex space-x-1"
|
|
4047
|
+
}, /*#__PURE__*/React.createElement("select", {
|
|
4048
|
+
className: "h-8 px-2",
|
|
4049
|
+
name: "month",
|
|
4050
|
+
onChange: handleChange,
|
|
4051
|
+
value: value.getMonth()
|
|
4052
|
+
}, months.map((month, i) => /*#__PURE__*/React.createElement("option", {
|
|
4053
|
+
key: month,
|
|
4054
|
+
value: i
|
|
4055
|
+
}, month))), /*#__PURE__*/React.createElement("select", {
|
|
4056
|
+
className: "h-8 px-2",
|
|
4057
|
+
name: "year",
|
|
4058
|
+
onChange: handleChange,
|
|
4059
|
+
value: value.getFullYear()
|
|
4060
|
+
}, years.map(year => /*#__PURE__*/React.createElement("option", {
|
|
4061
|
+
key: year,
|
|
4062
|
+
value: year
|
|
4063
|
+
}, String(year))))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
4064
|
+
title: actions.previousMonth
|
|
4065
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
4066
|
+
appearance: "discrete",
|
|
4067
|
+
icon: "chevron-left",
|
|
4068
|
+
"aria-label": actions.previousMonth,
|
|
4069
|
+
onClick: () => onPreviousClick(),
|
|
4070
|
+
rounded: true
|
|
4071
|
+
})), /*#__PURE__*/React.createElement(Tooltip, {
|
|
4072
|
+
title: actions.nextMonth
|
|
4073
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
4074
|
+
appearance: "discrete",
|
|
4075
|
+
icon: "chevron-right",
|
|
4076
|
+
"aria-label": actions.nextMonth,
|
|
4077
|
+
onClick: () => onNextClick(),
|
|
4078
|
+
rounded: true
|
|
4079
|
+
}))));
|
|
4080
|
+
});
|
|
4081
|
+
const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4017
4082
|
const {
|
|
4018
|
-
|
|
4019
|
-
|
|
4083
|
+
onChange: handleChange,
|
|
4084
|
+
value,
|
|
4085
|
+
disabledDays,
|
|
4020
4086
|
...otherProps
|
|
4021
4087
|
} = props;
|
|
4022
|
-
const
|
|
4023
|
-
|
|
4088
|
+
const {
|
|
4089
|
+
locale,
|
|
4090
|
+
texts
|
|
4091
|
+
} = useLocalization();
|
|
4092
|
+
const [visibleMonth, setVisibleMonth] = React.useState(value !== null && value !== void 0 ? value : new Date());
|
|
4093
|
+
React.useEffect(() => {
|
|
4094
|
+
if (visibleMonth !== value) {
|
|
4095
|
+
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
|
4096
|
+
}
|
|
4097
|
+
// visibleMonth in deps array breaking month switching logic. It should not be in deps array.
|
|
4098
|
+
}, [value]);
|
|
4099
|
+
const handleDayClick = (date, modifiers, event) => {
|
|
4100
|
+
if (modifiers.outside || modifiers.disabled) {
|
|
4101
|
+
return;
|
|
4102
|
+
}
|
|
4103
|
+
handleChange(date, event);
|
|
4104
|
+
};
|
|
4105
|
+
const handleCalendarClickToday = () => {
|
|
4106
|
+
const today = new Date();
|
|
4107
|
+
// set to midday to avoid UTC offset causing dates to be mismatched server side
|
|
4108
|
+
today.setHours(12);
|
|
4109
|
+
today.setMinutes(0);
|
|
4110
|
+
today.setSeconds(0);
|
|
4111
|
+
handleChange(today);
|
|
4112
|
+
};
|
|
4113
|
+
const className = cn('flex bg-white text-xs p-2', otherProps.className);
|
|
4114
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4115
|
+
"data-taco": "calendar"
|
|
4116
|
+
}, /*#__PURE__*/React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
|
4117
|
+
className: className,
|
|
4118
|
+
month: visibleMonth,
|
|
4119
|
+
selectedDays: value,
|
|
4120
|
+
locale: locale.substring(0, 2),
|
|
4121
|
+
firstDayOfWeek: 1,
|
|
4122
|
+
months: texts.calendar.months,
|
|
4123
|
+
weekdaysLong: texts.calendar.weekdays,
|
|
4124
|
+
weekdaysShort: texts.calendar.weekdaysShort,
|
|
4125
|
+
navbarElement: navProps => /*#__PURE__*/React.createElement(Navbar, Object.assign({}, navProps, {
|
|
4126
|
+
onMonthChange: setVisibleMonth,
|
|
4127
|
+
value: visibleMonth
|
|
4128
|
+
})),
|
|
4129
|
+
onDayClick: handleDayClick,
|
|
4130
|
+
onMonthChange: setVisibleMonth,
|
|
4131
|
+
onTodayButtonClick: handleCalendarClickToday,
|
|
4132
|
+
captionElement: () => null,
|
|
4133
|
+
todayButton: texts.calendar.actions.today,
|
|
4134
|
+
numberOfMonths: 1,
|
|
4135
|
+
ref: ref,
|
|
4136
|
+
disabledDays: disabledDays
|
|
4137
|
+
})));
|
|
4138
|
+
});
|
|
4139
|
+
|
|
4140
|
+
const Content$2 = /*#__PURE__*/React.forwardRef(function CardContent(externalProps, ref) {
|
|
4141
|
+
const {
|
|
4142
|
+
noPadding,
|
|
4143
|
+
...props
|
|
4144
|
+
} = externalProps;
|
|
4145
|
+
const className = cn('flex-grow overflow-auto', {
|
|
4146
|
+
'mx-4 mb-4': !noPadding
|
|
4024
4147
|
}, props.className);
|
|
4025
|
-
return /*#__PURE__*/React.createElement(
|
|
4148
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
|
|
4026
4149
|
className: className,
|
|
4027
|
-
"data-taco": "group",
|
|
4028
4150
|
ref: ref
|
|
4029
4151
|
}));
|
|
4030
4152
|
});
|
|
4031
|
-
|
|
4032
|
-
const MenuContext = /*#__PURE__*/React.createContext(undefined);
|
|
4033
|
-
const useCurrentMenu = () => {
|
|
4034
|
-
return React.useContext(MenuContext);
|
|
4035
|
-
};
|
|
4036
|
-
|
|
4037
|
-
const Content$2 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref) {
|
|
4038
|
-
const internalRef = useMergedRef(ref);
|
|
4039
|
-
const menu = useCurrentMenu();
|
|
4153
|
+
const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
4040
4154
|
const {
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
...otherProps
|
|
4155
|
+
title,
|
|
4156
|
+
menu,
|
|
4157
|
+
children
|
|
4045
4158
|
} = props;
|
|
4046
|
-
const className = cn('
|
|
4047
|
-
return /*#__PURE__*/React.createElement(
|
|
4048
|
-
align: align,
|
|
4159
|
+
const className = cn('bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300 hover:border-grey-500', props.className);
|
|
4160
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4049
4161
|
className: className,
|
|
4050
|
-
"data-taco": "
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4162
|
+
"data-taco": "card",
|
|
4163
|
+
ref: ref
|
|
4164
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
4165
|
+
className: "mx-4 mt-4 mb-2 flex"
|
|
4166
|
+
}, title && /*#__PURE__*/React.createElement("h4", {
|
|
4167
|
+
className: "mb-0 flex-grow text-left"
|
|
4168
|
+
}, title), menu ? /*#__PURE__*/React.createElement(IconButton, {
|
|
4169
|
+
icon: "ellipsis-horizontal",
|
|
4170
|
+
appearance: "discrete",
|
|
4171
|
+
menu: menu,
|
|
4172
|
+
className: "-mt-[4px]"
|
|
4173
|
+
}) : null), children);
|
|
4058
4174
|
});
|
|
4175
|
+
Card.Content = Content$2;
|
|
4059
4176
|
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
className: "absolute left-0 ml-1"
|
|
4064
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4065
|
-
className: "-ml-px -mt-px !h-5 !w-5",
|
|
4066
|
-
name: name
|
|
4067
|
-
}));
|
|
4068
|
-
const useItemStyling = ({
|
|
4069
|
-
disabled,
|
|
4070
|
-
indented,
|
|
4071
|
-
className
|
|
4072
|
-
}) => {
|
|
4073
|
-
const menu = useCurrentMenu();
|
|
4074
|
-
React.useEffect(() => {
|
|
4075
|
-
if (indented && !(menu !== null && menu !== void 0 && menu.indented)) {
|
|
4076
|
-
menu === null || menu === void 0 ? void 0 : menu.registerIndentation();
|
|
4077
|
-
}
|
|
4078
|
-
}, [indented]);
|
|
4079
|
-
return cn('flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group', {
|
|
4080
|
-
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
|
4081
|
-
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented),
|
|
4082
|
-
'cursor-pointer text-black hover:wcag-grey-200 data-[highlighted]:wcag-grey-200': !disabled,
|
|
4083
|
-
'cursor-not-allowed hover:bg-white text-grey-300': disabled
|
|
4084
|
-
}, className);
|
|
4085
|
-
};
|
|
4086
|
-
const Shortcut = props => {
|
|
4087
|
-
return /*#__PURE__*/React.createElement("span", Object.assign({}, props, {
|
|
4088
|
-
className: "text-grey-700 ml-auto pl-3"
|
|
4089
|
-
}));
|
|
4177
|
+
// React 18 has this built-in, when we upgrade this hook should be removed and the uuid dependency should be removed
|
|
4178
|
+
const useId = nativeId => {
|
|
4179
|
+
return React__default.useMemo(() => nativeId !== null && nativeId !== void 0 ? nativeId : uuid.v4(), []);
|
|
4090
4180
|
};
|
|
4091
|
-
|
|
4092
|
-
|
|
4181
|
+
|
|
4182
|
+
const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4093
4183
|
const {
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4184
|
+
checked,
|
|
4185
|
+
highlighted,
|
|
4186
|
+
indeterminate,
|
|
4187
|
+
invalid,
|
|
4188
|
+
label,
|
|
4189
|
+
onChange,
|
|
4098
4190
|
...otherProps
|
|
4099
4191
|
} = props;
|
|
4100
|
-
const
|
|
4101
|
-
const className =
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4192
|
+
const id = useId(props.id);
|
|
4193
|
+
const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus:yt-focus',
|
|
4194
|
+
//hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]
|
|
4195
|
+
{
|
|
4196
|
+
'border-grey-300 text-blue-500 hover:text-blue-300 focus:border-blue-500 focus:hover:border-blue-300': !props.disabled && !invalid,
|
|
4197
|
+
'border-grey-200 text-blue-300 cursor-not-allowed': props.disabled,
|
|
4198
|
+
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
|
4199
|
+
'border-red-500 text-red-500 hover:text-red-300 hover:border-red-300 focus:border-red-500 focus:hover:border-red-300': invalid && !props.disabled,
|
|
4200
|
+
'self-start': !!label
|
|
4201
|
+
}, props.className);
|
|
4202
|
+
let handleChange;
|
|
4203
|
+
if (onChange) {
|
|
4204
|
+
handleChange = checked => onChange(checked === 'indeterminate' ? false : checked);
|
|
4205
|
+
}
|
|
4206
|
+
let labelledByProps = null;
|
|
4207
|
+
if (label) {
|
|
4208
|
+
labelledByProps = {
|
|
4209
|
+
'aria-labelledby': `${id}-label`,
|
|
4210
|
+
id
|
|
4113
4211
|
};
|
|
4114
4212
|
}
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
if (props['aria-haspopup'] || typeof dialog === 'function') {
|
|
4120
|
-
event.preventDefault();
|
|
4213
|
+
// the enter keyboard shortcut isn't supported by default, but we want it
|
|
4214
|
+
const handleKeyDown = event => {
|
|
4215
|
+
if (event.key === 'Enter') {
|
|
4216
|
+
event.currentTarget.click();
|
|
4121
4217
|
}
|
|
4122
4218
|
};
|
|
4123
|
-
|
|
4219
|
+
const element = /*#__PURE__*/React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, labelledByProps, {
|
|
4220
|
+
"data-taco": "checkbox",
|
|
4221
|
+
checked: indeterminate ? 'indeterminate' : checked,
|
|
4124
4222
|
className: className,
|
|
4125
|
-
|
|
4126
|
-
|
|
4223
|
+
onCheckedChange: handleChange,
|
|
4224
|
+
onKeyDown: handleKeyDown,
|
|
4127
4225
|
ref: ref
|
|
4128
|
-
}),
|
|
4129
|
-
|
|
4130
|
-
}
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4226
|
+
}), /*#__PURE__*/React.createElement(CheckboxPrimitive.Indicator, {
|
|
4227
|
+
className: "flex h-full w-full"
|
|
4228
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4229
|
+
name: indeterminate ? 'line' : 'tick',
|
|
4230
|
+
className: "!h-full !w-full"
|
|
4231
|
+
})));
|
|
4232
|
+
if (label) {
|
|
4233
|
+
const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {
|
|
4234
|
+
'cursor-not-allowed text-grey-300': props.disabled
|
|
4135
4235
|
});
|
|
4236
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
4237
|
+
className: labelContainerClassName
|
|
4238
|
+
}, element, /*#__PURE__*/React.createElement("label", {
|
|
4239
|
+
htmlFor: id,
|
|
4240
|
+
id: `${id}-label`
|
|
4241
|
+
}, label));
|
|
4136
4242
|
}
|
|
4137
|
-
return
|
|
4243
|
+
return element;
|
|
4138
4244
|
});
|
|
4245
|
+
Checkbox.displayName = 'Checkbox';
|
|
4139
4246
|
|
|
4140
|
-
const
|
|
4141
|
-
const
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4247
|
+
const getInputClasses = props => {
|
|
4248
|
+
const disabled = props.disabled || !!props['aria-disabled'];
|
|
4249
|
+
const readOnly = props.readOnly || !!props['aria-readonly'];
|
|
4250
|
+
const invalid = props.invalid || !!props['aria-invalid'];
|
|
4251
|
+
return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)]', {
|
|
4252
|
+
'bg-white': !props.highlighted && !readOnly,
|
|
4253
|
+
// default
|
|
4254
|
+
'border-grey-300 focus:border-blue-300 focus:yt-focus': !invalid,
|
|
4255
|
+
'hover:shadow-[0_0_0.1rem_theme(colors.grey.500)] active:border-blue-700': !invalid && !disabled,
|
|
4256
|
+
// disabled
|
|
4257
|
+
'border-grey-200 text-opacity-25 cursor-not-allowed placeholder:text-grey-700': disabled,
|
|
4258
|
+
// highlighted
|
|
4259
|
+
'bg-[rgba(255,255,0,0.075)]': props.highlighted && disabled,
|
|
4260
|
+
'bg-[rgba(255,255,0,0.2)]': props.highlighted && !disabled,
|
|
4261
|
+
// invalid
|
|
4262
|
+
'border-red focus:border-red-300 focus:yt-focus-red active:border-red-700': invalid,
|
|
4263
|
+
'hover:shadow-[0_0_0.15rem_theme(colors.red.500)]': invalid && !disabled,
|
|
4264
|
+
// readOnly
|
|
4265
|
+
'cursor-not-allowed text-black bg-grey-200': readOnly
|
|
4152
4266
|
});
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4267
|
+
};
|
|
4268
|
+
const getButtonStateClasses = invalid => {
|
|
4269
|
+
if (invalid) {
|
|
4270
|
+
return 'border !border-red-500 group-peer-focus:!border-red-300 focus:yt-focus-red group-focus:group-active:!border-red-300 transition-colors ease-in';
|
|
4271
|
+
}
|
|
4272
|
+
return 'border border-grey-300 focus:!border-blue-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 transition-colors transition-opacity ease-in';
|
|
4273
|
+
};
|
|
4274
|
+
|
|
4275
|
+
const debounce = (fn, delay) => {
|
|
4276
|
+
let timeoutId;
|
|
4277
|
+
return function (...args) {
|
|
4278
|
+
clearTimeout(timeoutId);
|
|
4279
|
+
timeoutId = setTimeout(() => fn.apply(this, args), delay);
|
|
4156
4280
|
};
|
|
4157
|
-
|
|
4158
|
-
asChild: true,
|
|
4159
|
-
className: className,
|
|
4160
|
-
ref: ref,
|
|
4161
|
-
onClick: handleClick
|
|
4162
|
-
}), /*#__PURE__*/React.createElement("a", {
|
|
4163
|
-
href: href,
|
|
4164
|
-
target: "_blank"
|
|
4165
|
-
}, icon && /*#__PURE__*/React.createElement(Icon$1, {
|
|
4166
|
-
name: icon
|
|
4167
|
-
}), props.children));
|
|
4168
|
-
});
|
|
4281
|
+
};
|
|
4169
4282
|
|
|
4170
|
-
const
|
|
4171
|
-
|
|
4172
|
-
const
|
|
4283
|
+
const getVisibility = element => Boolean(element && (element.offsetWidth || element.offsetHeight || element.getClientRects().length));
|
|
4284
|
+
const useBoundingClientRectListener = (ref, dependencies) => {
|
|
4285
|
+
const [dimensions, setDimensions] = React.useState(undefined);
|
|
4286
|
+
const isRefElementVisible = getVisibility(ref.current);
|
|
4287
|
+
const [visibility, setVisibility] = React.useState(isRefElementVisible);
|
|
4288
|
+
const resize = () => {
|
|
4289
|
+
if (visibility) {
|
|
4290
|
+
var _ref$current;
|
|
4291
|
+
setDimensions((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect());
|
|
4292
|
+
}
|
|
4293
|
+
};
|
|
4173
4294
|
React.useEffect(() => {
|
|
4174
|
-
|
|
4175
|
-
|
|
4295
|
+
const timeout = setTimeout(resize, 0);
|
|
4296
|
+
const debouncedResize = debounce(resize, 250);
|
|
4297
|
+
window.addEventListener('resize', debouncedResize);
|
|
4298
|
+
return () => {
|
|
4299
|
+
clearTimeout(timeout);
|
|
4300
|
+
window.removeEventListener('resize', debouncedResize);
|
|
4301
|
+
};
|
|
4302
|
+
}, [ref.current, visibility]);
|
|
4303
|
+
React.useEffect(() => {
|
|
4304
|
+
const newRefElementVisibility = getVisibility(ref.current);
|
|
4305
|
+
if (visibility !== newRefElementVisibility) {
|
|
4306
|
+
// When visibility of an element changes, then the new visibility of the element can only be checked after the
|
|
4307
|
+
// component has rendered. That's why the visibility check is inside the useEffect. This useEffect will cause
|
|
4308
|
+
// the consumer to rerender and that will cause the above hook to recalculate the dimensions
|
|
4309
|
+
setVisibility(newRefElementVisibility);
|
|
4176
4310
|
}
|
|
4177
|
-
}, [internalRef]);
|
|
4178
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Trigger, Object.assign({}, props, {
|
|
4179
|
-
asChild: true,
|
|
4180
|
-
ref: internalRef
|
|
4181
|
-
}));
|
|
4182
|
-
});
|
|
4183
|
-
|
|
4184
|
-
const Checkbox = /*#__PURE__*/React.forwardRef(function MenuCheckboxItem(props, ref) {
|
|
4185
|
-
const {
|
|
4186
|
-
checked,
|
|
4187
|
-
children,
|
|
4188
|
-
onChange,
|
|
4189
|
-
...otherProps
|
|
4190
|
-
} = props;
|
|
4191
|
-
const className = useItemStyling({
|
|
4192
|
-
disabled: props.disabled,
|
|
4193
|
-
indented: true,
|
|
4194
|
-
className: props.className
|
|
4195
4311
|
});
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
}
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
name: "tick",
|
|
4205
|
-
className: "-ml-px !h-4 !w-4"
|
|
4206
|
-
})), children);
|
|
4207
|
-
});
|
|
4312
|
+
React.useEffect(() => {
|
|
4313
|
+
if (dependencies) {
|
|
4314
|
+
var _ref$current2;
|
|
4315
|
+
setDimensions((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.getBoundingClientRect());
|
|
4316
|
+
}
|
|
4317
|
+
}, dependencies);
|
|
4318
|
+
return dimensions;
|
|
4319
|
+
};
|
|
4208
4320
|
|
|
4209
|
-
|
|
4210
|
-
const
|
|
4211
|
-
const
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
'border-red-500 hover:border-4 text-red-500 focus:border-red-500 focus:yt-focus-red aria-checked:bg-red-500 aria-checked:border-red': context.invalid && !isDisabled
|
|
4227
|
-
});
|
|
4228
|
-
const labelClassName = cn('flex items-center gap-2', {
|
|
4229
|
-
'cursor-pointer': !isDisabled,
|
|
4230
|
-
'cursor-not-allowed text-grey-300': isDisabled
|
|
4231
|
-
}, props.className);
|
|
4232
|
-
return /*#__PURE__*/React.createElement("label", {
|
|
4233
|
-
className: labelClassName
|
|
4234
|
-
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Item, Object.assign({}, otherProps, {
|
|
4235
|
-
className: className,
|
|
4236
|
-
disabled: isDisabled,
|
|
4237
|
-
ref: ref,
|
|
4238
|
-
value: getRadioGroupItemValueAsString(value)
|
|
4239
|
-
}), /*#__PURE__*/React.createElement(RadioGroupPrimitive.Indicator, {
|
|
4240
|
-
className: "h-2 w-2 rounded-full bg-white"
|
|
4241
|
-
})), children);
|
|
4242
|
-
});
|
|
4243
|
-
const useRadioGroup = props => {
|
|
4321
|
+
// merges an external ref (optional) with an internal ref (required)
|
|
4322
|
+
const useMergedRef = ref => {
|
|
4323
|
+
const internalRef = React__default.useRef(null);
|
|
4324
|
+
React__default.useEffect(() => {
|
|
4325
|
+
if (ref) {
|
|
4326
|
+
if (typeof ref === 'function') {
|
|
4327
|
+
ref(internalRef.current);
|
|
4328
|
+
} else {
|
|
4329
|
+
ref.current = internalRef.current;
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
}, [ref]);
|
|
4333
|
+
return internalRef;
|
|
4334
|
+
};
|
|
4335
|
+
|
|
4336
|
+
const validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];
|
|
4337
|
+
const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function InputWithoutDeprecatedFeatures(props, ref) {
|
|
4244
4338
|
const {
|
|
4245
|
-
|
|
4246
|
-
defaultValue,
|
|
4247
|
-
disabled,
|
|
4339
|
+
highlighted,
|
|
4248
4340
|
invalid,
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4341
|
+
onKeyDown,
|
|
4342
|
+
postfix,
|
|
4343
|
+
prefix,
|
|
4344
|
+
type = 'text',
|
|
4345
|
+
...attributes
|
|
4253
4346
|
} = props;
|
|
4254
|
-
const
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4347
|
+
const internalRef = useMergedRef(ref);
|
|
4348
|
+
let handleKeyDown = onKeyDown;
|
|
4349
|
+
// home and end keys only navigate to the start/end of input value if the input container does not scroll
|
|
4350
|
+
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
|
4351
|
+
// so we manually override it to ensure _our_ desired behaviour remains intact
|
|
4352
|
+
// only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange
|
|
4353
|
+
if (validSetSelectionRangeTypes.includes(type)) {
|
|
4354
|
+
handleKeyDown = event => {
|
|
4355
|
+
if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {
|
|
4356
|
+
event.preventDefault();
|
|
4357
|
+
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
|
4358
|
+
event.currentTarget.setSelectionRange(position, position);
|
|
4359
|
+
}
|
|
4360
|
+
if (typeof onKeyDown === 'function') {
|
|
4361
|
+
onKeyDown(event);
|
|
4259
4362
|
}
|
|
4260
|
-
});
|
|
4261
|
-
return radioGroupItemValues;
|
|
4262
|
-
}, [children]);
|
|
4263
|
-
const context = React.useMemo(() => ({
|
|
4264
|
-
disabled: disabled !== null && disabled !== void 0 ? disabled : false,
|
|
4265
|
-
invalid: invalid !== null && invalid !== void 0 ? invalid : false
|
|
4266
|
-
}), [disabled, invalid]);
|
|
4267
|
-
let valueProps;
|
|
4268
|
-
if (onChange !== undefined) {
|
|
4269
|
-
const handleChange = value => onChange(findByValue(values, value));
|
|
4270
|
-
valueProps = {
|
|
4271
|
-
onValueChange: handleChange,
|
|
4272
|
-
value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined
|
|
4273
|
-
};
|
|
4274
|
-
} else {
|
|
4275
|
-
valueProps = {
|
|
4276
|
-
defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined
|
|
4277
4363
|
};
|
|
4278
4364
|
}
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4365
|
+
const prefixRef = React.useRef(null);
|
|
4366
|
+
const prefixRect = useBoundingClientRectListener(prefixRef);
|
|
4367
|
+
const postfixRef = React.useRef(null);
|
|
4368
|
+
const postfixRect = useBoundingClientRectListener(postfixRef);
|
|
4369
|
+
const className = cn(getInputClasses(props), {
|
|
4370
|
+
'pl-8': !!prefix,
|
|
4371
|
+
'pr-8': !!postfix
|
|
4372
|
+
}, attributes.className);
|
|
4373
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4374
|
+
className: "relative inline-flex w-full",
|
|
4375
|
+
"data-taco": "input-container",
|
|
4376
|
+
style: {
|
|
4377
|
+
opacity: 0.999
|
|
4287
4378
|
}
|
|
4288
|
-
}
|
|
4289
|
-
};
|
|
4290
|
-
const RadioGroup = /*#__PURE__*/React.forwardRef(function RadioGroup(props, ref) {
|
|
4291
|
-
const {
|
|
4292
|
-
context,
|
|
4293
|
-
props: otherProps
|
|
4294
|
-
} = useRadioGroup(props);
|
|
4295
|
-
const className = cn('flex items-start gap-y-2', {
|
|
4296
|
-
'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',
|
|
4297
|
-
'flex-col': otherProps.orientation === 'vertical'
|
|
4298
|
-
}, otherProps.className);
|
|
4299
|
-
return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, {
|
|
4300
|
-
value: context
|
|
4301
|
-
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Root, Object.assign({}, otherProps, {
|
|
4379
|
+
}, /*#__PURE__*/React.createElement("input", Object.assign({}, attributes, {
|
|
4302
4380
|
className: className,
|
|
4303
|
-
"data-taco": "
|
|
4304
|
-
|
|
4305
|
-
|
|
4381
|
+
"data-taco": "input",
|
|
4382
|
+
onKeyDown: handleKeyDown,
|
|
4383
|
+
ref: internalRef,
|
|
4384
|
+
style: {
|
|
4385
|
+
paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,
|
|
4386
|
+
paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined
|
|
4387
|
+
},
|
|
4388
|
+
type: type
|
|
4389
|
+
})), prefix ? /*#__PURE__*/React.createElement(Affix, {
|
|
4390
|
+
type: "prefix",
|
|
4391
|
+
children: prefix,
|
|
4392
|
+
disabled: attributes.disabled,
|
|
4393
|
+
ref: prefixRef
|
|
4394
|
+
}) : null, postfix ? /*#__PURE__*/React.createElement(Affix, {
|
|
4395
|
+
type: "postfix",
|
|
4396
|
+
children: postfix,
|
|
4397
|
+
disabled: attributes.disabled,
|
|
4398
|
+
ref: postfixRef
|
|
4399
|
+
}) : null);
|
|
4306
4400
|
});
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
const RadioItem = props => {
|
|
4310
|
-
const context = React.useContext(MenuRadioGroupContext);
|
|
4401
|
+
const Affix = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Affix(props, ref) {
|
|
4311
4402
|
const {
|
|
4312
4403
|
children,
|
|
4313
|
-
|
|
4314
|
-
|
|
4404
|
+
disabled,
|
|
4405
|
+
type
|
|
4315
4406
|
} = props;
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
}
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
disabled: false
|
|
4334
|
-
});
|
|
4335
|
-
const RadioGroup$1 = /*#__PURE__*/React.forwardRef(function MenuRadioItem(props, ref) {
|
|
4407
|
+
if (children) {
|
|
4408
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
4409
|
+
className: cn('group absolute top-0 flex h-full items-center justify-center px-2',
|
|
4410
|
+
// icon
|
|
4411
|
+
'[&_[data-taco="icon"]]:!h-5 [&_[data-taco="icon"]]:!w-5', {
|
|
4412
|
+
'text-grey-300': disabled,
|
|
4413
|
+
'text-grey-700': !disabled,
|
|
4414
|
+
'left-0 [&>button]:!-ml-2': type === 'prefix',
|
|
4415
|
+
'right-0 [&>button]:!-mr-2': type === 'postfix'
|
|
4416
|
+
}),
|
|
4417
|
+
ref: ref
|
|
4418
|
+
}, children);
|
|
4419
|
+
}
|
|
4420
|
+
return null;
|
|
4421
|
+
}));
|
|
4422
|
+
const Input = /*#__PURE__*/React.forwardRef(function LegacyInput(props, ref) {
|
|
4423
|
+
var _attributes$postfix;
|
|
4336
4424
|
const {
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4425
|
+
button,
|
|
4426
|
+
icon,
|
|
4427
|
+
...attributes
|
|
4428
|
+
} = props;
|
|
4429
|
+
let postfix;
|
|
4430
|
+
if (button) {
|
|
4431
|
+
const disabled = button.props.disabled || attributes.disabled;
|
|
4432
|
+
const buttonClassName = cn('items-center focus:z-10 flex justify-center rounded-l-none rounded-r h-full focus:rounded focus:outline-none', getButtonStateClasses(attributes.invalid), button.props.className);
|
|
4433
|
+
postfix = /*#__PURE__*/React.cloneElement(button, {
|
|
4434
|
+
className: buttonClassName,
|
|
4435
|
+
disabled
|
|
4436
|
+
});
|
|
4437
|
+
} else if (icon) {
|
|
4438
|
+
postfix = typeof icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
4439
|
+
name: icon
|
|
4440
|
+
}) : icon;
|
|
4441
|
+
}
|
|
4442
|
+
return /*#__PURE__*/React.createElement(InputWithoutDeprecatedFeatures, Object.assign({}, attributes, {
|
|
4443
|
+
postfix: (_attributes$postfix = attributes.postfix) !== null && _attributes$postfix !== void 0 ? _attributes$postfix : postfix,
|
|
4345
4444
|
ref: ref
|
|
4346
|
-
}))
|
|
4445
|
+
}));
|
|
4347
4446
|
});
|
|
4348
|
-
RadioGroup$1.Item = RadioItem;
|
|
4349
4447
|
|
|
4350
|
-
const
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4448
|
+
const getNextIndexFromKey = (key, length, index, direction = 'vertical') => {
|
|
4449
|
+
const previousKey = direction === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
|
|
4450
|
+
const nextKey = direction === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
|
|
4451
|
+
switch (key) {
|
|
4452
|
+
case previousKey:
|
|
4453
|
+
return index !== undefined ? index - 1 < 0 ? 0 : index - 1 : index;
|
|
4454
|
+
case nextKey:
|
|
4455
|
+
return index !== undefined ? index + 1 >= length ? index : index + 1 : index;
|
|
4456
|
+
case 'Home':
|
|
4457
|
+
return 0;
|
|
4458
|
+
case 'End':
|
|
4459
|
+
return length - 1;
|
|
4460
|
+
default:
|
|
4461
|
+
return;
|
|
4462
|
+
}
|
|
4463
|
+
};
|
|
4464
|
+
const useListKeyboardNavigation = (length = 0, options = {
|
|
4465
|
+
direction: 'vertical'
|
|
4466
|
+
}) => {
|
|
4467
|
+
const [index, setIndex] = React__default.useState(options.initialIndex);
|
|
4468
|
+
const getNextIndex = event => {
|
|
4469
|
+
const nextIndex = getNextIndexFromKey(event.key, length, index, options.direction);
|
|
4470
|
+
if (nextIndex !== undefined) {
|
|
4471
|
+
event.preventDefault();
|
|
4472
|
+
}
|
|
4473
|
+
return nextIndex;
|
|
4474
|
+
};
|
|
4475
|
+
return [index, setIndex, getNextIndex];
|
|
4354
4476
|
};
|
|
4355
4477
|
|
|
4356
|
-
const
|
|
4357
|
-
const
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
}
|
|
4478
|
+
const scrollToChildElement = (parent, child) => {
|
|
4479
|
+
const clientHeight = parent.clientHeight;
|
|
4480
|
+
if (parent.scrollHeight > clientHeight) {
|
|
4481
|
+
const scrollTop = parent.scrollTop;
|
|
4482
|
+
const scrollBottom = clientHeight + scrollTop;
|
|
4483
|
+
const childBottom = child.offsetTop + child.offsetHeight;
|
|
4484
|
+
if (childBottom > scrollBottom) {
|
|
4485
|
+
parent.scrollTop = childBottom - clientHeight;
|
|
4486
|
+
} else if (child.offsetTop < scrollTop) {
|
|
4487
|
+
parent.scrollTop = child.offsetTop;
|
|
4488
|
+
}
|
|
4489
|
+
}
|
|
4490
|
+
};
|
|
4491
|
+
const useListScrollTo = (internalRef, itemRefs) => {
|
|
4492
|
+
const scrollTo = index => {
|
|
4493
|
+
if (internalRef && internalRef.current) {
|
|
4494
|
+
if (index !== undefined) {
|
|
4495
|
+
const activeRef = itemRefs[index];
|
|
4496
|
+
if (activeRef && activeRef.current) {
|
|
4497
|
+
scrollToChildElement(internalRef.current, activeRef.current);
|
|
4498
|
+
}
|
|
4499
|
+
} else {
|
|
4500
|
+
internalRef.current.scrollTop = 0;
|
|
4501
|
+
}
|
|
4502
|
+
}
|
|
4503
|
+
};
|
|
4504
|
+
return {
|
|
4505
|
+
scrollTo
|
|
4506
|
+
};
|
|
4507
|
+
};
|
|
4367
4508
|
|
|
4368
|
-
const
|
|
4509
|
+
const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
|
4369
4510
|
const {
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
...props
|
|
4376
|
-
} = externalProps;
|
|
4377
|
-
const [indented, setIndented] = React.useState(false);
|
|
4378
|
-
const [minWidth, setMinWidth] = React.useState(undefined);
|
|
4379
|
-
const [open, setOpen] = reactUseControllableState.useControllableState({
|
|
4380
|
-
// uncontrolled
|
|
4381
|
-
defaultProp,
|
|
4382
|
-
// controlled
|
|
4383
|
-
onChange,
|
|
4384
|
-
prop
|
|
4385
|
-
});
|
|
4386
|
-
const context = React.useMemo(() => ({
|
|
4387
|
-
indented,
|
|
4388
|
-
registerIndentation: () => setIndented(true),
|
|
4389
|
-
minWidth,
|
|
4390
|
-
setMinWidth: width => setMinWidth(width),
|
|
4391
|
-
close: () => setOpen(false)
|
|
4392
|
-
}), [indented, minWidth]);
|
|
4393
|
-
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
4394
|
-
value: context
|
|
4395
|
-
}, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Root, Object.assign({}, props, {
|
|
4396
|
-
modal: false,
|
|
4397
|
-
open: open,
|
|
4398
|
-
onOpenChange: setOpen
|
|
4399
|
-
}), trigger && /*#__PURE__*/React.createElement(Trigger$2, {
|
|
4400
|
-
ref: ref
|
|
4401
|
-
}, trigger), children));
|
|
4402
|
-
});
|
|
4403
|
-
Menu$1.Trigger = Trigger$2;
|
|
4404
|
-
Menu$1.Content = Content$2;
|
|
4405
|
-
Menu$1.Item = Item$1;
|
|
4406
|
-
Menu$1.Link = Link;
|
|
4407
|
-
Menu$1.Checkbox = Checkbox;
|
|
4408
|
-
Menu$1.Separator = Separator;
|
|
4409
|
-
Menu$1.Header = Header;
|
|
4410
|
-
Menu$1.RadioGroup = RadioGroup$1;
|
|
4411
|
-
|
|
4412
|
-
const useIntersectionObserver = (ref, offset) => {
|
|
4413
|
-
const [intersectedIndexes, setIntersectedIndexes] = React__default.useState({});
|
|
4414
|
-
const handleIntersection = (entries, observer) => {
|
|
4415
|
-
if (observer.root) {
|
|
4416
|
-
const children = Array.from(observer.root.children);
|
|
4417
|
-
const map = {};
|
|
4418
|
-
entries.forEach(entry => {
|
|
4419
|
-
// entries only contains the items being intersected not all children of the ref
|
|
4420
|
-
// so use root and the the entry being intersected to find its real index
|
|
4421
|
-
// on first mount this is different - all children are present
|
|
4422
|
-
map[children.indexOf(entry.target)] = entry.isIntersecting;
|
|
4423
|
-
});
|
|
4424
|
-
setIntersectedIndexes(prev => ({
|
|
4425
|
-
...prev,
|
|
4426
|
-
...map
|
|
4427
|
-
}));
|
|
4428
|
-
}
|
|
4429
|
-
};
|
|
4430
|
-
const intersectedChildIndex = React__default.useMemo(() => {
|
|
4431
|
-
const index = Object.values(intersectedIndexes).indexOf(false);
|
|
4432
|
-
return index > -1 ? index : undefined;
|
|
4433
|
-
}, [intersectedIndexes]);
|
|
4434
|
-
const hasRootMargin = intersectedChildIndex !== undefined && offset;
|
|
4511
|
+
delay = 500,
|
|
4512
|
+
label,
|
|
4513
|
+
...otherProps
|
|
4514
|
+
} = props;
|
|
4515
|
+
const [visible, setVisibility] = React__default.useState(!delay);
|
|
4435
4516
|
React__default.useEffect(() => {
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
rootMargin: hasRootMargin ? `0px -${offset}px 0px 0px` : undefined,
|
|
4440
|
-
threshold: 1
|
|
4441
|
-
});
|
|
4442
|
-
if (observer.root) {
|
|
4443
|
-
Array.from(observer.root.children).forEach(item => {
|
|
4444
|
-
if (item.getAttribute('data-intersection-observer') !== 'ignore') {
|
|
4445
|
-
observer.observe(item);
|
|
4446
|
-
}
|
|
4447
|
-
});
|
|
4517
|
+
let timeout;
|
|
4518
|
+
if (delay) {
|
|
4519
|
+
timeout = window.setTimeout(() => setVisibility(true), delay);
|
|
4448
4520
|
}
|
|
4449
4521
|
return () => {
|
|
4450
|
-
|
|
4522
|
+
if (timeout) {
|
|
4523
|
+
clearTimeout(timeout);
|
|
4524
|
+
}
|
|
4451
4525
|
};
|
|
4452
|
-
}, [
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
const
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
const intersectedChildIndex = useIntersectionObserver(internalRef, OFFSET);
|
|
4473
|
-
const children = React__default.Children.toArray(props.children);
|
|
4474
|
-
const hidden = intersectedChildIndex !== undefined ? children.slice(intersectedChildIndex) : [];
|
|
4475
|
-
return /*#__PURE__*/React__default.createElement(Group, Object.assign({}, props, {
|
|
4476
|
-
ref: internalRef
|
|
4477
|
-
}), children.map((child, index) => /*#__PURE__*/React__default.cloneElement(child, {
|
|
4478
|
-
className: cn(child.props.className, {
|
|
4479
|
-
visible: intersectedChildIndex === undefined || index < intersectedChildIndex,
|
|
4480
|
-
'invisible order-[100] pointer-events-none': intersectedChildIndex !== undefined && index >= intersectedChildIndex
|
|
4481
|
-
})
|
|
4482
|
-
})), hidden.length ? /*#__PURE__*/React__default.createElement(IconButton, {
|
|
4483
|
-
className: "sticky right-0 order-[99]",
|
|
4484
|
-
"data-intesection-observer": "ignore",
|
|
4485
|
-
icon: "more",
|
|
4486
|
-
menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, null, hidden.map((button, index) => /*#__PURE__*/React__default.createElement(Menu$1.Item, Object.assign({
|
|
4487
|
-
key: index
|
|
4488
|
-
}, sanitizeButtonPropsForMenuItem(button.props))))))
|
|
4489
|
-
}) : null);
|
|
4526
|
+
}, [delay]);
|
|
4527
|
+
if (!visible) {
|
|
4528
|
+
return null;
|
|
4529
|
+
}
|
|
4530
|
+
const className = cn('inline-flex flex-col relative items-center', otherProps.className);
|
|
4531
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
|
|
4532
|
+
className: className,
|
|
4533
|
+
"data-taco": "spinner",
|
|
4534
|
+
ref: ref
|
|
4535
|
+
}), /*#__PURE__*/React__default.createElement("svg", {
|
|
4536
|
+
className: "h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]",
|
|
4537
|
+
viewBox: "0 0 100 100",
|
|
4538
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4539
|
+
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
4540
|
+
cx: "50",
|
|
4541
|
+
cy: "50",
|
|
4542
|
+
r: "45"
|
|
4543
|
+
})), label && /*#__PURE__*/React__default.createElement("span", {
|
|
4544
|
+
className: "mt-4"
|
|
4545
|
+
}, label));
|
|
4490
4546
|
});
|
|
4491
4547
|
|
|
4492
|
-
const
|
|
4493
|
-
const
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
onPreviousClick,
|
|
4501
|
-
value = new Date()
|
|
4502
|
-
}) => {
|
|
4503
|
-
const {
|
|
4504
|
-
texts: {
|
|
4505
|
-
calendar: {
|
|
4506
|
-
actions,
|
|
4507
|
-
months
|
|
4508
|
-
}
|
|
4548
|
+
const getId = (id, value) => `${id}_${value}`;
|
|
4549
|
+
const getNextEnabledItem = (event, data, index) => {
|
|
4550
|
+
const nextIndex = getNextIndexFromKey(event.key, data.length, index);
|
|
4551
|
+
if (nextIndex) {
|
|
4552
|
+
if (nextIndex === index) {
|
|
4553
|
+
return index;
|
|
4554
|
+
} else if (data[nextIndex] && data[nextIndex].disabled) {
|
|
4555
|
+
return getNextEnabledItem(event, data, nextIndex);
|
|
4509
4556
|
}
|
|
4510
|
-
}
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
month
|
|
4515
|
-
} = event.target.form;
|
|
4516
|
-
onMonthChange(new Date(year.value, month.value));
|
|
4517
|
-
};
|
|
4518
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4519
|
-
className: "mb-2 flex items-center justify-between"
|
|
4520
|
-
}, /*#__PURE__*/React.createElement("form", {
|
|
4521
|
-
className: "inline-flex space-x-1"
|
|
4522
|
-
}, /*#__PURE__*/React.createElement("select", {
|
|
4523
|
-
className: "h-8 px-2",
|
|
4524
|
-
name: "month",
|
|
4525
|
-
onChange: handleChange,
|
|
4526
|
-
value: value.getMonth()
|
|
4527
|
-
}, months.map((month, i) => /*#__PURE__*/React.createElement("option", {
|
|
4528
|
-
key: month,
|
|
4529
|
-
value: i
|
|
4530
|
-
}, month))), /*#__PURE__*/React.createElement("select", {
|
|
4531
|
-
className: "h-8 px-2",
|
|
4532
|
-
name: "year",
|
|
4533
|
-
onChange: handleChange,
|
|
4534
|
-
value: value.getFullYear()
|
|
4535
|
-
}, years.map(year => /*#__PURE__*/React.createElement("option", {
|
|
4536
|
-
key: year,
|
|
4537
|
-
value: year
|
|
4538
|
-
}, String(year))))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconButton, {
|
|
4539
|
-
appearance: "discrete",
|
|
4540
|
-
icon: "chevron-left",
|
|
4541
|
-
"aria-label": actions.previousMonth,
|
|
4542
|
-
onClick: () => onPreviousClick(),
|
|
4543
|
-
rounded: true
|
|
4544
|
-
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
4545
|
-
appearance: "discrete",
|
|
4546
|
-
icon: "chevron-right",
|
|
4547
|
-
"aria-label": actions.nextMonth,
|
|
4548
|
-
onClick: () => onNextClick(),
|
|
4549
|
-
rounded: true
|
|
4550
|
-
})));
|
|
4551
|
-
});
|
|
4552
|
-
const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4557
|
+
}
|
|
4558
|
+
return nextIndex;
|
|
4559
|
+
};
|
|
4560
|
+
const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(props, ref) {
|
|
4553
4561
|
const {
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4562
|
+
data,
|
|
4563
|
+
disabled,
|
|
4564
|
+
highlighted,
|
|
4565
|
+
id,
|
|
4566
|
+
invalid: _,
|
|
4567
|
+
loading,
|
|
4568
|
+
onChange: setCurrentIndex,
|
|
4569
|
+
onClick,
|
|
4570
|
+
onFocus,
|
|
4571
|
+
onKeyDown,
|
|
4572
|
+
readOnly,
|
|
4573
|
+
scrollOnFocus = false,
|
|
4574
|
+
value: currentIndex,
|
|
4575
|
+
multiselect,
|
|
4576
|
+
selectedIndexes = [],
|
|
4577
|
+
allOptionsSelected = false,
|
|
4557
4578
|
...otherProps
|
|
4558
4579
|
} = props;
|
|
4580
|
+
const listRef = useMergedRef(ref);
|
|
4581
|
+
const itemRefs = React.useMemo(() => data.map(() => /*#__PURE__*/React.createRef()), [data]);
|
|
4559
4582
|
const {
|
|
4560
|
-
locale,
|
|
4561
4583
|
texts
|
|
4562
4584
|
} = useLocalization();
|
|
4563
|
-
const
|
|
4585
|
+
const {
|
|
4586
|
+
scrollTo
|
|
4587
|
+
} = useListScrollTo(listRef, itemRefs);
|
|
4564
4588
|
React.useEffect(() => {
|
|
4565
|
-
|
|
4566
|
-
|
|
4589
|
+
var _itemRefs$currentInde;
|
|
4590
|
+
if (currentIndex && (_itemRefs$currentInde = itemRefs[currentIndex]) !== null && _itemRefs$currentInde !== void 0 && _itemRefs$currentInde.current) {
|
|
4591
|
+
var _itemRefs$currentInde2;
|
|
4592
|
+
(_itemRefs$currentInde2 = itemRefs[currentIndex].current) === null || _itemRefs$currentInde2 === void 0 ? void 0 : _itemRefs$currentInde2.scrollIntoView({
|
|
4593
|
+
block: 'center'
|
|
4594
|
+
});
|
|
4567
4595
|
}
|
|
4568
|
-
}, [
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4596
|
+
}, []);
|
|
4597
|
+
React.useEffect(() => {
|
|
4598
|
+
scrollTo(currentIndex);
|
|
4599
|
+
}, [currentIndex]);
|
|
4600
|
+
const handleKeyDown = event => {
|
|
4601
|
+
const nextIndex = getNextEnabledItem(event, data, currentIndex);
|
|
4602
|
+
if (nextIndex !== undefined && nextIndex !== currentIndex) {
|
|
4603
|
+
event.preventDefault();
|
|
4604
|
+
scrollTo(nextIndex);
|
|
4605
|
+
setCurrentIndex(nextIndex);
|
|
4606
|
+
}
|
|
4607
|
+
if (onKeyDown) {
|
|
4608
|
+
event.persist();
|
|
4609
|
+
const index = nextIndex !== undefined ? nextIndex : currentIndex;
|
|
4610
|
+
onKeyDown(event, index);
|
|
4572
4611
|
}
|
|
4573
|
-
handleChange(date, event);
|
|
4574
4612
|
};
|
|
4575
|
-
const
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
handleChange(today);
|
|
4582
|
-
};
|
|
4583
|
-
const className = cn('flex bg-white text-xs p-4', otherProps.className);
|
|
4584
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4585
|
-
"data-taco": "calendar"
|
|
4586
|
-
}, /*#__PURE__*/React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
|
4587
|
-
className: className,
|
|
4588
|
-
month: visibleMonth,
|
|
4589
|
-
selectedDays: value,
|
|
4590
|
-
locale: locale.substring(0, 2),
|
|
4591
|
-
firstDayOfWeek: 1,
|
|
4592
|
-
months: texts.calendar.months,
|
|
4593
|
-
weekdaysShort: texts.calendar.weekdaysShort,
|
|
4594
|
-
navbarElement: navProps => /*#__PURE__*/React.createElement(Navbar, Object.assign({}, navProps, {
|
|
4595
|
-
onMonthChange: setVisibleMonth,
|
|
4596
|
-
value: visibleMonth
|
|
4597
|
-
})),
|
|
4598
|
-
onDayClick: handleDayClick,
|
|
4599
|
-
onMonthChange: setVisibleMonth,
|
|
4600
|
-
onTodayButtonClick: handleCalendarClickToday,
|
|
4601
|
-
captionElement: () => null,
|
|
4602
|
-
todayButton: texts.calendar.actions.today,
|
|
4603
|
-
numberOfMonths: 1,
|
|
4604
|
-
ref: ref,
|
|
4605
|
-
disabledDays: disabledDays
|
|
4606
|
-
})));
|
|
4607
|
-
});
|
|
4608
|
-
|
|
4609
|
-
const Content$3 = /*#__PURE__*/React.forwardRef(function CardContent(externalProps, ref) {
|
|
4610
|
-
const {
|
|
4611
|
-
noPadding,
|
|
4612
|
-
...props
|
|
4613
|
-
} = externalProps;
|
|
4614
|
-
const className = cn('flex-grow overflow-auto', {
|
|
4615
|
-
'mx-4 mb-4': !noPadding
|
|
4616
|
-
}, props.className);
|
|
4617
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
|
|
4618
|
-
className: className,
|
|
4619
|
-
ref: ref
|
|
4620
|
-
}));
|
|
4621
|
-
});
|
|
4622
|
-
const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
4623
|
-
const {
|
|
4624
|
-
title,
|
|
4625
|
-
menu,
|
|
4626
|
-
children
|
|
4627
|
-
} = props;
|
|
4628
|
-
const className = cn('bg-white flex flex-col rounded-xl border border-solid border-radius-[12px] border-grey-300 hover:border-grey-500', props.className);
|
|
4629
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4630
|
-
className: className,
|
|
4631
|
-
"data-taco": "card",
|
|
4632
|
-
ref: ref
|
|
4633
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4634
|
-
className: "mx-4 mt-4 mb-2 flex"
|
|
4635
|
-
}, title && /*#__PURE__*/React.createElement("h4", {
|
|
4636
|
-
className: "mb-0 flex-grow text-left"
|
|
4637
|
-
}, title), menu ? /*#__PURE__*/React.createElement(IconButton, {
|
|
4638
|
-
icon: "ellipsis-horizontal",
|
|
4639
|
-
appearance: "discrete",
|
|
4640
|
-
menu: menu,
|
|
4641
|
-
className: "-mt-[4px]"
|
|
4642
|
-
}) : null), children);
|
|
4643
|
-
});
|
|
4644
|
-
Card.Content = Content$3;
|
|
4645
|
-
|
|
4646
|
-
// React 18 has this built-in, when we upgrade this hook should be removed and the uuid dependency should be removed
|
|
4647
|
-
const useId = nativeId => {
|
|
4648
|
-
return React__default.useMemo(() => nativeId !== null && nativeId !== void 0 ? nativeId : uuid.v4(), []);
|
|
4649
|
-
};
|
|
4650
|
-
|
|
4651
|
-
const Checkbox$1 = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4652
|
-
const {
|
|
4653
|
-
checked,
|
|
4654
|
-
highlighted,
|
|
4655
|
-
indeterminate,
|
|
4656
|
-
invalid,
|
|
4657
|
-
label,
|
|
4658
|
-
onChange,
|
|
4659
|
-
...otherProps
|
|
4660
|
-
} = props;
|
|
4661
|
-
const id = useId(props.id);
|
|
4662
|
-
const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus:yt-focus',
|
|
4663
|
-
//hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]
|
|
4664
|
-
{
|
|
4665
|
-
'border-grey-300 text-blue-500 hover:text-blue-300 focus:border-blue-500 focus:hover:border-blue-300': !props.disabled && !invalid,
|
|
4666
|
-
'border-grey-200 text-blue-300 cursor-not-allowed': props.disabled,
|
|
4667
|
-
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
|
4668
|
-
'border-red-500 text-red-500 hover:text-red-300 hover:border-red-300 focus:border-red-500 focus:hover:border-red-300': invalid && !props.disabled,
|
|
4669
|
-
'self-start': !!label
|
|
4670
|
-
}, props.className);
|
|
4671
|
-
let handleChange;
|
|
4672
|
-
if (onChange) {
|
|
4673
|
-
handleChange = checked => onChange(checked === 'indeterminate' ? false : checked);
|
|
4674
|
-
}
|
|
4675
|
-
let labelledByProps = null;
|
|
4676
|
-
if (label) {
|
|
4677
|
-
labelledByProps = {
|
|
4678
|
-
'aria-labelledby': `${id}-label`,
|
|
4679
|
-
id
|
|
4680
|
-
};
|
|
4681
|
-
}
|
|
4682
|
-
// the enter keyboard shortcut isn't supported by default, but we want it
|
|
4683
|
-
const handleKeyDown = event => {
|
|
4684
|
-
if (event.key === 'Enter') {
|
|
4685
|
-
event.currentTarget.click();
|
|
4686
|
-
}
|
|
4687
|
-
};
|
|
4688
|
-
const element = /*#__PURE__*/React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, labelledByProps, {
|
|
4689
|
-
"data-taco": "checkbox",
|
|
4690
|
-
checked: indeterminate ? 'indeterminate' : checked,
|
|
4691
|
-
className: className,
|
|
4692
|
-
onCheckedChange: handleChange,
|
|
4693
|
-
onKeyDown: handleKeyDown,
|
|
4694
|
-
ref: ref
|
|
4695
|
-
}), /*#__PURE__*/React.createElement(CheckboxPrimitive.Indicator, {
|
|
4696
|
-
className: "flex h-full w-full"
|
|
4697
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4698
|
-
name: indeterminate ? 'line' : 'tick',
|
|
4699
|
-
className: "!h-full !w-full"
|
|
4700
|
-
})));
|
|
4701
|
-
if (label) {
|
|
4702
|
-
const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {
|
|
4703
|
-
'cursor-not-allowed text-grey-300': props.disabled
|
|
4704
|
-
});
|
|
4705
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
4706
|
-
className: labelContainerClassName
|
|
4707
|
-
}, element, /*#__PURE__*/React.createElement("label", {
|
|
4708
|
-
htmlFor: id,
|
|
4709
|
-
id: `${id}-label`
|
|
4710
|
-
}, label));
|
|
4711
|
-
}
|
|
4712
|
-
return element;
|
|
4713
|
-
});
|
|
4714
|
-
Checkbox$1.displayName = 'Checkbox';
|
|
4715
|
-
|
|
4716
|
-
const getInputClasses = props => {
|
|
4717
|
-
const disabled = props.disabled || !!props['aria-disabled'];
|
|
4718
|
-
const readOnly = props.readOnly || !!props['aria-readonly'];
|
|
4719
|
-
const invalid = props.invalid || !!props['aria-invalid'];
|
|
4720
|
-
return cn('peer text-black text-sm border font-normal not-italic no-underline rounded flex items-center leading-6 px-2 relative w-full text-ellipsis transition-colors transition-opacity ease-in min-h-[theme(spacing.8)]', {
|
|
4721
|
-
'bg-white': !props.highlighted && !readOnly,
|
|
4722
|
-
// default
|
|
4723
|
-
'border-grey-300 focus:border-blue-300 focus:yt-focus': !invalid,
|
|
4724
|
-
'hover:shadow-[0_0_0.1rem_theme(colors.grey.500)] active:border-blue-700': !invalid && !disabled,
|
|
4725
|
-
// disabled
|
|
4726
|
-
'border-grey-200 text-opacity-25 cursor-not-allowed placeholder:text-grey-700': disabled,
|
|
4727
|
-
// highlighted
|
|
4728
|
-
'bg-[rgba(255,255,0,0.075)]': props.highlighted && disabled,
|
|
4729
|
-
'bg-[rgba(255,255,0,0.2)]': props.highlighted && !disabled,
|
|
4730
|
-
// invalid
|
|
4731
|
-
'border-red focus:border-red-300 focus:yt-focus-red active:border-red-700': invalid,
|
|
4732
|
-
'hover:shadow-[0_0_0.15rem_theme(colors.red.500)]': invalid && !disabled,
|
|
4733
|
-
// readOnly
|
|
4734
|
-
'cursor-not-allowed text-black bg-grey-200': readOnly
|
|
4735
|
-
});
|
|
4736
|
-
};
|
|
4737
|
-
const getButtonStateClasses = invalid => {
|
|
4738
|
-
if (invalid) {
|
|
4739
|
-
return 'border !border-red-500 group-peer-focus:!border-red-300 focus:yt-focus-red group-focus:group-active:!border-red-300 transition-colors ease-in';
|
|
4740
|
-
}
|
|
4741
|
-
return 'border border-grey-300 focus:!border-blue-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 transition-colors transition-opacity ease-in';
|
|
4742
|
-
};
|
|
4743
|
-
|
|
4744
|
-
const debounce = (fn, delay) => {
|
|
4745
|
-
let timeoutId;
|
|
4746
|
-
return function (...args) {
|
|
4747
|
-
clearTimeout(timeoutId);
|
|
4748
|
-
timeoutId = setTimeout(() => fn.apply(this, args), delay);
|
|
4749
|
-
};
|
|
4750
|
-
};
|
|
4751
|
-
|
|
4752
|
-
const getVisibility = element => Boolean(element && (element.offsetWidth || element.offsetHeight || element.getClientRects().length));
|
|
4753
|
-
const useBoundingClientRectListener = (ref, dependencies) => {
|
|
4754
|
-
const [dimensions, setDimensions] = React.useState(undefined);
|
|
4755
|
-
const isRefElementVisible = getVisibility(ref.current);
|
|
4756
|
-
const [visibility, setVisibility] = React.useState(isRefElementVisible);
|
|
4757
|
-
const resize = () => {
|
|
4758
|
-
if (visibility) {
|
|
4759
|
-
var _ref$current;
|
|
4760
|
-
setDimensions((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect());
|
|
4761
|
-
}
|
|
4762
|
-
};
|
|
4763
|
-
React.useEffect(() => {
|
|
4764
|
-
const timeout = setTimeout(resize, 0);
|
|
4765
|
-
const debouncedResize = debounce(resize, 250);
|
|
4766
|
-
window.addEventListener('resize', debouncedResize);
|
|
4767
|
-
return () => {
|
|
4768
|
-
clearTimeout(timeout);
|
|
4769
|
-
window.removeEventListener('resize', debouncedResize);
|
|
4770
|
-
};
|
|
4771
|
-
}, [ref.current, visibility]);
|
|
4772
|
-
React.useEffect(() => {
|
|
4773
|
-
const newRefElementVisibility = getVisibility(ref.current);
|
|
4774
|
-
if (visibility !== newRefElementVisibility) {
|
|
4775
|
-
// When visibility of an element changes, then the new visibility of the element can only be checked after the
|
|
4776
|
-
// component has rendered. That's why the visibility check is inside the useEffect. This useEffect will cause
|
|
4777
|
-
// the consumer to rerender and that will cause the above hook to recalculate the dimensions
|
|
4778
|
-
setVisibility(newRefElementVisibility);
|
|
4779
|
-
}
|
|
4780
|
-
});
|
|
4781
|
-
React.useEffect(() => {
|
|
4782
|
-
if (dependencies) {
|
|
4783
|
-
var _ref$current2;
|
|
4784
|
-
setDimensions((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.getBoundingClientRect());
|
|
4785
|
-
}
|
|
4786
|
-
}, dependencies);
|
|
4787
|
-
return dimensions;
|
|
4788
|
-
};
|
|
4789
|
-
|
|
4790
|
-
const validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];
|
|
4791
|
-
const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function InputWithoutDeprecatedFeatures(props, ref) {
|
|
4792
|
-
const {
|
|
4793
|
-
highlighted,
|
|
4794
|
-
invalid,
|
|
4795
|
-
onKeyDown,
|
|
4796
|
-
postfix,
|
|
4797
|
-
prefix,
|
|
4798
|
-
type = 'text',
|
|
4799
|
-
...attributes
|
|
4800
|
-
} = props;
|
|
4801
|
-
const internalRef = useMergedRef(ref);
|
|
4802
|
-
let handleKeyDown = onKeyDown;
|
|
4803
|
-
// home and end keys only navigate to the start/end of input value if the input container does not scroll
|
|
4804
|
-
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
|
4805
|
-
// so we manually override it to ensure _our_ desired behaviour remains intact
|
|
4806
|
-
// only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange
|
|
4807
|
-
if (validSetSelectionRangeTypes.includes(type)) {
|
|
4808
|
-
handleKeyDown = event => {
|
|
4809
|
-
if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {
|
|
4810
|
-
event.preventDefault();
|
|
4811
|
-
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
|
4812
|
-
event.currentTarget.setSelectionRange(position, position);
|
|
4813
|
-
}
|
|
4814
|
-
if (typeof onKeyDown === 'function') {
|
|
4815
|
-
onKeyDown(event);
|
|
4816
|
-
}
|
|
4817
|
-
};
|
|
4818
|
-
}
|
|
4819
|
-
const prefixRef = React.useRef(null);
|
|
4820
|
-
const prefixRect = useBoundingClientRectListener(prefixRef);
|
|
4821
|
-
const postfixRef = React.useRef(null);
|
|
4822
|
-
const postfixRect = useBoundingClientRectListener(postfixRef);
|
|
4823
|
-
const className = cn(getInputClasses(props), {
|
|
4824
|
-
'pl-8': !!prefix,
|
|
4825
|
-
'pr-8': !!postfix
|
|
4826
|
-
}, attributes.className);
|
|
4827
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4828
|
-
className: "relative inline-flex w-full",
|
|
4829
|
-
"data-taco": "input-container",
|
|
4830
|
-
style: {
|
|
4831
|
-
opacity: 0.999
|
|
4832
|
-
}
|
|
4833
|
-
}, /*#__PURE__*/React.createElement("input", Object.assign({}, attributes, {
|
|
4834
|
-
className: className,
|
|
4835
|
-
"data-taco": "input",
|
|
4836
|
-
onKeyDown: handleKeyDown,
|
|
4837
|
-
ref: internalRef,
|
|
4838
|
-
style: {
|
|
4839
|
-
paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,
|
|
4840
|
-
paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined
|
|
4841
|
-
},
|
|
4842
|
-
type: type
|
|
4843
|
-
})), prefix ? /*#__PURE__*/React.createElement(Affix, {
|
|
4844
|
-
type: "prefix",
|
|
4845
|
-
children: prefix,
|
|
4846
|
-
disabled: attributes.disabled,
|
|
4847
|
-
ref: prefixRef
|
|
4848
|
-
}) : null, postfix ? /*#__PURE__*/React.createElement(Affix, {
|
|
4849
|
-
type: "postfix",
|
|
4850
|
-
children: postfix,
|
|
4851
|
-
disabled: attributes.disabled,
|
|
4852
|
-
ref: postfixRef
|
|
4853
|
-
}) : null);
|
|
4854
|
-
});
|
|
4855
|
-
const Affix = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Affix(props, ref) {
|
|
4856
|
-
const {
|
|
4857
|
-
children,
|
|
4858
|
-
disabled,
|
|
4859
|
-
type
|
|
4860
|
-
} = props;
|
|
4861
|
-
if (children) {
|
|
4862
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4863
|
-
className: cn('group absolute top-0 flex h-full items-center justify-center px-2',
|
|
4864
|
-
// icon
|
|
4865
|
-
'[&_[data-taco="icon"]]:!h-5 [&_[data-taco="icon"]]:!w-5', {
|
|
4866
|
-
'text-grey-300': disabled,
|
|
4867
|
-
'text-grey-700': !disabled,
|
|
4868
|
-
'left-0 [&>button]:!-ml-2': type === 'prefix',
|
|
4869
|
-
'right-0 [&>button]:!-mr-2': type === 'postfix'
|
|
4870
|
-
}),
|
|
4871
|
-
ref: ref
|
|
4872
|
-
}, children);
|
|
4873
|
-
}
|
|
4874
|
-
return null;
|
|
4875
|
-
}));
|
|
4876
|
-
const Input = /*#__PURE__*/React.forwardRef(function LegacyInput(props, ref) {
|
|
4877
|
-
var _attributes$postfix;
|
|
4878
|
-
const {
|
|
4879
|
-
button,
|
|
4880
|
-
icon,
|
|
4881
|
-
...attributes
|
|
4882
|
-
} = props;
|
|
4883
|
-
let postfix;
|
|
4884
|
-
if (button) {
|
|
4885
|
-
const disabled = button.props.disabled || attributes.disabled;
|
|
4886
|
-
const buttonClassName = cn('items-center focus:z-10 flex justify-center rounded-l-none rounded-r h-full focus:rounded focus:outline-none', getButtonStateClasses(attributes.invalid), button.props.className);
|
|
4887
|
-
postfix = /*#__PURE__*/React.cloneElement(button, {
|
|
4888
|
-
className: buttonClassName,
|
|
4889
|
-
disabled
|
|
4890
|
-
});
|
|
4891
|
-
} else if (icon) {
|
|
4892
|
-
postfix = typeof icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
4893
|
-
name: icon
|
|
4894
|
-
}) : icon;
|
|
4895
|
-
}
|
|
4896
|
-
return /*#__PURE__*/React.createElement(InputWithoutDeprecatedFeatures, Object.assign({}, attributes, {
|
|
4897
|
-
postfix: (_attributes$postfix = attributes.postfix) !== null && _attributes$postfix !== void 0 ? _attributes$postfix : postfix,
|
|
4898
|
-
ref: ref
|
|
4899
|
-
}));
|
|
4900
|
-
});
|
|
4901
|
-
|
|
4902
|
-
const getNextIndexFromKey = (key, length, index, direction = 'vertical') => {
|
|
4903
|
-
const previousKey = direction === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
|
|
4904
|
-
const nextKey = direction === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
|
|
4905
|
-
switch (key) {
|
|
4906
|
-
case previousKey:
|
|
4907
|
-
return index !== undefined ? index - 1 < 0 ? 0 : index - 1 : index;
|
|
4908
|
-
case nextKey:
|
|
4909
|
-
return index !== undefined ? index + 1 >= length ? index : index + 1 : index;
|
|
4910
|
-
case 'Home':
|
|
4911
|
-
return 0;
|
|
4912
|
-
case 'End':
|
|
4913
|
-
return length - 1;
|
|
4914
|
-
default:
|
|
4915
|
-
return;
|
|
4916
|
-
}
|
|
4917
|
-
};
|
|
4918
|
-
const useListKeyboardNavigation = (length = 0, options = {
|
|
4919
|
-
direction: 'vertical'
|
|
4920
|
-
}) => {
|
|
4921
|
-
const [index, setIndex] = React__default.useState(options.initialIndex);
|
|
4922
|
-
const getNextIndex = event => {
|
|
4923
|
-
const nextIndex = getNextIndexFromKey(event.key, length, index, options.direction);
|
|
4924
|
-
if (nextIndex !== undefined) {
|
|
4925
|
-
event.preventDefault();
|
|
4926
|
-
}
|
|
4927
|
-
return nextIndex;
|
|
4928
|
-
};
|
|
4929
|
-
return [index, setIndex, getNextIndex];
|
|
4930
|
-
};
|
|
4931
|
-
|
|
4932
|
-
const scrollToChildElement = (parent, child) => {
|
|
4933
|
-
const clientHeight = parent.clientHeight;
|
|
4934
|
-
if (parent.scrollHeight > clientHeight) {
|
|
4935
|
-
const scrollTop = parent.scrollTop;
|
|
4936
|
-
const scrollBottom = clientHeight + scrollTop;
|
|
4937
|
-
const childBottom = child.offsetTop + child.offsetHeight;
|
|
4938
|
-
if (childBottom > scrollBottom) {
|
|
4939
|
-
parent.scrollTop = childBottom - clientHeight;
|
|
4940
|
-
} else if (child.offsetTop < scrollTop) {
|
|
4941
|
-
parent.scrollTop = child.offsetTop;
|
|
4942
|
-
}
|
|
4943
|
-
}
|
|
4944
|
-
};
|
|
4945
|
-
const useListScrollTo = (internalRef, itemRefs) => {
|
|
4946
|
-
const scrollTo = index => {
|
|
4947
|
-
if (internalRef && internalRef.current) {
|
|
4948
|
-
if (index !== undefined) {
|
|
4949
|
-
const activeRef = itemRefs[index];
|
|
4950
|
-
if (activeRef && activeRef.current) {
|
|
4951
|
-
scrollToChildElement(internalRef.current, activeRef.current);
|
|
4952
|
-
}
|
|
4953
|
-
} else {
|
|
4954
|
-
internalRef.current.scrollTop = 0;
|
|
4955
|
-
}
|
|
4956
|
-
}
|
|
4957
|
-
};
|
|
4958
|
-
return {
|
|
4959
|
-
scrollTo
|
|
4960
|
-
};
|
|
4961
|
-
};
|
|
4962
|
-
|
|
4963
|
-
const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
|
4964
|
-
const {
|
|
4965
|
-
delay = 500,
|
|
4966
|
-
label,
|
|
4967
|
-
...otherProps
|
|
4968
|
-
} = props;
|
|
4969
|
-
const [visible, setVisibility] = React__default.useState(!delay);
|
|
4970
|
-
React__default.useEffect(() => {
|
|
4971
|
-
let timeout;
|
|
4972
|
-
if (delay) {
|
|
4973
|
-
timeout = window.setTimeout(() => setVisibility(true), delay);
|
|
4974
|
-
}
|
|
4975
|
-
return () => {
|
|
4976
|
-
if (timeout) {
|
|
4977
|
-
clearTimeout(timeout);
|
|
4978
|
-
}
|
|
4979
|
-
};
|
|
4980
|
-
}, [delay]);
|
|
4981
|
-
if (!visible) {
|
|
4982
|
-
return null;
|
|
4983
|
-
}
|
|
4984
|
-
const className = cn('inline-flex flex-col relative items-center', otherProps.className);
|
|
4985
|
-
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
|
|
4986
|
-
className: className,
|
|
4987
|
-
"data-taco": "spinner",
|
|
4988
|
-
ref: ref
|
|
4989
|
-
}), /*#__PURE__*/React__default.createElement("svg", {
|
|
4990
|
-
className: "h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]",
|
|
4991
|
-
viewBox: "0 0 100 100",
|
|
4992
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
4993
|
-
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
4994
|
-
cx: "50",
|
|
4995
|
-
cy: "50",
|
|
4996
|
-
r: "45"
|
|
4997
|
-
})), label && /*#__PURE__*/React__default.createElement("span", {
|
|
4998
|
-
className: "mt-4"
|
|
4999
|
-
}, label));
|
|
5000
|
-
});
|
|
5001
|
-
|
|
5002
|
-
const getId = (id, value) => `${id}_${value}`;
|
|
5003
|
-
const getNextEnabledItem = (event, data, index) => {
|
|
5004
|
-
const nextIndex = getNextIndexFromKey(event.key, data.length, index);
|
|
5005
|
-
if (nextIndex) {
|
|
5006
|
-
if (nextIndex === index) {
|
|
5007
|
-
return index;
|
|
5008
|
-
} else if (data[nextIndex] && data[nextIndex].disabled) {
|
|
5009
|
-
return getNextEnabledItem(event, data, nextIndex);
|
|
5010
|
-
}
|
|
5011
|
-
}
|
|
5012
|
-
return nextIndex;
|
|
5013
|
-
};
|
|
5014
|
-
const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(props, ref) {
|
|
5015
|
-
const {
|
|
5016
|
-
data,
|
|
5017
|
-
disabled,
|
|
5018
|
-
highlighted,
|
|
5019
|
-
id,
|
|
5020
|
-
invalid: _,
|
|
5021
|
-
loading,
|
|
5022
|
-
onChange: setCurrentIndex,
|
|
5023
|
-
onClick,
|
|
5024
|
-
onFocus,
|
|
5025
|
-
onKeyDown,
|
|
5026
|
-
readOnly,
|
|
5027
|
-
scrollOnFocus = false,
|
|
5028
|
-
value: currentIndex,
|
|
5029
|
-
multiselect,
|
|
5030
|
-
selectedIndexes = [],
|
|
5031
|
-
allOptionsSelected = false,
|
|
5032
|
-
...otherProps
|
|
5033
|
-
} = props;
|
|
5034
|
-
const listRef = useMergedRef(ref);
|
|
5035
|
-
const itemRefs = React.useMemo(() => data.map(() => /*#__PURE__*/React.createRef()), [data]);
|
|
5036
|
-
const {
|
|
5037
|
-
texts
|
|
5038
|
-
} = useLocalization();
|
|
5039
|
-
const {
|
|
5040
|
-
scrollTo
|
|
5041
|
-
} = useListScrollTo(listRef, itemRefs);
|
|
5042
|
-
React.useEffect(() => {
|
|
5043
|
-
var _itemRefs$currentInde;
|
|
5044
|
-
if (currentIndex && (_itemRefs$currentInde = itemRefs[currentIndex]) !== null && _itemRefs$currentInde !== void 0 && _itemRefs$currentInde.current) {
|
|
5045
|
-
var _itemRefs$currentInde2;
|
|
5046
|
-
(_itemRefs$currentInde2 = itemRefs[currentIndex].current) === null || _itemRefs$currentInde2 === void 0 ? void 0 : _itemRefs$currentInde2.scrollIntoView({
|
|
5047
|
-
block: 'center'
|
|
5048
|
-
});
|
|
5049
|
-
}
|
|
5050
|
-
}, []);
|
|
5051
|
-
React.useEffect(() => {
|
|
5052
|
-
scrollTo(currentIndex);
|
|
5053
|
-
}, [currentIndex]);
|
|
5054
|
-
const handleKeyDown = event => {
|
|
5055
|
-
const nextIndex = getNextEnabledItem(event, data, currentIndex);
|
|
5056
|
-
if (nextIndex !== undefined && nextIndex !== currentIndex) {
|
|
5057
|
-
event.preventDefault();
|
|
5058
|
-
scrollTo(nextIndex);
|
|
5059
|
-
setCurrentIndex(nextIndex);
|
|
5060
|
-
}
|
|
5061
|
-
if (onKeyDown) {
|
|
5062
|
-
event.persist();
|
|
5063
|
-
const index = nextIndex !== undefined ? nextIndex : currentIndex;
|
|
5064
|
-
onKeyDown(event, index);
|
|
5065
|
-
}
|
|
5066
|
-
};
|
|
5067
|
-
const handleClick = index => event => {
|
|
5068
|
-
setCurrentIndex(index);
|
|
5069
|
-
if (onClick) {
|
|
5070
|
-
event.persist();
|
|
5071
|
-
onClick(event, index);
|
|
5072
|
-
}
|
|
4613
|
+
const handleClick = index => event => {
|
|
4614
|
+
setCurrentIndex(index);
|
|
4615
|
+
if (onClick) {
|
|
4616
|
+
event.persist();
|
|
4617
|
+
onClick(event, index);
|
|
4618
|
+
}
|
|
5073
4619
|
};
|
|
5074
4620
|
const handleFocus = event => {
|
|
5075
4621
|
if (scrollOnFocus) {
|
|
@@ -5138,7 +4684,7 @@ const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(pro
|
|
|
5138
4684
|
...optionProps
|
|
5139
4685
|
}) => /*#__PURE__*/React.createElement("li", Object.assign({}, optionProps), icon, /*#__PURE__*/React.createElement("span", {
|
|
5140
4686
|
className: "flex-grow truncate text-left"
|
|
5141
|
-
}, children), multiselect && /*#__PURE__*/React.createElement(Checkbox
|
|
4687
|
+
}, children), multiselect && /*#__PURE__*/React.createElement(Checkbox
|
|
5142
4688
|
// In multiselect variant, this checkbox only acts as visual representation of item being selected,
|
|
5143
4689
|
// so need to be taken out of screen reader scope.
|
|
5144
4690
|
, {
|
|
@@ -5204,7 +4750,7 @@ const getSelectedIndexesFromValue = (data, value) => {
|
|
|
5204
4750
|
if (typeof value !== 'string') return [];
|
|
5205
4751
|
return value.split(',').map(v => data.findIndex(o => String(o.value) === v)).filter(v => v !== -1);
|
|
5206
4752
|
};
|
|
5207
|
-
const findByValue
|
|
4753
|
+
const findByValue = (data, value) => {
|
|
5208
4754
|
return data.find(option => getValue(option.value) === getValue(value));
|
|
5209
4755
|
};
|
|
5210
4756
|
const searchForString = (child, value, strategy = 'includes') => {
|
|
@@ -5415,7 +4961,7 @@ const useCombobox = ({
|
|
|
5415
4961
|
return;
|
|
5416
4962
|
}
|
|
5417
4963
|
if (onChange && event.target.value !== value) {
|
|
5418
|
-
const item = findByValue
|
|
4964
|
+
const item = findByValue(flattenedData, event.target.value);
|
|
5419
4965
|
event.detail = sanitizeItem(item);
|
|
5420
4966
|
const parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
|
5421
4967
|
if (parents !== null && parents.length > 0) {
|
|
@@ -5800,7 +5346,7 @@ const PopoverContext = /*#__PURE__*/React.createContext({
|
|
|
5800
5346
|
props: {},
|
|
5801
5347
|
ref: null
|
|
5802
5348
|
});
|
|
5803
|
-
const Trigger$
|
|
5349
|
+
const Trigger$2 = /*#__PURE__*/React.forwardRef(function PopoverAnchor(props, externalRef) {
|
|
5804
5350
|
var _props$children;
|
|
5805
5351
|
const {
|
|
5806
5352
|
ref: parentRef,
|
|
@@ -5829,7 +5375,7 @@ const RenderPropWrapper = /*#__PURE__*/React.forwardRef(function RenderPropWrapp
|
|
|
5829
5375
|
ref
|
|
5830
5376
|
});
|
|
5831
5377
|
});
|
|
5832
|
-
const Content$
|
|
5378
|
+
const Content$3 = /*#__PURE__*/React.forwardRef(function PopoverContent(props, ref) {
|
|
5833
5379
|
const {
|
|
5834
5380
|
placement: side,
|
|
5835
5381
|
...popoverContentProps
|
|
@@ -5878,10 +5424,10 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(props, ref) {
|
|
|
5878
5424
|
modal: modal,
|
|
5879
5425
|
open: open,
|
|
5880
5426
|
onOpenChange: onChange
|
|
5881
|
-
}, trigger && /*#__PURE__*/React.createElement(Trigger$
|
|
5427
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$2, null, trigger), children));
|
|
5882
5428
|
});
|
|
5883
|
-
Popover.Trigger = Trigger$
|
|
5884
|
-
Popover.Content = Content$
|
|
5429
|
+
Popover.Trigger = Trigger$2;
|
|
5430
|
+
Popover.Content = Content$3;
|
|
5885
5431
|
Popover.Close = Close$1;
|
|
5886
5432
|
Popover.Portal = PopoverPrimitive.Portal;
|
|
5887
5433
|
|
|
@@ -5907,10 +5453,14 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
|
5907
5453
|
"data-taco": "datepicker",
|
|
5908
5454
|
style: style
|
|
5909
5455
|
}, /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
|
|
5910
|
-
button: /*#__PURE__*/React.createElement(
|
|
5456
|
+
button: /*#__PURE__*/React.createElement(Tooltip, {
|
|
5457
|
+
title: texts.datepicker.calendar
|
|
5458
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
5911
5459
|
"aria-label": texts.datepicker.expand,
|
|
5912
5460
|
disabled: input.disabled || input.readOnly,
|
|
5913
5461
|
icon: "calendar",
|
|
5462
|
+
tabIndex: -1,
|
|
5463
|
+
className: " border-grey-300 group-peer-focus:!border-blue-300 group-peer-focus:group-peer-active:!border-blue-700 flex h-full items-center justify-center rounded-l-none rounded-r border transition-colors transition-opacity ease-in focus:z-10 focus:rounded focus:!border-blue-300 focus:outline-none",
|
|
5914
5464
|
popover: props => /*#__PURE__*/React.createElement(Popover, Object.assign({}, props), /*#__PURE__*/React.createElement(Popover.Content, null, ({
|
|
5915
5465
|
close
|
|
5916
5466
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
@@ -5919,8 +5469,7 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
|
5919
5469
|
onChange: (date, event) => {
|
|
5920
5470
|
calendar.onChange(date, event);
|
|
5921
5471
|
close();
|
|
5922
|
-
}
|
|
5923
|
-
tabIndex: -1
|
|
5472
|
+
}
|
|
5924
5473
|
})), shortcuts && /*#__PURE__*/React.createElement("div", {
|
|
5925
5474
|
className: "border-grey-300 flex flex-col border-l"
|
|
5926
5475
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -5944,7 +5493,7 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
|
5944
5493
|
close();
|
|
5945
5494
|
}
|
|
5946
5495
|
}, texts.datepicker.clear)))))
|
|
5947
|
-
})
|
|
5496
|
+
}))
|
|
5948
5497
|
})));
|
|
5949
5498
|
});
|
|
5950
5499
|
Datepicker.displayName = 'Datepicker';
|
|
@@ -5971,7 +5520,7 @@ const useCurrentDialog = () => {
|
|
|
5971
5520
|
return React.useContext(DialogContext);
|
|
5972
5521
|
};
|
|
5973
5522
|
|
|
5974
|
-
const Trigger$
|
|
5523
|
+
const Trigger$3 = /*#__PURE__*/React.forwardRef(function DialogTrigger(props, externalRef) {
|
|
5975
5524
|
const {
|
|
5976
5525
|
ref: parentRef,
|
|
5977
5526
|
props: parentProps
|
|
@@ -6069,7 +5618,7 @@ const RenderPropWrapper$1 = /*#__PURE__*/React.forwardRef(function RenderPropWra
|
|
|
6069
5618
|
...renderProps
|
|
6070
5619
|
});
|
|
6071
5620
|
});
|
|
6072
|
-
const Content$
|
|
5621
|
+
const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, ref) {
|
|
6073
5622
|
const dialog = useCurrentDialog();
|
|
6074
5623
|
const internalRef = useMergedRef(ref);
|
|
6075
5624
|
const {
|
|
@@ -6236,16 +5785,37 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(props, ref) {
|
|
|
6236
5785
|
defaultOpen: defaultOpen,
|
|
6237
5786
|
open: open,
|
|
6238
5787
|
onOpenChange: onChange
|
|
6239
|
-
}, trigger && /*#__PURE__*/React.createElement(Trigger$
|
|
5788
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$3, null, trigger), children));
|
|
6240
5789
|
});
|
|
6241
|
-
Dialog.Trigger = Trigger$
|
|
6242
|
-
Dialog.Content = Content$
|
|
5790
|
+
Dialog.Trigger = Trigger$3;
|
|
5791
|
+
Dialog.Content = Content$4;
|
|
6243
5792
|
Dialog.Title = Title$1;
|
|
6244
5793
|
Dialog.Footer = Footer$1;
|
|
6245
5794
|
Dialog.Extra = Extra;
|
|
6246
5795
|
Dialog.Drawer = DialogDrawer;
|
|
6247
5796
|
Dialog.Close = Close$2;
|
|
6248
5797
|
|
|
5798
|
+
const Group = /*#__PURE__*/React.forwardRef(function Group(props, ref) {
|
|
5799
|
+
const {
|
|
5800
|
+
as: Tag = 'span',
|
|
5801
|
+
orientation = 'horizontal',
|
|
5802
|
+
...otherProps
|
|
5803
|
+
} = props;
|
|
5804
|
+
const className = cn('flex gap-2', {
|
|
5805
|
+
'flex-col ': orientation === 'vertical'
|
|
5806
|
+
}, props.className);
|
|
5807
|
+
return /*#__PURE__*/React.createElement(Tag, Object.assign({}, otherProps, {
|
|
5808
|
+
className: className,
|
|
5809
|
+
"data-taco": "group",
|
|
5810
|
+
ref: ref
|
|
5811
|
+
}));
|
|
5812
|
+
});
|
|
5813
|
+
|
|
5814
|
+
const MenuContext = /*#__PURE__*/React.createContext(undefined);
|
|
5815
|
+
const useCurrentMenu = () => {
|
|
5816
|
+
return React.useContext(MenuContext);
|
|
5817
|
+
};
|
|
5818
|
+
|
|
6249
5819
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6250
5820
|
const DrawerContext = /*#__PURE__*/React.createContext({
|
|
6251
5821
|
closeOnEscape: true,
|
|
@@ -6599,7 +6169,7 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
|
|
|
6599
6169
|
ref: ref
|
|
6600
6170
|
}, content);
|
|
6601
6171
|
});
|
|
6602
|
-
const Content$
|
|
6172
|
+
const Content$5 = /*#__PURE__*/React__default.forwardRef(function Content(props, externalRef) {
|
|
6603
6173
|
const {
|
|
6604
6174
|
children
|
|
6605
6175
|
} = props;
|
|
@@ -6608,7 +6178,7 @@ const Content$6 = /*#__PURE__*/React__default.forwardRef(function Content(props,
|
|
|
6608
6178
|
}), children));
|
|
6609
6179
|
});
|
|
6610
6180
|
|
|
6611
|
-
const Trigger$
|
|
6181
|
+
const Trigger$4 = /*#__PURE__*/React.forwardRef(function DrawerTrigger(props, ref) {
|
|
6612
6182
|
return /*#__PURE__*/React.createElement(DialogPrimitive.Trigger, Object.assign({}, props, {
|
|
6613
6183
|
ref: ref,
|
|
6614
6184
|
asChild: true
|
|
@@ -6696,10 +6266,10 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(props, ref) {
|
|
|
6696
6266
|
modal: variant === 'overlay' ? true : false,
|
|
6697
6267
|
open: open,
|
|
6698
6268
|
onOpenChange: setOpen
|
|
6699
|
-
}, trigger && /*#__PURE__*/React.createElement(Trigger$
|
|
6269
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$4, null, trigger), children));
|
|
6700
6270
|
});
|
|
6701
|
-
Drawer.Trigger = Trigger$
|
|
6702
|
-
Drawer.Content = Content$
|
|
6271
|
+
Drawer.Trigger = Trigger$4;
|
|
6272
|
+
Drawer.Content = Content$5;
|
|
6703
6273
|
Drawer.InnerContent = InnerContent;
|
|
6704
6274
|
Drawer.Title = Title$2;
|
|
6705
6275
|
Drawer.Footer = Footer$2;
|
|
@@ -6777,7 +6347,7 @@ const Title$3 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
|
|
6777
6347
|
ref: ref
|
|
6778
6348
|
}));
|
|
6779
6349
|
});
|
|
6780
|
-
const Content$
|
|
6350
|
+
const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
|
6781
6351
|
const {
|
|
6782
6352
|
placement: side
|
|
6783
6353
|
} = props;
|
|
@@ -6836,7 +6406,7 @@ const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
|
|
|
6836
6406
|
}, anchor && /*#__PURE__*/React.createElement(Anchor, null, anchor), children));
|
|
6837
6407
|
});
|
|
6838
6408
|
Hanger.Anchor = Anchor;
|
|
6839
|
-
Hanger.Content = Content$
|
|
6409
|
+
Hanger.Content = Content$6;
|
|
6840
6410
|
Hanger.Title = Title$3;
|
|
6841
6411
|
|
|
6842
6412
|
const UnstyledArrow$1 = /*#__PURE__*/React.forwardRef(function HoverCardArrow(props, ref) {
|
|
@@ -6861,13 +6431,13 @@ const UnstyledArrow$1 = /*#__PURE__*/React.forwardRef(function HoverCardArrow(pr
|
|
|
6861
6431
|
})));
|
|
6862
6432
|
});
|
|
6863
6433
|
|
|
6864
|
-
const Trigger$
|
|
6434
|
+
const Trigger$5 = /*#__PURE__*/React.forwardRef(function HoverCardTrigger(props, ref) {
|
|
6865
6435
|
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Trigger, Object.assign({}, props, {
|
|
6866
6436
|
asChild: true,
|
|
6867
6437
|
ref: ref
|
|
6868
6438
|
}));
|
|
6869
6439
|
});
|
|
6870
|
-
const Content$
|
|
6440
|
+
const Content$7 = /*#__PURE__*/React.forwardRef(function HoverCardContent(props, ref) {
|
|
6871
6441
|
const {
|
|
6872
6442
|
placement: side
|
|
6873
6443
|
} = props;
|
|
@@ -6887,62 +6457,8 @@ const HoverCard = props => {
|
|
|
6887
6457
|
openDelay: 300
|
|
6888
6458
|
}));
|
|
6889
6459
|
};
|
|
6890
|
-
HoverCard.Trigger = Trigger$
|
|
6891
|
-
HoverCard.Content = Content$
|
|
6892
|
-
|
|
6893
|
-
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
|
6894
|
-
onSearch,
|
|
6895
|
-
...props
|
|
6896
|
-
}, ref) {
|
|
6897
|
-
const internalRef = useMergedRef(ref);
|
|
6898
|
-
const {
|
|
6899
|
-
texts
|
|
6900
|
-
} = useLocalization();
|
|
6901
|
-
const handleClick = () => {
|
|
6902
|
-
var _internalRef$current$, _internalRef$current;
|
|
6903
|
-
onSearch === null || onSearch === void 0 ? void 0 : onSearch((_internalRef$current$ = (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.value) !== null && _internalRef$current$ !== void 0 ? _internalRef$current$ : '');
|
|
6904
|
-
};
|
|
6905
|
-
const handleCancelClick = () => {
|
|
6906
|
-
setInputValueByRef(internalRef.current, '');
|
|
6907
|
-
};
|
|
6908
|
-
const handleKeyDown = event => {
|
|
6909
|
-
var _props$onKeyDown;
|
|
6910
|
-
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
|
6911
|
-
if (event.isDefaultPrevented()) {
|
|
6912
|
-
return;
|
|
6913
|
-
}
|
|
6914
|
-
if (event.key === 'Enter') {
|
|
6915
|
-
event.preventDefault();
|
|
6916
|
-
handleClick();
|
|
6917
|
-
return;
|
|
6918
|
-
}
|
|
6919
|
-
};
|
|
6920
|
-
return /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
6921
|
-
"aria-label": texts.searchInput.placeholder,
|
|
6922
|
-
placeholder: texts.searchInput.placeholder
|
|
6923
|
-
}, props, {
|
|
6924
|
-
onKeyDown: handleKeyDown,
|
|
6925
|
-
postfix: /*#__PURE__*/React.createElement(React.Fragment, null, props.disabled || props.readOnly || !props.value ? null : /*#__PURE__*/React.createElement(IconButton, {
|
|
6926
|
-
"aria-hidden": true,
|
|
6927
|
-
className: "group-peer-focus:visible group-peer-hover:visible !text-grey-700 invisible mr-0.5 !h-5 !min-h-[theme(spacing.4)] !w-5 !min-w-[theme(spacing.4)] text-xs hover:visible group-hover:visible",
|
|
6928
|
-
icon: "close",
|
|
6929
|
-
onClick: handleCancelClick,
|
|
6930
|
-
rounded: true,
|
|
6931
|
-
tabIndex: -1,
|
|
6932
|
-
tooltip: texts.searchInput.clear
|
|
6933
|
-
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
6934
|
-
"aria-label": texts.searchInput.button,
|
|
6935
|
-
icon: "search",
|
|
6936
|
-
className: "group-peer-focus:!border-transparent group-peer-focus:group-peer-active:!border-transparent -mr-2 !border-transparent !bg-transparent focus:!border-transparent",
|
|
6937
|
-
disabled: props.disabled || props.readOnly,
|
|
6938
|
-
onClick: handleClick,
|
|
6939
|
-
tabIndex: -1,
|
|
6940
|
-
tooltip: texts.searchInput.button
|
|
6941
|
-
})),
|
|
6942
|
-
ref: internalRef,
|
|
6943
|
-
type: "search"
|
|
6944
|
-
}));
|
|
6945
|
-
});
|
|
6460
|
+
HoverCard.Trigger = Trigger$5;
|
|
6461
|
+
HoverCard.Content = Content$7;
|
|
6946
6462
|
|
|
6947
6463
|
function useTimer(duration = 0, callback) {
|
|
6948
6464
|
const timer = React.useRef();
|
|
@@ -7088,7 +6604,7 @@ const useListbox = ({
|
|
|
7088
6604
|
event.persist();
|
|
7089
6605
|
if (onChange) {
|
|
7090
6606
|
var _item$path$split, _item$path;
|
|
7091
|
-
const item = findByValue
|
|
6607
|
+
const item = findByValue(data, event.target.value);
|
|
7092
6608
|
event.detail = sanitizeItem(item);
|
|
7093
6609
|
const indexes = (_item$path$split = item === null || item === void 0 ? void 0 : (_item$path = item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
|
|
7094
6610
|
if (indexes.length > 1) {
|
|
@@ -7259,7 +6775,7 @@ const useMultiListbox = ({
|
|
|
7259
6775
|
const detail = [];
|
|
7260
6776
|
const valuesArray = event.target.value.split(',');
|
|
7261
6777
|
valuesArray.forEach(val => {
|
|
7262
|
-
const item = findByValue
|
|
6778
|
+
const item = findByValue(data, val);
|
|
7263
6779
|
if (item) {
|
|
7264
6780
|
detail.push(item);
|
|
7265
6781
|
}
|
|
@@ -7299,52 +6815,427 @@ const useMultiListbox = ({
|
|
|
7299
6815
|
};
|
|
7300
6816
|
};
|
|
7301
6817
|
|
|
7302
|
-
const Listbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
|
6818
|
+
const Listbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
|
6819
|
+
const {
|
|
6820
|
+
className: externalClassName,
|
|
6821
|
+
...otherProps
|
|
6822
|
+
} = props;
|
|
6823
|
+
const {
|
|
6824
|
+
list,
|
|
6825
|
+
input
|
|
6826
|
+
} = useListbox(otherProps, ref);
|
|
6827
|
+
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
|
6828
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
6829
|
+
"data-taco": "listbox",
|
|
6830
|
+
className: className
|
|
6831
|
+
}, /*#__PURE__*/React.createElement(ScrollableList, Object.assign({}, list, {
|
|
6832
|
+
style: {
|
|
6833
|
+
...list.style,
|
|
6834
|
+
maxHeight: 'calc(12rem + 2px)' /* (6 * option height) + listbox border */
|
|
6835
|
+
}
|
|
6836
|
+
})), /*#__PURE__*/React.createElement("input", Object.assign({}, input, {
|
|
6837
|
+
className: "hidden",
|
|
6838
|
+
type: "text"
|
|
6839
|
+
})));
|
|
6840
|
+
});
|
|
6841
|
+
const MultiListbox = /*#__PURE__*/React.forwardRef(function Listbox(props, ref) {
|
|
6842
|
+
const {
|
|
6843
|
+
className: externalClassName,
|
|
6844
|
+
...otherProps
|
|
6845
|
+
} = props;
|
|
6846
|
+
const {
|
|
6847
|
+
list,
|
|
6848
|
+
input
|
|
6849
|
+
} = useMultiListbox(otherProps, ref);
|
|
6850
|
+
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
|
6851
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
6852
|
+
"data-taco": "listbox",
|
|
6853
|
+
className: className
|
|
6854
|
+
}, /*#__PURE__*/React.createElement(ScrollableList, Object.assign({}, list, {
|
|
6855
|
+
style: {
|
|
6856
|
+
...list.style,
|
|
6857
|
+
maxHeight: 'calc(12rem + 2px + 2px)' /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
|
|
6858
|
+
}
|
|
6859
|
+
})), /*#__PURE__*/React.createElement("input", Object.assign({}, input, {
|
|
6860
|
+
className: "hidden",
|
|
6861
|
+
type: "text"
|
|
6862
|
+
})));
|
|
6863
|
+
});
|
|
6864
|
+
|
|
6865
|
+
const Content$8 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref) {
|
|
6866
|
+
const internalRef = useMergedRef(ref);
|
|
6867
|
+
const menu = useCurrentMenu();
|
|
6868
|
+
const {
|
|
6869
|
+
align = 'start',
|
|
6870
|
+
children,
|
|
6871
|
+
placement: side,
|
|
6872
|
+
...otherProps
|
|
6873
|
+
} = props;
|
|
6874
|
+
const className = cn('border border-transparent rounded block outline-none p-1 yt-shadow wcag-white', props.className);
|
|
6875
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Portal, null, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Content, Object.assign({}, otherProps, {
|
|
6876
|
+
align: align,
|
|
6877
|
+
className: className,
|
|
6878
|
+
"data-taco": "menu",
|
|
6879
|
+
side: side,
|
|
6880
|
+
sideOffset: 3,
|
|
6881
|
+
style: {
|
|
6882
|
+
minWidth: menu === null || menu === void 0 ? void 0 : menu.minWidth
|
|
6883
|
+
},
|
|
6884
|
+
ref: internalRef
|
|
6885
|
+
}), children));
|
|
6886
|
+
});
|
|
6887
|
+
|
|
6888
|
+
const Icon$1 = ({
|
|
6889
|
+
name
|
|
6890
|
+
}) => /*#__PURE__*/React.createElement("span", {
|
|
6891
|
+
className: "absolute left-0 ml-1"
|
|
6892
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
6893
|
+
className: "-ml-px -mt-px !h-5 !w-5",
|
|
6894
|
+
name: name
|
|
6895
|
+
}));
|
|
6896
|
+
const useItemStyling = ({
|
|
6897
|
+
disabled,
|
|
6898
|
+
indented,
|
|
6899
|
+
className
|
|
6900
|
+
}) => {
|
|
6901
|
+
const menu = useCurrentMenu();
|
|
6902
|
+
React.useEffect(() => {
|
|
6903
|
+
if (indented && !(menu !== null && menu !== void 0 && menu.indented)) {
|
|
6904
|
+
menu === null || menu === void 0 ? void 0 : menu.registerIndentation();
|
|
6905
|
+
}
|
|
6906
|
+
}, [indented]);
|
|
6907
|
+
return cn('flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group', {
|
|
6908
|
+
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
|
6909
|
+
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented),
|
|
6910
|
+
'cursor-pointer text-black hover:wcag-grey-200 data-[highlighted]:wcag-grey-200': !disabled,
|
|
6911
|
+
'cursor-not-allowed hover:bg-white text-grey-300': disabled
|
|
6912
|
+
}, className);
|
|
6913
|
+
};
|
|
6914
|
+
const Shortcut = props => {
|
|
6915
|
+
return /*#__PURE__*/React.createElement("span", Object.assign({}, props, {
|
|
6916
|
+
className: "text-grey-700 ml-auto pl-3"
|
|
6917
|
+
}));
|
|
6918
|
+
};
|
|
6919
|
+
const Item$1 = /*#__PURE__*/React.forwardRef(function MenuItem(props, ref) {
|
|
6920
|
+
var _props$disabled;
|
|
6921
|
+
const {
|
|
6922
|
+
dialog,
|
|
6923
|
+
icon,
|
|
6924
|
+
onClick,
|
|
6925
|
+
shortcut,
|
|
6926
|
+
...otherProps
|
|
6927
|
+
} = props;
|
|
6928
|
+
const menu = useCurrentMenu();
|
|
6929
|
+
const className = useItemStyling({
|
|
6930
|
+
disabled: props.disabled,
|
|
6931
|
+
indented: !!icon,
|
|
6932
|
+
className: props.className
|
|
6933
|
+
});
|
|
6934
|
+
const disabled = (_props$disabled = props.disabled) !== null && _props$disabled !== void 0 ? _props$disabled : props['aria-disabled'];
|
|
6935
|
+
let handleClick;
|
|
6936
|
+
// radix has a bug that does not disable clicks when disabled is set on items
|
|
6937
|
+
if (disabled) {
|
|
6938
|
+
handleClick = event => {
|
|
6939
|
+
event.preventDefault();
|
|
6940
|
+
event.stopPropagation();
|
|
6941
|
+
};
|
|
6942
|
+
}
|
|
6943
|
+
const handleSelect = event => {
|
|
6944
|
+
if (onClick) {
|
|
6945
|
+
onClick(event);
|
|
6946
|
+
}
|
|
6947
|
+
if (props['aria-haspopup'] || typeof dialog === 'function') {
|
|
6948
|
+
event.preventDefault();
|
|
6949
|
+
}
|
|
6950
|
+
};
|
|
6951
|
+
let button = /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Item, Object.assign({}, otherProps, {
|
|
6952
|
+
className: className,
|
|
6953
|
+
onClick: handleClick,
|
|
6954
|
+
onSelect: handleSelect,
|
|
6955
|
+
ref: ref
|
|
6956
|
+
}), icon && /*#__PURE__*/React.createElement(Icon$1, {
|
|
6957
|
+
name: icon
|
|
6958
|
+
}), props.children, shortcut && /*#__PURE__*/React.createElement(Shortcut, null, shortcut));
|
|
6959
|
+
if (typeof dialog === 'function') {
|
|
6960
|
+
button = dialog({
|
|
6961
|
+
trigger: button,
|
|
6962
|
+
onClose: menu === null || menu === void 0 ? void 0 : menu.close
|
|
6963
|
+
});
|
|
6964
|
+
}
|
|
6965
|
+
return button;
|
|
6966
|
+
});
|
|
6967
|
+
|
|
6968
|
+
const Link = /*#__PURE__*/React.forwardRef(function MenuLink(props, ref) {
|
|
6969
|
+
const {
|
|
6970
|
+
href,
|
|
6971
|
+
icon,
|
|
6972
|
+
onClick,
|
|
6973
|
+
...otherProps
|
|
6974
|
+
} = props;
|
|
6975
|
+
const menu = useCurrentMenu();
|
|
6976
|
+
const className = useItemStyling({
|
|
6977
|
+
disabled: props.disabled,
|
|
6978
|
+
indented: !!icon,
|
|
6979
|
+
className: props.className
|
|
6980
|
+
});
|
|
6981
|
+
const handleClick = event => {
|
|
6982
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
6983
|
+
menu === null || menu === void 0 ? void 0 : menu.close();
|
|
6984
|
+
};
|
|
6985
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Item, Object.assign({}, otherProps, {
|
|
6986
|
+
asChild: true,
|
|
6987
|
+
className: className,
|
|
6988
|
+
ref: ref,
|
|
6989
|
+
onClick: handleClick
|
|
6990
|
+
}), /*#__PURE__*/React.createElement("a", {
|
|
6991
|
+
href: href,
|
|
6992
|
+
target: "_blank"
|
|
6993
|
+
}, icon && /*#__PURE__*/React.createElement(Icon$1, {
|
|
6994
|
+
name: icon
|
|
6995
|
+
}), props.children));
|
|
6996
|
+
});
|
|
6997
|
+
|
|
6998
|
+
const Trigger$6 = /*#__PURE__*/React.forwardRef(function MenuTrigger(props, ref) {
|
|
6999
|
+
const menu = useCurrentMenu();
|
|
7000
|
+
const internalRef = useMergedRef(ref);
|
|
7001
|
+
React.useEffect(() => {
|
|
7002
|
+
if (internalRef.current) {
|
|
7003
|
+
menu === null || menu === void 0 ? void 0 : menu.setMinWidth(internalRef.current.getBoundingClientRect().width);
|
|
7004
|
+
}
|
|
7005
|
+
}, [internalRef]);
|
|
7006
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Trigger, Object.assign({}, props, {
|
|
7007
|
+
asChild: true,
|
|
7008
|
+
ref: internalRef
|
|
7009
|
+
}));
|
|
7010
|
+
});
|
|
7011
|
+
|
|
7012
|
+
const Checkbox$1 = /*#__PURE__*/React.forwardRef(function MenuCheckboxItem(props, ref) {
|
|
7303
7013
|
const {
|
|
7304
|
-
|
|
7014
|
+
checked,
|
|
7015
|
+
children,
|
|
7016
|
+
onChange,
|
|
7305
7017
|
...otherProps
|
|
7306
7018
|
} = props;
|
|
7019
|
+
const className = useItemStyling({
|
|
7020
|
+
disabled: props.disabled,
|
|
7021
|
+
indented: true,
|
|
7022
|
+
className: props.className
|
|
7023
|
+
});
|
|
7024
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.CheckboxItem, Object.assign({}, otherProps, {
|
|
7025
|
+
checked: checked,
|
|
7026
|
+
className: className,
|
|
7027
|
+
onCheckedChange: onChange,
|
|
7028
|
+
ref: ref
|
|
7029
|
+
}), /*#__PURE__*/React.createElement(DropdownMenuPrimitive.ItemIndicator, {
|
|
7030
|
+
className: "absolute left-0 ml-1.5"
|
|
7031
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
7032
|
+
name: "tick",
|
|
7033
|
+
className: "-ml-px !h-4 !w-4"
|
|
7034
|
+
})), children);
|
|
7035
|
+
});
|
|
7036
|
+
|
|
7037
|
+
const getRadioGroupItemValueAsString = value => String(value !== null && value !== void 0 ? value : '');
|
|
7038
|
+
const findByValue$1 = (values, valueAsString) => values.find(value => getRadioGroupItemValueAsString(value) === valueAsString);
|
|
7039
|
+
const RadioGroupContext = /*#__PURE__*/React.createContext({
|
|
7040
|
+
disabled: false,
|
|
7041
|
+
invalid: false
|
|
7042
|
+
});
|
|
7043
|
+
const RadioGroupItem = /*#__PURE__*/React.forwardRef(function RadioGroupItem(props, ref) {
|
|
7044
|
+
const context = React.useContext(RadioGroupContext);
|
|
7307
7045
|
const {
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7046
|
+
children,
|
|
7047
|
+
value,
|
|
7048
|
+
...otherProps
|
|
7049
|
+
} = props;
|
|
7050
|
+
const isDisabled = context.disabled || props.disabled;
|
|
7051
|
+
const className = cn('flex flex-shrink-0 self-start items-center justify-center h-4 w-4 mt-[0.2rem] rounded-full bg-white border-2', {
|
|
7052
|
+
'border-grey-300 hover:border-4 focus:yt-focus aria-checked:bg-blue-500 aria-checked:border-blue-500 hover:aria-checked:border-blue-300': !isDisabled && !context.invalid,
|
|
7053
|
+
'border-grey-200 cursor-not-allowed aria-checked:bg-blue-300 aria-checked:border-blue-300 ': isDisabled,
|
|
7054
|
+
'border-red-500 hover:border-4 text-red-500 focus:border-red-500 focus:yt-focus-red aria-checked:bg-red-500 aria-checked:border-red': context.invalid && !isDisabled
|
|
7055
|
+
});
|
|
7056
|
+
const labelClassName = cn('flex items-center gap-2', {
|
|
7057
|
+
'cursor-pointer': !isDisabled,
|
|
7058
|
+
'cursor-not-allowed text-grey-300': isDisabled
|
|
7059
|
+
}, props.className);
|
|
7060
|
+
return /*#__PURE__*/React.createElement("label", {
|
|
7061
|
+
className: labelClassName
|
|
7062
|
+
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Item, Object.assign({}, otherProps, {
|
|
7063
|
+
className: className,
|
|
7064
|
+
disabled: isDisabled,
|
|
7065
|
+
ref: ref,
|
|
7066
|
+
value: getRadioGroupItemValueAsString(value)
|
|
7067
|
+
}), /*#__PURE__*/React.createElement(RadioGroupPrimitive.Indicator, {
|
|
7068
|
+
className: "h-2 w-2 rounded-full bg-white"
|
|
7069
|
+
})), children);
|
|
7070
|
+
});
|
|
7071
|
+
const useRadioGroup = props => {
|
|
7072
|
+
const {
|
|
7073
|
+
children,
|
|
7074
|
+
defaultValue,
|
|
7075
|
+
disabled,
|
|
7076
|
+
invalid,
|
|
7077
|
+
onChange,
|
|
7078
|
+
orientation = 'vertical',
|
|
7079
|
+
value,
|
|
7080
|
+
...otherProps
|
|
7081
|
+
} = props;
|
|
7082
|
+
const values = React.useMemo(() => {
|
|
7083
|
+
const radioGroupItemValues = [];
|
|
7084
|
+
React.Children.forEach(children, child => {
|
|
7085
|
+
if ( /*#__PURE__*/React.isValidElement(child)) {
|
|
7086
|
+
radioGroupItemValues.push(child.props.value);
|
|
7087
|
+
}
|
|
7088
|
+
});
|
|
7089
|
+
return radioGroupItemValues;
|
|
7090
|
+
}, [children]);
|
|
7091
|
+
const context = React.useMemo(() => ({
|
|
7092
|
+
disabled: disabled !== null && disabled !== void 0 ? disabled : false,
|
|
7093
|
+
invalid: invalid !== null && invalid !== void 0 ? invalid : false
|
|
7094
|
+
}), [disabled, invalid]);
|
|
7095
|
+
let valueProps;
|
|
7096
|
+
if (onChange !== undefined) {
|
|
7097
|
+
const handleChange = value => onChange(findByValue$1(values, value));
|
|
7098
|
+
valueProps = {
|
|
7099
|
+
onValueChange: handleChange,
|
|
7100
|
+
value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined
|
|
7101
|
+
};
|
|
7102
|
+
} else {
|
|
7103
|
+
valueProps = {
|
|
7104
|
+
defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined
|
|
7105
|
+
};
|
|
7106
|
+
}
|
|
7107
|
+
return {
|
|
7108
|
+
context,
|
|
7109
|
+
props: {
|
|
7110
|
+
...otherProps,
|
|
7111
|
+
...valueProps,
|
|
7112
|
+
children,
|
|
7113
|
+
disabled,
|
|
7114
|
+
orientation
|
|
7319
7115
|
}
|
|
7320
|
-
}
|
|
7321
|
-
|
|
7322
|
-
|
|
7116
|
+
};
|
|
7117
|
+
};
|
|
7118
|
+
const RadioGroup = /*#__PURE__*/React.forwardRef(function RadioGroup(props, ref) {
|
|
7119
|
+
const {
|
|
7120
|
+
context,
|
|
7121
|
+
props: otherProps
|
|
7122
|
+
} = useRadioGroup(props);
|
|
7123
|
+
const className = cn('flex items-start gap-y-2', {
|
|
7124
|
+
'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',
|
|
7125
|
+
'flex-col': otherProps.orientation === 'vertical'
|
|
7126
|
+
}, otherProps.className);
|
|
7127
|
+
return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, {
|
|
7128
|
+
value: context
|
|
7129
|
+
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Root, Object.assign({}, otherProps, {
|
|
7130
|
+
className: className,
|
|
7131
|
+
"data-taco": "radio-group",
|
|
7132
|
+
ref: ref
|
|
7323
7133
|
})));
|
|
7324
7134
|
});
|
|
7325
|
-
|
|
7135
|
+
RadioGroup.Item = RadioGroupItem;
|
|
7136
|
+
|
|
7137
|
+
const RadioItem = props => {
|
|
7138
|
+
const context = React.useContext(MenuRadioGroupContext);
|
|
7326
7139
|
const {
|
|
7327
|
-
|
|
7140
|
+
children,
|
|
7141
|
+
value,
|
|
7328
7142
|
...otherProps
|
|
7329
7143
|
} = props;
|
|
7144
|
+
const disabled = context.disabled || props.disabled;
|
|
7145
|
+
const className = useItemStyling({
|
|
7146
|
+
disabled: disabled,
|
|
7147
|
+
indented: true,
|
|
7148
|
+
className: props.className
|
|
7149
|
+
});
|
|
7150
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.RadioItem, Object.assign({}, otherProps, {
|
|
7151
|
+
className: className,
|
|
7152
|
+
disabled: disabled,
|
|
7153
|
+
value: getRadioGroupItemValueAsString(value)
|
|
7154
|
+
}), /*#__PURE__*/React.createElement(DropdownMenuPrimitive.ItemIndicator, {
|
|
7155
|
+
className: "absolute left-0 ml-1.5"
|
|
7156
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
7157
|
+
className: "ml-1 flex h-1.5 w-1.5 rounded-full bg-current "
|
|
7158
|
+
})), children);
|
|
7159
|
+
};
|
|
7160
|
+
const MenuRadioGroupContext = /*#__PURE__*/React.createContext({
|
|
7161
|
+
disabled: false
|
|
7162
|
+
});
|
|
7163
|
+
const RadioGroup$1 = /*#__PURE__*/React.forwardRef(function MenuRadioItem(props, ref) {
|
|
7330
7164
|
const {
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
} =
|
|
7334
|
-
const className = cn('
|
|
7335
|
-
return /*#__PURE__*/React.createElement(
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
...list.style,
|
|
7341
|
-
maxHeight: 'calc(12rem + 2px + 2px)' /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
|
|
7342
|
-
}
|
|
7343
|
-
})), /*#__PURE__*/React.createElement("input", Object.assign({}, input, {
|
|
7344
|
-
className: "hidden",
|
|
7345
|
-
type: "text"
|
|
7165
|
+
context,
|
|
7166
|
+
props: otherProps
|
|
7167
|
+
} = useRadioGroup(props);
|
|
7168
|
+
const className = cn('flex flex-col', props.className);
|
|
7169
|
+
return /*#__PURE__*/React.createElement(MenuRadioGroupContext.Provider, {
|
|
7170
|
+
value: context
|
|
7171
|
+
}, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.RadioGroup, Object.assign({}, otherProps, {
|
|
7172
|
+
className: className,
|
|
7173
|
+
ref: ref
|
|
7346
7174
|
})));
|
|
7347
7175
|
});
|
|
7176
|
+
RadioGroup$1.Item = RadioItem;
|
|
7177
|
+
|
|
7178
|
+
const Separator = () => {
|
|
7179
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Separator, {
|
|
7180
|
+
className: "bg-grey-300 my-1 h-px"
|
|
7181
|
+
});
|
|
7182
|
+
};
|
|
7183
|
+
|
|
7184
|
+
const Header = /*#__PURE__*/React.forwardRef(function MenuHeader(props, ref) {
|
|
7185
|
+
const menu = useCurrentMenu();
|
|
7186
|
+
const className = cn('flex items-center justify-start h-7 pr-1.5 text-xs text-grey-700', {
|
|
7187
|
+
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
|
7188
|
+
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented)
|
|
7189
|
+
}, props.className);
|
|
7190
|
+
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Label, Object.assign({}, props, {
|
|
7191
|
+
className: className,
|
|
7192
|
+
ref: ref
|
|
7193
|
+
}));
|
|
7194
|
+
});
|
|
7195
|
+
|
|
7196
|
+
const Menu$1 = /*#__PURE__*/React.forwardRef(function Menu(externalProps, ref) {
|
|
7197
|
+
const {
|
|
7198
|
+
children,
|
|
7199
|
+
defaultOpen: defaultProp,
|
|
7200
|
+
onChange,
|
|
7201
|
+
open: prop,
|
|
7202
|
+
trigger,
|
|
7203
|
+
...props
|
|
7204
|
+
} = externalProps;
|
|
7205
|
+
const [indented, setIndented] = React.useState(false);
|
|
7206
|
+
const [minWidth, setMinWidth] = React.useState(undefined);
|
|
7207
|
+
const [open, setOpen] = reactUseControllableState.useControllableState({
|
|
7208
|
+
// uncontrolled
|
|
7209
|
+
defaultProp,
|
|
7210
|
+
// controlled
|
|
7211
|
+
onChange,
|
|
7212
|
+
prop
|
|
7213
|
+
});
|
|
7214
|
+
const context = React.useMemo(() => ({
|
|
7215
|
+
indented,
|
|
7216
|
+
registerIndentation: () => setIndented(true),
|
|
7217
|
+
minWidth,
|
|
7218
|
+
setMinWidth: width => setMinWidth(width),
|
|
7219
|
+
close: () => setOpen(false)
|
|
7220
|
+
}), [indented, minWidth]);
|
|
7221
|
+
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
7222
|
+
value: context
|
|
7223
|
+
}, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Root, Object.assign({}, props, {
|
|
7224
|
+
modal: false,
|
|
7225
|
+
open: open,
|
|
7226
|
+
onOpenChange: setOpen
|
|
7227
|
+
}), trigger && /*#__PURE__*/React.createElement(Trigger$6, {
|
|
7228
|
+
ref: ref
|
|
7229
|
+
}, trigger), children));
|
|
7230
|
+
});
|
|
7231
|
+
Menu$1.Trigger = Trigger$6;
|
|
7232
|
+
Menu$1.Content = Content$8;
|
|
7233
|
+
Menu$1.Item = Item$1;
|
|
7234
|
+
Menu$1.Link = Link;
|
|
7235
|
+
Menu$1.Checkbox = Checkbox$1;
|
|
7236
|
+
Menu$1.Separator = Separator;
|
|
7237
|
+
Menu$1.Header = Header;
|
|
7238
|
+
Menu$1.RadioGroup = RadioGroup$1;
|
|
7348
7239
|
|
|
7349
7240
|
const TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
|
|
7350
7241
|
return /*#__PURE__*/React__default.createElement("a", Object.assign({}, props, {
|
|
@@ -7554,6 +7445,116 @@ Navigation.Menu = Menu$2;
|
|
|
7554
7445
|
Navigation.Item = Item$2;
|
|
7555
7446
|
Navigation.Panel = Panel;
|
|
7556
7447
|
|
|
7448
|
+
const useIntersectionObserver = (ref, offset) => {
|
|
7449
|
+
const [intersectedIndexes, setIntersectedIndexes] = React__default.useState({});
|
|
7450
|
+
const handleIntersection = (entries, observer) => {
|
|
7451
|
+
if (observer.root) {
|
|
7452
|
+
const children = Array.from(observer.root.children);
|
|
7453
|
+
const map = {};
|
|
7454
|
+
entries.forEach(entry => {
|
|
7455
|
+
// entries only contains the items being intersected not all children of the ref
|
|
7456
|
+
// so use root and the the entry being intersected to find its real index
|
|
7457
|
+
// on first mount this is different - all children are present
|
|
7458
|
+
map[children.indexOf(entry.target)] = entry.isIntersecting;
|
|
7459
|
+
});
|
|
7460
|
+
setIntersectedIndexes(prev => ({
|
|
7461
|
+
...prev,
|
|
7462
|
+
...map
|
|
7463
|
+
}));
|
|
7464
|
+
}
|
|
7465
|
+
};
|
|
7466
|
+
const intersectedChildIndex = React__default.useMemo(() => {
|
|
7467
|
+
const index = Object.values(intersectedIndexes).indexOf(false);
|
|
7468
|
+
return index > -1 ? index : undefined;
|
|
7469
|
+
}, [intersectedIndexes]);
|
|
7470
|
+
const hasRootMargin = intersectedChildIndex !== undefined && offset;
|
|
7471
|
+
React__default.useEffect(() => {
|
|
7472
|
+
const observer = new IntersectionObserver(handleIntersection, {
|
|
7473
|
+
root: ref.current,
|
|
7474
|
+
// offset the button, but only after the first item has been intersected
|
|
7475
|
+
rootMargin: hasRootMargin ? `0px -${offset}px 0px 0px` : undefined,
|
|
7476
|
+
threshold: 1
|
|
7477
|
+
});
|
|
7478
|
+
if (observer.root) {
|
|
7479
|
+
Array.from(observer.root.children).forEach(item => {
|
|
7480
|
+
if (!item.hasAttribute('data-observer-ignore')) {
|
|
7481
|
+
observer.observe(item);
|
|
7482
|
+
}
|
|
7483
|
+
});
|
|
7484
|
+
}
|
|
7485
|
+
return () => {
|
|
7486
|
+
observer.disconnect();
|
|
7487
|
+
};
|
|
7488
|
+
}, [hasRootMargin]);
|
|
7489
|
+
return intersectedChildIndex;
|
|
7490
|
+
};
|
|
7491
|
+
|
|
7492
|
+
const sanitizeButtonPropsForMenuItem = (button, index) => {
|
|
7493
|
+
const href = button.props.to || button.props.href;
|
|
7494
|
+
const Tag = href ? Menu$1.Link : Menu$1.Item;
|
|
7495
|
+
// Removing className prop so that custom styling cannot be applied on Menu.Link
|
|
7496
|
+
const {
|
|
7497
|
+
as,
|
|
7498
|
+
className: _,
|
|
7499
|
+
appearance: _1,
|
|
7500
|
+
drawer: _2,
|
|
7501
|
+
fluid: _3,
|
|
7502
|
+
hanger: _4,
|
|
7503
|
+
menu: _5,
|
|
7504
|
+
popover: _6,
|
|
7505
|
+
tooltip: _7,
|
|
7506
|
+
...attributes
|
|
7507
|
+
} = button.props;
|
|
7508
|
+
const props = {
|
|
7509
|
+
...attributes,
|
|
7510
|
+
key: index,
|
|
7511
|
+
target: href ? href.startsWith('http') ? '_blank' : '_self' : undefined
|
|
7512
|
+
};
|
|
7513
|
+
if (as) {
|
|
7514
|
+
return /*#__PURE__*/React__default.cloneElement(button, {
|
|
7515
|
+
as: Tag,
|
|
7516
|
+
...props
|
|
7517
|
+
});
|
|
7518
|
+
}
|
|
7519
|
+
return /*#__PURE__*/React__default.createElement(Tag, Object.assign({}, props));
|
|
7520
|
+
};
|
|
7521
|
+
const DEFAULT_OFFSET = 32 + 8;
|
|
7522
|
+
const OverflowGroup = /*#__PURE__*/React__default.forwardRef(function OverflowGroup(props, ref) {
|
|
7523
|
+
const {
|
|
7524
|
+
moreButton: MoreButton,
|
|
7525
|
+
...attributes
|
|
7526
|
+
} = props;
|
|
7527
|
+
const internalRef = useMergedRef(ref);
|
|
7528
|
+
// determine width of more button, to add intersection observer margin
|
|
7529
|
+
const [buttonWidth, setButtonWidth] = React__default.useState(DEFAULT_OFFSET);
|
|
7530
|
+
const buttonRefCallback = React__default.useCallback(el => {
|
|
7531
|
+
var _el$getBoundingClient;
|
|
7532
|
+
return setButtonWidth(el === null || el === void 0 ? void 0 : (_el$getBoundingClient = el.getBoundingClientRect()) === null || _el$getBoundingClient === void 0 ? void 0 : _el$getBoundingClient.width);
|
|
7533
|
+
}, []);
|
|
7534
|
+
const button = MoreButton !== null && MoreButton !== void 0 ? MoreButton : /*#__PURE__*/React__default.createElement(IconButton, {
|
|
7535
|
+
icon: "more"
|
|
7536
|
+
});
|
|
7537
|
+
const intersectedChildIndex = useIntersectionObserver(internalRef, buttonWidth);
|
|
7538
|
+
const children = React__default.Children.toArray(props.children);
|
|
7539
|
+
const hiddenChildren = intersectedChildIndex !== undefined ? children.slice(intersectedChildIndex) : [];
|
|
7540
|
+
const className = cn('flex overflow-hidden', props.className);
|
|
7541
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
|
|
7542
|
+
className: className,
|
|
7543
|
+
"data-taco": "overflow-group",
|
|
7544
|
+
ref: internalRef
|
|
7545
|
+
}), children.map((child, index) => /*#__PURE__*/React__default.cloneElement(child, {
|
|
7546
|
+
className: cn(child.props.className, {
|
|
7547
|
+
visible: intersectedChildIndex === undefined || index < intersectedChildIndex,
|
|
7548
|
+
'invisible order-[100] pointer-events-none': intersectedChildIndex !== undefined && index >= intersectedChildIndex
|
|
7549
|
+
})
|
|
7550
|
+
})), hiddenChildren.length ? /*#__PURE__*/React__default.cloneElement(button, {
|
|
7551
|
+
className: cn('sticky right-0 order-[99]', button.props.className),
|
|
7552
|
+
'data-observer-ignore': true,
|
|
7553
|
+
menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, null, hiddenChildren.map(sanitizeButtonPropsForMenuItem))),
|
|
7554
|
+
ref: buttonRefCallback
|
|
7555
|
+
}) : null);
|
|
7556
|
+
});
|
|
7557
|
+
|
|
7557
7558
|
const createPageRange = (pageCount, pageNumber) => {
|
|
7558
7559
|
let lowerLimit = Math.min(pageNumber, pageCount);
|
|
7559
7560
|
let upperLimit = Math.min(pageNumber, pageCount);
|
|
@@ -7625,7 +7626,7 @@ const useSelect = ({
|
|
|
7625
7626
|
}, [open]);
|
|
7626
7627
|
React.useEffect(() => {
|
|
7627
7628
|
if (value === undefined) {
|
|
7628
|
-
if (defaultValue !== undefined && findByValue
|
|
7629
|
+
if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {
|
|
7629
7630
|
setInputValueByRef$1(inputRef.current, defaultValue);
|
|
7630
7631
|
} else {
|
|
7631
7632
|
if (emptyValue !== undefined) {
|
|
@@ -7635,7 +7636,7 @@ const useSelect = ({
|
|
|
7635
7636
|
}
|
|
7636
7637
|
}
|
|
7637
7638
|
} else {
|
|
7638
|
-
if (!multiselect && !findByValue
|
|
7639
|
+
if (!multiselect && !findByValue(flattenedData, value)) {
|
|
7639
7640
|
if (emptyValue !== undefined) {
|
|
7640
7641
|
setInputValueByRef$1(inputRef.current, emptyValue);
|
|
7641
7642
|
} else if (data.length > 0) {
|
|
@@ -7694,11 +7695,11 @@ const useSelect = ({
|
|
|
7694
7695
|
text = texts.select.allOptionsSelected;
|
|
7695
7696
|
} else {
|
|
7696
7697
|
var _findByValue$text, _findByValue;
|
|
7697
|
-
text = (_findByValue$text = (_findByValue = findByValue
|
|
7698
|
+
text = (_findByValue$text = (_findByValue = findByValue(flattenedData, selectedValues[0])) === null || _findByValue === void 0 ? void 0 : _findByValue.text) !== null && _findByValue$text !== void 0 ? _findByValue$text : '';
|
|
7698
7699
|
more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
|
|
7699
7700
|
}
|
|
7700
7701
|
} else {
|
|
7701
|
-
const item = findByValue
|
|
7702
|
+
const item = findByValue(flattenedData, value);
|
|
7702
7703
|
if (item) {
|
|
7703
7704
|
text = item.icon ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.cloneElement(item.icon, {
|
|
7704
7705
|
className: cn(item.icon.props.className, 'mr-1 -mt-px')
|
|
@@ -7710,7 +7711,7 @@ const useSelect = ({
|
|
|
7710
7711
|
event.persist();
|
|
7711
7712
|
if (onChange) {
|
|
7712
7713
|
var _item$path$split, _item$path;
|
|
7713
|
-
const item = findByValue
|
|
7714
|
+
const item = findByValue(flattenedData, event.target.value);
|
|
7714
7715
|
event.detail = sanitizeItem(item);
|
|
7715
7716
|
const indexes = (_item$path$split = item === null || item === void 0 ? void 0 : (_item$path = item.path) === null || _item$path === void 0 ? void 0 : _item$path.split('.')) !== null && _item$path$split !== void 0 ? _item$path$split : [];
|
|
7716
7717
|
if (indexes.length > 1) {
|
|
@@ -8057,6 +8058,7 @@ const getBadgeIcon = type => {
|
|
|
8057
8058
|
return null;
|
|
8058
8059
|
}
|
|
8059
8060
|
};
|
|
8061
|
+
const getToastEmptyContentWarning = content => `Toast requires 'content' property, which can't be empty string, null or undefined. Current content value is set to ${content === '' ? 'empty string' : content}.`;
|
|
8060
8062
|
|
|
8061
8063
|
const Toast = ({
|
|
8062
8064
|
content,
|
|
@@ -8082,7 +8084,7 @@ const Toast = ({
|
|
|
8082
8084
|
const timer = useTimer(autoClose, handleClose);
|
|
8083
8085
|
const controls = framerMotion.useAnimation();
|
|
8084
8086
|
if (!content) {
|
|
8085
|
-
console.warn(
|
|
8087
|
+
console.warn(getToastEmptyContentWarning(content));
|
|
8086
8088
|
}
|
|
8087
8089
|
React__default.useEffect(() => {
|
|
8088
8090
|
if (autoClose) {
|
|
@@ -8281,6 +8283,60 @@ const Provider = props => {
|
|
|
8281
8283
|
}, /*#__PURE__*/React.createElement(TooltipPrimitive.Provider, null, /*#__PURE__*/React.createElement(ToastProvider, null, children)));
|
|
8282
8284
|
};
|
|
8283
8285
|
|
|
8286
|
+
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
|
8287
|
+
onSearch,
|
|
8288
|
+
...props
|
|
8289
|
+
}, ref) {
|
|
8290
|
+
const internalRef = useMergedRef(ref);
|
|
8291
|
+
const {
|
|
8292
|
+
texts
|
|
8293
|
+
} = useLocalization();
|
|
8294
|
+
const handleClick = () => {
|
|
8295
|
+
var _internalRef$current$, _internalRef$current;
|
|
8296
|
+
onSearch === null || onSearch === void 0 ? void 0 : onSearch((_internalRef$current$ = (_internalRef$current = internalRef.current) === null || _internalRef$current === void 0 ? void 0 : _internalRef$current.value) !== null && _internalRef$current$ !== void 0 ? _internalRef$current$ : '');
|
|
8297
|
+
};
|
|
8298
|
+
const handleCancelClick = () => {
|
|
8299
|
+
setInputValueByRef(internalRef.current, '');
|
|
8300
|
+
};
|
|
8301
|
+
const handleKeyDown = event => {
|
|
8302
|
+
var _props$onKeyDown;
|
|
8303
|
+
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
|
8304
|
+
if (event.isDefaultPrevented()) {
|
|
8305
|
+
return;
|
|
8306
|
+
}
|
|
8307
|
+
if (event.key === 'Enter') {
|
|
8308
|
+
event.preventDefault();
|
|
8309
|
+
handleClick();
|
|
8310
|
+
return;
|
|
8311
|
+
}
|
|
8312
|
+
};
|
|
8313
|
+
return /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
8314
|
+
"aria-label": texts.searchInput.placeholder,
|
|
8315
|
+
placeholder: texts.searchInput.placeholder
|
|
8316
|
+
}, props, {
|
|
8317
|
+
onKeyDown: handleKeyDown,
|
|
8318
|
+
postfix: /*#__PURE__*/React.createElement(React.Fragment, null, props.disabled || props.readOnly || !props.value ? null : /*#__PURE__*/React.createElement(IconButton, {
|
|
8319
|
+
"aria-hidden": true,
|
|
8320
|
+
className: "group-peer-focus:visible group-peer-hover:visible !text-grey-700 invisible mr-0.5 !h-5 !min-h-[theme(spacing.4)] !w-5 !min-w-[theme(spacing.4)] text-xs hover:visible group-hover:visible",
|
|
8321
|
+
icon: "close",
|
|
8322
|
+
onClick: handleCancelClick,
|
|
8323
|
+
rounded: true,
|
|
8324
|
+
tabIndex: -1,
|
|
8325
|
+
tooltip: texts.searchInput.clear
|
|
8326
|
+
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
8327
|
+
"aria-label": texts.searchInput.button,
|
|
8328
|
+
icon: "search",
|
|
8329
|
+
className: "group-peer-focus:!border-transparent group-peer-focus:group-peer-active:!border-transparent -mr-2 !border-transparent !bg-transparent focus:!border-transparent",
|
|
8330
|
+
disabled: props.disabled || props.readOnly,
|
|
8331
|
+
onClick: handleClick,
|
|
8332
|
+
tabIndex: -1,
|
|
8333
|
+
tooltip: texts.searchInput.button
|
|
8334
|
+
})),
|
|
8335
|
+
ref: internalRef,
|
|
8336
|
+
type: "search"
|
|
8337
|
+
}));
|
|
8338
|
+
});
|
|
8339
|
+
|
|
8284
8340
|
const isAriaSelectionKey = event => {
|
|
8285
8341
|
if (event.key === 'Enter' || event.key === ' ' || event.key === 'Tab') {
|
|
8286
8342
|
return true;
|
|
@@ -9703,6 +9759,47 @@ const Shortcut$1 = ({
|
|
|
9703
9759
|
}, key)));
|
|
9704
9760
|
};
|
|
9705
9761
|
|
|
9762
|
+
const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
|
9763
|
+
const {
|
|
9764
|
+
label,
|
|
9765
|
+
onChange,
|
|
9766
|
+
...otherProps
|
|
9767
|
+
} = props;
|
|
9768
|
+
const id = useId(props.id);
|
|
9769
|
+
const className = cn('group h-5 w-9 flex flex-shrink-0 rounded-full inline-flex', {
|
|
9770
|
+
'mr-2': !!label,
|
|
9771
|
+
'bg-grey-500 hover:bg-grey-300 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-300 focus:yt-focus': !props.disabled,
|
|
9772
|
+
'bg-grey-100 cursor-not-allowed aria-checked:bg-blue-300': props.disabled
|
|
9773
|
+
}, props.className);
|
|
9774
|
+
let labelledByProps = null;
|
|
9775
|
+
if (label) {
|
|
9776
|
+
labelledByProps = {
|
|
9777
|
+
'aria-labelledby': `${id}-label`,
|
|
9778
|
+
id
|
|
9779
|
+
};
|
|
9780
|
+
}
|
|
9781
|
+
const element = /*#__PURE__*/React.createElement(PrimitiveSwitch.Root, Object.assign({}, otherProps, labelledByProps, {
|
|
9782
|
+
className: className,
|
|
9783
|
+
onCheckedChange: onChange,
|
|
9784
|
+
ref: ref
|
|
9785
|
+
}), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
|
|
9786
|
+
className: "'will-change-transform mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]"
|
|
9787
|
+
}));
|
|
9788
|
+
if (label) {
|
|
9789
|
+
const labelContainerClassName = cn('flex self-start cursor-pointer', {
|
|
9790
|
+
'cursor-not-allowed text-grey-300': props.disabled
|
|
9791
|
+
});
|
|
9792
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
9793
|
+
className: labelContainerClassName
|
|
9794
|
+
}, element, /*#__PURE__*/React.createElement("label", {
|
|
9795
|
+
htmlFor: id,
|
|
9796
|
+
id: `${id}-label`
|
|
9797
|
+
}, label));
|
|
9798
|
+
}
|
|
9799
|
+
return element;
|
|
9800
|
+
});
|
|
9801
|
+
Switch.displayName = 'Switch';
|
|
9802
|
+
|
|
9706
9803
|
const sanitizeRowProps = (row, rowExpansionRenderer) => {
|
|
9707
9804
|
var _row$subRows;
|
|
9708
9805
|
const props = {
|
|
@@ -10205,7 +10302,7 @@ const useRowSelect = onSelectedRows => {
|
|
|
10205
10302
|
onSelectedRows({});
|
|
10206
10303
|
}
|
|
10207
10304
|
};
|
|
10208
|
-
return /*#__PURE__*/React__default.createElement(Checkbox
|
|
10305
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, props, {
|
|
10209
10306
|
onChange: onChange
|
|
10210
10307
|
}));
|
|
10211
10308
|
},
|
|
@@ -10230,7 +10327,7 @@ const useRowSelect = onSelectedRows => {
|
|
|
10230
10327
|
}
|
|
10231
10328
|
lastSelectedSortedIndex.current = sortedIndex;
|
|
10232
10329
|
};
|
|
10233
|
-
return /*#__PURE__*/React__default.createElement(Checkbox
|
|
10330
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, props, {
|
|
10234
10331
|
className: "!mt-2.5",
|
|
10235
10332
|
onClick: onClick,
|
|
10236
10333
|
// this is necessary to remove console spam from eslint
|
|
@@ -11320,7 +11417,7 @@ const SelectCell = /*#__PURE__*/React__default.memo(({
|
|
|
11320
11417
|
className: "ml-2",
|
|
11321
11418
|
keys: ['Space']
|
|
11322
11419
|
}))
|
|
11323
|
-
}, /*#__PURE__*/React__default.createElement(Checkbox
|
|
11420
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
11324
11421
|
"aria-label": isSelected ? texts.table2.columns.select.select : texts.table2.columns.select.deselect,
|
|
11325
11422
|
className: "hover:border-blue !mt-0",
|
|
11326
11423
|
checked: isSelected,
|
|
@@ -11341,7 +11438,7 @@ function createRowSelectionColumn(enableMultipleRowSelection, lastSelectedRowInd
|
|
|
11341
11438
|
className: "ml-2",
|
|
11342
11439
|
keys: ['Ctrl', 'A']
|
|
11343
11440
|
}))
|
|
11344
|
-
}, /*#__PURE__*/React__default.createElement(Checkbox
|
|
11441
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
11345
11442
|
"aria-label": table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll,
|
|
11346
11443
|
className: "hover:border-blue !mt-0",
|
|
11347
11444
|
checked: table.getIsAllPageRowsSelected(),
|
|
@@ -11632,47 +11729,6 @@ const ColumnBase = /*#__PURE__*/React__default.forwardRef(function Table2ColumnB
|
|
|
11632
11729
|
}));
|
|
11633
11730
|
});
|
|
11634
11731
|
|
|
11635
|
-
const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
|
11636
|
-
const {
|
|
11637
|
-
label,
|
|
11638
|
-
onChange,
|
|
11639
|
-
...otherProps
|
|
11640
|
-
} = props;
|
|
11641
|
-
const id = useId(props.id);
|
|
11642
|
-
const className = cn('group h-5 w-9 flex flex-shrink-0 rounded-full inline-flex', {
|
|
11643
|
-
'mr-2': !!label,
|
|
11644
|
-
'bg-grey-500 hover:bg-grey-300 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-300 focus:yt-focus': !props.disabled,
|
|
11645
|
-
'bg-grey-100 cursor-not-allowed aria-checked:bg-blue-300': props.disabled
|
|
11646
|
-
}, props.className);
|
|
11647
|
-
let labelledByProps = null;
|
|
11648
|
-
if (label) {
|
|
11649
|
-
labelledByProps = {
|
|
11650
|
-
'aria-labelledby': `${id}-label`,
|
|
11651
|
-
id
|
|
11652
|
-
};
|
|
11653
|
-
}
|
|
11654
|
-
const element = /*#__PURE__*/React.createElement(PrimitiveSwitch.Root, Object.assign({}, otherProps, labelledByProps, {
|
|
11655
|
-
className: className,
|
|
11656
|
-
onCheckedChange: onChange,
|
|
11657
|
-
ref: ref
|
|
11658
|
-
}), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
|
|
11659
|
-
className: "'will-change-transform mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]"
|
|
11660
|
-
}));
|
|
11661
|
-
if (label) {
|
|
11662
|
-
const labelContainerClassName = cn('flex self-start cursor-pointer', {
|
|
11663
|
-
'cursor-not-allowed text-grey-300': props.disabled
|
|
11664
|
-
});
|
|
11665
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
11666
|
-
className: labelContainerClassName
|
|
11667
|
-
}, element, /*#__PURE__*/React.createElement("label", {
|
|
11668
|
-
htmlFor: id,
|
|
11669
|
-
id: `${id}-label`
|
|
11670
|
-
}, label));
|
|
11671
|
-
}
|
|
11672
|
-
return element;
|
|
11673
|
-
});
|
|
11674
|
-
Switch.displayName = 'Switch';
|
|
11675
|
-
|
|
11676
11732
|
var Table2FilterComparator;
|
|
11677
11733
|
(function (Table2FilterComparator) {
|
|
11678
11734
|
Table2FilterComparator[Table2FilterComparator["Contains"] = 0] = "Contains";
|
|
@@ -13364,7 +13420,7 @@ const OrderableColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
13364
13420
|
ref: ref
|
|
13365
13421
|
}), /*#__PURE__*/React__default.createElement("span", {
|
|
13366
13422
|
className: "pointer-events-none"
|
|
13367
|
-
}, icon, (_column$columnDef$hea = column.columnDef.header) !== null && _column$columnDef$hea !== void 0 ? _column$columnDef$hea : column.columnDef.id), column.getCanHide() ? /*#__PURE__*/React__default.createElement(Checkbox
|
|
13423
|
+
}, icon, (_column$columnDef$hea = column.columnDef.header) !== null && _column$columnDef$hea !== void 0 ? _column$columnDef$hea : column.columnDef.id), column.getCanHide() ? /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
13368
13424
|
checked: column.getIsVisible(),
|
|
13369
13425
|
onChange: column.toggleVisibility
|
|
13370
13426
|
}) : null);
|
|
@@ -14778,25 +14834,20 @@ Tour.Step = TourStep;
|
|
|
14778
14834
|
|
|
14779
14835
|
const Button$3 = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
|
|
14780
14836
|
const {
|
|
14781
|
-
as = 'li',
|
|
14782
14837
|
...attributes
|
|
14783
14838
|
} = props;
|
|
14784
14839
|
const className = cn(getButtonClasses$1(), props.className);
|
|
14785
|
-
|
|
14786
|
-
return /*#__PURE__*/React__default.createElement(Tag, {
|
|
14787
|
-
className: "contents"
|
|
14788
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, attributes, {
|
|
14840
|
+
return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, attributes, {
|
|
14789
14841
|
appearance: "discrete",
|
|
14790
14842
|
className: className,
|
|
14791
14843
|
"data-taco": "header-button",
|
|
14792
14844
|
ref: ref
|
|
14793
|
-
}))
|
|
14845
|
+
}));
|
|
14794
14846
|
});
|
|
14795
14847
|
const getButtonClasses$1 = () => cn('!h-9 !w-9 flex-shrink-0 flex-grow-0 cursor-pointer !rounded-full relative', 'focus:!outline-none focus:!shadow-none focus-visible:!yt-focus-dark ', 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', '!text-white hover:text-white focus:text-white');
|
|
14796
14848
|
|
|
14797
14849
|
const Link$1 = /*#__PURE__*/React__default.forwardRef(function Link(props, ref) {
|
|
14798
14850
|
const {
|
|
14799
|
-
as = 'li',
|
|
14800
14851
|
children,
|
|
14801
14852
|
icon,
|
|
14802
14853
|
isNew,
|
|
@@ -14806,9 +14857,8 @@ const Link$1 = /*#__PURE__*/React__default.forwardRef(function Link(props, ref)
|
|
|
14806
14857
|
const {
|
|
14807
14858
|
texts
|
|
14808
14859
|
} = useLocalization();
|
|
14809
|
-
const Tag = as;
|
|
14810
14860
|
const className = cn(getLinkClasses(icon), 'relative', props.className);
|
|
14811
|
-
|
|
14861
|
+
const link = /*#__PURE__*/React__default.createElement("a", Object.assign({}, otherProps, {
|
|
14812
14862
|
className: className,
|
|
14813
14863
|
"data-taco": "header-link",
|
|
14814
14864
|
ref: ref,
|
|
@@ -14821,13 +14871,11 @@ const Link$1 = /*#__PURE__*/React__default.forwardRef(function Link(props, ref)
|
|
|
14821
14871
|
className: "absolute top-0 right-0 -mt-1.5 -mr-2.5 !h-3 !px-0.5 text-[0.55rem] font-normal"
|
|
14822
14872
|
}, texts.header.new) : null);
|
|
14823
14873
|
if (tooltip) {
|
|
14824
|
-
|
|
14874
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
14825
14875
|
title: tooltip
|
|
14826
14876
|
}, link);
|
|
14827
14877
|
}
|
|
14828
|
-
return
|
|
14829
|
-
className: "contents"
|
|
14830
|
-
}, link);
|
|
14878
|
+
return link;
|
|
14831
14879
|
});
|
|
14832
14880
|
const getLinkClasses = (icon = undefined) => cn('flex h-8 flex-shrink-0 flex-grow-0 cursor-pointer items-center justify-center ', 'focus:!shadow-none focus:!outline-none focus-visible:!yt-focus-dark', 'bg-transparent hover:bg-white/[.08] focus:bg-white/[.08] aria-current-page:bg-white/[.08]', '!text-white hover:text-white focus:text-white', {
|
|
14833
14881
|
'!rounded-full !h-9 !w-9': icon,
|
|
@@ -14902,132 +14950,27 @@ const Logo = /*#__PURE__*/React__default.forwardRef(function Logo(props, ref) {
|
|
|
14902
14950
|
}))));
|
|
14903
14951
|
});
|
|
14904
14952
|
|
|
14905
|
-
const getChildWidths = parent => {
|
|
14906
|
-
const widths = [];
|
|
14907
|
-
for (let index = 0; index < parent.children.length; index++) {
|
|
14908
|
-
var _parent$children$inde, _childRect$width;
|
|
14909
|
-
const childRect = (_parent$children$inde = parent.children[index].firstElementChild) === null || _parent$children$inde === void 0 ? void 0 : _parent$children$inde.getBoundingClientRect();
|
|
14910
|
-
widths.push((_childRect$width = childRect === null || childRect === void 0 ? void 0 : childRect.width) !== null && _childRect$width !== void 0 ? _childRect$width : 0);
|
|
14911
|
-
}
|
|
14912
|
-
return widths;
|
|
14913
|
-
};
|
|
14914
|
-
const ChildrenWidth = ({
|
|
14915
|
-
setWidth,
|
|
14916
|
-
children
|
|
14917
|
-
}) => {
|
|
14918
|
-
const ref = React__default.useRef(null);
|
|
14919
|
-
const [show, setShow] = React__default.useState(true);
|
|
14920
|
-
React__default.useEffect(() => {
|
|
14921
|
-
// Calculate the width of children, and then hides the portal
|
|
14922
|
-
if (ref.current && show) {
|
|
14923
|
-
setWidth(getChildWidths(ref.current));
|
|
14924
|
-
setShow(false);
|
|
14925
|
-
}
|
|
14926
|
-
}, [show]);
|
|
14927
|
-
React__default.useEffect(() => {
|
|
14928
|
-
// If children changes, then we render the children to calculate their width
|
|
14929
|
-
if (!show) {
|
|
14930
|
-
setShow(true);
|
|
14931
|
-
}
|
|
14932
|
-
}, [children]);
|
|
14933
|
-
return show ? /*#__PURE__*/React__default.createElement(reactPortal.Portal, {
|
|
14934
|
-
className: cn('invisible absolute z-[-10] flex translate-x-[-1000px]'),
|
|
14935
|
-
ref: ref
|
|
14936
|
-
}, children) : null;
|
|
14937
|
-
};
|
|
14938
|
-
const useBoundaryIndex = (wrapperWidth, buttonRef, childWidths) => {
|
|
14939
|
-
// Primary navigation has a gap of gap-1, so we need to take the gap value in account as well
|
|
14940
|
-
// left gap + right gap = 8px
|
|
14941
|
-
const GAP = 8;
|
|
14942
|
-
return React__default.useMemo(() => {
|
|
14943
|
-
if (childWidths.length && wrapperWidth && buttonRef.current) {
|
|
14944
|
-
const realWidth = wrapperWidth - buttonRef.current.getBoundingClientRect().width - GAP;
|
|
14945
|
-
let boundary;
|
|
14946
|
-
let total = 0;
|
|
14947
|
-
childWidths.every((width, index) => {
|
|
14948
|
-
const nextWidth = total + width + GAP;
|
|
14949
|
-
if (nextWidth > realWidth) {
|
|
14950
|
-
boundary = index;
|
|
14951
|
-
return false;
|
|
14952
|
-
}
|
|
14953
|
-
total = nextWidth;
|
|
14954
|
-
return true;
|
|
14955
|
-
});
|
|
14956
|
-
return boundary;
|
|
14957
|
-
}
|
|
14958
|
-
return undefined;
|
|
14959
|
-
}, [childWidths, wrapperWidth]);
|
|
14960
|
-
};
|
|
14961
14953
|
const PrimaryNavigation = /*#__PURE__*/React__default.forwardRef(function PrimaryNavigation(props, ref) {
|
|
14962
|
-
var _rect$width;
|
|
14963
14954
|
const {
|
|
14964
14955
|
texts
|
|
14965
14956
|
} = useLocalization();
|
|
14966
14957
|
const internalRef = useMergedRef(ref);
|
|
14967
|
-
const rect = useBoundingClientRectListener(internalRef);
|
|
14968
|
-
const buttonRef = React__default.useRef(null);
|
|
14969
|
-
const [childWidths, setChildWidths] = React__default.useState([]);
|
|
14970
|
-
const boundaryIndex = useBoundaryIndex((_rect$width = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _rect$width !== void 0 ? _rect$width : 0, buttonRef, childWidths);
|
|
14971
14958
|
const className = cn('flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative', props.className);
|
|
14972
|
-
const
|
|
14973
|
-
|
|
14974
|
-
|
|
14975
|
-
const hiddenChildren = [];
|
|
14976
|
-
React__default.Children.forEach(props.children, (child, index) => {
|
|
14977
|
-
if ( /*#__PURE__*/React__default.isValidElement(child) && !!child) {
|
|
14978
|
-
if (boundaryIndex && index >= boundaryIndex) {
|
|
14979
|
-
hiddenChildren.push(child);
|
|
14980
|
-
} else {
|
|
14981
|
-
visibleChildren.push(child);
|
|
14982
|
-
}
|
|
14983
|
-
}
|
|
14984
|
-
});
|
|
14985
|
-
return [visibleChildren, hiddenChildren];
|
|
14986
|
-
}, [boundaryIndex, props.children]);
|
|
14959
|
+
const moreButton = /*#__PURE__*/React__default.createElement(Button$1, {
|
|
14960
|
+
className: cn(getLinkClasses(), '!bg-transparent aria-expanded:!bg-white/[.08]')
|
|
14961
|
+
}, texts.header.more);
|
|
14987
14962
|
return /*#__PURE__*/React__default.createElement("nav", Object.assign({}, props, {
|
|
14988
14963
|
className: className,
|
|
14989
14964
|
ref: internalRef
|
|
14990
|
-
}), /*#__PURE__*/React__default.createElement(
|
|
14991
|
-
className: "
|
|
14992
|
-
|
|
14993
|
-
className: cn({
|
|
14994
|
-
invisible: boundaryIndex === undefined
|
|
14995
|
-
})
|
|
14996
|
-
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
14997
|
-
className: moreButtonClassName,
|
|
14998
|
-
menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
|
14999
|
-
className: "hidden lg:block"
|
|
15000
|
-
}, hiddenChildren.map((child, index) => {
|
|
15001
|
-
const href = child.props.to || child.props.href;
|
|
15002
|
-
const target = href !== null && href !== void 0 && href.startsWith('http') ? '_blank' : '_self';
|
|
15003
|
-
// Removing className prop so that custom styling cannot be applied on Menu.Link
|
|
15004
|
-
const {
|
|
15005
|
-
as,
|
|
15006
|
-
className: _,
|
|
15007
|
-
...otherProps
|
|
15008
|
-
} = child.props;
|
|
15009
|
-
if (as) {
|
|
15010
|
-
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
15011
|
-
as: Menu$1.Link,
|
|
15012
|
-
key: index,
|
|
15013
|
-
target,
|
|
15014
|
-
...otherProps
|
|
15015
|
-
});
|
|
15016
|
-
}
|
|
15017
|
-
return /*#__PURE__*/React__default.createElement(Menu$1.Link, Object.assign({
|
|
15018
|
-
key: index,
|
|
15019
|
-
target: target
|
|
15020
|
-
}, otherProps));
|
|
15021
|
-
}))),
|
|
15022
|
-
ref: buttonRef
|
|
15023
|
-
}, texts.header.more))), /*#__PURE__*/React__default.createElement(ChildrenWidth, {
|
|
15024
|
-
setWidth: setChildWidths
|
|
14965
|
+
}), /*#__PURE__*/React__default.createElement(OverflowGroup, {
|
|
14966
|
+
className: "h-full flex-grow items-center gap-1 px-1",
|
|
14967
|
+
moreButton: moreButton
|
|
15025
14968
|
}, props.children));
|
|
15026
14969
|
});
|
|
15027
14970
|
|
|
15028
14971
|
const SecondaryNavigation = /*#__PURE__*/React__default.forwardRef(function SecondaryNavigation(props, ref) {
|
|
15029
|
-
const className = cn('flex h-full items-center gap-2 mb-0', props.className);
|
|
15030
|
-
return /*#__PURE__*/React__default.createElement("
|
|
14972
|
+
const className = cn('flex h-full items-center gap-2 mb-0 flex-shrink-0', props.className);
|
|
14973
|
+
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
|
|
15031
14974
|
className: className,
|
|
15032
14975
|
ref: ref
|
|
15033
14976
|
}));
|
|
@@ -15623,10 +15566,9 @@ exports.BadgeIcon = BadgeIcon;
|
|
|
15623
15566
|
exports.Banner = Banner;
|
|
15624
15567
|
exports.Base = Base;
|
|
15625
15568
|
exports.Button = Button$1;
|
|
15626
|
-
exports.ButtonGroup = ButtonGroup;
|
|
15627
15569
|
exports.Calendar = Calendar$1;
|
|
15628
15570
|
exports.Card = Card;
|
|
15629
|
-
exports.Checkbox = Checkbox
|
|
15571
|
+
exports.Checkbox = Checkbox;
|
|
15630
15572
|
exports.CollectionPrimitive = Collection;
|
|
15631
15573
|
exports.Combobox = Combobox;
|
|
15632
15574
|
exports.Datepicker = Datepicker;
|
|
@@ -15649,6 +15591,7 @@ exports.Menu = Menu$1;
|
|
|
15649
15591
|
exports.MultiListbox = MultiListbox;
|
|
15650
15592
|
exports.Navigation = Navigation;
|
|
15651
15593
|
exports.Navigation2 = Navigation2;
|
|
15594
|
+
exports.OverflowGroup = OverflowGroup;
|
|
15652
15595
|
exports.PaginatedTable = PaginatedTable;
|
|
15653
15596
|
exports.Pagination = Pagination;
|
|
15654
15597
|
exports.Popover = Popover;
|
|
@@ -15676,7 +15619,7 @@ exports.VisuallyHidden = VisuallyHidden;
|
|
|
15676
15619
|
exports.WindowedTable = WindowedTable;
|
|
15677
15620
|
exports.convertRowIndexPathToNumberArray = convertRowIndexPathToNumberArray;
|
|
15678
15621
|
exports.defaultLocalisationTexts = defaultLocalisationTexts;
|
|
15679
|
-
exports.findByValue = findByValue;
|
|
15622
|
+
exports.findByValue = findByValue$1;
|
|
15680
15623
|
exports.format = format;
|
|
15681
15624
|
exports.getByRowIndexPath = getByRowIndexPath;
|
|
15682
15625
|
exports.getNavigationLinkClasses = getNavigationLinkClasses;
|