@beweco/aurora-ui 0.6.4 → 0.6.6

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/dist/index.cjs.js CHANGED
@@ -1476,42 +1476,224 @@ var themeColors = {
1476
1476
  overlay: "#000000",
1477
1477
  },
1478
1478
  },
1479
+ "oceanMint-light": {
1480
+ extend: "light",
1481
+ colors: {
1482
+ primary: {
1483
+ "50": "#e4f4fc",
1484
+ "100": "#bee4f7",
1485
+ "200": "#98d4f3",
1486
+ "300": "#72c5ee",
1487
+ "400": "#4cb5ea",
1488
+ "500": "#26a5e5",
1489
+ "600": "#1f88bd",
1490
+ "700": "#196b95",
1491
+ "800": "#124e6d",
1492
+ "900": "#0b3245",
1493
+ foreground: "#000",
1494
+ DEFAULT: "#26a5e5",
1495
+ },
1496
+ secondary: {
1497
+ "50": "#e2fdf2",
1498
+ "100": "#bafae0",
1499
+ "200": "#92f7cd",
1500
+ "300": "#6af5bb",
1501
+ "400": "#42f2a8",
1502
+ "500": "#1aef96",
1503
+ "600": "#15c57c",
1504
+ "700": "#119b62",
1505
+ "800": "#0c7247",
1506
+ "900": "#08482d",
1507
+ foreground: "#000",
1508
+ DEFAULT: "#1aef96",
1509
+ },
1510
+ success: {
1511
+ "50": "#e2f8ec",
1512
+ "100": "#b9efd1",
1513
+ "200": "#91e5b5",
1514
+ "300": "#68dc9a",
1515
+ "400": "#40d27f",
1516
+ "500": "#17c964",
1517
+ "600": "#13a653",
1518
+ "700": "#0f8341",
1519
+ "800": "#0b5f30",
1520
+ "900": "#073c1e",
1521
+ foreground: "#000",
1522
+ DEFAULT: "#17c964",
1523
+ },
1524
+ warning: {
1525
+ "50": "#fef4e4",
1526
+ "100": "#fce4bd",
1527
+ "200": "#fad497",
1528
+ "300": "#f9c571",
1529
+ "400": "#f7b54a",
1530
+ "500": "#f5a524",
1531
+ "600": "#ca881e",
1532
+ "700": "#9f6b17",
1533
+ "800": "#744e11",
1534
+ "900": "#4a320b",
1535
+ foreground: "#000",
1536
+ DEFAULT: "#f5a524",
1537
+ },
1538
+ danger: {
1539
+ "50": "#fee1eb",
1540
+ "100": "#fbb8cf",
1541
+ "200": "#f98eb3",
1542
+ "300": "#f76598",
1543
+ "400": "#f53b7c",
1544
+ "500": "#f31260",
1545
+ "600": "#c80f4f",
1546
+ "700": "#9e0c3e",
1547
+ "800": "#73092e",
1548
+ "900": "#49051d",
1549
+ foreground: "#000",
1550
+ DEFAULT: "#f31260",
1551
+ },
1552
+ focus: "#006FEE",
1553
+ overlay: "#ffffff",
1554
+ },
1555
+ },
1556
+ "oceanMint-dark": {
1557
+ extend: "dark",
1558
+ colors: {
1559
+ primary: {
1560
+ "50": "#0b3245",
1561
+ "100": "#124e6d",
1562
+ "200": "#196b95",
1563
+ "300": "#1f88bd",
1564
+ "400": "#26a5e5",
1565
+ "500": "#4cb5ea",
1566
+ "600": "#72c5ee",
1567
+ "700": "#98d4f3",
1568
+ "800": "#bee4f7",
1569
+ "900": "#e4f4fc",
1570
+ foreground: "#000",
1571
+ DEFAULT: "#26a5e5",
1572
+ },
1573
+ secondary: {
1574
+ "50": "#08482d",
1575
+ "100": "#0c7247",
1576
+ "200": "#119b62",
1577
+ "300": "#15c57c",
1578
+ "400": "#1aef96",
1579
+ "500": "#42f2a8",
1580
+ "600": "#6af5bb",
1581
+ "700": "#92f7cd",
1582
+ "800": "#bafae0",
1583
+ "900": "#e2fdf2",
1584
+ foreground: "#000",
1585
+ DEFAULT: "#1aef96",
1586
+ },
1587
+ success: {
1588
+ "50": "#073c1e",
1589
+ "100": "#0b5f30",
1590
+ "200": "#0f8341",
1591
+ "300": "#13a653",
1592
+ "400": "#17c964",
1593
+ "500": "#40d27f",
1594
+ "600": "#68dc9a",
1595
+ "700": "#91e5b5",
1596
+ "800": "#b9efd1",
1597
+ "900": "#e2f8ec",
1598
+ foreground: "#000",
1599
+ DEFAULT: "#17c964",
1600
+ },
1601
+ warning: {
1602
+ "50": "#4a320b",
1603
+ "100": "#744e11",
1604
+ "200": "#9f6b17",
1605
+ "300": "#ca881e",
1606
+ "400": "#f5a524",
1607
+ "500": "#f7b54a",
1608
+ "600": "#f9c571",
1609
+ "700": "#fad497",
1610
+ "800": "#fce4bd",
1611
+ "900": "#fef4e4",
1612
+ foreground: "#000",
1613
+ DEFAULT: "#f5a524",
1614
+ },
1615
+ danger: {
1616
+ "50": "#49051d",
1617
+ "100": "#73092e",
1618
+ "200": "#9e0c3e",
1619
+ "300": "#c80f4f",
1620
+ "400": "#f31260",
1621
+ "500": "#f53b7c",
1622
+ "600": "#f76598",
1623
+ "700": "#f98eb3",
1624
+ "800": "#fbb8cf",
1625
+ "900": "#fee1eb",
1626
+ foreground: "#000",
1627
+ DEFAULT: "#f31260",
1628
+ },
1629
+ focus: "#006FEE",
1630
+ overlay: "#000000",
1631
+ },
1632
+ },
1479
1633
  };
