@aurora-ds/components 0.2.0 → 0.4.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/data-display/chip/Chip.props.d.ts +3 -0
- package/dist/cjs/components/index.d.ts +2 -0
- package/dist/cjs/components/layout/accordion/Accordion.d.ts +10 -0
- package/dist/cjs/components/layout/accordion/Accordion.props.d.ts +36 -0
- package/dist/cjs/components/layout/accordion/Accordion.styles.d.ts +7 -0
- package/dist/cjs/components/layout/accordion/index.d.ts +2 -0
- package/dist/cjs/components/navigation/drawer-item/DrawerItem.d.ts +10 -0
- package/dist/cjs/components/navigation/drawer-item/DrawerItem.props.d.ts +32 -0
- package/dist/cjs/components/navigation/drawer-item/DrawerItem.styles.d.ts +7 -0
- package/dist/cjs/components/navigation/drawer-item/index.d.ts +2 -0
- package/dist/cjs/constants/globalConstants.d.ts +1 -1
- package/dist/cjs/index.js +140 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/chip.types.d.ts +1 -1
- package/dist/cjs/resources/Icons.d.ts +3 -0
- package/dist/cjs/resources/icons/ChevronDownIcon.d.ts +1 -0
- package/dist/cjs/resources/icons/InfoIcon.d.ts +1 -0
- package/dist/cjs/utils/ui/components/chip/getChipColorStyles.utils.d.ts +2 -38
- package/dist/esm/components/data-display/chip/Chip.props.d.ts +3 -0
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/layout/accordion/Accordion.d.ts +10 -0
- package/dist/esm/components/layout/accordion/Accordion.props.d.ts +36 -0
- package/dist/esm/components/layout/accordion/Accordion.styles.d.ts +7 -0
- package/dist/esm/components/layout/accordion/index.d.ts +2 -0
- package/dist/esm/components/navigation/drawer-item/DrawerItem.d.ts +10 -0
- package/dist/esm/components/navigation/drawer-item/DrawerItem.props.d.ts +32 -0
- package/dist/esm/components/navigation/drawer-item/DrawerItem.styles.d.ts +7 -0
- package/dist/esm/components/navigation/drawer-item/index.d.ts +2 -0
- package/dist/esm/constants/globalConstants.d.ts +1 -1
- package/dist/esm/index.js +140 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/chip.types.d.ts +1 -1
- package/dist/esm/resources/Icons.d.ts +3 -0
- package/dist/esm/resources/icons/ChevronDownIcon.d.ts +1 -0
- package/dist/esm/resources/icons/InfoIcon.d.ts +1 -0
- package/dist/esm/utils/ui/components/chip/getChipColorStyles.utils.d.ts +2 -38
- package/dist/index.d.ts +69 -3
- package/package.json +2 -2
|
@@ -3,4 +3,4 @@ export type ChipVariant = 'filled' | 'outlined';
|
|
|
3
3
|
/** Chip color options */
|
|
4
4
|
export type ChipColor = 'default' | 'success' | 'warning' | 'error' | 'info';
|
|
5
5
|
/** Chip size options */
|
|
6
|
-
export type ChipSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
6
|
+
export type ChipSize = '2xs' | 'xs' | 'sm' | 'md' | 'lg';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChevronDownIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const InfoIcon: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,42 +1,6 @@
|
|
|
1
1
|
import { Theme } from '@aurora-ds/theme';
|
|
2
|
-
import { ChipStyleParams } from '@components/data-display/chip/Chip.props
|
|
3
|
-
export declare const getChipColorStyles: (theme: Theme, color: ChipStyleParams["color"], variant: ChipStyleParams["variant"]) => {
|
|
4
|
-
backgroundColor: string;
|
|
5
|
-
color: string;
|
|
6
|
-
borderColor: string;
|
|
7
|
-
} | {
|
|
8
|
-
backgroundColor: string;
|
|
9
|
-
color: string;
|
|
10
|
-
borderColor: string;
|
|
11
|
-
} | {
|
|
12
|
-
backgroundColor: string;
|
|
13
|
-
color: string;
|
|
14
|
-
borderColor: string;
|
|
15
|
-
} | {
|
|
16
|
-
backgroundColor: string;
|
|
17
|
-
color: string;
|
|
18
|
-
borderColor: string;
|
|
19
|
-
} | {
|
|
20
|
-
backgroundColor: string;
|
|
21
|
-
color: string;
|
|
22
|
-
borderColor: string;
|
|
23
|
-
} | {
|
|
24
|
-
backgroundColor: string;
|
|
25
|
-
color: string;
|
|
26
|
-
borderColor: string;
|
|
27
|
-
} | {
|
|
28
|
-
backgroundColor: string;
|
|
29
|
-
color: string;
|
|
30
|
-
borderColor: string;
|
|
31
|
-
} | {
|
|
32
|
-
backgroundColor: string;
|
|
33
|
-
color: string;
|
|
34
|
-
borderColor: string;
|
|
35
|
-
} | {
|
|
36
|
-
backgroundColor: string;
|
|
37
|
-
color: string;
|
|
38
|
-
borderColor: string;
|
|
39
|
-
} | {
|
|
2
|
+
import { ChipStyleParams } from '@components/data-display/chip/Chip.props';
|
|
3
|
+
export declare const getChipColorStyles: (theme: Theme, color: ChipStyleParams["color"], variant: ChipStyleParams["variant"], disabled: ChipStyleParams["disabled"]) => {
|
|
40
4
|
backgroundColor: string;
|
|
41
5
|
color: string;
|
|
42
6
|
borderColor: string;
|
|
@@ -16,12 +16,15 @@ export type ChipProps = {
|
|
|
16
16
|
gap?: keyof Theme['spacing'];
|
|
17
17
|
/** Border radius from theme */
|
|
18
18
|
radius?: keyof Theme['radius'];
|
|
19
|
+
/** Disabled state */
|
|
20
|
+
disabled?: boolean;
|
|
19
21
|
};
|
|
20
22
|
export type ChipStyleParams = {
|
|
21
23
|
variant: ChipVariant;
|
|
22
24
|
color: ChipColor;
|
|
23
25
|
size: ChipSize;
|
|
24
26
|
isIconOnly: boolean;
|
|
27
|
+
disabled: boolean;
|
|
25
28
|
gap?: keyof Theme['spacing'];
|
|
26
29
|
radius?: keyof Theme['radius'];
|
|
27
30
|
};
|
|
@@ -5,6 +5,8 @@ export * from '@components/inputs/button';
|
|
|
5
5
|
export * from '@components/inputs/icon-button';
|
|
6
6
|
export * from '@components/layout/stack';
|
|
7
7
|
export * from '@components/layout/card';
|
|
8
|
+
export * from '@components/layout/accordion';
|
|
9
|
+
export * from '@components/navigation/drawer-item';
|
|
8
10
|
export type { ButtonVariants, ButtonVariantStyle } from '@interfaces/button.types';
|
|
9
11
|
export type { TextVariants, TextVariantStyle } from '@interfaces/text.types';
|
|
10
12
|
export type { StackDirection, StackAlign, StackJustify, StackWrap } from '@interfaces/stack.types';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { AccordionProps } from '@components/layout/accordion/Accordion.props.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Accordion component
|
|
5
|
+
*
|
|
6
|
+
* A collapsible container that can show/hide content.
|
|
7
|
+
* Supports controlled and uncontrolled modes.
|
|
8
|
+
*/
|
|
9
|
+
declare const Accordion: FC<AccordionProps>;
|
|
10
|
+
export default Accordion;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Theme } from '@aurora-ds/theme';
|
|
2
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
3
|
+
export type AccordionProps = {
|
|
4
|
+
/** Title displayed in the accordion header */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Content to show/hide when accordion is expanded */
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Whether the accordion is expanded */
|
|
9
|
+
expanded?: boolean;
|
|
10
|
+
/** Default expanded state (for uncontrolled mode) */
|
|
11
|
+
defaultExpanded?: boolean;
|
|
12
|
+
/** Callback fired when the accordion expands or collapses */
|
|
13
|
+
onChange?: (expanded: boolean) => void;
|
|
14
|
+
/** Disabled state */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Optional icon to display before title */
|
|
17
|
+
icon?: ReactNode;
|
|
18
|
+
/** Optional background color */
|
|
19
|
+
backgroundColor?: keyof Theme['colors'];
|
|
20
|
+
/** Optional width */
|
|
21
|
+
width?: CSSProperties['width'];
|
|
22
|
+
};
|
|
23
|
+
export type AccordionStyleParams = {
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
width?: CSSProperties['width'];
|
|
26
|
+
};
|
|
27
|
+
export type AccordionHeaderStyleParams = {
|
|
28
|
+
disabled: boolean;
|
|
29
|
+
backgroundColor?: keyof Theme['colors'];
|
|
30
|
+
};
|
|
31
|
+
export type AccordionContentStyleParams = {
|
|
32
|
+
expanded: boolean;
|
|
33
|
+
};
|
|
34
|
+
export type AccordionIconStyleParams = {
|
|
35
|
+
expanded: boolean;
|
|
36
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AccordionContentStyleParams, AccordionHeaderStyleParams, AccordionIconStyleParams, AccordionStyleParams } from '@components/layout/accordion/Accordion.props.ts';
|
|
2
|
+
export declare const ACCORDION_STYLES: {
|
|
3
|
+
root: (args_0: AccordionStyleParams) => string;
|
|
4
|
+
header: (args_0: AccordionHeaderStyleParams) => string;
|
|
5
|
+
expandIcon: (args_0: AccordionIconStyleParams) => string;
|
|
6
|
+
content: (args_0: AccordionContentStyleParams) => string;
|
|
7
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DrawerItemProps } from '@components/navigation/drawer-item/DrawerItem.props';
|
|
3
|
+
/**
|
|
4
|
+
* DrawerItem component
|
|
5
|
+
*
|
|
6
|
+
* A navigation item for use in drawers/sidebars.
|
|
7
|
+
* Similar to a text button with selected state support.
|
|
8
|
+
*/
|
|
9
|
+
declare const DrawerItem: FC<DrawerItemProps>;
|
|
10
|
+
export default DrawerItem;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ChipColor, ChipVariant } from '@interfaces/chip.types';
|
|
3
|
+
export type DrawerItemProps = {
|
|
4
|
+
/** DrawerItem text label */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Optional icon to display before label */
|
|
7
|
+
startIcon?: ReactNode;
|
|
8
|
+
/** Optional icon to display after label */
|
|
9
|
+
endIcon?: ReactNode;
|
|
10
|
+
/** Click handler */
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
/** Selected state */
|
|
13
|
+
selected?: boolean;
|
|
14
|
+
/** Disabled state */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Optional chip to display */
|
|
17
|
+
chip?: DrawerItemChip;
|
|
18
|
+
};
|
|
19
|
+
type DrawerItemChip = {
|
|
20
|
+
/** Chip text label */
|
|
21
|
+
label?: string;
|
|
22
|
+
/** Chip icon */
|
|
23
|
+
icon?: ReactNode;
|
|
24
|
+
/** Chip color */
|
|
25
|
+
color?: ChipColor;
|
|
26
|
+
/** Chip variant */
|
|
27
|
+
variant?: ChipVariant;
|
|
28
|
+
};
|
|
29
|
+
export type DrawerItemStyleParams = {
|
|
30
|
+
selected?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import require$$0, { useContext, createContext, useMemo, createElement } from 'react';
|
|
1
|
+
import require$$0, { useContext, createContext, useMemo, createElement, useState } from 'react';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = {exports: {}};
|
|
4
4
|
|
|
@@ -1365,6 +1365,7 @@ const ICON_STYLES = pr((theme) => ({
|
|
|
1365
1365
|
justifyContent: 'center',
|
|
1366
1366
|
overflow: 'hidden',
|
|
1367
1367
|
transition: 'color 150ms ease-in-out',
|
|
1368
|
+
flexShrink: 0,
|
|
1368
1369
|
lineHeight: 0,
|
|
1369
1370
|
height: theme.fontSize[size ?? 'md'],
|
|
1370
1371
|
width: theme.fontSize[size ?? 'md'],
|
|
@@ -1413,7 +1414,21 @@ const Icon = ({ children, size, color, backgroundColor, padding, borderRadius, }
|
|
|
1413
1414
|
};
|
|
1414
1415
|
Icon.displayName = 'Icon';
|
|
1415
1416
|
|
|
1416
|
-
const getChipColorStyles = (theme, color, variant) => {
|
|
1417
|
+
const getChipColorStyles = (theme, color, variant, disabled) => {
|
|
1418
|
+
if (disabled) {
|
|
1419
|
+
return {
|
|
1420
|
+
filled: {
|
|
1421
|
+
backgroundColor: theme.colors.disabled,
|
|
1422
|
+
color: theme.colors.disabledText,
|
|
1423
|
+
borderColor: 'transparent',
|
|
1424
|
+
},
|
|
1425
|
+
outlined: {
|
|
1426
|
+
backgroundColor: 'transparent',
|
|
1427
|
+
color: theme.colors.disabledText,
|
|
1428
|
+
borderColor: theme.colors.disabled,
|
|
1429
|
+
},
|
|
1430
|
+
}[variant];
|
|
1431
|
+
}
|
|
1417
1432
|
const colorMap = {
|
|
1418
1433
|
default: {
|
|
1419
1434
|
filled: {
|
|
@@ -1499,6 +1514,10 @@ const getChipColorStyles = (theme, color, variant) => {
|
|
|
1499
1514
|
*/
|
|
1500
1515
|
const getChipSizeStyles = (theme, size, isIconOnly) => {
|
|
1501
1516
|
const sizeMap = {
|
|
1517
|
+
'2xs': {
|
|
1518
|
+
iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize['2xs'] },
|
|
1519
|
+
withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize['2xs'] },
|
|
1520
|
+
},
|
|
1502
1521
|
xs: {
|
|
1503
1522
|
iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize.xs },
|
|
1504
1523
|
withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize.xs },
|
|
@@ -1520,8 +1539,8 @@ const getChipSizeStyles = (theme, size, isIconOnly) => {
|
|
|
1520
1539
|
};
|
|
1521
1540
|
|
|
1522
1541
|
const CHIP_STYLES = pr((theme) => ({
|
|
1523
|
-
root: ({ variant, color, size, isIconOnly, gap, radius }) => {
|
|
1524
|
-
const colorStyles = getChipColorStyles(theme, color, variant);
|
|
1542
|
+
root: ({ variant, color, size, isIconOnly, disabled, gap, radius }) => {
|
|
1543
|
+
const colorStyles = getChipColorStyles(theme, color, variant, disabled);
|
|
1525
1544
|
const sizeStyles = getChipSizeStyles(theme, size, isIconOnly);
|
|
1526
1545
|
return {
|
|
1527
1546
|
display: 'flex',
|
|
@@ -1668,6 +1687,7 @@ Text.displayName = 'Text';
|
|
|
1668
1687
|
*/
|
|
1669
1688
|
const getChipContentSize = (size) => {
|
|
1670
1689
|
const sizeMap = {
|
|
1690
|
+
'2xs': '2xs',
|
|
1671
1691
|
xs: 'xs',
|
|
1672
1692
|
sm: 'sm',
|
|
1673
1693
|
md: 'sm',
|
|
@@ -1688,21 +1708,22 @@ const getChipContentSize = (size) => {
|
|
|
1688
1708
|
* **Colors:**
|
|
1689
1709
|
* - `default`, `primary`, `success`, `warning`, `error`, `info`
|
|
1690
1710
|
*/
|
|
1691
|
-
const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, }) => {
|
|
1711
|
+
const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, disabled = false, }) => {
|
|
1692
1712
|
const isIconOnly = Boolean(icon) && !label;
|
|
1693
1713
|
return (jsxRuntimeExports.jsxs("span", { className: CHIP_STYLES.root({
|
|
1694
1714
|
variant,
|
|
1695
1715
|
color,
|
|
1696
1716
|
size,
|
|
1697
1717
|
isIconOnly,
|
|
1718
|
+
disabled,
|
|
1698
1719
|
gap,
|
|
1699
1720
|
radius,
|
|
1700
1721
|
}), children: [icon && (jsxRuntimeExports.jsx(Icon, { size: getChipContentSize(size), children: icon })), label && (jsxRuntimeExports.jsx(Text, { variant: 'label', fontSize: getChipContentSize(size), children: label }))] }));
|
|
1701
1722
|
};
|
|
1702
1723
|
Chip.displayName = 'Chip';
|
|
1703
1724
|
|
|
1704
|
-
/** Button height constant */
|
|
1705
1725
|
const BUTTON_SIZE = 36;
|
|
1726
|
+
const DRAWER_ITEM_HEIGHT = 32;
|
|
1706
1727
|
|
|
1707
1728
|
/**
|
|
1708
1729
|
* Get button variant styles based on the theme
|
|
@@ -1868,7 +1889,7 @@ const STACK_STYLES = pr((theme) => ({
|
|
|
1868
1889
|
* - `row`: Horizontal layout (default)
|
|
1869
1890
|
* - `column`: Vertical layout
|
|
1870
1891
|
*/
|
|
1871
|
-
const Stack = ({ children, direction = 'row', gap, width, height, align = 'center', justify, wrap, padding, }) => {
|
|
1892
|
+
const Stack = ({ children, direction = 'row', gap = 'sm', width, height, align = 'center', justify, wrap, padding, }) => {
|
|
1872
1893
|
return (jsxRuntimeExports.jsx("div", { className: STACK_STYLES.root({
|
|
1873
1894
|
direction,
|
|
1874
1895
|
gap,
|
|
@@ -1930,5 +1951,116 @@ const Card = ({ children, direction = 'column', padding = 'md', width, height, g
|
|
|
1930
1951
|
};
|
|
1931
1952
|
Card.displayName = 'Card';
|
|
1932
1953
|
|
|
1933
|
-
|
|
1954
|
+
const ACCORDION_STYLES = pr((theme) => {
|
|
1955
|
+
return {
|
|
1956
|
+
root: ({ disabled, width }) => ({
|
|
1957
|
+
width: width ?? '100%',
|
|
1958
|
+
overflow: 'hidden',
|
|
1959
|
+
opacity: disabled ? 0.8 : 1,
|
|
1960
|
+
borderRadius: theme.radius.md,
|
|
1961
|
+
}),
|
|
1962
|
+
header: ({ disabled, backgroundColor }) => ({
|
|
1963
|
+
display: 'flex',
|
|
1964
|
+
alignItems: 'center',
|
|
1965
|
+
width: '100%',
|
|
1966
|
+
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
1967
|
+
border: 'none',
|
|
1968
|
+
backgroundColor: backgroundColor ? theme.colors[backgroundColor] : 'transparent',
|
|
1969
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
1970
|
+
transition: `background-color ${theme.transition.fast}`,
|
|
1971
|
+
gap: theme.spacing.sm,
|
|
1972
|
+
borderRadius: theme.radius.md,
|
|
1973
|
+
':hover': {
|
|
1974
|
+
backgroundColor: disabled ? 'transparent' : theme.colors.surfaceHover,
|
|
1975
|
+
},
|
|
1976
|
+
}),
|
|
1977
|
+
expandIcon: ({ expanded }) => ({
|
|
1978
|
+
transition: `transform ${theme.transition.fast}`,
|
|
1979
|
+
transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
1980
|
+
}),
|
|
1981
|
+
content: ({ expanded }) => ({
|
|
1982
|
+
display: expanded ? 'block' : 'none',
|
|
1983
|
+
padding: `0 ${theme.spacing.md} ${theme.spacing.md}`,
|
|
1984
|
+
}),
|
|
1985
|
+
};
|
|
1986
|
+
});
|
|
1987
|
+
|
|
1988
|
+
const ChevronDownIcon = () => {
|
|
1989
|
+
return (jsxRuntimeExports.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: jsxRuntimeExports.jsx("path", { d: 'm6 9 6 6 6-6' }) }));
|
|
1990
|
+
};
|
|
1991
|
+
|
|
1992
|
+
/**
|
|
1993
|
+
* Accordion component
|
|
1994
|
+
*
|
|
1995
|
+
* A collapsible container that can show/hide content.
|
|
1996
|
+
* Supports controlled and uncontrolled modes.
|
|
1997
|
+
*/
|
|
1998
|
+
const Accordion = ({ title, children, expanded, defaultExpanded = false, onChange, disabled = false, icon, backgroundColor, width }) => {
|
|
1999
|
+
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
2000
|
+
// Use controlled value if provided, otherwise use internal state
|
|
2001
|
+
const isExpanded = expanded !== undefined ? expanded : internalExpanded;
|
|
2002
|
+
const handleToggle = () => {
|
|
2003
|
+
if (disabled) {
|
|
2004
|
+
return;
|
|
2005
|
+
}
|
|
2006
|
+
const newExpanded = !isExpanded;
|
|
2007
|
+
// Update internal state for uncontrolled mode
|
|
2008
|
+
if (expanded === undefined) {
|
|
2009
|
+
setInternalExpanded(newExpanded);
|
|
2010
|
+
}
|
|
2011
|
+
// Call onChange callback
|
|
2012
|
+
onChange?.(newExpanded);
|
|
2013
|
+
};
|
|
2014
|
+
return (jsxRuntimeExports.jsxs("div", { className: ACCORDION_STYLES.root({ disabled, width }), children: [jsxRuntimeExports.jsxs("button", { type: 'button', className: ACCORDION_STYLES.header({ disabled, backgroundColor }), onClick: handleToggle, disabled: disabled, "aria-expanded": isExpanded, children: [jsxRuntimeExports.jsxs(Stack, { direction: 'row', align: 'center', gap: 'sm', width: '100%', children: [icon && (jsxRuntimeExports.jsx(Icon, { color: disabled ? 'disabledText' : 'text', children: icon })), jsxRuntimeExports.jsx(Text, { variant: 'label', color: disabled ? 'disabledText' : 'text', children: title })] }), jsxRuntimeExports.jsx("div", { className: ACCORDION_STYLES.expandIcon({ expanded: isExpanded }), children: jsxRuntimeExports.jsx(Icon, { color: disabled ? 'disabledText' : 'text', children: jsxRuntimeExports.jsx(ChevronDownIcon, {}) }) })] }), jsxRuntimeExports.jsx("div", { className: ACCORDION_STYLES.content({ expanded: isExpanded }), role: 'region', "aria-hidden": !isExpanded, children: children })] }));
|
|
2015
|
+
};
|
|
2016
|
+
Accordion.displayName = 'Accordion';
|
|
2017
|
+
|
|
2018
|
+
/**
|
|
2019
|
+
* DrawerItem styles using createStyles from @aurora-ds/theme
|
|
2020
|
+
*/
|
|
2021
|
+
const DRAWER_ITEM_STYLES = pr((theme) => ({
|
|
2022
|
+
root: ({ selected = false }) => ({
|
|
2023
|
+
display: 'inline-flex',
|
|
2024
|
+
alignItems: 'center',
|
|
2025
|
+
justifyContent: 'space-between',
|
|
2026
|
+
boxSizing: 'border-box',
|
|
2027
|
+
gap: theme.spacing.sm,
|
|
2028
|
+
padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
|
|
2029
|
+
borderRadius: theme.radius.md,
|
|
2030
|
+
cursor: 'pointer',
|
|
2031
|
+
transition: `background-color ${theme.transition.fast}, color ${theme.transition.fast}`,
|
|
2032
|
+
fontFamily: 'inherit',
|
|
2033
|
+
width: '100%',
|
|
2034
|
+
minHeight: DRAWER_ITEM_HEIGHT,
|
|
2035
|
+
maxHeight: DRAWER_ITEM_HEIGHT,
|
|
2036
|
+
backgroundColor: selected ? theme.colors.primary : 'transparent',
|
|
2037
|
+
color: selected ? theme.colors.onPrimary : theme.colors.textSecondary,
|
|
2038
|
+
border: 'none',
|
|
2039
|
+
':hover': {
|
|
2040
|
+
backgroundColor: selected ? theme.colors.primaryHover : theme.colors.surfaceHover,
|
|
2041
|
+
color: selected ? theme.colors.onPrimary : theme.colors.text,
|
|
2042
|
+
},
|
|
2043
|
+
':active': {
|
|
2044
|
+
backgroundColor: selected ? theme.colors.primaryActive : theme.colors.surfaceActive,
|
|
2045
|
+
},
|
|
2046
|
+
':disabled': {
|
|
2047
|
+
color: theme.colors.disabledText,
|
|
2048
|
+
backgroundColor: selected ? theme.colors.disabled : 'transparent',
|
|
2049
|
+
cursor: 'not-allowed',
|
|
2050
|
+
},
|
|
2051
|
+
}),
|
|
2052
|
+
}));
|
|
2053
|
+
|
|
2054
|
+
/**
|
|
2055
|
+
* DrawerItem component
|
|
2056
|
+
*
|
|
2057
|
+
* A navigation item for use in drawers/sidebars.
|
|
2058
|
+
* Similar to a text button with selected state support.
|
|
2059
|
+
*/
|
|
2060
|
+
const DrawerItem = ({ label, startIcon, endIcon, selected = false, onClick, disabled, chip }) => {
|
|
2061
|
+
return (jsxRuntimeExports.jsxs("button", { onClick: onClick, disabled: disabled, type: 'button', className: DRAWER_ITEM_STYLES.root({ selected }), children: [jsxRuntimeExports.jsxs(Stack, { children: [startIcon && (jsxRuntimeExports.jsx(Icon, { children: startIcon })), jsxRuntimeExports.jsx(Text, { variant: 'label', maxLines: 1, children: label }), endIcon && (jsxRuntimeExports.jsx(Icon, { children: endIcon }))] }), chip && !selected && (jsxRuntimeExports.jsx(Chip, { label: chip.label, size: '2xs', color: chip.color ?? 'info', icon: chip.icon, variant: chip.variant, disabled: disabled }))] }));
|
|
2062
|
+
};
|
|
2063
|
+
DrawerItem.displayName = 'DrawerItem';
|
|
2064
|
+
|
|
2065
|
+
export { Accordion, Button, Card, Chip, DrawerItem, Icon, IconButton, Stack, Text };
|
|
1934
2066
|
//# sourceMappingURL=index.js.map
|