@economic/taco 1.1.10 → 1.1.12
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/esm/_virtual/_rollupPluginBabelHelpers.js +18 -1
- package/dist/esm/_virtual/_rollupPluginBabelHelpers.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/Card/Card.js +15 -13
- package/dist/esm/components/Card/Card.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 +26 -23
- package/dist/esm/components/Combobox/Combobox.js.map +1 -1
- package/dist/esm/components/Datepicker/Datepicker.js +52 -48
- package/dist/esm/components/Datepicker/Datepicker.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/Dialog/components/Trigger.js +1 -1
- package/dist/esm/components/Dialog/components/Trigger.js.map +1 -1
- package/dist/esm/components/Field/Field.js +12 -10
- package/dist/esm/components/Field/Field.js.map +1 -1
- package/dist/esm/components/Form/Form.js +8 -6
- package/dist/esm/components/Form/Form.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js +36 -28
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +1 -1
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +3 -0
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/hooks/useDropTarget.js +10 -7
- package/dist/esm/utils/hooks/useDropTarget.js.map +1 -1
- package/dist/esm/utils/hooks/useProxiedRef.js +3 -3
- package/dist/esm/utils/hooks/useProxiedRef.js.map +1 -1
- package/dist/esm/utils/mergeRefs.js +3 -3
- package/dist/esm/utils/mergeRefs.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/taco.cjs.development.js +350 -281
- 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/mergeRefs.d.ts +1 -1
- package/dist/utils/tailwind.d.ts +1 -1
- package/package.json +3 -4
- package/tailwind.config.js +9 -0
@@ -1,3 +1,20 @@
|
|
1
|
+
function _extends() {
|
2
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
3
|
+
for (var i = 1; i < arguments.length; i++) {
|
4
|
+
var source = arguments[i];
|
5
|
+
|
6
|
+
for (var key in source) {
|
7
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
8
|
+
target[key] = source[key];
|
9
|
+
}
|
10
|
+
}
|
11
|
+
}
|
12
|
+
|
13
|
+
return target;
|
14
|
+
};
|
15
|
+
return _extends.apply(this, arguments);
|
16
|
+
}
|
17
|
+
|
1
18
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
2
19
|
if (source == null) return {};
|
3
20
|
var target = {};
|
@@ -13,5 +30,5 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
13
30
|
return target;
|
14
31
|
}
|
15
32
|
|
16
|
-
export { _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose };
|
33
|
+
export { _extends as extends, _objectWithoutPropertiesLoose as objectWithoutPropertiesLoose };
|
17
34
|
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1,34 +1,35 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import { forwardRef, createElement } from 'react';
|
2
3
|
import cn from 'classnames';
|
3
4
|
import { Icon } from '../Icon/Icon.js';
|
4
5
|
import { getButtonClasses, getAppearanceClasses, createButton } from './util.js';
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
var _excluded = ["fluid"];
|
8
|
+
var Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
9
|
+
var fluid = props.fluid,
|
10
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
11
|
+
|
12
|
+
var className = cn(getButtonClasses(), getAppearanceClasses(otherProps.appearance), 'rounded px-3', {
|
12
13
|
'cursor-not-allowed opacity-50': props.disabled,
|
13
14
|
'focus:yt-focus active:focus:yt-focus': !props.disabled,
|
14
15
|
'w-full': fluid
|
15
16
|
}, props.className);
|
16
|
-
|
17
|
+
var children = otherProps.children; // add a chevron icon to menu buttons
|
17
18
|
|
18
19
|
if (typeof otherProps.menu === 'function') {
|
19
|
-
children = Array.isArray(children) ? [
|
20
|
+
children = Array.isArray(children) ? [].concat(children, [createElement(Icon, {
|
20
21
|
key: "chevron-down",
|
21
22
|
name: "chevron-down"
|
22
|
-
})] : [children, createElement(Icon, {
|
23
|
+
})]) : [children, createElement(Icon, {
|
23
24
|
key: "chevron-down",
|
24
25
|
name: "chevron-down"
|
25
26
|
})];
|
26
27
|
}
|
27
28
|
|
28
|
-
return createButton({
|
29
|
-
children,
|
29
|
+
return createButton(_extends({}, otherProps, {
|
30
|
+
children: children,
|
30
31
|
'data-taco': 'button'
|
31
|
-
}, className, ref);
|
32
|
+
}), className, ref);
|
32
33
|
});
|
33
34
|
|
34
35
|
export { Button };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { Appearance } from '../../types';\r\nimport * as ButtonPrimitive from '../../primitives/Button';\r\nimport { getAppearanceClasses, getButtonClasses, createButton } from './util';\r\nimport { HangerProps } from '../Hanger/Hanger';\r\nimport { MenuProps } from '../Menu/Menu';\r\nimport { DialogProps } from '../Dialog/Dialog';\r\nimport { PopoverProps } from '../Popover/Popover';\r\nimport './Button.css';\r\nimport { Icon } from '../Icon/Icon';\r\n\r\nexport type ButtonProps = ButtonPrimitive.ButtonProps & {\r\n /** Appearance will change the style of the button */\r\n appearance?: Appearance;\r\n /**\r\n * Dialog component associated with the button, clicking the button will open the dialog.\r\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\r\n * the button should be only to open the associated dialog when clicked.\r\n */\r\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\r\n /** If fluid, button expands to the width of it's container */\r\n fluid?: boolean;\r\n /** Hanger component associated with the button. */\r\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\r\n /** Menu component associated with the button. */\r\n menu?: (props: Partial<MenuProps>) => JSX.Element;\r\n /**\r\n * Popover component associated with the button, clicking the button will open the popover.\r\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\r\n * the button should be only to open the associated popover when clicked.\r\n */\r\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\r\n /** A tooltip to show when hovering over the button */\r\n tooltip?: string;\r\n};\r\n\r\nexport const Button = React.forwardRef(function Button(\r\n props: ButtonProps,\r\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\r\n) {\r\n const { fluid, ...otherProps } = props;\r\n const className = cn(\r\n getButtonClasses(),\r\n getAppearanceClasses(otherProps.appearance),\r\n 'rounded px-3',\r\n {\r\n 'cursor-not-allowed opacity-50': props.disabled,\r\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\r\n 'w-full': fluid,\r\n },\r\n props.className\r\n );\r\n\r\n let children = otherProps.children;\r\n\r\n // add a chevron icon to menu buttons\r\n if (typeof otherProps.menu === 'function') {\r\n children = Array.isArray(children)\r\n ? [...children, <Icon key=\"chevron-down\" name=\"chevron-down\" />]\r\n : [children, <Icon key=\"chevron-down\" name=\"chevron-down\" />];\r\n }\r\n\r\n return createButton({ ...otherProps, children, 'data-taco': 'button' }, className, ref);\r\n});\r\n"],"names":["Button","React","props","ref","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","appearance","disabled","children","menu","Array","isArray","Icon","key","name","createButton"],"mappings":"
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { Appearance } from '../../types';\r\nimport * as ButtonPrimitive from '../../primitives/Button';\r\nimport { getAppearanceClasses, getButtonClasses, createButton } from './util';\r\nimport { HangerProps } from '../Hanger/Hanger';\r\nimport { MenuProps } from '../Menu/Menu';\r\nimport { DialogProps } from '../Dialog/Dialog';\r\nimport { PopoverProps } from '../Popover/Popover';\r\nimport './Button.css';\r\nimport { Icon } from '../Icon/Icon';\r\n\r\nexport type ButtonProps = ButtonPrimitive.ButtonProps & {\r\n /** Appearance will change the style of the button */\r\n appearance?: Appearance;\r\n /**\r\n * Dialog component associated with the button, clicking the button will open the dialog.\r\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\r\n * the button should be only to open the associated dialog when clicked.\r\n */\r\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\r\n /** If fluid, button expands to the width of it's container */\r\n fluid?: boolean;\r\n /** Hanger component associated with the button. */\r\n hanger?: (props: Partial<HangerProps>) => JSX.Element;\r\n /** Menu component associated with the button. */\r\n menu?: (props: Partial<MenuProps>) => JSX.Element;\r\n /**\r\n * Popover component associated with the button, clicking the button will open the popover.\r\n * *Note* that `onClick` event on button won't be handled, as in this case, the purpose of\r\n * the button should be only to open the associated popover when clicked.\r\n */\r\n popover?: (props: Partial<PopoverProps>) => JSX.Element;\r\n /** A tooltip to show when hovering over the button */\r\n tooltip?: string;\r\n};\r\n\r\nexport const Button = React.forwardRef(function Button(\r\n props: ButtonProps,\r\n ref: React.Ref<HTMLButtonElement | HTMLAnchorElement>\r\n) {\r\n const { fluid, ...otherProps } = props;\r\n const className = cn(\r\n getButtonClasses(),\r\n getAppearanceClasses(otherProps.appearance),\r\n 'rounded px-3',\r\n {\r\n 'cursor-not-allowed opacity-50': props.disabled,\r\n 'focus:yt-focus active:focus:yt-focus': !props.disabled,\r\n 'w-full': fluid,\r\n },\r\n props.className\r\n );\r\n\r\n let children = otherProps.children;\r\n\r\n // add a chevron icon to menu buttons\r\n if (typeof otherProps.menu === 'function') {\r\n children = Array.isArray(children)\r\n ? [...children, <Icon key=\"chevron-down\" name=\"chevron-down\" />]\r\n : [children, <Icon key=\"chevron-down\" name=\"chevron-down\" />];\r\n }\r\n\r\n return createButton({ ...otherProps, children, 'data-taco': 'button' }, className, ref);\r\n});\r\n"],"names":["Button","React","props","ref","fluid","otherProps","className","cn","getButtonClasses","getAppearanceClasses","appearance","disabled","children","menu","Array","isArray","Icon","key","name","createButton"],"mappings":";;;;;;;IAqCaA,MAAM,gBAAGC,UAAA,CAAiB,SAASD,MAAT,CACnCE,KADmC,EAEnCC,GAFmC;EAInC,IAAQC,KAAR,GAAiCF,KAAjC,CAAQE,KAAR;MAAkBC,UAAlB,iCAAiCH,KAAjC;;EACA,IAAMI,SAAS,GAAGC,EAAE,CAChBC,gBAAgB,EADA,EAEhBC,oBAAoB,CAACJ,UAAU,CAACK,UAAZ,CAFJ,EAGhB,cAHgB,EAIhB;IACI,iCAAiCR,KAAK,CAACS,QAD3C;IAEI,wCAAwC,CAACT,KAAK,CAACS,QAFnD;IAGI,UAAUP;GAPE,EAShBF,KAAK,CAACI,SATU,CAApB;EAYA,IAAIM,QAAQ,GAAGP,UAAU,CAACO,QAA1B;;EAGA,IAAI,OAAOP,UAAU,CAACQ,IAAlB,KAA2B,UAA/B,EAA2C;IACvCD,QAAQ,GAAGE,KAAK,CAACC,OAAN,CAAcH,QAAd,cACDA,QADC,GACSX,aAAA,CAACe,IAAD;MAAMC,GAAG,EAAC;MAAeC,IAAI,EAAC;KAA9B,CADT,KAEL,CAACN,QAAD,EAAWX,aAAA,CAACe,IAAD;MAAMC,GAAG,EAAC;MAAeC,IAAI,EAAC;KAA9B,CAAX,CAFN;;;EAKJ,OAAOC,YAAY,cAAMd,UAAN;IAAkBO,QAAQ,EAARA,QAAlB;IAA4B,aAAa;MAAYN,SAArD,EAAgEH,GAAhE,CAAnB;AACH,CA3BqB;;;;"}
|
@@ -1,40 +1,41 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import { forwardRef, useState, useEffect, createElement, memo } from 'react';
|
2
3
|
import cn from 'classnames';
|
3
4
|
import { IconButton } from '../IconButton/IconButton.js';
|
4
5
|
import ReactDayPicker from 'react-day-picker';
|
5
6
|
import { useLocalization } from '../Provider/Provider.js';
|
6
7
|
|
7
|
-
|
8
|
-
className: "dot"
|
9
|
-
}) : day.getDate();
|
8
|
+
var _excluded = ["onChange", "value"];
|
10
9
|
|
11
|
-
|
12
|
-
|
10
|
+
var renderDay = function renderDay(day, modifiers) {
|
11
|
+
return modifiers.disabled ? createElement("span", {
|
12
|
+
className: "dot"
|
13
|
+
}) : day.getDate();
|
14
|
+
};
|
13
15
|
|
14
|
-
|
16
|
+
var thisYear = /*#__PURE__*/new Date().getFullYear();
|
17
|
+
var years = [];
|
18
|
+
|
19
|
+
for (var i = thisYear - 10; i <= thisYear + 10; i += 1) {
|
15
20
|
years.push(i);
|
16
21
|
}
|
17
22
|
|
18
|
-
|
19
|
-
onMonthChange,
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
const {
|
25
|
-
texts: {
|
26
|
-
calendar: {
|
27
|
-
actions,
|
28
|
-
months
|
29
|
-
}
|
30
|
-
}
|
31
|
-
} = useLocalization();
|
23
|
+
var Navbar = /*#__PURE__*/memo(function (_ref) {
|
24
|
+
var onMonthChange = _ref.onMonthChange,
|
25
|
+
onNextClick = _ref.onNextClick,
|
26
|
+
onPreviousClick = _ref.onPreviousClick,
|
27
|
+
_ref$value = _ref.value,
|
28
|
+
value = _ref$value === void 0 ? new Date() : _ref$value;
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
var _useLocalization = useLocalization(),
|
31
|
+
_useLocalization$text = _useLocalization.texts.calendar,
|
32
|
+
actions = _useLocalization$text.actions,
|
33
|
+
months = _useLocalization$text.months;
|
34
|
+
|
35
|
+
var handleChange = function handleChange(event) {
|
36
|
+
var _event$target$form = event.target.form,
|
37
|
+
year = _event$target$form.year,
|
38
|
+
month = _event$target$form.month;
|
38
39
|
onMonthChange(new Date(year.value, month.value));
|
39
40
|
};
|
40
41
|
|
@@ -47,49 +48,59 @@ const Navbar = /*#__PURE__*/memo(({
|
|
47
48
|
name: "month",
|
48
49
|
onChange: handleChange,
|
49
50
|
value: value.getMonth()
|
50
|
-
}, months.map((month, i)
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
}, months.map(function (month, i) {
|
52
|
+
return createElement("option", {
|
53
|
+
key: month,
|
54
|
+
value: i
|
55
|
+
}, month);
|
56
|
+
})), createElement("select", {
|
54
57
|
className: "h-8 px-2",
|
55
58
|
name: "year",
|
56
59
|
onChange: handleChange,
|
57
60
|
value: value.getFullYear()
|
58
|
-
}, years.map(
|
59
|
-
|
60
|
-
|
61
|
-
|
61
|
+
}, years.map(function (year) {
|
62
|
+
return createElement("option", {
|
63
|
+
key: year,
|
64
|
+
value: year
|
65
|
+
}, String(year));
|
66
|
+
}))), createElement("div", null, createElement(IconButton, {
|
62
67
|
appearance: "discrete",
|
63
68
|
icon: "chevron-left",
|
64
69
|
"aria-label": actions.previousMonth,
|
65
|
-
onClick: ()
|
70
|
+
onClick: function onClick() {
|
71
|
+
return onPreviousClick();
|
72
|
+
},
|
66
73
|
rounded: true
|
67
74
|
}), createElement(IconButton, {
|
68
75
|
appearance: "discrete",
|
69
76
|
icon: "chevron-right",
|
70
77
|
"aria-label": actions.nextMonth,
|
71
|
-
onClick: ()
|
78
|
+
onClick: function onClick() {
|
79
|
+
return onNextClick();
|
80
|
+
},
|
72
81
|
rounded: true
|
73
82
|
})));
|
74
83
|
});
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
var Calendar = /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
85
|
+
var handleChange = props.onChange,
|
86
|
+
value = props.value,
|
87
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
88
|
+
|
89
|
+
var _useLocalization2 = useLocalization(),
|
90
|
+
locale = _useLocalization2.locale,
|
91
|
+
texts = _useLocalization2.texts;
|
92
|
+
|
93
|
+
var _React$useState = useState(value !== null && value !== void 0 ? value : new Date()),
|
94
|
+
visibleMonth = _React$useState[0],
|
95
|
+
setVisibleMonth = _React$useState[1];
|
96
|
+
|
97
|
+
useEffect(function () {
|
87
98
|
if (visibleMonth !== value) {
|
88
99
|
setVisibleMonth(value !== null && value !== void 0 ? value : new Date());
|
89
100
|
}
|
90
101
|
}, [value]);
|
91
102
|
|
92
|
-
|
103
|
+
var handleDayClick = function handleDayClick(date, modifiers, event) {
|
93
104
|
if (modifiers.outside || modifiers.disabled) {
|
94
105
|
return;
|
95
106
|
}
|
@@ -97,8 +108,8 @@ const Calendar = /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
97
108
|
handleChange(date, event);
|
98
109
|
};
|
99
110
|
|
100
|
-
|
101
|
-
|
111
|
+
var handleCalendarClickToday = function handleCalendarClickToday() {
|
112
|
+
var today = new Date(); // set to midday to avoid UTC offset causing dates to be mismatched server side
|
102
113
|
|
103
114
|
today.setHours(12);
|
104
115
|
today.setMinutes(0);
|
@@ -106,7 +117,7 @@ const Calendar = /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
106
117
|
handleChange(today);
|
107
118
|
};
|
108
119
|
|
109
|
-
|
120
|
+
var className = cn('flex bg-white text-xs p-4', otherProps.className);
|
110
121
|
return createElement("div", {
|
111
122
|
"data-taco": "calendar"
|
112
123
|
}, createElement(ReactDayPicker, Object.assign({}, otherProps, {
|
@@ -117,14 +128,18 @@ const Calendar = /*#__PURE__*/forwardRef(function Calendar(props, ref) {
|
|
117
128
|
firstDayOfWeek: 1,
|
118
129
|
months: texts.calendar.months,
|
119
130
|
weekdaysShort: texts.calendar.weekdaysShort,
|
120
|
-
navbarElement:
|
121
|
-
|
122
|
-
|
123
|
-
|
131
|
+
navbarElement: function navbarElement(navProps) {
|
132
|
+
return createElement(Navbar, Object.assign({}, navProps, {
|
133
|
+
onMonthChange: setVisibleMonth,
|
134
|
+
value: visibleMonth
|
135
|
+
}));
|
136
|
+
},
|
124
137
|
onDayClick: handleDayClick,
|
125
138
|
onMonthChange: setVisibleMonth,
|
126
139
|
onTodayButtonClick: handleCalendarClickToday,
|
127
|
-
captionElement: ()
|
140
|
+
captionElement: function captionElement() {
|
141
|
+
return null;
|
142
|
+
},
|
128
143
|
todayButton: texts.calendar.actions.today,
|
129
144
|
showOutsideDays: true,
|
130
145
|
renderDay: renderDay,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Calendar.js","sources":["../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport ReactDayPicker, { NavbarElementProps, DayModifiers } from 'react-day-picker';\r\nimport { useLocalization } from '../Provider/Provider';\r\nimport './Calendar.css';\r\nimport { IconButton } from '../IconButton/IconButton';\r\n\r\nexport type CalendarTextsActions = {\r\n /** Aria-label for previous month action button */\r\n previousMonth: string;\r\n /** Aria-label for next month action button */\r\n nextMonth: string;\r\n /** Aria-label for previous year action button */\r\n previousYear: string;\r\n /** Aria-label for next year action button */\r\n nextYear: string;\r\n /** Text displayed within today action button */\r\n today: string;\r\n};\r\n\r\nexport type CalendarTexts = {\r\n /** Text and aria-label for action buttons in Calendar */\r\n actions: CalendarTextsActions;\r\n /** Text abbreviation for months in Calendar's header, starting with January */\r\n months: string[];\r\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\r\n weekdaysShort: string[];\r\n};\r\n\r\nconst renderDay = (day: Date, modifiers: DayModifiers): React.ReactNode =>\r\n modifiers.disabled ? <span className=\"dot\" /> : day.getDate();\r\n\r\n/** @internal */\r\ntype CustomNavbarElementProps = NavbarElementProps & {\r\n showYearControls?: boolean;\r\n onMonthChange: (month: Date) => void;\r\n value?: Date;\r\n};\r\n\r\nconst thisYear = new Date().getFullYear();\r\nconst years: number[] = [];\r\n\r\nfor (let i = thisYear - 10; i <= thisYear + 10; i += 1) {\r\n years.push(i);\r\n}\r\n\r\nconst Navbar = React.memo(\r\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\r\n const {\r\n texts: {\r\n calendar: { actions, months },\r\n },\r\n } = useLocalization();\r\n\r\n const handleChange = function handleChange(event) {\r\n const { year, month } = event.target.form;\r\n onMonthChange(new Date(year.value, month.value));\r\n };\r\n\r\n return (\r\n <div className=\"mb-2 flex items-center justify-between\">\r\n <form className=\"inline-flex space-x-1\">\r\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\r\n {months.map((month, i) => (\r\n <option key={month} value={i}>\r\n {month}\r\n </option>\r\n ))}\r\n </select>\r\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\r\n {years.map(year => (\r\n <option key={year} value={year}>\r\n {String(year)}\r\n </option>\r\n ))}\r\n </select>\r\n </form>\r\n <div>\r\n <IconButton\r\n appearance=\"discrete\"\r\n icon=\"chevron-left\"\r\n aria-label={actions.previousMonth}\r\n onClick={() => onPreviousClick()}\r\n rounded\r\n />\r\n <IconButton\r\n appearance=\"discrete\"\r\n icon=\"chevron-right\"\r\n aria-label={actions.nextMonth}\r\n onClick={() => onNextClick()}\r\n rounded\r\n />\r\n </div>\r\n </div>\r\n );\r\n }\r\n);\r\n\r\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\r\n /** Handler called when a day is clicked in calendar */\r\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\r\n value?: Date;\r\n};\r\n\r\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\r\n const { onChange: handleChange, value, ...otherProps } = props;\r\n const { locale, texts } = useLocalization();\r\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\r\n\r\n React.useEffect(() => {\r\n if (visibleMonth !== value) {\r\n setVisibleMonth(value ?? new Date());\r\n }\r\n }, [value]);\r\n\r\n const handleDayClick = (date, modifiers, event) => {\r\n if (modifiers.outside || modifiers.disabled) {\r\n return;\r\n }\r\n\r\n handleChange(date, event);\r\n };\r\n\r\n const handleCalendarClickToday = (): void => {\r\n const today = new Date();\r\n\r\n // set to midday to avoid UTC offset causing dates to be mismatched server side\r\n today.setHours(12);\r\n today.setMinutes(0);\r\n today.setSeconds(0);\r\n\r\n handleChange(today);\r\n };\r\n\r\n const className = cn('flex bg-white text-xs p-4', otherProps.className);\r\n\r\n return (\r\n <div data-taco=\"calendar\">\r\n <ReactDayPicker\r\n {...otherProps}\r\n className={className}\r\n month={visibleMonth}\r\n selectedDays={value}\r\n locale={locale.substring(0, 2)}\r\n firstDayOfWeek={1}\r\n months={texts.calendar.months}\r\n weekdaysShort={texts.calendar.weekdaysShort}\r\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\r\n onDayClick={handleDayClick}\r\n onMonthChange={setVisibleMonth}\r\n onTodayButtonClick={handleCalendarClickToday}\r\n captionElement={() => null}\r\n todayButton={texts.calendar.actions.today}\r\n showOutsideDays\r\n renderDay={renderDay}\r\n numberOfMonths={1}\r\n ref={ref}\r\n />\r\n </div>\r\n );\r\n});\r\n"],"names":["renderDay","day","modifiers","disabled","React","className","getDate","thisYear","Date","getFullYear","years","i","push","Navbar","onMonthChange","onNextClick","onPreviousClick","value","texts","calendar","actions","months","useLocalization","handleChange","event","year","month","target","form","name","onChange","getMonth","map","key","String","IconButton","appearance","icon","previousMonth","onClick","rounded","nextMonth","Calendar","props","ref","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","outside","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysShort","navbarElement","navProps","onDayClick","onTodayButtonClick","captionElement","todayButton","showOutsideDays","numberOfMonths"],"mappings":";;;;;;AA6BA,MAAMA,SAAS,GAAG,CAACC,GAAD,EAAYC,SAAZ,KACdA,SAAS,CAACC,QAAV,GAAqBC,aAAA,OAAA;EAAMC,SAAS,EAAC;CAAhB,CAArB,GAAgDJ,GAAG,CAACK,OAAJ,EADpD;;AAUA,MAAMC,QAAQ,gBAAG,IAAIC,IAAJ,GAAWC,WAAX,EAAjB;AACA,MAAMC,KAAK,GAAa,EAAxB;;AAEA,KAAK,IAAIC,CAAC,GAAGJ,QAAQ,GAAG,EAAxB,EAA4BI,CAAC,IAAIJ,QAAQ,GAAG,EAA5C,EAAgDI,CAAC,IAAI,CAArD,EAAwD;EACpDD,KAAK,CAACE,IAAN,CAAWD,CAAX;AACH;;AAED,MAAME,MAAM,gBAAGT,IAAA,CACX,CAAC;EAAEU,aAAF;EAAiBC,WAAjB;EAA8BC,eAA9B;EAA+CC,KAAK,GAAG,IAAIT,IAAJ;AAAvD,CAAD;EACI,MAAM;IACFU,KAAK,EAAE;MACHC,QAAQ,EAAE;QAAEC,OAAF;QAAWC;;;MAEzBC,eAAe,EAJnB;;EAMA,MAAMC,YAAY,GAAG,SAASA,YAAT,CAAsBC,KAAtB;IACjB,MAAM;MAAEC,IAAF;MA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AN,CAAeE;IACvByC,aAAa,EAAE5C,KAAK,CAACC,QAAN,CAAe2C;IAC9BC,aAAa,EAAEC,QAAQ,IAAI5D,aAAA,CAACS,MAAD,oBAAYmD;MAAUlD,aAAa,EAAEkC;MAAiB/B,KAAK,EAAE8B;MAA7D;IAC3BkB,UAAU,EAAEhB;IACZnC,aAAa,EAAEkC;IACfkB,kBAAkB,EAAEd;IACpBe,cAAc,EAAE,MAAM;IACtBC,WAAW,EAAElD,KAAK,CAACC,QAAN,CAAeC,OAAf,CAAuBiC;IACpCgB,eAAe;IACfrE,SAAS,EAAEA;IACXsE,cAAc,EAAE;IAChB1B,GAAG,EAAEA;IAlBT,CADJ,CADJ;AAwBH,CAxDuB;;;;"}
|
1
|
+
{"version":3,"file":"Calendar.js","sources":["../../../../src/components/Calendar/Calendar.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport ReactDayPicker, { NavbarElementProps, DayModifiers } from 'react-day-picker';\r\nimport { useLocalization } from '../Provider/Provider';\r\nimport './Calendar.css';\r\nimport { IconButton } from '../IconButton/IconButton';\r\n\r\nexport type CalendarTextsActions = {\r\n /** Aria-label for previous month action button */\r\n previousMonth: string;\r\n /** Aria-label for next month action button */\r\n nextMonth: string;\r\n /** Aria-label for previous year action button */\r\n previousYear: string;\r\n /** Aria-label for next year action button */\r\n nextYear: string;\r\n /** Text displayed within today action button */\r\n today: string;\r\n};\r\n\r\nexport type CalendarTexts = {\r\n /** Text and aria-label for action buttons in Calendar */\r\n actions: CalendarTextsActions;\r\n /** Text abbreviation for months in Calendar's header, starting with January */\r\n months: string[];\r\n /** Text abbreviation for days in Calendar's header, starting with Sunday */\r\n weekdaysShort: string[];\r\n};\r\n\r\nconst renderDay = (day: Date, modifiers: DayModifiers): React.ReactNode =>\r\n modifiers.disabled ? <span className=\"dot\" /> : day.getDate();\r\n\r\n/** @internal */\r\ntype CustomNavbarElementProps = NavbarElementProps & {\r\n showYearControls?: boolean;\r\n onMonthChange: (month: Date) => void;\r\n value?: Date;\r\n};\r\n\r\nconst thisYear = new Date().getFullYear();\r\nconst years: number[] = [];\r\n\r\nfor (let i = thisYear - 10; i <= thisYear + 10; i += 1) {\r\n years.push(i);\r\n}\r\n\r\nconst Navbar = React.memo(\r\n ({ onMonthChange, onNextClick, onPreviousClick, value = new Date() }: CustomNavbarElementProps): JSX.Element => {\r\n const {\r\n texts: {\r\n calendar: { actions, months },\r\n },\r\n } = useLocalization();\r\n\r\n const handleChange = function handleChange(event) {\r\n const { year, month } = event.target.form;\r\n onMonthChange(new Date(year.value, month.value));\r\n };\r\n\r\n return (\r\n <div className=\"mb-2 flex items-center justify-between\">\r\n <form className=\"inline-flex space-x-1\">\r\n <select className=\"h-8 px-2\" name=\"month\" onChange={handleChange} value={value.getMonth()}>\r\n {months.map((month, i) => (\r\n <option key={month} value={i}>\r\n {month}\r\n </option>\r\n ))}\r\n </select>\r\n <select className=\"h-8 px-2\" name=\"year\" onChange={handleChange} value={value.getFullYear()}>\r\n {years.map(year => (\r\n <option key={year} value={year}>\r\n {String(year)}\r\n </option>\r\n ))}\r\n </select>\r\n </form>\r\n <div>\r\n <IconButton\r\n appearance=\"discrete\"\r\n icon=\"chevron-left\"\r\n aria-label={actions.previousMonth}\r\n onClick={() => onPreviousClick()}\r\n rounded\r\n />\r\n <IconButton\r\n appearance=\"discrete\"\r\n icon=\"chevron-right\"\r\n aria-label={actions.nextMonth}\r\n onClick={() => onNextClick()}\r\n rounded\r\n />\r\n </div>\r\n </div>\r\n );\r\n }\r\n);\r\n\r\nexport type CalendarProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'value'> & {\r\n /** Handler called when a day is clicked in calendar */\r\n onChange: (date: Date, event?: React.MouseEvent<HTMLDivElement>) => void;\r\n value?: Date;\r\n};\r\n\r\nexport const Calendar = React.forwardRef(function Calendar(props: CalendarProps, ref: React.Ref<ReactDayPicker>) {\r\n const { onChange: handleChange, value, ...otherProps } = props;\r\n const { locale, texts } = useLocalization();\r\n const [visibleMonth, setVisibleMonth] = React.useState(value ?? new Date());\r\n\r\n React.useEffect(() => {\r\n if (visibleMonth !== value) {\r\n setVisibleMonth(value ?? new Date());\r\n }\r\n }, [value]);\r\n\r\n const handleDayClick = (date, modifiers, event) => {\r\n if (modifiers.outside || modifiers.disabled) {\r\n return;\r\n }\r\n\r\n handleChange(date, event);\r\n };\r\n\r\n const handleCalendarClickToday = (): void => {\r\n const today = new Date();\r\n\r\n // set to midday to avoid UTC offset causing dates to be mismatched server side\r\n today.setHours(12);\r\n today.setMinutes(0);\r\n today.setSeconds(0);\r\n\r\n handleChange(today);\r\n };\r\n\r\n const className = cn('flex bg-white text-xs p-4', otherProps.className);\r\n\r\n return (\r\n <div data-taco=\"calendar\">\r\n <ReactDayPicker\r\n {...otherProps}\r\n className={className}\r\n month={visibleMonth}\r\n selectedDays={value}\r\n locale={locale.substring(0, 2)}\r\n firstDayOfWeek={1}\r\n months={texts.calendar.months}\r\n weekdaysShort={texts.calendar.weekdaysShort}\r\n navbarElement={navProps => <Navbar {...navProps} onMonthChange={setVisibleMonth} value={visibleMonth} />}\r\n onDayClick={handleDayClick}\r\n onMonthChange={setVisibleMonth}\r\n onTodayButtonClick={handleCalendarClickToday}\r\n captionElement={() => null}\r\n todayButton={texts.calendar.actions.today}\r\n showOutsideDays\r\n renderDay={renderDay}\r\n numberOfMonths={1}\r\n ref={ref}\r\n />\r\n </div>\r\n );\r\n});\r\n"],"names":["renderDay","day","modifiers","disabled","React","className","getDate","thisYear","Date","getFullYear","years","i","push","Navbar","onMonthChange","onNextClick","onPreviousClick","value","useLocalization","texts","calendar","actions","months","handleChange","event","target","form","year","month","name","onChange","getMonth","map","key","String","IconButton","appearance","icon","previousMonth","onClick","rounded","nextMonth","Calendar","props","ref","otherProps","locale","visibleMonth","setVisibleMonth","handleDayClick","date","outside","handleCalendarClickToday","today","setHours","setMinutes","setSeconds","cn","ReactDayPicker","selectedDays","substring","firstDayOfWeek","weekdaysShort","navb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AAa,EAAEkC;QAAiB/B,KAAK,EAAE8B;QAA7D,CAAJ;;IACvBkB,UAAU,EAAEhB;IACZnC,aAAa,EAAEkC;IACfkB,kBAAkB,EAAEd;IACpBe,cAAc,EAAE;MAAA,OAAM,IAAN;;IAChBC,WAAW,EAAEjD,KAAK,CAACC,QAAN,CAAeC,OAAf,CAAuBgC;IACpCgB,eAAe;IACfrE,SAAS,EAAEA;IACXsE,cAAc,EAAE;IAChB1B,GAAG,EAAEA;IAlBT,CADJ,CADJ;AAwBH,CAxDuB;;;;"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import { forwardRef, createElement } from 'react';
|
2
3
|
import cn from 'classnames';
|
3
4
|
import '../Icon/components/index.js';
|
@@ -15,12 +16,14 @@ import '../Toast/Toaster.js';
|
|
15
16
|
import '../Provider/Provider.js';
|
16
17
|
import '../Calendar/Calendar.js';
|
17
18
|
import '../Checkbox/Checkbox.js';
|
19
|
+
import '../../utils/hooks/useProxiedRef.js';
|
18
20
|
import '../Input/Input.js';
|
19
21
|
import '../../utils/hooks/useListKeyboardNavigation.js';
|
20
22
|
import '../../utils/hooks/useListScrollTo.js';
|
21
23
|
import '../../utils/hooks/useBoundingClientRectListener.js';
|
22
24
|
import '../Combobox/Combobox.js';
|
23
25
|
import '../../utils/date.js';
|
26
|
+
import '../../utils/mergeRefs.js';
|
24
27
|
import '../Popover/Popover.js';
|
25
28
|
import '../Datepicker/Datepicker.js';
|
26
29
|
import '../Dialog/Dialog.js';
|
@@ -34,6 +37,7 @@ import '../Listbox/Listbox.js';
|
|
34
37
|
import '../RadioGroup/RadioGroup.js';
|
35
38
|
import '../Menu/Menu.js';
|
36
39
|
import '../Treeview/Treeview.js';
|
40
|
+
import '../../utils/hooks/useDropTarget.js';
|
37
41
|
import '../Navigation/Navigation.js';
|
38
42
|
import '../Select/Select.js';
|
39
43
|
import '../Pagination/usePagination.js';
|
@@ -50,12 +54,12 @@ import '../Switch/Switch.js';
|
|
50
54
|
import '../Tour/Tour.js';
|
51
55
|
import '../../utils/hooks/useOnClickOutside.js';
|
52
56
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
57
|
+
var _excluded = ["noPadding"];
|
58
|
+
var Content = /*#__PURE__*/forwardRef(function CardContent(externalProps, ref) {
|
59
|
+
var noPadding = externalProps.noPadding,
|
60
|
+
props = _objectWithoutPropertiesLoose(externalProps, _excluded);
|
61
|
+
|
62
|
+
var className = cn('flex-grow overflow-auto', {
|
59
63
|
'mx-4 mb-4': !noPadding
|
60
64
|
}, props.className);
|
61
65
|
return createElement("div", Object.assign({}, props, {
|
@@ -63,13 +67,11 @@ const Content = /*#__PURE__*/forwardRef(function CardContent(externalProps, ref)
|
|
63
67
|
ref: ref
|
64
68
|
}));
|
65
69
|
});
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
} = props;
|
72
|
-
const className = cn('bg-white flex flex-col rounded-xl shadow-[0px_0px_1px_rgba(0,0,0,0.1),0px_6px_18px_rgba(47,51,68,0.2)]', props.className);
|
70
|
+
var Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
71
|
+
var title = props.title,
|
72
|
+
menu = props.menu,
|
73
|
+
children = props.children;
|
74
|
+
var className = cn('bg-white flex flex-col rounded-xl shadow-[0px_0px_1px_rgba(0,0,0,0.1),0px_6px_18px_rgba(47,51,68,0.2)]', props.className);
|
73
75
|
return createElement("div", {
|
74
76
|
className: className,
|
75
77
|
"data-taco": "card",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\n\r\nimport { MenuProps, IconButton } from '../..';\r\n\r\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {\r\n noPadding?: boolean;\r\n};\r\n\r\nconst Content = React.forwardRef<HTMLDivElement, CardContentProps>(function CardContent(externalProps, ref) {\r\n const { noPadding, ...props } = externalProps;\r\n const className = cn(\r\n 'flex-grow overflow-auto',\r\n {\r\n 'mx-4 mb-4': !noPadding,\r\n },\r\n props.className\r\n );\r\n return <div {...props} className={className} ref={ref} />;\r\n});\r\n\r\nexport type CardProps = React.HTMLAttributes<HTMLDivElement> & {\r\n /** Title of the Card */\r\n title: string | React.ReactElement;\r\n /** Menu component associated with the Card */\r\n menu?: (props: Partial<MenuProps>) => JSX.Element;\r\n};\r\n\r\nexport const Card = React.forwardRef<HTMLDivElement, CardProps>(function Card(props, ref) {\r\n const { title, menu, children } = props;\r\n const className = cn(\r\n 'bg-white flex flex-col rounded-xl shadow-[0px_0px_1px_rgba(0,0,0,0.1),0px_6px_18px_rgba(47,51,68,0.2)]',\r\n props.className\r\n );\r\n\r\n return (\r\n <div className={className} data-taco=\"card\" ref={ref}>\r\n <div className=\"mx-4 mt-4 mb-2 flex\">\r\n {title && <h4 className=\"mb-0 flex-grow text-left\">{title}</h4>}\r\n {menu ? <IconButton icon=\"ellipsis-horizontal\" appearance=\"discrete\" menu={menu} className=\"-mt-[4px]\" /> : null}\r\n </div>\r\n {children}\r\n </div>\r\n );\r\n}) as React.ForwardRefExoticComponent<CardProps> & {\r\n Content: React.ForwardRefExoticComponent<CardContentProps>;\r\n};\r\nCard.Content = Content;\r\n"],"names":["Content","React","CardContent","externalProps","ref","noPadding","props","className","cn","Card","title","menu","children","IconButton","icon","appearance"],"mappings":"
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../../src/components/Card/Card.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\n\r\nimport { MenuProps, IconButton } from '../..';\r\n\r\nexport type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {\r\n noPadding?: boolean;\r\n};\r\n\r\nconst Content = React.forwardRef<HTMLDivElement, CardContentProps>(function CardContent(externalProps, ref) {\r\n const { noPadding, ...props } = externalProps;\r\n const className = cn(\r\n 'flex-grow overflow-auto',\r\n {\r\n 'mx-4 mb-4': !noPadding,\r\n },\r\n props.className\r\n );\r\n return <div {...props} className={className} ref={ref} />;\r\n});\r\n\r\nexport type CardProps = React.HTMLAttributes<HTMLDivElement> & {\r\n /** Title of the Card */\r\n title: string | React.ReactElement;\r\n /** Menu component associated with the Card */\r\n menu?: (props: Partial<MenuProps>) => JSX.Element;\r\n};\r\n\r\nexport const Card = React.forwardRef<HTMLDivElement, CardProps>(function Card(props, ref) {\r\n const { title, menu, children } = props;\r\n const className = cn(\r\n 'bg-white flex flex-col rounded-xl shadow-[0px_0px_1px_rgba(0,0,0,0.1),0px_6px_18px_rgba(47,51,68,0.2)]',\r\n props.className\r\n );\r\n\r\n return (\r\n <div className={className} data-taco=\"card\" ref={ref}>\r\n <div className=\"mx-4 mt-4 mb-2 flex\">\r\n {title && <h4 className=\"mb-0 flex-grow text-left\">{title}</h4>}\r\n {menu ? <IconButton icon=\"ellipsis-horizontal\" appearance=\"discrete\" menu={menu} className=\"-mt-[4px]\" /> : null}\r\n </div>\r\n {children}\r\n </div>\r\n );\r\n}) as React.ForwardRefExoticComponent<CardProps> & {\r\n Content: React.ForwardRefExoticComponent<CardContentProps>;\r\n};\r\nCard.Content = Content;\r\n"],"names":["Content","React","CardContent","externalProps","ref","noPadding","props","className","cn","Card","title","menu","children","IconButton","icon","appearance"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAMA,OAAO,gBAAGC,UAAA,CAAmD,SAASC,WAAT,CAAqBC,aAArB,EAAoCC,GAApC;EAC/D,IAAQC,SAAR,GAAgCF,aAAhC,CAAQE,SAAR;MAAsBC,KAAtB,iCAAgCH,aAAhC;;EACA,IAAMI,SAAS,GAAGC,EAAE,CAChB,yBADgB,EAEhB;IACI,aAAa,CAACH;GAHF,EAKhBC,KAAK,CAACC,SALU,CAApB;EAOA,OAAON,aAAA,MAAA,oBAASK;IAAOC,SAAS,EAAEA;IAAWH,GAAG,EAAEA;IAA3C,CAAP;AACH,CAVe,CAAhB;IAmBaK,IAAI,gBAAGR,UAAA,CAA4C,SAASQ,IAAT,CAAcH,KAAd,EAAqBF,GAArB;EAC5D,IAAQM,KAAR,GAAkCJ,KAAlC,CAAQI,KAAR;MAAeC,IAAf,GAAkCL,KAAlC,CAAeK,IAAf;MAAqBC,QAArB,GAAkCN,KAAlC,CAAqBM,QAArB;EACA,IAAML,SAAS,GAAGC,EAAE,CAChB,wGADgB,EAEhBF,KAAK,CAACC,SAFU,CAApB;EAKA,OACIN,aAAA,MAAA;IAAKM,SAAS,EAAEA;iBAAqB;IAAOH,GAAG,EAAEA;GAAjD,EACIH,aAAA,MAAA;IAAKM,SAAS,EAAC;GAAf,EACKG,KAAK,IAAIT,aAAA,KAAA;IAAIM,SAAS,EAAC;GAAd,EAA0CG,KAA1C,CADd,EAEKC,IAAI,GAAGV,aAAA,CAACY,UAAD;IAAYC,IAAI,EAAC;IAAsBC,UAAU,EAAC;IAAWJ,IAAI,EAAEA;IAAMJ,SAAS,EAAC;GAAnF,CAAH,GAAuG,IAFhH,CADJ,EAKKK,QALL,CADJ;AASH,CAhBmB;AAmBpBH,IAAI,CAACT,OAAL,GAAeA,OAAf;;;;"}
|
@@ -1,32 +1,35 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import { forwardRef, createElement } from 'react';
|
2
3
|
import cn from 'classnames';
|
3
4
|
import { Icon } from '../Icon/Icon.js';
|
4
5
|
import { Root, Indicator } from '@radix-ui/react-checkbox';
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
7
|
+
var _excluded = ["checked", "highlighted", "indeterminate", "invalid", "label", "onChange"];
|
8
|
+
var Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
|
9
|
+
var checked = props.checked,
|
10
|
+
highlighted = props.highlighted,
|
11
|
+
indeterminate = props.indeterminate,
|
12
|
+
invalid = props.invalid,
|
13
|
+
label = props.label,
|
14
|
+
onChange = props.onChange,
|
15
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
16
|
+
|
17
|
+
var className = cn('bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem] focus:yt-focus', //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]
|
17
18
|
props.className, {
|
18
19
|
'border-grey-dark text-blue hover:text-blue-light focus:border-blue focus:hover:border-blue-light': !props.disabled && !invalid,
|
19
20
|
'border-grey text-blue-light cursor-not-allowed': props.disabled,
|
20
21
|
'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,
|
21
22
|
'border-red text-red hover:text-red-light hover:border-red-light focus:border-red focus:hover:border-red-light': invalid && !props.disabled
|
22
23
|
});
|
23
|
-
|
24
|
+
var handleChange;
|
24
25
|
|
25
26
|
if (onChange) {
|
26
|
-
handleChange =
|
27
|
+
handleChange = function handleChange(checked) {
|
28
|
+
return onChange(checked === 'indeterminate' ? false : checked);
|
29
|
+
};
|
27
30
|
}
|
28
31
|
|
29
|
-
|
32
|
+
var element = createElement(Root, Object.assign({}, otherProps, {
|
30
33
|
"data-taco": "checkbox",
|
31
34
|
checked: indeterminate ? 'indeterminate' : checked,
|
32
35
|
className: className,
|
@@ -40,7 +43,7 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, ref) {
|
|
40
43
|
})));
|
41
44
|
|
42
45
|
if (label) {
|
43
|
-
|
46
|
+
var labelClassName = cn('flex items-center cursor-pointer gap-2', {
|
44
47
|
'cursor-not-allowed text-grey-dark': props.disabled
|
45
48
|
}, props.className);
|
46
49
|
return createElement("label", {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\r\nimport { Icon } from '../Icon/Icon';\r\n\r\ntype CheckedState = boolean | 'indeterminate';\r\n\r\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\r\n /* Increases visual prominenance of the checkbox */\r\n highlighted?: boolean;\r\n /**\r\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\r\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\r\n */\r\n indeterminate?: boolean;\r\n /* Whether the checkbox is in an invalid state */\r\n invalid?: boolean;\r\n /** Label for the checkbox */\r\n label?: React.ReactNode;\r\n /* Whether user input is required */\r\n required?: boolean;\r\n};\r\n\r\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\r\n checked?: never;\r\n onChange?: never;\r\n /* The default checked state (uncontrolled) */\r\n defaultChecked?: boolean;\r\n}\r\n\r\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\r\n defaultChecked?: never;\r\n /* The current checked state (controlled) */\r\n checked: boolean;\r\n /* Handler called when the checked state changes */\r\n onChange: (checked: boolean) => void;\r\n}\r\n\r\nexport type CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\r\n\r\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\r\n const { checked, highlighted, indeterminate, invalid, label, onChange, ...otherProps } = props;\r\n\r\n const className = cn(\r\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem] focus:yt-focus', //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]\r\n props.className,\r\n {\r\n 'border-grey-dark text-blue hover:text-blue-light focus:border-blue focus:hover:border-blue-light':\r\n !props.disabled && !invalid,\r\n 'border-grey text-blue-light cursor-not-allowed': props.disabled,\r\n 'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,\r\n 'border-red text-red hover:text-red-light hover:border-red-light focus:border-red focus:hover:border-red-light':\r\n invalid && !props.disabled,\r\n }\r\n );\r\n\r\n let handleChange: ((checked: CheckedState) => void) | undefined;\r\n\r\n if (onChange) {\r\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\r\n }\r\n\r\n const element = (\r\n <CheckboxPrimitive.Root\r\n {...otherProps}\r\n data-taco=\"checkbox\"\r\n checked={indeterminate ? 'indeterminate' : checked}\r\n className={className}\r\n onCheckedChange={handleChange}\r\n ref={ref}\r\n >\r\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\r\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\r\n </CheckboxPrimitive.Indicator>\r\n </CheckboxPrimitive.Root>\r\n );\r\n\r\n if (label) {\r\n const labelClassName = cn(\r\n 'flex items-center cursor-pointer gap-2',\r\n {\r\n 'cursor-not-allowed text-grey-dark': props.disabled,\r\n },\r\n props.className\r\n );\r\n\r\n return (\r\n <label className={labelClassName}>\r\n {element}\r\n {label}\r\n </label>\r\n );\r\n }\r\n\r\n return element;\r\n});\r\n"],"names":["Checkbox","React","props","ref","checked","highlighted","indeterminate","invalid","label","onChange","otherProps","className","cn","disabled","handleChange","element","CheckboxPrimitive","onCheckedChange","Icon","name","labelClassName"],"mappings":"
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox';\r\nimport { Icon } from '../Icon/Icon';\r\n\r\ntype CheckedState = boolean | 'indeterminate';\r\n\r\ntype CheckboxBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\r\n /* Increases visual prominenance of the checkbox */\r\n highlighted?: boolean;\r\n /**\r\n * Indeterminate state should only be used with sub-checkboxes. The indeterminate state is shown if not all\r\n * sub-checkboxes are selected. This only affects the style, changing the icon in the checkbox.\r\n */\r\n indeterminate?: boolean;\r\n /* Whether the checkbox is in an invalid state */\r\n invalid?: boolean;\r\n /** Label for the checkbox */\r\n label?: React.ReactNode;\r\n /* Whether user input is required */\r\n required?: boolean;\r\n};\r\n\r\ninterface UncontrolledCheckboxProps extends CheckboxBaseProps {\r\n checked?: never;\r\n onChange?: never;\r\n /* The default checked state (uncontrolled) */\r\n defaultChecked?: boolean;\r\n}\r\n\r\ninterface ControlledCheckboxProps extends CheckboxBaseProps {\r\n defaultChecked?: never;\r\n /* The current checked state (controlled) */\r\n checked: boolean;\r\n /* Handler called when the checked state changes */\r\n onChange: (checked: boolean) => void;\r\n}\r\n\r\nexport type CheckboxProps = UncontrolledCheckboxProps | ControlledCheckboxProps;\r\n\r\nexport const Checkbox = React.forwardRef(function Checkbox(props: CheckboxProps, ref: React.Ref<HTMLButtonElement>) {\r\n const { checked, highlighted, indeterminate, invalid, label, onChange, ...otherProps } = props;\r\n\r\n const className = cn(\r\n 'bg-white h-5 w-5 border rounded text-sm flex-shrink-0 self-start mt-[0.1rem] focus:yt-focus', //hover:shadow-[0_0_0_1px_rgba(235,235,235,1)]\r\n props.className,\r\n {\r\n 'border-grey-dark text-blue hover:text-blue-light focus:border-blue focus:hover:border-blue-light':\r\n !props.disabled && !invalid,\r\n 'border-grey text-blue-light cursor-not-allowed': props.disabled,\r\n 'bg-[rgba(255,255,0,0.2)] disabled:bg-[rgba(255,255,0,0.075)]': highlighted,\r\n 'border-red text-red hover:text-red-light hover:border-red-light focus:border-red focus:hover:border-red-light':\r\n invalid && !props.disabled,\r\n }\r\n );\r\n\r\n let handleChange: ((checked: CheckedState) => void) | undefined;\r\n\r\n if (onChange) {\r\n handleChange = (checked: CheckedState) => onChange(checked === 'indeterminate' ? false : checked);\r\n }\r\n\r\n const element = (\r\n <CheckboxPrimitive.Root\r\n {...otherProps}\r\n data-taco=\"checkbox\"\r\n checked={indeterminate ? 'indeterminate' : checked}\r\n className={className}\r\n onCheckedChange={handleChange}\r\n ref={ref}\r\n >\r\n <CheckboxPrimitive.Indicator className=\"flex h-full w-full\">\r\n <Icon name={indeterminate ? 'line' : 'tick'} className=\"!h-full !w-full\" />\r\n </CheckboxPrimitive.Indicator>\r\n </CheckboxPrimitive.Root>\r\n );\r\n\r\n if (label) {\r\n const labelClassName = cn(\r\n 'flex items-center cursor-pointer gap-2',\r\n {\r\n 'cursor-not-allowed text-grey-dark': props.disabled,\r\n },\r\n props.className\r\n );\r\n\r\n return (\r\n <label className={labelClassName}>\r\n {element}\r\n {label}\r\n </label>\r\n );\r\n }\r\n\r\n return element;\r\n});\r\n"],"names":["Checkbox","React","props","ref","checked","highlighted","indeterminate","invalid","label","onChange","otherProps","className","cn","disabled","handleChange","element","CheckboxPrimitive","onCheckedChange","Icon","name","labelClassName"],"mappings":";;;;;;;IAwCaA,QAAQ,gBAAGC,UAAA,CAAiB,SAASD,QAAT,CAAkBE,KAAlB,EAAwCC,GAAxC;EACrC,IAAQC,OAAR,GAAyFF,KAAzF,CAAQE,OAAR;MAAiBC,WAAjB,GAAyFH,KAAzF,CAAiBG,WAAjB;MAA8BC,aAA9B,GAAyFJ,KAAzF,CAA8BI,aAA9B;MAA6CC,OAA7C,GAAyFL,KAAzF,CAA6CK,OAA7C;MAAsDC,KAAtD,GAAyFN,KAAzF,CAAsDM,KAAtD;MAA6DC,QAA7D,GAAyFP,KAAzF,CAA6DO,QAA7D;MAA0EC,UAA1E,iCAAyFR,KAAzF;;EAEA,IAAMS,SAAS,GAAGC,EAAE,CAChB,6FADgB;EAEhBV,KAAK,CAACS,SAFU,EAGhB;IACI,oGACI,CAACT,KAAK,CAACW,QAAP,IAAmB,CAACN,OAF5B;IAGI,kDAAkDL,KAAK,CAACW,QAH5D;IAII,gEAAgER,WAJpE;IAKI,iHACIE,OAAO,IAAI,CAACL,KAAK,CAACW;GATV,CAApB;EAaA,IAAIC,YAAJ;;EAEA,IAAIL,QAAJ,EAAc;IACVK,YAAY,GAAG,sBAACV,OAAD;MAAA,OAA2BK,QAAQ,CAACL,OAAO,KAAK,eAAZ,GAA8B,KAA9B,GAAsCA,OAAvC,CAAnC;KAAf;;;EAGJ,IAAMW,OAAO,GACTd,aAAA,CAACe,IAAD,oBACQN;iBACM;IACVN,OAAO,EAAEE,aAAa,GAAG,eAAH,GAAqBF;IAC3CO,SAAS,EAAEA;IACXM,eAAe,EAAEH;IACjBX,GAAG,EAAEA;IANT,EAQIF,aAAA,CAACe,SAAD;IAA6BL,SAAS,EAAC;GAAvC,EACIV,aAAA,CAACiB,IAAD;IAAMC,IAAI,EAAEb,aAAa,GAAG,MAAH,GAAY;IAAQK,SAAS,EAAC;GAAvD,CADJ,CARJ,CADJ;;EAeA,IAAIH,KAAJ,EAAW;IACP,IAAMY,cAAc,GAAGR,EAAE,CACrB,wCADqB,EAErB;MACI,qCAAqCV,KAAK,CAACW;KAH1B,EAKrBX,KAAK,CAACS,SALe,CAAzB;IAQA,OACIV,aAAA,QAAA;MAAOU,SAAS,EAAES;KAAlB,EACKL,OADL,EAEKP,KAFL,CADJ;;;EAQJ,OAAOO,OAAP;AACH,CAvDuB;;;;"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import { forwardRef, useRef, createElement } from 'react';
|
2
3
|
import cn from 'classnames';
|
3
4
|
import { IconButton } from '../IconButton/IconButton.js';
|
@@ -8,26 +9,27 @@ import { ScrollableList } from '../Listbox/ScrollableList.js';
|
|
8
9
|
import { useCombobox } from './useCombobox.js';
|
9
10
|
import { useBoundingClientRectListener } from '../../utils/hooks/useBoundingClientRectListener.js';
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
12
|
+
var _excluded = ["className", "dialog", "style"];
|
13
|
+
var Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
|
14
|
+
var externalClassName = props.className,
|
15
|
+
dialog = props.dialog,
|
16
|
+
style = props.style,
|
17
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
18
|
+
|
19
|
+
var _useCombobox = useCombobox(otherProps, ref),
|
20
|
+
combobox = _useCombobox.combobox,
|
21
|
+
button = _useCombobox.button,
|
22
|
+
input = _useCombobox.input,
|
23
|
+
popover = _useCombobox.popover,
|
24
|
+
list = _useCombobox.list;
|
25
|
+
|
26
|
+
var internalRef = useRef(null);
|
27
|
+
|
28
|
+
var _useLocalization = useLocalization(),
|
29
|
+
texts = _useLocalization.texts;
|
30
|
+
|
31
|
+
var selectDimensions = useBoundingClientRectListener(internalRef);
|
32
|
+
var className = cn('inline-flex relative', {
|
31
33
|
'yt-combobox--inline': props.inline
|
32
34
|
}, externalClassName);
|
33
35
|
return createElement("span", {
|
@@ -46,7 +48,7 @@ const Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
|
|
46
48
|
appearance: "discrete",
|
47
49
|
className: "!border-l-0 focus:!border-none focus:!shadow-none active:!border-none",
|
48
50
|
icon: popover.open ? 'chevron-up' : 'chevron-down',
|
49
|
-
onClick: ()
|
51
|
+
onClick: function onClick() {
|
50
52
|
var _input$ref$current;
|
51
53
|
|
52
54
|
popover.onOpenChange(true);
|
@@ -54,10 +56,11 @@ const Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
|
|
54
56
|
},
|
55
57
|
tabIndex: -1
|
56
58
|
}) : dialog ? createElement(IconButton, {
|
59
|
+
"aria-label": texts.combobox.tooltip,
|
57
60
|
icon: "list-search",
|
58
61
|
disabled: props.readOnly || props.disabled,
|
59
62
|
dialog: dialog,
|
60
|
-
onFocus: event
|
63
|
+
onFocus: function onFocus(event) {
|
61
64
|
var _input$ref$current2;
|
62
65
|
|
63
66
|
// Prevents the default focus behaviour of showing the tooltip, on parent tooltip element
|
@@ -70,7 +73,7 @@ const Combobox = /*#__PURE__*/forwardRef(function Combobox(props, ref) {
|
|
70
73
|
}) : undefined
|
71
74
|
})))), createElement(Content, {
|
72
75
|
align: "start",
|
73
|
-
onOpenAutoFocus: event
|
76
|
+
onOpenAutoFocus: function onOpenAutoFocus(event) {
|
74
77
|
event.preventDefault();
|
75
78
|
},
|
76
79
|
sideOffset: 4
|