@uni-design-system/uni-core 5.2.0 → 6.0.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.
@@ -821,6 +821,28 @@ var generateShadows = (colors, mode = "light") => {
821
821
  };
822
822
  };
823
823
  //#endregion
824
+ //#region src/concepts/iconography/icon.records.ts
825
+ /**
826
+ * Default icon primitives shipped with every theme. Each icon is an inline
827
+ * SVG data URI rendered as a CSS mask over `currentColor`, so icons recolor
828
+ * with the theme automatically. `createTheme` merges a theme's own `icons`
829
+ * over this set — add or override under any name; components render them by
830
+ * token via `uni-icon`, never by inlining SVG.
831
+ */
832
+ var BaseIcons = {
833
+ alertCircle: "data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cpath d='M0 0h24v24H0V0z' fill='none'/%3e%3cpath d='M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z'/%3e%3c/svg%3e",
834
+ calendar: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z'%3E%3C/path%3E%3C/svg%3E",
835
+ checkCircle: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg%3E%3Cpath d='M32,0A32,32,0,1,0,64,32,32,32,0,0,0,32,0Zm2.0873,41.5-5.4107,5.4106-.02.02L14.1751,32.4492l5.4306-5.4306,9.051,9.0509L46.2861,18.44l5.4305,5.4306Z'/%3E%3C/g%3E%3C/svg%3E",
836
+ chevronUp: "data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='m296-345-56-56 240-240 240 240-56 56-184-184-184 184Z'/%3E%3C/svg%3E",
837
+ chevronDown: "data:image/svg+xml,%0A%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E",
838
+ chevronLeft: "data:image/svg+xml, %3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z'/%3E%3C/svg%3E",
839
+ chevronRight: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960'%3E%3Cpath d='M504-480 320-664l56-56 240 240-240 240-56-56 184-184Z'/%3E%3C/svg%3E",
840
+ xCircle: "data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3e%3cg%3e%3cpath d='M32,0A32,32,0,1,0,64,32,32,32,0,0,0,32,0ZM47.4649,42.3543l-5.4306,5.43L31.68,37.4305,21.3257,47.7848l-5.4306-5.43L26.25,32,15.8951,21.6456l5.4306-5.4305L31.68,26.5694,42.0343,16.2151l5.4306,5.4305L37.1106,32Z'/%3e%3c/g%3e%3c/svg%3e",
841
+ search: "data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 50'%3e%3cg%3e%3cpath d='M 21 3 C 11.601563 3 4 10.601563 4 20 C 4 29.398438 11.601563 37 21 37 C 24.355469 37 27.460938 36.015625 30.09375 34.34375 L 42.375 46.625 L 46.625 42.375 L 34.5 30.28125 C 36.679688 27.421875 38 23.878906 38 20 C 38 10.601563 30.398438 3 21 3 Z M 21 7 C 28.199219 7 34 12.800781 34 20 C 34 27.199219 28.199219 33 21 33 C 13.800781 33 8 27.199219 8 20 C 8 12.800781 13.800781 7 21 7 Z'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",
842
+ close: "data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3e%3cg%3e%3cpath fill='currentColor' d='M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",
843
+ spinner: "data:image/svg+xml;charset=UTF-8,%3csvg stroke='%23000' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg' %3e%3cstyle%3e .oui_spinner %7b transform-origin: center; animation: rotate_360 2s linear infinite;%7d .oui_spinner circle %7b stroke-linecap: round; animation: dash 1.5s ease-in-out infinite;%7d %40keyframes rotate_360 %7b 100%25 %7b transform: rotate(360deg);%7d %7d %40keyframes dash %7b 0%25 %7b stroke-dasharray: 0 150; stroke-dashoffset: 0;%7d 47.5%25 %7b stroke-dasharray: 42 150; stroke-dashoffset: -16;%7d 95%25, 100%25 %7b stroke-dasharray: 42 150; stroke-dashoffset: -59;%7d %7d %3c/style%3e%3cg class='oui_spinner'%3e%3ccircle cx='12' cy='12' r='9.5' fill='none' stroke-width='3'%3e%3c/circle%3e%3c/g%3e%3c/svg%3e "
844
+ };
845
+ //#endregion
824
846
  //#region src/concepts/theme/themes/base.theme.ts
