@aurora-ds/components 0.2.1 → 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.
Files changed (39) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/components/data-display/chip/Chip.props.d.ts +3 -0
  3. package/dist/cjs/components/index.d.ts +2 -0
  4. package/dist/cjs/components/layout/accordion/Accordion.d.ts +10 -0
  5. package/dist/cjs/components/layout/accordion/Accordion.props.d.ts +36 -0
  6. package/dist/cjs/components/layout/accordion/Accordion.styles.d.ts +7 -0
  7. package/dist/cjs/components/layout/accordion/index.d.ts +2 -0
  8. package/dist/cjs/components/navigation/drawer-item/DrawerItem.d.ts +10 -0
  9. package/dist/cjs/components/navigation/drawer-item/DrawerItem.props.d.ts +32 -0
  10. package/dist/cjs/components/navigation/drawer-item/DrawerItem.styles.d.ts +7 -0
  11. package/dist/cjs/components/navigation/drawer-item/index.d.ts +2 -0
  12. package/dist/cjs/constants/globalConstants.d.ts +1 -1
  13. package/dist/cjs/index.js +140 -6
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/cjs/interfaces/chip.types.d.ts +1 -1
  16. package/dist/cjs/resources/Icons.d.ts +3 -0
  17. package/dist/cjs/resources/icons/ChevronDownIcon.d.ts +1 -0
  18. package/dist/cjs/resources/icons/InfoIcon.d.ts +1 -0
  19. package/dist/cjs/utils/ui/components/chip/getChipColorStyles.utils.d.ts +2 -38
  20. package/dist/esm/components/data-display/chip/Chip.props.d.ts +3 -0
  21. package/dist/esm/components/index.d.ts +2 -0
  22. package/dist/esm/components/layout/accordion/Accordion.d.ts +10 -0
  23. package/dist/esm/components/layout/accordion/Accordion.props.d.ts +36 -0
  24. package/dist/esm/components/layout/accordion/Accordion.styles.d.ts +7 -0
  25. package/dist/esm/components/layout/accordion/index.d.ts +2 -0
  26. package/dist/esm/components/navigation/drawer-item/DrawerItem.d.ts +10 -0
  27. package/dist/esm/components/navigation/drawer-item/DrawerItem.props.d.ts +32 -0
  28. package/dist/esm/components/navigation/drawer-item/DrawerItem.styles.d.ts +7 -0
  29. package/dist/esm/components/navigation/drawer-item/index.d.ts +2 -0
  30. package/dist/esm/constants/globalConstants.d.ts +1 -1
  31. package/dist/esm/index.js +140 -8
  32. package/dist/esm/index.js.map +1 -1
  33. package/dist/esm/interfaces/chip.types.d.ts +1 -1
  34. package/dist/esm/resources/Icons.d.ts +3 -0
  35. package/dist/esm/resources/icons/ChevronDownIcon.d.ts +1 -0
  36. package/dist/esm/resources/icons/InfoIcon.d.ts +1 -0
  37. package/dist/esm/utils/ui/components/chip/getChipColorStyles.utils.d.ts +2 -38
  38. package/dist/index.d.ts +69 -3
  39. package/package.json +2 -2
