@flipdish/ui-library 0.10.0 → 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/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 +4 -2
- package/dist/components/molecules/Select/components/multi-select.cjs.map +1 -1
- package/dist/components/molecules/Select/components/multi-select.d.ts +1 -1
- package/dist/components/molecules/Select/components/multi-select.d.ts.map +1 -1
- package/dist/components/molecules/Select/components/multi-select.js +4 -2
- 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 +6 -4
- package/dist/components/molecules/Select/index.cjs.map +1 -1
- package/dist/components/molecules/Select/index.d.ts +1 -1
- package/dist/components/molecules/Select/index.d.ts.map +1 -1
- package/dist/components/molecules/Select/index.js +6 -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/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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
|
+
import { useResolvedTestId, joinTestId, slugifyTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
3
4
|
import { createContext, useContext } from 'react';
|
|
4
5
|
import { Radio, RadioGroup as RadioGroup$1 } from 'react-aria-components';
|
|
5
6
|
|
|
@@ -14,9 +15,11 @@ RadioButtonBase.displayName = 'RadioButtonBase';
|
|
|
14
15
|
*
|
|
15
16
|
* @summary single-select option used within a mutually exclusive group
|
|
16
17
|
*/
|
|
17
|
-
const RadioButton = ({ label, hint, className, size = 'sm', ...ariaRadioProps }) => {
|
|
18
|
+
const RadioButton = ({ label, hint, className, size = 'sm', 'data-testid': dataTestId, ...ariaRadioProps }) => {
|
|
18
19
|
const context = useContext(RadioGroupContext);
|
|
19
20
|
size = context?.size ?? size;
|
|
21
|
+
const fallbackTestId = useResolvedTestId({ testId: dataTestId, segment: 'radio-button', rootName: 'radio-button' });
|
|
22
|
+
const radioTestId = !dataTestId && context?.testIdPrefix ? joinTestId(context.testIdPrefix, `option-${slugifyTestId(String(ariaRadioProps.value))}`) : fallbackTestId;
|
|
20
23
|
const sizes = {
|
|
21
24
|
sm: {
|
|
22
25
|
root: 'gap-2',
|
|
@@ -31,14 +34,15 @@ const RadioButton = ({ label, hint, className, size = 'sm', ...ariaRadioProps })
|
|
|
31
34
|
hint: 'text-md',
|
|
32
35
|
},
|
|
33
36
|
};
|
|
34
|
-
return (jsx(Radio, { ...ariaRadioProps, className: (state) => cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', sizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isDisabled, isFocusVisible }) => (jsxs(Fragment, { children: [jsx(RadioButtonBase, { size: size, isSelected: isSelected, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxs("div", { className: cx('inline-flex flex-col', sizes[size].textWrapper), children: [label && jsx("p", { className: cx('text-secondary select-none', sizes[size].label), children: label }), hint && (
|
|
37
|
+
return (jsx(Radio, { ...ariaRadioProps, "data-testid": radioTestId, className: (state) => cx('relative flex items-start', state.isDisabled && 'cursor-not-allowed', sizes[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isDisabled, isFocusVisible }) => (jsxs(Fragment, { children: [jsx(RadioButtonBase, { size: size, isSelected: isSelected, isDisabled: isDisabled, isFocusVisible: isFocusVisible, className: label || hint ? 'mt-0.5' : '' }), (label || hint) && (jsxs("div", { className: cx('inline-flex flex-col', sizes[size].textWrapper), children: [label && jsx("p", { className: cx('text-secondary select-none', sizes[size].label), children: label }), hint && (
|
|
35
38
|
// biome-ignore lint/a11y/noStaticElementInteractions: This is a hint that is not interactive
|
|
36
39
|
// biome-ignore lint/a11y/useKeyWithClickEvents: This is a hint that is not interactive
|
|
37
40
|
jsx("span", { className: cx('text-tertiary', sizes[size].hint), onClick: (event) => event.stopPropagation(), children: hint }))] }))] })) }));
|
|
38
41
|
};
|
|
39
42
|
RadioButton.displayName = 'RadioButton';
|
|
40
|
-
const RadioGroup = ({ children, className, size = 'sm', ...props }) => {
|
|
41
|
-
|
|
43
|
+
const RadioGroup = ({ children, className, size = 'sm', 'data-testid': dataTestId, ...props }) => {
|
|
44
|
+
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'radio-group', rootName: 'radio-group' });
|
|
45
|
+
return (jsx(RadioGroupContext.Provider, { value: { size, testIdPrefix: rootTestId }, children: jsx(RadioGroup$1, { ...props, "data-testid": rootTestId, className: cx('flex flex-col gap-4', className), children: children }) }));
|
|
42
46
|
};
|
|
43
47
|
|
|
44
48
|
export { RadioButton, RadioButtonBase, RadioGroup };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/RadioButton/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaRadio","_jsxs","_Fragment","AriaRadioGroup"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/RadioButton/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaRadio","_jsxs","_Fragment","AriaRadioGroup"],"mappings":";;;;;;AAiBA,MAAM,iBAAiB,GAAG,aAAa,CAA+B,IAAI,CAAC;AAUpE,MAAM,eAAe,GAAG,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,GAAG,IAAI,EAAwB,KAAI;IAC1H,QACEA,GAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,wIAAwI,EACxI,IAAI,KAAK,IAAI,IAAI,QAAQ,EACzB,UAAU,IAAI,iCAAiC,EAC/C,UAAU,IAAI,+BAA+B,EAC7C,UAAU,IAAI,CAAC,UAAU,IAAI,aAAa,EAC1C,cAAc,IAAI,+CAA+C,EACjE,SAAS,CACV,EAAA,QAAA,EAEDA,GAAA,CAAA,KAAA,EAAA,EACE,SAAS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AK,EAAmB,KAAI;AACvH,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,CAAC;AAE7G,IAAA,QACEA,GAAA,CAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,YACnEA,GAAA,CAACI,YAAc,EAAA,EAAA,GAAK,KAAK,iBAAe,UAAU,EAAE,SAAS,EAAE,EAAE,CAAC,qBAAqB,EAAE,SAAS,CAAC,EAAA,QAAA,EAChG,QAAQ,EAAA,CACM,EAAA,CACU;AAEjC;;;;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
5
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
5
6
|
var reactAriaComponents = require('react-aria-components');
|
|
6
7
|
|
|
7
8
|
const ToggleBase = ({ className, isHovered, isDisabled, isFocusVisible, isSelected, slim, size = 'sm' }) => {
|
|
@@ -51,8 +52,9 @@ const styles = {
|
|
|
51
52
|
*
|
|
52
53
|
* @summary on/off switch for a single setting
|
|
53
54
|
*/
|
|
54
|
-
const Toggle = ({ label, hint, className, size = 'sm', slim, ...ariaSwitchProps }) => {
|
|
55
|
-
|
|
55
|
+
const Toggle = ({ label, hint, className, size = 'sm', slim, 'data-testid': dataTestId, ...ariaSwitchProps }) => {
|
|
56
|
+
const toggleTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'toggle', rootName: 'toggle' });
|
|
57
|
+
return (jsxRuntime.jsx(reactAriaComponents.Switch, { ...ariaSwitchProps, "data-testid": toggleTestId, className: (state) => cx.cx('relative flex w-max items-start', state.isDisabled && 'cursor-not-allowed', styles[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isDisabled, isFocusVisible, isHovered }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ToggleBase, { slim: slim, size: size, isHovered: isHovered, isDisabled: isDisabled, isFocusVisible: isFocusVisible, isSelected: isSelected, className: slim ? 'mt-0.5' : '' }), (label || hint) && (jsxRuntime.jsxs("div", { className: cx.cx('flex flex-col', styles[size].textWrapper), children: [label && jsxRuntime.jsx("p", { className: cx.cx('text-secondary select-none', styles[size].label), children: label }), hint && (
|
|
56
58
|
// biome-ignore lint/a11y/noStaticElementInteractions: This is a hint that is not interactive
|
|
57
59
|
// biome-ignore lint/a11y/useKeyWithClickEvents: This is a hint that is not interactive
|
|
58
60
|
jsxRuntime.jsx("span", { className: cx.cx('text-tertiary', styles[size].hint), onClick: (event) => event.stopPropagation(), children: hint }))] }))] })) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Toggle/index.tsx"],"sourcesContent":[null],"names":["cx","_jsx","AriaSwitch","_jsxs","_Fragment"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/atoms/Toggle/index.tsx"],"sourcesContent":[null],"names":["cx","_jsx","useResolvedTestId","AriaSwitch","_jsxs","_Fragment"],"mappings":";;;;;;;MAkBa,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAmB,KAAI;AACjI,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,OAAO,EAAE;AACP,YAAA,EAAE,EAAE;AACF,gBAAA,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAEA,KAAE,CAAC,QAAQ,EAAE,UAAU,IAAI,eAAe,CAAC;AACpD,aAAA;AACD,YAAA,EAAE,EAAE;AACF,gBAAA,IAAI,EAAE,gBAAgB;gBACtB,MAAM,EAAEA,KAAE,CAAC,QAAQ,EAAE,UAA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EJ,KAAE,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,EAAA,QAAA,EAAA,CAC1D,KAAK,IAAIC,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAED,KAAE,CAAC,4BAA4B,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAA,QAAA,EAAG,KAAK,EAAA,CAAK,EACxF,IAAI;;;AAGH,wBAAAC,cAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAED,KAAE,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,eAAe,EAAE,EAAA,QAAA,EACjG,IAAI,EAAA,CACA,CACR,IACG,CACP,CAAA,EAAA,CACA,CACJ,EAAA,CACU;AAEjB;;;;;"}
|
|
@@ -15,12 +15,14 @@ export interface ToggleProps extends AriaSwitchProps {
|
|
|
15
15
|
label?: string;
|
|
16
16
|
hint?: ReactNode;
|
|
17
17
|
slim?: boolean;
|
|
18
|
+
/** Overrides the `data-testid` (defaults to `fd-toggle`). */
|
|
19
|
+
'data-testid'?: string;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Switch control for toggling a single setting on or off, with optional label and hint.
|
|
21
23
|
*
|
|
22
24
|
* @summary on/off switch for a single setting
|
|
23
25
|
*/
|
|
24
|
-
export declare const Toggle: ({ label, hint, className, size, slim, ...ariaSwitchProps }: ToggleProps) => import("react").JSX.Element;
|
|
26
|
+
export declare const Toggle: ({ label, hint, className, size, slim, "data-testid": dataTestId, ...ariaSwitchProps }: ToggleProps) => import("react").JSX.Element;
|
|
25
27
|
export {};
|
|
26
28
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Toggle/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Toggle/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG5E,UAAU,eAAe;IACvB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,UAAU,GAAI,8EAAqF,eAAe,gCA0D9H,CAAC;AAiBF,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,6DAA6D;IAC7D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,GAAI,uFAA8F,WAAW,gCA4C/H,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
|
+
import { useResolvedTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
3
4
|
import { Switch } from 'react-aria-components';
|
|
4
5
|
|
|
5
6
|
const ToggleBase = ({ className, isHovered, isDisabled, isFocusVisible, isSelected, slim, size = 'sm' }) => {
|
|
@@ -49,8 +50,9 @@ const styles = {
|
|
|
49
50
|
*
|
|
50
51
|
* @summary on/off switch for a single setting
|
|
51
52
|
*/
|
|
52
|
-
const Toggle = ({ label, hint, className, size = 'sm', slim, ...ariaSwitchProps }) => {
|
|
53
|
-
|
|
53
|
+
const Toggle = ({ label, hint, className, size = 'sm', slim, 'data-testid': dataTestId, ...ariaSwitchProps }) => {
|
|
54
|
+
const toggleTestId = useResolvedTestId({ testId: dataTestId, segment: 'toggle', rootName: 'toggle' });
|
|
55
|
+
return (jsx(Switch, { ...ariaSwitchProps, "data-testid": toggleTestId, className: (state) => cx('relative flex w-max items-start', state.isDisabled && 'cursor-not-allowed', styles[size].root, typeof className === 'function' ? className(state) : className), children: ({ isSelected, isDisabled, isFocusVisible, isHovered }) => (jsxs(Fragment, { children: [jsx(ToggleBase, { slim: slim, size: size, isHovered: isHovered, isDisabled: isDisabled, isFocusVisible: isFocusVisible, isSelected: isSelected, className: slim ? 'mt-0.5' : '' }), (label || hint) && (jsxs("div", { className: cx('flex flex-col', styles[size].textWrapper), children: [label && jsx("p", { className: cx('text-secondary select-none', styles[size].label), children: label }), hint && (
|
|
54
56
|
// biome-ignore lint/a11y/noStaticElementInteractions: This is a hint that is not interactive
|
|
55
57
|
// biome-ignore lint/a11y/useKeyWithClickEvents: This is a hint that is not interactive
|
|
56
58
|
jsx("span", { className: cx('text-tertiary', styles[size].hint), onClick: (event) => event.stopPropagation(), children: hint }))] }))] })) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Toggle/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaSwitch","_jsxs","_Fragment"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/atoms/Toggle/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaSwitch","_jsxs","_Fragment"],"mappings":";;;;;MAkBa,UAAU,GAAG,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI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AAC,UAAU,EAAA,EACT,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,IAAI,GAAG,QAAQ,GAAG,EAAE,EAAA,CAC/B,EAED,CAAC,KAAK,IAAI,IAAI,MACbE,IAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,EAAA,QAAA,EAAA,CAC1D,KAAK,IAAIF,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAE,EAAE,CAAC,4BAA4B,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAA,QAAA,EAAG,KAAK,EAAA,CAAK,EACxF,IAAI;;;AAGH,wBAAAA,GAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC,KAAK,KAAK,KAAK,CAAC,eAAe,EAAE,EAAA,QAAA,EACjG,IAAI,EAAA,CACA,CACR,IACG,CACP,CAAA,EAAA,CACA,CACJ,EAAA,CACU;AAEjB;;;;"}
|
|
@@ -7,6 +7,7 @@ var RadioButton = require('@flipdish/ui-library/components/atoms/RadioButton');
|
|
|
7
7
|
var Breadcrumbs = require('@flipdish/ui-library/components/molecules/Breadcrumbs');
|
|
8
8
|
var Dropdown = require('@flipdish/ui-library/components/molecules/Dropdown');
|
|
9
9
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
10
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
10
11
|
var React = require('react');
|
|
11
12
|
var reactAriaComponents = require('react-aria-components');
|
|
12
13
|
|
|
@@ -14,7 +15,8 @@ const BreadcrumbAccountItem = ({ items, selectedKey, onSelectionChange }) => {
|
|
|
14
15
|
const context = React.useContext(Breadcrumbs.BreadcrumbsContext);
|
|
15
16
|
const divider = context.divider || 'chevron';
|
|
16
17
|
const selectedAccount = items.find((item) => item.id === selectedKey);
|
|
17
|
-
|
|
18
|
+
const accountTestId = context.testIdPrefix ? testIdUtils.joinTestId(context.testIdPrefix, 'account') : undefined;
|
|
19
|
+
return (jsxRuntime.jsx(reactAriaComponents.Breadcrumb, { className: "flex items-center gap-1.5 md:gap-2", children: ({ isCurrent }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Dropdown.Dropdown.Root, { children: [jsxRuntime.jsxs(reactAriaComponents.Button, { "data-testid": accountTestId, "aria-label": "Switch account", className: ({ isPressed, isFocusVisible }) => cx.cx('flex cursor-pointer items-center gap-1.5 rounded-lg outline-0 outline-offset-2 outline-focus-ring', (isPressed || isFocusVisible) && 'outline-2'), children: [jsxRuntime.jsx("div", { className: "flex rounded-lg bg-primary p-0.5 ring-[0.5px] ring-secondary ring-inset", children: jsxRuntime.jsx(Avatar.Avatar, { size: "xs", src: selectedAccount?.avatar, className: "shadow-md", contentClassName: "rounded-md before:hidden" }) }), jsxRuntime.jsx("span", { className: "text-sm font-semibold text-primary", children: selectedAccount?.name }), jsxRuntime.jsx(uiIcons.ChevronSelectorVertical, { className: "size-3 shrink-0 stroke-3 text-fg-quaternary" })] }), jsxRuntime.jsx(Dropdown.Dropdown.Popover, { className: "w-62", placement: "bottom left", children: jsxRuntime.jsx(Dropdown.Dropdown.Menu, { disallowEmptySelection: true, selectionMode: "single", selectedKeys: [selectedKey], onSelectionChange: (keys) => onSelectionChange(Array.from(keys).join()), className: "flex flex-col gap-1 px-1.5 py-1.5", children: items.map((account) => (jsxRuntime.jsx(reactAriaComponents.MenuItem, { id: account.id, textValue: account.name, "data-testid": accountTestId ? testIdUtils.joinTestId(accountTestId, `menu-item-${account.id}`) : undefined, className: (state) => cx.cx('relative w-full cursor-pointer rounded-md px-2 py-2 text-left outline-0 outline-offset-2 outline-focus-ring transition duration-100 ease-linear hover:bg-primary_hover focus:z-10 focus-visible:outline-2', state.isSelected && 'bg-primary_hover'), children: ({ isSelected }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("figure", { className: "group flex min-w-0 flex-1 items-center gap-1.5", children: [jsxRuntime.jsx("div", { className: "flex rounded-[10px] bg-primary p-0.5 ring-[0.5px] ring-secondary ring-inset", children: jsxRuntime.jsx(Avatar.Avatar, { size: "sm", src: account.avatar, className: "shadow-md", contentClassName: "rounded-lg before:hidden" }) }), jsxRuntime.jsxs("figcaption", { className: "min-w-0 flex-1", children: [jsxRuntime.jsx("p", { className: "text-sm font-semibold text-primary", children: account.name }), jsxRuntime.jsx("p", { className: "truncate text-sm text-tertiary", children: account.email })] })] }), jsxRuntime.jsx(RadioButton.RadioButtonBase, { isSelected: isSelected, className: "absolute top-2 right-2" })] })) }, account.id))) }) })] }), !isCurrent &&
|
|
18
20
|
(divider === 'slash' ? (jsxRuntime.jsx(uiIcons.SlashDivider, { className: "size-4 shrink-0 stroke-[2.25px] text-utility-neutral-300" })) : (jsxRuntime.jsx(uiIcons.ChevronRight, { className: "size-4 shrink-0 stroke-[2.25px] text-utility-neutral-300" })))] })) }));
|
|
19
21
|
};
|
|
20
22
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb-account-item.cjs","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-account-item.tsx"],"sourcesContent":[null],"names":["useContext","BreadcrumbsContext","_jsx","AriaBreadcrumb","_jsxs","_Fragment","Dropdown","AriaButton","cx","Avatar","ChevronSelectorVertical","AriaMenuItem","RadioButtonBase","SlashDivider","ChevronRight"],"mappings":"
|
|
1
|
+
{"version":3,"file":"breadcrumb-account-item.cjs","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-account-item.tsx"],"sourcesContent":[null],"names":["useContext","BreadcrumbsContext","joinTestId","_jsx","AriaBreadcrumb","_jsxs","_Fragment","Dropdown","AriaButton","cx","Avatar","ChevronSelectorVertical","AriaMenuItem","RadioButtonBase","SlashDivider","ChevronRight"],"mappings":";;;;;;;;;;;;;AAyBO,MAAM,qBAAqB,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAA8B,KAAI;AAC7G,IAAA,MAAM,OAAO,GAAGA,gBAAU,CAACC,8BAAkB,CAAC;AAC9C,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,SAAS;AAC5C,IAAA,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,KAAK,WAAW,CAAC;IAErE,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,GAAGC,sBAAU,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG,SAAS;AAEpG,IAAA,QACEC,cAAA,CAACC,8BAAc,EAAA,EAAC,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAC3D,CAAC,EAAE,SAAS,EAAE,MACbC,eAAA,CAAAC,mBAAA,EAAA,EAAA,QAAA,EAAA,CACED,eAAA,CAACE,iBAAQ,CAAC,IAAI,EAAA,EAAA,QAAA,EAAA,CACZF,eAAA,CAACG,0BAAU,mBACI,aAAa,EAAA,YAAA,EACf,gBAAgB,EAC3B,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,KACvCC,KAAE,CACA,mGAAmG,EACnG,CAAC,SAAS,IAAI,cAAc,KAAK,WAAW,CAC7C,EAAA,QAAA,EAAA,CAGHN,wBAAK,SAAS,EAAC,yEAAyE,EAAA,QAAA,EACtFA,eAACO,aAAM,EAAA,EAAC,IAAI,EAAC,IAAI,EAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,SAAS,EAAC,WAAW,EAAC,gBAAgB,EAAC,0BAA0B,EAAA,CAAG,EAAA,CAChH,EACNP,cAAA,CAAA,M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B,EAAA,CAAG,EAAA,CACvG,EACNL,eAAA,CAAA,YAAA,EAAA,EAAY,SAAS,EAAC,gBAAgB,EAAA,QAAA,EAAA,CACpCF,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAE,OAAO,CAAC,IAAI,EAAA,CAAK,EACpEA,cAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,gCAAgC,EAAA,QAAA,EAAE,OAAO,CAAC,KAAK,EAAA,CAAK,CAAA,EAAA,CACtD,CAAA,EAAA,CACN,EACTA,cAAA,CAACU,2BAAe,EAAA,EAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC,wBAAwB,EAAA,CAAG,CAAA,EAAA,CAC7E,CACJ,EAAA,EAvBI,OAAO,CAAC,EAAE,CAwBF,CAChB,CAAC,EAAA,CACY,EAAA,CACC,CAAA,EAAA,CACL,EAEf,CAAC,SAAS;AACT,qBAAC,OAAO,KAAK,OAAO,IAClBV,cAAA,CAACW,oBAAY,EAAA,EAAC,SAAS,EAAC,0DAA0D,GAAG,KAErFX,cAAA,CAACY,oBAAY,EAAA,EAAC,SAAS,EAAC,0DAA0D,EAAA,CAAG,CACtF,CAAC,CAAA,EAAA,CACH,CACJ,EAAA,CACc;AAErB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb-account-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-account-item.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"breadcrumb-account-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-account-item.tsx"],"names":[],"mappings":"AAYA,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,yBAAyB,EAAE,CAAC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C;AAED,eAAO,MAAM,qBAAqB,GAAI,2CAA2C,0BAA0B,gCAiF1G,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { RadioButtonBase } from '@flipdish/ui-library/components/atoms/RadioButt
|
|
|
5
5
|
import { BreadcrumbsContext } from '@flipdish/ui-library/components/molecules/Breadcrumbs';
|
|
6
6
|
import { Dropdown } from '@flipdish/ui-library/components/molecules/Dropdown';
|
|
7
7
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
8
|
+
import { joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
8
9
|
import { useContext } from 'react';
|
|
9
10
|
import { Breadcrumb, Button, MenuItem } from 'react-aria-components';
|
|
10
11
|
|
|
@@ -12,7 +13,8 @@ const BreadcrumbAccountItem = ({ items, selectedKey, onSelectionChange }) => {
|
|
|
12
13
|
const context = useContext(BreadcrumbsContext);
|
|
13
14
|
const divider = context.divider || 'chevron';
|
|
14
15
|
const selectedAccount = items.find((item) => item.id === selectedKey);
|
|
15
|
-
|
|
16
|
+
const accountTestId = context.testIdPrefix ? joinTestId(context.testIdPrefix, 'account') : undefined;
|
|
17
|
+
return (jsx(Breadcrumb, { className: "flex items-center gap-1.5 md:gap-2", children: ({ isCurrent }) => (jsxs(Fragment, { children: [jsxs(Dropdown.Root, { children: [jsxs(Button, { "data-testid": accountTestId, "aria-label": "Switch account", className: ({ isPressed, isFocusVisible }) => cx('flex cursor-pointer items-center gap-1.5 rounded-lg outline-0 outline-offset-2 outline-focus-ring', (isPressed || isFocusVisible) && 'outline-2'), children: [jsx("div", { className: "flex rounded-lg bg-primary p-0.5 ring-[0.5px] ring-secondary ring-inset", children: jsx(Avatar, { size: "xs", src: selectedAccount?.avatar, className: "shadow-md", contentClassName: "rounded-md before:hidden" }) }), jsx("span", { className: "text-sm font-semibold text-primary", children: selectedAccount?.name }), jsx(ChevronSelectorVertical, { className: "size-3 shrink-0 stroke-3 text-fg-quaternary" })] }), jsx(Dropdown.Popover, { className: "w-62", placement: "bottom left", children: jsx(Dropdown.Menu, { disallowEmptySelection: true, selectionMode: "single", selectedKeys: [selectedKey], onSelectionChange: (keys) => onSelectionChange(Array.from(keys).join()), className: "flex flex-col gap-1 px-1.5 py-1.5", children: items.map((account) => (jsx(MenuItem, { id: account.id, textValue: account.name, "data-testid": accountTestId ? joinTestId(accountTestId, `menu-item-${account.id}`) : undefined, className: (state) => cx('relative w-full cursor-pointer rounded-md px-2 py-2 text-left outline-0 outline-offset-2 outline-focus-ring transition duration-100 ease-linear hover:bg-primary_hover focus:z-10 focus-visible:outline-2', state.isSelected && 'bg-primary_hover'), children: ({ isSelected }) => (jsxs(Fragment, { children: [jsxs("figure", { className: "group flex min-w-0 flex-1 items-center gap-1.5", children: [jsx("div", { className: "flex rounded-[10px] bg-primary p-0.5 ring-[0.5px] ring-secondary ring-inset", children: jsx(Avatar, { size: "sm", src: account.avatar, className: "shadow-md", contentClassName: "rounded-lg before:hidden" }) }), jsxs("figcaption", { className: "min-w-0 flex-1", children: [jsx("p", { className: "text-sm font-semibold text-primary", children: account.name }), jsx("p", { className: "truncate text-sm text-tertiary", children: account.email })] })] }), jsx(RadioButtonBase, { isSelected: isSelected, className: "absolute top-2 right-2" })] })) }, account.id))) }) })] }), !isCurrent &&
|
|
16
18
|
(divider === 'slash' ? (jsx(SlashDivider, { className: "size-4 shrink-0 stroke-[2.25px] text-utility-neutral-300" })) : (jsx(ChevronRight, { className: "size-4 shrink-0 stroke-[2.25px] text-utility-neutral-300" })))] })) }));
|
|
17
19
|
};
|
|
18
20
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb-account-item.js","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-account-item.tsx"],"sourcesContent":[null],"names":["_jsx","AriaBreadcrumb","_jsxs","_Fragment","AriaButton","AriaMenuItem"],"mappings":"
|
|
1
|
+
{"version":3,"file":"breadcrumb-account-item.js","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-account-item.tsx"],"sourcesContent":[null],"names":["_jsx","AriaBreadcrumb","_jsxs","_Fragment","AriaButton","AriaMenuItem"],"mappings":";;;;;;;;;;;AAyBO,MAAM,qBAAqB,GAAG,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAA8B,KAAI;AAC7G,IAAA,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,CAAC;AAC9C,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,SAAS;AAC5C,IAAA,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,KAAK,WAAW,CAAC;IAErE,MAAM,aAAa,GAAG,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,GAAG,SAAS;AAEpG,IAAA,QACEA,GAAA,CAACC,UAAc,EAAA,EAAC,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAC3D,CAAC,EAAE,SAAS,EAAE,MACbC,IAAA,CAAAC,QAAA,EAAA,EAAA,QAAA,EAAA,CACED,IAAA,CAAC,QAAQ,CAAC,IAAI,EAAA,EAAA,QAAA,EAAA,CACZA,IAAA,CAACE,MAAU,mBACI,aAAa,EAAA,YAAA,EACf,gBAAgB,EAC3B,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,KACvC,EAAE,CACA,mGAAmG,EACnG,CAAC,SAAS,IAAI,cAAc,KAAK,WAAW,CAC7C,EAAA,QAAA,EAAA,CAGHJ,aAAK,SAAS,EAAC,yEAAyE,EAAA,QAAA,EACtFA,IAAC,MAAM,EAAA,EAAC,IAAI,EAAC,IAAI,EAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE,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,EAAE,OAAO,CAAC,MAAM,EAAE,SAAS,EAAC,WAAW,EAAC,gBAAgB,EAAC,0BAA0B,EAAA,CAAG,EAAA,CACvG,EACNE,IAAA,CAAA,YAAA,EAAA,EAAY,SAAS,EAAC,gBAAgB,EAAA,QAAA,EAAA,CACpCF,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,oCAAoC,EAAA,QAAA,EAAE,OAAO,CAAC,IAAI,EAAA,CAAK,EACpEA,GAAA,CAAA,GAAA,EAAA,EAAG,SAAS,EAAC,gCAAgC,EAAA,QAAA,EAAE,OAAO,CAAC,KAAK,EAAA,CAAK,CAAA,EAAA,CACtD,CAAA,EAAA,CACN,EACTA,GAAA,CAAC,eAAe,EAAA,EAAC,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC,wBAAwB,EAAA,CAAG,CAAA,EAAA,CAC7E,CACJ,EAAA,EAvBI,OAAO,CAAC,EAAE,CAwBF,CAChB,CAAC,EAAA,CACY,EAAA,CACC,CAAA,EAAA,CACL,EAEf,CAAC,SAAS;AACT,qBAAC,OAAO,KAAK,OAAO,IAClBA,GAAA,CAAC,YAAY,EAAA,EAAC,SAAS,EAAC,0DAA0D,GAAG,KAErFA,GAAA,CAAC,YAAY,EAAA,EAAC,SAAS,EAAC,0DAA0D,EAAA,CAAG,CACtF,CAAC,CAAA,EAAA,CACH,CACJ,EAAA,CACc;AAErB;;;;"}
|
|
@@ -5,6 +5,7 @@ var uiIcons = require('@flipdish/ui-icons');
|
|
|
5
5
|
var Avatar = require('@flipdish/ui-library/components/atoms/Avatar');
|
|
6
6
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
7
7
|
var isReactComponent = require('@flipdish/ui-library/utilities/isReactComponent');
|
|
8
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
8
9
|
var React = require('react');
|
|
9
10
|
var reactAriaComponents = require('react-aria-components');
|
|
10
11
|
var index = require('../index.cjs');
|
|
@@ -27,20 +28,23 @@ const baseStyles = {
|
|
|
27
28
|
current: { root: 'bg-primary_hover', icon: 'text-fg-quaternary_hover', label: 'text-fg-tertiary_hover' },
|
|
28
29
|
},
|
|
29
30
|
};
|
|
30
|
-
const BreadcrumbBase = ({ href, children, icon: Icon, type = 'text', current, className, ...otherProps }) => {
|
|
31
|
-
return (jsxRuntime.jsxs(reactAriaComponents.Link, { ...otherProps,
|
|
31
|
+
const BreadcrumbBase = ({ href, children, icon: Icon, type = 'text', current, className, 'data-testid': dataTestId, ...otherProps }) => {
|
|
32
|
+
return (jsxRuntime.jsxs(reactAriaComponents.Link, { ...otherProps, "data-testid": dataTestId,
|
|
32
33
|
// Guard against an empty-string href: react-aria renders `<a>` only for a truthy
|
|
33
34
|
// href (a falsy value renders a non-navigable `<span role="link">`), so coerce
|
|
34
35
|
// `''`/undefined to undefined to keep href-less/current items non-interactive.
|
|
35
36
|
href: href || undefined, className: (state) => cx.cx('group inline-flex items-center justify-center gap-1 rounded-md outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2 focus-visible:outline-offset-2 in-current:max-w-full', baseStyles[type].root, current && baseStyles[type].current.root, (href || otherProps.onClick) && 'cursor-pointer', typeof className === 'function' ? className(state) : className), children: [isReactComponent.isReactComponent(Icon) && (jsxRuntime.jsx(Icon, { className: cx.cx('size-5 transition-inherit-all', baseStyles[type].icon, current && baseStyles[type].current.icon) })), React.isValidElement(Icon) && Icon, children && (jsxRuntime.jsx("span", { className: cx.cx('text-sm font-semibold whitespace-nowrap transition-inherit-all in-current:truncate', baseStyles[type].label, current && baseStyles[type].current.label), children: children }))] }));
|
|
36
37
|
};
|
|
37
|
-
const BreadcrumbItem = ({ href, icon, divider, type, isEllipsis, children, onClick, avatarSrc, className, ...otherProps }) => {
|
|
38
|
+
const BreadcrumbItem = ({ href, icon, divider, type, isEllipsis, children, onClick, avatarSrc, className, id, 'data-testid': dataTestId, ...otherProps }) => {
|
|
38
39
|
const context = React.useContext(index.BreadcrumbsContext);
|
|
39
40
|
type = context.type || 'text';
|
|
40
41
|
divider = context.divider || 'chevron';
|
|
41
|
-
|
|
42
|
+
const prefix = context.testIdPrefix;
|
|
43
|
+
const itemSegment = id ?? (typeof children === 'string' ? testIdUtils.slugifyTestId(children) : href ? testIdUtils.slugifyTestId(href) : undefined);
|
|
44
|
+
const itemTestId = dataTestId ?? (prefix ? testIdUtils.joinTestId(prefix, isEllipsis ? 'ellipsis' : itemSegment ? `item-${itemSegment}` : 'item') : undefined);
|
|
45
|
+
return (jsxRuntime.jsx(reactAriaComponents.Breadcrumb, { ...otherProps, className: cx.cx('flex items-center current:overflow-hidden', avatarSrc ? 'gap-1.5 md:gap-2' : type === 'text' || type === 'text-line' ? 'gap-1.5 md:gap-2' : 'gap-0.5 md:gap-1', className), children: ({ isCurrent }) => (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [avatarSrc ? (jsxRuntime.jsxs(reactAriaComponents.Link, { href: href || undefined, "data-testid": itemTestId, className: ({ isPressed, isFocusVisible }) => cx.cx('flex cursor-pointer items-center gap-1.5 rounded-lg outline-0 outline-offset-2 outline-focus-ring', (isPressed || isFocusVisible) && 'outline-2'), children: [jsxRuntime.jsx("div", { className: "flex rounded-lg bg-primary p-0.5 ring-[0.5px] ring-secondary ring-inset", children: jsxRuntime.jsx(Avatar.Avatar, { size: "xs", src: avatarSrc, className: "shadow-md", contentClassName: "rounded-md before:hidden" }) }), children && jsxRuntime.jsx("span", { className: "text-sm font-semibold text-primary", children: children })] })) : isEllipsis ? (jsxRuntime.jsx(BreadcrumbBase
|
|
42
46
|
// The label for screen readers.
|
|
43
|
-
, { "aria-label": "See all breadcrumb items", type: type === 'text-line' ? 'text' : type, onClick: onClick, children: "..." })) : (jsxRuntime.jsx(BreadcrumbBase, { href: href, icon: icon, current: isCurrent, type: type === 'text-line' ? 'text' : type, onClick: onClick, children: children })), !isCurrent &&
|
|
47
|
+
, { "aria-label": "See all breadcrumb items", type: type === 'text-line' ? 'text' : type, onClick: onClick, "data-testid": itemTestId, children: "..." })) : (jsxRuntime.jsx(BreadcrumbBase, { href: href, icon: icon, current: isCurrent, type: type === 'text-line' ? 'text' : type, onClick: onClick, "data-testid": itemTestId, children: children })), !isCurrent &&
|
|
44
48
|
(divider === 'slash' ? (jsxRuntime.jsx(uiIcons.SlashDivider, { className: "size-4 shrink-0 stroke-[2.25px] text-utility-neutral-300" })) : (jsxRuntime.jsx(uiIcons.ChevronRight, { className: "size-4 shrink-0 stroke-[2.25px] text-utility-neutral-300" })))] })) }));
|
|
45
49
|
};
|
|
46
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb-item.cjs","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-item.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaLink","cx","isReactComponent","_jsx","isValidElement","useContext","BreadcrumbsContext","AriaBreadcrumb","_Fragment","Avatar","SlashDivider","ChevronRight"],"mappings":"
|
|
1
|
+
{"version":3,"file":"breadcrumb-item.cjs","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-item.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaLink","cx","isReactComponent","_jsx","isValidElement","useContext","BreadcrumbsContext","slugifyTestId","joinTestId","AriaBreadcrumb","_Fragment","Avatar","SlashDivider","ChevronRight"],"mappings":";;;;;;;;;;;;AAgBA,MAAM,UAAU,GAAG;AACjB,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,IAAI,EAAE,yDAAyD;AAC/D,QAAA,KAAK,EAAE,iDAAiD;AACxD,QAAA,OAAO,EAAE;AACP,YAAA,IAAI,EAAE,EAAE;AACR,YAAA,IAAI,EAAE,yDAAyD;AAC/D,YAAA,KAAK,EAAE,uDAAuD;AAC/D,SAAA;AACF,KAAA;AACD,IAAA,MAAM,EAAE;AACN,QAAA,IAAI,EAAE,4BAA4B;AAClC,QAAA,IAAI,EAAE,yDAAyD;AAC/D,QAAA,KAAK,EAAE,sDAAsD;AAC7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@ export interface BreadcrumbItemProps extends AriaBreadcrumbProps {
|
|
|
14
14
|
/** Avatar image URL. Renders an avatar-in-ring instead of the default icon + label. */
|
|
15
15
|
avatarSrc?: string;
|
|
16
16
|
onClick?: () => void;
|
|
17
|
+
/** Stable id used to derive this item's `data-testid` (falls back to a slug of `children`/`href`). */
|
|
18
|
+
id?: string;
|
|
19
|
+
/** Overrides the derived `data-testid` for this item. */
|
|
20
|
+
'data-testid'?: string;
|
|
17
21
|
}
|
|
18
|
-
export declare const BreadcrumbItem: ({ href, icon, divider, type, isEllipsis, children, onClick, avatarSrc, className, ...otherProps }: BreadcrumbItemProps) => import("react").JSX.Element;
|
|
22
|
+
export declare const BreadcrumbItem: ({ href, icon, divider, type, isEllipsis, children, onClick, avatarSrc, className, id, "data-testid": dataTestId, ...otherProps }: BreadcrumbItemProps) => import("react").JSX.Element;
|
|
19
23
|
//# sourceMappingURL=breadcrumb-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-item.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"breadcrumb-item.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-item.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,EAAE,EAAkB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAC;AAC5E,OAAO,EAEL,KAAK,eAAe,IAAI,mBAAmB,EAG5C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AA6EnE,MAAM,WAAW,mBAAoB,SAAQ,mBAAmB;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,EAAE,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IAC9C,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,sGAAsG;IACtG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,GAAI,kIAa5B,mBAAmB,gCAuErB,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { SlashDivider, ChevronRight } from '@flipdish/ui-icons';
|
|
|
3
3
|
import { Avatar } from '@flipdish/ui-library/components/atoms/Avatar';
|
|
4
4
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
5
5
|
import { isReactComponent } from '@flipdish/ui-library/utilities/isReactComponent';
|
|
6
|
+
import { slugifyTestId, joinTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
6
7
|
import { useContext, isValidElement } from 'react';
|
|
7
8
|
import { Breadcrumb, Link } from 'react-aria-components';
|
|
8
9
|
import { BreadcrumbsContext } from '../index.js';
|
|
@@ -25,20 +26,23 @@ const baseStyles = {
|
|
|
25
26
|
current: { root: 'bg-primary_hover', icon: 'text-fg-quaternary_hover', label: 'text-fg-tertiary_hover' },
|
|
26
27
|
},
|
|
27
28
|
};
|
|
28
|
-
const BreadcrumbBase = ({ href, children, icon: Icon, type = 'text', current, className, ...otherProps }) => {
|
|
29
|
-
return (jsxs(Link, { ...otherProps,
|
|
29
|
+
const BreadcrumbBase = ({ href, children, icon: Icon, type = 'text', current, className, 'data-testid': dataTestId, ...otherProps }) => {
|
|
30
|
+
return (jsxs(Link, { ...otherProps, "data-testid": dataTestId,
|
|
30
31
|
// Guard against an empty-string href: react-aria renders `<a>` only for a truthy
|
|
31
32
|
// href (a falsy value renders a non-navigable `<span role="link">`), so coerce
|
|
32
33
|
// `''`/undefined to undefined to keep href-less/current items non-interactive.
|
|
33
34
|
href: href || undefined, className: (state) => cx('group inline-flex items-center justify-center gap-1 rounded-md outline-focus-ring transition duration-100 ease-linear focus-visible:outline-2 focus-visible:outline-offset-2 in-current:max-w-full', baseStyles[type].root, current && baseStyles[type].current.root, (href || otherProps.onClick) && 'cursor-pointer', typeof className === 'function' ? className(state) : className), children: [isReactComponent(Icon) && (jsx(Icon, { className: cx('size-5 transition-inherit-all', baseStyles[type].icon, current && baseStyles[type].current.icon) })), isValidElement(Icon) && Icon, children && (jsx("span", { className: cx('text-sm font-semibold whitespace-nowrap transition-inherit-all in-current:truncate', baseStyles[type].label, current && baseStyles[type].current.label), children: children }))] }));
|
|
34
35
|
};
|
|
35
|
-
const BreadcrumbItem = ({ href, icon, divider, type, isEllipsis, children, onClick, avatarSrc, className, ...otherProps }) => {
|
|
36
|
+
const BreadcrumbItem = ({ href, icon, divider, type, isEllipsis, children, onClick, avatarSrc, className, id, 'data-testid': dataTestId, ...otherProps }) => {
|
|
36
37
|
const context = useContext(BreadcrumbsContext);
|
|
37
38
|
type = context.type || 'text';
|
|
38
39
|
divider = context.divider || 'chevron';
|
|
39
|
-
|
|
40
|
+
const prefix = context.testIdPrefix;
|
|
41
|
+
const itemSegment = id ?? (typeof children === 'string' ? slugifyTestId(children) : href ? slugifyTestId(href) : undefined);
|
|
42
|
+
const itemTestId = dataTestId ?? (prefix ? joinTestId(prefix, isEllipsis ? 'ellipsis' : itemSegment ? `item-${itemSegment}` : 'item') : undefined);
|
|
43
|
+
return (jsx(Breadcrumb, { ...otherProps, className: cx('flex items-center current:overflow-hidden', avatarSrc ? 'gap-1.5 md:gap-2' : type === 'text' || type === 'text-line' ? 'gap-1.5 md:gap-2' : 'gap-0.5 md:gap-1', className), children: ({ isCurrent }) => (jsxs(Fragment, { children: [avatarSrc ? (jsxs(Link, { href: href || undefined, "data-testid": itemTestId, className: ({ isPressed, isFocusVisible }) => cx('flex cursor-pointer items-center gap-1.5 rounded-lg outline-0 outline-offset-2 outline-focus-ring', (isPressed || isFocusVisible) && 'outline-2'), children: [jsx("div", { className: "flex rounded-lg bg-primary p-0.5 ring-[0.5px] ring-secondary ring-inset", children: jsx(Avatar, { size: "xs", src: avatarSrc, className: "shadow-md", contentClassName: "rounded-md before:hidden" }) }), children && jsx("span", { className: "text-sm font-semibold text-primary", children: children })] })) : isEllipsis ? (jsx(BreadcrumbBase
|
|
40
44
|
// The label for screen readers.
|
|
41
|
-
, { "aria-label": "See all breadcrumb items", type: type === 'text-line' ? 'text' : type, onClick: onClick, children: "..." })) : (jsx(BreadcrumbBase, { href: href, icon: icon, current: isCurrent, type: type === 'text-line' ? 'text' : type, onClick: onClick, children: children })), !isCurrent &&
|
|
45
|
+
, { "aria-label": "See all breadcrumb items", type: type === 'text-line' ? 'text' : type, onClick: onClick, "data-testid": itemTestId, children: "..." })) : (jsx(BreadcrumbBase, { href: href, icon: icon, current: isCurrent, type: type === 'text-line' ? 'text' : type, onClick: onClick, "data-testid": itemTestId, children: children })), !isCurrent &&
|
|
42
46
|
(divider === 'slash' ? (jsx(SlashDivider, { className: "size-4 shrink-0 stroke-[2.25px] text-utility-neutral-300" })) : (jsx(ChevronRight, { className: "size-4 shrink-0 stroke-[2.25px] text-utility-neutral-300" })))] })) }));
|
|
43
47
|
};
|
|
44
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb-item.js","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-item.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaLink","_jsx","AriaBreadcrumb","_Fragment"],"mappings":"
|
|
1
|
+
{"version":3,"file":"breadcrumb-item.js","sources":["../../../../../src/components/molecules/Breadcrumbs/components/breadcrumb-item.tsx"],"sourcesContent":[null],"names":["_jsxs","AriaLink","_jsx","AriaBreadcrumb","_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ClB,IAAI,EAAE,IAAI,KAAK,WAAW,GAAG,MAAM,GAAG,IAAI,EAC1C,OAAO,EAAE,OAAO,EAAA,aAAA,EACH,UAAU,EAAA,QAAA,EAEtB,QAAQ,EAAA,CACM,CAClB,EAGA,CAAC,SAAS;AACT,qBAAC,OAAO,KAAK,OAAO,IAClBA,GAAA,CAAC,YAAY,EAAA,EAAC,SAAS,EAAC,0DAA0D,GAAG,KAErFA,GAAA,CAAC,YAAY,EAAA,EAAC,SAAS,EAAC,0DAA0D,EAAA,CAAG,CACtF,CAAC,CAAA,EAAA,CACH,CACJ,EAAA,CACc;AAErB;;;;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var cx = require('@flipdish/ui-library/utilities/cx');
|
|
5
|
+
var testIdUtils = require('@flipdish/ui-library/utilities/testIdUtils');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
var reactAriaComponents = require('react-aria-components');
|
|
7
8
|
var breadcrumbAccountItem = require('./components/breadcrumb-account-item.cjs');
|
|
@@ -22,8 +23,9 @@ const styles = {
|
|
|
22
23
|
*
|
|
23
24
|
* @summary navigable trail of links showing the user's location in the hierarchy
|
|
24
25
|
*/
|
|
25
|
-
const Breadcrumbs = ({ children, divider = 'chevron', type = 'text', className, maxVisibleItems = 4 }) => {
|
|
26
|
+
const Breadcrumbs = ({ children, divider = 'chevron', type = 'text', className, maxVisibleItems = 4, 'data-testid': dataTestId, }) => {
|
|
26
27
|
const [isExpanded, setIsExpanded] = React.useState(false);
|
|
28
|
+
const rootTestId = testIdUtils.useResolvedTestId({ testId: dataTestId, segment: 'breadcrumbs', rootName: 'breadcrumbs' });
|
|
27
29
|
const visibleItems = (() => {
|
|
28
30
|
const childrenArray = React.Children.toArray(children);
|
|
29
31
|
if (!maxVisibleItems || childrenArray.length <= maxVisibleItems || isExpanded) {
|
|
@@ -34,7 +36,7 @@ const Breadcrumbs = ({ children, divider = 'chevron', type = 'text', className,
|
|
|
34
36
|
const ellipsisItem = jsxRuntime.jsx(breadcrumbItem.BreadcrumbItem, { isEllipsis: true, divider: divider, type: type, onClick: () => setIsExpanded(true) }, "ellipsis");
|
|
35
37
|
return [...firstItems, ellipsisItem, ...lastItems];
|
|
36
38
|
})();
|
|
37
|
-
return (jsxRuntime.jsx("nav", { "aria-label": "Breadcrumbs", className: cx.cx('min-w-0', className), children: jsxRuntime.jsx(BreadcrumbsContext.Provider, { value: { divider, type }, children: jsxRuntime.jsx(reactAriaComponents.Breadcrumbs, { className: cx.cx('relative flex', styles[type]), children: visibleItems }) }) }));
|
|
39
|
+
return (jsxRuntime.jsx("nav", { "aria-label": "Breadcrumbs", "data-testid": rootTestId, className: cx.cx('min-w-0', className), children: jsxRuntime.jsx(BreadcrumbsContext.Provider, { value: { divider, type, testIdPrefix: rootTestId }, children: jsxRuntime.jsx(reactAriaComponents.Breadcrumbs, { className: cx.cx('relative flex', styles[type]), children: visibleItems }) }) }));
|
|
38
40
|
};
|
|
39
41
|
Breadcrumbs.Item = breadcrumbItem.BreadcrumbItem;
|
|
40
42
|
Breadcrumbs.AccountItem = breadcrumbAccountItem.BreadcrumbAccountItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../../src/components/molecules/Breadcrumbs/index.tsx"],"sourcesContent":[null],"names":["createContext","useState","_jsx","BreadcrumbItem","cx","AriaBreadcrumbs","BreadcrumbAccountItem"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/molecules/Breadcrumbs/index.tsx"],"sourcesContent":[null],"names":["createContext","useState","useResolvedTestId","_jsx","BreadcrumbItem","cx","AriaBreadcrumbs","BreadcrumbAccountItem"],"mappings":";;;;;;;;;;AAWO,MAAM,kBAAkB,GAAGA,mBAAa,CAAgF;AAC7H,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,IAAI,EAAE,MAAM;AACb,CAAA;AAoBD,MAAM,MAA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pD,CAAC,GAAG;IAEJ,QACED,cAAA,CAAA,KAAA,EAAA,EAAA,YAAA,EAAgB,aAAa,EAAA,aAAA,EAAc,UAAU,EAAE,SAAS,EAAEE,KAAE,CAAC,SAAS,EAAE,SAAS,CAAC,EAAA,QAAA,EACxFF,cAAA,CAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,EAAA,QAAA,EAC7EA,cAAA,CAACG,+BAAe,EAAA,EAAC,SAAS,EAAED,KAAE,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAA,QAAA,EAAG,YAAY,EAAA,CAAmB,EAAA,CACnE,EAAA,CAC1B;AAEV;AAEA,WAAW,CAAC,IAAI,GAAGD,6BAAc;AACjC,WAAW,CAAC,WAAW,GAAGG,2CAAqB;;;;;"}
|
|
@@ -3,6 +3,7 @@ export type BreadcrumbType = 'text' | 'text-line' | 'button';
|
|
|
3
3
|
export declare const BreadcrumbsContext: React.Context<{
|
|
4
4
|
divider: "chevron" | "slash";
|
|
5
5
|
type: BreadcrumbType;
|
|
6
|
+
testIdPrefix?: string;
|
|
6
7
|
}>;
|
|
7
8
|
export interface BreadcrumbsProps {
|
|
8
9
|
divider?: 'chevron' | 'slash';
|
|
@@ -15,6 +16,11 @@ export interface BreadcrumbsProps {
|
|
|
15
16
|
* item with an ellipsis that can be expanded.
|
|
16
17
|
*/
|
|
17
18
|
maxVisibleItems?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Overrides the root `data-testid`. Defaults to `fd-breadcrumbs`. Items derive
|
|
21
|
+
* their testids from this prefix (e.g. `<root>--item-settings`).
|
|
22
|
+
*/
|
|
23
|
+
'data-testid'?: string;
|
|
18
24
|
}
|
|
19
25
|
/**
|
|
20
26
|
* Shows the user's current location within a page hierarchy as a trail of
|
|
@@ -23,8 +29,8 @@ export interface BreadcrumbsProps {
|
|
|
23
29
|
* @summary navigable trail of links showing the user's location in the hierarchy
|
|
24
30
|
*/
|
|
25
31
|
declare const Breadcrumbs: {
|
|
26
|
-
({ children, divider, type, className, maxVisibleItems }: BreadcrumbsProps): React.JSX.Element;
|
|
27
|
-
Item: ({ href, icon, divider, type, isEllipsis, children, onClick, avatarSrc, className, ...otherProps }: import("./components/breadcrumb-item").BreadcrumbItemProps) => React.JSX.Element;
|
|
32
|
+
({ children, divider, type, className, maxVisibleItems, "data-testid": dataTestId, }: BreadcrumbsProps): React.JSX.Element;
|
|
33
|
+
Item: ({ href, icon, divider, type, isEllipsis, children, onClick, avatarSrc, className, id, "data-testid": dataTestId, ...otherProps }: import("./components/breadcrumb-item").BreadcrumbItemProps) => React.JSX.Element;
|
|
28
34
|
AccountItem: ({ items, selectedKey, onSelectionChange }: import("./components/breadcrumb-account-item").BreadcrumbAccountItemProps) => React.JSX.Element;
|
|
29
35
|
};
|
|
30
36
|
export { Breadcrumbs };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Breadcrumbs/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Breadcrumbs/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAiB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAKvE,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE7D,eAAO,MAAM,kBAAkB;aAA4B,SAAS,GAAG,OAAO;UAAQ,cAAc;mBAAiB,MAAM;EAGzH,CAAC;AAEH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AASD;;;;;GAKG;AACH,QAAA,MAAM,WAAW;0FAOd,gBAAgB;;;CAyBlB,CAAC;AAKF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { cx } from '@flipdish/ui-library/utilities/cx';
|
|
3
|
+
import { useResolvedTestId } from '@flipdish/ui-library/utilities/testIdUtils';
|
|
3
4
|
import React, { createContext, useState } from 'react';
|
|
4
5
|
import { Breadcrumbs as Breadcrumbs$1 } from 'react-aria-components';
|
|
5
6
|
import { BreadcrumbAccountItem } from './components/breadcrumb-account-item.js';
|
|
@@ -20,8 +21,9 @@ const styles = {
|
|
|
20
21
|
*
|
|
21
22
|
* @summary navigable trail of links showing the user's location in the hierarchy
|
|
22
23
|
*/
|
|
23
|
-
const Breadcrumbs = ({ children, divider = 'chevron', type = 'text', className, maxVisibleItems = 4 }) => {
|
|
24
|
+
const Breadcrumbs = ({ children, divider = 'chevron', type = 'text', className, maxVisibleItems = 4, 'data-testid': dataTestId, }) => {
|
|
24
25
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
26
|
+
const rootTestId = useResolvedTestId({ testId: dataTestId, segment: 'breadcrumbs', rootName: 'breadcrumbs' });
|
|
25
27
|
const visibleItems = (() => {
|
|
26
28
|
const childrenArray = React.Children.toArray(children);
|
|
27
29
|
if (!maxVisibleItems || childrenArray.length <= maxVisibleItems || isExpanded) {
|
|
@@ -32,7 +34,7 @@ const Breadcrumbs = ({ children, divider = 'chevron', type = 'text', className,
|
|
|
32
34
|
const ellipsisItem = jsx(BreadcrumbItem, { isEllipsis: true, divider: divider, type: type, onClick: () => setIsExpanded(true) }, "ellipsis");
|
|
33
35
|
return [...firstItems, ellipsisItem, ...lastItems];
|
|
34
36
|
})();
|
|
35
|
-
return (jsx("nav", { "aria-label": "Breadcrumbs", className: cx('min-w-0', className), children: jsx(BreadcrumbsContext.Provider, { value: { divider, type }, children: jsx(Breadcrumbs$1, { className: cx('relative flex', styles[type]), children: visibleItems }) }) }));
|
|
37
|
+
return (jsx("nav", { "aria-label": "Breadcrumbs", "data-testid": rootTestId, className: cx('min-w-0', className), children: jsx(BreadcrumbsContext.Provider, { value: { divider, type, testIdPrefix: rootTestId }, children: jsx(Breadcrumbs$1, { className: cx('relative flex', styles[type]), children: visibleItems }) }) }));
|
|
36
38
|
};
|
|
37
39
|
Breadcrumbs.Item = BreadcrumbItem;
|
|
38
40
|
Breadcrumbs.AccountItem = BreadcrumbAccountItem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/Breadcrumbs/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaBreadcrumbs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/molecules/Breadcrumbs/index.tsx"],"sourcesContent":[null],"names":["_jsx","AriaBreadcrumbs"],"mappings":";;;;;;;;AAWO,MAAM,kBAAkB,GAAG,aAAa,CAAgF;AAC7H,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,IAAI,EAAE,MAAM;AACb,CAAA;AAoBD,MAAM,MAAM,GAAG;AACb,IAAA,IAAI,EAAE,kBAAkB;AACxB,IAAA,WAAW,EACT,wIAAwI;AAC1I,IAAA,MAAM,EAAE,kBAAkB;CAC3B;AAED;;;;;AAKG;AACH,MAAM,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,MAAM,EACb,SAAS,EACT,eAAe,GAAG,CAAC,EACnB,aAAa,EAAE,UAAU,GACR,KAAI;IACrB,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;AACnD,IAAA,MAAM,UAAU,GAAG,iBAAiB,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,OA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