825
847
  var BaseTypography = {
826
848
  "display-large": {
@@ -959,6 +981,13 @@ var BaseTypography = {
959
981
  fontSize: 16,
960
982
  lineHeight: 24
961
983
  },
984
+ stat: {
985
+ fontFamily: "Red Hat Display",
986
+ fontSize: 32,
987
+ lineHeight: 38,
988
+ fontWeight: 600,
989
+ letterSpacing: -.32
990
+ },
962
991
  tag: {
963
992
  fontFamily: "Red Hat Display",
964
993
  fontSize: 15,
@@ -1102,7 +1131,23 @@ var buildComponents = (c) => ({
1102
1131
  ringColor: "surface",
1103
1132
  ringWidth: 2
1104
1133
  } },
1105
- checkbox: { options: { size: 20 } },
1134
+ searchInput: { options: {
1135
+ searchSymbol: "search",
1136
+ clearSymbol: "close",
1137
+ listColor: "primary-surface",
1138
+ listShadow: "menu",
1139
+ listBorderRadius: "xs",
1140
+ maxSuggestions: 8
1141
+ } },
1142
+ checkbox: { options: {
1143
+ size: 20,
1144
+ boxColor: "surface"
1145
+ } },
1146
+ radio: { options: {
1147
+ size: 20,
1148
+ ringColor: "outline",
1149
+ fillColor: "surface"
1150
+ } },
1106
1151
  dialog: { options: {
1107
1152
  borderRadius: "lg",
1108
1153
  color: "primary-surface",
@@ -1427,6 +1472,19 @@ var buildComponents = (c) => ({
1427
1472
  currentPageBorder: "light",
1428
1473
  currentPageBorderRadius: "xs"
1429
1474
  } },
1475
+ stat: { options: {
1476
+ labelTypeface: "label",
1477
+ valueTypeface: "stat",
1478
+ color: "surface",
1479
+ border: "light",
1480
+ borderRadius: "xs",
1481
+ positiveColor: "success",
1482
+ negativeColor: "error",
1483
+ trendColor: "outline",
1484
+ trendAccent: "primary",
1485
+ padding: "md",
1486
+ gap: "xxs"
1487
+ } },
1430
1488
  slider: { options: {
1431
1489
  color: "primary",
1432
1490
  trackColor: "surface-variant",
@@ -1453,7 +1511,11 @@ var buildComponents = (c) => ({
1453
1511
  grade: 0,
1454
1512
  opticalSize: 24
1455
1513
  } },
1456
- toggle: { options: { size: 20 } },
1514
+ toggle: { options: {
1515
+ size: 20,
1516
+ trackColor: "surface-variant",
1517
+ knobColor: "surface"
1518
+ } },
1457
1519
  tooltip: { options: {
1458
1520
  border: void 0,
1459
1521
  borderRadius: "xs",
@@ -1479,7 +1541,10 @@ var createTheme = ({ id, name, colors, icons = {}, radii = BaseRadii, shadows =
1479
1541
  shadows,
1480
1542
  spacing: BaseSpacing,
1481
1543
  thicknesses: BaseThicknesses,
1482
- icons,
1544
+ icons: {
1545
+ ...BaseIcons,
1546
+ ...icons
1547
+ },
1483
1548
  components: deepMerge(buildComponents(colors), components)
1484
1549
  });
1485
1550
  /**
@@ -1686,6 +1751,7 @@ var themeExport = (exportName, displayName, colorsConst, shadowsConst, radii) =>
1686
1751
  ` borders: borders(${colorsConst}),`,
1687
1752
  ` components: components(${colorsConst}),`,
1688
1753
  ` shadows: ${shadowsConst},`,
1754
+ " icons,",
1689
1755
  ...radii ? [" radii,"] : [],
1690
1756
  "});"
1691
1757
  ].join("\n");
@@ -1740,6 +1806,7 @@ var emitThemeFile = (input) => {
1740
1806
  " type Borders,",
1741
1807
  " type Colors,",
1742
1808
  " type ComponentThemes,",
1809
+ " type Icons,",
1743
1810
  " type Shadows,",
1744
1811
  " type UniTheme,",
1745
1812
  "} from '@uni-design-system/uni-core';",
@@ -1757,6 +1824,15 @@ var emitThemeFile = (input) => {
1757
1824
  " */",
1758
1825
  "const components = (colors: Colors): ComponentThemes => ({});",
1759
1826
  "",
1827
+ "/**",
1828
+ " * Icon primitives, merged over the built-in set (close, search, spinner,",
1829
+ " * chevrons, …). Define an icon ONCE here as an inline SVG data URI — it is",
1830
+ " * masked with currentColor, so it recolors with the theme — and render it",
1831
+ " * anywhere via `<uni-icon name='…'/>`. Never inline SVG in components.",
1832
+ " * Example: logo: \"data:image/svg+xml,%3Csvg xmlns='…' viewBox='0 0 24 24'%3E…%3C/svg%3E\",",
1833
+ " */",
1834
+ "const icons: Icons = {};",
1835
+ "",
1760
1836
  ...radii ? [
1761
1837
  `/** Shape language: '${input.shape}'. */`,
1762
1838
  `const radii = {\n${recordLiteral(radii, " ")}\n};`,
@@ -1966,6 +2042,7 @@ var debounce = (callback, timeout) => {
1966
2042
  };
1967
2043
  //#endregion
1968
2044
  exports.BASE_PALETTE_CONFIG = BASE_PALETTE_CONFIG;
2045
+ exports.BaseIcons = BaseIcons;
1969
2046
  exports.BaseTheme = BaseTheme;
1970
2047
  exports.CategoryChroma = CategoryChroma;
1971
2048
  exports.CategoryLightness = CategoryLightness;