1480
1634
 
1635
+ /**
1636
+ * @file This file contains the theme configurations for the application.
1637
+ */
1638
+ var ALL_THEMES = __spreadArray(["light", "dark"], Object.keys(themeColors), true);
1639
+ /**
1640
+ * Unique hue ids derived from {@link themeColors} keys (e.g. `oceanMint` from `oceanMint-light`).
1641
+ */
1642
+ function getRegisteredThemeColorBases() {
1643
+ return Array.from(new Set(Object.keys(themeColors).map(function (key) { return key.replace(/-(light|dark)$/, ""); }))).sort();
1644
+ }
1645
+ /**
1646
+ * Same as {@link getRegisteredThemeColorBases} typed as {@link ThemeColor} for callers that expect the union.
1647
+ * Keeps Storybook / pickers in sync when new `*-light` / `*-dark` pairs are added.
1648
+ */
1649
+ var REGISTERED_THEME_COLORS = getRegisteredThemeColorBases();
1650
+
1651
+ /** Human-readable theme name for tooltips and aria (e.g. blue-light → "Blue light"). */
1652
+ function formatThemeDisplayName(themeName) {
1653
+ return themeName
1654
+ .split("-")
1655
+ .map(function (segment) {
1656
+ return segment.length > 0
1657
+ ? segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()
1658
+ : segment;
1659
+ })
1660
+ .join(" ");
1661
+ }
1662
+ var swatchClass = "box-border shrink-0 cursor-pointer rounded-full border-2 transition-[border-color,box-shadow]";
1663
+ var radioClassNames = {
1664
+ base: "m-0 inline-flex max-w-fit items-center p-0",
1665
+ wrapper: "hidden",
1666
+ // HeroUI places a full-size invisible input at z-[1] over the label; lift swatches above it.
1667
+ labelWrapper: "relative z-[2] m-0 ms-0 flex flex-col p-0",
1668
+ label: "m-0 block p-0 leading-none",
1669
+ };
1670
+ /**
1671
+ * One swatch per registered hue, using the palette for the **current** app light/dark mode.
1672
+ * To preview dark variants the user must switch the app to dark mode (and vice versa).
1673
+ */
1481
1674
  var ColorSelector = function (_a) {
1482
1675
  var selectedColor = _a.selectedColor, onColorChange = _a.onColorChange;
1483
1676
  var mode = useThemeContext().mode;
1484
- /**
1485
- * Filters and maps the available theme colors to the current theme mode (light/dark).
1486
- * Each color option contains:
1487
- * - value: the theme name (e.g., "blue-light")
1488
- * - label: the base color name (e.g., "blue")
1489
- * - color: the primary color hex value
1490
- */
1491
- var colorOptions = Object.entries(themeColors)
1492
- .filter(function (_a) {
1493
- var themeData = _a[1];
1494
- var themeMode = themeData.extend;
1495
- return mode === "light" ? themeMode === "light" : themeMode === "dark";
1496
- })
1497
- .map(function (_a) {
1498
- var themeName = _a[0], theme = _a[1];
1499
- return ({
1500
- value: themeName,
1501
- label: themeName.split("-")[0],
1502
- color: theme.colors.primary.DEFAULT,
1503
- });
1504
- });
1677
+ var resolvedMode = mode === "dark" ? "dark" : "light";
1678
+ var baseIds = getRegisteredThemeColorBases();
1505
1679
  return (jsxRuntime.jsx(react.RadioGroup, { value: selectedColor, onValueChange: onColorChange, orientation: "horizontal", className: "flex flex-wrap !gap-2", classNames: {
1506
1680
  base: "flex flex-wrap !gap-2",
1507
1681
  wrapper: "flex flex-wrap !gap-2",
1508
- }, children: colorOptions.map(function (color) { return (jsxRuntime.jsx(react.Radio, { value: color.label, className: "p-0 m-0", classNames: {
1509
- base: "p-0 m-0",
1510
- wrapper: "hidden",
1511
- labelWrapper: "p-0 m-0",
1512
- }, children: jsxRuntime.jsx("div", { className: "w-8 h-8 rounded-full border-2 cursor-pointer transition-all ".concat(selectedColor === color.label
1513
- ? "border-black border-opacity-20 scale-110"
1514
- : "border-gray-200 hover:scale-105"), style: { backgroundColor: color.color }, title: color.label }) }, color.value)); }) }));
1682
+ }, children: baseIds.map(function (baseId) {
1683
+ var themeName = "".concat(baseId, "-").concat(resolvedMode);
1684
+ var entry = themeColors[themeName];
1685
+ if (!entry) {
1686
+ return null;
1687
+ }
1688
+ var isSelected = selectedColor === baseId;
1689
+ return (jsxRuntime.jsx(react.Radio, { value: baseId, "aria-label": formatThemeDisplayName(themeName), classNames: radioClassNames, children: jsxRuntime.jsx(react.Tooltip, { content: formatThemeDisplayName(themeName), delay: 0, closeDelay: 120, placement: "top", children: jsxRuntime.jsx("span", { className: [
1690
+ swatchClass,
1691
+ "inline-block size-8",
1692
+ isSelected
1693
+ ? "border-foreground/40 ring-2 ring-foreground/25 ring-offset-2 ring-offset-background"
1694
+ : "border-default-200 hover:border-default-400",
1695
+ ].join(" "), style: { backgroundColor: entry.colors.primary.DEFAULT } }) }) }, baseId));
1696
+ }) }));
1515
1697
  };
