@flipdish/ui-library 0.9.2 → 0.11.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/atoms/Button/index.cjs +4 -1
- package/dist/components/atoms/Button/index.cjs.map +1 -1
- package/dist/components/atoms/Button/index.d.ts +2 -0
- package/dist/components/atoms/Button/index.d.ts.map +1 -1
- package/dist/components/atoms/Button/index.js +4 -1
- package/dist/components/atoms/Button/index.js.map +1 -1
- package/dist/components/atoms/Checkbox/index.cjs +4 -2
- package/dist/components/atoms/Checkbox/index.cjs.map +1 -1
- package/dist/components/atoms/Checkbox/index.d.ts +3 -1
- package/dist/components/atoms/Checkbox/index.d.ts.map +1 -1
- package/dist/components/atoms/Checkbox/index.js +4 -2
- package/dist/components/atoms/Checkbox/index.js.map +1 -1
- package/dist/components/atoms/Input/index.cjs +7 -4
- package/dist/components/atoms/Input/index.cjs.map +1 -1
- package/dist/components/atoms/Input/index.d.ts +6 -2
- package/dist/components/atoms/Input/index.d.ts.map +1 -1
- package/dist/components/atoms/Input/index.js +7 -4
- package/dist/components/atoms/Input/index.js.map +1 -1
- package/dist/components/atoms/RadioButton/index.cjs +8 -4
- package/dist/components/atoms/RadioButton/index.cjs.map +1 -1
- package/dist/components/atoms/RadioButton/index.d.ts +8 -3
- package/dist/components/atoms/RadioButton/index.d.ts.map +1 -1
- package/dist/components/atoms/RadioButton/index.js +8 -4
- package/dist/components/atoms/RadioButton/index.js.map +1 -1
- package/dist/components/atoms/Toggle/index.cjs +4 -2
- package/dist/components/atoms/Toggle/index.cjs.map +1 -1
- package/dist/components/atoms/Toggle/index.d.ts +3 -1
- package/dist/components/atoms/Toggle/index.d.ts.map +1 -1
- package/dist/components/atoms/Toggle/index.js +4 -2
- package/dist/components/atoms/Toggle/index.js.map +1 -1
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.cjs +3 -1
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.cjs.map +1 -1
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.d.ts.map +1 -1
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.js +3 -1
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-account-item.js.map +1 -1
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.cjs +9 -5
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.cjs.map +1 -1
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.d.ts +5 -1
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.d.ts.map +1 -1
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.js +9 -5
- package/dist/components/molecules/Breadcrumbs/components/breadcrumb-item.js.map +1 -1
- package/dist/components/molecules/Breadcrumbs/index.cjs +4 -2
- package/dist/components/molecules/Breadcrumbs/index.cjs.map +1 -1
- package/dist/components/molecules/Breadcrumbs/index.d.ts +8 -2
- package/dist/components/molecules/Breadcrumbs/index.d.ts.map +1 -1
- package/dist/components/molecules/Breadcrumbs/index.js +4 -2
- package/dist/components/molecules/Breadcrumbs/index.js.map +1 -1
- package/dist/components/molecules/Pagination/components/pagination-base.cjs +11 -4
- package/dist/components/molecules/Pagination/components/pagination-base.cjs.map +1 -1
- package/dist/components/molecules/Pagination/components/pagination-base.d.ts +8 -1
- package/dist/components/molecules/Pagination/components/pagination-base.d.ts.map +1 -1
- package/dist/components/molecules/Pagination/components/pagination-base.js +11 -4
- package/dist/components/molecules/Pagination/components/pagination-base.js.map +1 -1
- package/dist/components/molecules/Pagination/index.cjs +1 -1
- package/dist/components/molecules/Pagination/index.cjs.map +1 -1
- package/dist/components/molecules/Pagination/index.js +1 -1
- package/dist/components/molecules/Pagination/index.js.map +1 -1
- package/dist/components/molecules/ProgressSteps/components/progress-step-base.cjs +16 -16
- package/dist/components/molecules/ProgressSteps/components/progress-step-base.cjs.map +1 -1
- package/dist/components/molecules/ProgressSteps/components/progress-step-base.d.ts +8 -8
- package/dist/components/molecules/ProgressSteps/components/progress-step-base.d.ts.map +1 -1
- package/dist/components/molecules/ProgressSteps/components/progress-step-base.js +16 -16
- package/dist/components/molecules/ProgressSteps/components/progress-step-base.js.map +1 -1
- package/dist/components/molecules/ProgressSteps/index.cjs +19 -12
- package/dist/components/molecules/ProgressSteps/index.cjs.map +1 -1
- package/dist/components/molecules/ProgressSteps/index.d.ts +3 -3
- package/dist/components/molecules/ProgressSteps/index.d.ts.map +1 -1
- package/dist/components/molecules/ProgressSteps/index.js +19 -12
- package/dist/components/molecules/ProgressSteps/index.js.map +1 -1
- package/dist/components/molecules/ProgressSteps/progressSteps.types.d.ts +10 -0
- package/dist/components/molecules/ProgressSteps/progressSteps.types.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.cjs +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.d.ts +3 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.js +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-avatar.js.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.cjs +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.d.ts +3 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.js +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-checkbox.js.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.cjs +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.d.ts +3 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.js +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-card.js.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.cjs +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.d.ts +3 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.js +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-icon-simple.js.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.cjs +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.d.ts +3 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.js +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-payment-icon.js.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.cjs +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.cjs.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.d.ts +3 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.js +4 -2
- package/dist/components/molecules/RadioGroup/components/radio-group-radio-button.js.map +1 -1
- package/dist/components/molecules/Select/components/multi-select.cjs +39 -4
- package/dist/components/molecules/Select/components/multi-select.cjs.map +1 -1
- package/dist/components/molecules/Select/components/multi-select.d.ts +3 -1
- package/dist/components/molecules/Select/components/multi-select.d.ts.map +1 -1
- package/dist/components/molecules/Select/components/multi-select.js +40 -5
- package/dist/components/molecules/Select/components/multi-select.js.map +1 -1
- package/dist/components/molecules/Select/components/select-item.cjs +6 -3
- package/dist/components/molecules/Select/components/select-item.cjs.map +1 -1
- package/dist/components/molecules/Select/components/select-item.d.ts +3 -1
- package/dist/components/molecules/Select/components/select-item.d.ts.map +1 -1
- package/dist/components/molecules/Select/components/select-item.js +6 -3
- package/dist/components/molecules/Select/components/select-item.js.map +1 -1
- package/dist/components/molecules/Select/components/select-shared.cjs.map +1 -1
- package/dist/components/molecules/Select/components/select-shared.d.ts +6 -0
- package/dist/components/molecules/Select/components/select-shared.d.ts.map +1 -1
- package/dist/components/molecules/Select/components/select-shared.js.map +1 -1
- package/dist/components/molecules/Select/index.cjs +8 -4
- package/dist/components/molecules/Select/index.cjs.map +1 -1
- package/dist/components/molecules/Select/index.d.ts +9 -1
- package/dist/components/molecules/Select/index.d.ts.map +1 -1
- package/dist/components/molecules/Select/index.js +7 -4
- package/dist/components/molecules/Select/index.js.map +1 -1
- package/dist/components/molecules/Tabs/index.cjs +24 -8
- package/dist/components/molecules/Tabs/index.cjs.map +1 -1
- package/dist/components/molecules/Tabs/index.d.ts +17 -7
- package/dist/components/molecules/Tabs/index.d.ts.map +1 -1
- package/dist/components/molecules/Tabs/index.js +24 -8
- package/dist/components/molecules/Tabs/index.js.map +1 -1
- package/dist/components/organisms/ActivityFeed/index.cjs +8 -2
- package/dist/components/organisms/ActivityFeed/index.cjs.map +1 -1
- package/dist/components/organisms/ActivityFeed/index.d.ts +3 -1
- package/dist/components/organisms/ActivityFeed/index.d.ts.map +1 -1
- package/dist/components/organisms/ActivityFeed/index.js +8 -2
- package/dist/components/organisms/ActivityFeed/index.js.map +1 -1
- package/dist/components/organisms/CommandMenu/components/command-menu-item.cjs +5 -1
- package/dist/components/organisms/CommandMenu/components/command-menu-item.cjs.map +1 -1
- package/dist/components/organisms/CommandMenu/components/command-menu-item.d.ts +2 -0
- package/dist/components/organisms/CommandMenu/components/command-menu-item.d.ts.map +1 -1
- package/dist/components/organisms/CommandMenu/components/command-menu-item.js +5 -1
- package/dist/components/organisms/CommandMenu/components/command-menu-item.js.map +1 -1
- package/dist/components/organisms/CommandMenu/index.cjs +6 -4
- package/dist/components/organisms/CommandMenu/index.cjs.map +1 -1
- package/dist/components/organisms/CommandMenu/index.d.ts +8 -2
- package/dist/components/organisms/CommandMenu/index.d.ts.map +1 -1
- package/dist/components/organisms/CommandMenu/index.js +6 -4
- package/dist/components/organisms/CommandMenu/index.js.map +1 -1
- package/dist/components/organisms/DatePicker/components/date-range-picker.d.ts +1 -2
- package/dist/components/organisms/DatePicker/components/date-range-picker.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/components/range-calendar.d.ts +1 -1
- package/dist/components/organisms/DatePicker/components/range-calendar.d.ts.map +1 -1
- package/dist/components/organisms/DatePicker/index.d.ts +2 -2
- package/dist/components/organisms/DatePicker/index.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/mobile-header.cjs +3 -2
- package/dist/components/organisms/HeaderNavigation/components/mobile-header.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/mobile-header.d.ts +6 -1
- package/dist/components/organisms/HeaderNavigation/components/mobile-header.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/mobile-header.js +3 -2
- package/dist/components/organisms/HeaderNavigation/components/mobile-header.js.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-account-card.cjs +9 -6
- package/dist/components/organisms/HeaderNavigation/components/nav-account-card.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-account-card.d.ts +10 -2
- package/dist/components/organisms/HeaderNavigation/components/nav-account-card.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-account-card.js +9 -6
- package/dist/components/organisms/HeaderNavigation/components/nav-account-card.js.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-button.cjs +2 -2
- package/dist/components/organisms/HeaderNavigation/components/nav-button.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-button.d.ts +3 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-button.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-button.js +2 -2
- package/dist/components/organisms/HeaderNavigation/components/nav-button.js.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-item.cjs +4 -4
- package/dist/components/organisms/HeaderNavigation/components/nav-item.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-item.d.ts +3 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-item.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-item.js +4 -4
- package/dist/components/organisms/HeaderNavigation/components/nav-item.js.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-list.cjs +9 -3
- package/dist/components/organisms/HeaderNavigation/components/nav-list.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-list.d.ts +3 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-list.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/components/nav-list.js +9 -3
- package/dist/components/organisms/HeaderNavigation/components/nav-list.js.map +1 -1
- package/dist/components/organisms/HeaderNavigation/headerNavigation.types.d.ts +17 -8
- package/dist/components/organisms/HeaderNavigation/headerNavigation.types.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/index.cjs +9 -2
- package/dist/components/organisms/HeaderNavigation/index.cjs.map +1 -1
- package/dist/components/organisms/HeaderNavigation/index.d.ts +10 -1
- package/dist/components/organisms/HeaderNavigation/index.d.ts.map +1 -1
- package/dist/components/organisms/HeaderNavigation/index.js +10 -3
- package/dist/components/organisms/HeaderNavigation/index.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/mobile-header.cjs +2 -2
- package/dist/components/organisms/SidebarNavigation/components/mobile-header.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/mobile-header.d.ts +8 -2
- package/dist/components/organisms/SidebarNavigation/components/mobile-header.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/mobile-header.js +2 -2
- package/dist/components/organisms/SidebarNavigation/components/mobile-header.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-account-card.cjs +15 -5
- package/dist/components/organisms/SidebarNavigation/components/nav-account-card.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-account-card.d.ts +12 -2
- package/dist/components/organisms/SidebarNavigation/components/nav-account-card.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-account-card.js +15 -5
- package/dist/components/organisms/SidebarNavigation/components/nav-account-card.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-button.cjs +2 -2
- package/dist/components/organisms/SidebarNavigation/components/nav-button.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-button.d.ts +3 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-button.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-button.js +2 -2
- package/dist/components/organisms/SidebarNavigation/components/nav-button.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-item.cjs +4 -4
- package/dist/components/organisms/SidebarNavigation/components/nav-item.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-item.d.ts +3 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-item.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-item.js +4 -4
- package/dist/components/organisms/SidebarNavigation/components/nav-item.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-list.cjs +9 -3
- package/dist/components/organisms/SidebarNavigation/components/nav-list.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-list.d.ts +3 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-list.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/nav-list.js +9 -3
- package/dist/components/organisms/SidebarNavigation/components/nav-list.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/sidebar-menu-button.cjs +1 -1
- package/dist/components/organisms/SidebarNavigation/components/sidebar-menu-button.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/sidebar-menu-button.d.ts +3 -1
- package/dist/components/organisms/SidebarNavigation/components/sidebar-menu-button.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/components/sidebar-menu-button.js +1 -1
- package/dist/components/organisms/SidebarNavigation/components/sidebar-menu-button.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.cjs +10 -6
- package/dist/components/organisms/SidebarNavigation/index.cjs.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.d.ts +7 -1
- package/dist/components/organisms/SidebarNavigation/index.d.ts.map +1 -1
- package/dist/components/organisms/SidebarNavigation/index.js +11 -7
- package/dist/components/organisms/SidebarNavigation/index.js.map +1 -1
- package/dist/components/organisms/SidebarNavigation/sidebarNavigation.types.d.ts +21 -8
- package/dist/components/organisms/SidebarNavigation/sidebarNavigation.types.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.cjs +13 -8
- package/dist/components/organisms/Table/index.cjs.map +1 -1
- package/dist/components/organisms/Table/index.d.ts +17 -3
- package/dist/components/organisms/Table/index.d.ts.map +1 -1
- package/dist/components/organisms/Table/index.js +13 -8
- package/dist/components/organisms/Table/index.js.map +1 -1
- package/dist/utilities/testIdUtils/index.cjs +70 -0
- package/dist/utilities/testIdUtils/index.cjs.map +1 -0
- package/dist/utilities/testIdUtils/index.d.ts +57 -0
- package/dist/utilities/testIdUtils/index.d.ts.map +1 -0
- package/dist/utilities/testIdUtils/index.js +58 -0
- package/dist/utilities/testIdUtils/index.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/molecules/MultiSelect/index.cjs +0 -8
- package/dist/components/molecules/MultiSelect/index.cjs.map +0 -1
- package/dist/components/molecules/MultiSelect/index.d.ts +0 -8
- package/dist/components/molecules/MultiSelect/index.d.ts.map +0 -1
- package/dist/components/molecules/MultiSelect/index.js +0 -2
- package/dist/components/molecules/MultiSelect/index.js.map +0 -1
|
@@ -4,15 +4,17 @@ import { Avatar } from '@flipdish/ui-library/components/atoms/Avatar';
|
|
|
4
4
|
import { Label, HintText } from '@flipdish/ui-library/components/atoms/Input';
|
|
5
5
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
6
6
|
import { isReactComponent } from '@flipdish/ui-library/utilities/isReactComponent';
|
|
7
|
+
import { useResolvedTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
7
8
|
import { isValidElement } from 'react';
|
|
8
9
|
import { Select as Select$1, ListBox, Button, SelectValue as SelectValue$1 } from 'react-aria-components';
|
|
9
10
|
import { ComboBox } from './components/combobox.js';
|
|
10
11
|
import { Popover } from './components/popover.js';
|
|
11
12
|
import { SelectItem } from './components/select-item.js';
|
|
12
13
|
import { SelectContext, sizes } from './components/select-shared.js';
|
|
14
|
+
export { MultiSelect } from './components/multi-select.js';
|
|
13
15
|
|
|
14
|
-
const SelectValue = ({ isOpen, isFocused, isDisabled, size, placeholder, icon, ref }) => {
|
|
15
|
-
return (jsx(Button, { ref: ref, className: cx('relative flex w-full cursor-pointer items-center rounded-lg bg-primary shadow-xs ring-1 ring-primary outline-hidden transition duration-100 ease-linear ring-inset', (isFocused || isOpen) && 'ring-2 ring-brand', isDisabled && 'cursor-not-allowed opacity-50'), children: jsx(SelectValue$1, { className: (state) => cx('flex h-max w-full items-center justify-start truncate text-left align-middle', sizes[size].root,
|
|
16
|
+
const SelectValue = ({ isOpen, isFocused, isDisabled, size, placeholder, icon, ref, 'data-testid': dataTestId, }) => {
|
|
17
|
+
return (jsx(Button, { ref: ref, "data-testid": dataTestId, className: cx('relative flex w-full cursor-pointer items-center rounded-lg bg-primary shadow-xs ring-1 ring-primary outline-hidden transition duration-100 ease-linear ring-inset', (isFocused || isOpen) && 'ring-2 ring-brand', isDisabled && 'cursor-not-allowed opacity-50'), children: jsx(SelectValue$1, { className: (state) => cx('flex h-max w-full items-center justify-start truncate text-left align-middle', sizes[size].root,
|
|
16
18
|
// With icon
|
|
17
19
|
(state.selectedItems[0]?.icon || icon) && sizes[size].withIcon,
|
|
18
20
|
// Icon styles
|
|
@@ -22,8 +24,9 @@ const SelectValue = ({ isOpen, isFocused, isDisabled, size, placeholder, icon, r
|
|
|
22
24
|
return (jsxs(Fragment, { children: [selectedItem?.avatarUrl ? (jsx(Avatar, { size: "xs", src: selectedItem.avatarUrl, alt: selectedItem.label, className: cx(size === 'sm' && 'size-5') })) : isReactComponent(Icon) ? (jsx(Icon, { "data-icon": true, "aria-hidden": "true" })) : isValidElement(Icon) ? (Icon) : null, selectedItem ? (jsxs("span", { className: cx('flex w-full truncate', sizes[size].textContainer), children: [jsx("p", { className: cx('truncate font-medium text-primary', sizes[size].text), children: selectedItem?.label }), selectedItem?.supportingText && jsx("p", { className: cx('text-tertiary', sizes[size].text), children: selectedItem?.supportingText })] })) : (jsx("p", { className: cx('text-placeholder', sizes[size].text), children: placeholder })), jsx(ChevronDown, { "aria-hidden": "true", className: cx('ml-auto shrink-0 text-fg-quaternary', size === 'lg' ? 'size-5' : 'size-4 stroke-[2.25px]') })] }));
|
|
23
25
|
} }) }));
|
|
24
26
|
};
|
|
25
|
-
const Select = ({ placeholder = 'Select', icon, size = 'md', children, items, popoverClassName, label, hint, tooltip, hideRequiredIndicator, className, ...rest }) => {
|
|
26
|
-
|
|
27
|
+
const Select = ({ placeholder = 'Select', icon, size = 'md', children, items, popoverClassName, label, hint, tooltip, hideRequiredIndicator, className, 'data-testid': dataTestId, ...rest }) => {
|
|
28
|
+
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'select', rootName: 'select' });
|
|
29
|
+
return (jsx(SelectContext.Provider, { value: { size, testIdPrefix: rootTestId }, children: jsx(Select$1, { ...rest, "data-testid": rootTestId, className: (state) => cx('flex flex-col gap-1.5', typeof className === 'function' ? className(state) : className), children: (state) => (jsxs(Fragment, { children: [label && (jsx(Label, { isRequired: hideRequiredIndicator ? false : state.isRequired, tooltip: tooltip, children: label })), jsx(SelectValue, { ...state, size, placeholder, icon: icon, "data-testid": joinTestId(rootTestId, 'trigger') }), jsx(Popover, { size: size, className: popoverClassName, children: jsx(ListBox, { items: items, className: "size-full outline-hidden", children: children }) }), hint && (jsx(HintText, { isInvalid: state.isInvalid, className: cx(size === 'sm' && 'text-xs'), children: hint }))] })) }) }));
|
|
27
30
|
};
|
|
28
31
|
const _Select = Select;
|
|
29
32
|
_Select.ComboBox = ComboBox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/Select/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaButton","AriaSelectValue","_jsxs","AriaSelect","_Fragment","AriaListBox"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/Select/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaButton","AriaSelectValue","_jsxs","AriaSelect","_Fragment","AriaListBox"],"mappings":";;;;;;;;;;;;;;;AA6CA,MAAM,WAAW,GAAG,CAAC,EACnB,MAAM,EACN,SAAS,EACT,UAAU,EACV,IAAI,EACJ,WAAW,EACX,IAAI,EACJ,GAAG,EACH,aAAa,EAAE,UAAU,GACqB,KAAI;IAClD,QACEA,IAACC,MAAU,EAAA,EACT,GAAG,EAAE,GAAG,EAAA,aAAA,EACK,UAAU,EACvB,SAAS,EAAE,EAAE,CACX,oKAAoK,EACpK,CAAC,SAAS,IAAI,MAAM,KAAK,mBAAmB,EAC5C,UAAU,IAAI,+BAA+B,CAC9C,EAAA,QAAA,EAEDD,GAAA,CAACE,aAAe,EAAA,EACd,SAAS,EAAE,CAAC,KAAK,KACf,EAAE,CACA,8EAA8E,EAE9E,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI;;AAGhB,YAAA,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ;;AAG9D,YAAA,qDAAqD,CACtD,EAAA,QAAA,EAGF,CAAC,KAAK,KAAI;gBACT,MAAM,YAAY,G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I,EAEjHA,GAAA,CAAC,OAAO,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,gBAAgB,EAAA,QAAA,EAC9CA,IAACM,OAAW,EAAA,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,0BAA0B,EAAA,QAAA,EAC5D,QAAQ,EAAA,CACG,GACN,EAET,IAAI,KACHN,IAAC,QAAQ,EAAA,EAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,SAAS,CAAC,EAAA,QAAA,EAC5E,IAAI,GACI,CACZ,CAAA,EAAA,CACA,CACJ,EAAA,CACU,EAAA,CACU;AAE7B,CAAC;AAED,MAAM,OAAO,GAAG;AAIhB,OAAO,CAAC,QAAQ,GAAG,QAAQ;AAC3B,OAAO,CAAC,IAAI,GAAG,UAAU;;;;"}
|
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var Badge = require('@flipdish/ui-library/components/atoms/Badge');
|
|
5
5
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
6
6
|
var isReactComponent = require('@flipdish/ui-library/utilities/isReactComponent');
|
|
7
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
7
8
|
var React = require('react');
|
|
8
9
|
var reactAriaComponents = require('react-aria-components');
|
|
9
10
|
|
|
@@ -49,10 +50,12 @@ const TabListContext = React.createContext({
|
|
|
49
50
|
size: 'sm',
|
|
50
51
|
type: 'button-brand',
|
|
51
52
|
});
|
|
52
|
-
const TabList = ({ size = 'sm', type = 'button-brand', orientation: orientationProp, fullWidth, className, children, ...otherProps }) => {
|
|
53
|
+
const TabList = ({ size = 'sm', type = 'button-brand', orientation: orientationProp, fullWidth, className, children, 'data-testid': dataTestId, ...otherProps }) => {
|
|
53
54
|
const context = reactAriaComponents.useSlottedContext(reactAriaComponents.TabsContext);
|
|
54
55
|
const orientation = orientationProp ?? context?.orientation ?? 'horizontal';
|
|
55
|
-
|
|
56
|
+
const prefix = testIdUtils.useTestIdPrefix();
|
|
57
|
+
const listTestId = dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, 'list') : undefined);
|
|
58
|
+
return (jsxRuntime.jsx(TabListContext.Provider, { value: { size, type, orientation, fullWidth }, children: jsxRuntime.jsx(reactAriaComponents.TabList, { ...otherProps, "data-testid": listTestId, className: (state) => cx.cx('group flex', getHorizontalStyles({
|
|
56
59
|
size,
|
|
57
60
|
fullWidth,
|
|
58
61
|
})[type], orientation === 'vertical' && 'w-max flex-col',
|
|
@@ -61,13 +64,25 @@ const TabList = ({ size = 'sm', type = 'button-brand', orientation: orientationP
|
|
|
61
64
|
type === 'underline' &&
|
|
62
65
|
'relative before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-border-secondary', typeof className === 'function' ? className(state) : className), children: children ?? (otherProps.items ? (item) => jsxRuntime.jsx(Tab, { ...item, children: item.children }) : undefined) }) }));
|
|
63
66
|
};
|
|
64
|
-
const TabPanel = (props) => {
|
|
65
|
-
|
|
67
|
+
const TabPanel = ({ 'data-testid': dataTestId, ...props }) => {
|
|
68
|
+
const prefix = testIdUtils.useTestIdPrefix();
|
|
69
|
+
const idPart = props.id !== undefined ? testIdUtils.slugifyTestId(String(props.id)) : 'panel';
|
|
70
|
+
const panelTestId = dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, `panel-${idPart}`) : undefined);
|
|
71
|
+
return (jsxRuntime.jsx(reactAriaComponents.TabPanel, { ...props, "data-testid": panelTestId, className: (state) => cx.cx('outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2', typeof props.className === 'function' ? props.className(state) : props.className) }));
|
|
66
72
|
};
|
|
67
|
-
const Tab = ({ label, children, badge, icon: Icon, className, ...otherProps }) => {
|
|
73
|
+
const Tab = ({ label, children, badge, icon: Icon, className, 'data-testid': dataTestId, ...otherProps }) => {
|
|
68
74
|
const { size = 'sm', type = 'button-brand', fullWidth } = React.useContext(TabListContext);
|
|
69
75
|
const showPillColorBadge = type === 'underline' || type === 'line' || type === 'button-brand';
|
|
70
|
-
|
|
76
|
+
const prefix = testIdUtils.useTestIdPrefix();
|
|
77
|
+
const idPart = otherProps.id !== undefined
|
|
78
|
+
? testIdUtils.slugifyTestId(String(otherProps.id))
|
|
79
|
+
: typeof label === 'string'
|
|
80
|
+
? testIdUtils.slugifyTestId(label)
|
|
81
|
+
: typeof children === 'string'
|
|
82
|
+
? testIdUtils.slugifyTestId(children)
|
|
83
|
+
: 'item';
|
|
84
|
+
const tabTestId = dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, `tab-${idPart}`) : undefined);
|
|
85
|
+
return (jsxRuntime.jsx(reactAriaComponents.Tab, { ...otherProps, "data-testid": tabTestId, className: (prop) => cx.cx('z-10 flex h-max cursor-pointer items-center justify-center gap-2 rounded-md whitespace-nowrap text-quaternary transition duration-100 ease-linear', 'group-orientation-vertical:justify-start', fullWidth && 'w-full flex-1', sizes[size].base, sizes[size][type], getTabStyles(prop)[type], typeof className === 'function' ? className(prop) : className), children: (state) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [React.isValidElement(Icon) && Icon, isReactComponent.isReactComponent(Icon) && jsxRuntime.jsx(Icon, { "data-icon": true, className: "transition-inherit-all" }), jsxRuntime.jsxs("span", { className: cx.cx('flex items-center gap-1.5', type !== 'line' && 'px-0.5'), children: [typeof children === 'function' ? children(state) : children || label, badge && (jsxRuntime.jsx(Badge.Badge, { size: "sm", type: showPillColorBadge ? 'pill-color' : 'modern', color: showPillColorBadge && (state.isHovered || state.isSelected) ? 'brand' : 'gray', className: cx.cx('hidden transition-inherit-all md:flex', size === 'sm' && '-my-px'), children: badge }))] })] })) }));
|
|
71
86
|
};
|
|
72
87
|
/**
|
|
73
88
|
* Organises related content into labelled panels, showing one at a time.
|
|
@@ -75,8 +90,9 @@ const Tab = ({ label, children, badge, icon: Icon, className, ...otherProps }) =
|
|
|
75
90
|
*
|
|
76
91
|
* @summary switch between labelled content panels
|
|
77
92
|
*/
|
|
78
|
-
const Tabs = ({ className, ...props }) => {
|
|
79
|
-
|
|
93
|
+
const Tabs = ({ className, 'data-testid': dataTestId, ...props }) => {
|
|
94
|
+
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'tabs', rootName: 'tabs' });
|
|
95
|
+
return (jsxRuntime.jsx(testIdUtils.TestIdProvider, { value: rootTestId, children: jsxRuntime.jsx(reactAriaComponents.Tabs, { keyboardActivation: "manual", ...props, "data-testid": rootTestId, className: (state) => cx.cx('flex w-full flex-col', typeof className === 'function' ? className(state) : className) }) }));
|
|
80
96
|
};
|
|
81
97
|
Tabs.Panel = TabPanel;
|
|
82
98
|
Tabs.List = TabList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/molecules/Tabs/index.tsx"],"sourcesContent":[null],"names":["cx","createContext","useSlottedContext","TabsContext","_jsx","AriaTabList","AriaTabPanel","useContext","AriaTab","_jsxs","isValidElement","isReactComponent","Badge","AriaTabs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/molecules/Tabs/index.tsx"],"sourcesContent":[null],"names":["cx","createContext","useSlottedContext","TabsContext","useTestIdPrefix","joinTestId","_jsx","AriaTabList","slugifyTestId","AriaTabPanel","useContext","AriaTab","_jsxs","_Fragment","isValidElement","isReactComponent","Badge","useResolvedTestId","TestIdProvider","AriaTabs"],"mappings":";;;;;;;;;;AAyBA;AACA,MAAM,YAAY,GAAG,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAsB,MAAM;AACvF,IAAA,cAAc,EAAEA,KAAE,CAChB,mDAAmD,EACnD,cAAc,IAAI,6BAA6B,EAC/C,CAAC,UAAU,IAAI,SAAS,KAAK,qFAAqF,CACnH;AACD,IAAA,aAAa,EAAEA,KAAE,CACf,mDAAmD,EACnD,SAAS,IAAI,qEAAqE,EAClF,cAAc,IAAI,6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C,IAAI,GAAG,GAAG;;;;;;;"}
|
|
@@ -36,9 +36,13 @@ export interface TabListComponentProps<T extends object, K extends Orientation>
|
|
|
36
36
|
items?: T[];
|
|
37
37
|
/** Whether the tab list is full width. */
|
|
38
38
|
fullWidth?: boolean;
|
|
39
|
+
/** Overrides the derived `data-testid` for the tab list (defaults to `<root>--list`). */
|
|
40
|
+
'data-testid'?: string;
|
|
39
41
|
}
|
|
40
|
-
export declare const TabList: <T extends Orientation>({ size, type, orientation: orientationProp, fullWidth, className, children, ...otherProps }: TabListComponentProps<TabComponentProps, T>) => import("react").JSX.Element;
|
|
41
|
-
export declare const TabPanel: (props: ComponentPropsWithRef<typeof AriaTabPanel>
|
|
42
|
+
export declare const TabList: <T extends Orientation>({ size, type, orientation: orientationProp, fullWidth, className, children, "data-testid": dataTestId, ...otherProps }: TabListComponentProps<TabComponentProps, T>) => import("react").JSX.Element;
|
|
43
|
+
export declare const TabPanel: ({ "data-testid": dataTestId, ...props }: ComponentPropsWithRef<typeof AriaTabPanel> & {
|
|
44
|
+
"data-testid"?: string;
|
|
45
|
+
}) => import("react").JSX.Element;
|
|
42
46
|
export interface TabComponentProps extends AriaTabProps {
|
|
43
47
|
/** The label of the tab. */
|
|
44
48
|
label?: ReactNode;
|
|
@@ -50,8 +54,10 @@ export interface TabComponentProps extends AriaTabProps {
|
|
|
50
54
|
}> | ReactNode;
|
|
51
55
|
/** The badge displayed next to the label. */
|
|
52
56
|
badge?: number | string;
|
|
57
|
+
/** Overrides the derived `data-testid` for the tab (defaults to `<root>--tab-<id>`). */
|
|
58
|
+
'data-testid'?: string;
|
|
53
59
|
}
|
|
54
|
-
export declare const Tab: ({ label, children, badge, icon: Icon, className, ...otherProps }: TabComponentProps) => import("react").JSX.Element;
|
|
60
|
+
export declare const Tab: ({ label, children, badge, icon: Icon, className, "data-testid": dataTestId, ...otherProps }: TabComponentProps) => import("react").JSX.Element;
|
|
55
61
|
/**
|
|
56
62
|
* Organises related content into labelled panels, showing one at a time.
|
|
57
63
|
* Compose with `Tabs.List` (`TabList`), `Tabs.Item` (`Tab`), and `Tabs.Panel` (`TabPanel`).
|
|
@@ -59,10 +65,14 @@ export declare const Tab: ({ label, children, badge, icon: Icon, className, ...o
|
|
|
59
65
|
* @summary switch between labelled content panels
|
|
60
66
|
*/
|
|
61
67
|
export declare const Tabs: {
|
|
62
|
-
({ className, ...props }: ComponentPropsWithRef<typeof AriaTabs>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
({ className, "data-testid": dataTestId, ...props }: ComponentPropsWithRef<typeof AriaTabs> & {
|
|
69
|
+
"data-testid"?: string;
|
|
70
|
+
}): import("react").JSX.Element;
|
|
71
|
+
Panel: ({ "data-testid": dataTestId, ...props }: ComponentPropsWithRef<typeof AriaTabPanel> & {
|
|
72
|
+
"data-testid"?: string;
|
|
73
|
+
}) => import("react").JSX.Element;
|
|
74
|
+
List: <T extends Orientation>({ size, type, orientation: orientationProp, fullWidth, className, children, "data-testid": dataTestId, ...otherProps }: TabListComponentProps<TabComponentProps, T>) => import("react").JSX.Element;
|
|
75
|
+
Item: ({ label, children, badge, icon: Icon, className, "data-testid": dataTestId, ...otherProps }: TabComponentProps) => import("react").JSX.Element;
|
|
66
76
|
};
|
|
67
77
|
export {};
|
|
68
78
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Tabs/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Tabs/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,qBAAqB,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EAAE,YAAY,IAAI,gBAAgB,EAAE,QAAQ,IAAI,YAAY,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CA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AAkB,SAAQ,YAAY;IACrD,4BAA4B;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,kBAAkB,KAAK,SAAS,CAAC,CAAC;IAClE,wDAAwD;IACxD,IAAI,CAAC,EAAE,EAAE,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IAC9C,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,GAAG,GAAI,6FAA6F,iBAAiB,gCAyDjI,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,IAAI;yDAAwD,qBAAqB,CAAC,OAAO,QAAQ,CAAC,GAAG;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE;qDAjG1E,qBAAqB,CAAC,OAAO,YAAY,CAAC,GAAG;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE;WAhDjH,CAAC,SAAS,WAAW,0HAS1C,qBAAqB,CAAC,iBAAiB,EAAE,CAAC,CAAC;wGAuEmE,iBAAiB;CA8EjI,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Badge } from '@flipdish/ui-library/components/atoms/Badge';
|
|
3
3
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
4
4
|
import { isReactComponent } from '@flipdish/ui-library/utilities/isReactComponent';
|
|
5
|
+
import { useTestIdPrefix, slugifyTestId, joinTestId, useResolvedTestId, TestIdProvider } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
5
6
|
import { createContext, useContext, isValidElement } from 'react';
|
|
6
7
|
import { Tab as Tab$1, useSlottedContext, TabsContext, TabList as TabList$1, TabPanel as TabPanel$1, Tabs as Tabs$1 } from 'react-aria-components';
|
|
7
8
|
|
|
@@ -47,10 +48,12 @@ const TabListContext = createContext({
|
|
|
47
48
|
size: 'sm',
|
|
48
49
|
type: 'button-brand',
|
|
49
50
|
});
|
|
50
|
-
const TabList = ({ size = 'sm', type = 'button-brand', orientation: orientationProp, fullWidth, className, children, ...otherProps }) => {
|
|
51
|
+
const TabList = ({ size = 'sm', type = 'button-brand', orientation: orientationProp, fullWidth, className, children, 'data-testid': dataTestId, ...otherProps }) => {
|
|
51
52
|
const context = useSlottedContext(TabsContext);
|
|
52
53
|
const orientation = orientationProp ?? context?.orientation ?? 'horizontal';
|
|
53
|
-
|
|
54
|
+
const prefix = useTestIdPrefix();
|
|
55
|
+
const listTestId = dataTestId ?? (prefix ? joinTestId(prefix, 'list') : undefined);
|
|
56
|
+
return (jsx(TabListContext.Provider, { value: { size, type, orientation, fullWidth }, children: jsx(TabList$1, { ...otherProps, "data-testid": listTestId, className: (state) => cx('group flex', getHorizontalStyles({
|
|
54
57
|
size,
|
|
55
58
|
fullWidth,
|
|
56
59
|
})[type], orientation === 'vertical' && 'w-max flex-col',
|
|
@@ -59,13 +62,25 @@ const TabList = ({ size = 'sm', type = 'button-brand', orientation: orientationP
|
|
|
59
62
|
type === 'underline' &&
|
|
60
63
|
'relative before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-border-secondary', typeof className === 'function' ? className(state) : className), children: children ?? (otherProps.items ? (item) => jsx(Tab, { ...item, children: item.children }) : undefined) }) }));
|
|
61
64
|
};
|
|
62
|
-
const TabPanel = (props) => {
|
|
63
|
-
|
|
65
|
+
const TabPanel = ({ 'data-testid': dataTestId, ...props }) => {
|
|
66
|
+
const prefix = useTestIdPrefix();
|
|
67
|
+
const idPart = props.id !== undefined ? slugifyTestId(String(props.id)) : 'panel';
|
|
68
|
+
const panelTestId = dataTestId ?? (prefix ? joinTestId(prefix, `panel-${idPart}`) : undefined);
|
|
69
|
+
return (jsx(TabPanel$1, { ...props, "data-testid": panelTestId, className: (state) => cx('outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2', typeof props.className === 'function' ? props.className(state) : props.className) }));
|
|
64
70
|
};
|
|
65
|
-
const Tab = ({ label, children, badge, icon: Icon, className, ...otherProps }) => {
|
|
71
|
+
const Tab = ({ label, children, badge, icon: Icon, className, 'data-testid': dataTestId, ...otherProps }) => {
|
|
66
72
|
const { size = 'sm', type = 'button-brand', fullWidth } = useContext(TabListContext);
|
|
67
73
|
const showPillColorBadge = type === 'underline' || type === 'line' || type === 'button-brand';
|
|
68
|
-
|
|
74
|
+
const prefix = useTestIdPrefix();
|
|
75
|
+
const idPart = otherProps.id !== undefined
|
|
76
|
+
? slugifyTestId(String(otherProps.id))
|
|
77
|
+
: typeof label === 'string'
|
|
78
|
+
? slugifyTestId(label)
|
|
79
|
+
: typeof children === 'string'
|
|
80
|
+
? slugifyTestId(children)
|
|
81
|
+
: 'item';
|
|
82
|
+
const tabTestId = dataTestId ?? (prefix ? joinTestId(prefix, `tab-${idPart}`) : undefined);
|
|
83
|
+
return (jsx(Tab$1, { ...otherProps, "data-testid": tabTestId, className: (prop) => cx('z-10 flex h-max cursor-pointer items-center justify-center gap-2 rounded-md whitespace-nowrap text-quaternary transition duration-100 ease-linear', 'group-orientation-vertical:justify-start', fullWidth && 'w-full flex-1', sizes[size].base, sizes[size][type], getTabStyles(prop)[type], typeof className === 'function' ? className(prop) : className), children: (state) => (jsxs(Fragment, { children: [isValidElement(Icon) && Icon, isReactComponent(Icon) && jsx(Icon, { "data-icon": true, className: "transition-inherit-all" }), jsxs("span", { className: cx('flex items-center gap-1.5', type !== 'line' && 'px-0.5'), children: [typeof children === 'function' ? children(state) : children || label, badge && (jsx(Badge, { size: "sm", type: showPillColorBadge ? 'pill-color' : 'modern', color: showPillColorBadge && (state.isHovered || state.isSelected) ? 'brand' : 'gray', className: cx('hidden transition-inherit-all md:flex', size === 'sm' && '-my-px'), children: badge }))] })] })) }));
|
|
69
84
|
};
|
|
70
85
|
/**
|
|
71
86
|
* Organises related content into labelled panels, showing one at a time.
|
|
@@ -73,8 +88,9 @@ const Tab = ({ label, children, badge, icon: Icon, className, ...otherProps }) =
|
|
|
73
88
|
*
|
|
74
89
|
* @summary switch between labelled content panels
|
|
75
90
|
*/
|
|
76
|
-
const Tabs = ({ className, ...props }) => {
|
|
77
|
-
|
|
91
|
+
const Tabs = ({ className, 'data-testid': dataTestId, ...props }) => {
|
|
92
|
+
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'tabs', rootName: 'tabs' });
|
|
93
|
+
return (jsx(TestIdProvider, { value: rootTestId, children: jsx(Tabs$1, { keyboardActivation: "manual", ...props, "data-testid": rootTestId, className: (state) => cx('flex w-full flex-col', typeof className === 'function' ? className(state) : className) }) }));
|
|
78
94
|
};
|
|
79
95
|
Tabs.Panel = TabPanel;
|
|
80
96
|
Tabs.List = TabList;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/Tabs/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaTabList","AriaTabPanel","AriaTab","_jsxs","AriaTabs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/Tabs/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaTabList","AriaTabPanel","AriaTab","_jsxs","_Fragment","AriaTabs"],"mappings":";;;;;;;;AAyBA;AACA,MAAM,YAAY,GAAG,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAsB,MAAM;AACvF,IAAA,cAAc,EAAE,EAAE,CAChB,mDAAmD,EACnD,cAAc,IAAI,6BAA6B,EAC/C,CAAC,UAAU,IAAI,SAAS,KAAK,qFAAqF,CACnH;AACD,IAAA,aAAa,EAAE,EAAE,CACf,mDAAmD,EACnD,SAAS,IAAI,qEAAqE,EAClF,cAAc,IAAI,6BAA6B,EAC/C,UAAU,IAAI,qEAAqE,CACpF;AACD,IAAA,eAAe,EAAE,EAAE,CACjB,mDAAm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
var Dot = require('@flipdish/ui-library/components/atoms/Dot');
|
|
9
9
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
10
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
10
11
|
|
|
11
|
-
const FeedItem = ({ user, date, action, attachment, comment, labels, message, unseen, connector, size = 'md' }) => {
|
|
12
|
-
|
|
12
|
+
const FeedItem = ({ id, user, date, action, attachment, comment, labels, message, unseen, connector, size = 'md', 'data-testid': dataTestId, }) => {
|
|
13
|
+
const itemTestId = testIdUtils.useResolvedTestId({
|
|
14
|
+
testId: dataTestId,
|
|
15
|
+
segment: `feed-item-${testIdUtils.slugifyTestId(String(id))}`,
|
|
16
|
+
rootName: `feed-item-${testIdUtils.slugifyTestId(String(id))}`,
|
|
17
|
+
});
|
|
18
|
+
return (jsxRuntime.jsxs("article", { "data-testid": itemTestId, className: "relative flex gap-3", children: [unseen && jsxRuntime.jsx(Dot.Dot, { size: "md", className: "absolute top-0 right-0 text-fg-success-secondary" }), jsxRuntime.jsxs("div", { className: "flex shrink-0 flex-col", children: [jsxRuntime.jsx(Avatar.Avatar, { src: user.avatarUrl, alt: user.name, size: size === 'sm' ? 'sm' : 'md', status: user.status }), connector && (jsxRuntime.jsx("div", { className: "relative my-1 flex h-full w-full justify-center self-center overflow-hidden", children: jsxRuntime.jsx("svg", { className: "absolute", width: "2.4", children: jsxRuntime.jsx("line", { x1: "1.2", y1: "1.2", x2: "1.2", y2: "100%", className: "stroke-border-primary", stroke: "black", strokeWidth: "2.4", strokeDasharray: "0,6", strokeLinecap: "round" }) }) }))] }), jsxRuntime.jsxs("div", { className: cx.cx('flex flex-1 flex-col gap-3', connector && 'pb-8'), children: [jsxRuntime.jsxs("header", { children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("a", { href: user.href, className: "rounded text-sm font-medium text-secondary outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2", children: user.name }), date && (jsxRuntime.jsx("time", { className: "text-xs text-tertiary", dateTime: date, children: date }))] }), action && (jsxRuntime.jsxs("p", { className: "text-sm text-tertiary", children: [action.content, ' ', action.target && (jsxRuntime.jsx(Button.Button, { href: action.href, className: "inline text-sm font-medium whitespace-normal", color: "link-color", size: "sm", children: action.target }))] })), user.username && jsxRuntime.jsx("p", { className: "text-sm text-tertiary", children: user.username })] }), attachment && (jsxRuntime.jsxs("figure", { className: "flex gap-3", children: [jsxRuntime.jsx(uiIcons.FileIcon, { type: attachment.type, theme: "light", className: "size-10 dark:hidden" }), jsxRuntime.jsx(uiIcons.FileIcon, { type: attachment.type, theme: "dark", className: "size-10 not-dark:hidden" }), jsxRuntime.jsxs("figcaption", { children: [jsxRuntime.jsx("p", { className: "text-sm font-medium text-secondary", children: attachment.name }), jsxRuntime.jsx("p", { className: "text-sm text-tertiary", children: attachment.size })] })] })), labels && labels.length > 0 && (jsxRuntime.jsx("aside", { className: "flex gap-1", "aria-label": "Labels", children: labels.map((label) => (jsxRuntime.jsx(Badge.Badge, { color: label.color, size: "sm", children: label.name }, label.name))) })), comment && jsxRuntime.jsx("q", { className: "text-sm text-tertiary", children: comment }), message && (jsxRuntime.jsx("section", { className: cx.cx('gap-2 rounded-lg rounded-tl-none p-3 ring-1 ring-secondary ring-inset', connector && 'py-2.5'), children: jsxRuntime.jsx("p", { className: "text-sm text-secondary", children: message }) }))] })] }));
|
|
13
19
|
};
|
|
14
20
|
|
|
15
21
|
exports.FeedItem = FeedItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/ActivityFeed/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx","Dot","Avatar","cx","Button","FileIcon","Badge"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/organisms/ActivityFeed/index.tsx"],"sourcesContent":[null],"names":["useResolvedTestId","slugifyTestId","_jsxs","_jsx","Dot","Avatar","cx","Button","FileIcon","Badge"],"mappings":";;;;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Props extends FeedItemType {
|
|
31
31
|
connector?: boolean;
|
|
32
32
|
size?: 'sm' | 'md';
|
|
33
|
+
/** Overrides the derived `data-testid` (defaults to `fd-feed-item-<id>`). */
|
|
34
|
+
'data-testid'?: string;
|
|
33
35
|
}
|
|
34
|
-
export declare const FeedItem: ({ user, date, action, attachment, comment, labels, message, unseen, connector, size }: FeedItemProps) => import("react").JSX.Element;
|
|
36
|
+
export declare const FeedItem: ({ id, user, date, action, attachment, comment, labels, message, unseen, connector, size, "data-testid": dataTestId, }: FeedItemProps) => import("react").JSX.Element;
|
|
35
37
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/ActivityFeed/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/ActivityFeed/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6CAA6C,CAAC;AAO/E,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;KAC/B,CAAC;IACF,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;KACrC,CAAC;IACF,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QAEb,KAAK,EAAE,WAAW,CAAC;KACpB,EAAE,CAAC;IACJ,MAAM,CAAC,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,QAAQ,GAAI,uHAatB,aAAa,gCAyFf,CAAC"}
|
|
@@ -5,9 +5,15 @@ import { Badge } from '@flipdish/ui-library/components/atoms/Badge';
|
|
|
5
5
|
import { Button } from '@flipdish/ui-library/components/atoms/Button';
|
|
6
6
|
import { Dot } from '@flipdish/ui-library/components/atoms/Dot';
|
|
7
7
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
8
|
+
import { useResolvedTestId, slugifyTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
8
9
|
|
|
9
|
-
const FeedItem = ({ user, date, action, attachment, comment, labels, message, unseen, connector, size = 'md' }) => {
|
|
10
|
-
|
|
10
|
+
const FeedItem = ({ id, user, date, action, attachment, comment, labels, message, unseen, connector, size = 'md', 'data-testid': dataTestId, }) => {
|
|
11
|
+
const itemTestId = useResolvedTestId({
|
|
12
|
+
testId: dataTestId,
|
|
13
|
+
segment: `feed-item-${slugifyTestId(String(id))}`,
|
|
14
|
+
rootName: `feed-item-${slugifyTestId(String(id))}`,
|
|
15
|
+
});
|
|
16
|
+
return (jsxs("article", { "data-testid": itemTestId, className: "relative flex gap-3", children: [unseen && jsx(Dot, { size: "md", className: "absolute top-0 right-0 text-fg-success-secondary" }), jsxs("div", { className: "flex shrink-0 flex-col", children: [jsx(Avatar, { src: user.avatarUrl, alt: user.name, size: size === 'sm' ? 'sm' : 'md', status: user.status }), connector && (jsx("div", { className: "relative my-1 flex h-full w-full justify-center self-center overflow-hidden", children: jsx("svg", { className: "absolute", width: "2.4", children: jsx("line", { x1: "1.2", y1: "1.2", x2: "1.2", y2: "100%", className: "stroke-border-primary", stroke: "black", strokeWidth: "2.4", strokeDasharray: "0,6", strokeLinecap: "round" }) }) }))] }), jsxs("div", { className: cx('flex flex-1 flex-col gap-3', connector && 'pb-8'), children: [jsxs("header", { children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("a", { href: user.href, className: "rounded text-sm font-medium text-secondary outline-focus-ring focus-visible:outline-2 focus-visible:outline-offset-2", children: user.name }), date && (jsx("time", { className: "text-xs text-tertiary", dateTime: date, children: date }))] }), action && (jsxs("p", { className: "text-sm text-tertiary", children: [action.content, ' ', action.target && (jsx(Button, { href: action.href, className: "inline text-sm font-medium whitespace-normal", color: "link-color", size: "sm", children: action.target }))] })), user.username && jsx("p", { className: "text-sm text-tertiary", children: user.username })] }), attachment && (jsxs("figure", { className: "flex gap-3", children: [jsx(FileIcon, { type: attachment.type, theme: "light", className: "size-10 dark:hidden" }), jsx(FileIcon, { type: attachment.type, theme: "dark", className: "size-10 not-dark:hidden" }), jsxs("figcaption", { children: [jsx("p", { className: "text-sm font-medium text-secondary", children: attachment.name }), jsx("p", { className: "text-sm text-tertiary", children: attachment.size })] })] })), labels && labels.length > 0 && (jsx("aside", { className: "flex gap-1", "aria-label": "Labels", children: labels.map((label) => (jsx(Badge, { color: label.color, size: "sm", children: label.name }, label.name))) })), comment && jsx("q", { className: "text-sm text-tertiary", children: comment }), message && (jsx("section", { className: cx('gap-2 rounded-lg rounded-tl-none p-3 ring-1 ring-secondary ring-inset', connector && 'py-2.5'), children: jsx("p", { className: "text-sm text-secondary", children: message }) }))] })] }));
|
|
11
17
|
};
|
|
12
18
|
|
|
13
19
|
export { FeedItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/ActivityFeed/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/organisms/ActivityFeed/index.tsx"],"sourcesContent":[null],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;;AAgDO,MAAM,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,UAAU,EACV,OAAO,EACP,MAAM,EACN,OAAO,EACP,MAAM,EACN,SAAS,EACT,IAAI,GAAG,IAAI,EACX,aAAa,EAAE,UAAU,GACX,KAAI;IAClB,MAAM,UAAU,GAAG,iBAAiB,CAAC;AACnC,QAAA,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,aAAa,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA,CAAE;QACjD,QAAQ,EAAE,aAAa,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAA,CAAE;AACnD,KAAA,CAAC;IAEF,QACEA,iCAAsB,UAAU,EAAE,SAAS,EAAC,qBAAqB,aAC9D,MAAM,IAAIC,IAAC,GAAG,EAAA,EAAC,IAAI,EAAC,IAAI,EAAC,SAAS,EAAC,kDAAkD,EAAA,CAAG,EACzFD,cAAK,SAAS,EAAC,wBAAwB,EAAA,QAAA,EAAA,CACrCC,GAAA,CAAC,MAAM,EAAA,EAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAA,CAAI,EACtG,SAAS,KACRA,GAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,6EAA6E,EAAA,QAAA,EAE1FA,GAA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EAAuE,EAAE,SAAS,IAAI,QAAQ,CAAC,EAAA,QAAA,EACpHA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,wBAAwB,YAAE,OAAO,EAAA,CAAK,GAC3C,CACX,CAAA,EAAA,CACG,CAAA,EAAA,CACE;AAEd;;;;"}
|
|
@@ -4,6 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
4
4
|
var Avatar = require('@flipdish/ui-library/components/atoms/Avatar');
|
|
5
5
|
var FeaturedIcon = require('@flipdish/ui-library/components/atoms/FeaturedIcon');
|
|
6
6
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
7
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
7
8
|
var reactAriaComponents = require('react-aria-components');
|
|
8
9
|
var commandShortcut = require('./command-shortcut.cjs');
|
|
9
10
|
|
|
@@ -13,7 +14,10 @@ function omit(obj, keys) {
|
|
|
13
14
|
return Object.fromEntries(Object.entries(obj).filter(([key]) => !keysToOmit.has(key)));
|
|
14
15
|
}
|
|
15
16
|
const CommandDropdownMenuItem = ({ label, children, description, stacked, shortcutKeys, className, ...props }) => {
|
|
16
|
-
|
|
17
|
+
const prefix = testIdUtils.useTestIdPrefix();
|
|
18
|
+
const explicitTestId = props['data-testid'];
|
|
19
|
+
const itemTestId = explicitTestId ?? (prefix && props.id !== undefined ? testIdUtils.joinTestId(prefix, `item-${testIdUtils.slugifyTestId(String(props.id))}`) : undefined);
|
|
20
|
+
return (jsxRuntime.jsx(reactAriaComponents.ListBoxItem, { ...omit(props, ['type', 'icon', 'alt', 'src']), "data-testid": itemTestId, textValue: label, className: (state) => cx.cx('group block cursor-pointer px-2 py-0.5 outline-hidden', typeof className === 'function' ? className(state) : className), children: (state) => (jsxRuntime.jsxs("div", { className: cx.cx('relative flex min-h-10 items-center justify-between rounded-lg px-2.5 py-2 pl-2.5 outline-focus-ring transition duration-100 ease-linear hover:bg-primary_hover', state.isSelected && 'bg-primary_hover', state.isFocusVisible && 'outline-2 outline-offset-2', stacked && 'items-start p-2.5 pl-3.5'), children: [props.type === 'icon' && !stacked && jsxRuntime.jsx(props.icon, { className: "mr-2 size-5 text-fg-quaternary" }), props.type === 'icon' && stacked && jsxRuntime.jsx(FeaturedIcon.FeaturedIcon, { color: "gray", size: "md", theme: "modern", icon: props.icon, className: "mr-2" }), props.type === 'avatar' && jsxRuntime.jsx(Avatar.Avatar, { alt: props.alt, src: props.src, size: stacked ? 'md' : 'xs', className: "mr-2" }), props.type === 'dot' && (
|
|
17
21
|
// biome-ignore lint/a11y/noSvgWithoutTitle: svg has no title
|
|
18
22
|
jsxRuntime.jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", className: cx.cx('mr-2 shrink-0 text-fg-success-secondary', stacked && 'mt-2 self-start'), children: jsxRuntime.jsx("circle", { cx: "5", cy: "5", r: "4", fill: "currentColor" }) })), jsxRuntime.jsxs("div", { className: cx.cx('flex flex-1 gap-x-1.5', stacked && 'flex-col'), children: [jsxRuntime.jsx(reactAriaComponents.Text, { slot: "label", className: "text-sm font-medium text-primary", children: typeof children === 'function' ? children(state) : children || label }), description && (jsxRuntime.jsx(reactAriaComponents.Text, { slot: "description", className: "text-sm text-tertiary", children: description }))] }), shortcutKeys && jsxRuntime.jsx(commandShortcut.CommandShortcut, { keys: shortcutKeys })] })) }));
|
|
19
23
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-menu-item.cjs","sources":["../../../../../src/components/organisms/CommandMenu/components/command-menu-item.tsx"],"sourcesContent":[null],"names":["_jsx","ListBoxItem","cx","_jsxs","FeaturedIcon","Avatar","AriaText","CommandShortcut"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-menu-item.cjs","sources":["../../../../../src/components/organisms/CommandMenu/components/command-menu-item.tsx"],"sourcesContent":[null],"names":["useTestIdPrefix","joinTestId","slugifyTestId","_jsx","ListBoxItem","cx","_jsxs","FeaturedIcon","Avatar","AriaText","CommandShort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AAC,OAAO,EAAC,SAAS,EAAC,kCAAkC,EAAA,QAAA,EAChE,OAAO,QAAQ,KAAK,UAAU,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,QAAQ,IAAI,KAAK,EAAA,CAC5D,EACV,WAAW,KACVN,cAAA,CAACM,wBAAQ,EAAA,EAAC,IAAI,EAAC,aAAa,EAAC,SAAS,EAAC,uBAAuB,EAAA,QAAA,EAC3D,WAAW,EAAA,CACH,CACZ,CAAA,EAAA,CACG,EAEL,YAAY,IAAIN,cAAA,CAACO,+BAAe,EAAA,EAAC,IAAI,EAAE,YAAY,EAAA,CAAI,CAAA,EAAA,CACpD,CACP,EAAA,CACW;AAElB;;;;"}
|
|
@@ -6,6 +6,8 @@ interface CommandMenuItemBaseType {
|
|
|
6
6
|
description?: string;
|
|
7
7
|
stacked?: boolean;
|
|
8
8
|
shortcutKeys?: string[];
|
|
9
|
+
/** Overrides the derived `data-testid` for this item (default `<root>--item-<id>`). */
|
|
10
|
+
'data-testid'?: string;
|
|
9
11
|
}
|
|
10
12
|
interface CommandDropdownMenuItemDefaultType extends CommandMenuItemBaseType {
|
|
11
13
|
type?: 'default';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-menu-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/CommandMenu/components/command-menu-item.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-menu-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/organisms/CommandMenu/components/command-menu-item.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAiC,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG7F,UAAU,uBAAuB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,uFAAuF;IACvF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,kCAAmC,SAAQ,uBAAuB;IAC1E,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,UAAU,+BAAgC,SAAQ,uBAAuB;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,EAAE,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClC;AAED,UAAU,iCAAkC,SAAQ,uBAAuB;IACzE,IAAI,EAAE,QAAQ,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,8BAA+B,SAAQ,uBAAuB;IACtE,IAAI,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,MAAM,2BAA2B,GACnC,kCAAkC,GAClC,+BAA+B,GAC/B,iCAAiC,GACjC,8BAA8B,CAAC;AAQnC,MAAM,MAAM,4BAA4B,GAAG,2BAA2B,GAAG,gBAAgB,CAAC;AAE1F,eAAO,MAAM,uBAAuB,GAAI,8EAQrC,4BAA4B,gCAyD9B,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Avatar } from '@flipdish/ui-library/components/atoms/Avatar';
|
|
3
3
|
import { FeaturedIcon } from '@flipdish/ui-library/components/atoms/FeaturedIcon';
|
|
4
4
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
5
|
+
import { useTestIdPrefix, joinTestId, slugifyTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
5
6
|
import { ListBoxItem, Text } from 'react-aria-components';
|
|
6
7
|
import { CommandShortcut } from './command-shortcut.js';
|
|
7
8
|
|
|
@@ -11,7 +12,10 @@ function omit(obj, keys) {
|
|
|
11
12
|
return Object.fromEntries(Object.entries(obj).filter(([key]) => !keysToOmit.has(key)));
|
|
12
13
|
}
|
|
13
14
|
const CommandDropdownMenuItem = ({ label, children, description, stacked, shortcutKeys, className, ...props }) => {
|
|
14
|
-
|
|
15
|
+
const prefix = useTestIdPrefix();
|
|
16
|
+
const explicitTestId = props['data-testid'];
|
|
17
|
+
const itemTestId = explicitTestId ?? (prefix && props.id !== undefined ? joinTestId(prefix, `item-${slugifyTestId(String(props.id))}`) : undefined);
|
|
18
|
+
return (jsx(ListBoxItem, { ...omit(props, ['type', 'icon', 'alt', 'src']), "data-testid": itemTestId, textValue: label, className: (state) => cx('group block cursor-pointer px-2 py-0.5 outline-hidden', typeof className === 'function' ? className(state) : className), children: (state) => (jsxs("div", { className: cx('relative flex min-h-10 items-center justify-between rounded-lg px-2.5 py-2 pl-2.5 outline-focus-ring transition duration-100 ease-linear hover:bg-primary_hover', state.isSelected && 'bg-primary_hover', state.isFocusVisible && 'outline-2 outline-offset-2', stacked && 'items-start p-2.5 pl-3.5'), children: [props.type === 'icon' && !stacked && jsx(props.icon, { className: "mr-2 size-5 text-fg-quaternary" }), props.type === 'icon' && stacked && jsx(FeaturedIcon, { color: "gray", size: "md", theme: "modern", icon: props.icon, className: "mr-2" }), props.type === 'avatar' && jsx(Avatar, { alt: props.alt, src: props.src, size: stacked ? 'md' : 'xs', className: "mr-2" }), props.type === 'dot' && (
|
|
15
19
|
// biome-ignore lint/a11y/noSvgWithoutTitle: svg has no title
|
|
16
20
|
jsx("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "none", className: cx('mr-2 shrink-0 text-fg-success-secondary', stacked && 'mt-2 self-start'), children: jsx("circle", { cx: "5", cy: "5", r: "4", fill: "currentColor" }) })), jsxs("div", { className: cx('flex flex-1 gap-x-1.5', stacked && 'flex-col'), children: [jsx(Text, { slot: "label", className: "text-sm font-medium text-primary", children: typeof children === 'function' ? children(state) : children || label }), description && (jsx(Text, { slot: "description", className: "text-sm text-tertiary", children: description }))] }), shortcutKeys && jsx(CommandShortcut, { keys: shortcutKeys })] })) }));
|
|
17
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-menu-item.js","sources":["../../../../../src/components/organisms/CommandMenu/components/command-menu-item.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaText"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-menu-item.js","sources":["../../../../../src/components/organisms/CommandMenu/components/command-menu-item.tsx"],"sourcesContent":[null],"names":["_jsx","_jsxs","AriaText"],"mappings":";;;;;;;;AA8CA;AACA,SAAS,IAAI,CAAC,GAAW,EAAE,IAAc,EAAA;AACvC,IAAA,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC;AAChC,IAAA,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AACxF;MAIa,uBAAuB,GAAG,CAAC,EACtC,KAAK,EACL,QAAQ,EACR,WAAW,EACX,OAAO,EACP,YAAY,EACZ,SAAS,EACT,GAAG,KAAK,EACqB,KAAI;AACjC,IAAA,MAAM,MAAM,GAAG,eAAe,EAAE;AAChC,IAAA,MAAM,cAAc,GAAI,KAAoC,CAAC,aAAa,CAAC;AAC3E,IAAA,MAAM,UAAU,GAAG,cAAc,KAAK,MAAM,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS,GAAG,UAAU,CAAC,MAAM,EAAE,CAAA,KAAA,EAAQ,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAA,CAAE,CAAC,GAAG,SAAS,CAAC;AAEnJ,IAAA,QACEA,GAAA,CAAC,WAAW,OACN,IAAI,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,EAAA,aAAA,EAClC,UAAU,EACvB,SAAS,E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