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