@veeqo/ui 12.3.4 → 12.4.0-beta-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/components/SelectDropdown/SelectDropdown.cjs +8 -7
- package/dist/components/SelectDropdown/SelectDropdown.cjs.map +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.d.ts +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.js +8 -7
- 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/ListItem/ListItem.js +2 -2
- package/dist/components/SelectDropdown/components/ListItem/ListItem.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/item.module.scss.cjs +2 -2
- package/dist/components/SelectDropdown/components/item.module.scss.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/item.module.scss.js +2 -2
- package/dist/components/SelectDropdown/components/item.module.scss.js.map +1 -1
- package/dist/components/SelectDropdown/types.d.ts +3 -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, '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);
|
|
@@ -49,7 +47,10 @@ const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple =
|
|
|
49
47
|
onSearchChange && (React__default.default.createElement(React__default.default.Fragment, null,
|
|
50
48
|
React__default.default.createElement(Search.Search, { className: SelectDropdown_module.search, value: searchValue, onChange: onSearchChange }),
|
|
51
49
|
React__default.default.createElement("hr", { className: SelectDropdown_module.separator }))),
|
|
52
|
-
|
|
50
|
+
topAction && (React__default.default.createElement(React.Fragment, { key: topAction.label },
|
|
51
|
+
React__default.default.createElement(Button.Button, { className: SelectDropdown_module.ctaButton, key: topAction.label, variant: "flat", ...topAction }),
|
|
52
|
+
React__default.default.createElement("hr", { className: SelectDropdown_module.separator, key: `seperator-${topAction.label}` }))),
|
|
53
|
+
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
54
|
actions.map(({ label, ...actionProps }) => (React__default.default.createElement(React.Fragment, { key: label },
|
|
54
55
|
React__default.default.createElement("hr", { className: SelectDropdown_module.separator, key: `seperator-${label}` }),
|
|
55
56
|
React__default.default.createElement(Button.Button, { className: SelectDropdown_module.ctaButton, variant: "flat", key: label, ...actionProps }))))));
|
|
@@ -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 '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 setIsSelectOpen(false);\n }\n },\n [options, hasSection, multiple, onChange],\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 <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 {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={`seperator-${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={`seperator-${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,iBAAiB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EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,MACtCV,sBAAA,CAAA,aAAA,CAACO,cAAQ,EAAC,EAAA,GAAG,EAAE,KAAK,EAAA;YAClBP,sBAAI,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAEG,qBAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAA,UAAA,EAAa,KAAK,CAAA,CAAE,EAAI,CAAA;YAC9DH,sBAAC,CAAA,aAAA,CAAAQ,aAAM,IAAC,SAAS,EAAEL,qBAAM,CAAC,SAAS,EAAE,OAAO,EAAC,MAAM,EAAC,GAAG,EAAE,KAAK,EAAA,GAAM,WAAW,EAAA,CAAI,CAC1E,CACZ,CAAC,CACO;AAEf;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SelectDropdownProps } from './types';
|
|
3
|
-
export 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, "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, '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);
|
|
@@ -43,7 +41,10 @@ const SelectDropdown = ({ id, className, placeholder = 'Select item', multiple =
|
|
|
43
41
|
onSearchChange && (React__default.createElement(React__default.Fragment, null,
|
|
44
42
|
React__default.createElement(Search, { className: styles.search, value: searchValue, onChange: onSearchChange }),
|
|
45
43
|
React__default.createElement("hr", { className: styles.separator }))),
|
|
46
|
-
|
|
44
|
+
topAction && (React__default.createElement(Fragment, { key: topAction.label },
|
|
45
|
+
React__default.createElement(Button, { className: styles.ctaButton, key: topAction.label, variant: "flat", ...topAction }),
|
|
46
|
+
React__default.createElement("hr", { className: styles.separator, key: `seperator-${topAction.label}` }))),
|
|
47
|
+
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
48
|
actions.map(({ label, ...actionProps }) => (React__default.createElement(Fragment, { key: label },
|
|
48
49
|
React__default.createElement("hr", { className: styles.separator, key: `seperator-${label}` }),
|
|
49
50
|
React__default.createElement(Button, { className: styles.ctaButton, variant: "flat", key: label, ...actionProps }))))));
|
|
@@ -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 '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 setIsSelectOpen(false);\n }\n },\n [options, hasSection, multiple, onChange],\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 <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 {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={`seperator-${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={`seperator-${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,EAC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E,MACtCA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAC,EAAA,GAAG,EAAE,KAAK,EAAA;YAClBA,cAAI,CAAA,aAAA,CAAA,IAAA,EAAA,EAAA,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,EAAE,CAAA,UAAA,EAAa,KAAK,CAAA,CAAE,EAAI,CAAA;YAC9DA,cAAC,CAAA,aAAA,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_11tan_1 {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n}\n._listBox_11tan_1[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n._dropdown_11tan_13 {\n padding: var(--sizes-none) !important;\n}\n\n._dropdownTrigger_11tan_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}\n\n._separator_11tan_24 {\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_11tan_32 {\n margin: var(--sizes-sm) !important;\n}\n\n._ctaButton_11tan_36 {\n justify-content: start !important;\n padding-left: var(--sizes-sm) !important;\n margin: var(--sizes-sm) var(--sizes-xs) !important;\n border-radius: var(--radius-base) !important;\n font-size: var(--text-body-font-size) !important;\n}\n._ctaButton_11tan_36 svg {\n width: var(--sizes-md) !important;\n height: var(--sizes-md) !important;\n}");
|
|
6
|
+
var styles = {"listBox":"_listBox_11tan_1","dropdown":"_dropdown_11tan_13","dropdownTrigger":"_dropdownTrigger_11tan_17","separator":"_separator_11tan_24","search":"_search_11tan_32","ctaButton":"_ctaButton_11tan_36"};
|
|
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-left: var(--sizes-
|
|
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-left: var(--sizes-sm) !important;\n margin: var(--sizes-sm) var(--sizes-xs) !important;\n border-radius: var(--radius-base) !important;\n font-size: var(--text-body-font-size) !important;\n svg {\n width: var(--sizes-md) !important;\n height: var(--sizes-md) !important;\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,s0CAAA;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_11tan_1 {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n}\n._listBox_11tan_1[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n._dropdown_11tan_13 {\n padding: var(--sizes-none) !important;\n}\n\n._dropdownTrigger_11tan_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}\n\n._separator_11tan_24 {\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_11tan_32 {\n margin: var(--sizes-sm) !important;\n}\n\n._ctaButton_11tan_36 {\n justify-content: start !important;\n padding-left: var(--sizes-sm) !important;\n margin: var(--sizes-sm) var(--sizes-xs) !important;\n border-radius: var(--radius-base) !important;\n font-size: var(--text-body-font-size) !important;\n}\n._ctaButton_11tan_36 svg {\n width: var(--sizes-md) !important;\n height: var(--sizes-md) !important;\n}");
|
|
4
|
+
var styles = {"listBox":"_listBox_11tan_1","dropdown":"_dropdown_11tan_13","dropdownTrigger":"_dropdownTrigger_11tan_17","separator":"_separator_11tan_24","search":"_search_11tan_32","ctaButton":"_ctaButton_11tan_36"};
|
|
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-left: var(--sizes-
|
|
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-left: var(--sizes-sm) !important;\n margin: var(--sizes-sm) var(--sizes-xs) !important;\n border-radius: var(--radius-base) !important;\n font-size: var(--text-body-font-size) !important;\n svg {\n width: var(--sizes-md) !important;\n height: var(--sizes-md) !important;\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,s0CAAA;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
|
+
|
|
16
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
17
|
+
|
|
18
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
19
|
+
|
|
20
|
+
// import styles from './GridItem.module.scss';
|
|
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 }) => (React__default.default.createElement(FlexRow.FlexRow, { flexWrap: "nowrap", justifyContent: "space-between" },
|
|
28
|
+
React__default.default.createElement(ItemContent.ItemContent, { selectionMode: selectionMode, allowsDragging: allowsDragging, isSelected: isSelected, 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` }))))));
|
|
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';\n// import 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 }: GridListItemRenderProps) => (\n <FlexRow flexWrap=\"nowrap\" justifyContent=\"space-between\">\n <ItemContent\n selectionMode={selectionMode}\n allowsDragging={allowsDragging}\n isSelected={isSelected}\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"],"mappings":";;;;;;;;;;;;;;;;;;;AAWA;AAEM,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,GAAGA,WAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAErD,IAAA,QACEC,sBAAC,CAAA,aAAA,CAAAC,gCAAY,IACX,EAAE,EAAE,UAAU,EACd,SAAS,EAAE,KAAK,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAEC,+BAAe,CAAC;AACzB,YAAAC,WAAU,CAAC,IAAI;AACf,YAAAA,WAAU,CAAC,CAAA,WAAA,EAAc,UAAU,CAAA,CAAE,CAAC;YACtC,SAAS;SACV,CAAC,EAAA,GACE,KAAK,EAAA,EAGR,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAA2B,MACtEH,sBAAC,CAAA,aAAA,CAAAI,eAAO,EAAC,EAAA,QAAQ,EAAC,QAAQ,EAAC,cAAc,EAAC,eAAe,EAAA;AACvD,QAAAJ,sBAAA,CAAA,aAAA,CAACK,uBAAW,EAAA,EACV,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,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;QACHL,sBAAC,CAAA,aAAA,CAAAM,aAAM,EACL,EAAA,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,EAAEN,sBAAC,CAAA,aAAA,CAAAO,6BAAc,OAAG,EAChB,YAAA,EAAA,kBAAkB,IAAI,CAAA,EAAG,KAAK,CAAA,WAAA,CAAa,EAEvD,CAAA,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
|
+
|
|
14
|
+
// import styles from './GridItem.module.scss';
|
|
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 }) => (React__default.createElement(FlexRow, { flexWrap: "nowrap", justifyContent: "space-between" },
|
|
22
|
+
React__default.createElement(ItemContent, { selectionMode: selectionMode, allowsDragging: allowsDragging, isSelected: isSelected, 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` }))))));
|
|
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';\n// import 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 }: GridListItemRenderProps) => (\n <FlexRow flexWrap=\"nowrap\" justifyContent=\"space-between\">\n <ItemContent\n selectionMode={selectionMode}\n allowsDragging={allowsDragging}\n isSelected={isSelected}\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}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AK,KAAK,KAAK,CAAC,eAAe,EAAE,EAC7C,OAAO,EAAC,MAAM,EACd,QAAQ,EAAEA,cAAC,CAAA,aAAA,CAAA,cAAc,OAAG,EAChB,YAAA,EAAA,kBAAkB,IAAI,CAAA,EAAG,KAAK,CAAA,WAAA,CAAa,EAEvD,CAAA,CACH,CACO,CACX,CACY;AAEnB;;;;"}
|
|
@@ -6,11 +6,11 @@ import 'lodash.throttle';
|
|
|
6
6
|
import { ItemContent } from '../ItemContent/ItemContent.js';
|
|
7
7
|
import { buildClassnames } from '../../../../utils/buildClassnames.js';
|
|
8
8
|
import 'uid/secure';
|
|
9
|
-
import
|
|
9
|
+
import itemStyles from '../item.module.scss.js';
|
|
10
10
|
|
|
11
11
|
const ListItem = ({ id, label, href, appearance = 'primary', className, ...props }) => {
|
|
12
12
|
const idComputed = useId({ id, prefix: 'list-item' });
|
|
13
|
-
return (React__default.createElement(ListBoxItem, { id: idComputed, textValue: label, href: href, className: buildClassnames([
|
|
13
|
+
return (React__default.createElement(ListBoxItem, { id: idComputed, textValue: label, href: href, className: buildClassnames([itemStyles.item, itemStyles[`appearance-${appearance}`], className]), ...props }, ({ selectionMode, allowsDragging, isSelected }) => (React__default.createElement(ItemContent, { selectionMode: selectionMode, allowsDragging: allowsDragging, isSelected: isSelected, label: label, isLink: Boolean(href), appearance: appearance, itemType: "list", ...props }))));
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export { ListItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.js","sources":["../../../../../src/components/SelectDropdown/components/ListItem/ListItem.tsx"],"sourcesContent":["import React from 'react';\nimport { ListBoxItem, ListBoxItemRenderProps } from 'react-aria-components';\nimport { useId } from '../../../../hooks';\nimport { ListItemProps } from './types';\nimport { ItemContent } from '../ItemContent';\nimport { buildClassnames } from '../../../../utils';\n\nimport styles from '../item.module.scss';\n\nexport const ListItem = ({\n id,\n label,\n href,\n appearance = 'primary',\n className,\n ...props\n}: ListItemProps) => {\n const idComputed = useId({ id, prefix: 'list-item' });\n\n return (\n <ListBoxItem\n id={idComputed}\n textValue={label}\n href={href}\n className={buildClassnames([styles.item, styles[`appearance-${appearance}`], className])}\n {...props}\n >\n {/* use react aria's render props to add more such as isHovered */}\n {({ selectionMode, allowsDragging, isSelected }: ListBoxItemRenderProps) => (\n <ItemContent\n selectionMode={selectionMode}\n allowsDragging={allowsDragging}\n isSelected={isSelected}\n label={label}\n isLink={Boolean(href)}\n appearance={appearance}\n itemType=\"list\"\n {...props}\n />\n )}\n </ListBoxItem>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;MASa,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAU,GAAG,SAAS,EACtB,SAAS,EACT,GAAG,KAAK,EACM,KAAI;AAClB,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAErD,IAAA,QACEA,cAAC,CAAA,aAAA,CAAA,WAAW,IACV,EAAE,EAAE,UAAU,EACd,SAAS,EAAE,KAAK,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"ListItem.js","sources":["../../../../../src/components/SelectDropdown/components/ListItem/ListItem.tsx"],"sourcesContent":["import React from 'react';\nimport { ListBoxItem, ListBoxItemRenderProps } from 'react-aria-components';\nimport { useId } from '../../../../hooks';\nimport { ListItemProps } from './types';\nimport { ItemContent } from '../ItemContent';\nimport { buildClassnames } from '../../../../utils';\n\nimport styles from '../item.module.scss';\n\nexport const ListItem = ({\n id,\n label,\n href,\n appearance = 'primary',\n className,\n ...props\n}: ListItemProps) => {\n const idComputed = useId({ id, prefix: 'list-item' });\n\n return (\n <ListBoxItem\n id={idComputed}\n textValue={label}\n href={href}\n className={buildClassnames([styles.item, styles[`appearance-${appearance}`], className])}\n {...props}\n >\n {/* use react aria's render props to add more such as isHovered */}\n {({ selectionMode, allowsDragging, isSelected }: ListBoxItemRenderProps) => (\n <ItemContent\n selectionMode={selectionMode}\n allowsDragging={allowsDragging}\n isSelected={isSelected}\n label={label}\n isLink={Boolean(href)}\n appearance={appearance}\n itemType=\"list\"\n {...props}\n />\n )}\n </ListBoxItem>\n );\n};\n"],"names":["React","styles"],"mappings":";;;;;;;;;;MASa,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,KAAK,EACL,IAAI,EACJ,UAAU,GAAG,SAAS,EACtB,SAAS,EACT,GAAG,KAAK,EACM,KAAI;AAClB,IAAA,MAAM,UAAU,GAAG,KAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AAErD,IAAA,QACEA,cAAC,CAAA,aAAA,CAAA,WAAW,IACV,EAAE,EAAE,UAAU,EACd,SAAS,EAAE,KAAK,EAChB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,eAAe,CAAC,CAACC,UAAM,CAAC,IAAI,EAAEA,UAAM,CAAC,CAAc,WAAA,EAAA,UAAU,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC,KACpF,KAAK,EAAA,EAGR,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAA0B,MACrED,cAAC,CAAA,aAAA,CAAA,WAAW,IACV,aAAa,EAAE,aAAa,EAC5B,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EACrB,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAC,MAAM,EACX,GAAA,KAAK,GACT,CACH,CACW;AAElB;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactAriaComponents = require('react-aria-components');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var GridItem = require('../GridItem/GridItem.cjs');
|
|
6
|
+
var buildClassnames = require('../../../../utils/buildClassnames.cjs');
|
|
7
|
+
require('uid/secure');
|
|
8
|
+
var OptionsContainer_module = require('./OptionsContainer.module.scss.cjs');
|
|
9
|
+
var SelectDropdownState = require('../SelectDropdownState.cjs');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
14
|
+
|
|
15
|
+
const GridList = ({ id, className, options, onSelectionChange, selectedValues, selectionMode, emptyStateSlot, isLoading = false, ariaDescribedBy, ariaLabelledBy, ...otherProps }) => (React__default.default.createElement(reactAriaComponents.GridList, { className: buildClassnames.buildClassnames([className, OptionsContainer_module.container]), selectionMode: selectionMode, items: options, onSelectionChange: onSelectionChange, selectedKeys: selectedValues.map((selectedValue) => selectedValue.id), renderEmptyState: () => (React__default.default.createElement(SelectDropdownState.SelectDropdownState, { isLoading: isLoading, emptyStateSlot: emptyStateSlot })), "aria-labelledby": ariaLabelledBy !== null && ariaLabelledBy !== undefined ? ariaLabelledBy : `${id}-label`, "aria-describedby": ariaDescribedBy !== null && ariaDescribedBy !== undefined ? ariaDescribedBy : `${id}-hint`, ...otherProps }, (item) => React__default.default.createElement(GridItem.GridItem, { ...item })));
|
|
16
|
+
|
|
17
|
+
exports.GridList = GridList;
|
|
18
|
+
//# sourceMappingURL=GridList.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridList.cjs","sources":["../../../../../src/components/SelectDropdown/components/OptionsContainers/GridList.tsx"],"sourcesContent":["import { GridList as AriaGridList, Key } from 'react-aria-components';\nimport React from 'react';\nimport { GridItem } from '../GridItem';\nimport { GridListProps } from './types';\nimport { buildClassnames } from '../../../../utils';\n\nimport styles from './OptionsContainer.module.scss';\nimport { SelectDropdownState } from '../SelectDropdownState';\n\nexport const GridList = ({\n id,\n className,\n options,\n onSelectionChange,\n selectedValues,\n selectionMode,\n emptyStateSlot,\n isLoading = false,\n ariaDescribedBy,\n ariaLabelledBy,\n ...otherProps\n}: GridListProps) => (\n <AriaGridList\n className={buildClassnames([className, styles.container])}\n selectionMode={selectionMode}\n items={options}\n onSelectionChange={onSelectionChange}\n selectedKeys={selectedValues.map((selectedValue) => selectedValue.id) as Key[]}\n renderEmptyState={() => (\n <SelectDropdownState isLoading={isLoading} emptyStateSlot={emptyStateSlot} />\n )}\n aria-labelledby={ariaLabelledBy ?? `${id}-label`}\n aria-describedby={ariaDescribedBy ?? `${id}-hint`}\n {...otherProps}\n >\n {(item) => <GridItem {...item} />}\n </AriaGridList>\n);\n"],"names":["React","AriaGridList","buildClassnames","styles","SelectDropdownState","GridItem"],"mappings":";;;;;;;;;;;;;;AASO,MAAM,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,cAAc,EACd,SAAS,GAAG,KAAK,EACjB,eAAe,EACf,cAAc,EACd,GAAG,UAAU,EACC,MACdA,sBAAA,CAAA,aAAA,CAACC,4BAAY,EAAA,EACX,SAAS,EAAEC,+BAAe,CAAC,CAAC,SAAS,EAAEC,uBAAM,CAAC,SAAS,CAAC,CAAC,EACzD,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,OAAO,EACd,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,aAAa,KAAK,aAAa,CAAC,EAAE,CAAU,EAC9E,gBAAgB,EAAE,OAChBH,sBAAC,CAAA,aAAA,CAAAI,uCAAmB,EAAC,EAAA,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAI,CAAA,CAC9E,qBACgB,cAAc,KAAA,IAAA,IAAd,cAAc,KAAA,SAAA,GAAd,cAAc,GAAI,CAAG,EAAA,EAAE,CAAQ,MAAA,CAAA,EAAA,kBAAA,EAC9B,eAAe,KAAA,IAAA,IAAf,eAAe,KAAA,SAAA,GAAf,eAAe,GAAI,GAAG,EAAE,CAAA,KAAA,CAAO,EAC7C,GAAA,UAAU,EAEb,EAAA,CAAC,IAAI,KAAKJ,sBAAC,CAAA,aAAA,CAAAK,iBAAQ,EAAK,EAAA,GAAA,IAAI,EAAI,CAAA,CACpB;;;;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { GridListProps } from './types';
|
|
3
|
+
export declare const GridList: ({ id, className, options, onSelectionChange, selectedValues, selectionMode, emptyStateSlot, isLoading, ariaDescribedBy, ariaLabelledBy, ...otherProps }: GridListProps) => React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GridList as GridList$1 } from 'react-aria-components';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { GridItem } from '../GridItem/GridItem.js';
|
|
4
|
+
import { buildClassnames } from '../../../../utils/buildClassnames.js';
|
|
5
|
+
import 'uid/secure';
|
|
6
|
+
import styles from './OptionsContainer.module.scss.js';
|
|
7
|
+
import { SelectDropdownState } from '../SelectDropdownState.js';
|
|
8
|
+
|
|
9
|
+
const GridList = ({ id, className, options, onSelectionChange, selectedValues, selectionMode, emptyStateSlot, isLoading = false, ariaDescribedBy, ariaLabelledBy, ...otherProps }) => (React__default.createElement(GridList$1, { className: buildClassnames([className, styles.container]), selectionMode: selectionMode, items: options, onSelectionChange: onSelectionChange, selectedKeys: selectedValues.map((selectedValue) => selectedValue.id), renderEmptyState: () => (React__default.createElement(SelectDropdownState, { isLoading: isLoading, emptyStateSlot: emptyStateSlot })), "aria-labelledby": ariaLabelledBy !== null && ariaLabelledBy !== undefined ? ariaLabelledBy : `${id}-label`, "aria-describedby": ariaDescribedBy !== null && ariaDescribedBy !== undefined ? ariaDescribedBy : `${id}-hint`, ...otherProps }, (item) => React__default.createElement(GridItem, { ...item })));
|
|
10
|
+
|
|
11
|
+
export { GridList };
|
|
12
|
+
//# sourceMappingURL=GridList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridList.js","sources":["../../../../../src/components/SelectDropdown/components/OptionsContainers/GridList.tsx"],"sourcesContent":["import { GridList as AriaGridList, Key } from 'react-aria-components';\nimport React from 'react';\nimport { GridItem } from '../GridItem';\nimport { GridListProps } from './types';\nimport { buildClassnames } from '../../../../utils';\n\nimport styles from './OptionsContainer.module.scss';\nimport { SelectDropdownState } from '../SelectDropdownState';\n\nexport const GridList = ({\n id,\n className,\n options,\n onSelectionChange,\n selectedValues,\n selectionMode,\n emptyStateSlot,\n isLoading = false,\n ariaDescribedBy,\n ariaLabelledBy,\n ...otherProps\n}: GridListProps) => (\n <AriaGridList\n className={buildClassnames([className, styles.container])}\n selectionMode={selectionMode}\n items={options}\n onSelectionChange={onSelectionChange}\n selectedKeys={selectedValues.map((selectedValue) => selectedValue.id) as Key[]}\n renderEmptyState={() => (\n <SelectDropdownState isLoading={isLoading} emptyStateSlot={emptyStateSlot} />\n )}\n aria-labelledby={ariaLabelledBy ?? `${id}-label`}\n aria-describedby={ariaDescribedBy ?? `${id}-hint`}\n {...otherProps}\n >\n {(item) => <GridItem {...item} />}\n </AriaGridList>\n);\n"],"names":["React","AriaGridList"],"mappings":";;;;;;;;AASO,MAAM,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,SAAS,EACT,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,cAAc,EACd,SAAS,GAAG,KAAK,EACjB,eAAe,EACf,cAAc,EACd,GAAG,UAAU,EACC,MACdA,cAAA,CAAA,aAAA,CAACC,UAAY,EAAA,EACX,SAAS,EAAE,eAAe,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,EACzD,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,OAAO,EACd,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,aAAa,KAAK,aAAa,CAAC,EAAE,CAAU,EAC9E,gBAAgB,EAAE,OAChBD,cAAC,CAAA,aAAA,CAAA,mBAAmB,EAAC,EAAA,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAI,CAAA,CAC9E,qBACgB,cAAc,KAAA,IAAA,IAAd,cAAc,KAAA,SAAA,GAAd,cAAc,GAAI,CAAG,EAAA,EAAE,CAAQ,MAAA,CAAA,EAAA,kBAAA,EAC9B,eAAe,KAAA,IAAA,IAAf,eAAe,KAAA,SAAA,GAAf,eAAe,GAAI,GAAG,EAAE,CAAA,KAAA,CAAO,EAC7C,GAAA,UAAU,EAEb,EAAA,CAAC,IAAI,KAAKA,cAAC,CAAA,aAAA,CAAA,QAAQ,EAAK,EAAA,GAAA,IAAI,EAAI,CAAA,CACpB;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var reactAriaComponents = require('react-aria-components');
|
|
5
|
+
var buildClassnames = require('../../../../utils/buildClassnames.cjs');
|
|
6
|
+
require('uid/secure');
|
|
7
|
+
var OptionsContainer_module = require('./OptionsContainer.module.scss.cjs');
|
|
8
|
+
var SelectDropdownState = require('../SelectDropdownState.cjs');
|
|
9
|
+
var ListItemSection = require('../ListItemSection/ListItemSection.cjs');
|
|
10
|
+
var ListItem = require('../ListItem/ListItem.cjs');
|
|
11
|
+
|
|
12
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
13
|
+
|
|
14
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
15
|
+
|
|
16
|
+
const ListBox = ({ id, className, ariaLabelledBy, ariaDescribedBy, selectionMode, options, onSelectionChange, selectedValues, isLoading = false, emptyStateSlot, hasSection, ...otherProps }) => (React__default.default.createElement(reactAriaComponents.ListBox, { className: buildClassnames.buildClassnames([className, OptionsContainer_module.container]), selectionMode: selectionMode, items: options, onSelectionChange: onSelectionChange, selectedKeys: selectedValues.map((selectedValue) => selectedValue.id), renderEmptyState: () => (React__default.default.createElement(SelectDropdownState.SelectDropdownState, { isLoading: isLoading, emptyStateSlot: emptyStateSlot })), "aria-labelledby": ariaLabelledBy !== null && ariaLabelledBy !== undefined ? ariaLabelledBy : `${id}-label`, "aria-describedby": ariaDescribedBy !== null && ariaDescribedBy !== undefined ? ariaDescribedBy : `${id}-hint`, ...otherProps }, (item) => hasSection ? (React__default.default.createElement(ListItemSection.ListItemSection, { ...item })) : (React__default.default.createElement(ListItem.ListItem, { ...item }))));
|
|
17
|
+
|
|
18
|
+
exports.ListBox = ListBox;
|
|
19
|
+
//# sourceMappingURL=ListBox.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListBox.cjs","sources":["../../../../../src/components/SelectDropdown/components/OptionsContainers/ListBox.tsx"],"sourcesContent":["import React from 'react';\nimport { ListBox as AriaListBox, Key } from 'react-aria-components';\nimport { buildClassnames } from '../../../../utils';\n\nimport styles from './OptionsContainer.module.scss';\nimport { SelectDropdownState } from '../SelectDropdownState';\nimport { ListItemSection } from '../ListItemSection';\nimport { ListItem } from '../ListItem';\nimport { ListItemProps } from '../ListItem/types';\nimport { ListItemSectionProps } from '../ListItemSection/ListItemSection';\nimport { ListBoxProps } from './types';\n\nexport const ListBox = ({\n id,\n className,\n ariaLabelledBy,\n ariaDescribedBy,\n selectionMode,\n options,\n onSelectionChange,\n selectedValues,\n isLoading = false,\n emptyStateSlot,\n hasSection,\n ...otherProps\n}: ListBoxProps) => (\n <AriaListBox\n className={buildClassnames([className, styles.container])}\n selectionMode={selectionMode}\n items={options}\n onSelectionChange={onSelectionChange}\n selectedKeys={selectedValues.map((selectedValue) => selectedValue.id) as Key[]}\n renderEmptyState={() => (\n <SelectDropdownState isLoading={isLoading} emptyStateSlot={emptyStateSlot} />\n )}\n aria-labelledby={ariaLabelledBy ?? `${id}-label`}\n aria-describedby={ariaDescribedBy ?? `${id}-hint`}\n {...otherProps}\n >\n {(item) =>\n hasSection ? (\n <ListItemSection {...(item as ListItemSectionProps)} />\n ) : (\n <ListItem {...(item as ListItemProps)} />\n )\n }\n </AriaListBox>\n);\n"],"names":["React","AriaListBox","buildClassnames","styles","SelectDropdownState","ListItemSection","ListItem"],"mappings":";;;;;;;;;;;;;;;AAYO,MAAM,OAAO,GAAG,CAAC,EACtB,EAAE,EACF,SAAS,EACT,cAAc,EACd,eAAe,EACf,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,SAAS,GAAG,KAAK,EACjB,cAAc,EACd,UAAU,EACV,GAAG,UAAU,EACA,MACbA,sBAAA,CAAA,aAAA,CAACC,2BAAW,EAAA,EACV,SAAS,EAAEC,+BAAe,CAAC,CAAC,SAAS,EAAEC,uBAAM,CAAC,SAAS,CAAC,CAAC,EACzD,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,OAAO,EACd,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,aAAa,KAAK,aAAa,CAAC,EAAE,CAAU,EAC9E,gBAAgB,EAAE,OAChBH,sBAAC,CAAA,aAAA,CAAAI,uCAAmB,EAAC,EAAA,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAA,CAAI,CAC9E,EAAA,iBAAA,EACgB,cAAc,KAAd,IAAA,IAAA,cAAc,KAAd,SAAA,GAAA,cAAc,GAAI,CAAG,EAAA,EAAE,CAAQ,MAAA,CAAA,EAAA,kBAAA,EAC9B,eAAe,KAAf,IAAA,IAAA,eAAe,KAAf,SAAA,GAAA,eAAe,GAAI,CAAA,EAAG,EAAE,CAAA,KAAA,CAAO,KAC7C,UAAU,EAAA,EAEb,CAAC,IAAI,KACJ,UAAU,IACRJ,sBAAC,CAAA,aAAA,CAAAK,+BAAe,OAAM,IAA6B,EAAA,CAAI,KAEvDL,sBAAC,CAAA,aAAA,CAAAM,iBAAQ,OAAM,IAAsB,EAAA,CAAI,CAC1C,CAES;;;;"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ListBoxProps } from './types';
|
|
3
|
+
export declare const ListBox: ({ id, className, ariaLabelledBy, ariaDescribedBy, selectionMode, options, onSelectionChange, selectedValues, isLoading, emptyStateSlot, hasSection, ...otherProps }: ListBoxProps) => React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { ListBox as ListBox$1 } from 'react-aria-components';
|
|
3
|
+
import { buildClassnames } from '../../../../utils/buildClassnames.js';
|
|
4
|
+
import 'uid/secure';
|
|
5
|
+
import styles from './OptionsContainer.module.scss.js';
|
|
6
|
+
import { SelectDropdownState } from '../SelectDropdownState.js';
|
|
7
|
+
import { ListItemSection } from '../ListItemSection/ListItemSection.js';
|
|
8
|
+
import { ListItem } from '../ListItem/ListItem.js';
|
|
9
|
+
|
|
10
|
+
const ListBox = ({ id, className, ariaLabelledBy, ariaDescribedBy, selectionMode, options, onSelectionChange, selectedValues, isLoading = false, emptyStateSlot, hasSection, ...otherProps }) => (React__default.createElement(ListBox$1, { className: buildClassnames([className, styles.container]), selectionMode: selectionMode, items: options, onSelectionChange: onSelectionChange, selectedKeys: selectedValues.map((selectedValue) => selectedValue.id), renderEmptyState: () => (React__default.createElement(SelectDropdownState, { isLoading: isLoading, emptyStateSlot: emptyStateSlot })), "aria-labelledby": ariaLabelledBy !== null && ariaLabelledBy !== undefined ? ariaLabelledBy : `${id}-label`, "aria-describedby": ariaDescribedBy !== null && ariaDescribedBy !== undefined ? ariaDescribedBy : `${id}-hint`, ...otherProps }, (item) => hasSection ? (React__default.createElement(ListItemSection, { ...item })) : (React__default.createElement(ListItem, { ...item }))));
|
|
11
|
+
|
|
12
|
+
export { ListBox };
|
|
13
|
+
//# sourceMappingURL=ListBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListBox.js","sources":["../../../../../src/components/SelectDropdown/components/OptionsContainers/ListBox.tsx"],"sourcesContent":["import React from 'react';\nimport { ListBox as AriaListBox, Key } from 'react-aria-components';\nimport { buildClassnames } from '../../../../utils';\n\nimport styles from './OptionsContainer.module.scss';\nimport { SelectDropdownState } from '../SelectDropdownState';\nimport { ListItemSection } from '../ListItemSection';\nimport { ListItem } from '../ListItem';\nimport { ListItemProps } from '../ListItem/types';\nimport { ListItemSectionProps } from '../ListItemSection/ListItemSection';\nimport { ListBoxProps } from './types';\n\nexport const ListBox = ({\n id,\n className,\n ariaLabelledBy,\n ariaDescribedBy,\n selectionMode,\n options,\n onSelectionChange,\n selectedValues,\n isLoading = false,\n emptyStateSlot,\n hasSection,\n ...otherProps\n}: ListBoxProps) => (\n <AriaListBox\n className={buildClassnames([className, styles.container])}\n selectionMode={selectionMode}\n items={options}\n onSelectionChange={onSelectionChange}\n selectedKeys={selectedValues.map((selectedValue) => selectedValue.id) as Key[]}\n renderEmptyState={() => (\n <SelectDropdownState isLoading={isLoading} emptyStateSlot={emptyStateSlot} />\n )}\n aria-labelledby={ariaLabelledBy ?? `${id}-label`}\n aria-describedby={ariaDescribedBy ?? `${id}-hint`}\n {...otherProps}\n >\n {(item) =>\n hasSection ? (\n <ListItemSection {...(item as ListItemSectionProps)} />\n ) : (\n <ListItem {...(item as ListItemProps)} />\n )\n }\n </AriaListBox>\n);\n"],"names":["React","AriaListBox"],"mappings":";;;;;;;;;AAYO,MAAM,OAAO,GAAG,CAAC,EACtB,EAAE,EACF,SAAS,EACT,cAAc,EACd,eAAe,EACf,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,cAAc,EACd,SAAS,GAAG,KAAK,EACjB,cAAc,EACd,UAAU,EACV,GAAG,UAAU,EACA,MACbA,cAAA,CAAA,aAAA,CAACC,SAAW,EAAA,EACV,SAAS,EAAE,eAAe,CAAC,CAAC,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,EACzD,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,OAAO,EACd,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,aAAa,KAAK,aAAa,CAAC,EAAE,CAAU,EAC9E,gBAAgB,EAAE,OAChBD,cAAC,CAAA,aAAA,CAAA,mBAAmB,EAAC,EAAA,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,cAAc,EAAA,CAAI,CAC9E,EAAA,iBAAA,EACgB,cAAc,KAAd,IAAA,IAAA,cAAc,KAAd,SAAA,GAAA,cAAc,GAAI,CAAG,EAAA,EAAE,CAAQ,MAAA,CAAA,EAAA,kBAAA,EAC9B,eAAe,KAAf,IAAA,IAAA,eAAe,KAAf,SAAA,GAAA,eAAe,GAAI,CAAA,EAAG,EAAE,CAAA,KAAA,CAAO,KAC7C,UAAU,EAAA,EAEb,CAAC,IAAI,KACJ,UAAU,IACRA,cAAC,CAAA,aAAA,CAAA,eAAe,OAAM,IAA6B,EAAA,CAAI,KAEvDA,cAAC,CAAA,aAAA,CAAA,QAAQ,OAAM,IAAsB,EAAA,CAAI,CAC1C,CAES;;;;"}
|
package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.cjs
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ___$insertStyle = require('../../../../_virtual/____insertStyle.cjs');
|
|
4
|
+
|
|
5
|
+
___$insertStyle("._container_jvp9b_1 {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n}\n._container_jvp9b_1[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n}");
|
|
6
|
+
var styles = {"container":"_container_jvp9b_1"};
|
|
7
|
+
|
|
8
|
+
module.exports = styles;
|
|
9
|
+
//# sourceMappingURL=OptionsContainer.module.scss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionsContainer.module.scss.cjs","sources":["../../../../../src/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss"],"sourcesContent":[".container {\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"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,sPAAA;AACA,aAAA,CAAA,WAAA,CAAA,oBAAA;;;;"}
|
package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import insertStyle from '../../../../_virtual/____insertStyle.js';
|
|
2
|
+
|
|
3
|
+
insertStyle("._container_jvp9b_1 {\n overflow-y: scroll;\n max-height: 300px;\n padding: var(--sizes-sm);\n scroll-padding: var(--sizes-xs) 0;\n}\n._container_jvp9b_1[data-empty] {\n display: flex;\n align-items: center;\n justify-content: center;\n}");
|
|
4
|
+
var styles = {"container":"_container_jvp9b_1"};
|
|
5
|
+
|
|
6
|
+
export { styles as default };
|
|
7
|
+
//# sourceMappingURL=OptionsContainer.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionsContainer.module.scss.js","sources":["../../../../../src/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss"],"sourcesContent":[".container {\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"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,sPAAA;AACA,aAAA,CAAA,WAAA,CAAA,oBAAA;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { Selection, GridListProps as AriaGridListProps, ListBoxProps as AriaListBoxProps } from 'react-aria-components';
|
|
3
|
+
import { ListItemSectionProps } from '../ListItemSection/ListItemSection';
|
|
4
|
+
import { GridItemProps } from '../GridItem/types';
|
|
5
|
+
import { ListItemProps } from '../ListItem/types';
|
|
6
|
+
type ListProps = {
|
|
7
|
+
id?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
selectionMode: 'single' | 'multiple';
|
|
10
|
+
emptyStateSlot?: ReactElement;
|
|
11
|
+
isLoading?: boolean;
|
|
12
|
+
onSelectionChange: (keys: Selection) => void;
|
|
13
|
+
ariaLabelledBy?: string;
|
|
14
|
+
ariaDescribedBy?: string;
|
|
15
|
+
};
|
|
16
|
+
export type GridListProps = ListProps & Omit<AriaGridListProps<GridItemProps>, 'items' | 'selectedValues'> & {
|
|
17
|
+
options: GridItemProps[];
|
|
18
|
+
selectedValues: GridItemProps[];
|
|
19
|
+
};
|
|
20
|
+
export type ListBoxProps = ListProps & Omit<AriaListBoxProps<ListItemProps | ListItemSectionProps>, 'items' | 'selectedValues'> & {
|
|
21
|
+
options: (ListItemProps | ListItemSectionProps)[];
|
|
22
|
+
selectedValues: (ListItemProps | ListItemSectionProps)[];
|
|
23
|
+
hasSection?: boolean;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var ___$insertStyle = require('../../../_virtual/____insertStyle.cjs');
|
|
4
4
|
|
|
5
5
|
___$insertStyle("._item_19dv4_1 {\n border-radius: var(--radius-base);\n cursor: pointer;\n background-color: #ffffff;\n text-decoration: none;\n}\n._item_19dv4_1._appearance-secondary_19dv4_7 {\n background-color: var(--colors-neutral-grey-lightest);\n}\n._item_19dv4_1[data-hovered] > div, ._item_19dv4_1[data-hovered] > div:first-of-type[role=gridcell] > :first-child {\n background-color: #f0f7fc;\n}\n._item_19dv4_1[data-pressed] > div, ._item_19dv4_1[data-pressed] > div:first-of-type[role=gridcell] > :first-child {\n background-color: #e3f0fa;\n}\n._item_19dv4_1[data-focused] {\n outline: 0;\n}\n._item_19dv4_1[data-focus-visible] > div, ._item_19dv4_1[data-focus-visible] > div:first-of-type[role=gridcell] > :first-child {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n z-index: 1;\n position: relative;\n}\n._item_19dv4_1[data-dragging] {\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--color-secondary-blue-base);\n}\n._item_19dv4_1[data-drop-target] {\n background-color: var(--colors-secondary-green-base);\n border-color: var(--colors-secondary-green-base);\n}\n._item_19dv4_1[data-disabled] {\n cursor: not-allowed;\n background-color: var(--colors-neutral-grey-light);\n opacity: 0.75;\n}\n._item_19dv4_1 > div,\n._item_19dv4_1 > div:first-of-type[role=gridcell] > :first-child {\n padding: var(--sizes-sm);\n border-radius: var(--radius-base);\n}");
|
|
6
|
-
var
|
|
6
|
+
var itemStyles = {"item":"_item_19dv4_1","appearance-secondary":"_appearance-secondary_19dv4_7"};
|
|
7
7
|
|
|
8
|
-
module.exports =
|
|
8
|
+
module.exports = itemStyles;
|
|
9
9
|
//# sourceMappingURL=item.module.scss.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.module.scss.cjs","sources":["../../../../src/components/SelectDropdown/components/item.module.scss"],"sourcesContent":[".item {\n border-radius: var(--radius-base);\n cursor: pointer;\n background-color: #ffffff;\n text-decoration: none;\n\n &.appearance-secondary {\n background-color: var(--colors-neutral-grey-lightest);\n }\n\n &[data-hovered] > div,\n &[data-hovered] > div:first-of-type[role='gridcell'] > :first-child {\n background-color: #f0f7fc;\n }\n\n &[data-pressed] > div,\n &[data-pressed] > div:first-of-type[role='gridcell'] > :first-child {\n background-color: #e3f0fa;\n }\n\n &[data-focused] {\n outline: 0;\n }\n\n &[data-focus-visible] > div,\n &[data-focus-visible] > div:first-of-type[role='gridcell'] > :first-child {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n z-index: 1;\n position: relative;\n }\n\n &[data-dragging] {\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--color-secondary-blue-base);\n }\n\n &[data-drop-target] {\n background-color: var(--colors-secondary-green-base);\n border-color: var(--colors-secondary-green-base);\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n background-color: var(--colors-neutral-grey-light);\n opacity: 0.75;\n }\n\n > div,\n > div:first-of-type[role='gridcell'] > :first-child {\n padding: var(--sizes-sm);\n border-radius: var(--radius-base);\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,64CAAA;AACA,
|
|
1
|
+
{"version":3,"file":"item.module.scss.cjs","sources":["../../../../src/components/SelectDropdown/components/item.module.scss"],"sourcesContent":[".item {\n border-radius: var(--radius-base);\n cursor: pointer;\n background-color: #ffffff;\n text-decoration: none;\n\n &.appearance-secondary {\n background-color: var(--colors-neutral-grey-lightest);\n }\n\n &[data-hovered] > div,\n &[data-hovered] > div:first-of-type[role='gridcell'] > :first-child {\n background-color: #f0f7fc;\n }\n\n &[data-pressed] > div,\n &[data-pressed] > div:first-of-type[role='gridcell'] > :first-child {\n background-color: #e3f0fa;\n }\n\n &[data-focused] {\n outline: 0;\n }\n\n &[data-focus-visible] > div,\n &[data-focus-visible] > div:first-of-type[role='gridcell'] > :first-child {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n z-index: 1;\n position: relative;\n }\n\n &[data-dragging] {\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--color-secondary-blue-base);\n }\n\n &[data-drop-target] {\n background-color: var(--colors-secondary-green-base);\n border-color: var(--colors-secondary-green-base);\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n background-color: var(--colors-neutral-grey-light);\n opacity: 0.75;\n }\n\n > div,\n > div:first-of-type[role='gridcell'] > :first-child {\n padding: var(--sizes-sm);\n border-radius: var(--radius-base);\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,64CAAA;AACA,iBAAA,CAAA,MAAA,CAAA,eAAA,CAAA,sBAAA,CAAA,+BAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import insertStyle from '../../../_virtual/____insertStyle.js';
|
|
2
2
|
|
|
3
3
|
insertStyle("._item_19dv4_1 {\n border-radius: var(--radius-base);\n cursor: pointer;\n background-color: #ffffff;\n text-decoration: none;\n}\n._item_19dv4_1._appearance-secondary_19dv4_7 {\n background-color: var(--colors-neutral-grey-lightest);\n}\n._item_19dv4_1[data-hovered] > div, ._item_19dv4_1[data-hovered] > div:first-of-type[role=gridcell] > :first-child {\n background-color: #f0f7fc;\n}\n._item_19dv4_1[data-pressed] > div, ._item_19dv4_1[data-pressed] > div:first-of-type[role=gridcell] > :first-child {\n background-color: #e3f0fa;\n}\n._item_19dv4_1[data-focused] {\n outline: 0;\n}\n._item_19dv4_1[data-focus-visible] > div, ._item_19dv4_1[data-focus-visible] > div:first-of-type[role=gridcell] > :first-child {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n z-index: 1;\n position: relative;\n}\n._item_19dv4_1[data-dragging] {\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--color-secondary-blue-base);\n}\n._item_19dv4_1[data-drop-target] {\n background-color: var(--colors-secondary-green-base);\n border-color: var(--colors-secondary-green-base);\n}\n._item_19dv4_1[data-disabled] {\n cursor: not-allowed;\n background-color: var(--colors-neutral-grey-light);\n opacity: 0.75;\n}\n._item_19dv4_1 > div,\n._item_19dv4_1 > div:first-of-type[role=gridcell] > :first-child {\n padding: var(--sizes-sm);\n border-radius: var(--radius-base);\n}");
|
|
4
|
-
var
|
|
4
|
+
var itemStyles = {"item":"_item_19dv4_1","appearance-secondary":"_appearance-secondary_19dv4_7"};
|
|
5
5
|
|
|
6
|
-
export {
|
|
6
|
+
export { itemStyles as default };
|
|
7
7
|
//# sourceMappingURL=item.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.module.scss.js","sources":["../../../../src/components/SelectDropdown/components/item.module.scss"],"sourcesContent":[".item {\n border-radius: var(--radius-base);\n cursor: pointer;\n background-color: #ffffff;\n text-decoration: none;\n\n &.appearance-secondary {\n background-color: var(--colors-neutral-grey-lightest);\n }\n\n &[data-hovered] > div,\n &[data-hovered] > div:first-of-type[role='gridcell'] > :first-child {\n background-color: #f0f7fc;\n }\n\n &[data-pressed] > div,\n &[data-pressed] > div:first-of-type[role='gridcell'] > :first-child {\n background-color: #e3f0fa;\n }\n\n &[data-focused] {\n outline: 0;\n }\n\n &[data-focus-visible] > div,\n &[data-focus-visible] > div:first-of-type[role='gridcell'] > :first-child {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n z-index: 1;\n position: relative;\n }\n\n &[data-dragging] {\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--color-secondary-blue-base);\n }\n\n &[data-drop-target] {\n background-color: var(--colors-secondary-green-base);\n border-color: var(--colors-secondary-green-base);\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n background-color: var(--colors-neutral-grey-light);\n opacity: 0.75;\n }\n\n > div,\n > div:first-of-type[role='gridcell'] > :first-child {\n padding: var(--sizes-sm);\n border-radius: var(--radius-base);\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,64CAAA;AACA,
|
|
1
|
+
{"version":3,"file":"item.module.scss.js","sources":["../../../../src/components/SelectDropdown/components/item.module.scss"],"sourcesContent":[".item {\n border-radius: var(--radius-base);\n cursor: pointer;\n background-color: #ffffff;\n text-decoration: none;\n\n &.appearance-secondary {\n background-color: var(--colors-neutral-grey-lightest);\n }\n\n &[data-hovered] > div,\n &[data-hovered] > div:first-of-type[role='gridcell'] > :first-child {\n background-color: #f0f7fc;\n }\n\n &[data-pressed] > div,\n &[data-pressed] > div:first-of-type[role='gridcell'] > :first-child {\n background-color: #e3f0fa;\n }\n\n &[data-focused] {\n outline: 0;\n }\n\n &[data-focus-visible] > div,\n &[data-focus-visible] > div:first-of-type[role='gridcell'] > :first-child {\n outline: solid var(--sizes-xs) var(--colors-secondary-blue-light);\n z-index: 1;\n position: relative;\n }\n\n &[data-dragging] {\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--color-secondary-blue-base);\n }\n\n &[data-drop-target] {\n background-color: var(--colors-secondary-green-base);\n border-color: var(--colors-secondary-green-base);\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n background-color: var(--colors-neutral-grey-light);\n opacity: 0.75;\n }\n\n > div,\n > div:first-of-type[role='gridcell'] > :first-child {\n padding: var(--sizes-sm);\n border-radius: var(--radius-base);\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,64CAAA;AACA,iBAAA,CAAA,MAAA,CAAA,eAAA,CAAA,sBAAA,CAAA,+BAAA;;;;"}
|
|
@@ -3,10 +3,11 @@ import { ReactElement } from 'react';
|
|
|
3
3
|
import { ButtonProps } from '../Button/types';
|
|
4
4
|
import { ListItemProps } from './components/ListItem/types';
|
|
5
5
|
import { ListItemSectionProps } from './components/ListItemSection/ListItemSection';
|
|
6
|
+
import { GridItemProps } from './components/GridItem/types';
|
|
6
7
|
type CTAButtonProps = Omit<ButtonProps, 'variant'> & {
|
|
7
8
|
label: string;
|
|
8
9
|
};
|
|
9
|
-
export type SelectDropdownItem = ListItemProps | ListItemSectionProps;
|
|
10
|
+
export type SelectDropdownItem = ListItemProps | ListItemSectionProps | GridItemProps;
|
|
10
11
|
type ImportedListBoxProps = Pick<ListBoxProps<SelectDropdownItem>, 'children' | 'dragAndDropHooks' | 'onScroll' | 'disabledKeys'>;
|
|
11
12
|
export type SelectDropdownSingleProps = ImportedListBoxProps & {
|
|
12
13
|
multiple?: false;
|
|
@@ -31,6 +32,7 @@ export type SelectDropdownProps = (SelectDropdownSingleProps | SelectDropdownMul
|
|
|
31
32
|
actions?: CTAButtonProps[];
|
|
32
33
|
searchValue?: string;
|
|
33
34
|
onSearchChange?: (value: string) => void;
|
|
35
|
+
topAction?: CTAButtonProps;
|
|
34
36
|
'aria-label'?: string;
|
|
35
37
|
'aria-labelledby'?: string;
|
|
36
38
|
'aria-describedby'?: string;
|