@economic/taco 0.0.28-alpha.0 → 0.0.30-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Combobox/Combobox.d.ts +0 -3
- package/dist/components/Datepicker/Datepicker.d.ts +1 -1
- package/dist/components/Field/Field.d.ts +2 -5
- package/dist/components/Input/Input.d.ts +2 -5
- package/dist/components/Input/util.d.ts +1 -3
- package/dist/components/Listbox/Listbox.d.ts +3 -7
- package/dist/components/Listbox/ScrollableList.d.ts +2 -5
- package/dist/components/Listbox/useListbox.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Textarea/Textarea.d.ts +2 -5
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js +19 -1
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/dist/esm/components/Badge/Badge.js +14 -14
- package/dist/esm/components/Badge/Badge.js.map +1 -1
- package/dist/esm/components/Banner/Banner.js +5 -7
- package/dist/esm/components/Banner/Banner.js.map +1 -1
- package/dist/esm/components/Button/Button.js +13 -12
- package/dist/esm/components/Button/Button.js.map +1 -1
- package/dist/esm/components/Calendar/Calendar.js +71 -56
- package/dist/esm/components/Calendar/Calendar.js.map +1 -1
- package/dist/esm/components/Checkbox/Checkbox.js +18 -15
- package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/Combobox/Combobox.js +25 -23
- package/dist/esm/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/components/Dialog/Dialog.js +58 -39
- package/dist/esm/components/Dialog/Dialog.js.map +1 -1
- package/dist/esm/components/Field/Field.js +15 -16
- package/dist/esm/components/Field/Field.js.map +1 -1
- package/dist/esm/components/Input/Input.js +2 -2
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/Input/util.js +8 -36
- package/dist/esm/components/Input/util.js.map +1 -1
- package/dist/esm/components/Listbox/Listbox.js.map +1 -1
- package/dist/esm/components/Listbox/ScrollableList.js +1 -1
- package/dist/esm/components/Listbox/ScrollableList.js.map +1 -1
- package/dist/esm/components/Listbox/useListbox.js +2 -0
- package/dist/esm/components/Listbox/useListbox.js.map +1 -1
- package/dist/esm/components/Select/Select.js +2 -1
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/useSelect.js +4 -1
- package/dist/esm/components/Select/useSelect.js.map +1 -1
- package/dist/esm/components/Table/components/BaseTable.js +1 -1
- package/dist/esm/components/Table/components/BaseTable.js.map +1 -1
- package/dist/esm/components/Textarea/Textarea.js +1 -1
- package/dist/esm/components/Textarea/Textarea.js.map +1 -1
- package/dist/esm/index.css +19 -0
- package/dist/index.css +19 -0
- package/dist/taco.cjs.development.js +252 -226
- 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/utils/tailwind.d.ts +1 -1
- package/package.json +16 -16
- package/types.json +17 -33
@@ -36,6 +36,24 @@ var PrimitiveSwitch = require('@radix-ui/react-switch');
|
|
36
36
|
var Joyride = require('react-joyride');
|
37
37
|
var Joyride__default = _interopDefault(Joyride);
|
38
38
|
|
39
|
+
function _extends() {
|
40
|
+
_extends = Object.assign || function (target) {
|
41
|
+
for (var i = 1; i < arguments.length; i++) {
|
42
|
+
var source = arguments[i];
|
43
|
+
|
44
|
+
for (var key in source) {
|
45
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
46
|
+
target[key] = source[key];
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
|
51
|
+
return target;
|
52
|
+
};
|
53
|
+
|
54
|
+
return _extends.apply(this, arguments);
|
55
|
+
}
|
56
|
+
|
39
57
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
40
58
|
if (source == null) return {};
|
41
59
|
var target = {};
|
@@ -3211,8 +3229,8 @@ Accordion.Item = Item;
|
|
3211
3229
|
Accordion.Trigger = Trigger;
|
3212
3230
|
Accordion.Content = Content;
|
3213
3231
|
|
3214
|
-
|
3215
|
-
|
3232
|
+
var Backdrop = /*#__PURE__*/React.forwardRef(function Backdrop(props, ref) {
|
3233
|
+
var className = cn('fixed inset-0 cursor-default overflow-y-auto bg-[rgba(50,46,62,0.8)] aria-hidden:hidden z-[996]', props.className);
|
3216
3234
|
return React.createElement("div", Object.assign({}, props, {
|
3217
3235
|
className: className,
|
3218
3236
|
ref: ref
|
@@ -3265,20 +3283,19 @@ const getOutlineClasses = state => {
|
|
3265
3283
|
}
|
3266
3284
|
};
|
3267
3285
|
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
}, props.className);
|
3286
|
+
var _excluded$1 = ["children", "compact", "outline", "state"];
|
3287
|
+
var Badge = /*#__PURE__*/React.forwardRef(function Badge(props, ref) {
|
3288
|
+
var _cn;
|
3289
|
+
|
3290
|
+
var children = props.children,
|
3291
|
+
_props$compact = props.compact,
|
3292
|
+
compact = _props$compact === void 0 ? false : _props$compact,
|
3293
|
+
_props$outline = props.outline,
|
3294
|
+
outline = _props$outline === void 0 ? false : _props$outline,
|
3295
|
+
state = props.state,
|
3296
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$1);
|
3297
|
+
|
3298
|
+
var className = cn('rounded-full border font-bold text-xs uppercase overflow-hidden whitespace-nowrap inline-flex items-center justify-center h-5', (_cn = {}, _cn[getOutlineClasses(state)] = outline, _cn["border-transparent " + getStateClasses(state)] = !outline, _cn['h-2 w-2 min-w-0'] = compact, _cn['h-5 py-0 px-[0.354rem]'] = !compact, _cn), props.className);
|
3282
3299
|
return React.createElement("span", Object.assign({}, otherProps, {
|
3283
3300
|
"aria-atomic": "true",
|
3284
3301
|
"aria-live": "polite",
|
@@ -3462,13 +3479,11 @@ const IconButton = /*#__PURE__*/React.forwardRef(function IconButton(props, ref)
|
|
3462
3479
|
}, className, ref);
|
3463
3480
|
});
|
3464
3481
|
|
3465
|
-
|
3466
|
-
|
3467
|
-
|
3468
|
-
|
3469
|
-
|
3470
|
-
} = props;
|
3471
|
-
const className = cn('bg-white relative flex items-center px-4 h-12 shadow-lg z-10', props.className);
|
3482
|
+
var Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
3483
|
+
var children = props.children,
|
3484
|
+
state = props.state,
|
3485
|
+
onClose = props.onClose;
|
3486
|
+
var className = cn('bg-white relative flex items-center px-4 h-12 shadow-lg z-10', props.className);
|
3472
3487
|
return React.createElement("div", {
|
3473
3488
|
className: className,
|
3474
3489
|
"data-taco": "banner",
|
@@ -3481,32 +3496,32 @@ const Banner = /*#__PURE__*/React.forwardRef(function Banner(props, ref) {
|
|
3481
3496
|
}) : null);
|
3482
3497
|
});
|
3483
3498
|
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
3487
|
-
|
3488
|
-
|
3489
|
-
|
3499
|
+
var _excluded$2 = ["fluid"];
|
3500
|
+
var Button$1 = /*#__PURE__*/React.forwardRef(function Button(props, ref) {
|
3501
|
+
var fluid = props.fluid,
|
3502
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$2);
|
3503
|
+
|
3504
|
+
var className = cn(getButtonClasses(), getAppearanceClasses(otherProps.appearance), 'rounded px-3', {
|
3490
3505
|
'cursor-not-allowed opacity-50': props.disabled,
|
3491
3506
|
'focus:yt-focus active:focus:yt-focus': !props.disabled,
|
3492
3507
|
'w-full': fluid
|
3493
3508
|
}, props.className);
|
3494
|
-
|
3509
|
+
var children = otherProps.children; // add a chevron icon to menu buttons
|
3495
3510
|
|
3496
3511
|
if (typeof otherProps.menu === 'function') {
|
3497
|
-
children = Array.isArray(children) ? [
|
3512
|
+
children = Array.isArray(children) ? [].concat(children, [React.createElement(Icon, {
|
3498
3513
|
key: "chevron-down",
|
3499
3514
|
name: "chevron-down"
|
3500
|
-
})] : [children, React.createElement(Icon, {
|
3515
|
+
})]) : [children, React.createElement(Icon, {
|
3501
3516
|
key: "chevron-down",
|
3502
3517
|
name: "chevron-down"
|
3503
3518
|
})];
|
3504
3519
|
}
|
3505
3520
|
|
3506
|
-
return createButton({
|
3507
|
-
children,
|
3521
|
+
return createButton(_extends({}, otherProps, {
|
3522
|
+
children: children,
|
3508
3523
|
'data-taco': 'button'
|
3509
|
-
}, className, ref);
|
3524
|
+
}), className, ref);
|
3510
3525
|
});
|
3511
3526
|
|
3512
3527
|
function useTimer(duration = 0, callback) {
|
@@ -3962,37 +3977,37 @@ const Provider = props => {
|
|
3962
3977
|
const useTaco = () => React.useContext(Context);
|
3963
3978
|
const useLocalization = () => useTaco().localization;
|
3964
3979
|
|
3965
|
-
|
3966
|
-
className: "dot"
|
3967
|
-
}) : day.getDate();
|
3980
|
+
var _excluded$3 = ["onChange", "value"];
|
3968
3981
|
|
3969
|
-
|
3970
|
-
|
3982
|
+
var renderDay = function renderDay(day, modifiers) {
|
3983
|
+
return modifiers.disabled ? React.createElement("span", {
|
3984
|
+
className: "dot"
|
3985
|
+
}) : day.getDate();
|
3986
|
+
};
|
3987
|
+
|
3988
|
+
var thisYear = /*#__PURE__*/new Date().getFullYear();
|
3989
|
+
var years = [];
|
3971
3990
|
|
3972
|
-
for (
|
3991
|
+
for (var i = thisYear - 10; i <= thisYear + 10; i += 1) {
|
3973
3992
|
years.push(i);
|
3974
3993
|
}
|
3975
3994
|
|
3976
|
-
|
3977
|
-
onMonthChange,
|
3978
|
-
|
3979
|
-
|
3980
|
-
|
3981
|
-
|
3982
|
-
const {
|
3983
|
-
texts: {
|
3984
|
-
calendar: {
|
3985
|
-
actions,
|
3986
|
-
months
|
3987
|
-
}
|
3988
|
-
}
|
3989
|
-
} = useLocalization();
|
3995
|
+
var Navbar = /*#__PURE__*/React.memo(function (_ref) {
|
3996
|
+
var onMonthChange = _ref.onMonthChange,
|
3997
|
+
onNextClick = _ref.onNextClick,
|
3998
|
+
onPreviousClick = _ref.onPreviousClick,
|
3999
|
+
_ref$value = _ref.value,
|
4000
|
+
value = _ref$value === void 0 ? new Date() : _ref$value;
|
3990
4001
|
|
3991
|
-
|
3992
|
-
|
3993
|
-
|
3994
|
-
|
3995
|
-
|
4002
|
+
var _useLocalization = useLocalization(),
|
4003
|
+
_useLocalization$text = _useLocalization.texts.calendar,
|
4004
|
+
actions = _useLocalization$text.actions,
|
4005
|
+
months = _useLocalization$text.months;
|
4006
|
+
|
4007
|
+
var handleChange = function handleChange(event) {
|
4008
|
+
var _event$target$form = event.target.form,
|
4009
|
+
year = _event$target$form.year,
|
4010
|
+
month = _event$target$form.month;
|
3996
4011
|
onMonthChange(new Date(year.value, month.value));
|
3997
4012
|
};
|
3998
4013
|
|
@@ -4005,49 +4020,59 @@ const Navbar = /*#__PURE__*/React.memo(({
|
|
4005
4020
|
name: "month",
|
4006
4021
|
onChange: handleChange,
|
4007
4022
|
value: value.getMonth()
|
4008
|
-
}, months.map((month, i)
|
4009
|
-
|
4010
|
-
|
4011
|
-
|
4023
|
+
}, months.map(function (month, i) {
|
4024
|
+
return React.createElement("option", {
|
4025
|
+
key: month,
|
4026
|
+
value: i
|
4027
|
+
}, month);
|
4028
|
+
})), React.createElement("select", {
|
4012
4029
|
className: "h-8 px-2",
|
4013
4030
|
name: "year",
|
4014
4031
|
onChange: handleChange,
|
4015
4032
|
value: value.getFullYear()
|
4016
|
-
}, years.map(
|
4017
|
-
|
4018
|
-
|
4019
|
-
|
4033
|
+
}, years.map(function (year) {
|
4034
|
+
return React.createElement("option", {
|
4035
|
+
key: year,
|
4036
|
+
value: year
|
4037
|
+
}, String(year));
|
4038
|
+
}))), React.createElement("div", null, React.createElement(IconButton, {
|
4020
4039
|
appearance: "discrete",
|
4021
4040
|
icon: "chevron-left",
|
4022
4041
|
"aria-label": actions.previousMonth,
|
4023
|
-
onClick: ()
|
4042
|
+
onClick: function onClick() {
|
4043
|
+
return onPreviousClick();
|
4044
|
+
},
|
4024
4045
|
rounded: true
|
4025
4046
|
}), React.createElement(IconButton, {
|
4026
4047
|
appearance: "discrete",
|
4027
4048
|
icon: "chevron-right",
|
4028
4049
|
"aria-label": actions.nextMonth,
|
4029
|
-
onClick: ()
|
4050
|
+
onClick: function onClick() {
|
4051
|
+
return onNextClick();
|
4052
|
+
},
|
4030
4053
|
rounded: true
|
4031
4054
|
})));
|
4032
4055
|
});
|
4033
|
-
|
4034
|
-
|
4035
|
-
|
4036
|
-
|
4037
|
-
|
4038
|
-
|
4039
|
-
|
4040
|
-
|
4041
|
-
|
4042
|
-
|
4043
|
-
|
4044
|
-
|
4056
|
+
var Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
4057
|
+
var handleChange = props.onChange,
|
4058
|
+
value = props.value,
|
4059
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$3);
|
4060
|
+
|
4061
|
+
var _useLocalization2 = useLocalization(),
|
4062
|
+
locale = _useLocalization2.locale,
|
4063
|
+
texts = _useLocalization2.texts;
|
4064
|
+
|
4065
|
+
var _React$useState = React.useState(value !== null && value !== void 0 ? value : new Date()),
|
4066
|
+
visibleMonth = _React$useState[0],
|
4067
|
+
setVisibleMonth = _React$useState[1];
|
4068
|
+
|
4069
|
+
React.useEffect(function () {
|
4045
4070
|
if (visibleMonth !== value) {
|
4046
4071
|
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
4047
4072
|
}
|
4048
4073
|
}, [value]);
|
4049
4074
|
|
4050
|
-
|
4075
|
+
var handleDayClick = function handleDayClick(date, modifiers, event) {
|
4051
4076
|
if (modifiers.outside || modifiers.disabled) {
|
4052
4077
|
return;
|
4053
4078
|
}
|
@@ -4055,8 +4080,8 @@ const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4055
4080
|
handleChange(date, event);
|
4056
4081
|
};
|
4057
4082
|
|
4058
|
-
|
4059
|
-
|
4083
|
+
var handleCalendarClickToday = function handleCalendarClickToday() {
|
4084
|
+
var today = new Date(); // set to midday to avoid UTC offset causing dates to be mismatched server side
|
4060
4085
|
|
4061
4086
|
today.setHours(12);
|
4062
4087
|
today.setMinutes(0);
|
@@ -4064,7 +4089,7 @@ const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4064
4089
|
handleChange(today);
|
4065
4090
|
};
|
4066
4091
|
|
4067
|
-
|
4092
|
+
var className = cn('flex bg-white text-xs p-4', otherProps.className);
|
4068
4093
|
return React.createElement("div", {
|
4069
4094
|
"data-taco": "calendar"
|
4070
4095
|
}, React.createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
@@ -4075,14 +4100,18 @@ const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4075
4100
|
firstDayOfWeek: 1,
|
4076
4101
|
months: texts.calendar.months,
|
4077
4102
|
weekdaysShort: texts.calendar.weekdaysShort,
|
4078
|
-
navbarElement:
|
4079
|
-
|
4080
|
-
|
4081
|
-
|
4103
|
+
navbarElement: function navbarElement(navProps) {
|
4104
|
+
return React.createElement(Navbar, Object.assign({}, navProps, {
|
4105
|
+
onMonthChange: setVisibleMonth,
|
4106
|
+
value: visibleMonth
|
4107
|
+
}));
|
4108
|
+
},
|
4082
4109
|
onDayClick: handleDayClick,
|
4083
4110
|
onMonthChange: setVisibleMonth,
|
4084
4111
|
onTodayButtonClick: handleCalendarClickToday,
|
4085
|
-
captionElement: ()
|
4112
|
+
captionElement: function captionElement() {
|
4113
|
+
return null;
|
4114
|
+
},
|
4086
4115
|
todayButton: texts.calendar.actions.today,
|
4087
4116
|
showOutsideDays: true,
|
4088
4117
|
renderDay: renderDay,
|
@@ -4091,30 +4120,32 @@ const Calendar$1 = /*#__PURE__*/React.forwardRef(function Calendar(props, ref) {
|
|
4091
4120
|
})));
|
4092
4121
|
});
|
4093
4122
|
|
4094
|
-
|
4095
|
-
|
4096
|
-
|
4097
|
-
|
4098
|
-
|
4099
|
-
|
4100
|
-
|
4101
|
-
|
4102
|
-
|
4103
|
-
|
4104
|
-
|
4123
|
+
var _excluded$4 = ["checked", "highlighted", "indeterminate", "invalid", "label", "onChange"];
|
4124
|
+
var Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
4125
|
+
var checked = props.checked,
|
4126
|
+
highlighted = props.highlighted,
|
4127
|
+
indeterminate = props.indeterminate,
|
4128
|
+
invalid = props.invalid,
|
4129
|
+
label = props.label,
|
4130
|
+
onChange = props.onChange,
|
4131
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$4);
|
4132
|
+
|
4133
|
+
var className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem]', {
|
4105
4134
|
'mr-2': !!label,
|
4106
4135
|
'border-grey-dark text-blue focus:border-blue focus:yt-focus': !props.disabled && !invalid,
|
4107
4136
|
'border-grey text-blue-light cursor-not-allowed': props.disabled,
|
4108
4137
|
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
4109
4138
|
'border-red text-red focus:border-red focus:yt-focus-red': invalid && !props.disabled
|
4110
4139
|
});
|
4111
|
-
|
4140
|
+
var handleChange;
|
4112
4141
|
|
4113
4142
|
if (onChange) {
|
4114
|
-
handleChange =
|
4143
|
+
handleChange = function handleChange(checked) {
|
4144
|
+
return onChange(checked === 'indeterminate' ? false : checked);
|
4145
|
+
};
|
4115
4146
|
}
|
4116
4147
|
|
4117
|
-
|
4148
|
+
var element = React.createElement(CheckboxPrimitive.Root, Object.assign({}, otherProps, {
|
4118
4149
|
"data-taco": "checkbox",
|
4119
4150
|
checked: indeterminate ? 'indeterminate' : checked,
|
4120
4151
|
className: className,
|
@@ -4128,7 +4159,7 @@ const Checkbox = /*#__PURE__*/React.forwardRef(function Checkbox(props, ref) {
|
|
4128
4159
|
})));
|
4129
4160
|
|
4130
4161
|
if (label) {
|
4131
|
-
|
4162
|
+
var labelClassName = cn('flex items-center cursor-pointer', {
|
4132
4163
|
'cursor-not-allowed text-grey-dark': props.disabled
|
4133
4164
|
}, props.className);
|
4134
4165
|
return React.createElement("label", {
|
@@ -4157,46 +4188,18 @@ const getInputClasses = props => {
|
|
4157
4188
|
return cn('peer bg-white text-black text-sm border font-normal not-italic no-underline rounded inline-flex leading-6 px-2 relative w-full text-ellipsis flex items-center', {
|
4158
4189
|
'cursor-not-allowed text-black bg-grey': props.readOnly,
|
4159
4190
|
'border-grey text-opacity-25 cursor-not-allowed': props.disabled,
|
4160
|
-
[getStateClasses$1(props.state)]: !props.disabled,
|
4161
4191
|
'bg-[rgba(255,255,0,0.075)]': props.highlighted && props.disabled,
|
4162
|
-
'bg-[rgba(255,255,0,0.2)]': props.highlighted && !props.disabled
|
4192
|
+
'bg-[rgba(255,255,0,0.2)]': props.highlighted && !props.disabled,
|
4193
|
+
'border-grey-dark hover:shadow-[0_0_0.1rem_theme(colors.grey.darker)] focus:border-blue-light focus:yt-focus active:border-blue-dark': !props.invalid,
|
4194
|
+
'border-red hover:shadow-[0_0_0.15rem_theme(colors.red.DEFAULT)] focus:border-red-light focus:yt-focus-red active:border-red-dark': props.invalid
|
4163
4195
|
});
|
4164
4196
|
};
|
4165
|
-
const
|
4166
|
-
|
4167
|
-
|
4168
|
-
return 'border-green hover:shadow-[0_0_0.15rem_theme(colors.green.DEFAULT)] focus:border-green-light focus:yt-focus-green active:border-green-dark';
|
4169
|
-
|
4170
|
-
case 'error':
|
4171
|
-
return 'border-red hover:shadow-[0_0_0.15rem_theme(colors.red.DEFAULT)] focus:border-red-light focus:yt-focus-red active:border-red-dark';
|
4172
|
-
|
4173
|
-
case 'warning':
|
4174
|
-
return 'border-yellow-dark hover:shadow-[0_0_0.15rem_theme(colors.yellow.dark)] focus:yt-focus-yellow active:border-yellow-dark';
|
4175
|
-
|
4176
|
-
case 'information':
|
4177
|
-
return 'border-blue hover:shadow-[0_0_0.15rem_theme(colors.blue.dark)] focus:border-blue-light focus:yt-focus active:border-blue-dark';
|
4178
|
-
|
4179
|
-
default:
|
4180
|
-
return 'border-grey-dark hover:shadow-[0_0_0.1rem_theme(colors.grey.darker)] focus:border-blue-light focus:yt-focus active:border-blue-dark';
|
4197
|
+
const getButtonStateClasses = invalid => {
|
4198
|
+
if (invalid) {
|
4199
|
+
return '!border-red focus:!border-red-light focus:yt-focus-red peer-focus:!border-red-light peer-focus:peer-active:!border-red-dark';
|
4181
4200
|
}
|
4182
|
-
};
|
4183
|
-
const getButtonStateClasses = value => {
|
4184
|
-
switch (value) {
|
4185
|
-
case 'success':
|
4186
|
-
return '!border-green focus:!border-green-light focus:yt-focus-green peer-focus:!border-green-light peer-focus:peer-active:!border-green-dark';
|
4187
4201
|
|
4188
|
-
|
4189
|
-
return '!border-red focus:!border-red-light focus:yt-focus-red peer-focus:!border-red-light peer-focus:peer-active:!border-red-dark';
|
4190
|
-
|
4191
|
-
case 'warning':
|
4192
|
-
return '!border-yellow-dark focus:!border-yellow-dark focus:yt-focus-yellow peer-focus:peer-active:!border-yellow-dark';
|
4193
|
-
|
4194
|
-
case 'information':
|
4195
|
-
return '!border-blue focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4196
|
-
|
4197
|
-
default:
|
4198
|
-
return '!border-grey-dark focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4199
|
-
}
|
4202
|
+
return '!border-grey-dark focus:!border-blue-light peer-focus:!border-blue-light peer-focus:peer-active:!border-blue-dark';
|
4200
4203
|
};
|
4201
4204
|
|
4202
4205
|
const Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
@@ -4204,8 +4207,8 @@ const Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4204
4207
|
button,
|
4205
4208
|
icon,
|
4206
4209
|
highlighted,
|
4210
|
+
invalid,
|
4207
4211
|
onKeyDown,
|
4208
|
-
state,
|
4209
4212
|
autoFocus,
|
4210
4213
|
...otherProps
|
4211
4214
|
} = props;
|
@@ -4249,7 +4252,7 @@ const Input = /*#__PURE__*/React.forwardRef(function Input(props, ref) {
|
|
4249
4252
|
|
4250
4253
|
const disabled = (_button$props$disable = button.props.disabled) !== null && _button$props$disable !== void 0 ? _button$props$disable : otherProps.disabled;
|
4251
4254
|
const buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', {
|
4252
|
-
[getButtonStateClasses(
|
4255
|
+
[getButtonStateClasses(invalid)]: !props.disabled
|
4253
4256
|
}, button.props.className);
|
4254
4257
|
extra = React.cloneElement(button, {
|
4255
4258
|
className: buttonClassName,
|
@@ -4389,6 +4392,7 @@ const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(pro
|
|
4389
4392
|
disabled,
|
4390
4393
|
highlighted,
|
4391
4394
|
id,
|
4395
|
+
invalid: _,
|
4392
4396
|
loading,
|
4393
4397
|
onChange: setCurrentIndex,
|
4394
4398
|
onClick,
|
@@ -4396,7 +4400,6 @@ const ScrollableList = /*#__PURE__*/React.forwardRef(function ScrollableList(pro
|
|
4396
4400
|
onKeyDown,
|
4397
4401
|
readOnly,
|
4398
4402
|
scrollOnFocus = false,
|
4399
|
-
state,
|
4400
4403
|
value: currentIndex,
|
4401
4404
|
multiselect,
|
4402
4405
|
selectedIndexes = [],
|
@@ -5042,26 +5045,27 @@ var useBoundingClientRectListener = function useBoundingClientRectListener(ref)
|
|
5042
5045
|
return dimensions;
|
5043
5046
|
};
|
5044
5047
|
|
5045
|
-
|
5046
|
-
|
5047
|
-
|
5048
|
-
|
5049
|
-
|
5050
|
-
|
5051
|
-
|
5052
|
-
|
5053
|
-
|
5054
|
-
|
5055
|
-
|
5056
|
-
|
5057
|
-
|
5058
|
-
|
5059
|
-
|
5060
|
-
|
5061
|
-
|
5062
|
-
|
5063
|
-
|
5064
|
-
|
5048
|
+
var _excluded$5 = ["className", "dialog", "style"];
|
5049
|
+
var Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
5050
|
+
var externalClassName = props.className,
|
5051
|
+
dialog = props.dialog,
|
5052
|
+
style = props.style,
|
5053
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$5);
|
5054
|
+
|
5055
|
+
var _useCombobox = useCombobox(otherProps, ref),
|
5056
|
+
combobox = _useCombobox.combobox,
|
5057
|
+
button = _useCombobox.button,
|
5058
|
+
input = _useCombobox.input,
|
5059
|
+
popover = _useCombobox.popover,
|
5060
|
+
list = _useCombobox.list;
|
5061
|
+
|
5062
|
+
var internalRef = React.useRef(null);
|
5063
|
+
|
5064
|
+
var _useLocalization = useLocalization(),
|
5065
|
+
texts = _useLocalization.texts;
|
5066
|
+
|
5067
|
+
var selectDimensions = useBoundingClientRectListener(internalRef);
|
5068
|
+
var className = cn('inline-flex relative', {
|
5065
5069
|
'yt-combobox--inline': props.inline
|
5066
5070
|
}, externalClassName);
|
5067
5071
|
return React.createElement("span", {
|
@@ -5080,7 +5084,7 @@ const Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
|
5080
5084
|
appearance: "discrete",
|
5081
5085
|
className: "!border-l-0 focus:!border-none focus:!shadow-none active:!border-none",
|
5082
5086
|
icon: popover.open ? 'chevron-up' : 'chevron-down',
|
5083
|
-
onClick: ()
|
5087
|
+
onClick: function onClick() {
|
5084
5088
|
var _input$ref$current;
|
5085
5089
|
|
5086
5090
|
popover.onOpenChange(true);
|
@@ -5091,7 +5095,7 @@ const Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
|
5091
5095
|
icon: "list-search",
|
5092
5096
|
disabled: props.readOnly || props.disabled,
|
5093
5097
|
dialog: dialog,
|
5094
|
-
onFocus: event
|
5098
|
+
onFocus: function onFocus(event) {
|
5095
5099
|
var _input$ref$current2;
|
5096
5100
|
|
5097
5101
|
// Prevents the default focus behaviour of showing the tooltip, on parent tooltip element
|
@@ -5104,7 +5108,7 @@ const Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
|
|
5104
5108
|
}) : undefined
|
5105
5109
|
})))), React.createElement(PopoverPrimitive.Content, {
|
5106
5110
|
align: "start",
|
5107
|
-
onOpenAutoFocus: event
|
5111
|
+
onOpenAutoFocus: function onOpenAutoFocus(event) {
|
5108
5112
|
event.preventDefault();
|
5109
5113
|
},
|
5110
5114
|
sideOffset: 4
|
@@ -5715,12 +5719,14 @@ const Extra = /*#__PURE__*/React.forwardRef(function DialogExtra(props, ref) {
|
|
5715
5719
|
});
|
5716
5720
|
Extra.displayName = 'DialogExtra';
|
5717
5721
|
|
5718
|
-
|
5719
|
-
|
5720
|
-
|
5721
|
-
|
5722
|
-
|
5723
|
-
|
5722
|
+
var _excluded$6 = ["children", "closeOnEscape", "defaultOpen", "draggable", "onChange", "onClose", "open", "showCloseButton", "size", "trigger"];
|
5723
|
+
|
5724
|
+
var useSeparatedChildren = function useSeparatedChildren(initialChildren) {
|
5725
|
+
return React.useMemo(function () {
|
5726
|
+
var children = [];
|
5727
|
+
var drawer;
|
5728
|
+
var extra;
|
5729
|
+
React.Children.toArray(initialChildren).forEach(function (child) {
|
5724
5730
|
var _child$type, _child$type2;
|
5725
5731
|
|
5726
5732
|
if (((_child$type = child.type) === null || _child$type === void 0 ? void 0 : _child$type.displayName) === Drawer.displayName) {
|
@@ -5735,39 +5741,55 @@ const useSeparatedChildren = initialChildren => {
|
|
5735
5741
|
}, [initialChildren]);
|
5736
5742
|
};
|
5737
5743
|
|
5738
|
-
|
5739
|
-
|
5740
|
-
|
5741
|
-
|
5742
|
-
|
5743
|
-
|
5744
|
-
|
5745
|
-
|
5746
|
-
|
5747
|
-
|
5748
|
-
|
5749
|
-
|
5750
|
-
|
5751
|
-
|
5752
|
-
|
5753
|
-
|
5754
|
-
|
5755
|
-
|
5756
|
-
|
5757
|
-
|
5758
|
-
|
5759
|
-
|
5760
|
-
|
5761
|
-
|
5762
|
-
|
5763
|
-
|
5764
|
-
|
5765
|
-
|
5766
|
-
|
5767
|
-
|
5768
|
-
|
5769
|
-
|
5770
|
-
|
5744
|
+
var Dialog = /*#__PURE__*/React.forwardRef(function Dialog(props, ref) {
|
5745
|
+
var initialChildren = props.children,
|
5746
|
+
_props$closeOnEscape = props.closeOnEscape,
|
5747
|
+
closeOnEscape = _props$closeOnEscape === void 0 ? true : _props$closeOnEscape,
|
5748
|
+
defaultOpen = props.defaultOpen,
|
5749
|
+
_props$draggable = props.draggable,
|
5750
|
+
draggable = _props$draggable === void 0 ? false : _props$draggable,
|
5751
|
+
onChange = props.onChange,
|
5752
|
+
onClose = props.onClose,
|
5753
|
+
open = props.open,
|
5754
|
+
_props$showCloseButto = props.showCloseButton,
|
5755
|
+
showCloseButton = _props$showCloseButto === void 0 ? true : _props$showCloseButto,
|
5756
|
+
_props$size = props.size,
|
5757
|
+
size = _props$size === void 0 ? 'sm' : _props$size,
|
5758
|
+
trigger = props.trigger,
|
5759
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$6);
|
5760
|
+
|
5761
|
+
var _useSeparatedChildren = useSeparatedChildren(initialChildren),
|
5762
|
+
children = _useSeparatedChildren[0],
|
5763
|
+
drawer = _useSeparatedChildren[1],
|
5764
|
+
extra = _useSeparatedChildren[2];
|
5765
|
+
|
5766
|
+
var _React$useState = React.useState(false),
|
5767
|
+
drawerOpen = _React$useState[0],
|
5768
|
+
setDrawerOpen = _React$useState[1];
|
5769
|
+
|
5770
|
+
var context = React.useMemo(function () {
|
5771
|
+
return {
|
5772
|
+
closeOnEscape: closeOnEscape,
|
5773
|
+
draggable: draggable,
|
5774
|
+
drawer: {
|
5775
|
+
open: drawerOpen,
|
5776
|
+
toggle: function toggle() {
|
5777
|
+
return setDrawerOpen(function (isDrawerOpen) {
|
5778
|
+
return !isDrawerOpen;
|
5779
|
+
});
|
5780
|
+
}
|
5781
|
+
},
|
5782
|
+
elements: {
|
5783
|
+
drawer: drawer,
|
5784
|
+
extra: extra
|
5785
|
+
},
|
5786
|
+
onClose: onClose,
|
5787
|
+
props: otherProps,
|
5788
|
+
showCloseButton: showCloseButton,
|
5789
|
+
size: size,
|
5790
|
+
ref: ref
|
5791
|
+
};
|
5792
|
+
}, [closeOnEscape, drawerOpen, draggable, drawer, extra, open, otherProps, showCloseButton]);
|
5771
5793
|
return React.createElement(DialogContext.Provider, {
|
5772
5794
|
value: context
|
5773
5795
|
}, React.createElement(DialogPrimitive.Root, {
|
@@ -5784,23 +5806,21 @@ Dialog.Extra = Extra;
|
|
5784
5806
|
Dialog.Drawer = Drawer;
|
5785
5807
|
Dialog.Close = Close$2;
|
5786
5808
|
|
5787
|
-
|
5788
|
-
|
5789
|
-
|
5790
|
-
|
5791
|
-
|
5792
|
-
|
5793
|
-
|
5794
|
-
|
5795
|
-
|
5809
|
+
var _excluded$7 = ["disabled", "children", "invalid", "message"];
|
5810
|
+
var Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
5811
|
+
var disabled = props.disabled,
|
5812
|
+
children = props.children,
|
5813
|
+
_props$invalid = props.invalid,
|
5814
|
+
invalid = _props$invalid === void 0 ? false : _props$invalid,
|
5815
|
+
message = props.message,
|
5816
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded$7);
|
5817
|
+
|
5818
|
+
var className = cn('flex flex-col font-bold text-xs leading-loose pb-4 min-h-[theme(spacing.18)]', {
|
5796
5819
|
'text-grey-dark': disabled
|
5797
5820
|
}, props.className);
|
5798
|
-
|
5799
|
-
'text-grey-darkest': !
|
5800
|
-
'text-red':
|
5801
|
-
'text-green': state === 'success',
|
5802
|
-
'text-blue': state === 'information',
|
5803
|
-
'text-yellow-dark': state === 'warning',
|
5821
|
+
var messageClassName = cn('h-4 text-xs text-left leading-normal font-normal truncate -mb-4', {
|
5822
|
+
'text-grey-darkest': !invalid,
|
5823
|
+
'text-red': invalid,
|
5804
5824
|
'opacity-50': disabled
|
5805
5825
|
}, props.className);
|
5806
5826
|
return React.createElement("label", Object.assign({}, otherProps, {
|
@@ -5809,7 +5829,7 @@ const Field = /*#__PURE__*/React.forwardRef(function Field(props, ref) {
|
|
5809
5829
|
ref: ref
|
5810
5830
|
}), children, message && React.createElement("span", {
|
5811
5831
|
className: messageClassName,
|
5812
|
-
role:
|
5832
|
+
role: invalid ? 'alert' : undefined
|
5813
5833
|
}, message));
|
5814
5834
|
});
|
5815
5835
|
|
@@ -5947,6 +5967,7 @@ const useListbox = ({
|
|
5947
5967
|
disabled,
|
5948
5968
|
emptyValue,
|
5949
5969
|
id: nativeId,
|
5970
|
+
invalid,
|
5950
5971
|
name,
|
5951
5972
|
onChange,
|
5952
5973
|
onFocus,
|
@@ -6056,6 +6077,7 @@ const useListbox = ({
|
|
6056
6077
|
data,
|
6057
6078
|
disabled,
|
6058
6079
|
id,
|
6080
|
+
invalid,
|
6059
6081
|
onChange: handleListboxChange,
|
6060
6082
|
onFocus: handleListboxFocus,
|
6061
6083
|
onKeyDown: handleListboxKeyDown,
|
@@ -7099,7 +7121,10 @@ const useSelect = ({
|
|
7099
7121
|
}
|
7100
7122
|
}, [defaultValue]);
|
7101
7123
|
React.useEffect(() => {
|
7102
|
-
|
7124
|
+
// If emptyValue is defined, then set emptyValue
|
7125
|
+
if (emptyValue !== undefined && value === emptyValue) {
|
7126
|
+
setInputValueByRef$1(internalInputRef.current, value);
|
7127
|
+
} else if (value !== undefined && data.some(option => option.value === value)) {
|
7103
7128
|
setInputValueByRef$1(internalInputRef.current, value);
|
7104
7129
|
} else if (data.length && defaultValue === undefined) {
|
7105
7130
|
setInputValueByRef$1(internalInputRef.current, data[0].value);
|
@@ -7268,7 +7293,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref)
|
|
7268
7293
|
const className = cn('inline-flex relative w-full', {
|
7269
7294
|
'yt-select--readonly': props.readOnly
|
7270
7295
|
}, externalClassName);
|
7271
|
-
const inputClassname = cn(getInputClasses(props), 'text-left pr-0', {
|
7296
|
+
const inputClassname = cn(getInputClasses(props), 'h-8 text-left pr-0', {
|
7272
7297
|
'border-blue': popover.open
|
7273
7298
|
});
|
7274
7299
|
React.useEffect(() => {
|
@@ -7287,6 +7312,7 @@ const BaseSelect = /*#__PURE__*/React.forwardRef(function BaseSelect(props, ref)
|
|
7287
7312
|
|
7288
7313
|
const commonListboxProps = { ...listbox,
|
7289
7314
|
className: 'w-auto',
|
7315
|
+
invalid: undefined,
|
7290
7316
|
style: {
|
7291
7317
|
minWidth: selectDimensions === null || selectDimensions === void 0 ? void 0 : selectDimensions.width
|
7292
7318
|
},
|
@@ -8715,7 +8741,7 @@ const BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(prop
|
|
8715
8741
|
}, headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup, index) => React__default.createElement("div", {
|
8716
8742
|
key: index,
|
8717
8743
|
role: "row",
|
8718
|
-
className: "border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-
|
8744
|
+
className: "border-grey-light flex h-auto min-h-[2.5rem] w-full select-none border-t-0 border-b-2 font-bold"
|
8719
8745
|
}, headerGroup.headers.map((cell, index) => React__default.createElement(Column, {
|
8720
8746
|
key: index,
|
8721
8747
|
index: index,
|
@@ -9173,8 +9199,8 @@ const Textarea = /*#__PURE__*/React.forwardRef(function Textarea(props, ref) {
|
|
9173
9199
|
const {
|
9174
9200
|
defaultValue: _,
|
9175
9201
|
highlighted,
|
9202
|
+
invalid,
|
9176
9203
|
onKeyDown,
|
9177
|
-
state,
|
9178
9204
|
...otherProps
|
9179
9205
|
} = props;
|
9180
9206
|
const classNames = cn(getInputClasses(props), 'py-1 min-h-[75px] disabled:resize-none', props.className); // home and end keys only navigate to the start/end of textarea value if the textarea container does not scroll
|