@aurora-ds/components 0.1.0 → 0.2.1

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 (75) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/components/data-display/chip/Chip.d.ts +16 -0
  3. package/dist/cjs/components/data-display/chip/Chip.props.d.ts +27 -0
  4. package/dist/cjs/components/data-display/chip/Chip.styles.d.ts +4 -0
  5. package/dist/cjs/components/data-display/chip/index.d.ts +2 -0
  6. package/dist/cjs/components/data-display/icon/Icon.d.ts +35 -0
  7. package/dist/cjs/components/data-display/icon/Icon.props.d.ts +14 -0
  8. package/dist/cjs/components/data-display/icon/Icon.styles.d.ts +3 -0
  9. package/dist/cjs/components/data-display/icon/index.d.ts +2 -0
  10. package/dist/cjs/components/index.d.ts +8 -6
  11. package/dist/cjs/components/inputs/button/Button.d.ts +12 -0
  12. package/dist/cjs/components/inputs/button/Button.props.d.ts +24 -0
  13. package/dist/cjs/components/inputs/button/Button.styles.d.ts +18 -0
  14. package/dist/cjs/components/inputs/button/index.d.ts +2 -0
  15. package/dist/cjs/components/inputs/icon-button/IconButton.d.ts +4 -0
  16. package/dist/cjs/components/inputs/icon-button/IconButton.props.d.ts +20 -0
  17. package/dist/cjs/components/inputs/icon-button/IconButton.styles.d.ts +4 -0
  18. package/dist/cjs/components/inputs/icon-button/index.d.ts +2 -0
  19. package/dist/cjs/components/layout/card/Card.d.ts +14 -0
  20. package/dist/cjs/components/layout/card/Card.props.d.ts +43 -0
  21. package/dist/cjs/components/layout/card/Card.styles.d.ts +7 -0
  22. package/dist/cjs/components/layout/card/index.d.ts +2 -0
  23. package/dist/cjs/components/layout/stack/Stack.d.ts +13 -0
  24. package/dist/cjs/components/layout/stack/Stack.props.d.ts +33 -0
  25. package/dist/cjs/components/layout/stack/Stack.styles.d.ts +7 -0
  26. package/dist/cjs/components/layout/stack/index.d.ts +2 -0
  27. package/dist/cjs/components/layout/text/Text.d.ts +19 -0
  28. package/dist/cjs/components/layout/text/Text.props.d.ts +22 -0
  29. package/dist/cjs/components/layout/text/Text.styles.d.ts +4 -0
  30. package/dist/cjs/components/layout/text/index.d.ts +2 -0
  31. package/dist/cjs/index.js +185 -10
  32. package/dist/cjs/index.js.map +1 -1
  33. package/dist/cjs/interfaces/chip.types.d.ts +6 -0
  34. package/dist/cjs/utils/ui/components/chip/getChipColorStyles.utils.d.ts +43 -0
  35. package/dist/cjs/utils/ui/components/chip/getChipContentSize.utils.d.ts +8 -0
  36. package/dist/cjs/utils/ui/components/chip/getChipSizeStyles.utils.d.ts +12 -0
  37. package/dist/cjs/utils/ui/components/text/getTextVariantStyles.utils.d.ts +1 -1
  38. package/dist/esm/components/data-display/chip/Chip.d.ts +16 -0
  39. package/dist/esm/components/data-display/chip/Chip.props.d.ts +27 -0
  40. package/dist/esm/components/data-display/chip/Chip.styles.d.ts +4 -0
  41. package/dist/esm/components/data-display/chip/index.d.ts +2 -0
  42. package/dist/esm/components/data-display/icon/Icon.d.ts +35 -0
  43. package/dist/esm/components/data-display/icon/Icon.props.d.ts +14 -0
  44. package/dist/esm/components/data-display/icon/Icon.styles.d.ts +3 -0
  45. package/dist/esm/components/data-display/icon/index.d.ts +2 -0
  46. package/dist/esm/components/index.d.ts +8 -6
  47. package/dist/esm/components/inputs/button/Button.d.ts +12 -0
  48. package/dist/esm/components/inputs/button/Button.props.d.ts +24 -0
  49. package/dist/esm/components/inputs/button/Button.styles.d.ts +18 -0
  50. package/dist/esm/components/inputs/button/index.d.ts +2 -0
  51. package/dist/esm/components/inputs/icon-button/IconButton.d.ts +4 -0
  52. package/dist/esm/components/inputs/icon-button/IconButton.props.d.ts +20 -0
  53. package/dist/esm/components/inputs/icon-button/IconButton.styles.d.ts +4 -0
  54. package/dist/esm/components/inputs/icon-button/index.d.ts +2 -0
  55. package/dist/esm/components/layout/card/Card.d.ts +14 -0
  56. package/dist/esm/components/layout/card/Card.props.d.ts +43 -0
  57. package/dist/esm/components/layout/card/Card.styles.d.ts +7 -0
  58. package/dist/esm/components/layout/card/index.d.ts +2 -0
  59. package/dist/esm/components/layout/stack/Stack.d.ts +13 -0
  60. package/dist/esm/components/layout/stack/Stack.props.d.ts +33 -0
  61. package/dist/esm/components/layout/stack/Stack.styles.d.ts +7 -0
  62. package/dist/esm/components/layout/stack/index.d.ts +2 -0
  63. package/dist/esm/components/layout/text/Text.d.ts +19 -0
  64. package/dist/esm/components/layout/text/Text.props.d.ts +22 -0
  65. package/dist/esm/components/layout/text/Text.styles.d.ts +4 -0
  66. package/dist/esm/components/layout/text/index.d.ts +2 -0
  67. package/dist/esm/index.js +185 -11
  68. package/dist/esm/index.js.map +1 -1
  69. package/dist/esm/interfaces/chip.types.d.ts +6 -0
  70. package/dist/esm/utils/ui/components/chip/getChipColorStyles.utils.d.ts +43 -0
  71. package/dist/esm/utils/ui/components/chip/getChipContentSize.utils.d.ts +8 -0
  72. package/dist/esm/utils/ui/components/chip/getChipSizeStyles.utils.d.ts +12 -0
  73. package/dist/esm/utils/ui/components/text/getTextVariantStyles.utils.d.ts +1 -1
  74. package/dist/index.d.ts +46 -2
  75. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -1367,11 +1367,12 @@ const ICON_STYLES = pr((theme) => ({
1367
1367
  justifyContent: 'center',
1368
1368
  overflow: 'hidden',
1369
1369
  transition: 'color 150ms ease-in-out',
1370
+ lineHeight: 0,
1370
1371
  height: theme.fontSize[size ?? 'md'],
1371
1372
  width: theme.fontSize[size ?? 'md'],
1372
1373
  minWidth: theme.fontSize[size ?? 'md'],
1373
1374
  minHeight: theme.fontSize[size ?? 'md'],
1374
- color: theme.colors[color ?? 'text'],
1375
+ color: color ? theme.colors[color] : 'inherit',
1375
1376
  backgroundColor: backgroundColor ? theme.colors[backgroundColor] : undefined,
1376
1377
  padding: padding ? theme.spacing[padding] : 0,
1377
1378
  borderRadius: theme.radius[borderRadius ?? 'md'],
@@ -1414,6 +1415,136 @@ const Icon = ({ children, size, color, backgroundColor, padding, borderRadius, }
1414
1415
  };
1415
1416
  Icon.displayName = 'Icon';
1416
1417
 
1418
+ const getChipColorStyles = (theme, color, variant) => {
1419
+ const colorMap = {
1420
+ default: {
1421
+ filled: {
1422
+ backgroundColor: theme.colors.surfaceHover,
1423
+ color: theme.colors.text,
1424
+ borderColor: 'transparent',
1425
+ },
1426
+ outlined: {
1427
+ backgroundColor: 'transparent',
1428
+ color: theme.colors.text,
1429
+ borderColor: theme.colors.border,
1430
+ },
1431
+ },
1432
+ primary: {
1433
+ filled: {
1434
+ backgroundColor: theme.colors.primary,
1435
+ color: theme.colors.onPrimary,
1436
+ borderColor: 'transparent',
1437
+ },
1438
+ outlined: {
1439
+ backgroundColor: 'transparent',
1440
+ color: theme.colors.primary,
1441
+ borderColor: theme.colors.primary,
1442
+ },
1443
+ },
1444
+ success: {
1445
+ filled: {
1446
+ backgroundColor: theme.colors.successSubtle,
1447
+ color: theme.colors.success,
1448
+ borderColor: 'transparent',
1449
+ },
1450
+ outlined: {
1451
+ backgroundColor: theme.colors.successSubtle,
1452
+ color: theme.colors.success,
1453
+ borderColor: theme.colors.success,
1454
+ },
1455
+ },
1456
+ warning: {
1457
+ filled: {
1458
+ backgroundColor: theme.colors.warningSubtle,
1459
+ color: theme.colors.warning,
1460
+ borderColor: 'transparent',
1461
+ },
1462
+ outlined: {
1463
+ backgroundColor: theme.colors.warningSubtle,
1464
+ color: theme.colors.warning,
1465
+ borderColor: theme.colors.warning,
1466
+ },
1467
+ },
1468
+ error: {
1469
+ filled: {
1470
+ backgroundColor: theme.colors.errorSubtle,
1471
+ color: theme.colors.error,
1472
+ borderColor: 'transparent',
1473
+ },
1474
+ outlined: {
1475
+ backgroundColor: theme.colors.errorSubtle,
1476
+ color: theme.colors.error,
1477
+ borderColor: theme.colors.error,
1478
+ },
1479
+ },
1480
+ info: {
1481
+ filled: {
1482
+ backgroundColor: theme.colors.infoSubtle,
1483
+ color: theme.colors.info,
1484
+ borderColor: 'transparent',
1485
+ },
1486
+ outlined: {
1487
+ backgroundColor: theme.colors.infoSubtle,
1488
+ color: theme.colors.info,
1489
+ borderColor: theme.colors.info,
1490
+ },
1491
+ },
1492
+ };
1493
+ return colorMap[color][variant];
1494
+ };
1495
+
1496
+ /**
1497
+ * Get chip size styles based on the theme, size and icon-only state
1498
+ * @param theme - Theme object
1499
+ * @param size - Chip size
1500
+ * @param isIconOnly - Whether the chip has only an icon (no label)
1501
+ */
1502
+ const getChipSizeStyles = (theme, size, isIconOnly) => {
1503
+ const sizeMap = {
1504
+ xs: {
1505
+ iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize.xs },
1506
+ withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize.xs },
1507
+ },
1508
+ sm: {
1509
+ iconOnly: { padding: theme.spacing.xs, fontSize: theme.fontSize.sm },
1510
+ withLabel: { padding: `${theme.spacing.xs} ${theme.spacing.sm}`, fontSize: theme.fontSize.sm },
1511
+ },
1512
+ md: {
1513
+ iconOnly: { padding: theme.spacing.sm, fontSize: theme.fontSize.md },
1514
+ withLabel: { padding: `${theme.spacing.sm} ${theme.spacing.md}`, fontSize: theme.fontSize.sm },
1515
+ },
1516
+ lg: {
1517
+ iconOnly: { padding: theme.spacing.md, fontSize: theme.fontSize.lg },
1518
+ withLabel: { padding: `${theme.spacing.sm} ${theme.spacing.lg}`, fontSize: theme.fontSize.md },
1519
+ },
1520
+ };
1521
+ return isIconOnly ? sizeMap[size].iconOnly : sizeMap[size].withLabel;
1522
+ };
1523
+
1524
+ const CHIP_STYLES = pr((theme) => ({
1525
+ root: ({ variant, color, size, isIconOnly, gap, radius }) => {
1526
+ const colorStyles = getChipColorStyles(theme, color, variant);
1527
+ const sizeStyles = getChipSizeStyles(theme, size, isIconOnly);
1528
+ return {
1529
+ display: 'flex',
1530
+ alignItems: 'center',
1531
+ justifyContent: 'center',
1532
+ gap: gap ? theme.spacing[gap] : theme.spacing.sm,
1533
+ borderRadius: radius ? theme.radius[radius] : theme.radius.md,
1534
+ border: variant === 'outlined' ? '1px solid' : 'none',
1535
+ aspectRatio: isIconOnly ? 1 : undefined,
1536
+ height: 'fit-content',
1537
+ width: 'fit-content',
1538
+ fontFamily: 'inherit',
1539
+ fontWeight: theme.fontWeight.medium,
1540
+ whiteSpace: 'nowrap',
1541
+ boxSizing: 'border-box',
1542
+ ...sizeStyles,
1543
+ ...colorStyles,
1544
+ };
1545
+ },
1546
+ }));
1547
+
1417
1548
  /**
1418
1549
  * Get text variant styles based on the theme
1419
1550
  * @param theme
@@ -1493,12 +1624,12 @@ const getTruncateTextStyles = (maxLines) => (maxLines === 1
1493
1624
  const TEXT_STYLES = pr((theme) => {
1494
1625
  const variantStyles = getTextVariantStyles(theme);
1495
1626
  return {
1496
- root: ({ variant = 'span', color, maxLines, underline }) => ({
1627
+ root: ({ variant = 'span', color, fontSize, maxLines, underline }) => ({
1497
1628
  margin: 0,
1498
- fontSize: variantStyles[variant].fontSize,
1629
+ fontSize: fontSize ? theme.fontSize[fontSize] : variantStyles[variant].fontSize,
1499
1630
  fontWeight: variantStyles[variant].fontWeight,
1500
1631
  lineHeight: variantStyles[variant].lineHeight,
1501
- color: theme.colors[color ?? 'text'],
1632
+ color: color ? theme.colors[color] : 'inherit',
1502
1633
  cursor: 'inherit',
1503
1634
  ...(underline && {
1504
1635
  textDecoration: 'underline',
@@ -1524,14 +1655,54 @@ const TEXT_STYLES = pr((theme) => {
1524
1655
  * - Text truncation with `maxLines`
1525
1656
  * - Underline support
1526
1657
  */
1527
- const Text = ({ children, variant = 'span', color, maxLines, underline, }) => {
1658
+ const Text = ({ children, variant = 'span', color, fontSize, maxLines, underline, }) => {
1528
1659
  const theme = rr();
1529
1660
  const variantStyles = require$$0.useMemo(() => getTextVariantStyles(theme), [theme]);
1530
1661
  const tag = variantStyles[variant].tag;
1531
- return require$$0.createElement(tag, { className: TEXT_STYLES.root({ variant, color, maxLines, underline }) }, children);
1662
+ return require$$0.createElement(tag, { className: TEXT_STYLES.root({ variant, color, fontSize, maxLines, underline }) }, children);
1532
1663
  };
1533
1664
  Text.displayName = 'Text';
1534
1665
 
1666
+ /**
1667
+ * Get chip content size based on the chip size
1668
+ * @param size
1669
+ * @constructor
1670
+ */
1671
+ const getChipContentSize = (size) => {
1672
+ const sizeMap = {
1673
+ xs: 'xs',
1674
+ sm: 'sm',
1675
+ md: 'sm',
1676
+ lg: 'md',
1677
+ };
1678
+ return sizeMap[size];
1679
+ };
1680
+
1681
+ /**
1682
+ * Chip component
1683
+ *
1684
+ * A compact element for displaying information, tags, or actions.
1685
+ *
1686
+ * **Variants:**
1687
+ * - `filled`: Solid background (default)
1688
+ * - `outlined`: Border only
1689
+ *
1690
+ * **Colors:**
1691
+ * - `default`, `primary`, `success`, `warning`, `error`, `info`
1692
+ */
1693
+ const Chip = ({ label, icon, variant = 'filled', color = 'default', size = 'md', gap, radius, }) => {
1694
+ const isIconOnly = Boolean(icon) && !label;
1695
+ return (jsxRuntimeExports.jsxs("span", { className: CHIP_STYLES.root({
1696
+ variant,
1697
+ color,
1698
+ size,
1699
+ isIconOnly,
1700
+ gap,
1701
+ radius,
1702
+ }), children: [icon && (jsxRuntimeExports.jsx(Icon, { size: getChipContentSize(size), children: icon })), label && (jsxRuntimeExports.jsx(Text, { variant: 'label', fontSize: getChipContentSize(size), children: label }))] }));
1703
+ };
1704
+ Chip.displayName = 'Chip';
1705
+
1535
1706
  /** Button height constant */
1536
1707
  const BUTTON_SIZE = 36;
1537
1708
 
@@ -1699,7 +1870,7 @@ const STACK_STYLES = pr((theme) => ({
1699
1870
  * - `row`: Horizontal layout (default)
1700
1871
  * - `column`: Vertical layout
1701
1872
  */
1702
- const Stack = ({ children, direction = 'row', gap, width, height, align, justify, wrap, padding, }) => {
1873
+ const Stack = ({ children, direction = 'row', gap, width, height, align = 'center', justify, wrap, padding, }) => {
1703
1874
  return (jsxRuntimeExports.jsx("div", { className: STACK_STYLES.root({
1704
1875
  direction,
1705
1876
  gap,
@@ -1717,7 +1888,7 @@ Stack.displayName = 'Stack';
1717
1888
  * Card styles using createStyles from @aurora-ds/theme
1718
1889
  */
1719
1890
  const CARD_STYLES = pr((theme) => ({
1720
- root: ({ direction, padding, width, height, gap, radius, shadow, align, justify, }) => ({
1891
+ root: ({ direction, padding, width, height, gap, radius, shadow, align, justify, backgroundColor, borderColor }) => ({
1721
1892
  display: 'flex',
1722
1893
  flexDirection: direction,
1723
1894
  padding: padding ? theme.spacing[padding] : undefined,
@@ -1726,7 +1897,8 @@ const CARD_STYLES = pr((theme) => ({
1726
1897
  gap: gap ? theme.spacing[gap] : undefined,
1727
1898
  borderRadius: theme.radius[radius],
1728
1899
  boxShadow: theme.shadows[shadow],
1729
- backgroundColor: theme.colors.background,
1900
+ backgroundColor: theme.colors[backgroundColor],
1901
+ border: borderColor ? `1px solid ${theme.colors[borderColor]}` : 'none',
1730
1902
  alignItems: align,
1731
1903
  justifyContent: justify,
1732
1904
  boxSizing: 'border-box',
@@ -1743,7 +1915,7 @@ const CARD_STYLES = pr((theme) => ({
1743
1915
  * - `column`: Vertical layout (default)
1744
1916
  * - `row`: Horizontal layout
1745
1917
  */
1746
- const Card = ({ children, direction = 'column', padding = 'md', width, height, gap, radius = 'md', shadow = 'sm', align, justify, }) => {
1918
+ const Card = ({ children, direction = 'column', padding = 'md', width, height, gap, radius = 'md', shadow = 'sm', align, justify, backgroundColor = 'background', borderColor }) => {
1747
1919
  return (jsxRuntimeExports.jsx("div", { className: CARD_STYLES.root({
1748
1920
  direction,
1749
1921
  padding,
@@ -1754,12 +1926,15 @@ const Card = ({ children, direction = 'column', padding = 'md', width, height, g
1754
1926
  shadow,
1755
1927
  align,
1756
1928
  justify,
1929
+ backgroundColor,
1930
+ borderColor
1757
1931
  }), children: children }));
1758
1932
  };
1759
1933
  Card.displayName = 'Card';
1760
1934
 
1761
1935
  exports.Button = Button;
1762
1936
  exports.Card = Card;
1937
+ exports.Chip = Chip;
1763
1938
  exports.Icon = Icon;
1764
1939
  exports.IconButton = IconButton;
1765
1940
  exports.Stack = Stack;