@aurora-ds/components 0.6.7 → 0.10.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/README.md +2 -0
- package/dist/cjs/components/actions/button/Button.d.ts +12 -0
- package/dist/cjs/components/actions/button/Button.props.d.ts +41 -0
- package/dist/cjs/components/actions/button/Button.styles.d.ts +18 -0
- package/dist/cjs/components/actions/button/index.d.ts +2 -0
- package/dist/cjs/components/actions/icon-button/IconButton.d.ts +4 -0
- package/dist/cjs/components/actions/icon-button/IconButton.props.d.ts +37 -0
- package/dist/cjs/components/actions/icon-button/IconButton.styles.d.ts +4 -0
- package/dist/cjs/components/actions/icon-button/index.d.ts +2 -0
- package/dist/cjs/components/data-display/chip/Chip.props.d.ts +10 -0
- package/dist/cjs/components/forms/form/Form.d.ts +3 -0
- package/dist/cjs/components/forms/form/Form.props.d.ts +9 -0
- package/dist/cjs/components/forms/form/Form.styles.d.ts +3 -0
- package/dist/cjs/components/forms/form/index.d.ts +2 -0
- package/dist/cjs/components/forms/input/Input.d.ts +3 -0
- package/dist/cjs/components/forms/input/Input.props.d.ts +32 -0
- package/dist/cjs/components/forms/input/Input.styles.d.ts +15 -0
- package/dist/cjs/components/forms/input/index.d.ts +2 -0
- package/dist/cjs/components/forms/textarea/TextArea.d.ts +3 -0
- package/dist/cjs/components/forms/textarea/TextArea.props.d.ts +27 -0
- package/dist/cjs/components/forms/textarea/TextArea.styles.d.ts +11 -0
- package/dist/cjs/components/forms/textarea/index.d.ts +2 -0
- package/dist/cjs/components/foundation/icon/Icon.d.ts +35 -0
- package/dist/cjs/components/foundation/icon/Icon.props.d.ts +24 -0
- package/dist/cjs/components/foundation/icon/Icon.styles.d.ts +3 -0
- package/dist/cjs/components/foundation/icon/index.d.ts +2 -0
- package/dist/cjs/components/foundation/text/Text.d.ts +21 -0
- package/dist/cjs/components/foundation/text/Text.props.d.ts +38 -0
- package/dist/cjs/components/foundation/text/Text.styles.d.ts +4 -0
- package/dist/cjs/components/foundation/text/index.d.ts +2 -0
- package/dist/cjs/components/index.d.ts +11 -5
- package/dist/cjs/components/inputs/button/Button.props.d.ts +1 -0
- package/dist/cjs/components/inputs/icon-button/IconButton.props.d.ts +1 -0
- package/dist/cjs/components/inputs/input/Input.d.ts +6 -0
- package/dist/cjs/components/inputs/input/Input.props.d.ts +17 -0
- package/dist/cjs/components/inputs/input/Input.styles.d.ts +7 -0
- package/dist/cjs/components/inputs/input/index.d.ts +2 -0
- package/dist/cjs/components/layout/card/Card.props.d.ts +10 -0
- package/dist/cjs/components/layout/grid/Grid.props.d.ts +10 -0
- package/dist/cjs/components/layout/page-construction/page/Page.d.ts +10 -0
- package/dist/cjs/components/layout/page-construction/page/Page.props.d.ts +30 -0
- package/dist/cjs/components/layout/page-construction/page/Page.styles.d.ts +5 -0
- package/dist/cjs/components/layout/page-construction/page/index.d.ts +2 -0
- package/dist/cjs/components/layout/page-construction/page-section/PageSection.d.ts +10 -0
- package/dist/cjs/components/layout/page-construction/page-section/PageSection.props.d.ts +34 -0
- package/dist/cjs/components/layout/page-construction/page-section/PageSection.styles.d.ts +4 -0
- package/dist/cjs/components/layout/page-construction/page-section/index.d.ts +2 -0
- package/dist/cjs/components/layout/stack/Stack.props.d.ts +10 -0
- package/dist/cjs/components/layout/text/Text.d.ts +1 -0
- package/dist/cjs/components/layout/text/Text.props.d.ts +3 -0
- package/dist/cjs/components/navigation/breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/cjs/components/navigation/breadcrumb/Breadcrumb.props.d.ts +13 -0
- package/dist/cjs/components/navigation/breadcrumb/Breadcrumb.styles.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbEllipsis/BreadcrumbEllipsis.d.ts +8 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbEllipsis/BreadcrumbEllipsis.props.d.ts +5 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbEllipsis/BreadcrumbEllipsis.styles.d.ts +7 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbEllipsis/index.d.ts +2 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbEllipsis.d.ts +9 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbItem/BreadcrumbItem.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbItem/BreadcrumbItem.styles.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbItem/index.d.ts +1 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbItem.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbLink/BreadcrumbLink.d.ts +7 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbLink/BreadcrumbLink.props.d.ts +14 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbLink/BreadcrumbLink.styles.d.ts +7 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbLink/index.d.ts +2 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbLink.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbList/BreadcrumbList.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbList/BreadcrumbList.styles.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbList/index.d.ts +1 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbList.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbPage/BreadcrumbPage.d.ts +7 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbPage/BreadcrumbPage.props.d.ts +10 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbPage/BreadcrumbPage.styles.d.ts +7 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbPage/index.d.ts +2 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbPage.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbSeparator/BreadcrumbSeparator.d.ts +7 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbSeparator/BreadcrumbSeparator.props.d.ts +5 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbSeparator/BreadcrumbSeparator.styles.d.ts +6 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbSeparator/index.d.ts +2 -0
- package/dist/cjs/components/navigation/breadcrumb/BreadcrumbSeparator.d.ts +9 -0
- package/dist/cjs/components/navigation/breadcrumb/index.d.ts +10 -0
- package/dist/cjs/components/navigation/drawer-item/DrawerItem.props.d.ts +10 -0
- package/dist/cjs/components/overlay/accordion/Accordion.d.ts +10 -0
- package/dist/cjs/components/overlay/accordion/Accordion.props.d.ts +52 -0
- package/dist/cjs/components/overlay/accordion/Accordion.styles.d.ts +7 -0
- package/dist/cjs/components/overlay/accordion/index.d.ts +2 -0
- package/dist/cjs/index.js +741 -203
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/button.types.d.ts +14 -1
- package/dist/cjs/resources/Icons.d.ts +5 -1
- package/dist/cjs/resources/icons/ChevronRightIcon.d.ts +1 -0
- package/dist/cjs/resources/icons/EyeIcon.d.ts +1 -0
- package/dist/cjs/resources/icons/EyeOffIcon.d.ts +1 -0
- package/dist/cjs/resources/icons/MoreHorizontalIcon.d.ts +1 -0
- package/dist/cjs/utils/ui/components/actions/button/getButtonSizeStyles.utils.d.ts +12 -0
- package/dist/cjs/utils/ui/components/actions/button/getButtonVariantStyles.utils.d.ts +7 -0
- package/dist/cjs/utils/ui/components/actions/icon-button/getIconButtonSizeStyles.utils.d.ts +9 -0
- package/dist/cjs/utils/ui/components/data-display/chip/getChipColorStyles.utils.d.ts +7 -0
- package/dist/cjs/utils/ui/components/data-display/chip/getChipContentSize.utils.d.ts +8 -0
- package/dist/cjs/utils/ui/components/data-display/chip/getChipSizeStyles.utils.d.ts +12 -0
- package/dist/cjs/utils/ui/components/foundation/text/getTextVariantStyles.utils.d.ts +7 -0
- package/dist/cjs/utils/ui/components/foundation/text/getTruncateTextStyles.utils.d.ts +17 -0
- package/dist/cjs/utils/ui/components/foundation/text/parseTextWithBold.utils.d.ts +7 -0
- package/dist/cjs/utils/ui/components/navigation/breadcrumb/buildBreadcrumbChildren.utils.d.ts +5 -0
- package/dist/cjs/utils/ui/components/navigation/breadcrumb/flattenChildren.utils.d.ts +5 -0
- package/dist/cjs/utils/ui/components/navigation/breadcrumb/insertSeparators.utils.d.ts +5 -0
- package/dist/cjs/utils/ui/components/navigation/breadcrumb/isSeparator.utils.d.ts +5 -0
- package/dist/esm/components/actions/button/Button.d.ts +12 -0
- package/dist/esm/components/actions/button/Button.props.d.ts +41 -0
- package/dist/esm/components/actions/button/Button.styles.d.ts +18 -0
- package/dist/esm/components/actions/button/index.d.ts +2 -0
- package/dist/esm/components/actions/icon-button/IconButton.d.ts +4 -0
- package/dist/esm/components/actions/icon-button/IconButton.props.d.ts +37 -0
- package/dist/esm/components/actions/icon-button/IconButton.styles.d.ts +4 -0
- package/dist/esm/components/actions/icon-button/index.d.ts +2 -0
- package/dist/esm/components/data-display/chip/Chip.props.d.ts +10 -0
- package/dist/esm/components/forms/form/Form.d.ts +3 -0
- package/dist/esm/components/forms/form/Form.props.d.ts +9 -0
- package/dist/esm/components/forms/form/Form.styles.d.ts +3 -0
- package/dist/esm/components/forms/form/index.d.ts +2 -0
- package/dist/esm/components/forms/input/Input.d.ts +3 -0
- package/dist/esm/components/forms/input/Input.props.d.ts +32 -0
- package/dist/esm/components/forms/input/Input.styles.d.ts +15 -0
- package/dist/esm/components/forms/input/index.d.ts +2 -0
- package/dist/esm/components/forms/textarea/TextArea.d.ts +3 -0
- package/dist/esm/components/forms/textarea/TextArea.props.d.ts +27 -0
- package/dist/esm/components/forms/textarea/TextArea.styles.d.ts +11 -0
- package/dist/esm/components/forms/textarea/index.d.ts +2 -0
- package/dist/esm/components/foundation/icon/Icon.d.ts +35 -0
- package/dist/esm/components/foundation/icon/Icon.props.d.ts +24 -0
- package/dist/esm/components/foundation/icon/Icon.styles.d.ts +3 -0
- package/dist/esm/components/foundation/icon/index.d.ts +2 -0
- package/dist/esm/components/foundation/text/Text.d.ts +21 -0
- package/dist/esm/components/foundation/text/Text.props.d.ts +38 -0
- package/dist/esm/components/foundation/text/Text.styles.d.ts +4 -0
- package/dist/esm/components/foundation/text/index.d.ts +2 -0
- package/dist/esm/components/index.d.ts +11 -5
- package/dist/esm/components/inputs/button/Button.props.d.ts +1 -0
- package/dist/esm/components/inputs/icon-button/IconButton.props.d.ts +1 -0
- package/dist/esm/components/inputs/input/Input.d.ts +6 -0
- package/dist/esm/components/inputs/input/Input.props.d.ts +17 -0
- package/dist/esm/components/inputs/input/Input.styles.d.ts +7 -0
- package/dist/esm/components/inputs/input/index.d.ts +2 -0
- package/dist/esm/components/layout/card/Card.props.d.ts +10 -0
- package/dist/esm/components/layout/grid/Grid.props.d.ts +10 -0
- package/dist/esm/components/layout/page-construction/page/Page.d.ts +10 -0
- package/dist/esm/components/layout/page-construction/page/Page.props.d.ts +30 -0
- package/dist/esm/components/layout/page-construction/page/Page.styles.d.ts +5 -0
- package/dist/esm/components/layout/page-construction/page/index.d.ts +2 -0
- package/dist/esm/components/layout/page-construction/page-section/PageSection.d.ts +10 -0
- package/dist/esm/components/layout/page-construction/page-section/PageSection.props.d.ts +34 -0
- package/dist/esm/components/layout/page-construction/page-section/PageSection.styles.d.ts +4 -0
- package/dist/esm/components/layout/page-construction/page-section/index.d.ts +2 -0
- package/dist/esm/components/layout/stack/Stack.props.d.ts +10 -0
- package/dist/esm/components/layout/text/Text.d.ts +1 -0
- package/dist/esm/components/layout/text/Text.props.d.ts +3 -0
- package/dist/esm/components/navigation/breadcrumb/Breadcrumb.d.ts +12 -0
- package/dist/esm/components/navigation/breadcrumb/Breadcrumb.props.d.ts +13 -0
- package/dist/esm/components/navigation/breadcrumb/Breadcrumb.styles.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbEllipsis/BreadcrumbEllipsis.d.ts +8 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbEllipsis/BreadcrumbEllipsis.props.d.ts +5 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbEllipsis/BreadcrumbEllipsis.styles.d.ts +7 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbEllipsis/index.d.ts +2 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbEllipsis.d.ts +9 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbItem/BreadcrumbItem.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbItem/BreadcrumbItem.styles.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbItem/index.d.ts +1 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbItem.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbLink/BreadcrumbLink.d.ts +7 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbLink/BreadcrumbLink.props.d.ts +14 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbLink/BreadcrumbLink.styles.d.ts +7 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbLink/index.d.ts +2 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbLink.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbList/BreadcrumbList.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbList/BreadcrumbList.styles.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbList/index.d.ts +1 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbList.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbPage/BreadcrumbPage.d.ts +7 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbPage/BreadcrumbPage.props.d.ts +10 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbPage/BreadcrumbPage.styles.d.ts +7 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbPage/index.d.ts +2 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbPage.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbSeparator/BreadcrumbSeparator.d.ts +7 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbSeparator/BreadcrumbSeparator.props.d.ts +5 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbSeparator/BreadcrumbSeparator.styles.d.ts +6 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbSeparator/index.d.ts +2 -0
- package/dist/esm/components/navigation/breadcrumb/BreadcrumbSeparator.d.ts +9 -0
- package/dist/esm/components/navigation/breadcrumb/index.d.ts +10 -0
- package/dist/esm/components/navigation/drawer-item/DrawerItem.props.d.ts +10 -0
- package/dist/esm/components/overlay/accordion/Accordion.d.ts +10 -0
- package/dist/esm/components/overlay/accordion/Accordion.props.d.ts +52 -0
- package/dist/esm/components/overlay/accordion/Accordion.styles.d.ts +7 -0
- package/dist/esm/components/overlay/accordion/index.d.ts +2 -0
- package/dist/esm/index.js +733 -205
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/button.types.d.ts +14 -1
- package/dist/esm/resources/Icons.d.ts +5 -1
- package/dist/esm/resources/icons/ChevronRightIcon.d.ts +1 -0
- package/dist/esm/resources/icons/EyeIcon.d.ts +1 -0
- package/dist/esm/resources/icons/EyeOffIcon.d.ts +1 -0
- package/dist/esm/resources/icons/MoreHorizontalIcon.d.ts +1 -0
- package/dist/esm/utils/ui/components/actions/button/getButtonSizeStyles.utils.d.ts +12 -0
- package/dist/esm/utils/ui/components/actions/button/getButtonVariantStyles.utils.d.ts +7 -0
- package/dist/esm/utils/ui/components/actions/icon-button/getIconButtonSizeStyles.utils.d.ts +9 -0
- package/dist/esm/utils/ui/components/data-display/chip/getChipColorStyles.utils.d.ts +7 -0
- package/dist/esm/utils/ui/components/data-display/chip/getChipContentSize.utils.d.ts +8 -0
- package/dist/esm/utils/ui/components/data-display/chip/getChipSizeStyles.utils.d.ts +12 -0
- package/dist/esm/utils/ui/components/foundation/text/getTextVariantStyles.utils.d.ts +7 -0
- package/dist/esm/utils/ui/components/foundation/text/getTruncateTextStyles.utils.d.ts +17 -0
- package/dist/esm/utils/ui/components/foundation/text/parseTextWithBold.utils.d.ts +7 -0
- package/dist/esm/utils/ui/components/navigation/breadcrumb/buildBreadcrumbChildren.utils.d.ts +5 -0
- package/dist/esm/utils/ui/components/navigation/breadcrumb/flattenChildren.utils.d.ts +5 -0
- package/dist/esm/utils/ui/components/navigation/breadcrumb/insertSeparators.utils.d.ts +5 -0
- package/dist/esm/utils/ui/components/navigation/breadcrumb/isSeparator.utils.d.ts +5 -0
- package/dist/index.d.ts +382 -45
- package/package.json +76 -77
package/dist/cjs/index.js
CHANGED
|
@@ -56,7 +56,7 @@ const ICON_STYLES = theme.createStyles((theme) => ({
|
|
|
56
56
|
* </Icon>
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
|
-
const Icon = ({ children, size, color, backgroundColor, padding, borderRadius, }) => {
|
|
59
|
+
const Icon = ({ children, size, color, backgroundColor, padding, borderRadius, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
60
60
|
// Clone child element to apply width and height
|
|
61
61
|
const child = react.Children.only(children);
|
|
62
62
|
const styledChild = react.isValidElement(child)
|
|
@@ -65,158 +65,10 @@ const Icon = ({ children, size, color, backgroundColor, padding, borderRadius, }
|
|
|
65
65
|
height: '100%',
|
|
66
66
|
})
|
|
67
67
|
: child;
|
|
68
|
-
return (jsxRuntime.jsx("div", { className: ICON_STYLES.root(size, color, backgroundColor, padding, borderRadius), children: styledChild }));
|
|
68
|
+
return (jsxRuntime.jsx("div", { className: ICON_STYLES.root(size, color, backgroundColor, padding, borderRadius), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: styledChild }));
|
|
69
69
|
};
|
|
70
70
|
Icon.displayName = 'Icon';
|
|
71
71
|
|
|
72
|
-
const getChipColorStyles = (theme, color, variant, disabled) => {
|
|
73
|
-
if (disabled) {
|
|
74
|
-
return {
|
|
75
|
-
filled: {
|
|
76
|
-
backgroundColor: theme.colors.disabled,
|
|
77
|
-
color: theme.colors.disabledText,
|
|
78
|
-
borderColor: 'transparent',
|
|
79
|
-
},
|
|
80
|
-
outlined: {
|
|
81
|
-
backgroundColor: 'transparent',
|
|
82
|
-
color: theme.colors.disabledText,
|
|
83
|
-
borderColor: theme.colors.disabled,
|
|
84
|
-
},
|
|
85
|
-
}[variant];
|
|
86
|
-
}
|
|
87
|
-
const colorMap = {
|
|
88
|
-
default: {
|
|
89
|
-
filled: {
|
|
90
|
-
backgroundColor: theme.colors.surfaceHover,
|
|
91
|
-
color: theme.colors.text,
|
|
92
|
-
borderColor: 'transparent',
|
|
93
|
-
},
|
|
94
|
-
outlined: {
|
|
95
|
-
backgroundColor: 'transparent',
|
|
96
|
-
color: theme.colors.text,
|
|
97
|
-
borderColor: theme.colors.border,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
primary: {
|
|
101
|
-
filled: {
|
|
102
|
-
backgroundColor: theme.colors.primary,
|
|
103
|
-
color: theme.colors.onPrimary,
|
|
104
|
-
borderColor: 'transparent',
|
|
105
|
-
},
|
|
106
|
-
outlined: {
|
|
107
|
-
backgroundColor: 'transparent',
|
|
108
|
-
color: theme.colors.primary,
|
|
109
|
-
borderColor: theme.colors.primary,
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
success: {
|
|
113
|
-
filled: {
|
|
114
|
-
backgroundColor: theme.colors.successSubtle,
|
|
115
|
-
color: theme.colors.success,
|
|
116
|
-
borderColor: 'transparent',
|
|
117
|
-
},
|
|
118
|
-
outlined: {
|
|
119
|
-
backgroundColor: theme.colors.successSubtle,
|
|
120
|
-
color: theme.colors.success,
|
|
121
|
-
borderColor: theme.colors.success,
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
warning: {
|
|
125
|
-
filled: {
|
|
126
|
-
backgroundColor: theme.colors.warningSubtle,
|
|
127
|
-
color: theme.colors.warning,
|
|
128
|
-
borderColor: 'transparent',
|
|
129
|
-
},
|
|
130
|
-
outlined: {
|
|
131
|
-
backgroundColor: theme.colors.warningSubtle,
|
|
132
|
-
color: theme.colors.warning,
|
|
133
|
-
borderColor: theme.colors.warning,
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
error: {
|
|
137
|
-
filled: {
|
|
138
|
-
backgroundColor: theme.colors.errorSubtle,
|
|
139
|
-
color: theme.colors.error,
|
|
140
|
-
borderColor: 'transparent',
|
|
141
|
-
},
|
|
142
|
-
outlined: {
|
|
143
|
-
backgroundColor: theme.colors.errorSubtle,
|
|
144
|
-
color: theme.colors.error,
|
|
145
|
-
borderColor: theme.colors.error,
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
info: {
|
|
149
|
-
filled: {
|
|
150
|
-
backgroundColor: theme.colors.infoSubtle,
|
|
151
|
-
color: theme.colors.info,
|
|
152
|
-
borderColor: 'transparent',
|
|
153
|
-
},
|
|
154
|
-
outlined: {
|
|
155
|
-
backgroundColor: theme.colors.infoSubtle,
|
|
156
|
-
color: theme.colors.info,
|
|
157
|
-
borderColor: theme.colors.info,
|
|
158
|
-
},
|
|
159
|
-
},
|
|
160
|
-
};
|
|
161
|
-
return colorMap[color][variant];
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Get chip size styles based on the theme, size and icon-only state
|
|
166
|
-
* @param theme - Theme object
|
|
167
|
-
* @param size - Chip size
|
|
168
|
-
* @param isIconOnly - Whether the chip has only an icon (no label)
|
|
169
|
-
*/
|
|
170
|
-
const getChipSizeStyles = (theme, size, isIconOnly) => {
|
|
171
|
-
const sizeMap = {
|
|
172
|
-
'2xs': {
|
|
173
|
-
iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize['2xs'] },
|
|
174
|
-
withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize['2xs'] },
|
|
175
|
-
},
|
|
176
|
-
xs: {
|
|
177
|
-
iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize.xs },
|
|
178
|
-
withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize.xs },
|
|
179
|
-
},
|
|
180
|
-
sm: {
|
|
181
|
-
iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize.sm },
|
|
182
|
-
withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize.sm },
|
|
183
|
-
},
|
|
184
|
-
md: {
|
|
185
|
-
iconOnly: { padding: theme.spacing.sm, fontSize: theme.fontSize.md },
|
|
186
|
-
withLabel: { padding: `${theme.spacing.sm} ${theme.spacing.md}`, fontSize: theme.fontSize.sm },
|
|
187
|
-
},
|
|
188
|
-
lg: {
|
|
189
|
-
iconOnly: { padding: theme.spacing.md, fontSize: theme.fontSize.lg },
|
|
190
|
-
withLabel: { padding: `${theme.spacing.sm} ${theme.spacing.lg}`, fontSize: theme.fontSize.md },
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
return isIconOnly ? sizeMap[size].iconOnly : sizeMap[size].withLabel;
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
const CHIP_STYLES = theme.createStyles((theme) => ({
|
|
197
|
-
root: ({ variant, color, size, isIconOnly, disabled, gap, radius }) => {
|
|
198
|
-
const colorStyles = getChipColorStyles(theme, color, variant, disabled);
|
|
199
|
-
const sizeStyles = getChipSizeStyles(theme, size, isIconOnly);
|
|
200
|
-
return {
|
|
201
|
-
display: 'flex',
|
|
202
|
-
alignItems: 'center',
|
|
203
|
-
justifyContent: 'center',
|
|
204
|
-
gap: gap ? theme.spacing[gap] : theme.spacing.sm,
|
|
205
|
-
borderRadius: radius ? theme.radius[radius] : theme.radius.md,
|
|
206
|
-
border: variant === 'outlined' ? '1px solid' : 'none',
|
|
207
|
-
aspectRatio: isIconOnly ? 1 : undefined,
|
|
208
|
-
height: 'fit-content',
|
|
209
|
-
width: 'fit-content',
|
|
210
|
-
fontFamily: 'inherit',
|
|
211
|
-
fontWeight: theme.fontWeight.medium,
|
|
212
|
-
whiteSpace: 'nowrap',
|
|
213
|
-
boxSizing: 'border-box',
|
|
214
|
-
...sizeStyles,
|
|
215
|
-
...colorStyles,
|
|
216
|
-
};
|
|
217
|
-
},
|
|
218
|
-
}));
|
|
219
|
-
|
|
220
72
|
/**
|
|
221
73
|
* Get text variant styles based on the theme
|
|
222
74
|
* @param theme
|
|
@@ -260,7 +112,7 @@ const getTextVariantStyles = (theme) => ({
|
|
|
260
112
|
},
|
|
261
113
|
p: {
|
|
262
114
|
tag: 'p',
|
|
263
|
-
fontSize: theme.fontSize.
|
|
115
|
+
fontSize: theme.fontSize.md,
|
|
264
116
|
fontWeight: theme.fontWeight.regular,
|
|
265
117
|
lineHeight: theme.lineHeight.relaxed,
|
|
266
118
|
},
|
|
@@ -272,7 +124,7 @@ const getTextVariantStyles = (theme) => ({
|
|
|
272
124
|
},
|
|
273
125
|
label: {
|
|
274
126
|
tag: 'label',
|
|
275
|
-
fontSize: theme.fontSize.
|
|
127
|
+
fontSize: theme.fontSize.md,
|
|
276
128
|
fontWeight: theme.fontWeight.medium,
|
|
277
129
|
lineHeight: theme.lineHeight.normal,
|
|
278
130
|
},
|
|
@@ -296,14 +148,15 @@ const getTruncateTextStyles = (maxLines) => (maxLines === 1
|
|
|
296
148
|
const TEXT_STYLES = theme.createStyles((theme) => {
|
|
297
149
|
const variantStyles = getTextVariantStyles(theme);
|
|
298
150
|
return {
|
|
299
|
-
root: ({ variant = 'span', color, fontSize, fontFamily, maxLines, underline }) => ({
|
|
151
|
+
root: ({ variant = 'span', color, fontSize, fontFamily, maxLines, underline, preserveWhitespace, }) => ({
|
|
300
152
|
margin: 0,
|
|
301
153
|
fontSize: fontSize ? theme.fontSize[fontSize] : variantStyles[variant].fontSize,
|
|
302
154
|
fontWeight: variantStyles[variant].fontWeight,
|
|
303
155
|
lineHeight: variantStyles[variant].lineHeight,
|
|
304
156
|
color: color ? theme.colors[color] : 'inherit',
|
|
305
157
|
cursor: 'inherit',
|
|
306
|
-
|
|
158
|
+
fontFamily,
|
|
159
|
+
...(preserveWhitespace && { whiteSpace: 'pre-wrap' }),
|
|
307
160
|
...(underline && {
|
|
308
161
|
textDecoration: 'underline',
|
|
309
162
|
textUnderlineOffset: '3px',
|
|
@@ -356,16 +209,172 @@ const parseTextWithBold = (children) => {
|
|
|
356
209
|
* - Theme-aware colors
|
|
357
210
|
* - Text truncation with `maxLines`
|
|
358
211
|
* - Underline support
|
|
212
|
+
* - Preserve whitespace with `preserveWhitespace` prop
|
|
359
213
|
* - Bold text with **double asterisks** syntax
|
|
360
214
|
*/
|
|
361
|
-
const Text = ({ children, variant = 'span', color, fontSize, fontFamily, maxLines, underline, }) => {
|
|
215
|
+
const Text = ({ children, variant = 'span', color, fontSize, fontFamily, maxLines, underline, preserveWhitespace, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
362
216
|
const theme$1 = theme.useTheme();
|
|
363
217
|
const variantStyles = react.useMemo(() => getTextVariantStyles(theme$1), [theme$1]);
|
|
364
218
|
const tag = variantStyles[variant].tag;
|
|
365
219
|
const parsedChildren = react.useMemo(() => parseTextWithBold(children), [children]);
|
|
366
|
-
return react.createElement(tag, {
|
|
220
|
+
return react.createElement(tag, {
|
|
221
|
+
className: TEXT_STYLES.root({ variant, color, fontSize, fontFamily, maxLines, underline, preserveWhitespace }),
|
|
222
|
+
'aria-label': ariaLabel,
|
|
223
|
+
'aria-labelledby': ariaLabelledBy,
|
|
224
|
+
'aria-describedby': ariaDescribedBy,
|
|
225
|
+
role,
|
|
226
|
+
tabIndex,
|
|
227
|
+
}, parsedChildren);
|
|
228
|
+
};
|
|
229
|
+
Text.displayName = 'Text';
|
|
230
|
+
|
|
231
|
+
const getChipColorStyles = (theme, color, variant, disabled) => {
|
|
232
|
+
if (disabled) {
|
|
233
|
+
return {
|
|
234
|
+
filled: {
|
|
235
|
+
backgroundColor: theme.colors.disabled,
|
|
236
|
+
color: theme.colors.disabledText,
|
|
237
|
+
borderColor: 'transparent',
|
|
238
|
+
},
|
|
239
|
+
outlined: {
|
|
240
|
+
backgroundColor: 'transparent',
|
|
241
|
+
color: theme.colors.disabledText,
|
|
242
|
+
borderColor: theme.colors.disabled,
|
|
243
|
+
},
|
|
244
|
+
}[variant];
|
|
245
|
+
}
|
|
246
|
+
const colorMap = {
|
|
247
|
+
default: {
|
|
248
|
+
filled: {
|
|
249
|
+
backgroundColor: theme.colors.surfaceHover,
|
|
250
|
+
color: theme.colors.text,
|
|
251
|
+
borderColor: 'transparent',
|
|
252
|
+
},
|
|
253
|
+
outlined: {
|
|
254
|
+
backgroundColor: 'transparent',
|
|
255
|
+
color: theme.colors.text,
|
|
256
|
+
borderColor: theme.colors.border,
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
primary: {
|
|
260
|
+
filled: {
|
|
261
|
+
backgroundColor: theme.colors.primary,
|
|
262
|
+
color: theme.colors.onPrimary,
|
|
263
|
+
borderColor: 'transparent',
|
|
264
|
+
},
|
|
265
|
+
outlined: {
|
|
266
|
+
backgroundColor: 'transparent',
|
|
267
|
+
color: theme.colors.primary,
|
|
268
|
+
borderColor: theme.colors.primary,
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
success: {
|
|
272
|
+
filled: {
|
|
273
|
+
backgroundColor: theme.colors.successSubtle,
|
|
274
|
+
color: theme.colors.success,
|
|
275
|
+
borderColor: 'transparent',
|
|
276
|
+
},
|
|
277
|
+
outlined: {
|
|
278
|
+
backgroundColor: theme.colors.successSubtle,
|
|
279
|
+
color: theme.colors.success,
|
|
280
|
+
borderColor: theme.colors.success,
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
warning: {
|
|
284
|
+
filled: {
|
|
285
|
+
backgroundColor: theme.colors.warningSubtle,
|
|
286
|
+
color: theme.colors.warning,
|
|
287
|
+
borderColor: 'transparent',
|
|
288
|
+
},
|
|
289
|
+
outlined: {
|
|
290
|
+
backgroundColor: theme.colors.warningSubtle,
|
|
291
|
+
color: theme.colors.warning,
|
|
292
|
+
borderColor: theme.colors.warning,
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
error: {
|
|
296
|
+
filled: {
|
|
297
|
+
backgroundColor: theme.colors.errorSubtle,
|
|
298
|
+
color: theme.colors.error,
|
|
299
|
+
borderColor: 'transparent',
|
|
300
|
+
},
|
|
301
|
+
outlined: {
|
|
302
|
+
backgroundColor: theme.colors.errorSubtle,
|
|
303
|
+
color: theme.colors.error,
|
|
304
|
+
borderColor: theme.colors.error,
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
info: {
|
|
308
|
+
filled: {
|
|
309
|
+
backgroundColor: theme.colors.infoSubtle,
|
|
310
|
+
color: theme.colors.info,
|
|
311
|
+
borderColor: 'transparent',
|
|
312
|
+
},
|
|
313
|
+
outlined: {
|
|
314
|
+
backgroundColor: theme.colors.infoSubtle,
|
|
315
|
+
color: theme.colors.info,
|
|
316
|
+
borderColor: theme.colors.info,
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
return colorMap[color][variant];
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Get chip size styles based on the theme, size and icon-only state
|
|
325
|
+
* @param theme - Theme object
|
|
326
|
+
* @param size - Chip size
|
|
327
|
+
* @param isIconOnly - Whether the chip has only an icon (no label)
|
|
328
|
+
*/
|
|
329
|
+
const getChipSizeStyles = (theme, size, isIconOnly) => {
|
|
330
|
+
const sizeMap = {
|
|
331
|
+
'2xs': {
|
|
332
|
+
iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize['2xs'] },
|
|
333
|
+
withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize['2xs'] },
|
|
334
|
+
},
|
|
335
|
+
xs: {
|
|
336
|
+
iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize.xs },
|
|
337
|
+
withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize.xs },
|
|
338
|
+
},
|
|
339
|
+
sm: {
|
|
340
|
+
iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize.sm },
|
|
341
|
+
withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize.sm },
|
|
342
|
+
},
|
|
343
|
+
md: {
|
|
344
|
+
iconOnly: { padding: theme.spacing.sm, fontSize: theme.fontSize.md },
|
|
345
|
+
withLabel: { padding: `${theme.spacing.sm} ${theme.spacing.md}`, fontSize: theme.fontSize.sm },
|
|
346
|
+
},
|
|
347
|
+
lg: {
|
|
348
|
+
iconOnly: { padding: theme.spacing.md, fontSize: theme.fontSize.lg },
|
|
349
|
+
withLabel: { padding: `${theme.spacing.sm} ${theme.spacing.lg}`, fontSize: theme.fontSize.md },
|
|
350
|
+
},
|
|
351
|
+
};
|
|
352
|
+
return isIconOnly ? sizeMap[size].iconOnly : sizeMap[size].withLabel;
|
|
367
353
|
};
|
|
368
|
-
|
|
354
|
+
|
|
355
|
+
const CHIP_STYLES = theme.createStyles((theme) => ({
|
|
356
|
+
root: ({ variant, color, size, isIconOnly, disabled, gap, radius }) => {
|
|
357
|
+
const colorStyles = getChipColorStyles(theme, color, variant, disabled);
|
|
358
|
+
const sizeStyles = getChipSizeStyles(theme, size, isIconOnly);
|
|
359
|
+
return {
|
|
360
|
+
display: 'flex',
|
|
361
|
+
alignItems: 'center',
|
|
362
|
+
justifyContent: 'center',
|
|
363
|
+
gap: gap ? theme.spacing[gap] : theme.spacing.sm,
|
|
364
|
+
borderRadius: radius ? theme.radius[radius] : theme.radius.md,
|
|
365
|
+
border: variant === 'outlined' ? '1px solid' : 'none',
|
|
366
|
+
aspectRatio: isIconOnly ? 1 : undefined,
|
|
367
|
+
height: 'fit-content',
|
|
368
|
+
width: 'fit-content',
|
|
369
|
+
fontFamily: 'inherit',
|
|
370
|
+
fontWeight: theme.fontWeight.medium,
|
|
371
|
+
whiteSpace: 'nowrap',
|
|
372
|
+
boxSizing: 'border-box',
|
|
373
|
+
...sizeStyles,
|
|
374
|
+
...colorStyles,
|
|
375
|
+
};
|
|
376
|
+
},
|
|
377
|
+
}));
|
|
369
378
|
|
|
370
379
|
/**
|
|
371
380
|
* Get chip content size based on the chip size
|
|
@@ -395,7 +404,7 @@ const getChipContentSize = (size) => {
|
|
|
395
404
|
* **Colors:**
|
|
396
405
|
* - `default`, `primary`, `success`, `warning`, `error`, `info`
|
|
397
406
|
*/
|
|
398
|
-
const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, disabled = false, }) => {
|
|
407
|
+
const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, disabled = false, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
399
408
|
const isIconOnly = Boolean(icon) && !label;
|
|
400
409
|
return (jsxRuntime.jsxs("span", { className: CHIP_STYLES.root({
|
|
401
410
|
variant,
|
|
@@ -405,13 +414,40 @@ const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md',
|
|
|
405
414
|
disabled,
|
|
406
415
|
gap,
|
|
407
416
|
radius,
|
|
408
|
-
}), children: [icon && (jsxRuntime.jsx(Icon, { size: getChipContentSize(size), children: icon })), label && (jsxRuntime.jsx(Text, { variant: 'label', fontSize: getChipContentSize(size), children: label }))] }));
|
|
417
|
+
}), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [icon && (jsxRuntime.jsx(Icon, { size: getChipContentSize(size), children: icon })), label && (jsxRuntime.jsx(Text, { variant: 'label', fontSize: getChipContentSize(size), children: label }))] }));
|
|
409
418
|
};
|
|
410
419
|
Chip.displayName = 'Chip';
|
|
411
420
|
|
|
412
421
|
const BUTTON_SIZE = 36;
|
|
413
422
|
const DRAWER_ITEM_HEIGHT = 32;
|
|
414
423
|
|
|
424
|
+
const getButtonSizeStyles = () => ({
|
|
425
|
+
small: {
|
|
426
|
+
height: BUTTON_SIZE - 8,
|
|
427
|
+
padding: {
|
|
428
|
+
vertical: 'xs',
|
|
429
|
+
horizontal: 'sm'
|
|
430
|
+
},
|
|
431
|
+
fontSize: 'sm'
|
|
432
|
+
},
|
|
433
|
+
medium: {
|
|
434
|
+
height: BUTTON_SIZE,
|
|
435
|
+
padding: {
|
|
436
|
+
vertical: 'sm',
|
|
437
|
+
horizontal: 'md'
|
|
438
|
+
},
|
|
439
|
+
fontSize: 'md'
|
|
440
|
+
},
|
|
441
|
+
large: {
|
|
442
|
+
height: BUTTON_SIZE + 8,
|
|
443
|
+
padding: {
|
|
444
|
+
vertical: 'sm',
|
|
445
|
+
horizontal: 'lg'
|
|
446
|
+
},
|
|
447
|
+
fontSize: 'lg'
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
415
451
|
/**
|
|
416
452
|
* Get button variant styles based on the theme
|
|
417
453
|
* @param theme
|
|
@@ -429,6 +465,7 @@ const getButtonVariantStyles = (theme$1) => {
|
|
|
429
465
|
const baseDisabled = {
|
|
430
466
|
color: theme$1.colors.disabledText,
|
|
431
467
|
cursor: 'not-allowed',
|
|
468
|
+
opacity: theme$1.opacity.high
|
|
432
469
|
};
|
|
433
470
|
return {
|
|
434
471
|
contained: {
|
|
@@ -457,6 +494,24 @@ const getButtonVariantStyles = (theme$1) => {
|
|
|
457
494
|
disabled: { ...baseDisabled, backgroundColor: 'transparent' },
|
|
458
495
|
textColor: 'primary',
|
|
459
496
|
},
|
|
497
|
+
destructive: {
|
|
498
|
+
default: {
|
|
499
|
+
backgroundColor: theme$1.colors.error,
|
|
500
|
+
color: theme$1.colors.onError,
|
|
501
|
+
border: 'none',
|
|
502
|
+
},
|
|
503
|
+
hover: { backgroundColor: theme$1.colors.errorHover },
|
|
504
|
+
pressed: { backgroundColor: theme$1.colors.error },
|
|
505
|
+
disabled: { ...baseDisabled, backgroundColor: theme$1.colors.disabled },
|
|
506
|
+
textColor: 'onError',
|
|
507
|
+
},
|
|
508
|
+
link: {
|
|
509
|
+
default: { ...transparentBase, border: 'none', textDecoration: 'underline', textDecorationColor: 'transparent', textUnderlineOffset: '3px' },
|
|
510
|
+
hover: { backgroundColor: 'transparent', textDecorationColor: 'currentColor' },
|
|
511
|
+
pressed: { backgroundColor: 'transparent', textDecorationColor: 'currentColor', color: theme$1.colors.linkActive },
|
|
512
|
+
disabled: { ...baseDisabled, backgroundColor: 'transparent', textDecoration: 'none' },
|
|
513
|
+
textColor: 'link',
|
|
514
|
+
},
|
|
460
515
|
};
|
|
461
516
|
};
|
|
462
517
|
|
|
@@ -476,26 +531,35 @@ const getButtonVariantStyles = (theme$1) => {
|
|
|
476
531
|
*/
|
|
477
532
|
const BUTTON_STYLES = theme.createStyles((theme) => {
|
|
478
533
|
const variantStyles = getButtonVariantStyles(theme);
|
|
534
|
+
const sizeStyles = getButtonSizeStyles();
|
|
479
535
|
return {
|
|
480
|
-
root: ({ variant = 'contained', active = false }) =>
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
536
|
+
root: ({ variant = 'contained', active = false, textColor, size = 'medium' }) => {
|
|
537
|
+
const sizeConfig = sizeStyles[size];
|
|
538
|
+
const overrides = textColor ? {
|
|
539
|
+
...(variant !== 'contained' && { color: theme.colors[textColor] }),
|
|
540
|
+
...(variant === 'outlined' && { border: `1px solid ${theme.colors[textColor]}` }),
|
|
541
|
+
} : {};
|
|
542
|
+
return {
|
|
543
|
+
display: 'inline-flex',
|
|
544
|
+
alignItems: 'center',
|
|
545
|
+
justifyContent: 'center',
|
|
546
|
+
boxSizing: 'border-box',
|
|
547
|
+
gap: theme.spacing.sm,
|
|
548
|
+
padding: `${theme.spacing[sizeConfig.padding.vertical]} ${theme.spacing[sizeConfig.padding.horizontal]}`,
|
|
549
|
+
borderRadius: theme.radius.md,
|
|
550
|
+
cursor: 'pointer',
|
|
551
|
+
transition: `background-color ${theme.transition.fast}, color ${theme.transition.fast}, text-decoration-color ${theme.transition.fast}`,
|
|
552
|
+
minHeight: sizeConfig.height,
|
|
553
|
+
maxHeight: sizeConfig.height,
|
|
554
|
+
fontFamily: 'inherit',
|
|
555
|
+
...variantStyles[variant].default,
|
|
556
|
+
...(active && variantStyles[variant].pressed),
|
|
557
|
+
':hover': variantStyles[variant].hover,
|
|
558
|
+
':active': variantStyles[variant].pressed,
|
|
559
|
+
':disabled': variantStyles[variant].disabled,
|
|
560
|
+
...overrides,
|
|
561
|
+
};
|
|
562
|
+
},
|
|
499
563
|
};
|
|
500
564
|
});
|
|
501
565
|
|
|
@@ -507,11 +571,12 @@ const BUTTON_STYLES = theme.createStyles((theme) => {
|
|
|
507
571
|
* - `outlined`: Border only button
|
|
508
572
|
* - `text`: Text only button without background
|
|
509
573
|
*/
|
|
510
|
-
const Button = ({ label, startIcon, endIcon, variant = 'contained', active = false, onClick, disabled, type = 'button', textColor: customTextColor, }) => {
|
|
574
|
+
const Button = ({ label, startIcon, endIcon, variant = 'contained', active = false, onClick, disabled, type = 'button', textColor: customTextColor, size = 'medium', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
511
575
|
const theme$1 = theme.useTheme();
|
|
512
576
|
const variantStyles = getButtonVariantStyles(theme$1);
|
|
577
|
+
const sizeStyles = getButtonSizeStyles();
|
|
513
578
|
const textColor = disabled ? 'disabledText' : (customTextColor ?? variantStyles[variant].textColor);
|
|
514
|
-
return (jsxRuntime.jsxs("button", { onClick: onClick, disabled: disabled, type: type, className: BUTTON_STYLES.root({ variant, active }), children: [startIcon && (jsxRuntime.jsx(Icon, { color: textColor, children: startIcon })), jsxRuntime.jsx(Text, { variant: 'label', color: textColor, children: label }), endIcon && (jsxRuntime.jsx(Icon, { color: textColor, children: endIcon }))] }));
|
|
579
|
+
return (jsxRuntime.jsxs("button", { onClick: onClick, disabled: disabled, type: type, className: BUTTON_STYLES.root({ variant, active, textColor: customTextColor, size }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [startIcon && (jsxRuntime.jsx(Icon, { color: textColor, children: startIcon })), jsxRuntime.jsx(Text, { variant: 'label', color: textColor, fontSize: sizeStyles[size].fontSize, children: label }), endIcon && (jsxRuntime.jsx(Icon, { color: textColor, children: endIcon }))] }));
|
|
515
580
|
};
|
|
516
581
|
Button.displayName = 'Button';
|
|
517
582
|
|
|
@@ -537,8 +602,12 @@ const ICON_BUTTON_STYLES = theme.createStyles((theme) => {
|
|
|
537
602
|
const variantStyles = getButtonVariantStyles(theme);
|
|
538
603
|
const sizeStyles = getIconButtonSizeStyles();
|
|
539
604
|
return {
|
|
540
|
-
root: ({ variant = 'contained', active = false, size = 'medium' }) => {
|
|
605
|
+
root: ({ variant = 'contained', active = false, size = 'medium', textColor }) => {
|
|
541
606
|
const sizeConfig = sizeStyles[size];
|
|
607
|
+
const overrides = textColor ? {
|
|
608
|
+
...(variant !== 'contained' && { color: theme.colors[textColor] }),
|
|
609
|
+
...(variant === 'outlined' && { border: `1px solid ${theme.colors[textColor]}` }),
|
|
610
|
+
} : {};
|
|
542
611
|
return {
|
|
543
612
|
display: 'inline-flex',
|
|
544
613
|
alignItems: 'center',
|
|
@@ -559,20 +628,115 @@ const ICON_BUTTON_STYLES = theme.createStyles((theme) => {
|
|
|
559
628
|
':hover': variantStyles[variant].hover,
|
|
560
629
|
':active': variantStyles[variant].pressed,
|
|
561
630
|
':disabled': variantStyles[variant].disabled,
|
|
631
|
+
...overrides,
|
|
562
632
|
};
|
|
563
633
|
},
|
|
564
634
|
};
|
|
565
635
|
});
|
|
566
636
|
|
|
567
|
-
const IconButton = ({ icon, variant = 'contained', active = false, type = 'button', onClick, disabled, textColor: customTextColor, size = 'medium' }) => {
|
|
637
|
+
const IconButton = ({ icon, variant = 'contained', active = false, type = 'button', onClick, disabled, textColor: customTextColor, size = 'medium', ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
568
638
|
const theme$1 = theme.useTheme();
|
|
569
639
|
const variantStyles = getButtonVariantStyles(theme$1);
|
|
570
640
|
const textColor = disabled ? 'disabledText' : (customTextColor ?? variantStyles[variant].textColor);
|
|
571
641
|
const iconSize = getIconButtonSizeStyles()[size].iconSize;
|
|
572
|
-
return (jsxRuntime.jsx("button", { onClick: onClick, disabled: disabled, type: type, className: ICON_BUTTON_STYLES.root({ variant, active, size }), children: jsxRuntime.jsx(Icon, { color: textColor, size: iconSize, children: icon }) }));
|
|
642
|
+
return (jsxRuntime.jsx("button", { onClick: onClick, disabled: disabled, type: type, className: ICON_BUTTON_STYLES.root({ variant, active, size, textColor: customTextColor }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: jsxRuntime.jsx(Icon, { color: textColor, size: iconSize, children: icon }) }));
|
|
573
643
|
};
|
|
574
644
|
IconButton.displayName = 'IconButton';
|
|
575
645
|
|
|
646
|
+
const FORM_STYLES = theme.createStyles(() => ({
|
|
647
|
+
root: {
|
|
648
|
+
display: 'contents',
|
|
649
|
+
},
|
|
650
|
+
}));
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Form component - A transparent wrapper for form elements with automatic preventDefault handling
|
|
654
|
+
*/
|
|
655
|
+
const Form = ({ children, onSubmit, ariaLabel, }) => {
|
|
656
|
+
const handleSubmit = react.useCallback((e) => {
|
|
657
|
+
e.preventDefault();
|
|
658
|
+
onSubmit?.(e);
|
|
659
|
+
}, [onSubmit]);
|
|
660
|
+
return (jsxRuntime.jsx("form", { onSubmit: handleSubmit, className: FORM_STYLES.root, "aria-label": ariaLabel, children: children }));
|
|
661
|
+
};
|
|
662
|
+
Form.displayName = 'Form';
|
|
663
|
+
var Form_default = react.memo(Form);
|
|
664
|
+
|
|
665
|
+
/**
|
|
666
|
+
* Input styles using createStyles from @aurora-ds/theme
|
|
667
|
+
*/
|
|
668
|
+
const INPUT_STYLES = theme.createStyles((theme) => ({
|
|
669
|
+
container: ({ width }) => ({
|
|
670
|
+
position: 'relative',
|
|
671
|
+
display: 'block',
|
|
672
|
+
width: width ?? '100%',
|
|
673
|
+
'&:hover:not(.disabled) input': {
|
|
674
|
+
borderColor: theme.colors.primaryHover,
|
|
675
|
+
},
|
|
676
|
+
}),
|
|
677
|
+
startIcon: {
|
|
678
|
+
position: 'absolute',
|
|
679
|
+
left: theme.spacing.md,
|
|
680
|
+
top: '50%',
|
|
681
|
+
transform: 'translateY(-50%)',
|
|
682
|
+
pointerEvents: 'none',
|
|
683
|
+
},
|
|
684
|
+
endIcon: {
|
|
685
|
+
position: 'absolute',
|
|
686
|
+
right: theme.spacing.md,
|
|
687
|
+
top: '50%',
|
|
688
|
+
transform: 'translateY(-50%)',
|
|
689
|
+
zIndex: 1,
|
|
690
|
+
},
|
|
691
|
+
endIconShifted: {
|
|
692
|
+
position: 'absolute',
|
|
693
|
+
right: `calc(${theme.spacing.md} + 1.5rem)`,
|
|
694
|
+
top: '50%',
|
|
695
|
+
transform: 'translateY(-50%)',
|
|
696
|
+
zIndex: 1,
|
|
697
|
+
},
|
|
698
|
+
passwordToggle: {
|
|
699
|
+
position: 'absolute',
|
|
700
|
+
right: theme.spacing.sm,
|
|
701
|
+
top: '50%',
|
|
702
|
+
transform: 'translateY(-50%)',
|
|
703
|
+
zIndex: 2,
|
|
704
|
+
},
|
|
705
|
+
root: ({ disabled = false, hasStartIcon = false, hasEndIcon = false, hasPasswordToggle = false }) => ({
|
|
706
|
+
boxSizing: 'border-box',
|
|
707
|
+
width: '100%',
|
|
708
|
+
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
709
|
+
paddingLeft: hasStartIcon ? `calc(${theme.spacing.md} + 1.5rem)` : theme.spacing.md,
|
|
710
|
+
paddingRight: `calc(${theme.spacing.md} + ${hasEndIcon ? '1.5rem' : '0px'} + ${hasPasswordToggle ? '1.5rem' : '0px'})`,
|
|
711
|
+
border: `1px solid ${theme.colors.border}`,
|
|
712
|
+
borderRadius: theme.radius.md,
|
|
713
|
+
fontSize: theme.fontSize.md,
|
|
714
|
+
fontFamily: 'inherit',
|
|
715
|
+
backgroundColor: theme.colors.surface,
|
|
716
|
+
color: theme.colors.text,
|
|
717
|
+
transition: `border-color ${theme.transition.fast}`,
|
|
718
|
+
outline: 'none',
|
|
719
|
+
minHeight: BUTTON_SIZE,
|
|
720
|
+
maxHeight: BUTTON_SIZE,
|
|
721
|
+
lineHeight: theme.lineHeight.none,
|
|
722
|
+
textOverflow: 'ellipsis',
|
|
723
|
+
overflow: 'hidden',
|
|
724
|
+
whiteSpace: 'nowrap',
|
|
725
|
+
':focus': {
|
|
726
|
+
borderColor: theme.colors.primary,
|
|
727
|
+
},
|
|
728
|
+
'::placeholder': {
|
|
729
|
+
color: theme.colors.textTertiary,
|
|
730
|
+
fontSize: theme.fontSize.md,
|
|
731
|
+
},
|
|
732
|
+
...(disabled && {
|
|
733
|
+
color: theme.colors.disabledText,
|
|
734
|
+
cursor: 'not-allowed',
|
|
735
|
+
opacity: theme.opacity.high
|
|
736
|
+
}),
|
|
737
|
+
}),
|
|
738
|
+
}));
|
|
739
|
+
|
|
576
740
|
/**
|
|
577
741
|
* Stack styles using createStyles from @aurora-ds/theme
|
|
578
742
|
*/
|
|
@@ -599,7 +763,7 @@ const STACK_STYLES = theme.createStyles((theme) => ({
|
|
|
599
763
|
* - `row`: Horizontal layout (default)
|
|
600
764
|
* - `column`: Vertical layout
|
|
601
765
|
*/
|
|
602
|
-
const Stack = ({ children, direction = 'row', gap = 'sm', width, height, align = 'center', justify, wrap, padding, }) => {
|
|
766
|
+
const Stack = ({ children, direction = 'row', gap = 'sm', width, height, align = 'center', justify, wrap, padding, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
603
767
|
return (jsxRuntime.jsx("div", { className: STACK_STYLES.root({
|
|
604
768
|
direction,
|
|
605
769
|
gap,
|
|
@@ -609,10 +773,123 @@ const Stack = ({ children, direction = 'row', gap = 'sm', width, height, align =
|
|
|
609
773
|
justify,
|
|
610
774
|
wrap,
|
|
611
775
|
padding,
|
|
612
|
-
}), children: children }));
|
|
776
|
+
}), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: children }));
|
|
613
777
|
};
|
|
614
778
|
Stack.displayName = 'Stack';
|
|
615
779
|
|
|
780
|
+
const ChevronDownIcon = () => {
|
|
781
|
+
return (jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '100%', height: '100%', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', "stroke-width": '2', "stroke-linecap": 'round', "stroke-linejoin": 'round', className: 'lucide lucide-chevron-down-icon lucide-chevron-down', children: jsxRuntime.jsx("path", { d: 'm6 9 6 6 6-6' }) }));
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
const ChevronRightIcon = () => {
|
|
785
|
+
return (jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', "stroke-width": '2', "stroke-linecap": 'round', "stroke-linejoin": 'round', className: 'lucide lucide-chevron-right-icon lucide-chevron-right', children: jsxRuntime.jsx("path", { d: 'm9 18 6-6-6-6' }) }));
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
const EyeIcon = () => {
|
|
789
|
+
return (jsxRuntime.jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', "stroke-width": '2', "stroke-linecap": 'round', "stroke-linejoin": 'round', className: 'lucide lucide-eye-icon lucide-eye', children: [jsxRuntime.jsx("path", { d: 'M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0' }), jsxRuntime.jsx("circle", { cx: '12', cy: '12', r: '3' })] }));
|
|
790
|
+
};
|
|
791
|
+
|
|
792
|
+
const EyeOffIcon = () => {
|
|
793
|
+
return (jsxRuntime.jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', "stroke-width": '2', "stroke-linecap": 'round', "stroke-linejoin": 'round', className: 'lucide lucide-eye-off-icon lucide-eye-off', children: [jsxRuntime.jsx("path", { d: 'M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49' }), jsxRuntime.jsx("path", { d: 'M14.084 14.158a3 3 0 0 1-4.242-4.242' }), jsxRuntime.jsx("path", { d: 'M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143' }), jsxRuntime.jsx("path", { d: 'm2 2 20 20' })] }));
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
const MoreHorizontalIcon = () => {
|
|
797
|
+
return (jsxRuntime.jsxs("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '24', height: '24', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', "stroke-width": '2', "stroke-linecap": 'round', "stroke-linejoin": 'round', className: 'lucide lucide-ellipsis-icon lucide-ellipsis', children: [jsxRuntime.jsx("circle", { cx: '12', cy: '12', r: '1' }), jsxRuntime.jsx("circle", { cx: '19', cy: '12', r: '1' }), jsxRuntime.jsx("circle", { cx: '5', cy: '12', r: '1' })] }));
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Input component
|
|
802
|
+
*/
|
|
803
|
+
const Input = react.forwardRef(({ value, onChange, label, mandatory = false, placeholder, disabled = false, type = 'text', ariaLabel, startIcon, endIcon, width, }, ref) => {
|
|
804
|
+
const [showPassword, setShowPassword] = react.useState(false);
|
|
805
|
+
const handleChange = (event) => {
|
|
806
|
+
onChange(event.target.value);
|
|
807
|
+
};
|
|
808
|
+
const inputType = type === 'password' ? (showPassword ? 'text' : 'password') : type;
|
|
809
|
+
const hasPasswordToggle = type === 'password';
|
|
810
|
+
return (jsxRuntime.jsxs(Stack, { direction: 'column', gap: 'xs', align: 'stretch', width: width ?? '100%', children: [label && (jsxRuntime.jsxs(Stack, { direction: 'row', gap: 'xs', align: 'center', children: [jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', children: label }), mandatory && (jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', color: 'error', children: "*" }))] })), jsxRuntime.jsxs("div", { className: `${INPUT_STYLES.container({ width })} ${disabled ? 'disabled' : ''}`, children: [jsxRuntime.jsx("input", { ref: ref, type: inputType, value: value, onChange: handleChange, placeholder: placeholder, disabled: disabled, className: INPUT_STYLES.root({ disabled, hasStartIcon: !!startIcon, hasEndIcon: !!endIcon, hasPasswordToggle }), "aria-label": ariaLabel || label }), startIcon && (jsxRuntime.jsx("div", { className: INPUT_STYLES.startIcon, children: jsxRuntime.jsx(Icon, { color: 'textTertiary', children: startIcon }) })), endIcon && (jsxRuntime.jsx("div", { className: hasPasswordToggle ? INPUT_STYLES.endIconShifted : INPUT_STYLES.endIcon, children: jsxRuntime.jsx(Icon, { color: 'textTertiary', children: endIcon }) })), hasPasswordToggle && (jsxRuntime.jsx("div", { className: INPUT_STYLES.passwordToggle, children: jsxRuntime.jsx(IconButton, { icon: showPassword ? jsxRuntime.jsx(EyeOffIcon, {}) : jsxRuntime.jsx(EyeIcon, {}), onClick: () => setShowPassword(!showPassword), disabled: disabled, ariaLabel: ariaLabel || label, variant: 'text', size: 'small', textColor: 'textSecondary' }) }))] })] }));
|
|
811
|
+
});
|
|
812
|
+
Input.displayName = 'Input';
|
|
813
|
+
var Input_default = react.memo(Input);
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* TextArea styles using createStyles from @aurora-ds/theme
|
|
817
|
+
*/
|
|
818
|
+
const TEXTAREA_STYLES = theme.createStyles((theme) => ({
|
|
819
|
+
container: ({ width }) => ({
|
|
820
|
+
position: 'relative',
|
|
821
|
+
display: 'inline-block',
|
|
822
|
+
width: width ?? '100%',
|
|
823
|
+
'&:hover:not(.disabled) textarea': {
|
|
824
|
+
borderColor: theme.colors.primaryHover,
|
|
825
|
+
},
|
|
826
|
+
}),
|
|
827
|
+
root: ({ disabled = false }) => ({
|
|
828
|
+
boxSizing: 'border-box',
|
|
829
|
+
width: '100%',
|
|
830
|
+
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
831
|
+
border: `1px solid ${theme.colors.border}`,
|
|
832
|
+
borderRadius: theme.radius.md,
|
|
833
|
+
fontSize: theme.fontSize.md,
|
|
834
|
+
fontFamily: 'inherit',
|
|
835
|
+
backgroundColor: theme.colors.surface,
|
|
836
|
+
color: theme.colors.text,
|
|
837
|
+
transition: `border-color ${theme.transition.fast}`,
|
|
838
|
+
outline: 'none',
|
|
839
|
+
lineHeight: theme.lineHeight.normal,
|
|
840
|
+
resize: 'none',
|
|
841
|
+
overflow: 'hidden',
|
|
842
|
+
':focus': {
|
|
843
|
+
borderColor: theme.colors.primary,
|
|
844
|
+
},
|
|
845
|
+
'::placeholder': {
|
|
846
|
+
color: theme.colors.textTertiary,
|
|
847
|
+
fontSize: theme.fontSize.md,
|
|
848
|
+
textOverflow: 'ellipsis',
|
|
849
|
+
overflow: 'hidden',
|
|
850
|
+
whiteSpace: 'nowrap',
|
|
851
|
+
},
|
|
852
|
+
...(disabled && {
|
|
853
|
+
color: theme.colors.disabledText,
|
|
854
|
+
cursor: 'not-allowed',
|
|
855
|
+
opacity: theme.opacity.high
|
|
856
|
+
}),
|
|
857
|
+
}),
|
|
858
|
+
}));
|
|
859
|
+
|
|
860
|
+
/**
|
|
861
|
+
* TextArea component with auto-expanding height based on content
|
|
862
|
+
*/
|
|
863
|
+
const TextArea = react.forwardRef(({ value, onChange, label, mandatory = false, placeholder, disabled = false, ariaLabel, width, minRows = 3, maxRows, }, ref) => {
|
|
864
|
+
const internalRef = react.useRef(null);
|
|
865
|
+
const textareaRef = ref || internalRef;
|
|
866
|
+
const adjustHeight = react.useCallback(() => {
|
|
867
|
+
const textarea = textareaRef.current;
|
|
868
|
+
if (textarea) {
|
|
869
|
+
// Reset height to calculate the correct scrollHeight
|
|
870
|
+
textarea.style.height = 'auto';
|
|
871
|
+
// Set minHeight based on minRows
|
|
872
|
+
const lineHeight = parseInt(getComputedStyle(textarea).lineHeight) || 20;
|
|
873
|
+
const minHeight = lineHeight * minRows;
|
|
874
|
+
const maxHeight = maxRows ? lineHeight * maxRows : Infinity;
|
|
875
|
+
// Set the height to the greater of minHeight or scrollHeight, but capped at maxHeight
|
|
876
|
+
const newHeight = Math.min(Math.max(minHeight, textarea.scrollHeight), maxHeight);
|
|
877
|
+
textarea.style.height = `${newHeight}px`;
|
|
878
|
+
// Enable scrolling if content exceeds maxHeight
|
|
879
|
+
textarea.style.overflowY = textarea.scrollHeight > maxHeight ? 'auto' : 'hidden';
|
|
880
|
+
}
|
|
881
|
+
}, [minRows, maxRows, textareaRef]);
|
|
882
|
+
react.useEffect(() => {
|
|
883
|
+
adjustHeight();
|
|
884
|
+
}, [value, adjustHeight]);
|
|
885
|
+
const handleChange = (event) => {
|
|
886
|
+
onChange(event.target.value);
|
|
887
|
+
};
|
|
888
|
+
return (jsxRuntime.jsxs(Stack, { direction: 'column', gap: 'xs', align: 'stretch', width: width ?? '100%', children: [label && (jsxRuntime.jsxs(Stack, { direction: 'row', gap: 'xs', align: 'center', children: [jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', children: label }), mandatory && (jsxRuntime.jsx(Text, { variant: 'label', fontSize: 'sm', color: 'error', children: "*" }))] })), jsxRuntime.jsx("div", { className: `${TEXTAREA_STYLES.container({ width })} ${disabled ? 'disabled' : ''}`, children: jsxRuntime.jsx("textarea", { ref: textareaRef, value: value, onChange: handleChange, placeholder: placeholder, disabled: disabled, className: TEXTAREA_STYLES.root({ disabled }), "aria-label": ariaLabel || label, rows: minRows }) })] }));
|
|
889
|
+
});
|
|
890
|
+
TextArea.displayName = 'TextArea';
|
|
891
|
+
var TextArea_default = react.memo(TextArea);
|
|
892
|
+
|
|
616
893
|
/**
|
|
617
894
|
* Card styles using createStyles from @aurora-ds/theme
|
|
618
895
|
*/
|
|
@@ -644,7 +921,7 @@ const CARD_STYLES = theme.createStyles((theme) => ({
|
|
|
644
921
|
* - `column`: Vertical layout (default)
|
|
645
922
|
* - `row`: Horizontal layout
|
|
646
923
|
*/
|
|
647
|
-
const Card = ({ children, direction = 'column', padding = 'md', width, height, gap, radius = 'md', shadow = 'sm', align, justify, backgroundColor = 'surface', borderColor }) => {
|
|
924
|
+
const Card = ({ children, direction = 'column', padding = 'md', width, height, gap, radius = 'md', shadow = 'sm', align, justify, backgroundColor = 'surface', borderColor, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
648
925
|
return (jsxRuntime.jsx("div", { className: CARD_STYLES.root({
|
|
649
926
|
direction,
|
|
650
927
|
padding,
|
|
@@ -657,7 +934,7 @@ const Card = ({ children, direction = 'column', padding = 'md', width, height, g
|
|
|
657
934
|
justify,
|
|
658
935
|
backgroundColor,
|
|
659
936
|
borderColor
|
|
660
|
-
}), children: children }));
|
|
937
|
+
}), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: children }));
|
|
661
938
|
};
|
|
662
939
|
Card.displayName = 'Card';
|
|
663
940
|
|
|
@@ -713,7 +990,7 @@ const GRID_STYLES = theme.createStyles((theme) => ({
|
|
|
713
990
|
* - Use `rows` to define the number of rows or a custom grid-template-rows value
|
|
714
991
|
* - Use `minChildWidth` for responsive auto-fill grids
|
|
715
992
|
*/
|
|
716
|
-
const Grid = ({ children, columns = 1, rows, gap = 'sm', columnGap, rowGap, width, height, alignItems, justifyItems, alignContent, justifyContent, padding, minChildWidth, }) => {
|
|
993
|
+
const Grid = ({ children, columns = 1, rows, gap = 'sm', columnGap, rowGap, width, height, alignItems, justifyItems, alignContent, justifyContent, padding, minChildWidth, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
717
994
|
return (jsxRuntime.jsx("div", { className: GRID_STYLES.root({
|
|
718
995
|
columns,
|
|
719
996
|
rows,
|
|
@@ -728,10 +1005,66 @@ const Grid = ({ children, columns = 1, rows, gap = 'sm', columnGap, rowGap, widt
|
|
|
728
1005
|
justifyContent,
|
|
729
1006
|
padding,
|
|
730
1007
|
minChildWidth,
|
|
731
|
-
}), children: children }));
|
|
1008
|
+
}), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: children }));
|
|
732
1009
|
};
|
|
733
1010
|
Grid.displayName = 'Grid';
|
|
734
1011
|
|
|
1012
|
+
const PAGE_SECTION_STYLES = theme.createStyles((theme) => ({
|
|
1013
|
+
root: ({ gap, paddingHorizontal, paddingVertical, alignItems = 'center', maxWidth, minHeight }) => ({
|
|
1014
|
+
display: 'flex',
|
|
1015
|
+
flexDirection: 'column',
|
|
1016
|
+
gap: gap || theme.spacing.xl,
|
|
1017
|
+
padding: `${paddingVertical ? theme.spacing[paddingVertical] : theme.spacing['3xl']} ${paddingHorizontal ? theme.spacing[paddingHorizontal] : theme.spacing.xl}`,
|
|
1018
|
+
alignItems,
|
|
1019
|
+
maxWidth,
|
|
1020
|
+
minHeight,
|
|
1021
|
+
width: '100%',
|
|
1022
|
+
margin: '0 auto'
|
|
1023
|
+
})
|
|
1024
|
+
}));
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* PageSection component
|
|
1028
|
+
*
|
|
1029
|
+
* A layout component that provides consistent spacing and alignment for page sections.
|
|
1030
|
+
* Supports customization of gap, padding, alignment, min height and max width.
|
|
1031
|
+
*/
|
|
1032
|
+
const PageSection = ({ children, gap, paddingHorizontal, paddingVertical, alignItems, maxWidth, minHeight, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
1033
|
+
return (jsxRuntime.jsx("section", { className: PAGE_SECTION_STYLES.root({ gap, paddingHorizontal, paddingVertical, alignItems, maxWidth, minHeight }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: children }));
|
|
1034
|
+
};
|
|
1035
|
+
PageSection.displayName = 'PageSection';
|
|
1036
|
+
|
|
1037
|
+
const PAGE_STYLES = theme.createStyles(() => ({
|
|
1038
|
+
root: ({ backgroundColor, padding }) => ({
|
|
1039
|
+
width: '100%',
|
|
1040
|
+
height: '100%',
|
|
1041
|
+
display: 'flex',
|
|
1042
|
+
flexDirection: 'column',
|
|
1043
|
+
alignItems: 'center',
|
|
1044
|
+
backgroundColor,
|
|
1045
|
+
padding,
|
|
1046
|
+
}),
|
|
1047
|
+
children: ({ maxWidth = '100%' }) => ({
|
|
1048
|
+
maxWidth,
|
|
1049
|
+
height: '100%',
|
|
1050
|
+
marginLeft: 'auto',
|
|
1051
|
+
marginRight: 'auto',
|
|
1052
|
+
width: '100%',
|
|
1053
|
+
flex: 1,
|
|
1054
|
+
})
|
|
1055
|
+
}));
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Page component
|
|
1059
|
+
*
|
|
1060
|
+
* A layout component that provides consistent page structure with optional footer.
|
|
1061
|
+
* Supports customization of dimensions, background, and content constraints.
|
|
1062
|
+
*/
|
|
1063
|
+
const Page = ({ children, footer, maxWidth, backgroundColor, padding, className, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
1064
|
+
return (jsxRuntime.jsxs("div", { className: `${PAGE_STYLES.root({ backgroundColor, padding })} ${className || ''}`, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [jsxRuntime.jsx("div", { className: PAGE_STYLES.children({ maxWidth }), children: children }), footer && (jsxRuntime.jsx("div", { children: footer }))] }));
|
|
1065
|
+
};
|
|
1066
|
+
Page.displayName = 'Page';
|
|
1067
|
+
|
|
735
1068
|
const ACCORDION_STYLES = theme.createStyles((theme) => {
|
|
736
1069
|
return {
|
|
737
1070
|
root: ({ disabled, width }) => ({
|
|
@@ -740,11 +1073,11 @@ const ACCORDION_STYLES = theme.createStyles((theme) => {
|
|
|
740
1073
|
opacity: disabled ? 0.8 : 1,
|
|
741
1074
|
borderRadius: theme.radius.md,
|
|
742
1075
|
}),
|
|
743
|
-
header: ({ disabled, backgroundColor }) => ({
|
|
1076
|
+
header: ({ disabled, backgroundColor, headerPadding }) => ({
|
|
744
1077
|
display: 'flex',
|
|
745
1078
|
alignItems: 'center',
|
|
746
1079
|
width: '100%',
|
|
747
|
-
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
1080
|
+
padding: headerPadding ?? `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
748
1081
|
border: 'none',
|
|
749
1082
|
backgroundColor: backgroundColor ? theme.colors[backgroundColor] : 'transparent',
|
|
750
1083
|
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
@@ -759,24 +1092,20 @@ const ACCORDION_STYLES = theme.createStyles((theme) => {
|
|
|
759
1092
|
transition: `transform ${theme.transition.fast}`,
|
|
760
1093
|
transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
761
1094
|
}),
|
|
762
|
-
content: ({ expanded }) => ({
|
|
1095
|
+
content: ({ expanded, contentPadding }) => ({
|
|
763
1096
|
display: expanded ? 'block' : 'none',
|
|
764
|
-
padding: `0 ${theme.spacing.
|
|
1097
|
+
padding: contentPadding ?? `0 ${theme.spacing.sm} ${theme.spacing.md}`,
|
|
765
1098
|
}),
|
|
766
1099
|
};
|
|
767
1100
|
});
|
|
768
1101
|
|
|
769
|
-
const ChevronDownIcon = () => {
|
|
770
|
-
return (jsxRuntime.jsx("svg", { xmlns: 'http://www.w3.org/2000/svg', width: '100%', height: '100%', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', "stroke-width": '2', "stroke-linecap": 'round', "stroke-linejoin": 'round', className: 'lucide lucide-chevron-down-icon lucide-chevron-down', children: jsxRuntime.jsx("path", { d: 'm6 9 6 6 6-6' }) }));
|
|
771
|
-
};
|
|
772
|
-
|
|
773
1102
|
/**
|
|
774
1103
|
* Accordion component
|
|
775
1104
|
*
|
|
776
1105
|
* A collapsible container that can show/hide content.
|
|
777
1106
|
* Supports controlled and uncontrolled modes.
|
|
778
1107
|
*/
|
|
779
|
-
const Accordion = ({ title, children, expanded, defaultExpanded = false, onChange, disabled = false, icon, backgroundColor, width }) => {
|
|
1108
|
+
const Accordion = ({ title, children, expanded, defaultExpanded = false, onChange, disabled = false, icon, backgroundColor, width, headerPadding, contentPadding, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
780
1109
|
const [internalExpanded, setInternalExpanded] = react.useState(defaultExpanded);
|
|
781
1110
|
// Use controlled value if provided, otherwise use internal state
|
|
782
1111
|
const isExpanded = expanded !== undefined ? expanded : internalExpanded;
|
|
@@ -785,14 +1114,12 @@ const Accordion = ({ title, children, expanded, defaultExpanded = false, onChang
|
|
|
785
1114
|
return;
|
|
786
1115
|
}
|
|
787
1116
|
const newExpanded = !isExpanded;
|
|
788
|
-
// Update internal state for uncontrolled mode
|
|
789
1117
|
if (expanded === undefined) {
|
|
790
1118
|
setInternalExpanded(newExpanded);
|
|
791
1119
|
}
|
|
792
|
-
// Call onChange callback
|
|
793
1120
|
onChange?.(newExpanded);
|
|
794
1121
|
};
|
|
795
|
-
return (jsxRuntime.jsxs("div", { className: ACCORDION_STYLES.root({ disabled, width }), children: [jsxRuntime.jsxs("button", { type: 'button', className: ACCORDION_STYLES.header({ disabled, backgroundColor }), onClick: handleToggle, disabled: disabled, "aria-expanded": isExpanded, children: [jsxRuntime.jsxs(Stack, { direction: 'row', align: 'center', gap: 'sm', width: '100%', children: [icon && (jsxRuntime.jsx(Icon, { color: disabled ? 'disabledText' : 'text', children: icon })), jsxRuntime.jsx(Text, { variant: 'label', color: disabled ? 'disabledText' : 'text', children: title })] }), jsxRuntime.jsx("div", { className: ACCORDION_STYLES.expandIcon({ expanded: isExpanded }), children: jsxRuntime.jsx(Icon, { color: disabled ? 'disabledText' : 'text', children: jsxRuntime.jsx(ChevronDownIcon, {}) }) })] }), jsxRuntime.jsx("div", { className: ACCORDION_STYLES.content({ expanded: isExpanded }), role: 'region', "aria-hidden": !isExpanded, children: children })] }));
|
|
1122
|
+
return (jsxRuntime.jsxs("div", { className: ACCORDION_STYLES.root({ disabled, width }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [jsxRuntime.jsxs("button", { type: 'button', className: ACCORDION_STYLES.header({ disabled, backgroundColor, headerPadding }), onClick: handleToggle, disabled: disabled, "aria-expanded": isExpanded, children: [jsxRuntime.jsxs(Stack, { direction: 'row', align: 'center', gap: 'sm', width: '100%', children: [icon && (jsxRuntime.jsx(Icon, { color: disabled ? 'disabledText' : 'text', children: icon })), jsxRuntime.jsx(Text, { variant: 'label', color: disabled ? 'disabledText' : 'text', children: title })] }), jsxRuntime.jsx("div", { className: ACCORDION_STYLES.expandIcon({ expanded: isExpanded }), children: jsxRuntime.jsx(Icon, { color: disabled ? 'disabledText' : 'text', children: jsxRuntime.jsx(ChevronDownIcon, {}) }) })] }), jsxRuntime.jsx("div", { className: ACCORDION_STYLES.content({ expanded: isExpanded, contentPadding }), role: 'region', "aria-hidden": !isExpanded, children: children })] }));
|
|
796
1123
|
};
|
|
797
1124
|
Accordion.displayName = 'Accordion';
|
|
798
1125
|
|
|
@@ -838,19 +1165,230 @@ const DRAWER_ITEM_STYLES = theme.createStyles((theme) => ({
|
|
|
838
1165
|
* A navigation item for use in drawers/sidebars.
|
|
839
1166
|
* Similar to a text button with selected state support.
|
|
840
1167
|
*/
|
|
841
|
-
const DrawerItem = ({ label, startIcon, endIcon, selected = false, onClick, disabled, chip }) => {
|
|
842
|
-
return (jsxRuntime.jsxs("button", { onClick: onClick, disabled: disabled, type: 'button', className: DRAWER_ITEM_STYLES.root({ selected }), children: [jsxRuntime.jsxs(Stack, { children: [startIcon && (jsxRuntime.jsx(Icon, { children: startIcon })), jsxRuntime.jsx(Text, { variant: 'label', maxLines: 1, children: label }), endIcon && (jsxRuntime.jsx(Icon, { children: endIcon }))] }), chip && !selected && (jsxRuntime.jsx(Chip, { ...chip, size: '2xs', color: chip.color ?? 'info', disabled: disabled }))] }));
|
|
1168
|
+
const DrawerItem = ({ label, startIcon, endIcon, selected = false, onClick, disabled, chip, ariaLabel, ariaLabelledBy, ariaDescribedBy, role, tabIndex, }) => {
|
|
1169
|
+
return (jsxRuntime.jsxs("button", { onClick: onClick, disabled: disabled, type: 'button', className: DRAWER_ITEM_STYLES.root({ selected }), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, children: [jsxRuntime.jsxs(Stack, { children: [startIcon && (jsxRuntime.jsx(Icon, { children: startIcon })), jsxRuntime.jsx(Text, { variant: 'label', maxLines: 1, children: label }), endIcon && (jsxRuntime.jsx(Icon, { children: endIcon }))] }), chip && !selected && (jsxRuntime.jsx(Chip, { ...chip, size: '2xs', color: chip.color ?? 'info', disabled: disabled }))] }));
|
|
843
1170
|
};
|
|
844
1171
|
DrawerItem.displayName = 'DrawerItem';
|
|
845
1172
|
|
|
1173
|
+
/**
|
|
1174
|
+
* Breadcrumb styles using createStyles from @aurora-ds/theme
|
|
1175
|
+
*/
|
|
1176
|
+
const BREADCRUMB_STYLES = theme.createStyles((theme) => ({
|
|
1177
|
+
list: {
|
|
1178
|
+
display: 'flex',
|
|
1179
|
+
flexWrap: 'wrap',
|
|
1180
|
+
alignItems: 'center',
|
|
1181
|
+
gap: theme.spacing.sm,
|
|
1182
|
+
wordBreak: 'break-word',
|
|
1183
|
+
fontSize: theme.fontSize.sm,
|
|
1184
|
+
color: theme.colors.disabledText,
|
|
1185
|
+
listStyle: 'none',
|
|
1186
|
+
margin: 0,
|
|
1187
|
+
padding: 0,
|
|
1188
|
+
},
|
|
1189
|
+
}));
|
|
1190
|
+
|
|
1191
|
+
/**
|
|
1192
|
+
* BreadcrumbEllipsis styles using createStyles from @aurora-ds/theme
|
|
1193
|
+
*/
|
|
1194
|
+
const BREADCRUMB_ELLIPSIS_STYLES = theme.createStyles((theme) => ({
|
|
1195
|
+
item: {
|
|
1196
|
+
display: 'inline-flex',
|
|
1197
|
+
alignItems: 'center',
|
|
1198
|
+
gap: theme.spacing.sm,
|
|
1199
|
+
},
|
|
1200
|
+
ellipsis: {
|
|
1201
|
+
display: 'flex',
|
|
1202
|
+
height: 36,
|
|
1203
|
+
width: 36,
|
|
1204
|
+
alignItems: 'center',
|
|
1205
|
+
justifyContent: 'center',
|
|
1206
|
+
},
|
|
1207
|
+
}));
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* BreadcrumbEllipsis component
|
|
1211
|
+
* Renders an ellipsis item in the breadcrumb (includes the li wrapper)
|
|
1212
|
+
*/
|
|
1213
|
+
const BreadcrumbEllipsis = () => (jsxRuntime.jsx("li", { className: BREADCRUMB_ELLIPSIS_STYLES.item, children: jsxRuntime.jsx("span", { role: 'presentation', "aria-hidden": 'true', className: BREADCRUMB_ELLIPSIS_STYLES.ellipsis, children: jsxRuntime.jsx(Icon, { size: 'md', color: 'disabledText', children: jsxRuntime.jsx(MoreHorizontalIcon, {}) }) }) }));
|
|
1214
|
+
BreadcrumbEllipsis.displayName = 'BreadcrumbEllipsis';
|
|
1215
|
+
|
|
1216
|
+
/**
|
|
1217
|
+
* BreadcrumbSeparator component
|
|
1218
|
+
*/
|
|
1219
|
+
const BreadcrumbSeparator = () => (jsxRuntime.jsx("li", { role: 'presentation', "aria-hidden": 'true', children: jsxRuntime.jsx(Icon, { color: 'disabledText', size: 'sm', children: jsxRuntime.jsx(ChevronRightIcon, {}) }) }));
|
|
1220
|
+
BreadcrumbSeparator.displayName = 'BreadcrumbSeparator';
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Inserts separators between breadcrumb items automatically
|
|
1224
|
+
*/
|
|
1225
|
+
const insertSeparators = (items, SeparatorComponent) => {
|
|
1226
|
+
const result = [];
|
|
1227
|
+
items.forEach((item, index) => {
|
|
1228
|
+
// Add the item with a key
|
|
1229
|
+
const itemWithKey = react.isValidElement(item)
|
|
1230
|
+
? react.cloneElement(item, { key: `item-${index}` })
|
|
1231
|
+
: item;
|
|
1232
|
+
result.push(itemWithKey);
|
|
1233
|
+
// Add separator after each item except the last one
|
|
1234
|
+
if (index < items.length - 1) {
|
|
1235
|
+
result.push(jsxRuntime.jsx(SeparatorComponent, {}, `sep-${index}`));
|
|
1236
|
+
}
|
|
1237
|
+
});
|
|
1238
|
+
return result;
|
|
1239
|
+
};
|
|
1240
|
+
|
|
1241
|
+
/**
|
|
1242
|
+
* Builds the breadcrumb children with ellipsis logic
|
|
1243
|
+
*/
|
|
1244
|
+
const buildBreadcrumbChildren = (items, maxItems, EllipsisComponent, SeparatorComponent) => {
|
|
1245
|
+
if (!maxItems || items.length <= maxItems) {
|
|
1246
|
+
return insertSeparators(items, SeparatorComponent);
|
|
1247
|
+
}
|
|
1248
|
+
// First item
|
|
1249
|
+
const firstItem = items[0];
|
|
1250
|
+
// Last (maxItems - 1) items
|
|
1251
|
+
const lastItemsCount = maxItems - 1;
|
|
1252
|
+
const lastItems = items.slice(-lastItemsCount);
|
|
1253
|
+
// Build the result: first + separator + ellipsis + separator + last items with separators between them
|
|
1254
|
+
const result = [];
|
|
1255
|
+
// Add first item with key
|
|
1256
|
+
const firstWithKey = react.isValidElement(firstItem)
|
|
1257
|
+
? react.cloneElement(firstItem, { key: 'first' })
|
|
1258
|
+
: firstItem;
|
|
1259
|
+
result.push(firstWithKey);
|
|
1260
|
+
// Add separator + ellipsis + separator
|
|
1261
|
+
result.push(jsxRuntime.jsx(SeparatorComponent, {}, 'sep-ellipsis-before'));
|
|
1262
|
+
result.push(jsxRuntime.jsx(EllipsisComponent, {}, 'ellipsis'));
|
|
1263
|
+
result.push(jsxRuntime.jsx(SeparatorComponent, {}, 'sep-ellipsis-after'));
|
|
1264
|
+
// Add last items with separators between them
|
|
1265
|
+
lastItems.forEach((item, index) => {
|
|
1266
|
+
const itemWithKey = react.isValidElement(item)
|
|
1267
|
+
? react.cloneElement(item, { key: `last-${index}` })
|
|
1268
|
+
: item;
|
|
1269
|
+
result.push(itemWithKey);
|
|
1270
|
+
// Add separator between items (but not after the last one)
|
|
1271
|
+
if (index < lastItems.length - 1) {
|
|
1272
|
+
result.push(jsxRuntime.jsx(SeparatorComponent, {}, `sep-last-${index}`));
|
|
1273
|
+
}
|
|
1274
|
+
});
|
|
1275
|
+
return result;
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Flattens children, extracting children from Fragments
|
|
1280
|
+
*/
|
|
1281
|
+
const flattenChildren = (children) => {
|
|
1282
|
+
const result = [];
|
|
1283
|
+
react.Children.forEach(children, (child) => {
|
|
1284
|
+
if (react.isValidElement(child) && child.type === react.Fragment) {
|
|
1285
|
+
result.push(...flattenChildren(child.props.children));
|
|
1286
|
+
}
|
|
1287
|
+
else {
|
|
1288
|
+
result.push(child);
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
return result;
|
|
1292
|
+
};
|
|
1293
|
+
|
|
1294
|
+
/**
|
|
1295
|
+
* Checks if a React element is a BreadcrumbSeparator
|
|
1296
|
+
*/
|
|
1297
|
+
const isSeparator = (child) => {
|
|
1298
|
+
return react.isValidElement(child) && child.type?.displayName === 'BreadcrumbSeparator';
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* Breadcrumb component
|
|
1303
|
+
* Navigation component for hierarchical page structures
|
|
1304
|
+
*
|
|
1305
|
+
* @param maxItems - Maximum number of items to display (minimum 2).
|
|
1306
|
+
* If exceeded, shows: first item + ellipsis + last (maxItems - 1) items
|
|
1307
|
+
* @param children
|
|
1308
|
+
* @param props
|
|
1309
|
+
*/
|
|
1310
|
+
const Breadcrumb = react.memo(({ maxItems, children, ...props }) => {
|
|
1311
|
+
const allChildren = flattenChildren(children);
|
|
1312
|
+
// Filter out any manually added separators (in case user added them)
|
|
1313
|
+
const items = allChildren.filter(child => !isSeparator(child));
|
|
1314
|
+
const renderedChildren = react.useMemo(() => buildBreadcrumbChildren(items, maxItems, BreadcrumbEllipsis, BreadcrumbSeparator), [items, maxItems]);
|
|
1315
|
+
return (jsxRuntime.jsx("nav", { "aria-label": 'breadcrumb', ...props, children: jsxRuntime.jsx("ol", { className: BREADCRUMB_STYLES.list, children: renderedChildren }) }));
|
|
1316
|
+
});
|
|
1317
|
+
Breadcrumb.displayName = 'Breadcrumb';
|
|
1318
|
+
|
|
1319
|
+
/**
|
|
1320
|
+
* BreadcrumbLink styles using createStyles from @aurora-ds/theme
|
|
1321
|
+
*/
|
|
1322
|
+
const BREADCRUMB_LINK_STYLES = theme.createStyles((theme) => ({
|
|
1323
|
+
item: {
|
|
1324
|
+
display: 'inline-flex',
|
|
1325
|
+
alignItems: 'center',
|
|
1326
|
+
gap: theme.spacing.sm,
|
|
1327
|
+
cursor: 'pointer'
|
|
1328
|
+
},
|
|
1329
|
+
link: {
|
|
1330
|
+
transition: `color ${theme.transition.fast}, text-decoration-color ${theme.transition.fast}`,
|
|
1331
|
+
color: theme.colors.disabledText,
|
|
1332
|
+
textDecoration: 'underline',
|
|
1333
|
+
textDecorationColor: 'transparent',
|
|
1334
|
+
textUnderlineOffset: '3px',
|
|
1335
|
+
':hover': {
|
|
1336
|
+
color: theme.colors.primary,
|
|
1337
|
+
textDecorationColor: 'currentColor',
|
|
1338
|
+
},
|
|
1339
|
+
},
|
|
1340
|
+
}));
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* BreadcrumbLink component
|
|
1344
|
+
* Renders a clickable breadcrumb item with a link
|
|
1345
|
+
*/
|
|
1346
|
+
const BreadcrumbLink = react.memo((props) => {
|
|
1347
|
+
const { children, onClick } = props;
|
|
1348
|
+
return (jsxRuntime.jsx("li", { className: BREADCRUMB_LINK_STYLES.item, children: jsxRuntime.jsx("a", { className: BREADCRUMB_LINK_STYLES.link, onClick: onClick, children: jsxRuntime.jsx(Text, { variant: 'span', fontSize: 'sm', children: children }) }) }));
|
|
1349
|
+
});
|
|
1350
|
+
BreadcrumbLink.displayName = 'BreadcrumbLink';
|
|
1351
|
+
|
|
1352
|
+
/**
|
|
1353
|
+
* BreadcrumbPage styles using createStyles from @aurora-ds/theme
|
|
1354
|
+
*/
|
|
1355
|
+
const BREADCRUMB_PAGE_STYLES = theme.createStyles((theme) => ({
|
|
1356
|
+
item: {
|
|
1357
|
+
display: 'inline-flex',
|
|
1358
|
+
alignItems: 'center',
|
|
1359
|
+
gap: theme.spacing.sm,
|
|
1360
|
+
},
|
|
1361
|
+
page: {
|
|
1362
|
+
fontWeight: theme.fontWeight.medium,
|
|
1363
|
+
color: theme.colors.primary,
|
|
1364
|
+
},
|
|
1365
|
+
}));
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* BreadcrumbPage component
|
|
1369
|
+
* Renders the current page (non-clickable) in the breadcrumb
|
|
1370
|
+
*/
|
|
1371
|
+
const BreadcrumbPage = react.memo(({ children }) => (jsxRuntime.jsx("li", { className: BREADCRUMB_PAGE_STYLES.item, children: jsxRuntime.jsx("span", { className: BREADCRUMB_PAGE_STYLES.page, children: jsxRuntime.jsx(Text, { variant: 'span', fontSize: 'sm', color: 'primary', children: children }) }) })));
|
|
1372
|
+
BreadcrumbPage.displayName = 'BreadcrumbPage';
|
|
1373
|
+
|
|
846
1374
|
exports.Accordion = Accordion;
|
|
1375
|
+
exports.Breadcrumb = Breadcrumb;
|
|
1376
|
+
exports.BreadcrumbEllipsis = BreadcrumbEllipsis;
|
|
1377
|
+
exports.BreadcrumbLink = BreadcrumbLink;
|
|
1378
|
+
exports.BreadcrumbPage = BreadcrumbPage;
|
|
1379
|
+
exports.BreadcrumbSeparator = BreadcrumbSeparator;
|
|
847
1380
|
exports.Button = Button;
|
|
848
1381
|
exports.Card = Card;
|
|
849
1382
|
exports.Chip = Chip;
|
|
850
1383
|
exports.DrawerItem = DrawerItem;
|
|
1384
|
+
exports.Form = Form_default;
|
|
851
1385
|
exports.Grid = Grid;
|
|
852
1386
|
exports.Icon = Icon;
|
|
853
1387
|
exports.IconButton = IconButton;
|
|
1388
|
+
exports.Input = Input_default;
|
|
1389
|
+
exports.Page = Page;
|
|
1390
|
+
exports.PageSection = PageSection;
|
|
854
1391
|
exports.Stack = Stack;
|
|
855
1392
|
exports.Text = Text;
|
|
1393
|
+
exports.TextArea = TextArea_default;
|
|
856
1394
|
//# sourceMappingURL=index.js.map
|