@veeqo/ui 12.4.0 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/SelectDropdown/SelectDropdown.cjs +27 -19
- package/dist/components/SelectDropdown/SelectDropdown.cjs.map +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.d.ts +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.js +27 -19
- package/dist/components/SelectDropdown/SelectDropdown.js.map +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.module.scss.cjs +2 -2
- package/dist/components/SelectDropdown/SelectDropdown.module.scss.cjs.map +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.module.scss.js +2 -2
- package/dist/components/SelectDropdown/SelectDropdown.module.scss.js.map +1 -1
- package/dist/components/SelectDropdown/components/GridItem/GridItem.cjs +37 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.js +31 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.js.map +1 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.module.scss.cjs +9 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.module.scss.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.module.scss.js +7 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.module.scss.js.map +1 -0
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.cjs +4 -4
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.d.ts +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.js +4 -4
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.js.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.module.scss.cjs +2 -2
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.module.scss.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.module.scss.js +2 -2
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.module.scss.js.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/types.d.ts +2 -0
- package/dist/components/SelectDropdown/components/ListItem/ListItem.cjs +1 -1
- package/dist/components/SelectDropdown/components/ListItem/ListItem.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ListItem/ListItem.js +2 -2
- package/dist/components/SelectDropdown/components/ListItem/ListItem.js.map +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.cjs +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.js +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.js.map +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.module.scss.cjs +2 -2
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.module.scss.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.module.scss.js +2 -2
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.module.scss.js.map +1 -1
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.cjs +18 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.d.ts +3 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.js +12 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.js.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.cjs +19 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.d.ts +3 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.js +13 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.js.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.cjs +9 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.js +7 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.js.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/types.d.ts +25 -0
- package/dist/components/SelectDropdown/components/SelectDropdownState.cjs +11 -3
- package/dist/components/SelectDropdown/components/SelectDropdownState.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/SelectDropdownState.js +11 -3
- package/dist/components/SelectDropdown/components/SelectDropdownState.js.map +1 -1
- package/dist/components/SelectDropdown/components/SelectedOption.cjs +2 -2
- package/dist/components/SelectDropdown/components/SelectedOption.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/SelectedOption.js +2 -2
- package/dist/components/SelectDropdown/components/SelectedOption.js.map +1 -1
- package/dist/components/SelectDropdown/components/item.module.scss.cjs +3 -3
- package/dist/components/SelectDropdown/components/item.module.scss.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/item.module.scss.js +3 -3
- package/dist/components/SelectDropdown/components/item.module.scss.js.map +1 -1
- package/dist/components/SelectDropdown/types.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var reactAriaComponents = require('react-aria-components');
|
|
5
4
|
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
6
5
|
require('uid/secure');
|
|
7
6
|
var SelectedOption = require('./components/SelectedOption.cjs');
|
|
8
7
|
var utils = require('./utils.cjs');
|
|
9
|
-
var ListItemSection = require('./components/ListItemSection/ListItemSection.cjs');
|
|
10
|
-
var ListItem = require('./components/ListItem/ListItem.cjs');
|
|
11
|
-
var SelectDropdownState = require('./components/SelectDropdownState.cjs');
|
|
12
8
|
var Dropdown = require('../Dropdown/Dropdown.cjs');
|
|
13
9
|
var Search = require('../Search/Search.cjs');
|
|
14
10
|
var Button = require('../Button/Button.cjs');
|
|
15
11
|
var SelectDropdown_module = require('./SelectDropdown.module.scss.cjs');
|
|
16
12
|
var form_module = require('../../utils/forms/form.module.scss.cjs');
|
|
13
|
+
var ListBox = require('./components/OptionsContainers/ListBox.cjs');
|
|
14
|
+
var GridList = require('./components/OptionsContainers/GridList.cjs');
|
|
17
15
|
|
|
18
16
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
19
17
|
|
|
20
18
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple = false, compact = false, hasError = false, disabled, options, value, actions, isLoading = false, searchValue, emptyStateSlot, onSearchChange, onChange, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps }) => {
|
|
20
|
+
const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple = false, compact = false, hasError = false, disabled, options, value, actions, isLoading = false, searchValue, emptyStateSlot, onSearchChange, onChange, topAction, isSelectDropdownOpen = false, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps }) => {
|
|
24
21
|
const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);
|
|
25
22
|
const classNames = utils.generateClassNames(className);
|
|
26
23
|
const [isSelectOpen, setIsSelectOpen] = React.useState(false);
|
|
27
24
|
const selectedValues = utils.getSelectedValues(options, hasSection, value);
|
|
28
25
|
const selectionMode = multiple ? 'multiple' : 'single';
|
|
26
|
+
const hasRowAction = options.some((option) => 'onClickRowAction' in option && option.onClickRowAction);
|
|
29
27
|
const onSelectionChange = React.useCallback((keys) => {
|
|
30
28
|
const selectedKeys = Array.from(keys);
|
|
31
29
|
const newSelectedValues = utils.getSelectedValues(options, hasSection, selectedKeys);
|
|
@@ -34,24 +32,34 @@ const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple =
|
|
|
34
32
|
}
|
|
35
33
|
else {
|
|
36
34
|
onChange(newSelectedValues[0]);
|
|
37
|
-
|
|
35
|
+
if (!isSelectDropdownOpen) {
|
|
36
|
+
setIsSelectOpen(false);
|
|
37
|
+
}
|
|
38
38
|
}
|
|
39
|
-
}, [options, hasSection, multiple, onChange]);
|
|
40
|
-
return (React__default.default.createElement(Dropdown.Dropdown, { id: `select-dropdown-${id}`, className: buildClassnames.buildClassnames([classNames === null || classNames === undefined ? undefined : classNames.popover, SelectDropdown_module.dropdown, className]), shouldShow: isSelectOpen, setShouldShow: setIsSelectOpen, useAnchorWidth: true, disabled: disabled, renderCta: (buttonProps, anchorRef) =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
}, [options, hasSection, multiple, onChange, isSelectDropdownOpen]);
|
|
40
|
+
return (React__default.default.createElement(Dropdown.Dropdown, { id: `select-dropdown-${id}`, className: buildClassnames.buildClassnames([classNames === null || classNames === undefined ? undefined : classNames.popover, SelectDropdown_module.dropdown, className]), shouldShow: isSelectOpen, setShouldShow: setIsSelectOpen, useAnchorWidth: true, disabled: disabled, renderCta: (buttonProps, anchorRef) => {
|
|
41
|
+
if (anchorRef && isSelectDropdownOpen) {
|
|
42
|
+
setIsSelectOpen(isSelectDropdownOpen);
|
|
43
|
+
}
|
|
44
|
+
return (React__default.default.createElement("button", { ...buttonProps, type: "button", ref: anchorRef, className: buildClassnames.buildClassnames([
|
|
45
|
+
className,
|
|
46
|
+
SelectDropdown_module.dropdownTrigger,
|
|
47
|
+
form_module.fullStyles,
|
|
48
|
+
form_module.base,
|
|
49
|
+
hasError && form_module.error,
|
|
50
|
+
compact && form_module.compact,
|
|
51
|
+
]) },
|
|
52
|
+
React__default.default.createElement(SelectedOption.SelectedOption, { placeholder: placeholder, options: selectedValues, selectionMode: selectionMode })));
|
|
53
|
+
} },
|
|
49
54
|
onSearchChange && (React__default.default.createElement(React__default.default.Fragment, null,
|
|
50
55
|
React__default.default.createElement(Search.Search, { className: SelectDropdown_module.search, value: searchValue, onChange: onSearchChange }),
|
|
51
56
|
React__default.default.createElement("hr", { className: SelectDropdown_module.separator }))),
|
|
52
|
-
|
|
57
|
+
topAction && (React__default.default.createElement(React.Fragment, { key: topAction.label },
|
|
58
|
+
React__default.default.createElement(Button.Button, { className: SelectDropdown_module.ctaButton, key: topAction.label, variant: "flat", ...topAction }),
|
|
59
|
+
React__default.default.createElement("hr", { className: SelectDropdown_module.separator, key: `separator-${topAction.label}` }))),
|
|
60
|
+
hasRowAction ? (React__default.default.createElement(GridList.GridList, { id: id, className: classNames === null || classNames === undefined ? undefined : classNames.optionsContainer, ariaLabelledBy: ariaLabelledBy, ariaDescribedBy: ariaDescribedBy, selectionMode: selectionMode, options: options, onSelectionChange: onSelectionChange, selectedValues: selectedValues, isLoading: isLoading, emptyStateSlot: emptyStateSlot, ...otherProps })) : (React__default.default.createElement(ListBox.ListBox, { id: id, className: classNames === null || classNames === undefined ? undefined : classNames.optionsContainer, ariaLabelledBy: ariaLabelledBy, ariaDescribedBy: ariaDescribedBy, selectionMode: selectionMode, options: options, onSelectionChange: onSelectionChange, selectedValues: selectedValues, isLoading: isLoading, emptyStateSlot: emptyStateSlot, hasSection: hasSection, ...otherProps })), actions === null || actions === undefined ? undefined :
|
|
53
61
|
actions.map(({ label, ...actionProps }) => (React__default.default.createElement(React.Fragment, { key: label },
|
|
54
|
-
React__default.default.createElement("hr", { className: SelectDropdown_module.separator, key: `
|
|
62
|
+
React__default.default.createElement("hr", { className: SelectDropdown_module.separator, key: `separator-${label}` }),
|
|
55
63
|
React__default.default.createElement(Button.Button, { className: SelectDropdown_module.ctaButton, variant: "flat", key: label, ...actionProps }))))));
|
|
56
64
|
};
|
|
57
65
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectDropdown.cjs","sources":["../../../src/components/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"SelectDropdown.cjs","sources":["../../../src/components/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import React, { Fragment, useCallback, useState } from 'react';\nimport { Selection } from 'react-aria-components';\n\nimport { buildClassnames } from '../../utils';\nimport { SelectedOption } from './components/SelectedOption';\nimport { generateClassNames, getSelectedValues } from './utils';\nimport { SelectDropdownItem, SelectDropdownProps } from './types';\nimport { GridItemProps } from './components/GridItem/types';\nimport { Dropdown } from '../Dropdown';\nimport { Search } from '../Search';\nimport { Button } from '../Button';\nimport styles from './SelectDropdown.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\nimport { ListBox } from './components/OptionsContainers/ListBox';\nimport { GridList } from './components/OptionsContainers/GridList';\n\nexport const SelectDropdown = ({\n id,\n className,\n placeholder = 'Select item',\n multiple = false,\n compact = false,\n hasError = false,\n disabled,\n options,\n value,\n actions,\n isLoading = false,\n searchValue,\n emptyStateSlot,\n onSearchChange,\n onChange,\n topAction,\n isSelectDropdownOpen = false,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...otherProps\n}: SelectDropdownProps) => {\n const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);\n const classNames = generateClassNames(className);\n\n const [isSelectOpen, setIsSelectOpen] = useState(false);\n\n const selectedValues = getSelectedValues(options, hasSection, value);\n const selectionMode = multiple ? 'multiple' : 'single';\n const hasRowAction = options.some(\n (option) => 'onClickRowAction' in option && option.onClickRowAction,\n );\n\n const onSelectionChange = useCallback(\n (keys: Selection) => {\n const selectedKeys = Array.from(keys);\n const newSelectedValues = getSelectedValues(options, hasSection, selectedKeys);\n\n if (multiple) {\n (onChange as (items: SelectDropdownItem[]) => void)(newSelectedValues);\n } else {\n (onChange as (item: SelectDropdownItem) => void)(newSelectedValues[0]);\n if (!isSelectDropdownOpen) {\n setIsSelectOpen(false);\n }\n }\n },\n [options, hasSection, multiple, onChange, isSelectDropdownOpen],\n );\n\n return (\n <Dropdown\n id={`select-dropdown-${id}`}\n className={buildClassnames([classNames?.popover, styles.dropdown, className])}\n shouldShow={isSelectOpen}\n setShouldShow={setIsSelectOpen}\n useAnchorWidth\n disabled={disabled}\n renderCta={(buttonProps, anchorRef) => {\n if (anchorRef && isSelectDropdownOpen) {\n setIsSelectOpen(isSelectDropdownOpen);\n }\n\n return (\n <button\n {...buttonProps}\n type=\"button\"\n ref={anchorRef}\n className={buildClassnames([\n className,\n styles.dropdownTrigger,\n formStyles.fullStyles,\n formStyles.base,\n hasError && formStyles.error,\n compact && formStyles.compact,\n ])}\n >\n <SelectedOption\n placeholder={placeholder}\n options={selectedValues}\n selectionMode={selectionMode}\n />\n </button>\n );\n }}\n >\n {onSearchChange && (\n <>\n <Search className={styles.search} value={searchValue} onChange={onSearchChange} />\n <hr className={styles.separator} />\n </>\n )}\n {topAction && (\n <Fragment key={topAction.label}>\n <Button\n className={styles.ctaButton}\n key={topAction.label}\n variant=\"flat\"\n {...topAction}\n />\n <hr className={styles.separator} key={`separator-${topAction.label}`} />\n </Fragment>\n )}\n {hasRowAction ? (\n <GridList\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options as GridItemProps[]}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues as GridItemProps[]}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n {...otherProps}\n />\n ) : (\n <ListBox\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n hasSection={hasSection}\n {...otherProps}\n />\n )}\n {actions?.map(({ label, ...actionProps }) => (\n <Fragment key={label}>\n <hr className={styles.separator} key={`separator-${label}`} />\n <Button className={styles.ctaButton} variant=\"flat\" key={label} {...actionProps} />\n </Fragment>\n ))}\n </Dropdown>\n );\n};\n"],"names":["generateClassNames","useState","getSelectedValues","useCallback","React","Dropdown","buildClassnames","styles","formStyles","SelectedOption","Search","Fragment","Button","GridList","ListBox"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBO,MAAM,cAAc,GAAG,CAAC,EAC7B,EAAE,EACF,SAAS,EACT,WAAW,GAAG,aAAa,EAC3B,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACR,SAAS,EACT,oBAAoB,GAAG,KAAK,EAC5B,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,UAAU,EACO,KAAI;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC;AACtF,IAAA,MAAM,UAAU,GAAGA,wBAAkB,CAAC,SAAS,CAAC;IAEhD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;IAEvD,MAAM,cAAc,GAAGC,uBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC;IACpE,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ;AACtD,IAAA,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAC/B,CAAC,MAAM,KAAK,kBAAkB,IAAI,MAAM,IAAI,MAAM,CAAC,gBAAgB,CACpE;AAED,IAAA,MAAM,iBAAiB,GAAGC,iBAAW,CACnC,CAAC,IAAe,KAAI;QAClB,MAAM,YAAY,GAAG,KAAK,CAAC,IA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declare const SelectDropdown: ({ id, className, placeholder, multiple, compact, hasError, disabled, options, value, actions, isLoading, searchValue, emptyStateSlot, onSearchChange, onChange, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...otherProps }: SelectDropdownProps) => React.JSX.Element;
|
|
3
|
+
export declare const SelectDropdown: ({ id, className, placeholder, multiple, compact, hasError, disabled, options, value, actions, isLoading, searchValue, emptyStateSlot, onSearchChange, onChange, topAction, isSelectDropdownOpen, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...otherProps }: SelectDropdownProps) => React.JSX.Element;
|
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
import React__default, { useState, useCallback, Fragment } from 'react';
|
|
2
|
-
import { ListBox } from 'react-aria-components';
|
|
3
2
|
import { buildClassnames } from '../../utils/buildClassnames.js';
|
|
4
3
|
import 'uid/secure';
|
|
5
4
|
import { SelectedOption } from './components/SelectedOption.js';
|
|
6
5
|
import { getSelectedValues, generateClassNames } from './utils.js';
|
|
7
|
-
import { ListItemSection } from './components/ListItemSection/ListItemSection.js';
|
|
8
|
-
import { ListItem } from './components/ListItem/ListItem.js';
|
|
9
|
-
import { SelectDropdownState } from './components/SelectDropdownState.js';
|
|
10
6
|
import { Dropdown } from '../Dropdown/Dropdown.js';
|
|
11
7
|
import { Search } from '../Search/Search.js';
|
|
12
8
|
import { Button } from '../Button/Button.js';
|
|
13
9
|
import styles from './SelectDropdown.module.scss.js';
|
|
14
10
|
import formStyles from '../../utils/forms/form.module.scss.js';
|
|
11
|
+
import { ListBox } from './components/OptionsContainers/ListBox.js';
|
|
12
|
+
import { GridList } from './components/OptionsContainers/GridList.js';
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple = false, compact = false, hasError = false, disabled, options, value, actions, isLoading = false, searchValue, emptyStateSlot, onSearchChange, onChange, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps }) => {
|
|
14
|
+
const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple = false, compact = false, hasError = false, disabled, options, value, actions, isLoading = false, searchValue, emptyStateSlot, onSearchChange, onChange, topAction, isSelectDropdownOpen = false, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...otherProps }) => {
|
|
18
15
|
const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);
|
|
19
16
|
const classNames = generateClassNames(className);
|
|
20
17
|
const [isSelectOpen, setIsSelectOpen] = useState(false);
|
|
21
18
|
const selectedValues = getSelectedValues(options, hasSection, value);
|
|
22
19
|
const selectionMode = multiple ? 'multiple' : 'single';
|
|
20
|
+
const hasRowAction = options.some((option) => 'onClickRowAction' in option && option.onClickRowAction);
|
|
23
21
|
const onSelectionChange = useCallback((keys) => {
|
|
24
22
|
const selectedKeys = Array.from(keys);
|
|
25
23
|
const newSelectedValues = getSelectedValues(options, hasSection, selectedKeys);
|
|
@@ -28,24 +26,34 @@ const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple =
|
|
|
28
26
|
}
|
|
29
27
|
else {
|
|
30
28
|
onChange(newSelectedValues[0]);
|
|
31
|
-
|
|
29
|
+
if (!isSelectDropdownOpen) {
|
|
30
|
+
setIsSelectOpen(false);
|
|
31
|
+
}
|
|
32
32
|
}
|
|
33
|
-
}, [options, hasSection, multiple, onChange]);
|
|
34
|
-
return (React__default.createElement(Dropdown, { id: `select-dropdown-${id}`, className: buildClassnames([classNames === null || classNames === undefined ? undefined : classNames.popover, styles.dropdown, className]), shouldShow: isSelectOpen, setShouldShow: setIsSelectOpen, useAnchorWidth: true, disabled: disabled, renderCta: (buttonProps, anchorRef) =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
}, [options, hasSection, multiple, onChange, isSelectDropdownOpen]);
|
|
34
|
+
return (React__default.createElement(Dropdown, { id: `select-dropdown-${id}`, className: buildClassnames([classNames === null || classNames === undefined ? undefined : classNames.popover, styles.dropdown, className]), shouldShow: isSelectOpen, setShouldShow: setIsSelectOpen, useAnchorWidth: true, disabled: disabled, renderCta: (buttonProps, anchorRef) => {
|
|
35
|
+
if (anchorRef && isSelectDropdownOpen) {
|
|
36
|
+
setIsSelectOpen(isSelectDropdownOpen);
|
|
37
|
+
}
|
|
38
|
+
return (React__default.createElement("button", { ...buttonProps, type: "button", ref: anchorRef, className: buildClassnames([
|
|
39
|
+
className,
|
|
40
|
+
styles.dropdownTrigger,
|
|
41
|
+
formStyles.fullStyles,
|
|
42
|
+
formStyles.base,
|
|
43
|
+
hasError && formStyles.error,
|
|
44
|
+
compact && formStyles.compact,
|
|
45
|
+
]) },
|
|
46
|
+
React__default.createElement(SelectedOption, { placeholder: placeholder, options: selectedValues, selectionMode: selectionMode })));
|
|
47
|
+
} },
|
|
43
48
|
onSearchChange && (React__default.createElement(React__default.Fragment, null,
|
|
44
49
|
React__default.createElement(Search, { className: styles.search, value: searchValue, onChange: onSearchChange }),
|
|
45
50
|
React__default.createElement("hr", { className: styles.separator }))),
|
|
46
|
-
|
|
51
|
+
topAction && (React__default.createElement(Fragment, { key: topAction.label },
|
|
52
|
+
React__default.createElement(Button, { className: styles.ctaButton, key: topAction.label, variant: "flat", ...topAction }),
|
|
53
|
+
React__default.createElement("hr", { className: styles.separator, key: `separator-${topAction.label}` }))),
|
|
54
|
+
hasRowAction ? (React__default.createElement(GridList, { id: id, className: classNames === null || classNames === undefined ? undefined : classNames.optionsContainer, ariaLabelledBy: ariaLabelledBy, ariaDescribedBy: ariaDescribedBy, selectionMode: selectionMode, options: options, onSelectionChange: onSelectionChange, selectedValues: selectedValues, isLoading: isLoading, emptyStateSlot: emptyStateSlot, ...otherProps })) : (React__default.createElement(ListBox, { id: id, className: classNames === null || classNames === undefined ? undefined : classNames.optionsContainer, ariaLabelledBy: ariaLabelledBy, ariaDescribedBy: ariaDescribedBy, selectionMode: selectionMode, options: options, onSelectionChange: onSelectionChange, selectedValues: selectedValues, isLoading: isLoading, emptyStateSlot: emptyStateSlot, hasSection: hasSection, ...otherProps })), actions === null || actions === undefined ? undefined :
|
|
47
55
|
actions.map(({ label, ...actionProps }) => (React__default.createElement(Fragment, { key: label },
|
|
48
|
-
React__default.createElement("hr", { className: styles.separator, key: `
|
|
56
|
+
React__default.createElement("hr", { className: styles.separator, key: `separator-${label}` }),
|
|
49
57
|
React__default.createElement(Button, { className: styles.ctaButton, variant: "flat", key: label, ...actionProps }))))));
|
|
50
58
|
};
|
|
51
59
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectDropdown.js","sources":["../../../src/components/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"SelectDropdown.js","sources":["../../../src/components/SelectDropdown/SelectDropdown.tsx"],"sourcesContent":["import React, { Fragment, useCallback, useState } from 'react';\nimport { Selection } from 'react-aria-components';\n\nimport { buildClassnames } from '../../utils';\nimport { SelectedOption } from './components/SelectedOption';\nimport { generateClassNames, getSelectedValues } from './utils';\nimport { SelectDropdownItem, SelectDropdownProps } from './types';\nimport { GridItemProps } from './components/GridItem/types';\nimport { Dropdown } from '../Dropdown';\nimport { Search } from '../Search';\nimport { Button } from '../Button';\nimport styles from './SelectDropdown.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\nimport { ListBox } from './components/OptionsContainers/ListBox';\nimport { GridList } from './components/OptionsContainers/GridList';\n\nexport const SelectDropdown = ({\n id,\n className,\n placeholder = 'Select item',\n multiple = false,\n compact = false,\n hasError = false,\n disabled,\n options,\n value,\n actions,\n isLoading = false,\n searchValue,\n emptyStateSlot,\n onSearchChange,\n onChange,\n topAction,\n isSelectDropdownOpen = false,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...otherProps\n}: SelectDropdownProps) => {\n const hasSection = options.flatMap((option) => option).some((item) => 'items' in item);\n const classNames = generateClassNames(className);\n\n const [isSelectOpen, setIsSelectOpen] = useState(false);\n\n const selectedValues = getSelectedValues(options, hasSection, value);\n const selectionMode = multiple ? 'multiple' : 'single';\n const hasRowAction = options.some(\n (option) => 'onClickRowAction' in option && option.onClickRowAction,\n );\n\n const onSelectionChange = useCallback(\n (keys: Selection) => {\n const selectedKeys = Array.from(keys);\n const newSelectedValues = getSelectedValues(options, hasSection, selectedKeys);\n\n if (multiple) {\n (onChange as (items: SelectDropdownItem[]) => void)(newSelectedValues);\n } else {\n (onChange as (item: SelectDropdownItem) => void)(newSelectedValues[0]);\n if (!isSelectDropdownOpen) {\n setIsSelectOpen(false);\n }\n }\n },\n [options, hasSection, multiple, onChange, isSelectDropdownOpen],\n );\n\n return (\n <Dropdown\n id={`select-dropdown-${id}`}\n className={buildClassnames([classNames?.popover, styles.dropdown, className])}\n shouldShow={isSelectOpen}\n setShouldShow={setIsSelectOpen}\n useAnchorWidth\n disabled={disabled}\n renderCta={(buttonProps, anchorRef) => {\n if (anchorRef && isSelectDropdownOpen) {\n setIsSelectOpen(isSelectDropdownOpen);\n }\n\n return (\n <button\n {...buttonProps}\n type=\"button\"\n ref={anchorRef}\n className={buildClassnames([\n className,\n styles.dropdownTrigger,\n formStyles.fullStyles,\n formStyles.base,\n hasError && formStyles.error,\n compact && formStyles.compact,\n ])}\n >\n <SelectedOption\n placeholder={placeholder}\n options={selectedValues}\n selectionMode={selectionMode}\n />\n </button>\n );\n }}\n >\n {onSearchChange && (\n <>\n <Search className={styles.search} value={searchValue} onChange={onSearchChange} />\n <hr className={styles.separator} />\n </>\n )}\n {topAction && (\n <Fragment key={topAction.label}>\n <Button\n className={styles.ctaButton}\n key={topAction.label}\n variant=\"flat\"\n {...topAction}\n />\n <hr className={styles.separator} key={`separator-${topAction.label}`} />\n </Fragment>\n )}\n {hasRowAction ? (\n <GridList\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options as GridItemProps[]}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues as GridItemProps[]}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n {...otherProps}\n />\n ) : (\n <ListBox\n id={id}\n className={classNames?.optionsContainer}\n ariaLabelledBy={ariaLabelledBy}\n ariaDescribedBy={ariaDescribedBy}\n selectionMode={selectionMode}\n options={options}\n onSelectionChange={onSelectionChange}\n selectedValues={selectedValues}\n isLoading={isLoading}\n emptyStateSlot={emptyStateSlot}\n hasSection={hasSection}\n {...otherProps}\n />\n )}\n {actions?.map(({ label, ...actionProps }) => (\n <Fragment key={label}>\n <hr className={styles.separator} key={`separator-${label}`} />\n <Button className={styles.ctaButton} variant=\"flat\" key={label} {...actionProps} />\n </Fragment>\n ))}\n </Dropdown>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAgBO,MAAM,cAAc,GAAG,CAAC,EAC7B,EAAE,EACF,SAAS,EACT,WAAW,GAAG,aAAa,EAC3B,QAAQ,GAAG,KAAK,EAChB,OAAO,GAAG,KAAK,EACf,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,OAAO,EACP,SAAS,GAAG,KAAK,EACjB,WAAW,EACX,cAAc,EACd,cAAc,EACd,QAAQ,EACR,SAAS,EACT,oBAAoB,GAAG,KAAK,EAC5B,iBAAiB,EAAE,cAAc,EACjC,kBAAkB,EAAE,eAAe,EACnC,GAAG,UAAU,EACO,KAAI;IACxB,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC;AACtF,IAAA,MAAM,UAAU,GAAG,kBAAkB,CAAC,SAAS,CAAC;IAEhD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IAEvD,MAAM,cAAc,GAAG,iBAAiB,CAAC,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,CAAA,MAAM,IAAC,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,OAAO,EAAC,MAAM,EAAC,GAAG,EAAE,KAAK,EAAA,GAAM,WAAW,EAAA,CAAI,CAC1E,CACZ,CAAC,CACO;AAEf;;;;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
4
|
|
|
5
|
-
___$insertStyle(".
|
|
6
|
-
var styles = {"listBox":"
|
|
5
|
+
___$insertStyle("._listBox_1fva9_1 {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n}\n._listBox_1fva9_1[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n._dropdown_1fva9_13 {\n padding: var(--sizes-none) !important;\n}\n\n._dropdownTrigger_1fva9_17 {\n padding-right: var(--sizes-9);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right var(--sizes-3) top 50%;\n width: 100%;\n}\n\n._separator_1fva9_25 {\n height: var(--sizes-line);\n background: var(--colors-neutral-grey-base);\n border: none;\n margin: var(--sizes-none) var(--sizes-none);\n width: 100%;\n}\n\n._search_1fva9_33 {\n margin: var(--sizes-sm) !important;\n}\n\n._ctaButton_1fva9_37 {\n justify-content: start !important;\n padding: var(--sizes-sm) var(--sizes-xs) !important;\n margin: var(--sizes-sm) !important;\n border-radius: var(--radius-base) !important;\n border: 0 !important;\n}\n._ctaButton_1fva9_37 svg {\n width: var(--sizes-md) !important;\n height: var(--sizes-md) !important;\n}\n._ctaButton_1fva9_37 > span {\n gap: var(--sizes-base);\n padding: 0 var(--sizes-xs);\n}\n._ctaButton_1fva9_37:hover {\n background-color: var(--colors-neutral-grey-lightest) !important;\n font-weight: var(--text-body-bold-font-weight) !important;\n}");
|
|
6
|
+
var styles = {"listBox":"_listBox_1fva9_1","dropdown":"_dropdown_1fva9_13","dropdownTrigger":"_dropdownTrigger_1fva9_17","separator":"_separator_1fva9_25","search":"_search_1fva9_33","ctaButton":"_ctaButton_1fva9_37"};
|
|
7
7
|
|
|
8
8
|
module.exports = styles;
|
|
9
9
|
//# sourceMappingURL=SelectDropdown.module.scss.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectDropdown.module.scss.cjs","sources":["../../../src/components/SelectDropdown/SelectDropdown.module.scss"],"sourcesContent":[".listBox {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n\n &[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n\n// used important to override styled-component styles from Dropdown\n.dropdown {\n padding: var(--sizes-none) !important;\n}\n\n.dropdownTrigger {\n padding-right: var(--sizes-9);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right var(--sizes-3) top 50%;\n}\n\n.separator {\n height: var(--sizes-line);\n background: var(--colors-neutral-grey-base);\n border: none;\n margin: var(--sizes-none) var(--sizes-none);\n width: 100%;\n}\n\n// used important to override styled-component styles from Search\n.search {\n margin: var(--sizes-sm) !important;\n}\n\n// used important to override styled-component styles from Button\n.ctaButton {\n justify-content: start !important;\n padding
|
|
1
|
+
{"version":3,"file":"SelectDropdown.module.scss.cjs","sources":["../../../src/components/SelectDropdown/SelectDropdown.module.scss"],"sourcesContent":[".listBox {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n\n &[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n\n// used important to override styled-component styles from Dropdown\n.dropdown {\n padding: var(--sizes-none) !important;\n}\n\n.dropdownTrigger {\n padding-right: var(--sizes-9);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right var(--sizes-3) top 50%;\n width: 100%;\n}\n\n.separator {\n height: var(--sizes-line);\n background: var(--colors-neutral-grey-base);\n border: none;\n margin: var(--sizes-none) var(--sizes-none);\n width: 100%;\n}\n\n// used important to override styled-component styles from Search\n.search {\n margin: var(--sizes-sm) !important;\n}\n\n// used important to override styled-component styles from Button\n.ctaButton {\n justify-content: start !important;\n padding: var(--sizes-sm) var(--sizes-xs) !important;\n margin: var(--sizes-sm) !important;\n border-radius: var(--radius-base) !important;\n border: 0 !important;\n\n svg {\n width: var(--sizes-md) !important;\n height: var(--sizes-md) !important;\n }\n\n > span {\n gap: var(--sizes-base);\n padding: 0 var(--sizes-xs);\n }\n\n &:hover {\n background-color: var(--colors-neutral-grey-lightest) !important;\n font-weight: var(--text-body-bold-font-weight) !important;\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,qjDAAA;AACA,aAAA,CAAA,SAAA,CAAA,kBAAA,CAAA,UAAA,CAAA,oBAAA,CAAA,iBAAA,CAAA,2BAAA,CAAA,WAAA,CAAA,qBAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,WAAA,CAAA,qBAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
2
|
|
|
3
|
-
insertStyle(".
|
|
4
|
-
var styles = {"listBox":"
|
|
3
|
+
insertStyle("._listBox_1fva9_1 {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n}\n._listBox_1fva9_1[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n._dropdown_1fva9_13 {\n padding: var(--sizes-none) !important;\n}\n\n._dropdownTrigger_1fva9_17 {\n padding-right: var(--sizes-9);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right var(--sizes-3) top 50%;\n width: 100%;\n}\n\n._separator_1fva9_25 {\n height: var(--sizes-line);\n background: var(--colors-neutral-grey-base);\n border: none;\n margin: var(--sizes-none) var(--sizes-none);\n width: 100%;\n}\n\n._search_1fva9_33 {\n margin: var(--sizes-sm) !important;\n}\n\n._ctaButton_1fva9_37 {\n justify-content: start !important;\n padding: var(--sizes-sm) var(--sizes-xs) !important;\n margin: var(--sizes-sm) !important;\n border-radius: var(--radius-base) !important;\n border: 0 !important;\n}\n._ctaButton_1fva9_37 svg {\n width: var(--sizes-md) !important;\n height: var(--sizes-md) !important;\n}\n._ctaButton_1fva9_37 > span {\n gap: var(--sizes-base);\n padding: 0 var(--sizes-xs);\n}\n._ctaButton_1fva9_37:hover {\n background-color: var(--colors-neutral-grey-lightest) !important;\n font-weight: var(--text-body-bold-font-weight) !important;\n}");
|
|
4
|
+
var styles = {"listBox":"_listBox_1fva9_1","dropdown":"_dropdown_1fva9_13","dropdownTrigger":"_dropdownTrigger_1fva9_17","separator":"_separator_1fva9_25","search":"_search_1fva9_33","ctaButton":"_ctaButton_1fva9_37"};
|
|
5
5
|
|
|
6
6
|
export { styles as default };
|
|
7
7
|
//# sourceMappingURL=SelectDropdown.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectDropdown.module.scss.js","sources":["../../../src/components/SelectDropdown/SelectDropdown.module.scss"],"sourcesContent":[".listBox {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n\n &[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n\n// used important to override styled-component styles from Dropdown\n.dropdown {\n padding: var(--sizes-none) !important;\n}\n\n.dropdownTrigger {\n padding-right: var(--sizes-9);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right var(--sizes-3) top 50%;\n}\n\n.separator {\n height: var(--sizes-line);\n background: var(--colors-neutral-grey-base);\n border: none;\n margin: var(--sizes-none) var(--sizes-none);\n width: 100%;\n}\n\n// used important to override styled-component styles from Search\n.search {\n margin: var(--sizes-sm) !important;\n}\n\n// used important to override styled-component styles from Button\n.ctaButton {\n justify-content: start !important;\n padding
|
|
1
|
+
{"version":3,"file":"SelectDropdown.module.scss.js","sources":["../../../src/components/SelectDropdown/SelectDropdown.module.scss"],"sourcesContent":[".listBox {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n\n &[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n}\n\n// used important to override styled-component styles from Dropdown\n.dropdown {\n padding: var(--sizes-none) !important;\n}\n\n.dropdownTrigger {\n padding-right: var(--sizes-9);\n background-image: url(\"data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fillRule='evenodd' clipRule='evenodd' d='M4 6L8 10L12 6H4Z' fill='currentColor' /%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right var(--sizes-3) top 50%;\n width: 100%;\n}\n\n.separator {\n height: var(--sizes-line);\n background: var(--colors-neutral-grey-base);\n border: none;\n margin: var(--sizes-none) var(--sizes-none);\n width: 100%;\n}\n\n// used important to override styled-component styles from Search\n.search {\n margin: var(--sizes-sm) !important;\n}\n\n// used important to override styled-component styles from Button\n.ctaButton {\n justify-content: start !important;\n padding: var(--sizes-sm) var(--sizes-xs) !important;\n margin: var(--sizes-sm) !important;\n border-radius: var(--radius-base) !important;\n border: 0 !important;\n\n svg {\n width: var(--sizes-md) !important;\n height: var(--sizes-md) !important;\n }\n\n > span {\n gap: var(--sizes-base);\n padding: 0 var(--sizes-xs);\n }\n\n &:hover {\n background-color: var(--colors-neutral-grey-lightest) !important;\n font-weight: var(--text-body-bold-font-weight) !important;\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,qjDAAA;AACA,aAAA,CAAA,SAAA,CAAA,kBAAA,CAAA,UAAA,CAAA,oBAAA,CAAA,iBAAA,CAAA,2BAAA,CAAA,WAAA,CAAA,qBAAA,CAAA,QAAA,CAAA,kBAAA,CAAA,WAAA,CAAA,qBAAA;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactAriaComponents = require('react-aria-components');
|
|
5
|
+
var FlexRow = require('../../../Flex/FlexRow/FlexRow.cjs');
|
|
6
|
+
var Button = require('../../../Button/Button.cjs');
|
|
7
|
+
var ArrowRightIcon = require('../../../../icons/design-system/components/ArrowRightIcon.cjs');
|
|
8
|
+
var ItemContent = require('../ItemContent/ItemContent.cjs');
|
|
9
|
+
var buildClassnames = require('../../../../utils/buildClassnames.cjs');
|
|
10
|
+
require('uid/secure');
|
|
11
|
+
require('../../../../hooks/useFocusVisible.cjs');
|
|
12
|
+
var useId = require('../../../../hooks/useId.cjs');
|
|
13
|
+
require('lodash.throttle');
|
|
14
|
+
var item_module = require('../item.module.scss.cjs');
|
|
15
|
+
var GridItem_module = require('./GridItem.module.scss.cjs');
|
|
16
|
+
|
|
17
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
18
|
+
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
20
|
+
|
|
21
|
+
function GridItem({ id, label, href, appearance = 'primary', className, onClickRowAction, rowActionAriaLabel, isRowActionDisabled = false, ...props }) {
|
|
22
|
+
const idComputed = useId.useId({ id, prefix: 'grid-item' });
|
|
23
|
+
return (React__default.default.createElement(reactAriaComponents.GridListItem, { id: idComputed, textValue: label, href: href, className: buildClassnames.buildClassnames([
|
|
24
|
+
item_module.item,
|
|
25
|
+
item_module[`appearance-${appearance}`],
|
|
26
|
+
className,
|
|
27
|
+
]), ...props }, ({ selectionMode, allowsDragging, isSelected, isHovered }) => (React__default.default.createElement(FlexRow.FlexRow, { flexWrap: "nowrap", justifyContent: "space-between" },
|
|
28
|
+
React__default.default.createElement(ItemContent.ItemContent, { selectionMode: selectionMode, allowsDragging: allowsDragging, isSelected: isSelected, isHovered: isHovered, label: label, isLink: Boolean(href), appearance: appearance, itemType: "grid", ...props }),
|
|
29
|
+
onClickRowAction && (
|
|
30
|
+
/** onPointerDown event prevents click events from bubbling up to the GridListItem.
|
|
31
|
+
* onKeyDown event prevents keyboard events from bubbling up to the GridListItem.
|
|
32
|
+
*/
|
|
33
|
+
React__default.default.createElement(Button.Button, { onClick: onClickRowAction, disabled: isRowActionDisabled, onPointerDown: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), variant: "flat", iconSlot: React__default.default.createElement(ArrowRightIcon.ReactComponent, null), "aria-label": rowActionAriaLabel || `${label} row action`, className: GridItem_module.actionButton }))))));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.GridItem = GridItem;
|
|
37
|
+
//# sourceMappingURL=GridItem.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridItem.cjs","sources":["../../../../../src/components/SelectDropdown/components/GridItem/GridItem.tsx"],"sourcesContent":["import React from 'react';\nimport { GridListItem, GridListItemRenderProps } from 'react-aria-components';\nimport { FlexRow } from '../../../Flex/FlexRow';\nimport { Button } from '../../../Button';\nimport { ArrowRightIcon } from '../../../../icons';\nimport { ItemContent } from '../ItemContent';\nimport { GridItemProps } from './types';\nimport { buildClassnames } from '../../../../utils';\nimport { useId } from '../../../../hooks';\n\nimport itemStyles from '../item.module.scss';\nimport styles from './GridItem.module.scss';\n\nexport function GridItem({\n id,\n label,\n href,\n appearance = 'primary',\n className,\n onClickRowAction,\n rowActionAriaLabel,\n isRowActionDisabled = false,\n ...props\n}: GridItemProps) {\n const idComputed = useId({ id, prefix: 'grid-item' });\n\n return (\n <GridListItem\n id={idComputed}\n textValue={label}\n href={href}\n className={buildClassnames([\n itemStyles.item,\n itemStyles[`appearance-${appearance}`],\n className,\n ])}\n {...props}\n >\n {/* use react aria's render props to add more such as isHovered */}\n {({ selectionMode, allowsDragging, isSelected, isHovered }: GridListItemRenderProps) => (\n <FlexRow flexWrap=\"nowrap\" justifyContent=\"space-between\">\n <ItemContent\n selectionMode={selectionMode}\n allowsDragging={allowsDragging}\n isSelected={isSelected}\n isHovered={isHovered}\n label={label}\n isLink={Boolean(href)}\n appearance={appearance}\n itemType=\"grid\"\n {...props}\n />\n {onClickRowAction && (\n /** onPointerDown event prevents click events from bubbling up to the GridListItem.\n * onKeyDown event prevents keyboard events from bubbling up to the GridListItem.\n */\n <Button\n onClick={onClickRowAction}\n disabled={isRowActionDisabled}\n onPointerDown={(event) => event.stopPropagation()}\n onKeyDown={(event) => event.stopPropagation()}\n variant=\"flat\"\n iconSlot={<ArrowRightIcon />}\n aria-label={rowActionAriaLabel || `${label} row action`}\n className={styles.actionButton}\n />\n )}\n </FlexRow>\n )}\n </GridListItem>\n );\n}\n"],"names":["useId","React","GridListItem","buildClassnames","itemStyles","FlexRow","ItemContent","Button","ArrowRightIcon","styles"],"mappings":";;;;;;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,EAAE,EACjD,SAAS,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,eAAe,EAAE,EAC7C,OAAO,EAAC,MAAM,EACd,QAAQ,EAAEN,sBAAC,CAAA,aAAA,CAAAO,6BAAc,EAAG,IAAA,CAAA,EAAA,YAAA,EAChB,kBAAkB,IAAI,CAAG,EAAA,KAAK,CAAa,WAAA,CAAA,EACvD,SAAS,EAAEC,eAAM,CAAC,YAAY,EAAA,CAC9B,CACH,CACO,CACX,CACY;AAEnB;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { GridListItem } from 'react-aria-components';
|
|
3
|
+
import { FlexRow } from '../../../Flex/FlexRow/FlexRow.js';
|
|
4
|
+
import { Button } from '../../../Button/Button.js';
|
|
5
|
+
import { ReactComponent as ArrowRightIcon } from '../../../../icons/design-system/components/ArrowRightIcon.js';
|
|
6
|
+
import { ItemContent } from '../ItemContent/ItemContent.js';
|
|
7
|
+
import { buildClassnames } from '../../../../utils/buildClassnames.js';
|
|
8
|
+
import 'uid/secure';
|
|
9
|
+
import '../../../../hooks/useFocusVisible.js';
|
|
10
|
+
import { useId } from '../../../../hooks/useId.js';
|
|
11
|
+
import 'lodash.throttle';
|
|
12
|
+
import itemStyles from '../item.module.scss.js';
|
|
13
|
+
import styles from './GridItem.module.scss.js';
|
|
14
|
+
|
|
15
|
+
function GridItem({ id, label, href, appearance = 'primary', className, onClickRowAction, rowActionAriaLabel, isRowActionDisabled = false, ...props }) {
|
|
16
|
+
const idComputed = useId({ id, prefix: 'grid-item' });
|
|
17
|
+
return (React__default.createElement(GridListItem, { id: idComputed, textValue: label, href: href, className: buildClassnames([
|
|
18
|
+
itemStyles.item,
|
|
19
|
+
itemStyles[`appearance-${appearance}`],
|
|
20
|
+
className,
|
|
21
|
+
]), ...props }, ({ selectionMode, allowsDragging, isSelected, isHovered }) => (React__default.createElement(FlexRow, { flexWrap: "nowrap", justifyContent: "space-between" },
|
|
22
|
+
React__default.createElement(ItemContent, { selectionMode: selectionMode, allowsDragging: allowsDragging, isSelected: isSelected, isHovered: isHovered, label: label, isLink: Boolean(href), appearance: appearance, itemType: "grid", ...props }),
|
|
23
|
+
onClickRowAction && (
|
|
24
|
+
/** onPointerDown event prevents click events from bubbling up to the GridListItem.
|
|
25
|
+
* onKeyDown event prevents keyboard events from bubbling up to the GridListItem.
|
|
26
|
+
*/
|
|
27
|
+
React__default.createElement(Button, { onClick: onClickRowAction, disabled: isRowActionDisabled, onPointerDown: (event) => event.stopPropagation(), onKeyDown: (event) => event.stopPropagation(), variant: "flat", iconSlot: React__default.createElement(ArrowRightIcon, null), "aria-label": rowActionAriaLabel || `${label} row action`, className: styles.actionButton }))))));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { GridItem };
|
|
31
|
+
//# sourceMappingURL=GridItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridItem.js","sources":["../../../../../src/components/SelectDropdown/components/GridItem/GridItem.tsx"],"sourcesContent":["import React from 'react';\nimport { GridListItem, GridListItemRenderProps } from 'react-aria-components';\nimport { FlexRow } from '../../../Flex/FlexRow';\nimport { Button } from '../../../Button';\nimport { ArrowRightIcon } from '../../../../icons';\nimport { ItemContent } from '../ItemContent';\nimport { GridItemProps } from './types';\nimport { buildClassnames } from '../../../../utils';\nimport { useId } from '../../../../hooks';\n\nimport itemStyles from '../item.module.scss';\nimport styles from './GridItem.module.scss';\n\nexport function GridItem({\n id,\n label,\n href,\n appearance = 'primary',\n className,\n onClickRowAction,\n rowActionAriaLabel,\n isRowActionDisabled = false,\n ...props\n}: GridItemProps) {\n const idComputed = useId({ id, prefix: 'grid-item' });\n\n return (\n <GridListItem\n id={idComputed}\n textValue={label}\n href={href}\n className={buildClassnames([\n itemStyles.item,\n itemStyles[`appearance-${appearance}`],\n className,\n ])}\n {...props}\n >\n {/* use react aria's render props to add more such as isHovered */}\n {({ selectionMode, allowsDragging, isSelected, isHovered }: GridListItemRenderProps) => (\n <FlexRow flexWrap=\"nowrap\" justifyContent=\"space-between\">\n <ItemContent\n selectionMode={selectionMode}\n allowsDragging={allowsDragging}\n isSelected={isSelected}\n isHovered={isHovered}\n label={label}\n isLink={Boolean(href)}\n appearance={appearance}\n itemType=\"grid\"\n {...props}\n />\n {onClickRowAction && (\n /** onPointerDown event prevents click events from bubbling up to the GridListItem.\n * onKeyDown event prevents keyboard events from bubbling up to the GridListItem.\n */\n <Button\n onClick={onClickRowAction}\n disabled={isRowActionDisabled}\n onPointerDown={(event) => event.stopPropagation()}\n onKeyDown={(event) => event.stopPropagation()}\n variant=\"flat\"\n iconSlot={<ArrowRightIcon />}\n aria-label={rowActionAriaLabel || `${label} row action`}\n className={styles.actionButton}\n />\n )}\n </FlexRow>\n )}\n </GridListItem>\n );\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;AAaM,SAAU,QAAQ,CAAC,EACvB,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAU,GAAG,SAAS,EACtB,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,GAAG,KAAK,EAC3B,GAAG,KAAK,EACM,EAAA;AACd,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAErD,IAAA,QACEA,cAAC,CAAA,aAAA,CAAA,YAAY,IACX,EAAE,EAAE,UAAU,EACd,SAAS,EAAE,KAAK,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,eAAe,CAAC;AACzB,YAAA,UAAU,CAAC,IAAI;AACf,YAAA,UAAU,CAAC,CAAA,WAAA,EAAc,UAAU,CAAA,CAAE,CAAC;YACtC,SAAS;SACV,CAAC,EAAA,GACE,KAAK,EAAA,EAGR,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAA2B,MACjFA,cAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EAAC,QAAQ,EAAC,QAAQ,EAAC,cAAc,EAAC,eAAe,EAAA;AACvD,QAAAA,cAAA,CAAA,aAAA,CAAC,WAAW,EACV,EAAA,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EACrB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAC,MAAM,EAAA,GACX,KAAK,EACT,CAAA;AACD,QAAA,gBAAgB;AACf;;AAEG;AACH,QAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,mBAAmB,EAC7B,aAAa,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,eAAe,EAAE,EACjD,SAAS,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,eAAe,EAAE,EAC7C,OAAO,EAAC,MAAM,EACd,QAAQ,EAAEA,cAAC,CAAA,aAAA,CAAA,cAAc,EAAG,IAAA,CAAA,EAAA,YAAA,EAChB,kBAAkB,IAAI,CAAG,EAAA,KAAK,CAAa,WAAA,CAAA,EACvD,SAAS,EAAE,MAAM,CAAC,YAAY,EAAA,CAC9B,CACH,CACO,CACX,CACY;AAEnB;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ___$insertStyle = require('../../../../_virtual/____insertStyle.cjs');
|
|
4
|
+
|
|
5
|
+
___$insertStyle("._actionButton_bip91_1:hover {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n}");
|
|
6
|
+
var styles = {"actionButton":"_actionButton_bip91_1"};
|
|
7
|
+
|
|
8
|
+
module.exports = styles;
|
|
9
|
+
//# sourceMappingURL=GridItem.module.scss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridItem.module.scss.cjs","sources":["../../../../../src/components/SelectDropdown/components/GridItem/GridItem.module.scss"],"sourcesContent":[".actionButton {\n &:hover {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n }\n}\n"],"names":[],"mappings":";;;;AAEI,eAAA,CAAA,yGAAA;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import insertStyle from '../../../../_virtual/____insertStyle.js';
|
|
2
|
+
|
|
3
|
+
insertStyle("._actionButton_bip91_1:hover {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n}");
|
|
4
|
+
var styles = {"actionButton":"_actionButton_bip91_1"};
|
|
5
|
+
|
|
6
|
+
export { styles as default };
|
|
7
|
+
//# sourceMappingURL=GridItem.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridItem.module.scss.js","sources":["../../../../../src/components/SelectDropdown/components/GridItem/GridItem.module.scss"],"sourcesContent":[".actionButton {\n &:hover {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AAEIA,WAAA,CAAA,yGAAA;;;;;"}
|
|
@@ -17,7 +17,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
17
17
|
|
|
18
18
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
19
19
|
|
|
20
|
-
const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging = false, selectionMode = 'single', isLink, isSelected = false, itemType, }) => {
|
|
20
|
+
const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging = false, selectionMode = 'single', isLink, isSelected = false, isHovered = false, itemType, }) => {
|
|
21
21
|
const infoContainerClassNames = React.useMemo(() => {
|
|
22
22
|
const base = ItemContent_module.infoContainer;
|
|
23
23
|
if (itemInfoSlot && endInfoSlot) {
|
|
@@ -38,12 +38,12 @@ const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot,
|
|
|
38
38
|
mediaSlot,
|
|
39
39
|
React__default.default.createElement(FlexCol.FlexCol, { gap: "xs", style: { flexGrow: 1 } },
|
|
40
40
|
React__default.default.createElement("div", { className: infoContainerClassNames, "data-testid": "info-container" },
|
|
41
|
-
itemType === 'grid' ? (React__default.default.createElement(Text.Text, { variant:
|
|
42
|
-
React__default.default.createElement(Text.Text, { variant:
|
|
41
|
+
itemType === 'grid' ? (React__default.default.createElement(Text.Text, { variant: isHovered ? 'bodyBold' : 'body' }, label)) : (React__default.default.createElement(reactAriaComponents.Text, { slot: "label" },
|
|
42
|
+
React__default.default.createElement(Text.Text, { variant: isHovered ? 'bodyBold' : 'body' }, label))),
|
|
43
43
|
itemInfoSlot,
|
|
44
44
|
endInfoSlot && (React__default.default.createElement("div", { className: endInfoSlot ? ItemContent_module.justifyEnd : ItemContent_module.justifyStart }, endInfoSlot))),
|
|
45
45
|
hint && (React__default.default.createElement(reactAriaComponents.Text, { slot: "description" },
|
|
46
|
-
React__default.default.createElement(Text.Text, { variant: "
|
|
46
|
+
React__default.default.createElement(Text.Text, { variant: "body" }, hint))),
|
|
47
47
|
alert && React__default.default.createElement(MiniAlert.MiniAlert, { title: alert.title, variant: alert.variant }))),
|
|
48
48
|
isLink && React__default.default.createElement(ArrowRightIcon.ReactComponent, { className: ItemContent_module.linkIcon, "data-testid": "link-icon" })));
|
|
49
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemContent.cjs","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/ItemContent.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Text } from 'react-aria-components';\nimport { buildClassnames } from '../../../../utils';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowRightIcon, DragIndicatorIcon } from '../../../../icons';\nimport { ItemContentProps } from './types';\nimport { Text as VeeqoText } from '../../../Text';\nimport { MiniAlert } from '../../../Alerts/MiniAlert';\nimport { SelectionType } from './SelectionType';\nimport styles from './ItemContent.module.scss';\nimport { FlexRow } from '../../../Flex/FlexRow';\n\nexport const ItemContent = ({\n label,\n hint,\n itemInfoSlot,\n endInfoSlot,\n alert,\n mediaSlot,\n allowsDragging = false,\n selectionMode = 'single',\n isLink,\n isSelected = false,\n itemType,\n}: ItemContentProps) => {\n const infoContainerClassNames = useMemo(() => {\n const base = styles.infoContainer;\n\n if (itemInfoSlot && endInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoAndEndInfo]);\n }\n\n if (itemInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoOnly]);\n }\n\n if (endInfoSlot) {\n return buildClassnames([base, styles.hasEndInfoOnly]);\n }\n\n return buildClassnames([base]);\n }, [endInfoSlot, itemInfoSlot]);\n\n return (\n <FlexRow\n flexWrap=\"nowrap\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n gap=\"base\"\n style={{ flexGrow: 1 }}\n >\n <FlexRow flexWrap=\"nowrap\" gap=\"base\" style={{ flexGrow: 1 }}>\n {allowsDragging && <DragIndicatorIcon data-testid=\"drag-icon\" />}\n <SelectionType selectionMode={selectionMode} isSelected={isSelected} isLink={isLink} />\n {mediaSlot}\n <FlexCol gap=\"xs\" style={{ flexGrow: 1 }}>\n <div className={infoContainerClassNames} data-testid=\"info-container\">\n {itemType === 'grid' ? (\n <VeeqoText variant
|
|
1
|
+
{"version":3,"file":"ItemContent.cjs","sources":["../../../../../src/components/SelectDropdown/components/ItemContent/ItemContent.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { Text } from 'react-aria-components';\nimport { buildClassnames } from '../../../../utils';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowRightIcon, DragIndicatorIcon } from '../../../../icons';\nimport { ItemContentProps } from './types';\nimport { Text as VeeqoText } from '../../../Text';\nimport { MiniAlert } from '../../../Alerts/MiniAlert';\nimport { SelectionType } from './SelectionType';\nimport styles from './ItemContent.module.scss';\nimport { FlexRow } from '../../../Flex/FlexRow';\n\nexport const ItemContent = ({\n label,\n hint,\n itemInfoSlot,\n endInfoSlot,\n alert,\n mediaSlot,\n allowsDragging = false,\n selectionMode = 'single',\n isLink,\n isSelected = false,\n isHovered = false,\n itemType,\n}: ItemContentProps) => {\n const infoContainerClassNames = useMemo(() => {\n const base = styles.infoContainer;\n\n if (itemInfoSlot && endInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoAndEndInfo]);\n }\n\n if (itemInfoSlot) {\n return buildClassnames([base, styles.hasItemInfoOnly]);\n }\n\n if (endInfoSlot) {\n return buildClassnames([base, styles.hasEndInfoOnly]);\n }\n\n return buildClassnames([base]);\n }, [endInfoSlot, itemInfoSlot]);\n\n return (\n <FlexRow\n flexWrap=\"nowrap\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n gap=\"base\"\n style={{ flexGrow: 1 }}\n >\n <FlexRow flexWrap=\"nowrap\" gap=\"base\" style={{ flexGrow: 1 }}>\n {allowsDragging && <DragIndicatorIcon data-testid=\"drag-icon\" />}\n <SelectionType selectionMode={selectionMode} isSelected={isSelected} isLink={isLink} />\n {mediaSlot}\n <FlexCol gap=\"xs\" style={{ flexGrow: 1 }}>\n <div className={infoContainerClassNames} data-testid=\"info-container\">\n {itemType === 'grid' ? (\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n ) : (\n <Text slot=\"label\">\n <VeeqoText variant={isHovered ? 'bodyBold' : 'body'}>{label}</VeeqoText>\n </Text>\n )}\n {itemInfoSlot}\n {endInfoSlot && (\n <div className={endInfoSlot ? styles.justifyEnd : styles.justifyStart}>\n {endInfoSlot}\n </div>\n )}\n </div>\n\n {hint && (\n <Text slot=\"description\">\n <VeeqoText variant=\"body\">{hint}</VeeqoText>\n </Text>\n )}\n {alert && <MiniAlert title={alert.title} variant={alert.variant} />}\n </FlexCol>\n </FlexRow>\n {isLink && <ArrowRightIcon className={styles.linkIcon} data-testid=\"link-icon\" />}\n </FlexRow>\n );\n};\n"],"names":["useMemo","styles","buildClassnames","React","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AACA,gBAAA,KAAK,IAAIL,sBAAC,CAAA,aAAA,CAAAO,mBAAS,EAAC,EAAA,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAA,CAAI,CAC3D,CACF;AACT,QAAA,MAAM,IAAIP,sBAAA,CAAA,aAAA,CAACQ,6BAAc,EAAA,EAAC,SAAS,EAAEV,kBAAM,CAAC,QAAQ,EAAc,aAAA,EAAA,WAAW,EAAG,CAAA,CACzE;AAEd;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ItemContentProps } from './types';
|
|
3
|
-
export declare const ItemContent: ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging, selectionMode, isLink, isSelected, itemType, }: ItemContentProps) => React.JSX.Element;
|
|
3
|
+
export declare const ItemContent: ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging, selectionMode, isLink, isSelected, isHovered, itemType, }: ItemContentProps) => React.JSX.Element;
|
|
@@ -11,7 +11,7 @@ import { SelectionType } from './SelectionType.js';
|
|
|
11
11
|
import styles from './ItemContent.module.scss.js';
|
|
12
12
|
import { FlexRow } from '../../../Flex/FlexRow/FlexRow.js';
|
|
13
13
|
|
|
14
|
-
const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging = false, selectionMode = 'single', isLink, isSelected = false, itemType, }) => {
|
|
14
|
+
const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot, allowsDragging = false, selectionMode = 'single', isLink, isSelected = false, isHovered = false, itemType, }) => {
|
|
15
15
|
const infoContainerClassNames = useMemo(() => {
|
|
16
16
|
const base = styles.infoContainer;
|
|
17
17
|
if (itemInfoSlot && endInfoSlot) {
|
|
@@ -32,12 +32,12 @@ const ItemContent = ({ label, hint, itemInfoSlot, endInfoSlot, alert, mediaSlot,
|
|
|
32
32
|
mediaSlot,
|
|
33
33
|
React__default.createElement(FlexCol, { gap: "xs", style: { flexGrow: 1 } },
|
|
34
34
|
React__default.createElement("div", { className: infoContainerClassNames, "data-testid": "info-container" },
|
|
35
|
-
itemType === 'grid' ? (React__default.createElement(Text, { variant:
|
|
36
|
-
React__default.createElement(Text, { variant:
|
|
35
|
+
itemType === 'grid' ? (React__default.createElement(Text, { variant: isHovered ? 'bodyBold' : 'body' }, label)) : (React__default.createElement(Text$1, { slot: "label" },
|
|
36
|
+
React__default.createElement(Text, { variant: isHovered ? 'bodyBold' : 'body' }, label))),
|
|
37
37
|
itemInfoSlot,
|
|
38
38
|
endInfoSlot && (React__default.createElement("div", { className: endInfoSlot ? styles.justifyEnd : styles.justifyStart }, endInfoSlot))),
|
|
39
39
|
hint && (React__default.createElement(Text$1, { slot: "description" },
|
|
40
|
-
React__default.createElement(Text, { variant: "
|
|
40
|
+
React__default.createElement(Text, { variant: "body" }, hint))),
|
|
41
41
|
alert && React__default.createElement(MiniAlert, { title: alert.title, variant: alert.variant }))),
|
|
42
42
|
isLink && React__default.createElement(ArrowRightIcon, { className: styles.linkIcon, "data-testid": "link-icon" })));
|
|
43
43
|
};
|