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