@aurora-ds/components 0.2.1 → 0.5.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 +1 -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/layout/text/Text.d.ts +1 -0
- package/dist/cjs/components/layout/text/Text.props.d.ts +3 -0
- package/dist/cjs/components/navigation/drawer-item/DrawerItem.d.ts +10 -0
- package/dist/cjs/components/navigation/drawer-item/DrawerItem.props.d.ts +21 -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 +175 -9
- 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/cjs/utils/ui/components/text/parseTextWithBold.utils.d.ts +7 -0
- 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/layout/text/Text.d.ts +1 -0
- package/dist/esm/components/layout/text/Text.props.d.ts +3 -0
- package/dist/esm/components/navigation/drawer-item/DrawerItem.d.ts +10 -0
- package/dist/esm/components/navigation/drawer-item/DrawerItem.props.d.ts +21 -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 +175 -11
- 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/esm/utils/ui/components/text/parseTextWithBold.utils.d.ts +7 -0
- package/dist/index.d.ts +62 -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;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Parses text content and converts **bold** syntax to <strong> elements
|
|
4
|
+
* @param children - The content to parse (string or ReactNode)
|
|
5
|
+
* @returns Parsed content with bold text wrapped in <strong> elements
|
|
6
|
+
*/
|
|
7
|
+
export declare const parseTextWithBold: (children: ReactNode) => ReactNode;
|
|
@@ -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
|
+
};
|
|
@@ -14,6 +14,7 @@ import { TextProps } from '@components/layout/text/Text.props.ts';
|
|
|
14
14
|
* - Theme-aware colors
|
|
15
15
|
* - Text truncation with `maxLines`
|
|
16
16
|
* - Underline support
|
|
17
|
+
* - Bold text with **double asterisks** syntax
|
|
17
18
|
*/
|
|
18
19
|
declare const Text: FC<TextProps>;
|
|
19
20
|
export default Text;
|
|
@@ -8,6 +8,8 @@ export type TextProps = PropsWithChildren<{
|
|
|
8
8
|
color?: keyof Theme['colors'];
|
|
9
9
|
/** Font size from theme (overrides variant fontSize if provided) */
|
|
10
10
|
fontSize?: keyof Theme['fontSize'];
|
|
11
|
+
/** Font family override (CSS value) */
|
|
12
|
+
fontFamily?: string;
|
|
11
13
|
/** Maximum number of lines before truncation with ellipsis */
|
|
12
14
|
maxLines?: number;
|
|
13
15
|
/** Add underline text decoration */
|
|
@@ -17,6 +19,7 @@ export type TextStyleParams = {
|
|
|
17
19
|
variant?: TextVariants;
|
|
18
20
|
color?: keyof Theme['colors'];
|
|
19
21
|
fontSize?: keyof Theme['fontSize'];
|
|
22
|
+
fontFamily?: string;
|
|
20
23
|
maxLines?: number;
|
|
21
24
|
underline?: boolean;
|
|
22
25
|
};
|
|
@@ -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,21 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ChipProps } from '@/components';
|
|
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?: Omit<ChipProps, 'size' | 'disabled'>;
|
|
18
|
+
};
|
|
19
|
+
export type DrawerItemStyleParams = {
|
|
20
|
+
selected?: boolean;
|
|
21
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import require$$0, { useContext, createContext, useMemo,
|
|
1
|
+
import require$$0, { useContext, createContext, createElement, Fragment, useMemo, 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',
|
|
@@ -1622,13 +1641,14 @@ const getTruncateTextStyles = (maxLines) => (maxLines === 1
|
|
|
1622
1641
|
const TEXT_STYLES = pr((theme) => {
|
|
1623
1642
|
const variantStyles = getTextVariantStyles(theme);
|
|
1624
1643
|
return {
|
|
1625
|
-
root: ({ variant = 'span', color, fontSize, maxLines, underline }) => ({
|
|
1644
|
+
root: ({ variant = 'span', color, fontSize, fontFamily, maxLines, underline }) => ({
|
|
1626
1645
|
margin: 0,
|
|
1627
1646
|
fontSize: fontSize ? theme.fontSize[fontSize] : variantStyles[variant].fontSize,
|
|
1628
1647
|
fontWeight: variantStyles[variant].fontWeight,
|
|
1629
1648
|
lineHeight: variantStyles[variant].lineHeight,
|
|
1630
1649
|
color: color ? theme.colors[color] : 'inherit',
|
|
1631
1650
|
cursor: 'inherit',
|
|
1651
|
+
...(fontFamily && { fontFamily }),
|
|
1632
1652
|
...(underline && {
|
|
1633
1653
|
textDecoration: 'underline',
|
|
1634
1654
|
textUnderlineOffset: '3px',
|
|
@@ -1638,6 +1658,35 @@ const TEXT_STYLES = pr((theme) => {
|
|
|
1638
1658
|
};
|
|
1639
1659
|
});
|
|
1640
1660
|
|
|
1661
|
+
/**
|
|
1662
|
+
* Parses text content and converts **bold** syntax to <strong> elements
|
|
1663
|
+
* @param children - The content to parse (string or ReactNode)
|
|
1664
|
+
* @returns Parsed content with bold text wrapped in <strong> elements
|
|
1665
|
+
*/
|
|
1666
|
+
const parseTextWithBold = (children) => {
|
|
1667
|
+
if (typeof children !== 'string' || !children.includes('**')) {
|
|
1668
|
+
return children;
|
|
1669
|
+
}
|
|
1670
|
+
const boldPattern = /\*\*(.+?)\*\*/g;
|
|
1671
|
+
const parts = [];
|
|
1672
|
+
let lastIndex = 0;
|
|
1673
|
+
let match;
|
|
1674
|
+
while ((match = boldPattern.exec(children)) !== null) {
|
|
1675
|
+
if (match.index > lastIndex) {
|
|
1676
|
+
parts.push(children.slice(lastIndex, match.index));
|
|
1677
|
+
}
|
|
1678
|
+
parts.push(createElement('strong', { key: match.index }, match[1]));
|
|
1679
|
+
lastIndex = match.index + match[0].length;
|
|
1680
|
+
}
|
|
1681
|
+
if (parts.length === 0) {
|
|
1682
|
+
return children;
|
|
1683
|
+
}
|
|
1684
|
+
if (lastIndex < children.length) {
|
|
1685
|
+
parts.push(children.slice(lastIndex));
|
|
1686
|
+
}
|
|
1687
|
+
return createElement(Fragment, null, ...parts);
|
|
1688
|
+
};
|
|
1689
|
+
|
|
1641
1690
|
/**
|
|
1642
1691
|
* Text component - Renders semantic HTML elements based on variant
|
|
1643
1692
|
*
|
|
@@ -1652,12 +1701,14 @@ const TEXT_STYLES = pr((theme) => {
|
|
|
1652
1701
|
* - Theme-aware colors
|
|
1653
1702
|
* - Text truncation with `maxLines`
|
|
1654
1703
|
* - Underline support
|
|
1704
|
+
* - Bold text with **double asterisks** syntax
|
|
1655
1705
|
*/
|
|
1656
|
-
const Text = ({ children, variant = 'span', color, fontSize, maxLines, underline, }) => {
|
|
1706
|
+
const Text = ({ children, variant = 'span', color, fontSize, fontFamily, maxLines, underline, }) => {
|
|
1657
1707
|
const theme = rr();
|
|
1658
1708
|
const variantStyles = useMemo(() => getTextVariantStyles(theme), [theme]);
|
|
1659
1709
|
const tag = variantStyles[variant].tag;
|
|
1660
|
-
|
|
1710
|
+
const parsedChildren = useMemo(() => parseTextWithBold(children), [children]);
|
|
1711
|
+
return createElement(tag, { className: TEXT_STYLES.root({ variant, color, fontSize, fontFamily, maxLines, underline }) }, parsedChildren);
|
|
1661
1712
|
};
|
|
1662
1713
|
Text.displayName = 'Text';
|
|
1663
1714
|
|
|
@@ -1668,6 +1719,7 @@ Text.displayName = 'Text';
|
|
|
1668
1719
|
*/
|
|
1669
1720
|
const getChipContentSize = (size) => {
|
|
1670
1721
|
const sizeMap = {
|
|
1722
|
+
'2xs': '2xs',
|
|
1671
1723
|
xs: 'xs',
|
|
1672
1724
|
sm: 'sm',
|
|
1673
1725
|
md: 'sm',
|
|
@@ -1688,21 +1740,22 @@ const getChipContentSize = (size) => {
|
|
|
1688
1740
|
* **Colors:**
|
|
1689
1741
|
* - `default`, `primary`, `success`, `warning`, `error`, `info`
|
|
1690
1742
|
*/
|
|
1691
|
-
const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, }) => {
|
|
1743
|
+
const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, disabled = false, }) => {
|
|
1692
1744
|
const isIconOnly = Boolean(icon) && !label;
|
|
1693
1745
|
return (jsxRuntimeExports.jsxs("span", { className: CHIP_STYLES.root({
|
|
1694
1746
|
variant,
|
|
1695
1747
|
color,
|
|
1696
1748
|
size,
|
|
1697
1749
|
isIconOnly,
|
|
1750
|
+
disabled,
|
|
1698
1751
|
gap,
|
|
1699
1752
|
radius,
|
|
1700
1753
|
}), children: [icon && (jsxRuntimeExports.jsx(Icon, { size: getChipContentSize(size), children: icon })), label && (jsxRuntimeExports.jsx(Text, { variant: 'label', fontSize: getChipContentSize(size), children: label }))] }));
|
|
1701
1754
|
};
|
|
1702
1755
|
Chip.displayName = 'Chip';
|
|
1703
1756
|
|
|
1704
|
-
/** Button height constant */
|
|
1705
1757
|
const BUTTON_SIZE = 36;
|
|
1758
|
+
const DRAWER_ITEM_HEIGHT = 32;
|
|
1706
1759
|
|
|
1707
1760
|
/**
|
|
1708
1761
|
* Get button variant styles based on the theme
|
|
@@ -1868,7 +1921,7 @@ const STACK_STYLES = pr((theme) => ({
|
|
|
1868
1921
|
* - `row`: Horizontal layout (default)
|
|
1869
1922
|
* - `column`: Vertical layout
|
|
1870
1923
|
*/
|
|
1871
|
-
const Stack = ({ children, direction = 'row', gap, width, height, align = 'center', justify, wrap, padding, }) => {
|
|
1924
|
+
const Stack = ({ children, direction = 'row', gap = 'sm', width, height, align = 'center', justify, wrap, padding, }) => {
|
|
1872
1925
|
return (jsxRuntimeExports.jsx("div", { className: STACK_STYLES.root({
|
|
1873
1926
|
direction,
|
|
1874
1927
|
gap,
|
|
@@ -1930,5 +1983,116 @@ const Card = ({ children, direction = 'column', padding = 'md', width, height, g
|
|
|
1930
1983
|
};
|
|
1931
1984
|
Card.displayName = 'Card';
|
|
1932
1985
|
|
|
1933
|
-
|
|
1986
|
+
const ACCORDION_STYLES = pr((theme) => {
|
|
1987
|
+
return {
|
|
1988
|
+
root: ({ disabled, width }) => ({
|
|
1989
|
+
width: width ?? '100%',
|
|
1990
|
+
overflow: 'hidden',
|
|
1991
|
+
opacity: disabled ? 0.8 : 1,
|
|
1992
|
+
borderRadius: theme.radius.md,
|
|
1993
|
+
}),
|
|
1994
|
+
header: ({ disabled, backgroundColor }) => ({
|
|
1995
|
+
display: 'flex',
|
|
1996
|
+
alignItems: 'center',
|
|
1997
|
+
width: '100%',
|
|
1998
|
+
padding: `${theme.spacing.sm} ${theme.spacing.md}`,
|
|
1999
|
+
border: 'none',
|
|
2000
|
+
backgroundColor: backgroundColor ? theme.colors[backgroundColor] : 'transparent',
|
|
2001
|
+
cursor: disabled ? 'not-allowed' : 'pointer',
|
|
2002
|
+
transition: `background-color ${theme.transition.fast}`,
|
|
2003
|
+
gap: theme.spacing.sm,
|
|
2004
|
+
borderRadius: theme.radius.md,
|
|
2005
|
+
':hover': {
|
|
2006
|
+
backgroundColor: disabled ? 'transparent' : theme.colors.surfaceHover,
|
|
2007
|
+
},
|
|
2008
|
+
}),
|
|
2009
|
+
expandIcon: ({ expanded }) => ({
|
|
2010
|
+
transition: `transform ${theme.transition.fast}`,
|
|
2011
|
+
transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
2012
|
+
}),
|
|
2013
|
+
content: ({ expanded }) => ({
|
|
2014
|
+
display: expanded ? 'block' : 'none',
|
|
2015
|
+
padding: `0 ${theme.spacing.md} ${theme.spacing.md}`,
|
|
2016
|
+
}),
|
|
2017
|
+
};
|
|
2018
|
+
});
|
|
2019
|
+
|
|
2020
|
+
const ChevronDownIcon = () => {
|
|
2021
|
+
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' }) }));
|
|
2022
|
+
};
|
|
2023
|
+
|
|
2024
|
+
/**
|
|
2025
|
+
* Accordion component
|
|
2026
|
+
*
|
|
2027
|
+
* A collapsible container that can show/hide content.
|
|
2028
|
+
* Supports controlled and uncontrolled modes.
|
|
2029
|
+
*/
|
|
2030
|
+
const Accordion = ({ title, children, expanded, defaultExpanded = false, onChange, disabled = false, icon, backgroundColor, width }) => {
|
|
2031
|
+
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
2032
|
+
// Use controlled value if provided, otherwise use internal state
|
|
2033
|
+
const isExpanded = expanded !== undefined ? expanded : internalExpanded;
|
|
2034
|
+
const handleToggle = () => {
|
|
2035
|
+
if (disabled) {
|
|
2036
|
+
return;
|
|
2037
|
+
}
|
|
2038
|
+
const newExpanded = !isExpanded;
|
|
2039
|
+
// Update internal state for uncontrolled mode
|
|
2040
|
+
if (expanded === undefined) {
|
|
2041
|
+
setInternalExpanded(newExpanded);
|
|
2042
|
+
}
|
|
2043
|
+
// Call onChange callback
|
|
2044
|
+
onChange?.(newExpanded);
|
|
2045
|
+
};
|
|
2046
|
+
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 })] }));
|
|
2047
|
+
};
|
|
2048
|
+
Accordion.displayName = 'Accordion';
|
|
2049
|
+
|
|
2050
|
+
/**
|
|
2051
|
+
* DrawerItem styles using createStyles from @aurora-ds/theme
|
|
2052
|
+
*/
|
|
2053
|
+
const DRAWER_ITEM_STYLES = pr((theme) => ({
|
|
2054
|
+
root: ({ selected = false }) => ({
|
|
2055
|
+
display: 'inline-flex',
|
|
2056
|
+
alignItems: 'center',
|
|
2057
|
+
justifyContent: 'space-between',
|
|
2058
|
+
boxSizing: 'border-box',
|
|
2059
|
+
gap: theme.spacing.sm,
|
|
2060
|
+
padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
|
|
2061
|
+
borderRadius: theme.radius.md,
|
|
2062
|
+
cursor: 'pointer',
|
|
2063
|
+
transition: `background-color ${theme.transition.fast}, color ${theme.transition.fast}`,
|
|
2064
|
+
fontFamily: 'inherit',
|
|
2065
|
+
width: '100%',
|
|
2066
|
+
minHeight: DRAWER_ITEM_HEIGHT,
|
|
2067
|
+
maxHeight: DRAWER_ITEM_HEIGHT,
|
|
2068
|
+
backgroundColor: selected ? theme.colors.primary : 'transparent',
|
|
2069
|
+
color: selected ? theme.colors.onPrimary : theme.colors.textSecondary,
|
|
2070
|
+
border: 'none',
|
|
2071
|
+
':hover': {
|
|
2072
|
+
backgroundColor: selected ? theme.colors.primaryHover : theme.colors.surfaceHover,
|
|
2073
|
+
color: selected ? theme.colors.onPrimary : theme.colors.text,
|
|
2074
|
+
},
|
|
2075
|
+
':active': {
|
|
2076
|
+
backgroundColor: selected ? theme.colors.primaryActive : theme.colors.surfaceActive,
|
|
2077
|
+
},
|
|
2078
|
+
':disabled': {
|
|
2079
|
+
color: theme.colors.disabledText,
|
|
2080
|
+
backgroundColor: selected ? theme.colors.disabled : 'transparent',
|
|
2081
|
+
cursor: 'not-allowed',
|
|
2082
|
+
},
|
|
2083
|
+
}),
|
|
2084
|
+
}));
|
|
2085
|
+
|
|
2086
|
+
/**
|
|
2087
|
+
* DrawerItem component
|
|
2088
|
+
*
|
|
2089
|
+
* A navigation item for use in drawers/sidebars.
|
|
2090
|
+
* Similar to a text button with selected state support.
|
|
2091
|
+
*/
|
|
2092
|
+
const DrawerItem = ({ label, startIcon, endIcon, selected = false, onClick, disabled, chip }) => {
|
|
2093
|
+
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, { ...chip, size: '2xs', color: chip.color ?? 'info', disabled: disabled }))] }));
|
|
2094
|
+
};
|
|
2095
|
+
DrawerItem.displayName = 'DrawerItem';
|
|
2096
|
+
|
|
2097
|
+
export { Accordion, Button, Card, Chip, DrawerItem, Icon, IconButton, Stack, Text };
|
|
1934
2098
|
//# sourceMappingURL=index.js.map
|