@economic/taco 0.0.30-alpha.0 → 0.0.31-alpha.2
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/components/Button/util.js +1 -1
- package/dist/esm/components/Button/util.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/Form/Form.js +8 -6
- package/dist/esm/components/Form/Form.js.map +1 -1
- package/dist/esm/components/Group/Group.js +8 -6
- package/dist/esm/components/Group/Group.js.map +1 -1
- package/dist/esm/components/Hanger/Hanger.js +33 -25
- package/dist/esm/components/Hanger/Hanger.js.map +1 -1
- package/dist/esm/components/Icon/Icon.js +8 -7
- package/dist/esm/components/Icon/Icon.js.map +1 -1
- package/dist/esm/components/IconButton/IconButton.js +11 -9
- package/dist/esm/components/IconButton/IconButton.js.map +1 -1
- package/dist/esm/components/Input/Input.js +24 -26
- package/dist/esm/components/Input/Input.js.map +1 -1
- package/dist/esm/components/Listbox/Listbox.js +25 -24
- package/dist/esm/components/Listbox/Listbox.js.map +1 -1
- package/dist/esm/components/Menu/Menu.js +43 -20
- package/dist/esm/components/Menu/Menu.js.map +1 -1
- package/dist/esm/components/Menu/components/Item.js +5 -5
- package/dist/esm/components/Menu/components/Item.js.map +1 -1
- package/dist/esm/components/Navigation/Navigation.js +44 -35
- package/dist/esm/components/Navigation/Navigation.js.map +1 -1
- package/dist/esm/components/Pagination/Pagination.js +56 -39
- package/dist/esm/components/Pagination/Pagination.js.map +1 -1
- package/dist/esm/components/Popover/Popover.js +34 -29
- package/dist/esm/components/Popover/Popover.js.map +1 -1
- package/dist/esm/components/Progress/Progress.js +15 -11
- package/dist/esm/components/Progress/Progress.js.map +1 -1
- package/dist/esm/components/Provider/Provider.js +18 -13
- package/dist/esm/components/Provider/Provider.js.map +1 -1
- package/dist/esm/components/RadioGroup/RadioGroup.js +57 -45
- package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +11 -10
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/esm/components/Select/Select.js +31 -30
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Spinner/Spinner.js +19 -12
- package/dist/esm/components/Spinner/Spinner.js.map +1 -1
- package/dist/esm/components/Switch/Switch.js +10 -9
- package/dist/esm/components/Switch/Switch.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.js +27 -25
- package/dist/esm/components/Tabs/Tabs.js.map +1 -1
- package/dist/esm/components/Textarea/Textarea.js +9 -11
- package/dist/esm/components/Textarea/Textarea.js.map +1 -1
- package/dist/esm/components/Toast/Toaster.js +118 -88
- package/dist/esm/components/Toast/Toaster.js.map +1 -1
- package/dist/esm/components/Tooltip/Tooltip.js +8 -7
- package/dist/esm/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/Treeview/Treeview.js +36 -26
- package/dist/esm/components/Treeview/Treeview.js.map +1 -1
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js +1 -1
- package/dist/esm/components/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/esm/index.css +8 -5
- package/dist/index.css +8 -5
- package/dist/taco.cjs.development.js +754 -628
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +3 -3
@@ -1,25 +1,25 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import { forwardRef, useEffect, createElement, cloneElement } from 'react';
|
2
3
|
import cn from 'classnames';
|
3
4
|
import { Icon } from '../Icon/Icon.js';
|
4
5
|
import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
|
5
6
|
import { getInputClasses, getButtonStateClasses } from './util.js';
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
const className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
|
8
|
+
var _excluded = ["button", "icon", "highlighted", "invalid", "onKeyDown", "autoFocus"];
|
9
|
+
var Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
|
10
|
+
var button = props.button,
|
11
|
+
icon = props.icon,
|
12
|
+
invalid = props.invalid,
|
13
|
+
onKeyDown = props.onKeyDown,
|
14
|
+
autoFocus = props.autoFocus,
|
15
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
16
|
+
|
17
|
+
var inputRef = useProxiedRef(ref);
|
18
|
+
var hasContainer = button || icon;
|
19
|
+
var className = cn(getInputClasses(props), 'min-h-[theme(spacing.8)] pointer-events-all', {
|
20
20
|
'pr-8': !!hasContainer
|
21
21
|
}, !hasContainer && otherProps.className);
|
22
|
-
useEffect(()
|
22
|
+
useEffect(function () {
|
23
23
|
if (autoFocus && inputRef.current) {
|
24
24
|
inputRef.current.focus();
|
25
25
|
}
|
@@ -27,10 +27,10 @@ const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
|
|
27
27
|
// if it has scroll height then the browser reverts to native scrolling behaviour only
|
28
28
|
// so we manually override it to ensure _our_ desired behaviour remains intact
|
29
29
|
|
30
|
-
|
30
|
+
var handleKeyDown = function handleKeyDown(event) {
|
31
31
|
if (event.key === 'Home' || event.key === 'End') {
|
32
32
|
event.preventDefault();
|
33
|
-
|
33
|
+
var position = event.key === 'End' ? event.currentTarget.value.length : 0;
|
34
34
|
event.currentTarget.setSelectionRange(position, position);
|
35
35
|
}
|
36
36
|
|
@@ -39,7 +39,7 @@ const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
|
|
39
39
|
}
|
40
40
|
};
|
41
41
|
|
42
|
-
|
42
|
+
var input = createElement("input", Object.assign({}, otherProps, {
|
43
43
|
className: className,
|
44
44
|
"data-taco": "input",
|
45
45
|
onKeyDown: handleKeyDown,
|
@@ -47,21 +47,19 @@ const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
|
|
47
47
|
}));
|
48
48
|
|
49
49
|
if (hasContainer) {
|
50
|
-
|
50
|
+
var extra;
|
51
51
|
|
52
52
|
if (button) {
|
53
|
-
var _button$props$disable;
|
53
|
+
var _button$props$disable, _cn;
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
[getButtonStateClasses(invalid)]: !props.disabled
|
58
|
-
}, button.props.className);
|
55
|
+
var disabled = (_button$props$disable = button.props.disabled) !== null && _button$props$disable !== void 0 ? _button$props$disable : otherProps.disabled;
|
56
|
+
var buttonClassName = cn('items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none', (_cn = {}, _cn[getButtonStateClasses(invalid)] = !props.disabled, _cn), button.props.className);
|
59
57
|
extra = cloneElement(button, {
|
60
58
|
className: buttonClassName,
|
61
|
-
disabled
|
59
|
+
disabled: disabled
|
62
60
|
});
|
63
61
|
} else if (icon) {
|
64
|
-
|
62
|
+
var iconClassName = cn('items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2', {
|
65
63
|
'text-grey-dark': props.disabled,
|
66
64
|
'text-grey-darkest': !props.disabled
|
67
65
|
});
|
@@ -73,7 +71,7 @@ const Input = /*#__PURE__*/forwardRef(function Input(props, ref) {
|
|
73
71
|
});
|
74
72
|
}
|
75
73
|
|
76
|
-
|
74
|
+
var containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);
|
77
75
|
return createElement("div", {
|
78
76
|
className: containerClassName,
|
79
77
|
"data-taco": "input-container"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { Icon, IconName } from '../Icon/Icon';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\nimport { getButtonStateClasses, getInputClasses } from './util';\r\n\r\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\r\n /** Shows a button within the input field */\r\n button?: React.ReactElement;\r\n /** Shows an icon within the input field */\r\n icon?: IconName | JSX.Element;\r\n /** Draws attention to the input by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n};\r\n\r\nexport const Input = React.forwardRef(function Input(props: InputProps, ref: React.Ref<HTMLInputElement>) {\r\n const { button, icon, highlighted, invalid, onKeyDown, autoFocus, ...otherProps } = props;\r\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\r\n const hasContainer = button || icon;\r\n const className = cn(\r\n getInputClasses(props),\r\n 'min-h-[theme(spacing.8)] pointer-events-all',\r\n {\r\n 'pr-8': !!hasContainer,\r\n },\r\n !hasContainer && otherProps.className\r\n );\r\n\r\n React.useEffect(() => {\r\n if (autoFocus && inputRef.current) {\r\n inputRef.current.focus();\r\n }\r\n }, []);\r\n\r\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\r\n // if it has scroll height then the browser reverts to native scrolling behaviour only\r\n // so we manually override it to ensure _our_ desired behaviour remains intact\r\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === 'Home' || event.key === 'End') {\r\n event.preventDefault();\r\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\r\n event.currentTarget.setSelectionRange(position, position);\r\n }\r\n\r\n if (onKeyDown) {\r\n onKeyDown(event);\r\n }\r\n };\r\n\r\n const input = <input {...otherProps} className={className} data-taco=\"input\" onKeyDown={handleKeyDown} ref={inputRef} />;\r\n\r\n if (hasContainer) {\r\n let extra: any;\r\n\r\n if (button) {\r\n const disabled = button.props.disabled ?? otherProps.disabled;\r\n const buttonClassName = cn(\r\n 'items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none',\r\n {\r\n [getButtonStateClasses(invalid)]: !props.disabled,\r\n },\r\n button.props.className\r\n );\r\n extra = React.cloneElement(button, {\r\n className: buttonClassName,\r\n disabled,\r\n });\r\n } else if (icon) {\r\n const iconClassName = cn(\r\n 'items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2',\r\n {\r\n 'text-grey-dark': props.disabled,\r\n 'text-grey-darkest': !props.disabled,\r\n }\r\n );\r\n extra =\r\n typeof icon === 'string' ? (\r\n <Icon className={iconClassName} name={icon} />\r\n ) : (\r\n React.cloneElement(icon, { className: cn(iconClassName, icon.props.className) })\r\n );\r\n }\r\n\r\n const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);\r\n\r\n return (\r\n <div className={containerClassName} data-taco=\"input-container\">\r\n {input}\r\n {extra}\r\n </div>\r\n );\r\n }\r\n\r\n return input;\r\n});\r\n"],"names":["Input","React","props","ref","button","icon","
|
1
|
+
{"version":3,"file":"Input.js","sources":["../../../../src/components/Input/Input.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { Icon, IconName } from '../Icon/Icon';\r\nimport { useProxiedRef } from '../../utils/hooks/useProxiedRef';\r\nimport { getButtonStateClasses, getInputClasses } from './util';\r\n\r\nexport type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {\r\n /** Shows a button within the input field */\r\n button?: React.ReactElement;\r\n /** Shows an icon within the input field */\r\n icon?: IconName | JSX.Element;\r\n /** Draws attention to the input by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n};\r\n\r\nexport const Input = React.forwardRef(function Input(props: InputProps, ref: React.Ref<HTMLInputElement>) {\r\n const { button, icon, highlighted, invalid, onKeyDown, autoFocus, ...otherProps } = props;\r\n const inputRef = useProxiedRef<HTMLInputElement>(ref);\r\n const hasContainer = button || icon;\r\n const className = cn(\r\n getInputClasses(props),\r\n 'min-h-[theme(spacing.8)] pointer-events-all',\r\n {\r\n 'pr-8': !!hasContainer,\r\n },\r\n !hasContainer && otherProps.className\r\n );\r\n\r\n React.useEffect(() => {\r\n if (autoFocus && inputRef.current) {\r\n inputRef.current.focus();\r\n }\r\n }, []);\r\n\r\n // home and end keys only navigate to the start/end of input value if the input container does not scroll\r\n // if it has scroll height then the browser reverts to native scrolling behaviour only\r\n // so we manually override it to ensure _our_ desired behaviour remains intact\r\n const handleKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\r\n if (event.key === 'Home' || event.key === 'End') {\r\n event.preventDefault();\r\n const position = event.key === 'End' ? event.currentTarget.value.length : 0;\r\n event.currentTarget.setSelectionRange(position, position);\r\n }\r\n\r\n if (onKeyDown) {\r\n onKeyDown(event);\r\n }\r\n };\r\n\r\n const input = <input {...otherProps} className={className} data-taco=\"input\" onKeyDown={handleKeyDown} ref={inputRef} />;\r\n\r\n if (hasContainer) {\r\n let extra: any;\r\n\r\n if (button) {\r\n const disabled = button.props.disabled ?? otherProps.disabled;\r\n const buttonClassName = cn(\r\n 'items-center flex justify-center border absolute rounded-l-none rounded-r right-0 h-full focus:rounded focus:outline-none',\r\n {\r\n [getButtonStateClasses(invalid)]: !props.disabled,\r\n },\r\n button.props.className\r\n );\r\n extra = React.cloneElement(button, {\r\n className: buttonClassName,\r\n disabled,\r\n });\r\n } else if (icon) {\r\n const iconClassName = cn(\r\n 'items-center flex justify-center absolute pointer-events-none mr-1 p-px right-0 w-5 top-1/2 -translate-y-1/2',\r\n {\r\n 'text-grey-dark': props.disabled,\r\n 'text-grey-darkest': !props.disabled,\r\n }\r\n );\r\n extra =\r\n typeof icon === 'string' ? (\r\n <Icon className={iconClassName} name={icon} />\r\n ) : (\r\n React.cloneElement(icon, { className: cn(iconClassName, icon.props.className) })\r\n );\r\n }\r\n\r\n const containerClassName = cn('bg-white inline-flex relative rounded w-full', otherProps.className);\r\n\r\n return (\r\n <div className={containerClassName} data-taco=\"input-container\">\r\n {input}\r\n {extra}\r\n </div>\r\n );\r\n }\r\n\r\n return input;\r\n});\r\n"],"names":["Input","React","props","ref","button","icon","invalid","onKeyDown","autoFocus","otherProps","inputRef","useProxiedRef","hasContainer","className","cn","getInputClasses","current","focus","handleKeyDown","event","key","preventDefault","position","currentTarget","value","length","setSelectionRange","input","extra","disabled","buttonClassName","getButtonStateClasses","iconClassName","Icon","name","containerClassName"],"mappings":";;;;;;;;IAiBaA,KAAK,gBAAGC,UAAA,CAAiB,SAASD,KAAT,CAAeE,KAAf,EAAkCC,GAAlC;AAClC,MAAQC,MAAR,GAAoFF,KAApF,CAAQE,MAAR;AAAA,MAAgBC,IAAhB,GAAoFH,KAApF,CAAgBG,IAAhB;AAAA,MAAmCC,OAAnC,GAAoFJ,KAApF,CAAmCI,OAAnC;AAAA,MAA4CC,SAA5C,GAAoFL,KAApF,CAA4CK,SAA5C;AAAA,MAAuDC,SAAvD,GAAoFN,KAApF,CAAuDM,SAAvD;AAAA,MAAqEC,UAArE,iCAAoFP,KAApF;;AACA,MAAMQ,QAAQ,GAAGC,aAAa,CAAmBR,GAAnB,CAA9B;AACA,MAAMS,YAAY,GAAGR,MAAM,IAAIC,IAA/B;AACA,MAAMQ,SAAS,GAAGC,EAAE,CAChBC,eAAe,CAACb,KAAD,CADC,EAEhB,6CAFgB,EAGhB;AACI,YAAQ,CAAC,CAACU;AADd,GAHgB,EAMhB,CAACA,YAAD,IAAiBH,UAAU,CAACI,SANZ,CAApB;AASAZ,EAAAA,SAAA,CAAgB;AACZ,QAAIO,SAAS,IAAIE,QAAQ,CAACM,OAA1B,EAAmC;AAC/BN,MAAAA,QAAQ,CAACM,OAAT,CAAiBC,KAAjB;AACH;AACJ,GAJD,EAIG,EAJH;AAOA;AACA;;AACA,MAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD;AAClB,QAAIA,KAAK,CAACC,GAAN,KAAc,MAAd,IAAwBD,KAAK,CAACC,GAAN,KAAc,KAA1C,EAAiD;AAC7CD,MAAAA,KAAK,CAACE,cAAN;AACA,UA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AAAeE,QAAAA,IAAI,EAAE7B;OAAtC,CADJ,GAGIJ,YAAA,CAAmBI,IAAnB,EAAyB;AAAEQ,QAAAA,SAAS,EAAEC,EAAE,CAACkB,aAAD,EAAgB3B,IAAI,CAACH,KAAL,CAAWW,SAA3B;AAAf,OAAzB,CAJR;AAMH;;AAED,QAAMsB,kBAAkB,GAAGrB,EAAE,CAAC,8CAAD,EAAiDL,UAAU,CAACI,SAA5D,CAA7B;AAEA,WACIZ,aAAA,MAAA;AAAKY,MAAAA,SAAS,EAAEsB;mBAA8B;KAA9C,EACKR,KADL,EAEKC,KAFL,CADJ;AAMH;;AAED,SAAOD,KAAP;AACH,CA/EoB;;;;"}
|
@@ -1,52 +1,53 @@
|
|
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 { ScrollableList } from './ScrollableList.js';
|
4
5
|
import { useListbox } from './useListbox.js';
|
5
6
|
import { useMultiListbox } from './useMultiListbox.js';
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
var _excluded = ["className"],
|
9
|
+
_excluded2 = ["className"];
|
10
|
+
var Listbox = /*#__PURE__*/forwardRef(function Listbox(props, ref) {
|
11
|
+
var externalClassName = props.className,
|
12
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
13
|
+
|
14
|
+
var _useListbox = useListbox(otherProps, ref),
|
15
|
+
list = _useListbox.list,
|
16
|
+
input = _useListbox.input;
|
17
|
+
|
18
|
+
var className = cn('bg-white inline-flex relative w-full', externalClassName);
|
17
19
|
return createElement("span", {
|
18
20
|
"data-taco": "listbox",
|
19
21
|
className: className
|
20
22
|
}, createElement(ScrollableList, Object.assign({}, list, {
|
21
|
-
style: {
|
23
|
+
style: _extends({}, list.style, {
|
22
24
|
maxHeight: 'calc(12rem + 2px)'
|
23
25
|
/* (6 * option height) + listbox border */
|
24
26
|
|
25
|
-
}
|
27
|
+
})
|
26
28
|
})), createElement("input", Object.assign({}, input, {
|
27
29
|
className: "hidden",
|
28
30
|
type: "text"
|
29
31
|
})));
|
30
32
|
});
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
const className = cn('bg-white inline-flex relative w-full', externalClassName);
|
33
|
+
var MultiListbox = /*#__PURE__*/forwardRef(function Listbox(props, ref) {
|
34
|
+
var externalClassName = props.className,
|
35
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
36
|
+
|
37
|
+
var _useMultiListbox = useMultiListbox(otherProps, ref),
|
38
|
+
list = _useMultiListbox.list,
|
39
|
+
input = _useMultiListbox.input;
|
40
|
+
|
41
|
+
var className = cn('bg-white inline-flex relative w-full', externalClassName);
|
41
42
|
return createElement("span", {
|
42
43
|
"data-taco": "listbox",
|
43
44
|
className: className
|
44
45
|
}, createElement(ScrollableList, Object.assign({}, list, {
|
45
|
-
style: {
|
46
|
+
style: _extends({}, list.style, {
|
46
47
|
maxHeight: 'calc(12rem + 2px + 2px)'
|
47
48
|
/* (6 * option height) + listbox border + ALL_OPTIONS bottom border */
|
48
49
|
|
49
|
-
}
|
50
|
+
})
|
50
51
|
})), createElement("input", Object.assign({}, input, {
|
51
52
|
className: "hidden",
|
52
53
|
type: "text"
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Listbox.js","sources":["../../../../src/components/Listbox/Listbox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { useListbox } from './useListbox';\r\nimport { useMultiListbox } from './useMultiListbox';\r\nimport { ScrollableList, ScrollableListItemValue, ScrollableListItem } from './ScrollableList';\r\n\r\nexport type ListboxItem = ScrollableListItem;\r\nexport type ListboxValue = ScrollableListItemValue;\r\n\r\nexport type ListboxTexts = {\r\n /**\r\n * Text displayed in the listbox if no data provided.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n empty: string;\r\n /**\r\n * Text displayed in the listbox to indicate the data is loading.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n loading: string;\r\n /**\r\n * The first option displayed in a multiselect listbox that selects all available options.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n allOption: string;\r\n};\r\n\r\nexport type ListboxProps = Pick<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onFocus'> &\r\n Omit<React.InputHTMLAttributes<HTMLElement>, 'defaultValue' | 'onChange' | 'value'> & {\r\n /** Data indicating the options in listbox */\r\n data?: ListboxItem[];\r\n /**\r\n * Initial value of the listbox.\r\n * This is used when listbox is mounted, if no value is provided.\r\n * *Note* that listbox is a controlled component, setting this will also trigger the `onChange` event\r\n */\r\n defaultValue?: ListboxValue;\r\n /** Set what value should have an empty option in listbox */\r\n emptyValue?: ListboxValue;\r\n /** Draws attention to the listbox by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n /**\r\n * Shows a loading indicator with a text next to it.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n loading?: boolean;\r\n /**\r\n * Value of the listbox representing the selected item.\r\n * It needs to be an existing value from the provided data\r\n */\r\n value?: ListboxValue;\r\n };\r\n\r\nexport const Listbox = React.forwardRef(function Listbox(props: ListboxProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, ...otherProps } = props;\r\n const { list, input } = useListbox(otherProps, ref);\r\n const className = cn('bg-white inline-flex relative w-full', externalClassName);\r\n\r\n return (\r\n <span data-taco=\"listbox\" className={className}>\r\n <ScrollableList\r\n {...list}\r\n style={{ ...list.style, maxHeight: 'calc(12rem + 2px)' /* (6 * option height) + listbox border */ }}\r\n />\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </span>\r\n );\r\n});\r\n\r\nexport const MultiListbox = React.forwardRef(function Listbox(props: ListboxProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, ...otherProps } = props;\r\n const { list, input } = useMultiListbox(otherProps, ref);\r\n const className = cn('bg-white inline-flex relative w-full', externalClassName);\r\n\r\n return (\r\n <span data-taco=\"listbox\" className={className}>\r\n <ScrollableList\r\n {...list}\r\n style={{\r\n ...list.style,\r\n maxHeight: 'calc(12rem + 2px + 2px)' /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */,\r\n }}\r\n />\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </span>\r\n );\r\n});\r\n"],"names":["Listbox","React","props","ref","
|
1
|
+
{"version":3,"file":"Listbox.js","sources":["../../../../src/components/Listbox/Listbox.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport cn from 'classnames';\r\nimport { useListbox } from './useListbox';\r\nimport { useMultiListbox } from './useMultiListbox';\r\nimport { ScrollableList, ScrollableListItemValue, ScrollableListItem } from './ScrollableList';\r\n\r\nexport type ListboxItem = ScrollableListItem;\r\nexport type ListboxValue = ScrollableListItemValue;\r\n\r\nexport type ListboxTexts = {\r\n /**\r\n * Text displayed in the listbox if no data provided.\r\n * To read more about how to provide the text, see [Provider](component:provider) component\r\n */\r\n empty: string;\r\n /**\r\n * Text displayed in the listbox to indicate the data is loading.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n loading: string;\r\n /**\r\n * The first option displayed in a multiselect listbox that selects all available options.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n allOption: string;\r\n};\r\n\r\nexport type ListboxProps = Pick<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onFocus'> &\r\n Omit<React.InputHTMLAttributes<HTMLElement>, 'defaultValue' | 'onChange' | 'value'> & {\r\n /** Data indicating the options in listbox */\r\n data?: ListboxItem[];\r\n /**\r\n * Initial value of the listbox.\r\n * This is used when listbox is mounted, if no value is provided.\r\n * *Note* that listbox is a controlled component, setting this will also trigger the `onChange` event\r\n */\r\n defaultValue?: ListboxValue;\r\n /** Set what value should have an empty option in listbox */\r\n emptyValue?: ListboxValue;\r\n /** Draws attention to the listbox by changing its style and making it visually prominent */\r\n highlighted?: boolean;\r\n /* Whether the input is in an invalid state */\r\n invalid?: boolean;\r\n /**\r\n * Shows a loading indicator with a text next to it.\r\n * Read more about how to provide the text in [Provider](component:provider) component\r\n */\r\n loading?: boolean;\r\n /**\r\n * Value of the listbox representing the selected item.\r\n * It needs to be an existing value from the provided data\r\n */\r\n value?: ListboxValue;\r\n };\r\n\r\nexport const Listbox = React.forwardRef(function Listbox(props: ListboxProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, ...otherProps } = props;\r\n const { list, input } = useListbox(otherProps, ref);\r\n const className = cn('bg-white inline-flex relative w-full', externalClassName);\r\n\r\n return (\r\n <span data-taco=\"listbox\" className={className}>\r\n <ScrollableList\r\n {...list}\r\n style={{ ...list.style, maxHeight: 'calc(12rem + 2px)' /* (6 * option height) + listbox border */ }}\r\n />\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </span>\r\n );\r\n});\r\n\r\nexport const MultiListbox = React.forwardRef(function Listbox(props: ListboxProps, ref: React.Ref<HTMLInputElement>) {\r\n const { className: externalClassName, ...otherProps } = props;\r\n const { list, input } = useMultiListbox(otherProps, ref);\r\n const className = cn('bg-white inline-flex relative w-full', externalClassName);\r\n\r\n return (\r\n <span data-taco=\"listbox\" className={className}>\r\n <ScrollableList\r\n {...list}\r\n style={{\r\n ...list.style,\r\n maxHeight: 'calc(12rem + 2px + 2px)' /* (6 * option height) + listbox border + ALL_OPTIONS bottom border */,\r\n }}\r\n />\r\n <input {...input} className=\"hidden\" type=\"text\" />\r\n </span>\r\n );\r\n});\r\n"],"names":["Listbox","React","props","ref","externalClassName","className","otherProps","useListbox","list","input","cn","ScrollableList","style","maxHeight","type","MultiListbox","useMultiListbox"],"mappings":";;;;;;;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J,EAQIZ,aAAA,QAAA,oBAAWQ;AAAOJ,IAAAA,SAAS,EAAC;AAASS,IAAAA,IAAI,EAAC;IAA1C,CARJ,CADJ;AAYH,CAjB2B;;;;"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import { useState, useMemo, createElement } from 'react';
|
2
3
|
import { MenuContext } from './Context.js';
|
3
4
|
import { Root } from '@radix-ui/react-dropdown-menu';
|
@@ -10,26 +11,48 @@ import { RadioGroup } from './components/RadioGroup.js';
|
|
10
11
|
import { Separator } from './components/Separator.js';
|
11
12
|
import { Header } from './components/Header.js';
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
14
|
+
var _excluded = ["appearance", "children", "trigger"];
|
15
|
+
var Menu = function Menu(externalProps) {
|
16
|
+
var externalAppearance = externalProps.appearance,
|
17
|
+
children = externalProps.children,
|
18
|
+
trigger = externalProps.trigger,
|
19
|
+
props = _objectWithoutPropertiesLoose(externalProps, _excluded);
|
20
|
+
|
21
|
+
var _React$useState = useState(false),
|
22
|
+
open = _React$useState[0],
|
23
|
+
setOpen = _React$useState[1];
|
24
|
+
|
25
|
+
var _React$useState2 = useState(externalAppearance !== null && externalAppearance !== void 0 ? externalAppearance : 'default'),
|
26
|
+
appearance = _React$useState2[0],
|
27
|
+
_setAppearance = _React$useState2[1];
|
28
|
+
|
29
|
+
var _React$useState3 = useState(false),
|
30
|
+
indented = _React$useState3[0],
|
31
|
+
setIndented = _React$useState3[1];
|
32
|
+
|
33
|
+
var _React$useState4 = useState(undefined),
|
34
|
+
minWidth = _React$useState4[0],
|
35
|
+
_setMinWidth = _React$useState4[1];
|
36
|
+
|
37
|
+
var context = useMemo(function () {
|
38
|
+
return {
|
39
|
+
appearance: appearance,
|
40
|
+
setAppearance: function setAppearance(appearance) {
|
41
|
+
return _setAppearance(appearance);
|
42
|
+
},
|
43
|
+
indented: indented,
|
44
|
+
registerIndentation: function registerIndentation() {
|
45
|
+
return setIndented(true);
|
46
|
+
},
|
47
|
+
minWidth: minWidth,
|
48
|
+
setMinWidth: function setMinWidth(width) {
|
49
|
+
return _setMinWidth(width);
|
50
|
+
},
|
51
|
+
close: function close() {
|
52
|
+
return setOpen(false);
|
53
|
+
}
|
54
|
+
};
|
55
|
+
}, [indented, minWidth, appearance]);
|
33
56
|
return createElement(MenuContext.Provider, {
|
34
57
|
value: context
|
35
58
|
}, createElement(Root, Object.assign({}, props, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Menu.js","sources":["../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport { MenuContext } from './Context';\r\nimport { Content } from './components/Content';\r\nimport { Item } from './components/Item';\r\nimport { Link } from './components/Link';\r\nimport { Trigger } from './components/Trigger';\r\nimport { Checkbox } from './components/Checkbox';\r\nimport { RadioGroup } from './components/RadioGroup';\r\nimport { Separator } from './components/Separator';\r\nimport { Header } from './components/Header';\r\nimport { Appearance } from '../..';\r\n\r\nexport type MenuProps = {\r\n /** Appearance will change the style of the button */\r\n appearance?: Appearance;\r\n children: React.ReactNode;\r\n id?: string;\r\n /** A trigger to be used for the menu, should not be set if `children` already contains a trigger */\r\n trigger?: JSX.Element;\r\n};\r\n\r\nexport const Menu = (externalProps: MenuProps): JSX.Element => {\r\n const { appearance: externalAppearance, children, trigger, ...props } = externalProps;\r\n const [open, setOpen] = React.useState(false);\r\n const [appearance, setAppearance] = React.useState<Appearance>(externalAppearance ?? 'default');\r\n const [indented, setIndented] = React.useState(false);\r\n const [minWidth, setMinWidth] = React.useState<number | undefined>(undefined);\r\n\r\n const context = React.useMemo(\r\n () => ({\r\n appearance,\r\n setAppearance: (appearance: Appearance) => setAppearance(appearance),\r\n indented,\r\n registerIndentation: () => setIndented(true),\r\n minWidth,\r\n setMinWidth: (width: number) => setMinWidth(width),\r\n close: () => setOpen(false),\r\n }),\r\n [indented, minWidth, appearance]\r\n );\r\n\r\n return (\r\n <MenuContext.Provider value={context}>\r\n <DropdownMenuPrimitive.Root {...props} modal={false} open={open} onOpenChange={setOpen}>\r\n {trigger && <Trigger>{trigger}</Trigger>}\r\n {children}\r\n </DropdownMenuPrimitive.Root>\r\n </MenuContext.Provider>\r\n );\r\n};\r\nMenu.Trigger = Trigger;\r\nMenu.Content = Content;\r\nMenu.Item = Item;\r\nMenu.Link = Link;\r\nMenu.Checkbox = Checkbox;\r\nMenu.Separator = Separator;\r\nMenu.Header = Header;\r\nMenu.RadioGroup = RadioGroup;\r\n"],"names":["Menu","externalProps","
|
1
|
+
{"version":3,"file":"Menu.js","sources":["../../../../src/components/Menu/Menu.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport { MenuContext } from './Context';\r\nimport { Content } from './components/Content';\r\nimport { Item } from './components/Item';\r\nimport { Link } from './components/Link';\r\nimport { Trigger } from './components/Trigger';\r\nimport { Checkbox } from './components/Checkbox';\r\nimport { RadioGroup } from './components/RadioGroup';\r\nimport { Separator } from './components/Separator';\r\nimport { Header } from './components/Header';\r\nimport { Appearance } from '../..';\r\n\r\nexport type MenuProps = {\r\n /** Appearance will change the style of the button */\r\n appearance?: Appearance;\r\n children: React.ReactNode;\r\n id?: string;\r\n /** A trigger to be used for the menu, should not be set if `children` already contains a trigger */\r\n trigger?: JSX.Element;\r\n};\r\n\r\nexport const Menu = (externalProps: MenuProps): JSX.Element => {\r\n const { appearance: externalAppearance, children, trigger, ...props } = externalProps;\r\n const [open, setOpen] = React.useState(false);\r\n const [appearance, setAppearance] = React.useState<Appearance>(externalAppearance ?? 'default');\r\n const [indented, setIndented] = React.useState(false);\r\n const [minWidth, setMinWidth] = React.useState<number | undefined>(undefined);\r\n\r\n const context = React.useMemo(\r\n () => ({\r\n appearance,\r\n setAppearance: (appearance: Appearance) => setAppearance(appearance),\r\n indented,\r\n registerIndentation: () => setIndented(true),\r\n minWidth,\r\n setMinWidth: (width: number) => setMinWidth(width),\r\n close: () => setOpen(false),\r\n }),\r\n [indented, minWidth, appearance]\r\n );\r\n\r\n return (\r\n <MenuContext.Provider value={context}>\r\n <DropdownMenuPrimitive.Root {...props} modal={false} open={open} onOpenChange={setOpen}>\r\n {trigger && <Trigger>{trigger}</Trigger>}\r\n {children}\r\n </DropdownMenuPrimitive.Root>\r\n </MenuContext.Provider>\r\n );\r\n};\r\nMenu.Trigger = Trigger;\r\nMenu.Content = Content;\r\nMenu.Item = Item;\r\nMenu.Link = Link;\r\nMenu.Checkbox = Checkbox;\r\nMenu.Separator = Separator;\r\nMenu.Header = Header;\r\nMenu.RadioGroup = RadioGroup;\r\n"],"names":["Menu","externalProps","externalAppearance","appearance","children","trigger","props","React","open","setOpen","setAppearance","indented","setIndented","undefined","minWidth","setMinWidth","context","registerIndentation","width","close","MenuContext","Provider","value","DropdownMenuPrimitive","modal","onOpenChange","Trigger","Content","Item","Link","Checkbox","Separator","Header","RadioGroup"],"mappings":";;;;;;;;;;;;;;IAsBaA,IAAI,GAAG,SAAPA,IAAO,CAACC,aAAD;AAChB,MAAoBC,kBAApB,GAAwED,aAAxE,CAAQE,UAAR;AAAA,MAAwCC,QAAxC,GAAwEH,aAAxE,CAAwCG,QAAxC;AAAA,MAAkDC,OAAlD,GAAwEJ,aAAxE,CAAkDI,OAAlD;AAAA,MAA8DC,KAA9D,iCAAwEL,aAAxE;;AACA,wBAAwBM,QAAA,CAAe,KAAf,CAAxB;AAAA,MAAOC,IAAP;AAAA,MAAaC,OAAb;;AACA,yBAAoCF,QAAA,CAA2BL,kBAA3B,aAA2BA,kBA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GAAYA,IAAZ;AACA5B,IAAI,CAAC6B,IAAL,GAAYA,IAAZ;AACA7B,IAAI,CAAC8B,QAAL,GAAgBA,QAAhB;AACA9B,IAAI,CAAC+B,SAAL,GAAiBA,SAAjB;AACA/B,IAAI,CAACgC,MAAL,GAAcA,MAAd;AACAhC,IAAI,CAACiC,UAAL,GAAkBA,UAAlB;;;;"}
|
@@ -16,20 +16,20 @@ const Icon = ({
|
|
16
16
|
const getAppearanceClasses = appearance => {
|
17
17
|
switch (appearance) {
|
18
18
|
case 'primary':
|
19
|
-
return 'wcag-blue aria-disabled:text-blue-dark focus:wcag-blue-light';
|
19
|
+
return 'wcag-blue aria-disabled:text-blue-dark hover:wcag-blue-light focus:wcag-blue-light';
|
20
20
|
|
21
21
|
case 'danger':
|
22
|
-
return 'wcag-red aria-disabled:text-red-dark focus:wcag-red-light';
|
22
|
+
return 'wcag-red aria-disabled:text-red-dark hover:wcag-red-light focus:wcag-red-light';
|
23
23
|
|
24
24
|
case 'ghost':
|
25
|
-
return 'text-blue aria-disabled:text-grey focus:wcag-blue';
|
25
|
+
return 'text-blue aria-disabled:text-grey hover:wcag-blue focus:wcag-blue';
|
26
26
|
|
27
27
|
case 'discrete':
|
28
|
-
return 'text-black aria-disabled:text-grey focus:wcag-blue-lightest';
|
28
|
+
return 'text-black aria-disabled:text-grey hover:wcag-blue-lightest focus:wcag-blue-lightest';
|
29
29
|
|
30
30
|
case 'default':
|
31
31
|
default:
|
32
|
-
return 'wcag-grey-light aria-disabled:text-grey-darker focus:wcag-grey-dark';
|
32
|
+
return 'wcag-grey-light aria-disabled:text-grey-darker hover:wcag-grey-dark focus:wcag-grey-dark';
|
33
33
|
}
|
34
34
|
};
|
35
35
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Item.js","sources":["../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport cn from 'classnames';\r\nimport { IconName } from '../../Icon/Icon';\r\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\r\nimport { useCurrentMenu } from '../Context';\r\nimport { Appearance } from '../../../types';\r\nimport { DialogProps } from '../../Dialog/Dialog';\r\n\r\nexport const Icon = ({ name }) => (\r\n <span className=\"absolute left-0 ml-1\">\r\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\r\n </span>\r\n);\r\n\r\nconst getAppearanceClasses = (appearance: Appearance | undefined) => {\r\n switch (appearance) {\r\n case 'primary':\r\n return 'wcag-blue aria-disabled:text-blue-dark focus:wcag-blue-light';\r\n\r\n case 'danger':\r\n return 'wcag-red aria-disabled:text-red-dark focus:wcag-red-light';\r\n\r\n case 'ghost':\r\n return 'text-blue aria-disabled:text-grey focus:wcag-blue';\r\n\r\n case 'discrete':\r\n return 'text-black aria-disabled:text-grey focus:wcag-blue-lightest';\r\n\r\n case 'default':\r\n default:\r\n return 'wcag-grey-light aria-disabled:text-grey-darker focus:wcag-grey-dark';\r\n }\r\n};\r\n\r\nexport const useItemStyling = ({ disabled, indented, className }) => {\r\n const menu = useCurrentMenu();\r\n\r\n React.useEffect(() => {\r\n if (indented && !menu?.indented) {\r\n menu?.registerIndentation();\r\n }\r\n }, [indented]);\r\n\r\n return cn(\r\n 'flex items-center justify-start h-7 pr-1.5 relative rounded w-full focus:outline-none group',\r\n getAppearanceClasses(menu?.appearance),\r\n {\r\n 'pl-7': menu?.indented,\r\n 'pl-1.5': !menu?.indented,\r\n 'cursor-pointer': !disabled,\r\n 'cursor-not-allowed': disabled,\r\n },\r\n className\r\n );\r\n};\r\n\r\nexport const Shortcut = props => {\r\n const menu = useCurrentMenu();\r\n let appearance;\r\n\r\n switch (menu?.appearance) {\r\n case 'primary':\r\n appearance = 'text-blue-lightest group-focus:text-black';\r\n break;\r\n\r\n case 'danger':\r\n appearance = 'text-red-lightest group-focus:text-white';\r\n break;\r\n\r\n case 'ghost':\r\n appearance = 'text-blue-light group-focus:text-blue-lightest';\r\n break;\r\n\r\n case 'discrete':\r\n appearance = 'text-grey-darker group-focus:text-blue-light';\r\n break;\r\n\r\n case 'default':\r\n default:\r\n appearance = 'text-grey-darkest';\r\n break;\r\n }\r\n\r\n const className = cn('ml-auto pl-3', appearance);\r\n\r\n return <span {...props} className={className} />;\r\n};\r\n\r\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\r\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\r\n disabled?: boolean;\r\n icon?: IconName;\r\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\r\n shortcut?: string;\r\n};\r\n\r\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\r\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\r\n const className = useItemStyling({\r\n disabled: props.disabled,\r\n indented: !!icon,\r\n className: props.className,\r\n });\r\n\r\n const disabled = props.disabled ?? props['aria-disabled'];\r\n\r\n let handleClick;\r\n\r\n // radix has a bug that does not disable clicks when disabled is set on items\r\n if (disabled) {\r\n handleClick = event => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n };\r\n }\r\n\r\n const handleSelect = event => {\r\n if (onClick) {\r\n onClick(event);\r\n }\r\n\r\n if (props['aria-haspopup'] || typeof dialog === 'function') {\r\n event.preventDefault();\r\n }\r\n };\r\n\r\n let button = (\r\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\r\n {icon && <Icon name={icon} />}\r\n {props.children}\r\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\r\n </DropdownMenuPrimitive.Item>\r\n );\r\n\r\n if (typeof dialog === 'function') {\r\n button = dialog({ trigger: button });\r\n }\r\n\r\n return button;\r\n});\r\n"],"names":["Icon","name","React","className","IconPrimitive","getAppearanceClasses","appearance","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stopPropagation","handleSelect","button","DropdownMenuPrimitive","onSelect","children","trigger"],"mappings":";;;;;;MASaA,IAAI,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAChBC,aAAA,OAAA;AAAMC,EAAAA,SAAS,EAAC;CAAhB,EACID,aAAA,CAACE,MAAD;AAAeD,EAAAA,SAAS,EAAC;AAA0BF,EAAAA,IAAI,EAAEA;CAAzD,CADJ;;AAKJ,MAAMI,oBAAoB,GAAIC,UAAD;AACzB,UAAQA,UAAR;AACI,SAAK,SAAL;AACI,aAAO,
|
1
|
+
{"version":3,"file":"Item.js","sources":["../../../../../src/components/Menu/components/Item.tsx"],"sourcesContent":["import * as React from 'react';\r\nimport * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';\r\nimport cn from 'classnames';\r\nimport { IconName } from '../../Icon/Icon';\r\nimport { Icon as IconPrimitive } from '../../Icon/Icon';\r\nimport { useCurrentMenu } from '../Context';\r\nimport { Appearance } from '../../../types';\r\nimport { DialogProps } from '../../Dialog/Dialog';\r\n\r\nexport const Icon = ({ name }) => (\r\n <span className=\"absolute left-0 ml-1\">\r\n <IconPrimitive className=\"-ml-px -mt-px !h-5 !w-5\" name={name} />\r\n </span>\r\n);\r\n\r\nconst getAppearanceClasses = (appearance: Appearance | undefined) => {\r\n switch (appearance) {\r\n case 'primary':\r\n return 'wcag-blue aria-disabled:text-blue-dark hover:wcag-blue-light focus:wcag-blue-light';\r\n\r\n case 'danger':\r\n return 'wcag-red aria-disabled:text-red-dark hover:wcag-red-light focus:wcag-red-light';\r\n\r\n case 'ghost':\r\n return 'text-blue aria-disabled:text-grey hover:wcag-blue focus:wcag-blue';\r\n\r\n case 'discrete':\r\n return 'text-black aria-disabled:text-grey hover:wcag-blue-lightest focus:wcag-blue-lightest';\r\n\r\n case 'default':\r\n default:\r\n return 'wcag-grey-light aria-disabled:text-grey-darker hover:wcag-grey-dark focus:wcag-grey-dark';\r\n }\r\n};\r\n\r\nexport const useItemStyling = ({ disabled, indented, className }) => {\r\n const menu = useCurrentMenu();\r\n\r\n React.useEffect(() => {\r\n if (indented && !menu?.indented) {\r\n menu?.registerIndentation();\r\n }\r\n }, [indented]);\r\n\r\n return cn(\r\n 'flex items-center justify-start h-7 pr-1.5 relative rounded w-full focus:outline-none group',\r\n getAppearanceClasses(menu?.appearance),\r\n {\r\n 'pl-7': menu?.indented,\r\n 'pl-1.5': !menu?.indented,\r\n 'cursor-pointer': !disabled,\r\n 'cursor-not-allowed': disabled,\r\n },\r\n className\r\n );\r\n};\r\n\r\nexport const Shortcut = props => {\r\n const menu = useCurrentMenu();\r\n let appearance;\r\n\r\n switch (menu?.appearance) {\r\n case 'primary':\r\n appearance = 'text-blue-lightest group-focus:text-black';\r\n break;\r\n\r\n case 'danger':\r\n appearance = 'text-red-lightest group-focus:text-white';\r\n break;\r\n\r\n case 'ghost':\r\n appearance = 'text-blue-light group-focus:text-blue-lightest';\r\n break;\r\n\r\n case 'discrete':\r\n appearance = 'text-grey-darker group-focus:text-blue-light';\r\n break;\r\n\r\n case 'default':\r\n default:\r\n appearance = 'text-grey-darkest';\r\n break;\r\n }\r\n\r\n const className = cn('ml-auto pl-3', appearance);\r\n\r\n return <span {...props} className={className} />;\r\n};\r\n\r\nexport type MenuItemProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'onSelect'> & {\r\n dialog?: (props: Partial<DialogProps>) => JSX.Element;\r\n disabled?: boolean;\r\n icon?: IconName;\r\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\r\n shortcut?: string;\r\n};\r\n\r\nexport const Item = React.forwardRef(function MenuItem(props: MenuItemProps, ref: React.Ref<HTMLDivElement>) {\r\n const { dialog, icon, onClick, shortcut, ...otherProps } = props;\r\n const className = useItemStyling({\r\n disabled: props.disabled,\r\n indented: !!icon,\r\n className: props.className,\r\n });\r\n\r\n const disabled = props.disabled ?? props['aria-disabled'];\r\n\r\n let handleClick;\r\n\r\n // radix has a bug that does not disable clicks when disabled is set on items\r\n if (disabled) {\r\n handleClick = event => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n };\r\n }\r\n\r\n const handleSelect = event => {\r\n if (onClick) {\r\n onClick(event);\r\n }\r\n\r\n if (props['aria-haspopup'] || typeof dialog === 'function') {\r\n event.preventDefault();\r\n }\r\n };\r\n\r\n let button = (\r\n <DropdownMenuPrimitive.Item {...otherProps} className={className} onClick={handleClick} onSelect={handleSelect} ref={ref}>\r\n {icon && <Icon name={icon} />}\r\n {props.children}\r\n {shortcut && <Shortcut>{shortcut}</Shortcut>}\r\n </DropdownMenuPrimitive.Item>\r\n );\r\n\r\n if (typeof dialog === 'function') {\r\n button = dialog({ trigger: button });\r\n }\r\n\r\n return button;\r\n});\r\n"],"names":["Icon","name","React","className","IconPrimitive","getAppearanceClasses","appearance","useItemStyling","disabled","indented","menu","useCurrentMenu","registerIndentation","cn","Shortcut","props","Item","MenuItem","ref","dialog","icon","onClick","shortcut","otherProps","handleClick","event","preventDefault","stopPropagation","handleSelect","button","DropdownMenuPrimitive","onSelect","children","trigger"],"mappings":";;;;;;MASaA,IAAI,GAAG,CAAC;AAAEC,EAAAA;AAAF,CAAD,KAChBC,aAAA,OAAA;AAAMC,EAAAA,SAAS,EAAC;CAAhB,EACID,aAAA,CAACE,MAAD;AAAeD,EAAAA,SAAS,EAAC;AAA0BF,EAAAA,IAAI,EAAEA;CAAzD,CADJ;;AAKJ,MAAMI,oBAAoB,GAAIC,UAAD;AACzB,UAAQA,UAAR;AACI,SAAK,SAAL;AACI,aAAO,oFAAP;;AAEJ,SAAK,QAAL;AACI,aAAO,gFAAP;;AAEJ,SAAK,OAAL;AACI,aAAO,mEAAP;;AAEJ,SAAK,UAAL;AACI,aAAO,sFAAP;;AAEJ,SAAK,SAAL;AACA;AACI,aAAO,0FAAP;AAfR;AAiBH,CAlBD;;MAoBaC,cAAc,GAAG,CAAC;AAAEC,EAAAA,QAAF;AAAYC,EA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J;;AAQA,MAAI,OAAOH,MAAP,KAAkB,UAAtB,EAAkC;AAC9BU,IAAAA,MAAM,GAAGV,MAAM,CAAC;AAAEc,MAAAA,OAAO,EAAEJ;AAAX,KAAD,CAAf;AACH;;AAED,SAAOA,MAAP;AACH,CA3CmB;;;;"}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
1
2
|
import React__default from 'react';
|
2
3
|
import cn from 'classnames';
|
3
4
|
import { Icon } from '../Icon/Icon.js';
|
@@ -5,20 +6,25 @@ import { useProxiedRef } from '../../utils/hooks/useProxiedRef.js';
|
|
5
6
|
import { Treeview } from '../Treeview/Treeview.js';
|
6
7
|
import { useDropTarget } from '../../utils/hooks/useDropTarget.js';
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
9
|
+
var _excluded = ["active", "children", "onDrop", "postfix", "prefix", "role"],
|
10
|
+
_excluded2 = ["children"];
|
11
|
+
var Item = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
12
|
+
var active = props.active,
|
13
|
+
children = props.children,
|
14
|
+
onDrop = props.onDrop,
|
15
|
+
postfix = props.postfix,
|
16
|
+
prefix = props.prefix,
|
17
|
+
role = props.role,
|
18
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded);
|
19
|
+
|
20
|
+
var proxyRef = useProxiedRef(ref);
|
21
|
+
|
22
|
+
var _useDropTarget = useDropTarget(onDrop),
|
23
|
+
isDraggedOver = _useDropTarget[0],
|
24
|
+
dropTargetProps = _useDropTarget[1];
|
25
|
+
|
26
|
+
var isTreeitem = role === 'treeitem';
|
27
|
+
var className = cn('yt-navigation__item cursor-pointer', {
|
22
28
|
'w-full mb-px py-1 px-3 flex items-center hover:bg-grey-dark': isTreeitem,
|
23
29
|
'bg-white w-full h-10 px-3 flex-shrink-0 flex items-center justify-between cursor-pointer': !isTreeitem,
|
24
30
|
'yt-navigation__item--active': active && !isDraggedOver,
|
@@ -26,7 +32,7 @@ const Item = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
26
32
|
'yt-navigation__item--dropping bg-blue': isDraggedOver
|
27
33
|
}, props.className);
|
28
34
|
|
29
|
-
|
35
|
+
var handleClick = function handleClick(event) {
|
30
36
|
if (event.target instanceof HTMLAnchorElement || event.target instanceof HTMLButtonElement) {
|
31
37
|
return;
|
32
38
|
}
|
@@ -49,19 +55,19 @@ const Item = /*#__PURE__*/React__default.forwardRef(function Item(props, ref) {
|
|
49
55
|
className: "yt-navigation__item__postfix ml-1"
|
50
56
|
}, postfix));
|
51
57
|
});
|
52
|
-
|
58
|
+
var Panel = /*#__PURE__*/React__default.forwardRef(function Panel(props, ref) {
|
53
59
|
return React__default.createElement("div", Object.assign({}, props, {
|
54
60
|
className: cn('w-full bg-white p-3', props.className),
|
55
61
|
ref: ref
|
56
62
|
}));
|
57
63
|
});
|
58
|
-
|
59
|
-
|
64
|
+
var MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(props, ref) {
|
65
|
+
var className = cn('flex-shrink-0 space-y-1 outline-none', {
|
60
66
|
'bg-white pb-2': props.fixed
|
61
67
|
}, props.className);
|
62
68
|
|
63
|
-
|
64
|
-
|
69
|
+
var title = function title(expanded) {
|
70
|
+
var className = cn('bg-white h-10 pl-3 pr-1 flex items-center justify-between w-full', {
|
65
71
|
'mb-1': expanded,
|
66
72
|
'cursor-pointer hover:text-blue': !props.fixed
|
67
73
|
});
|
@@ -78,14 +84,16 @@ const MenuGroup = /*#__PURE__*/React__default.forwardRef(function MenuGroup(prop
|
|
78
84
|
ref: ref
|
79
85
|
}));
|
80
86
|
});
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
React__default.Children.toArray(props.children).filter(
|
87
|
+
var Menu = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
|
88
|
+
var scrollableAreas = React__default.useMemo(function () {
|
89
|
+
var scrollableAreas = [];
|
90
|
+
React__default.Children.toArray(props.children).filter(function (child) {
|
91
|
+
return !!child;
|
92
|
+
}).map(function (child) {
|
85
93
|
if (child.props.fixed) {
|
86
94
|
scrollableAreas.push(child);
|
87
95
|
} else {
|
88
|
-
|
96
|
+
var x = scrollableAreas[scrollableAreas.length - 1];
|
89
97
|
|
90
98
|
if (Array.isArray(x)) {
|
91
99
|
x.push(child);
|
@@ -99,18 +107,19 @@ const Menu = /*#__PURE__*/React__default.forwardRef(function Menu(props, ref) {
|
|
99
107
|
return React__default.createElement(Treeview, Object.assign({}, props, {
|
100
108
|
className: cn('divide-grey-light flex flex-grow flex-col divide-y-2 overflow-y-auto', props.className),
|
101
109
|
ref: ref
|
102
|
-
}), scrollableAreas.map((area, i)
|
103
|
-
|
104
|
-
|
105
|
-
|
110
|
+
}), scrollableAreas.map(function (area, i) {
|
111
|
+
return Array.isArray(area) ? React__default.createElement("div", {
|
112
|
+
className: "divide-grey-light flex h-0 flex-auto flex-shrink-0 flex-grow flex-col divide-y-2 overflow-y-auto",
|
113
|
+
key: i
|
114
|
+
}, area) : area;
|
115
|
+
}));
|
106
116
|
});
|
107
117
|
Menu.Group = MenuGroup;
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
const className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);
|
118
|
+
var Navigation = /*#__PURE__*/React__default.forwardRef(function Navigation(props, ref) {
|
119
|
+
var children = props.children,
|
120
|
+
otherProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
121
|
+
|
122
|
+
var className = cn('h-full flex flex-col bg-grey-light divide-y-2 divide-grey-light', props.className);
|
114
123
|
return React__default.createElement("div", Object.assign({}, otherProps, {
|
115
124
|
className: className,
|
116
125
|
"data-taco": "navigation",
|