package/README.md CHANGED
@@ -46,6 +46,7 @@ function App() {
46
46
 
47
47
  | Component | Description |
48
48
  |-----------|-------------|
49
+ | **Accordion** | Collapsible container to show/hide content |
49
50
  | **Button** | Button with variants (contained, outlined, text), icons, and states |
50
51
  | **IconButton** | Icon-only button component |
51
52
  | **Text** | Typography component with semantic HTML tags (h1-h6, p, span, label) |
@@ -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,2 @@
1
+ export { default as Accordion } from '@components/layout/accordion/Accordion.tsx';
2
+ export type { AccordionProps } from '@components/layout/accordion/Accordion.props.ts';
@@ -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 {};
@@ -0,0 +1,7 @@
1
+ import { DrawerItemStyleParams } from '@components/navigation/drawer-item/DrawerItem.props';
2
+ /**
3
+ * DrawerItem styles using createStyles from @aurora-ds/theme
4
+ */
5
+ export declare const DRAWER_ITEM_STYLES: {
6
+ root: (args_0: DrawerItemStyleParams) => string;
7
+ };
@@ -0,0 +1,2 @@
1
+ export { default as DrawerItem } from '@components/navigation/drawer-item/DrawerItem';
2
+ export type { DrawerItemProps } from '@components/navigation/drawer-item/DrawerItem.props';
@@ -1,2 +1,2 @@
1
- /** Button height constant */
2
1
  export declare const BUTTON_SIZE = 36;
2
+ export declare const DRAWER_ITEM_HEIGHT = 32;
package/dist/cjs/index.js CHANGED
@@ -1367,6 +1367,7 @@ const ICON_STYLES = pr((theme) => ({
1367
1367
  justifyContent: 'center',
1368
1368
  overflow: 'hidden',
1369
1369
  transition: 'color 150ms ease-in-out',
1370
+ flexShrink: 0,
1370
1371
  lineHeight: 0,
1371
1372
  height: theme.fontSize[size ?? 'md'],
1372
1373
  width: theme.fontSize[size ?? 'md'],
@@ -1415,7 +1416,21 @@ const Icon = ({ children, size, color, backgroundColor, padding, borderRadius, }
1415
1416
  };
1416
1417
  Icon.displayName = 'Icon';
1417
1418
 
1418
- const getChipColorStyles = (theme, color, variant) => {
1419
+ const getChipColorStyles = (theme, color, variant, disabled) => {
1420
+ if (disabled) {
1421
+ return {
1422
+ filled: {
1423
+ backgroundColor: theme.colors.disabled,
1424
+ color: theme.colors.disabledText,
1425
+ borderColor: 'transparent',
1426
+ },
1427
+ outlined: {
1428
+ backgroundColor: 'transparent',
1429
+ color: theme.colors.disabledText,
1430
+ borderColor: theme.colors.disabled,
1431
+ },
1432
+ }[variant];
1433
+ }
1419
1434
  const colorMap = {
1420
1435
  default: {
1421
1436
  filled: {
@@ -1501,6 +1516,10 @@ const getChipColorStyles = (theme, color, variant) => {
1501
1516
  */
1502
1517
  const getChipSizeStyles = (theme, size, isIconOnly) => {
1503
1518
  const sizeMap = {
1519
+ '2xs': {
1520
+ iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize['2xs'] },
1521
+ withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize['2xs'] },
1522
+ },
1504
1523
  xs: {
1505
1524
  iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize.xs },
1506
1525
  withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize.xs },
@@ -1522,8 +1541,8 @@ const getChipSizeStyles = (theme, size, isIconOnly) => {
1522
1541
  };
1523
1542
 
1524
1543
  const CHIP_STYLES = pr((theme) => ({
1525
- root: ({ variant, color, size, isIconOnly, gap, radius }) => {
1526
- const colorStyles = getChipColorStyles(theme, color, variant);
1544
+ root: ({ variant, color, size, isIconOnly, disabled, gap, radius }) => {
1545
+ const colorStyles = getChipColorStyles(theme, color, variant, disabled);
1527
1546
  const sizeStyles = getChipSizeStyles(theme, size, isIconOnly);
1528
1547
  return {
1529
1548
  display: 'flex',
@@ -1670,6 +1689,7 @@ Text.displayName = 'Text';
1670
1689
  */
1671
1690
  const getChipContentSize = (size) => {
1672
1691
  const sizeMap = {
1692
+ '2xs': '2xs',
1673
1693
  xs: 'xs',
1674
1694
  sm: 'sm',
1675
1695
  md: 'sm',
@@ -1690,21 +1710,22 @@ const getChipContentSize = (size) => {
1690
1710
  * **Colors:**
1691
1711
  * - `default`, `primary`, `success`, `warning`, `error`, `info`
1692
1712
  */
1693
- const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, }) => {
1713
+ const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, disabled = false, }) => {
1694
1714
  const isIconOnly = Boolean(icon) && !label;
1695
1715
  return (jsxRuntimeExports.jsxs("span", { className: CHIP_STYLES.root({
1696
1716
  variant,
1697
1717
  color,
1698
1718
  size,
1699
1719
  isIconOnly,
1720
+ disabled,
1700
1721
  gap,
1701
1722
  radius,
1702
1723
  }), children: [icon && (jsxRuntimeExports.jsx(Icon, { size: getChipContentSize(size), children: icon })), label && (jsxRuntimeExports.jsx(Text, { variant: 'label', fontSize: getChipContentSize(size), children: label }))] }));
1703
1724
  };
1704
1725
  Chip.displayName = 'Chip';
1705
1726
 
1706
- /** Button height constant */
1707
1727
  const BUTTON_SIZE = 36;
1728
+ const DRAWER_ITEM_HEIGHT = 32;
1708
1729
 
1709
1730
  /**
1710
1731
  * Get button variant styles based on the theme
@@ -1870,7 +1891,7 @@ const STACK_STYLES = pr((theme) => ({
1870
1891
  * - `row`: Horizontal layout (default)
1871
1892
  * - `column`: Vertical layout
1872
1893
  */
1873
- const Stack = ({ children, direction = 'row', gap, width, height, align = 'center', justify, wrap, padding, }) => {
1894
+ const Stack = ({ children, direction = 'row', gap = 'sm', width, height, align = 'center', justify, wrap, padding, }) => {
1874
1895
  return (jsxRuntimeExports.jsx("div", { className: STACK_STYLES.root({
1875
1896
  direction,
1876
1897
  gap,
@@ -1932,9 +1953,122 @@ const Card = ({ children, direction = 'column', padding = 'md', width, height, g
1932
1953
  };
1933
1954
  Card.displayName = 'Card';
1934
1955
 
1956
+ const ACCORDION_STYLES = pr((theme) => {
1957
+ return {
1958
+ root: ({ disabled, width }) => ({
1959
+ width: width ?? '100%',
1960
+ overflow: 'hidden',
1961
+ opacity: disabled ? 0.8 : 1,
1962
+ borderRadius: theme.radius.md,
1963
+ }),
1964
+ header: ({ disabled, backgroundColor }) => ({
1965
+ display: 'flex',
1966
+ alignItems: 'center',
1967
+ width: '100%',
1968
+ padding: `${theme.spacing.sm} ${theme.spacing.md}`,
1969
+ border: 'none',
1970
+ backgroundColor: backgroundColor ? theme.colors[backgroundColor] : 'transparent',
1971
+ cursor: disabled ? 'not-allowed' : 'pointer',
1972
+ transition: `background-color ${theme.transition.fast}`,
1973
+ gap: theme.spacing.sm,
1974
+ borderRadius: theme.radius.md,
1975
+ ':hover': {
1976
+ backgroundColor: disabled ? 'transparent' : theme.colors.surfaceHover,
1977
+ },
1978
+ }),
1979
+ expandIcon: ({ expanded }) => ({
1980
+ transition: `transform ${theme.transition.fast}`,
1981
+ transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
1982
+ }),
1983
+ content: ({ expanded }) => ({
1984
+ display: expanded ? 'block' : 'none',
1985
+ padding: `0 ${theme.spacing.md} ${theme.spacing.md}`,
1986
+ }),
1987
+ };
1988
+ });
1989
+
1990
+ const ChevronDownIcon = () => {
1991
+ 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' }) }));
1992
+ };
1993
+
1994
+ /**
1995
+ * Accordion component
1996
+ *
1997
+ * A collapsible container that can show/hide content.
1998
+ * Supports controlled and uncontrolled modes.
1999
+ */
2000
+ const Accordion = ({ title, children, expanded, defaultExpanded = false, onChange, disabled = false, icon, backgroundColor, width }) => {
2001
+ const [internalExpanded, setInternalExpanded] = require$$0.useState(defaultExpanded);
2002
+ // Use controlled value if provided, otherwise use internal state
2003
+ const isExpanded = expanded !== undefined ? expanded : internalExpanded;
2004
+ const handleToggle = () => {
2005
+ if (disabled) {
2006
+ return;
2007
+ }
2008
+ const newExpanded = !isExpanded;
2009
+ // Update internal state for uncontrolled mode
2010
+ if (expanded === undefined) {
2011
+ setInternalExpanded(newExpanded);
2012
+ }
2013
+ // Call onChange callback
2014
+ onChange?.(newExpanded);
2015
+ };
2016
+ 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 })] }));
2017
+ };
2018
+ Accordion.displayName = 'Accordion';
2019
+
2020
+ /**
2021
+ * DrawerItem styles using createStyles from @aurora-ds/theme
2022
+ */
2023
+ const DRAWER_ITEM_STYLES = pr((theme) => ({
2024
+ root: ({ selected = false }) => ({
2025
+ display: 'inline-flex',
2026
+ alignItems: 'center',
2027
+ justifyContent: 'space-between',
2028
+ boxSizing: 'border-box',
2029
+ gap: theme.spacing.sm,
2030
+ padding: `${theme.spacing.xs} ${theme.spacing.sm}`,
2031
+ borderRadius: theme.radius.md,
2032
+ cursor: 'pointer',
2033
+ transition: `background-color ${theme.transition.fast}, color ${theme.transition.fast}`,
2034
+ fontFamily: 'inherit',
2035
+ width: '100%',
2036
+ minHeight: DRAWER_ITEM_HEIGHT,
2037
+ maxHeight: DRAWER_ITEM_HEIGHT,
2038
+ backgroundColor: selected ? theme.colors.primary : 'transparent',
2039
+ color: selected ? theme.colors.onPrimary : theme.colors.textSecondary,
2040
+ border: 'none',
2041
+ ':hover': {
2042
+ backgroundColor: selected ? theme.colors.primaryHover : theme.colors.surfaceHover,
2043
+ color: selected ? theme.colors.onPrimary : theme.colors.text,
2044
+ },
2045
+ ':active': {
2046
+ backgroundColor: selected ? theme.colors.primaryActive : theme.colors.surfaceActive,
2047
+ },
2048
+ ':disabled': {
2049
+ color: theme.colors.disabledText,
2050
+ backgroundColor: selected ? theme.colors.disabled : 'transparent',
2051
+ cursor: 'not-allowed',
2052
+ },
2053
+ }),
2054
+ }));
2055
+
2056
+ /**
2057
+ * DrawerItem component
2058
+ *
2059
+ * A navigation item for use in drawers/sidebars.
2060
+ * Similar to a text button with selected state support.
2061
+ */
2062
+ const DrawerItem = ({ label, startIcon, endIcon, selected = false, onClick, disabled, chip }) => {
2063
+ 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 }))] }));
2064
+ };
2065
+ DrawerItem.displayName = 'DrawerItem';
2066
+
2067
+ exports.Accordion = Accordion;
1935
2068
  exports.Button = Button;
1936
2069
  exports.Card = Card;
1937
2070
  exports.Chip = Chip;
2071
+ exports.DrawerItem = DrawerItem;
1938
2072
  exports.Icon = Icon;
1939
2073
  exports.IconButton = IconButton;
1940
2074
  exports.Stack = Stack;