1516
1698
 
1517
1699
  /**
@@ -6515,6 +6697,79 @@ var Card = function (_a) {
6515
6697
  return (jsxRuntime.jsx(react.Card, __assign({ shadow: shadow, radius: radius, className: combinedClassName }, props, { children: children })));
6516
6698
  };
6517
6699
 
6700
+ /**
6701
+ * Registro público de temas Aurora para consumidores (@beweco/aurora-ui).
6702
+ * Derivado de {@link themeColors}: al añadir un par `*-light` / `*-dark` en
6703
+ * `colors.default.ts`, este registro se actualiza sin duplicar listas.
6704
+ */
6705
+ function readPrimaryDefault(colors) {
6706
+ var primary = colors.primary;
6707
+ if (primary &&
6708
+ typeof primary === "object" &&
6709
+ "DEFAULT" in primary &&
6710
+ typeof primary.DEFAULT === "string") {
6711
+ return primary.DEFAULT;
6712
+ }
6713
+ return "#000000";
6714
+ }
6715
+ function parseEntry(id, config) {
6716
+ var mode = config.extend === "dark" ? "dark" : "light";
6717
+ var colorFamily = id.replace(/-(light|dark)$/, "");
6718
+ return {
6719
+ id: id,
6720
+ colorFamily: colorFamily,
6721
+ mode: mode,
6722
+ labelKey: "aurora.theme.".concat(id),
6723
+ previewPrimary: readPrimaryDefault(config.colors),
6724
+ };
6725
+ }
6726
+ /** Entradas en el mismo orden que las claves de `themeColors`. */
6727
+ var AURORA_THEME_REGISTRY = Object.entries(themeColors).map(function (_a) {
6728
+ var id = _a[0], config = _a[1];
6729
+ return parseEntry(id, config);
6730
+ });
6731
+ function buildFamilies(entries) {
6732
+ var _a;
6733
+ var map = new Map();
6734
+ for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
6735
+ var entry = entries_1[_i];
6736
+ var slot = (_a = map.get(entry.colorFamily)) !== null && _a !== void 0 ? _a : {};
6737
+ if (entry.mode === "light") {
6738
+ slot.light = entry;
6739
+ }
6740
+ else {
6741
+ slot.dark = entry;
6742
+ }
6743
+ map.set(entry.colorFamily, slot);
6744
+ }
6745
+ return Array.from(map.entries())
6746
+ .map(function (_a) {
6747
+ var colorFamily = _a[0], _b = _a[1], light = _b.light, dark = _b.dark;
6748
+ return ({
6749
+ colorFamily: colorFamily,
6750
+ light: light,
6751
+ dark: dark,
6752
+ });
6753
+ })
6754
+ .sort(function (a, b) { return a.colorFamily.localeCompare(b.colorFamily); });
6755
+ }
6756
+ /** Familias de color (light + dark) para selectores tipo “Color de la plataforma”. */
6757
+ var AURORA_THEME_FAMILIES = buildFamilies(AURORA_THEME_REGISTRY);
6758
+ function isAuroraFullThemeId(value) {
6759
+ return value in themeColors;
6760
+ }
6761
+ /** Texto legible por defecto para tooltips (p. ej. `Ocean Mint · Light`). */
6762
+ function formatAuroraThemeTooltip(entry) {
6763
+ var family = entry.colorFamily
6764
+ .replace(/([A-Z])/g, " $1")
6765
+ .trim()
6766
+ .split(/\s+/)
6767
+ .map(function (w) { return w.charAt(0).toUpperCase() + w.slice(1).toLowerCase(); })
6768
+ .join(" ");
6769
+ var mode = entry.mode === "light" ? "Light" : "Dark";
6770
+ return "".concat(family, " \u00B7 ").concat(mode);
6771
+ }
6772
+
6518
6773
  var THEME_COLOR_HEX_MAP = {
6519
6774
  blue: "#006fee",
6520
6775
  purple: "#7828c8",
@@ -6522,6 +6777,7 @@ var THEME_COLOR_HEX_MAP = {
6522
6777
  green: "#16c964",
6523
6778
  coral: "#ff4f4f",
6524
6779
  skyBlue: "#60A5FA",
6780
+ oceanMint: "#26a5e5",
6525
6781
  };
6526
6782
  function hexToRgb$1(hex) {
6527
6783
  var clean = hex.replace("#", "");
@@ -6705,11 +6961,6 @@ function removeCustomPrimaryColor() {
6705
6961
  }
6706
6962
  }
6707
6963
 
6708
- /**
6709
- * @file This file contains the theme configurations for the application.
6710
- */
6711
- var ALL_THEMES = __spreadArray(["light", "dark"], Object.keys(themeColors), true);
6712
-
6713
6964
  /**
6714
6965
  * Custom hook to manage the theme state and side effects.
6715
6966
  * Supports both named ThemeColor values and arbitrary hex colors.
@@ -6884,6 +7135,9 @@ Object.defineProperty(exports, "loadIcons", {
6884
7135
  enumerable: true,
6885
7136
  get: function () { return react$1.loadIcons; }
6886
7137
  });
7138
+ exports.ALL_THEMES = ALL_THEMES;
7139
+ exports.AURORA_THEME_FAMILIES = AURORA_THEME_FAMILIES;
7140
+ exports.AURORA_THEME_REGISTRY = AURORA_THEME_REGISTRY;
6887
7141
  exports.AccordionList = AccordionList;
6888
7142
  exports.AddHolidayForm = AddHolidayForm;
6889
7143
  exports.AnalyticsCard = AnalyticsCard;
@@ -6930,6 +7184,7 @@ exports.P = P;
6930
7184
  exports.Pagination = Pagination;
6931
7185
  exports.Phone = Phone;
6932
7186
  exports.PromotionalBanner = PromotionalBanner;
7187
+ exports.REGISTERED_THEME_COLORS = REGISTERED_THEME_COLORS;
6933
7188
  exports.RangeFilter = RangeFilter;
6934
7189
  exports.RowSteps = RowSteps;
6935
7190
  exports.SEGMENTATION_DEFAULT_TRANSLATIONS = DEFAULT_TRANSLATIONS$1;
@@ -6961,11 +7216,14 @@ exports.WizardSidebar = WizardSidebar;
6961
7216
  exports.applyCustomPrimaryColor = applyCustomPrimaryColor;
6962
7217
  exports.defaultCountries = uniqueCountries;
6963
7218
  exports.defaultTranslations = defaultTranslations$4;
7219
+ exports.formatAuroraThemeTooltip = formatAuroraThemeTooltip;
6964
7220
  exports.generateThemeColorScale = generateThemeColorScale;
6965
7221
  exports.getContrastForeground = getContrastForeground;
7222
+ exports.getRegisteredThemeColorBases = getRegisteredThemeColorBases;
6966
7223
  exports.getSelectedKeyFromPath = getSelectedKeyFromPath;
6967
7224
  exports.hexToThemeColor = hexToThemeColor;
6968
7225
  exports.hslToCssValue = hslToCssValue;
7226
+ exports.isAuroraFullThemeId = isAuroraFullThemeId;
6969
7227
  exports.isExactThemeColor = isExactThemeColor;
6970
7228
  exports.isGroupState = isGroupState;
6971
7229
  exports.isHexColor = isHexColor;