@economic/taco 1.27.0 → 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/OverflowGroup/OverflowGroup.d.ts +5 -0
- package/dist/components/Provider/Localization.d.ts +1 -0
- 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/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 +1235 -1307
- 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 +10 -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 => {
|
|
@@ -3223,6 +3222,7 @@ const Icon = /*#__PURE__*/React__default.forwardRef(function Icon(props, ref) {
|
|
|
3223
3222
|
return Component ? /*#__PURE__*/React__default.createElement(Component, Object.assign({}, otherProps, {
|
|
3224
3223
|
className: className,
|
|
3225
3224
|
"data-taco": "icon",
|
|
3225
|
+
"data-icon-name": name,
|
|
3226
3226
|
focusable: "false",
|
|
3227
3227
|
ref: ref,
|
|
3228
3228
|
role: "img"
|
|
@@ -3745,6 +3745,7 @@ const defaultLocalisationTexts = {
|
|
|
3745
3745
|
calendar: {
|
|
3746
3746
|
months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
3747
3747
|
weekdaysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
3748
|
+
weekdays: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
|
|
3748
3749
|
actions: {
|
|
3749
3750
|
previousMonth: 'Previous month',
|
|
3750
3751
|
nextMonth: 'Next month',
|
|
@@ -4013,1078 +4014,608 @@ const Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
|
|
4013
4014
|
}, button);
|
|
4014
4015
|
});
|
|
4015
4016
|
|
|
4016
|
-
|
|
4017
|
-
const
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
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
|
|
4025
4033
|
}
|
|
4026
4034
|
}
|
|
4027
|
-
}
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
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) {
|
|
4032
4082
|
const {
|
|
4033
|
-
|
|
4034
|
-
|
|
4083
|
+
onChange: handleChange,
|
|
4084
|
+
value,
|
|
4085
|
+
disabledDays,
|
|
4035
4086
|
...otherProps
|
|
4036
4087
|
} = props;
|
|
4037
|
-
const
|
|
4038
|
-
|
|
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
|
|
4039
4147
|
}, props.className);
|
|
4040
|
-
return /*#__PURE__*/React.createElement(
|
|
4148
|
+
return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
|
|
4041
4149
|
className: className,
|
|
4042
|
-
"data-taco": "group",
|
|
4043
4150
|
ref: ref
|
|
4044
4151
|
}));
|
|
4045
4152
|
});
|
|
4046
|
-
|
|
4047
|
-
const MenuContext = /*#__PURE__*/React.createContext(undefined);
|
|
4048
|
-
const useCurrentMenu = () => {
|
|
4049
|
-
return React.useContext(MenuContext);
|
|
4050
|
-
};
|
|
4051
|
-
|
|
4052
|
-
const Content$2 = /*#__PURE__*/React.forwardRef(function MenuContent(props, ref) {
|
|
4053
|
-
const internalRef = useMergedRef(ref);
|
|
4054
|
-
const menu = useCurrentMenu();
|
|
4153
|
+
const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
4055
4154
|
const {
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
...otherProps
|
|
4155
|
+
title,
|
|
4156
|
+
menu,
|
|
4157
|
+
children
|
|
4060
4158
|
} = props;
|
|
4061
|
-
const className = cn('
|
|
4062
|
-
return /*#__PURE__*/React.createElement(
|
|
4063
|
-
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", {
|
|
4064
4161
|
className: className,
|
|
4065
|
-
"data-taco": "
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
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);
|
|
4073
4174
|
});
|
|
4175
|
+
Card.Content = Content$2;
|
|
4074
4176
|
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
className: "absolute left-0 ml-1"
|
|
4079
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4080
|
-
className: "-ml-px -mt-px !h-5 !w-5",
|
|
4081
|
-
name: name
|
|
4082
|
-
}));
|
|
4083
|
-
const useItemStyling = ({
|
|
4084
|
-
disabled,
|
|
4085
|
-
indented,
|
|
4086
|
-
className
|
|
4087
|
-
}) => {
|
|
4088
|
-
const menu = useCurrentMenu();
|
|
4089
|
-
React.useEffect(() => {
|
|
4090
|
-
if (indented && !(menu !== null && menu !== void 0 && menu.indented)) {
|
|
4091
|
-
menu === null || menu === void 0 ? void 0 : menu.registerIndentation();
|
|
4092
|
-
}
|
|
4093
|
-
}, [indented]);
|
|
4094
|
-
return cn('flex items-center justify-start h-8 pr-1.5 relative rounded w-full focus:outline-none group', {
|
|
4095
|
-
'pl-7': menu === null || menu === void 0 ? void 0 : menu.indented,
|
|
4096
|
-
'pl-1.5': !(menu !== null && menu !== void 0 && menu.indented),
|
|
4097
|
-
'cursor-pointer text-black hover:wcag-grey-200 data-[highlighted]:wcag-grey-200': !disabled,
|
|
4098
|
-
'cursor-not-allowed hover:bg-white text-grey-300': disabled
|
|
4099
|
-
}, className);
|
|
4100
|
-
};
|
|
4101
|
-
const Shortcut = props => {
|
|
4102
|
-
return /*#__PURE__*/React.createElement("span", Object.assign({}, props, {
|
|
4103
|
-
className: "text-grey-700 ml-auto pl-3"
|
|
4104
|
-
}));
|
|
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(), []);
|
|
4105
4180
|
};
|
|
4106
|
-
|
|
4107
|
-
|
|
4181
|
+
|
|
4182
|
+
const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4108
4183
|
const {
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4184
|
+
checked,
|
|
4185
|
+
highlighted,
|
|
4186
|
+
indeterminate,
|
|
4187
|
+
invalid,
|
|
4188
|
+
label,
|
|
4189
|
+
onChange,
|
|
4113
4190
|
...otherProps
|
|
4114
4191
|
} = props;
|
|
4115
|
-
const
|
|
4116
|
-
const className =
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
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
|
|
4211
|
+
};
|
|
4212
|
+
}
|
|
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();
|
|
4217
|
+
}
|
|
4218
|
+
};
|
|
4219
|
+
const element = /*#__PURE__*/React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, labelledByProps, {
|
|
4220
|
+
"data-taco": "checkbox",
|
|
4221
|
+
checked: indeterminate ? 'indeterminate' : checked,
|
|
4139
4222
|
className: className,
|
|
4140
|
-
|
|
4141
|
-
|
|
4223
|
+
onCheckedChange: handleChange,
|
|
4224
|
+
onKeyDown: handleKeyDown,
|
|
4142
4225
|
ref: ref
|
|
4143
|
-
}),
|
|
4144
|
-
|
|
4145
|
-
}
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
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
|
|
4150
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));
|
|
4151
4242
|
}
|
|
4152
|
-
return
|
|
4243
|
+
return element;
|
|
4153
4244
|
});
|
|
4245
|
+
Checkbox.displayName = 'Checkbox';
|
|
4154
4246
|
|
|
4155
|
-
const
|
|
4156
|
-
const
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
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
|
|
4167
4266
|
});
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
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);
|
|
4171
4280
|
};
|
|
4172
|
-
|
|
4173
|
-
asChild: true,
|
|
4174
|
-
className: className,
|
|
4175
|
-
ref: ref,
|
|
4176
|
-
onClick: handleClick
|
|
4177
|
-
}), /*#__PURE__*/React.createElement("a", {
|
|
4178
|
-
href: href,
|
|
4179
|
-
target: "_blank"
|
|
4180
|
-
}, icon && /*#__PURE__*/React.createElement(Icon$1, {
|
|
4181
|
-
name: icon
|
|
4182
|
-
}), props.children));
|
|
4183
|
-
});
|
|
4281
|
+
};
|
|
4184
4282
|
|
|
4185
|
-
const
|
|
4186
|
-
|
|
4187
|
-
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
|
+
};
|
|
4188
4294
|
React.useEffect(() => {
|
|
4189
|
-
|
|
4190
|
-
|
|
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);
|
|
4191
4310
|
}
|
|
4192
|
-
}, [internalRef]);
|
|
4193
|
-
return /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Trigger, Object.assign({}, props, {
|
|
4194
|
-
asChild: true,
|
|
4195
|
-
ref: internalRef
|
|
4196
|
-
}));
|
|
4197
|
-
});
|
|
4198
|
-
|
|
4199
|
-
const Checkbox = /*#__PURE__*/React.forwardRef(function MenuCheckboxItem(props, ref) {
|
|
4200
|
-
const {
|
|
4201
|
-
checked,
|
|
4202
|
-
children,
|
|
4203
|
-
onChange,
|
|
4204
|
-
...otherProps
|
|
4205
|
-
} = props;
|
|
4206
|
-
const className = useItemStyling({
|
|
4207
|
-
disabled: props.disabled,
|
|
4208
|
-
indented: true,
|
|
4209
|
-
className: props.className
|
|
4210
4311
|
});
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
}
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
name: "tick",
|
|
4220
|
-
className: "-ml-px !h-4 !w-4"
|
|
4221
|
-
})), children);
|
|
4222
|
-
});
|
|
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
|
+
};
|
|
4223
4320
|
|
|
4224
|
-
|
|
4225
|
-
const
|
|
4226
|
-
const
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
'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
|
|
4242
|
-
});
|
|
4243
|
-
const labelClassName = cn('flex items-center gap-2', {
|
|
4244
|
-
'cursor-pointer': !isDisabled,
|
|
4245
|
-
'cursor-not-allowed text-grey-300': isDisabled
|
|
4246
|
-
}, props.className);
|
|
4247
|
-
return /*#__PURE__*/React.createElement("label", {
|
|
4248
|
-
className: labelClassName
|
|
4249
|
-
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Item, Object.assign({}, otherProps, {
|
|
4250
|
-
className: className,
|
|
4251
|
-
disabled: isDisabled,
|
|
4252
|
-
ref: ref,
|
|
4253
|
-
value: getRadioGroupItemValueAsString(value)
|
|
4254
|
-
}), /*#__PURE__*/React.createElement(RadioGroupPrimitive.Indicator, {
|
|
4255
|
-
className: "h-2 w-2 rounded-full bg-white"
|
|
4256
|
-
})), children);
|
|
4257
|
-
});
|
|
4258
|
-
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) {
|
|
4259
4338
|
const {
|
|
4260
|
-
|
|
4261
|
-
defaultValue,
|
|
4262
|
-
disabled,
|
|
4339
|
+
highlighted,
|
|
4263
4340
|
invalid,
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4341
|
+
onKeyDown,
|
|
4342
|
+
postfix,
|
|
4343
|
+
prefix,
|
|
4344
|
+
type = 'text',
|
|
4345
|
+
...attributes
|
|
4268
4346
|
} = props;
|
|
4269
|
-
const
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
valueProps = {
|
|
4286
|
-
onValueChange: handleChange,
|
|
4287
|
-
value: value !== undefined ? getRadioGroupItemValueAsString(value) : undefined
|
|
4288
|
-
};
|
|
4289
|
-
} else {
|
|
4290
|
-
valueProps = {
|
|
4291
|
-
defaultValue: defaultValue !== undefined ? getRadioGroupItemValueAsString(defaultValue) : undefined
|
|
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);
|
|
4362
|
+
}
|
|
4292
4363
|
};
|
|
4293
4364
|
}
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
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
|
|
4302
4378
|
}
|
|
4303
|
-
}
|
|
4304
|
-
};
|
|
4305
|
-
const RadioGroup = /*#__PURE__*/React.forwardRef(function RadioGroup(props, ref) {
|
|
4306
|
-
const {
|
|
4307
|
-
context,
|
|
4308
|
-
props: otherProps
|
|
4309
|
-
} = useRadioGroup(props);
|
|
4310
|
-
const className = cn('flex items-start gap-y-2', {
|
|
4311
|
-
'flex-wrap gap-x-4 ': otherProps.orientation === 'horizontal',
|
|
4312
|
-
'flex-col': otherProps.orientation === 'vertical'
|
|
4313
|
-
}, otherProps.className);
|
|
4314
|
-
return /*#__PURE__*/React.createElement(RadioGroupContext.Provider, {
|
|
4315
|
-
value: context
|
|
4316
|
-
}, /*#__PURE__*/React.createElement(RadioGroupPrimitive.Root, Object.assign({}, otherProps, {
|
|
4379
|
+
}, /*#__PURE__*/React.createElement("input", Object.assign({}, attributes, {
|
|
4317
4380
|
className: className,
|
|
4318
|
-
"data-taco": "
|
|
4319
|
-
|
|
4320
|
-
|
|
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);
|
|
4321
4400
|
});
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
const RadioItem = props => {
|
|
4325
|
-
const context = React.useContext(MenuRadioGroupContext);
|
|
4401
|
+
const Affix = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Affix(props, ref) {
|
|
4326
4402
|
const {
|
|
4327
4403
|
children,
|
|
4328
|
-
|
|
4329
|
-
|
|
4404
|
+
disabled,
|
|
4405
|
+
type
|
|
4330
4406
|
} = props;
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
}
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
disabled: false
|
|
4349
|
-
});
|
|
4350
|
-
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;
|
|
4351
4424
|
const {
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
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,
|
|
4360
4444
|
ref: ref
|
|
4361
|
-
}))
|
|
4445
|
+
}));
|
|
4362
4446
|
});
|
|
4363
|
-
RadioGroup$1.Item = RadioItem;
|
|
4364
4447
|
|
|
4365
|
-
const
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
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];
|
|
4369
4476
|
};
|
|
4370
4477
|
|
|
4371
|
-
const
|
|
4372
|
-
const
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
}
|
|
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
|
+
};
|
|
4382
4508
|
|
|
4383
|
-
const
|
|
4509
|
+
const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
|
4384
4510
|
const {
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
...props
|
|
4391
|
-
} = externalProps;
|
|
4392
|
-
const [indented, setIndented] = React.useState(false);
|
|
4393
|
-
const [minWidth, setMinWidth] = React.useState(undefined);
|
|
4394
|
-
const [open, setOpen] = reactUseControllableState.useControllableState({
|
|
4395
|
-
// uncontrolled
|
|
4396
|
-
defaultProp,
|
|
4397
|
-
// controlled
|
|
4398
|
-
onChange,
|
|
4399
|
-
prop
|
|
4400
|
-
});
|
|
4401
|
-
const context = React.useMemo(() => ({
|
|
4402
|
-
indented,
|
|
4403
|
-
registerIndentation: () => setIndented(true),
|
|
4404
|
-
minWidth,
|
|
4405
|
-
setMinWidth: width => setMinWidth(width),
|
|
4406
|
-
close: () => setOpen(false)
|
|
4407
|
-
}), [indented, minWidth]);
|
|
4408
|
-
return /*#__PURE__*/React.createElement(MenuContext.Provider, {
|
|
4409
|
-
value: context
|
|
4410
|
-
}, /*#__PURE__*/React.createElement(DropdownMenuPrimitive.Root, Object.assign({}, props, {
|
|
4411
|
-
modal: false,
|
|
4412
|
-
open: open,
|
|
4413
|
-
onOpenChange: setOpen
|
|
4414
|
-
}), trigger && /*#__PURE__*/React.createElement(Trigger$2, {
|
|
4415
|
-
ref: ref
|
|
4416
|
-
}, trigger), children));
|
|
4417
|
-
});
|
|
4418
|
-
Menu$1.Trigger = Trigger$2;
|
|
4419
|
-
Menu$1.Content = Content$2;
|
|
4420
|
-
Menu$1.Item = Item$1;
|
|
4421
|
-
Menu$1.Link = Link;
|
|
4422
|
-
Menu$1.Checkbox = Checkbox;
|
|
4423
|
-
Menu$1.Separator = Separator;
|
|
4424
|
-
Menu$1.Header = Header;
|
|
4425
|
-
Menu$1.RadioGroup = RadioGroup$1;
|
|
4426
|
-
|
|
4427
|
-
const useIntersectionObserver = (ref, offset) => {
|
|
4428
|
-
const [intersectedIndexes, setIntersectedIndexes] = React__default.useState({});
|
|
4429
|
-
const handleIntersection = (entries, observer) => {
|
|
4430
|
-
if (observer.root) {
|
|
4431
|
-
const children = Array.from(observer.root.children);
|
|
4432
|
-
const map = {};
|
|
4433
|
-
entries.forEach(entry => {
|
|
4434
|
-
// entries only contains the items being intersected not all children of the ref
|
|
4435
|
-
// so use root and the the entry being intersected to find its real index
|
|
4436
|
-
// on first mount this is different - all children are present
|
|
4437
|
-
map[children.indexOf(entry.target)] = entry.isIntersecting;
|
|
4438
|
-
});
|
|
4439
|
-
setIntersectedIndexes(prev => ({
|
|
4440
|
-
...prev,
|
|
4441
|
-
...map
|
|
4442
|
-
}));
|
|
4443
|
-
}
|
|
4444
|
-
};
|
|
4445
|
-
const intersectedChildIndex = React__default.useMemo(() => {
|
|
4446
|
-
const index = Object.values(intersectedIndexes).indexOf(false);
|
|
4447
|
-
return index > -1 ? index : undefined;
|
|
4448
|
-
}, [intersectedIndexes]);
|
|
4449
|
-
const hasRootMargin = intersectedChildIndex !== undefined && offset;
|
|
4511
|
+
delay = 500,
|
|
4512
|
+
label,
|
|
4513
|
+
...otherProps
|
|
4514
|
+
} = props;
|
|
4515
|
+
const [visible, setVisibility] = React__default.useState(!delay);
|
|
4450
4516
|
React__default.useEffect(() => {
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
rootMargin: hasRootMargin ? `0px -${offset}px 0px 0px` : undefined,
|
|
4455
|
-
threshold: 1
|
|
4456
|
-
});
|
|
4457
|
-
if (observer.root) {
|
|
4458
|
-
Array.from(observer.root.children).forEach(item => {
|
|
4459
|
-
if (item.getAttribute('data-intersection-observer') !== 'ignore') {
|
|
4460
|
-
observer.observe(item);
|
|
4461
|
-
}
|
|
4462
|
-
});
|
|
4517
|
+
let timeout;
|
|
4518
|
+
if (delay) {
|
|
4519
|
+
timeout = window.setTimeout(() => setVisibility(true), delay);
|
|
4463
4520
|
}
|
|
4464
4521
|
return () => {
|
|
4465
|
-
|
|
4522
|
+
if (timeout) {
|
|
4523
|
+
clearTimeout(timeout);
|
|
4524
|
+
}
|
|
4466
4525
|
};
|
|
4467
|
-
}, [
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
const
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
const intersectedChildIndex = useIntersectionObserver(internalRef, OFFSET);
|
|
4488
|
-
const children = React__default.Children.toArray(props.children);
|
|
4489
|
-
const hidden = intersectedChildIndex !== undefined ? children.slice(intersectedChildIndex) : [];
|
|
4490
|
-
return /*#__PURE__*/React__default.createElement(Group, Object.assign({}, props, {
|
|
4491
|
-
ref: internalRef
|
|
4492
|
-
}), children.map((child, index) => /*#__PURE__*/React__default.cloneElement(child, {
|
|
4493
|
-
className: cn(child.props.className, {
|
|
4494
|
-
visible: intersectedChildIndex === undefined || index < intersectedChildIndex,
|
|
4495
|
-
'invisible order-[100] pointer-events-none': intersectedChildIndex !== undefined && index >= intersectedChildIndex
|
|
4496
|
-
})
|
|
4497
|
-
})), hidden.length ? /*#__PURE__*/React__default.createElement(IconButton, {
|
|
4498
|
-
className: "sticky right-0 order-[99]",
|
|
4499
|
-
"data-intesection-observer": "ignore",
|
|
4500
|
-
icon: "more",
|
|
4501
|
-
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({
|
|
4502
|
-
key: index
|
|
4503
|
-
}, sanitizeButtonPropsForMenuItem(button.props))))))
|
|
4504
|
-
}) : 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));
|
|
4505
4546
|
});
|
|
4506
4547
|
|
|
4507
|
-
const
|
|
4508
|
-
const
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
onPreviousClick,
|
|
4516
|
-
value = new Date()
|
|
4517
|
-
}) => {
|
|
4518
|
-
const {
|
|
4519
|
-
texts: {
|
|
4520
|
-
calendar: {
|
|
4521
|
-
actions,
|
|
4522
|
-
months
|
|
4523
|
-
}
|
|
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);
|
|
4524
4556
|
}
|
|
4525
|
-
}
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
month
|
|
4530
|
-
} = event.target.form;
|
|
4531
|
-
onMonthChange(new Date(year.value, month.value));
|
|
4532
|
-
};
|
|
4533
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4534
|
-
className: "mb-2 flex items-center justify-between"
|
|
4535
|
-
}, /*#__PURE__*/React.createElement("form", {
|
|
4536
|
-
className: "inline-flex space-x-1"
|
|
4537
|
-
}, /*#__PURE__*/React.createElement("select", {
|
|
4538
|
-
className: "h-8 px-2",
|
|
4539
|
-
name: "month",
|
|
4540
|
-
onChange: handleChange,
|
|
4541
|
-
value: value.getMonth()
|
|
4542
|
-
}, months.map((month, i) => /*#__PURE__*/React.createElement("option", {
|
|
4543
|
-
key: month,
|
|
4544
|
-
value: i
|
|
4545
|
-
}, month))), /*#__PURE__*/React.createElement("select", {
|
|
4546
|
-
className: "h-8 px-2",
|
|
4547
|
-
name: "year",
|
|
4548
|
-
onChange: handleChange,
|
|
4549
|
-
value: value.getFullYear()
|
|
4550
|
-
}, years.map(year => /*#__PURE__*/React.createElement("option", {
|
|
4551
|
-
key: year,
|
|
4552
|
-
value: year
|
|
4553
|
-
}, String(year))))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconButton, {
|
|
4554
|
-
appearance: "discrete",
|
|
4555
|
-
icon: "chevron-left",
|
|
4556
|
-
"aria-label": actions.previousMonth,
|
|
4557
|
-
onClick: () => onPreviousClick(),
|
|
4558
|
-
rounded: true
|
|
4559
|
-
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
4560
|
-
appearance: "discrete",
|
|
4561
|
-
icon: "chevron-right",
|
|
4562
|
-
"aria-label": actions.nextMonth,
|
|
4563
|
-
onClick: () => onNextClick(),
|
|
4564
|
-
rounded: true
|
|
4565
|
-
})));
|
|
4566
|
-
});
|
|
4567
|
-
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) {
|
|
4568
4561
|
const {
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
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,
|
|
4572
4578
|
...otherProps
|
|
4573
4579
|
} = props;
|
|
4580
|
+
const listRef = useMergedRef(ref);
|
|
4581
|
+
const itemRefs = React.useMemo(() => data.map(() => /*#__PURE__*/React.createRef()), [data]);
|
|
4574
4582
|
const {
|
|
4575
|
-
locale,
|
|
4576
4583
|
texts
|
|
4577
4584
|
} = useLocalization();
|
|
4578
|
-
const
|
|
4585
|
+
const {
|
|
4586
|
+
scrollTo
|
|
4587
|
+
} = useListScrollTo(listRef, itemRefs);
|
|
4579
4588
|
React.useEffect(() => {
|
|
4580
|
-
|
|
4581
|
-
|
|
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
|
+
});
|
|
4582
4595
|
}
|
|
4583
|
-
}, [
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
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);
|
|
4587
4611
|
}
|
|
4588
|
-
handleChange(date, event);
|
|
4589
4612
|
};
|
|
4590
|
-
const
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
handleChange(today);
|
|
4597
|
-
};
|
|
4598
|
-
const className = cn('flex bg-white text-xs p-4', otherProps.className);
|
|
4599
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4600
|
-
"data-taco": "calendar"
|
|
4601
|
-
}, /*#__PURE__*/React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
|
4602
|
-
className: className,
|
|
4603
|
-
month: visibleMonth,
|
|
4604
|
-
selectedDays: value,
|
|
4605
|
-
locale: locale.substring(0, 2),
|
|
4606
|
-
firstDayOfWeek: 1,
|
|
4607
|
-
months: texts.calendar.months,
|
|
4608
|
-
weekdaysShort: texts.calendar.weekdaysShort,
|
|
4609
|
-
navbarElement: navProps => /*#__PURE__*/React.createElement(Navbar, Object.assign({}, navProps, {
|
|
4610
|
-
onMonthChange: setVisibleMonth,
|
|
4611
|
-
value: visibleMonth
|
|
4612
|
-
})),
|
|
4613
|
-
onDayClick: handleDayClick,
|
|
4614
|
-
onMonthChange: setVisibleMonth,
|
|
4615
|
-
onTodayButtonClick: handleCalendarClickToday,
|
|
4616
|
-
captionElement: () => null,
|
|
4617
|
-
todayButton: texts.calendar.actions.today,
|
|
4618
|
-
numberOfMonths: 1,
|
|
4619
|
-
ref: ref,
|
|
4620
|
-
disabledDays: disabledDays
|
|
4621
|
-
})));
|
|
4622
|
-
});
|
|
4623
|
-
|
|
4624
|
-
const Content$3 = /*#__PURE__*/React.forwardRef(function CardContent(externalProps, ref) {
|
|
4625
|
-
const {
|
|
4626
|
-
noPadding,
|
|
4627
|
-
...props
|
|
4628
|
-
} = externalProps;
|
|
4629
|
-
const className = cn('flex-grow overflow-auto', {
|
|
4630
|
-
'mx-4 mb-4': !noPadding
|
|
4631
|
-
}, props.className);
|
|
4632
|
-
return /*#__PURE__*/React.createElement("div", Object.assign({}, props, {
|
|
4633
|
-
className: className,
|
|
4634
|
-
ref: ref
|
|
4635
|
-
}));
|
|
4636
|
-
});
|
|
4637
|
-
const Card = /*#__PURE__*/React.forwardRef(function Card(props, ref) {
|
|
4638
|
-
const {
|
|
4639
|
-
title,
|
|
4640
|
-
menu,
|
|
4641
|
-
children
|
|
4642
|
-
} = props;
|
|
4643
|
-
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);
|
|
4644
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4645
|
-
className: className,
|
|
4646
|
-
"data-taco": "card",
|
|
4647
|
-
ref: ref
|
|
4648
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
4649
|
-
className: "mx-4 mt-4 mb-2 flex"
|
|
4650
|
-
}, title && /*#__PURE__*/React.createElement("h4", {
|
|
4651
|
-
className: "mb-0 flex-grow text-left"
|
|
4652
|
-
}, title), menu ? /*#__PURE__*/React.createElement(IconButton, {
|
|
4653
|
-
icon: "ellipsis-horizontal",
|
|
4654
|
-
appearance: "discrete",
|
|
4655
|
-
menu: menu,
|
|
4656
|
-
className: "-mt-[4px]"
|
|
4657
|
-
}) : null), children);
|
|
4658
|
-
});
|
|
4659
|
-
Card.Content = Content$3;
|
|
4660
|
-
|
|
4661
|
-
// React 18 has this built-in, when we upgrade this hook should be removed and the uuid dependency should be removed
|
|
4662
|
-
const useId = nativeId => {
|
|
4663
|
-
return React__default.useMemo(() => nativeId !== null && nativeId !== void 0 ? nativeId : uuid.v4(), []);
|
|
4664
|
-
};
|
|
4665
|
-
|
|
4666
|
-
const Checkbox$1 = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4667
|
-
const {
|
|
4668
|
-
checked,
|
|
4669
|
-
highlighted,
|
|
4670
|
-
indeterminate,
|
|
4671
|
-
invalid,
|
|
4672
|
-
label,
|
|
4673
|
-
onChange,
|
|
4674
|
-
...otherProps
|
|
4675
|
-
} = props;
|
|
4676
|
-
const id = useId(props.id);
|
|
4677
|
-
const className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 mt-[0.1rem] focus:yt-focus',
|
|
4678
|
-
//hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]
|
|
4679
|
-
{
|
|
4680
|
-
'border-grey-300 text-blue-500 hover:text-blue-300 focus:border-blue-500 focus:hover:border-blue-300': !props.disabled && !invalid,
|
|
4681
|
-
'border-grey-200 text-blue-300 cursor-not-allowed': props.disabled,
|
|
4682
|
-
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
|
4683
|
-
'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,
|
|
4684
|
-
'self-start': !!label
|
|
4685
|
-
}, props.className);
|
|
4686
|
-
let handleChange;
|
|
4687
|
-
if (onChange) {
|
|
4688
|
-
handleChange = checked => onChange(checked === 'indeterminate' ? false : checked);
|
|
4689
|
-
}
|
|
4690
|
-
let labelledByProps = null;
|
|
4691
|
-
if (label) {
|
|
4692
|
-
labelledByProps = {
|
|
4693
|
-
'aria-labelledby': `${id}-label`,
|
|
4694
|
-
id
|
|
4695
|
-
};
|
|
4696
|
-
}
|
|
4697
|
-
// the enter keyboard shortcut isn't supported by default, but we want it
|
|
4698
|
-
const handleKeyDown = event => {
|
|
4699
|
-
if (event.key === 'Enter') {
|
|
4700
|
-
event.currentTarget.click();
|
|
4701
|
-
}
|
|
4702
|
-
};
|
|
4703
|
-
const element = /*#__PURE__*/React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, labelledByProps, {
|
|
4704
|
-
"data-taco": "checkbox",
|
|
4705
|
-
checked: indeterminate ? 'indeterminate' : checked,
|
|
4706
|
-
className: className,
|
|
4707
|
-
onCheckedChange: handleChange,
|
|
4708
|
-
onKeyDown: handleKeyDown,
|
|
4709
|
-
ref: ref
|
|
4710
|
-
}), /*#__PURE__*/React.createElement(CheckboxPrimitive.Indicator, {
|
|
4711
|
-
className: "flex h-full w-full"
|
|
4712
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
4713
|
-
name: indeterminate ? 'line' : 'tick',
|
|
4714
|
-
className: "!h-full !w-full"
|
|
4715
|
-
})));
|
|
4716
|
-
if (label) {
|
|
4717
|
-
const labelContainerClassName = cn('flex items-center cursor-pointer gap-2', {
|
|
4718
|
-
'cursor-not-allowed text-grey-300': props.disabled
|
|
4719
|
-
});
|
|
4720
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
4721
|
-
className: labelContainerClassName
|
|
4722
|
-
}, element, /*#__PURE__*/React.createElement("label", {
|
|
4723
|
-
htmlFor: id,
|
|
4724
|
-
id: `${id}-label`
|
|
4725
|
-
}, label));
|
|
4726
|
-
}
|
|
4727
|
-
return element;
|
|
4728
|
-
});
|
|
4729
|
-
Checkbox$1.displayName = 'Checkbox';
|
|
4730
|
-
|
|
4731
|
-
const getInputClasses = props => {
|
|
4732
|
-
const disabled = props.disabled || !!props['aria-disabled'];
|
|
4733
|
-
const readOnly = props.readOnly || !!props['aria-readonly'];
|
|
4734
|
-
const invalid = props.invalid || !!props['aria-invalid'];
|
|
4735
|
-
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)]', {
|
|
4736
|
-
'bg-white': !props.highlighted && !readOnly,
|
|
4737
|
-
// default
|
|
4738
|
-
'border-grey-300 focus:border-blue-300 focus:yt-focus': !invalid,
|
|
4739
|
-
'hover:shadow-[0_0_0.1rem_theme(colors.grey.500)] active:border-blue-700': !invalid && !disabled,
|
|
4740
|
-
// disabled
|
|
4741
|
-
'border-grey-200 text-opacity-25 cursor-not-allowed placeholder:text-grey-700': disabled,
|
|
4742
|
-
// highlighted
|
|
4743
|
-
'bg-[rgba(255,255,0,0.075)]': props.highlighted && disabled,
|
|
4744
|
-
'bg-[rgba(255,255,0,0.2)]': props.highlighted && !disabled,
|
|
4745
|
-
// invalid
|
|
4746
|
-
'border-red focus:border-red-300 focus:yt-focus-red active:border-red-700': invalid,
|
|
4747
|
-
'hover:shadow-[0_0_0.15rem_theme(colors.red.500)]': invalid && !disabled,
|
|
4748
|
-
// readOnly
|
|
4749
|
-
'cursor-not-allowed text-black bg-grey-200': readOnly
|
|
4750
|
-
});
|
|
4751
|
-
};
|
|
4752
|
-
const getButtonStateClasses = invalid => {
|
|
4753
|
-
if (invalid) {
|
|
4754
|
-
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';
|
|
4755
|
-
}
|
|
4756
|
-
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';
|
|
4757
|
-
};
|
|
4758
|
-
|
|
4759
|
-
const debounce = (fn, delay) => {
|
|
4760
|
-
let timeoutId;
|
|
4761
|
-
return function (...args) {
|
|
4762
|
-
clearTimeout(timeoutId);
|
|
4763
|
-
timeoutId = setTimeout(() => fn.apply(this, args), delay);
|
|
4764
|
-
};
|
|
4765
|
-
};
|
|
4766
|
-
|
|
4767
|
-
const getVisibility = element => Boolean(element && (element.offsetWidth || element.offsetHeight || element.getClientRects().length));
|
|
4768
|
-
const useBoundingClientRectListener = (ref, dependencies) => {
|
|
4769
|
-
const [dimensions, setDimensions] = React.useState(undefined);
|
|
4770
|
-
const isRefElementVisible = getVisibility(ref.current);
|
|
4771
|
-
const [visibility, setVisibility] = React.useState(isRefElementVisible);
|
|
4772
|
-
const resize = () => {
|
|
4773
|
-
if (visibility) {
|
|
4774
|
-
var _ref$current;
|
|
4775
|
-
setDimensions((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect());
|
|
4776
|
-
}
|
|
4777
|
-
};
|
|
4778
|
-
React.useEffect(() => {
|
|
4779
|
-
const timeout = setTimeout(resize, 0);
|
|
4780
|
-
const debouncedResize = debounce(resize, 250);
|
|
4781
|
-
window.addEventListener('resize', debouncedResize);
|
|
4782
|
-
return () => {
|
|
4783
|
-
clearTimeout(timeout);
|
|
4784
|
-
window.removeEventListener('resize', debouncedResize);
|
|
4785
|
-
};
|
|
4786
|
-
}, [ref.current, visibility]);
|
|
4787
|
-
React.useEffect(() => {
|
|
4788
|
-
const newRefElementVisibility = getVisibility(ref.current);
|
|
4789
|
-
if (visibility !== newRefElementVisibility) {
|
|
4790
|
-
// When visibility of an element changes, then the new visibility of the element can only be checked after the
|
|
4791
|
-
// component has rendered. That's why the visibility check is inside the useEffect. This useEffect will cause
|
|
4792
|
-
// the consumer to rerender and that will cause the above hook to recalculate the dimensions
|
|
4793
|
-
setVisibility(newRefElementVisibility);
|
|
4794
|
-
}
|
|
4795
|
-
});
|
|
4796
|
-
React.useEffect(() => {
|
|
4797
|
-
if (dependencies) {
|
|
4798
|
-
var _ref$current2;
|
|
4799
|
-
setDimensions((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.getBoundingClientRect());
|
|
4800
|
-
}
|
|
4801
|
-
}, dependencies);
|
|
4802
|
-
return dimensions;
|
|
4803
|
-
};
|
|
4804
|
-
|
|
4805
|
-
const validSetSelectionRangeTypes = ['text', 'search', 'url', 'tel', 'password'];
|
|
4806
|
-
const InputWithoutDeprecatedFeatures = /*#__PURE__*/React.forwardRef(function InputWithoutDeprecatedFeatures(props, ref) {
|
|
4807
|
-
const {
|
|
4808
|
-
highlighted,
|
|
4809
|
-
invalid,
|
|
4810
|
-
onKeyDown,
|
|
4811
|
-
postfix,
|
|
4812
|
-
prefix,
|
|
4813
|
-
type = 'text',
|
|
4814
|
-
...attributes
|
|
4815
|
-
} = props;
|
|
4816
|
-
const internalRef = useMergedRef(ref);
|
|
4817
|
-
let handleKeyDown = onKeyDown;
|
|
4818
|
-
// home and end keys only navigate to the start/end of input value if the input container does not scroll
|
|
4819
|
-
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
|
4820
|
-
// so we manually override it to ensure _our_ desired behaviour remains intact
|
|
4821
|
-
// only the 'text', 'search', 'url', 'tel', 'password' input types support setSelectionRange
|
|
4822
|
-
if (validSetSelectionRangeTypes.includes(type)) {
|
|
4823
|
-
handleKeyDown = event => {
|
|
4824
|
-
if (!event.shiftKey && (event.key === 'Home' || event.key === 'End')) {
|
|
4825
|
-
event.preventDefault();
|
|
4826
|
-
const position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
|
4827
|
-
event.currentTarget.setSelectionRange(position, position);
|
|
4828
|
-
}
|
|
4829
|
-
if (typeof onKeyDown === 'function') {
|
|
4830
|
-
onKeyDown(event);
|
|
4831
|
-
}
|
|
4832
|
-
};
|
|
4833
|
-
}
|
|
4834
|
-
const prefixRef = React.useRef(null);
|
|
4835
|
-
const prefixRect = useBoundingClientRectListener(prefixRef);
|
|
4836
|
-
const postfixRef = React.useRef(null);
|
|
4837
|
-
const postfixRect = useBoundingClientRectListener(postfixRef);
|
|
4838
|
-
const className = cn(getInputClasses(props), {
|
|
4839
|
-
'pl-8': !!prefix,
|
|
4840
|
-
'pr-8': !!postfix
|
|
4841
|
-
}, attributes.className);
|
|
4842
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4843
|
-
className: "relative inline-flex w-full",
|
|
4844
|
-
"data-taco": "input-container",
|
|
4845
|
-
style: {
|
|
4846
|
-
opacity: 0.999
|
|
4847
|
-
}
|
|
4848
|
-
}, /*#__PURE__*/React.createElement("input", Object.assign({}, attributes, {
|
|
4849
|
-
className: className,
|
|
4850
|
-
"data-taco": "input",
|
|
4851
|
-
onKeyDown: handleKeyDown,
|
|
4852
|
-
ref: internalRef,
|
|
4853
|
-
style: {
|
|
4854
|
-
paddingLeft: prefixRect ? `${prefixRect.width - 1}px` : undefined,
|
|
4855
|
-
paddingRight: postfixRect ? `${postfixRect.width - 1}px` : undefined
|
|
4856
|
-
},
|
|
4857
|
-
type: type
|
|
4858
|
-
})), prefix ? /*#__PURE__*/React.createElement(Affix, {
|
|
4859
|
-
type: "prefix",
|
|
4860
|
-
children: prefix,
|
|
4861
|
-
disabled: attributes.disabled,
|
|
4862
|
-
ref: prefixRef
|
|
4863
|
-
}) : null, postfix ? /*#__PURE__*/React.createElement(Affix, {
|
|
4864
|
-
type: "postfix",
|
|
4865
|
-
children: postfix,
|
|
4866
|
-
disabled: attributes.disabled,
|
|
4867
|
-
ref: postfixRef
|
|
4868
|
-
}) : null);
|
|
4869
|
-
});
|
|
4870
|
-
const Affix = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function Affix(props, ref) {
|
|
4871
|
-
const {
|
|
4872
|
-
children,
|
|
4873
|
-
disabled,
|
|
4874
|
-
type
|
|
4875
|
-
} = props;
|
|
4876
|
-
if (children) {
|
|
4877
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
4878
|
-
className: cn('group absolute top-0 flex h-full items-center justify-center px-2',
|
|
4879
|
-
// icon
|
|
4880
|
-
'[&_[data-taco="icon"]]:!h-5 [&_[data-taco="icon"]]:!w-5', {
|
|
4881
|
-
'text-grey-300': disabled,
|
|
4882
|
-
'text-grey-700': !disabled,
|
|
4883
|
-
'left-0 [&>button]:!-ml-2': type === 'prefix',
|
|
4884
|
-
'right-0 [&>button]:!-mr-2': type === 'postfix'
|
|
4885
|
-
}),
|
|
4886
|
-
ref: ref
|
|
4887
|
-
}, children);
|
|
4888
|
-
}
|
|
4889
|
-
return null;
|
|
4890
|
-
}));
|
|
4891
|
-
const Input = /*#__PURE__*/React.forwardRef(function LegacyInput(props, ref) {
|
|
4892
|
-
var _attributes$postfix;
|
|
4893
|
-
const {
|
|
4894
|
-
button,
|
|
4895
|
-
icon,
|
|
4896
|
-
...attributes
|
|
4897
|
-
} = props;
|
|
4898
|
-
let postfix;
|
|
4899
|
-
if (button) {
|
|
4900
|
-
const disabled = button.props.disabled || attributes.disabled;
|
|
4901
|
-
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);
|
|
4902
|
-
postfix = /*#__PURE__*/React.cloneElement(button, {
|
|
4903
|
-
className: buttonClassName,
|
|
4904
|
-
disabled
|
|
4905
|
-
});
|
|
4906
|
-
} else if (icon) {
|
|
4907
|
-
postfix = typeof icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
4908
|
-
name: icon
|
|
4909
|
-
}) : icon;
|
|
4910
|
-
}
|
|
4911
|
-
return /*#__PURE__*/React.createElement(InputWithoutDeprecatedFeatures, Object.assign({}, attributes, {
|
|
4912
|
-
postfix: (_attributes$postfix = attributes.postfix) !== null && _attributes$postfix !== void 0 ? _attributes$postfix : postfix,
|
|
4913
|
-
ref: ref
|
|
4914
|
-
}));
|
|
4915
|
-
});
|
|
4916
|
-
|
|
4917
|
-
const getNextIndexFromKey = (key, length, index, direction = 'vertical') => {
|
|
4918
|
-
const previousKey = direction === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
|
|
4919
|
-
const nextKey = direction === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
|
|
4920
|
-
switch (key) {
|
|
4921
|
-
case previousKey:
|
|
4922
|
-
return index !== undefined ? index - 1 < 0 ? 0 : index - 1 : index;
|
|
4923
|
-
case nextKey:
|
|
4924
|
-
return index !== undefined ? index + 1 >= length ? index : index + 1 : index;
|
|
4925
|
-
case 'Home':
|
|
4926
|
-
return 0;
|
|
4927
|
-
case 'End':
|
|
4928
|
-
return length - 1;
|
|
4929
|
-
default:
|
|
4930
|
-
return;
|
|
4931
|
-
}
|
|
4932
|
-
};
|
|
4933
|
-
const useListKeyboardNavigation = (length = 0, options = {
|
|
4934
|
-
direction: 'vertical'
|
|
4935
|
-
}) => {
|
|
4936
|
-
const [index, setIndex] = React__default.useState(options.initialIndex);
|
|
4937
|
-
const getNextIndex = event => {
|
|
4938
|
-
const nextIndex = getNextIndexFromKey(event.key, length, index, options.direction);
|
|
4939
|
-
if (nextIndex !== undefined) {
|
|
4940
|
-
event.preventDefault();
|
|
4941
|
-
}
|
|
4942
|
-
return nextIndex;
|
|
4943
|
-
};
|
|
4944
|
-
return [index, setIndex, getNextIndex];
|
|
4945
|
-
};
|
|
4946
|
-
|
|
4947
|
-
const scrollToChildElement = (parent, child) => {
|
|
4948
|
-
const clientHeight = parent.clientHeight;
|
|
4949
|
-
if (parent.scrollHeight > clientHeight) {
|
|
4950
|
-
const scrollTop = parent.scrollTop;
|
|
4951
|
-
const scrollBottom = clientHeight + scrollTop;
|
|
4952
|
-
const childBottom = child.offsetTop + child.offsetHeight;
|
|
4953
|
-
if (childBottom > scrollBottom) {
|
|
4954
|
-
parent.scrollTop = childBottom - clientHeight;
|
|
4955
|
-
} else if (child.offsetTop < scrollTop) {
|
|
4956
|
-
parent.scrollTop = child.offsetTop;
|
|
4957
|
-
}
|
|
4958
|
-
}
|
|
4959
|
-
};
|
|
4960
|
-
const useListScrollTo = (internalRef, itemRefs) => {
|
|
4961
|
-
const scrollTo = index => {
|
|
4962
|
-
if (internalRef && internalRef.current) {
|
|
4963
|
-
if (index !== undefined) {
|
|
4964
|
-
const activeRef = itemRefs[index];
|
|
4965
|
-
if (activeRef && activeRef.current) {
|
|
4966
|
-
scrollToChildElement(internalRef.current, activeRef.current);
|
|
4967
|
-
}
|
|
4968
|
-
} else {
|
|
4969
|
-
internalRef.current.scrollTop = 0;
|
|
4970
|
-
}
|
|
4971
|
-
}
|
|
4972
|
-
};
|
|
4973
|
-
return {
|
|
4974
|
-
scrollTo
|
|
4975
|
-
};
|
|
4976
|
-
};
|
|
4977
|
-
|
|
4978
|
-
const Spinner = /*#__PURE__*/React__default.forwardRef(function Spinner(props, ref) {
|
|
4979
|
-
const {
|
|
4980
|
-
delay = 500,
|
|
4981
|
-
label,
|
|
4982
|
-
...otherProps
|
|
4983
|
-
} = props;
|
|
4984
|
-
const [visible, setVisibility] = React__default.useState(!delay);
|
|
4985
|
-
React__default.useEffect(() => {
|
|
4986
|
-
let timeout;
|
|
4987
|
-
if (delay) {
|
|
4988
|
-
timeout = window.setTimeout(() => setVisibility(true), delay);
|
|
4989
|
-
}
|
|
4990
|
-
return () => {
|
|
4991
|
-
if (timeout) {
|
|
4992
|
-
clearTimeout(timeout);
|
|
4993
|
-
}
|
|
4994
|
-
};
|
|
4995
|
-
}, [delay]);
|
|
4996
|
-
if (!visible) {
|
|
4997
|
-
return null;
|
|
4998
|
-
}
|
|
4999
|
-
const className = cn('inline-flex flex-col relative items-center', otherProps.className);
|
|
5000
|
-
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, otherProps, {
|
|
5001
|
-
className: className,
|
|
5002
|
-
"data-taco": "spinner",
|
|
5003
|
-
ref: ref
|
|
5004
|
-
}), /*#__PURE__*/React__default.createElement("svg", {
|
|
5005
|
-
className: "h-10 w-10 animate-[spinnerRotation_2s_linear_infinite]",
|
|
5006
|
-
viewBox: "0 0 100 100",
|
|
5007
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
5008
|
-
}, /*#__PURE__*/React__default.createElement("circle", {
|
|
5009
|
-
cx: "50",
|
|
5010
|
-
cy: "50",
|
|
5011
|
-
r: "45"
|
|
5012
|
-
})), label && /*#__PURE__*/React__default.createElement("span", {
|
|
5013
|
-
className: "mt-4"
|
|
5014
|
-
}, label));
|
|
5015
|
-
});
|
|
5016
|
-
|
|
5017
|
-
const getId = (id, value) => `${id}_${value}`;
|
|
5018
|
-
const getNextEnabledItem = (event, data, index) => {
|
|
5019
|
-
const nextIndex = getNextIndexFromKey(event.key, data.length, index);
|
|
5020
|
-
if (nextIndex) {
|
|
5021
|
-
if (nextIndex === index) {
|
|
5022
|
-
return index;
|
|
5023
|
-
} else if (data[nextIndex] && data[nextIndex].disabled) {
|
|
5024
|
-
return getNextEnabledItem(event, data, nextIndex);
|
|
5025
|
-
}
|
|
5026
|
-
}
|
|
5027
|
-
return nextIndex;
|
|
5028
|
-
};
|
|
5029
|
-
const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(props, ref) {
|
|
5030
|
-
const {
|
|
5031
|
-
data,
|
|
5032
|
-
disabled,
|
|
5033
|
-
highlighted,
|
|
5034
|
-
id,
|
|
5035
|
-
invalid: _,
|
|
5036
|
-
loading,
|
|
5037
|
-
onChange: setCurrentIndex,
|
|
5038
|
-
onClick,
|
|
5039
|
-
onFocus,
|
|
5040
|
-
onKeyDown,
|
|
5041
|
-
readOnly,
|
|
5042
|
-
scrollOnFocus = false,
|
|
5043
|
-
value: currentIndex,
|
|
5044
|
-
multiselect,
|
|
5045
|
-
selectedIndexes = [],
|
|
5046
|
-
allOptionsSelected = false,
|
|
5047
|
-
...otherProps
|
|
5048
|
-
} = props;
|
|
5049
|
-
const listRef = useMergedRef(ref);
|
|
5050
|
-
const itemRefs = React.useMemo(() => data.map(() => /*#__PURE__*/React.createRef()), [data]);
|
|
5051
|
-
const {
|
|
5052
|
-
texts
|
|
5053
|
-
} = useLocalization();
|
|
5054
|
-
const {
|
|
5055
|
-
scrollTo
|
|
5056
|
-
} = useListScrollTo(listRef, itemRefs);
|
|
5057
|
-
React.useEffect(() => {
|
|
5058
|
-
var _itemRefs$currentInde;
|
|
5059
|
-
if (currentIndex && (_itemRefs$currentInde = itemRefs[currentIndex]) !== null && _itemRefs$currentInde !== void 0 && _itemRefs$currentInde.current) {
|
|
5060
|
-
var _itemRefs$currentInde2;
|
|
5061
|
-
(_itemRefs$currentInde2 = itemRefs[currentIndex].current) === null || _itemRefs$currentInde2 === void 0 ? void 0 : _itemRefs$currentInde2.scrollIntoView({
|
|
5062
|
-
block: 'center'
|
|
5063
|
-
});
|
|
5064
|
-
}
|
|
5065
|
-
}, []);
|
|
5066
|
-
React.useEffect(() => {
|
|
5067
|
-
scrollTo(currentIndex);
|
|
5068
|
-
}, [currentIndex]);
|
|
5069
|
-
const handleKeyDown = event => {
|
|
5070
|
-
const nextIndex = getNextEnabledItem(event, data, currentIndex);
|
|
5071
|
-
if (nextIndex !== undefined && nextIndex !== currentIndex) {
|
|
5072
|
-
event.preventDefault();
|
|
5073
|
-
scrollTo(nextIndex);
|
|
5074
|
-
setCurrentIndex(nextIndex);
|
|
5075
|
-
}
|
|
5076
|
-
if (onKeyDown) {
|
|
5077
|
-
event.persist();
|
|
5078
|
-
const index = nextIndex !== undefined ? nextIndex : currentIndex;
|
|
5079
|
-
onKeyDown(event, index);
|
|
5080
|
-
}
|
|
5081
|
-
};
|
|
5082
|
-
const handleClick = index => event => {
|
|
5083
|
-
setCurrentIndex(index);
|
|
5084
|
-
if (onClick) {
|
|
5085
|
-
event.persist();
|
|
5086
|
-
onClick(event, index);
|
|
5087
|
-
}
|
|
4613
|
+
const handleClick = index => event => {
|
|
4614
|
+
setCurrentIndex(index);
|
|
4615
|
+
if (onClick) {
|
|
4616
|
+
event.persist();
|
|
4617
|
+
onClick(event, index);
|
|
4618
|
+
}
|
|
5088
4619
|
};
|
|
5089
4620
|
const handleFocus = event => {
|
|
5090
4621
|
if (scrollOnFocus) {
|
|
@@ -5153,7 +4684,7 @@ const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(pro
|
|
|
5153
4684
|
...optionProps
|
|
5154
4685
|
}) => /*#__PURE__*/React.createElement("li", Object.assign({}, optionProps), icon, /*#__PURE__*/React.createElement("span", {
|
|
5155
4686
|
className: "flex-grow truncate text-left"
|
|
5156
|
-
}, children), multiselect && /*#__PURE__*/React.createElement(Checkbox
|
|
4687
|
+
}, children), multiselect && /*#__PURE__*/React.createElement(Checkbox
|
|
5157
4688
|
// In multiselect variant, this checkbox only acts as visual representation of item being selected,
|
|
5158
4689
|
// so need to be taken out of screen reader scope.
|
|
5159
4690
|
, {
|
|
@@ -5219,7 +4750,7 @@ const getSelectedIndexesFromValue = (data, value) => {
|
|
|
5219
4750
|
if (typeof value !== 'string') return [];
|
|
5220
4751
|
return value.split(',').map(v => data.findIndex(o => String(o.value) === v)).filter(v => v !== -1);
|
|
5221
4752
|
};
|
|
5222
|
-
const findByValue
|
|
4753
|
+
const findByValue = (data, value) => {
|
|
5223
4754
|
return data.find(option => getValue(option.value) === getValue(value));
|
|
5224
4755
|
};
|
|
5225
4756
|
const searchForString = (child, value, strategy = 'includes') => {
|
|
@@ -5430,7 +4961,7 @@ const useCombobox = ({
|
|
|
5430
4961
|
return;
|
|
5431
4962
|
}
|
|
5432
4963
|
if (onChange && event.target.value !== value) {
|
|
5433
|
-
const item = findByValue
|
|
4964
|
+
const item = findByValue(flattenedData, event.target.value);
|
|
5434
4965
|
event.detail = sanitizeItem(item);
|
|
5435
4966
|
const parents = getOptionParents(flattenedData, item === null || item === void 0 ? void 0 : item.path);
|
|
5436
4967
|
if (parents !== null && parents.length > 0) {
|
|
@@ -5815,7 +5346,7 @@ const PopoverContext = /*#__PURE__*/React.createContext({
|
|
|
5815
5346
|
props: {},
|
|
5816
5347
|
ref: null
|
|
5817
5348
|
});
|
|
5818
|
-
const Trigger$
|
|
5349
|
+
const Trigger$2 = /*#__PURE__*/React.forwardRef(function PopoverAnchor(props, externalRef) {
|
|
5819
5350
|
var _props$children;
|
|
5820
5351
|
const {
|
|
5821
5352
|
ref: parentRef,
|
|
@@ -5844,7 +5375,7 @@ const RenderPropWrapper = /*#__PURE__*/React.forwardRef(function RenderPropWrapp
|
|
|
5844
5375
|
ref
|
|
5845
5376
|
});
|
|
5846
5377
|
});
|
|
5847
|
-
const Content$
|
|
5378
|
+
const Content$3 = /*#__PURE__*/React.forwardRef(function PopoverContent(props, ref) {
|
|
5848
5379
|
const {
|
|
5849
5380
|
placement: side,
|
|
5850
5381
|
...popoverContentProps
|
|
@@ -5893,10 +5424,10 @@ const Popover = /*#__PURE__*/React.forwardRef(function Popover(props, ref) {
|
|
|
5893
5424
|
modal: modal,
|
|
5894
5425
|
open: open,
|
|
5895
5426
|
onOpenChange: onChange
|
|
5896
|
-
}, trigger && /*#__PURE__*/React.createElement(Trigger$
|
|
5427
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$2, null, trigger), children));
|
|
5897
5428
|
});
|
|
5898
|
-
Popover.Trigger = Trigger$
|
|
5899
|
-
Popover.Content = Content$
|
|
5429
|
+
Popover.Trigger = Trigger$2;
|
|
5430
|
+
Popover.Content = Content$3;
|
|
5900
5431
|
Popover.Close = Close$1;
|
|
5901
5432
|
Popover.Portal = PopoverPrimitive.Portal;
|
|
5902
5433
|
|
|
@@ -5922,10 +5453,14 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
|
5922
5453
|
"data-taco": "datepicker",
|
|
5923
5454
|
style: style
|
|
5924
5455
|
}, /*#__PURE__*/React.createElement(Input, Object.assign({}, input, {
|
|
5925
|
-
button: /*#__PURE__*/React.createElement(
|
|
5456
|
+
button: /*#__PURE__*/React.createElement(Tooltip, {
|
|
5457
|
+
title: texts.datepicker.calendar
|
|
5458
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
5926
5459
|
"aria-label": texts.datepicker.expand,
|
|
5927
5460
|
disabled: input.disabled || input.readOnly,
|
|
5928
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",
|
|
5929
5464
|
popover: props => /*#__PURE__*/React.createElement(Popover, Object.assign({}, props), /*#__PURE__*/React.createElement(Popover.Content, null, ({
|
|
5930
5465
|
close
|
|
5931
5466
|
}) => /*#__PURE__*/React.createElement("div", {
|
|
@@ -5934,8 +5469,7 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
|
5934
5469
|
onChange: (date, event) => {
|
|
5935
5470
|
calendar.onChange(date, event);
|
|
5936
5471
|
close();
|
|
5937
|
-
}
|
|
5938
|
-
tabIndex: -1
|
|
5472
|
+
}
|
|
5939
5473
|
})), shortcuts && /*#__PURE__*/React.createElement("div", {
|
|
5940
5474
|
className: "border-grey-300 flex flex-col border-l"
|
|
5941
5475
|
}, /*#__PURE__*/React.createElement("span", {
|
|
@@ -5959,7 +5493,7 @@ const Datepicker = /*#__PURE__*/React.forwardRef(function Datepicker(props, ref)
|
|
|
5959
5493
|
close();
|
|
5960
5494
|
}
|
|
5961
5495
|
}, texts.datepicker.clear)))))
|
|
5962
|
-
})
|
|
5496
|
+
}))
|
|
5963
5497
|
})));
|
|
5964
5498
|
});
|
|
5965
5499
|
Datepicker.displayName = 'Datepicker';
|
|
@@ -5986,7 +5520,7 @@ const useCurrentDialog = () => {
|
|
|
5986
5520
|
return React.useContext(DialogContext);
|
|
5987
5521
|
};
|
|
5988
5522
|
|
|
5989
|
-
const Trigger$
|
|
5523
|
+
const Trigger$3 = /*#__PURE__*/React.forwardRef(function DialogTrigger(props, externalRef) {
|
|
5990
5524
|
const {
|
|
5991
5525
|
ref: parentRef,
|
|
5992
5526
|
props: parentProps
|
|
@@ -6084,7 +5618,7 @@ const RenderPropWrapper$1 = /*#__PURE__*/React.forwardRef(function RenderPropWra
|
|
|
6084
5618
|
...renderProps
|
|
6085
5619
|
});
|
|
6086
5620
|
});
|
|
6087
|
-
const Content$
|
|
5621
|
+
const Content$4 = /*#__PURE__*/React.forwardRef(function DialogContent(props, ref) {
|
|
6088
5622
|
const dialog = useCurrentDialog();
|
|
6089
5623
|
const internalRef = useMergedRef(ref);
|
|
6090
5624
|
const {
|
|
@@ -6251,16 +5785,37 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(props, ref) {
|
|
|
6251
5785
|
defaultOpen: defaultOpen,
|
|
6252
5786
|
open: open,
|
|
6253
5787
|
onOpenChange: onChange
|
|
6254
|
-
}, trigger && /*#__PURE__*/React.createElement(Trigger$
|
|
5788
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$3, null, trigger), children));
|
|
6255
5789
|
});
|
|
6256
|
-
Dialog.Trigger = Trigger$
|
|
6257
|
-
Dialog.Content = Content$
|
|
5790
|
+
Dialog.Trigger = Trigger$3;
|
|
5791
|
+
Dialog.Content = Content$4;
|
|
6258
5792
|
Dialog.Title = Title$1;
|
|
6259
5793
|
Dialog.Footer = Footer$1;
|
|
6260
5794
|
Dialog.Extra = Extra;
|
|
6261
5795
|
Dialog.Drawer = DialogDrawer;
|
|
6262
5796
|
Dialog.Close = Close$2;
|
|
6263
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
|
+
|
|
6264
5819
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
6265
5820
|
const DrawerContext = /*#__PURE__*/React.createContext({
|
|
6266
5821
|
closeOnEscape: true,
|
|
@@ -6614,7 +6169,7 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
|
|
|
6614
6169
|
ref: ref
|
|
6615
6170
|
}, content);
|
|
6616
6171
|
});
|
|
6617
|
-
const Content$
|
|
6172
|
+
const Content$5 = /*#__PURE__*/React__default.forwardRef(function Content(props, externalRef) {
|
|
6618
6173
|
const {
|
|
6619
6174
|
children
|
|
6620
6175
|
} = props;
|
|
@@ -6623,7 +6178,7 @@ const Content$6 = /*#__PURE__*/React__default.forwardRef(function Content(props,
|
|
|
6623
6178
|
}), children));
|
|
6624
6179
|
});
|
|
6625
6180
|
|
|
6626
|
-
const Trigger$
|
|
6181
|
+
const Trigger$4 = /*#__PURE__*/React.forwardRef(function DrawerTrigger(props, ref) {
|
|
6627
6182
|
return /*#__PURE__*/React.createElement(DialogPrimitive.Trigger, Object.assign({}, props, {
|
|
6628
6183
|
ref: ref,
|
|
6629
6184
|
asChild: true
|
|
@@ -6711,10 +6266,10 @@ const Drawer = /*#__PURE__*/React.forwardRef(function Drawer(props, ref) {
|
|
|
6711
6266
|
modal: variant === 'overlay' ? true : false,
|
|
6712
6267
|
open: open,
|
|
6713
6268
|
onOpenChange: setOpen
|
|
6714
|
-
}, trigger && /*#__PURE__*/React.createElement(Trigger$
|
|
6269
|
+
}, trigger && /*#__PURE__*/React.createElement(Trigger$4, null, trigger), children));
|
|
6715
6270
|
});
|
|
6716
|
-
Drawer.Trigger = Trigger$
|
|
6717
|
-
Drawer.Content = Content$
|
|
6271
|
+
Drawer.Trigger = Trigger$4;
|
|
6272
|
+
Drawer.Content = Content$5;
|
|
6718
6273
|
Drawer.InnerContent = InnerContent;
|
|
6719
6274
|
Drawer.Title = Title$2;
|
|
6720
6275
|
Drawer.Footer = Footer$2;
|
|
@@ -6792,7 +6347,7 @@ const Title$3 = /*#__PURE__*/React.forwardRef(function DialogTitle(props, ref) {
|
|
|
6792
6347
|
ref: ref
|
|
6793
6348
|
}));
|
|
6794
6349
|
});
|
|
6795
|
-
const Content$
|
|
6350
|
+
const Content$6 = /*#__PURE__*/React.forwardRef(function HangerContent(props, ref) {
|
|
6796
6351
|
const {
|
|
6797
6352
|
placement: side
|
|
6798
6353
|
} = props;
|
|
@@ -6851,7 +6406,7 @@ const Hanger = /*#__PURE__*/React.forwardRef(function Hanger(props, ref) {
|
|
|
6851
6406
|
}, anchor && /*#__PURE__*/React.createElement(Anchor, null, anchor), children));
|
|
6852
6407
|
});
|
|
6853
6408
|
Hanger.Anchor = Anchor;
|
|
6854
|
-
Hanger.Content = Content$
|
|
6409
|
+
Hanger.Content = Content$6;
|
|
6855
6410
|
Hanger.Title = Title$3;
|
|
6856
6411
|
|
|
6857
6412
|
const UnstyledArrow$1 = /*#__PURE__*/React.forwardRef(function HoverCardArrow(props, ref) {
|
|
@@ -6876,13 +6431,13 @@ const UnstyledArrow$1 = /*#__PURE__*/React.forwardRef(function HoverCardArrow(pr
|
|
|
6876
6431
|
})));
|
|
6877
6432
|
});
|
|
6878
6433
|
|
|
6879
|
-
const Trigger$
|
|
6434
|
+
const Trigger$5 = /*#__PURE__*/React.forwardRef(function HoverCardTrigger(props, ref) {
|
|
6880
6435
|
return /*#__PURE__*/React.createElement(HoverCardPrimitive.Trigger, Object.assign({}, props, {
|
|
6881
6436
|
asChild: true,
|
|
6882
6437
|
ref: ref
|
|
6883
6438
|
}));
|
|
6884
6439
|
});
|
|
6885
|
-
const Content$
|
|
6440
|
+
const Content$7 = /*#__PURE__*/React.forwardRef(function HoverCardContent(props, ref) {
|
|
6886
6441
|
const {
|
|
6887
6442
|
placement: side
|
|
6888
6443
|
} = props;
|
|
@@ -6902,62 +6457,8 @@ const HoverCard = props => {
|
|
|
6902
6457
|
openDelay: 300
|
|
6903
6458
|
}));
|
|
6904
6459
|
};
|
|
6905
|
-
HoverCard.Trigger = Trigger$
|
|
6906
|
-
HoverCard.Content = Content$
|
|
6907
|
-
|
|
6908
|
-
const SearchInput = /*#__PURE__*/React.forwardRef(function SearchInput({
|
|
6909
|
-
onSearch,
|
|
6910
|
-
...props
|
|
6911
|
-
}, ref) {
|
|
6912
|
-
const internalRef = useMergedRef(ref);
|
|
6913
|
-
const {
|
|
6914
|
-
texts
|
|
6915
|
-
} = useLocalization();
|
|
6916
|
-
const handleClick = () => {
|
|
6917
|
-
var _internalRef$current$, _internalRef$current;
|
|
6918
|
-
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$ : '');
|
|
6919
|
-
};
|
|
6920
|
-
const handleCancelClick = () => {
|
|
6921
|
-
setInputValueByRef(internalRef.current, '');
|
|
6922
|
-
};
|
|
6923
|
-
const handleKeyDown = event => {
|
|
6924
|
-
var _props$onKeyDown;
|
|
6925
|
-
(_props$onKeyDown = props.onKeyDown) === null || _props$onKeyDown === void 0 ? void 0 : _props$onKeyDown.call(props, event);
|
|
6926
|
-
if (event.isDefaultPrevented()) {
|
|
6927
|
-
return;
|
|
6928
|
-
}
|
|
6929
|
-
if (event.key === 'Enter') {
|
|
6930
|
-
event.preventDefault();
|
|
6931
|
-
handleClick();
|
|
6932
|
-
return;
|
|
6933
|
-
}
|
|
6934
|
-
};
|
|
6935
|
-
return /*#__PURE__*/React.createElement(Input, Object.assign({
|
|
6936
|
-
"aria-label": texts.searchInput.placeholder,
|
|
6937
|
-
placeholder: texts.searchInput.placeholder
|
|
6938
|
-
}, props, {
|
|
6939
|
-
onKeyDown: handleKeyDown,
|
|
6940
|
-
postfix: /*#__PURE__*/React.createElement(React.Fragment, null, props.disabled || props.readOnly || !props.value ? null : /*#__PURE__*/React.createElement(IconButton, {
|
|
6941
|
-
"aria-hidden": true,
|
|
6942
|
-
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",
|
|
6943
|
-
icon: "close",
|
|
6944
|
-
onClick: handleCancelClick,
|
|
6945
|
-
rounded: true,
|
|
6946
|
-
tabIndex: -1,
|
|
6947
|
-
tooltip: texts.searchInput.clear
|
|
6948
|
-
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
6949
|
-
"aria-label": texts.searchInput.button,
|
|
6950
|
-
icon: "search",
|
|
6951
|
-
className: "group-peer-focus:!border-transparent group-peer-focus:group-peer-active:!border-transparent -mr-2 !border-transparent !bg-transparent focus:!border-transparent",
|
|
6952
|
-
disabled: props.disabled || props.readOnly,
|
|
6953
|
-
onClick: handleClick,
|
|
6954
|
-
tabIndex: -1,
|
|
6955
|
-
tooltip: texts.searchInput.button
|
|
6956
|
-
})),
|
|
6957
|
-
ref: internalRef,
|
|
6958
|
-
type: "search"
|
|
6959
|
-
}));
|
|
6960
|
-
});
|
|
6460
|
+
HoverCard.Trigger = Trigger$5;
|
|
6461
|
+
HoverCard.Content = Content$7;
|
|
6961
6462
|
|
|
6962
6463
|
function useTimer(duration = 0, callback) {
|
|
6963
6464
|
const timer = React.useRef();
|
|
@@ -7103,7 +6604,7 @@ const useListbox = ({
|
|
|
7103
6604
|
event.persist();
|
|
7104
6605
|
if (onChange) {
|
|
7105
6606
|
var _item$path$split, _item$path;
|
|
7106
|
-
const item = findByValue
|
|
6607
|
+
const item = findByValue(data, event.target.value);
|
|
7107
6608
|
event.detail = sanitizeItem(item);
|
|
7108
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 : [];
|
|
7109
6610
|
if (indexes.length > 1) {
|
|
@@ -7274,7 +6775,7 @@ const useMultiListbox = ({
|
|
|
7274
6775
|
const detail = [];
|
|
7275
6776
|
const valuesArray = event.target.value.split(',');
|
|
7276
6777
|
valuesArray.forEach(val => {
|
|
7277
|
-
const item = findByValue
|
|
6778
|
+
const item = findByValue(data, val);
|
|
7278
6779
|
if (item) {
|
|
7279
6780
|
detail.push(item);
|
|
7280
6781
|
}
|
|
@@ -7314,52 +6815,427 @@ const useMultiListbox = ({
|
|
|
7314
6815
|
};
|
|
7315
6816
|
};
|
|
7316
6817
|
|
|
7317
|
-
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) {
|
|
7318
7013
|
const {
|
|
7319
|
-
|
|
7014
|
+
checked,
|
|
7015
|
+
children,
|
|
7016
|
+
onChange,
|
|
7320
7017
|
...otherProps
|
|
7321
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);
|
|
7322
7045
|
const {
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
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
|
|
7334
7115
|
}
|
|
7335
|
-
}
|
|
7336
|
-
|
|
7337
|
-
|
|
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
|
|
7338
7133
|
})));
|
|
7339
7134
|
});
|
|
7340
|
-
|
|
7135
|
+
RadioGroup.Item = RadioGroupItem;
|
|
7136
|
+
|
|
7137
|
+
const RadioItem = props => {
|
|
7138
|
+
const context = React.useContext(MenuRadioGroupContext);
|
|
7341
7139
|
const {
|
|
7342
|
-
|
|
7140
|
+
children,
|
|
7141
|
+
value,
|
|
7343
7142
|
...otherProps
|
|
7344
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) {
|
|
7345
7164
|
const {
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
} =
|
|
7349
|
-
const className = cn('
|
|
7350
|
-
return /*#__PURE__*/React.createElement(
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
...list.style,
|
|
7356
|
-
maxHeight: 'calc(12rem + 2px + 2px)' /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
|
|
7357
|
-
}
|
|
7358
|
-
})), /*#__PURE__*/React.createElement("input", Object.assign({}, input, {
|
|
7359
|
-
className: "hidden",
|
|
7360
|
-
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
|
|
7361
7174
|
})));
|
|
7362
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;
|
|
7363
7239
|
|
|
7364
7240
|
const TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
|
|
7365
7241
|
return /*#__PURE__*/React__default.createElement("a", Object.assign({}, props, {
|
|
@@ -7569,6 +7445,116 @@ Navigation.Menu = Menu$2;
|
|
|
7569
7445
|
Navigation.Item = Item$2;
|
|
7570
7446
|
Navigation.Panel = Panel;
|
|
7571
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
|
+
|
|
7572
7558
|
const createPageRange = (pageCount, pageNumber) => {
|
|
7573
7559
|
let lowerLimit = Math.min(pageNumber, pageCount);
|
|
7574
7560
|
let upperLimit = Math.min(pageNumber, pageCount);
|
|
@@ -7640,7 +7626,7 @@ const useSelect = ({
|
|
|
7640
7626
|
}, [open]);
|
|
7641
7627
|
React.useEffect(() => {
|
|
7642
7628
|
if (value === undefined) {
|
|
7643
|
-
if (defaultValue !== undefined && findByValue
|
|
7629
|
+
if (defaultValue !== undefined && findByValue(flattenedData, defaultValue)) {
|
|
7644
7630
|
setInputValueByRef$1(inputRef.current, defaultValue);
|
|
7645
7631
|
} else {
|
|
7646
7632
|
if (emptyValue !== undefined) {
|
|
@@ -7650,7 +7636,7 @@ const useSelect = ({
|
|
|
7650
7636
|
}
|
|
7651
7637
|
}
|
|
7652
7638
|
} else {
|
|
7653
|
-
if (!multiselect && !findByValue
|
|
7639
|
+
if (!multiselect && !findByValue(flattenedData, value)) {
|
|
7654
7640
|
if (emptyValue !== undefined) {
|
|
7655
7641
|
setInputValueByRef$1(inputRef.current, emptyValue);
|
|
7656
7642
|
} else if (data.length > 0) {
|
|
@@ -7709,11 +7695,11 @@ const useSelect = ({
|
|
|
7709
7695
|
text = texts.select.allOptionsSelected;
|
|
7710
7696
|
} else {
|
|
7711
7697
|
var _findByValue$text, _findByValue;
|
|
7712
|
-
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 : '';
|
|
7713
7699
|
more = selectedValues.length > 1 ? selectedValues.length - 1 : 0;
|
|
7714
7700
|
}
|
|
7715
7701
|
} else {
|
|
7716
|
-
const item = findByValue
|
|
7702
|
+
const item = findByValue(flattenedData, value);
|
|
7717
7703
|
if (item) {
|
|
7718
7704
|
text = item.icon ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.cloneElement(item.icon, {
|
|
7719
7705
|
className: cn(item.icon.props.className, 'mr-1 -mt-px')
|
|
@@ -7725,7 +7711,7 @@ const useSelect = ({
|
|
|
7725
7711
|
event.persist();
|
|
7726
7712
|
if (onChange) {
|
|
7727
7713
|
var _item$path$split, _item$path;
|
|
7728
|
-
const item = findByValue
|
|
7714
|
+
const item = findByValue(flattenedData, event.target.value);
|
|
7729
7715
|
event.detail = sanitizeItem(item);
|
|
7730
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 : [];
|
|
7731
7717
|
if (indexes.length > 1) {
|
|
@@ -8072,6 +8058,7 @@ const getBadgeIcon = type => {
|
|
|
8072
8058
|
return null;
|
|
8073
8059
|
}
|
|
8074
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}.`;
|
|
8075
8062
|
|
|
8076
8063
|
const Toast = ({
|
|
8077
8064
|
content,
|
|
@@ -8097,7 +8084,7 @@ const Toast = ({
|
|
|
8097
8084
|
const timer = useTimer(autoClose, handleClose);
|
|
8098
8085
|
const controls = framerMotion.useAnimation();
|
|
8099
8086
|
if (!content) {
|
|
8100
|
-
console.warn(
|
|
8087
|
+
console.warn(getToastEmptyContentWarning(content));
|
|
8101
8088
|
}
|
|
8102
8089
|
React__default.useEffect(() => {
|
|
8103
8090
|
if (autoClose) {
|
|
@@ -8296,6 +8283,60 @@ const Provider = props => {
|
|
|
8296
8283
|
}, /*#__PURE__*/React.createElement(TooltipPrimitive.Provider, null, /*#__PURE__*/React.createElement(ToastProvider, null, children)));
|
|
8297
8284
|
};
|
|
8298
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
|
+
|
|
8299
8340
|
const isAriaSelectionKey = event => {
|
|
8300
8341
|
if (event.key === 'Enter' || event.key === ' ' || event.key === 'Tab') {
|
|
8301
8342
|
return true;
|
|
@@ -9718,6 +9759,47 @@ const Shortcut$1 = ({
|
|
|
9718
9759
|
}, key)));
|
|
9719
9760
|
};
|
|
9720
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
|
+
|
|
9721
9803
|
const sanitizeRowProps = (row, rowExpansionRenderer) => {
|
|
9722
9804
|
var _row$subRows;
|
|
9723
9805
|
const props = {
|
|
@@ -10220,7 +10302,7 @@ const useRowSelect = onSelectedRows => {
|
|
|
10220
10302
|
onSelectedRows({});
|
|
10221
10303
|
}
|
|
10222
10304
|
};
|
|
10223
|
-
return /*#__PURE__*/React__default.createElement(Checkbox
|
|
10305
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, props, {
|
|
10224
10306
|
onChange: onChange
|
|
10225
10307
|
}));
|
|
10226
10308
|
},
|
|
@@ -10245,7 +10327,7 @@ const useRowSelect = onSelectedRows => {
|
|
|
10245
10327
|
}
|
|
10246
10328
|
lastSelectedSortedIndex.current = sortedIndex;
|
|
10247
10329
|
};
|
|
10248
|
-
return /*#__PURE__*/React__default.createElement(Checkbox
|
|
10330
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, Object.assign({}, props, {
|
|
10249
10331
|
className: "!mt-2.5",
|
|
10250
10332
|
onClick: onClick,
|
|
10251
10333
|
// this is necessary to remove console spam from eslint
|
|
@@ -11335,7 +11417,7 @@ const SelectCell = /*#__PURE__*/React__default.memo(({
|
|
|
11335
11417
|
className: "ml-2",
|
|
11336
11418
|
keys: ['Space']
|
|
11337
11419
|
}))
|
|
11338
|
-
}, /*#__PURE__*/React__default.createElement(Checkbox
|
|
11420
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
11339
11421
|
"aria-label": isSelected ? texts.table2.columns.select.select : texts.table2.columns.select.deselect,
|
|
11340
11422
|
className: "hover:border-blue !mt-0",
|
|
11341
11423
|
checked: isSelected,
|
|
@@ -11356,7 +11438,7 @@ function createRowSelectionColumn(enableMultipleRowSelection, lastSelectedRowInd
|
|
|
11356
11438
|
className: "ml-2",
|
|
11357
11439
|
keys: ['Ctrl', 'A']
|
|
11358
11440
|
}))
|
|
11359
|
-
}, /*#__PURE__*/React__default.createElement(Checkbox
|
|
11441
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
11360
11442
|
"aria-label": table.getIsAllPageRowsSelected() ? texts.table2.columns.select.deselectAll : texts.table2.columns.select.selectAll,
|
|
11361
11443
|
className: "hover:border-blue !mt-0",
|
|
11362
11444
|
checked: table.getIsAllPageRowsSelected(),
|
|
@@ -11647,47 +11729,6 @@ const ColumnBase = /*#__PURE__*/React__default.forwardRef(function Table2ColumnB
|
|
|
11647
11729
|
}));
|
|
11648
11730
|
});
|
|
11649
11731
|
|
|
11650
|
-
const Switch = /*#__PURE__*/React.forwardRef(function Switch(props, ref) {
|
|
11651
|
-
const {
|
|
11652
|
-
label,
|
|
11653
|
-
onChange,
|
|
11654
|
-
...otherProps
|
|
11655
|
-
} = props;
|
|
11656
|
-
const id = useId(props.id);
|
|
11657
|
-
const className = cn('group h-5 w-9 flex flex-shrink-0 rounded-full inline-flex', {
|
|
11658
|
-
'mr-2': !!label,
|
|
11659
|
-
'bg-grey-500 hover:bg-grey-300 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-300 focus:yt-focus': !props.disabled,
|
|
11660
|
-
'bg-grey-100 cursor-not-allowed aria-checked:bg-blue-300': props.disabled
|
|
11661
|
-
}, props.className);
|
|
11662
|
-
let labelledByProps = null;
|
|
11663
|
-
if (label) {
|
|
11664
|
-
labelledByProps = {
|
|
11665
|
-
'aria-labelledby': `${id}-label`,
|
|
11666
|
-
id
|
|
11667
|
-
};
|
|
11668
|
-
}
|
|
11669
|
-
const element = /*#__PURE__*/React.createElement(PrimitiveSwitch.Root, Object.assign({}, otherProps, labelledByProps, {
|
|
11670
|
-
className: className,
|
|
11671
|
-
onCheckedChange: onChange,
|
|
11672
|
-
ref: ref
|
|
11673
|
-
}), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
|
|
11674
|
-
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]"
|
|
11675
|
-
}));
|
|
11676
|
-
if (label) {
|
|
11677
|
-
const labelContainerClassName = cn('flex self-start cursor-pointer', {
|
|
11678
|
-
'cursor-not-allowed text-grey-300': props.disabled
|
|
11679
|
-
});
|
|
11680
|
-
return /*#__PURE__*/React.createElement("span", {
|
|
11681
|
-
className: labelContainerClassName
|
|
11682
|
-
}, element, /*#__PURE__*/React.createElement("label", {
|
|
11683
|
-
htmlFor: id,
|
|
11684
|
-
id: `${id}-label`
|
|
11685
|
-
}, label));
|
|
11686
|
-
}
|
|
11687
|
-
return element;
|
|
11688
|
-
});
|
|
11689
|
-
Switch.displayName = 'Switch';
|
|
11690
|
-
|
|
11691
11732
|
var Table2FilterComparator;
|
|
11692
11733
|
(function (Table2FilterComparator) {
|
|
11693
11734
|
Table2FilterComparator[Table2FilterComparator["Contains"] = 0] = "Contains";
|
|
@@ -13379,7 +13420,7 @@ const OrderableColumn = /*#__PURE__*/React__default.forwardRef((props, ref) => {
|
|
|
13379
13420
|
ref: ref
|
|
13380
13421
|
}), /*#__PURE__*/React__default.createElement("span", {
|
|
13381
13422
|
className: "pointer-events-none"
|
|
13382
|
-
}, 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, {
|
|
13383
13424
|
checked: column.getIsVisible(),
|
|
13384
13425
|
onChange: column.toggleVisibility
|
|
13385
13426
|
}) : null);
|
|
@@ -14793,25 +14834,20 @@ Tour.Step = TourStep;
|
|
|
14793
14834
|
|
|
14794
14835
|
const Button$3 = /*#__PURE__*/React__default.forwardRef(function Button(props, ref) {
|
|
14795
14836
|
const {
|
|
14796
|
-
as = 'li',
|
|
14797
14837
|
...attributes
|
|
14798
14838
|
} = props;
|
|
14799
14839
|
const className = cn(getButtonClasses$1(), props.className);
|
|
14800
|
-
|
|
14801
|
-
return /*#__PURE__*/React__default.createElement(Tag, {
|
|
14802
|
-
className: "contents"
|
|
14803
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, attributes, {
|
|
14840
|
+
return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, attributes, {
|
|
14804
14841
|
appearance: "discrete",
|
|
14805
14842
|
className: className,
|
|
14806
14843
|
"data-taco": "header-button",
|
|
14807
14844
|
ref: ref
|
|
14808
|
-
}))
|
|
14845
|
+
}));
|
|
14809
14846
|
});
|
|
14810
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');
|
|
14811
14848
|
|
|
14812
14849
|
const Link$1 = /*#__PURE__*/React__default.forwardRef(function Link(props, ref) {
|
|
14813
14850
|
const {
|
|
14814
|
-
as = 'li',
|
|
14815
14851
|
children,
|
|
14816
14852
|
icon,
|
|
14817
14853
|
isNew,
|
|
@@ -14821,9 +14857,8 @@ const Link$1 = /*#__PURE__*/React__default.forwardRef(function Link(props, ref)
|
|
|
14821
14857
|
const {
|
|
14822
14858
|
texts
|
|
14823
14859
|
} = useLocalization();
|
|
14824
|
-
const Tag = as;
|
|
14825
14860
|
const className = cn(getLinkClasses(icon), 'relative', props.className);
|
|
14826
|
-
|
|
14861
|
+
const link = /*#__PURE__*/React__default.createElement("a", Object.assign({}, otherProps, {
|
|
14827
14862
|
className: className,
|
|
14828
14863
|
"data-taco": "header-link",
|
|
14829
14864
|
ref: ref,
|
|
@@ -14836,13 +14871,11 @@ const Link$1 = /*#__PURE__*/React__default.forwardRef(function Link(props, ref)
|
|
|
14836
14871
|
className: "absolute top-0 right-0 -mt-1.5 -mr-2.5 !h-3 !px-0.5 text-[0.55rem] font-normal"
|
|
14837
14872
|
}, texts.header.new) : null);
|
|
14838
14873
|
if (tooltip) {
|
|
14839
|
-
|
|
14874
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
14840
14875
|
title: tooltip
|
|
14841
14876
|
}, link);
|
|
14842
14877
|
}
|
|
14843
|
-
return
|
|
14844
|
-
className: "contents"
|
|
14845
|
-
}, link);
|
|
14878
|
+
return link;
|
|
14846
14879
|
});
|
|
14847
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', {
|
|
14848
14881
|
'!rounded-full !h-9 !w-9': icon,
|
|
@@ -14917,132 +14950,27 @@ const Logo = /*#__PURE__*/React__default.forwardRef(function Logo(props, ref) {
|
|
|
14917
14950
|
}))));
|
|
14918
14951
|
});
|
|
14919
14952
|
|
|
14920
|
-
const getChildWidths = parent => {
|
|
14921
|
-
const widths = [];
|
|
14922
|
-
for (let index = 0; index < parent.children.length; index++) {
|
|
14923
|
-
var _parent$children$inde, _childRect$width;
|
|
14924
|
-
const childRect = (_parent$children$inde = parent.children[index].firstElementChild) === null || _parent$children$inde === void 0 ? void 0 : _parent$children$inde.getBoundingClientRect();
|
|
14925
|
-
widths.push((_childRect$width = childRect === null || childRect === void 0 ? void 0 : childRect.width) !== null && _childRect$width !== void 0 ? _childRect$width : 0);
|
|
14926
|
-
}
|
|
14927
|
-
return widths;
|
|
14928
|
-
};
|
|
14929
|
-
const ChildrenWidth = ({
|
|
14930
|
-
setWidth,
|
|
14931
|
-
children
|
|
14932
|
-
}) => {
|
|
14933
|
-
const ref = React__default.useRef(null);
|
|
14934
|
-
const [show, setShow] = React__default.useState(true);
|
|
14935
|
-
React__default.useEffect(() => {
|
|
14936
|
-
// Calculate the width of children, and then hides the portal
|
|
14937
|
-
if (ref.current && show) {
|
|
14938
|
-
setWidth(getChildWidths(ref.current));
|
|
14939
|
-
setShow(false);
|
|
14940
|
-
}
|
|
14941
|
-
}, [show]);
|
|
14942
|
-
React__default.useEffect(() => {
|
|
14943
|
-
// If children changes, then we render the children to calculate their width
|
|
14944
|
-
if (!show) {
|
|
14945
|
-
setShow(true);
|
|
14946
|
-
}
|
|
14947
|
-
}, [children]);
|
|
14948
|
-
return show ? /*#__PURE__*/React__default.createElement(reactPortal.Portal, {
|
|
14949
|
-
className: cn('invisible absolute z-[-10] flex translate-x-[-1000px]'),
|
|
14950
|
-
ref: ref
|
|
14951
|
-
}, children) : null;
|
|
14952
|
-
};
|
|
14953
|
-
const useBoundaryIndex = (wrapperWidth, buttonRef, childWidths) => {
|
|
14954
|
-
// Primary navigation has a gap of gap-1, so we need to take the gap value in account as well
|
|
14955
|
-
// left gap + right gap = 8px
|
|
14956
|
-
const GAP = 8;
|
|
14957
|
-
return React__default.useMemo(() => {
|
|
14958
|
-
if (childWidths.length && wrapperWidth && buttonRef.current) {
|
|
14959
|
-
const realWidth = wrapperWidth - buttonRef.current.getBoundingClientRect().width - GAP;
|
|
14960
|
-
let boundary;
|
|
14961
|
-
let total = 0;
|
|
14962
|
-
childWidths.every((width, index) => {
|
|
14963
|
-
const nextWidth = total + width + GAP;
|
|
14964
|
-
if (nextWidth > realWidth) {
|
|
14965
|
-
boundary = index;
|
|
14966
|
-
return false;
|
|
14967
|
-
}
|
|
14968
|
-
total = nextWidth;
|
|
14969
|
-
return true;
|
|
14970
|
-
});
|
|
14971
|
-
return boundary;
|
|
14972
|
-
}
|
|
14973
|
-
return undefined;
|
|
14974
|
-
}, [childWidths, wrapperWidth]);
|
|
14975
|
-
};
|
|
14976
14953
|
const PrimaryNavigation = /*#__PURE__*/React__default.forwardRef(function PrimaryNavigation(props, ref) {
|
|
14977
|
-
var _rect$width;
|
|
14978
14954
|
const {
|
|
14979
14955
|
texts
|
|
14980
14956
|
} = useLocalization();
|
|
14981
14957
|
const internalRef = useMergedRef(ref);
|
|
14982
|
-
const rect = useBoundingClientRectListener(internalRef);
|
|
14983
|
-
const buttonRef = React__default.useRef(null);
|
|
14984
|
-
const [childWidths, setChildWidths] = React__default.useState([]);
|
|
14985
|
-
const boundaryIndex = useBoundaryIndex((_rect$width = rect === null || rect === void 0 ? void 0 : rect.width) !== null && _rect$width !== void 0 ? _rect$width : 0, buttonRef, childWidths);
|
|
14986
14958
|
const className = cn('flex h-full w-full flex-grow items-center overflow-hidden active:outline-none relative', props.className);
|
|
14987
|
-
const
|
|
14988
|
-
|
|
14989
|
-
|
|
14990
|
-
const hiddenChildren = [];
|
|
14991
|
-
React__default.Children.forEach(props.children, (child, index) => {
|
|
14992
|
-
if ( /*#__PURE__*/React__default.isValidElement(child) && !!child) {
|
|
14993
|
-
if (boundaryIndex && index >= boundaryIndex) {
|
|
14994
|
-
hiddenChildren.push(child);
|
|
14995
|
-
} else {
|
|
14996
|
-
visibleChildren.push(child);
|
|
14997
|
-
}
|
|
14998
|
-
}
|
|
14999
|
-
});
|
|
15000
|
-
return [visibleChildren, hiddenChildren];
|
|
15001
|
-
}, [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);
|
|
15002
14962
|
return /*#__PURE__*/React__default.createElement("nav", Object.assign({}, props, {
|
|
15003
14963
|
className: className,
|
|
15004
14964
|
ref: internalRef
|
|
15005
|
-
}), /*#__PURE__*/React__default.createElement(
|
|
15006
|
-
className: "
|
|
15007
|
-
|
|
15008
|
-
className: cn({
|
|
15009
|
-
invisible: boundaryIndex === undefined
|
|
15010
|
-
})
|
|
15011
|
-
}, /*#__PURE__*/React__default.createElement(Button$1, {
|
|
15012
|
-
className: moreButtonClassName,
|
|
15013
|
-
menu: menuProps => /*#__PURE__*/React__default.createElement(Menu$1, Object.assign({}, menuProps), /*#__PURE__*/React__default.createElement(Menu$1.Content, {
|
|
15014
|
-
className: "hidden lg:block"
|
|
15015
|
-
}, hiddenChildren.map((child, index) => {
|
|
15016
|
-
const href = child.props.to || child.props.href;
|
|
15017
|
-
const target = href !== null && href !== void 0 && href.startsWith('http') ? '_blank' : '_self';
|
|
15018
|
-
// Removing className prop so that custom styling cannot be applied on Menu.Link
|
|
15019
|
-
const {
|
|
15020
|
-
as,
|
|
15021
|
-
className: _,
|
|
15022
|
-
...otherProps
|
|
15023
|
-
} = child.props;
|
|
15024
|
-
if (as) {
|
|
15025
|
-
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
15026
|
-
as: Menu$1.Link,
|
|
15027
|
-
key: index,
|
|
15028
|
-
target,
|
|
15029
|
-
...otherProps
|
|
15030
|
-
});
|
|
15031
|
-
}
|
|
15032
|
-
return /*#__PURE__*/React__default.createElement(Menu$1.Link, Object.assign({
|
|
15033
|
-
key: index,
|
|
15034
|
-
target: target
|
|
15035
|
-
}, otherProps));
|
|
15036
|
-
}))),
|
|
15037
|
-
ref: buttonRef
|
|
15038
|
-
}, texts.header.more))), /*#__PURE__*/React__default.createElement(ChildrenWidth, {
|
|
15039
|
-
setWidth: setChildWidths
|
|
14965
|
+
}), /*#__PURE__*/React__default.createElement(OverflowGroup, {
|
|
14966
|
+
className: "h-full flex-grow items-center gap-1 px-1",
|
|
14967
|
+
moreButton: moreButton
|
|
15040
14968
|
}, props.children));
|
|
15041
14969
|
});
|
|
15042
14970
|
|
|
15043
14971
|
const SecondaryNavigation = /*#__PURE__*/React__default.forwardRef(function SecondaryNavigation(props, ref) {
|
|
15044
|
-
const className = cn('flex h-full items-center gap-2 mb-0', props.className);
|
|
15045
|
-
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, {
|
|
15046
14974
|
className: className,
|
|
15047
14975
|
ref: ref
|
|
15048
14976
|
}));
|
|
@@ -15638,10 +15566,9 @@ exports.BadgeIcon = BadgeIcon;
|
|
|
15638
15566
|
exports.Banner = Banner;
|
|
15639
15567
|
exports.Base = Base;
|
|
15640
15568
|
exports.Button = Button$1;
|
|
15641
|
-
exports.ButtonGroup = ButtonGroup;
|
|
15642
15569
|
exports.Calendar = Calendar$1;
|
|
15643
15570
|
exports.Card = Card;
|
|
15644
|
-
exports.Checkbox = Checkbox
|
|
15571
|
+
exports.Checkbox = Checkbox;
|
|
15645
15572
|
exports.CollectionPrimitive = Collection;
|
|
15646
15573
|
exports.Combobox = Combobox;
|
|
15647
15574
|
exports.Datepicker = Datepicker;
|
|
@@ -15664,6 +15591,7 @@ exports.Menu = Menu$1;
|
|
|
15664
15591
|
exports.MultiListbox = MultiListbox;
|
|
15665
15592
|
exports.Navigation = Navigation;
|
|
15666
15593
|
exports.Navigation2 = Navigation2;
|
|
15594
|
+
exports.OverflowGroup = OverflowGroup;
|
|
15667
15595
|
exports.PaginatedTable = PaginatedTable;
|
|
15668
15596
|
exports.Pagination = Pagination;
|
|
15669
15597
|
exports.Popover = Popover;
|
|
@@ -15691,7 +15619,7 @@ exports.VisuallyHidden = VisuallyHidden;
|
|
|
15691
15619
|
exports.WindowedTable = WindowedTable;
|
|
15692
15620
|
exports.convertRowIndexPathToNumberArray = convertRowIndexPathToNumberArray;
|
|
15693
15621
|
exports.defaultLocalisationTexts = defaultLocalisationTexts;
|
|
15694
|
-
exports.findByValue = findByValue;
|
|
15622
|
+
exports.findByValue = findByValue$1;
|
|
15695
15623
|
exports.format = format;
|
|
15696
15624
|
exports.getByRowIndexPath = getByRowIndexPath;
|
|
15697
15625
|
exports.getNavigationLinkClasses = getNavigationLinkClasses;
|