@uni-design-system/uni-core 10.1.0 → 10.2.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.
package/dist/esm/index.js CHANGED
@@ -1056,6 +1056,30 @@ var buildBorders = (c) => ({
1056
1056
  * surface and draws the edge — so every role stays consistent and a theme can
1057
1057
  * still override any single cell.
1058
1058
  */
1059
+ /**
1060
+ * Accent roles for the selection controls (checkbox, radio, toggle).
1061
+ *
1062
+ * A variant names the intent; this says which colour token draws it, and the
1063
+ * component decides where it lands — the box fill, the ring, the dot, the
1064
+ * track, the focus ring. Keeping it as a role rather than a `variants`
1065
+ * StyleExpression is what stops interior class names like `.checkbox-check`
1066
+ * becoming public theme contract.
1067
+ *
1068
+ * The same seven names `button` and `iconButton` theme, so the library is
1069
+ * consistent about which intents exist by default.
1070
+ */
1071
+ var SELECTION_ACCENTS = {
1072
+ primary: { accent: "primary" },
1073
+ secondary: { accent: "secondary" },
1074
+ tertiary: { accent: "tertiary" },
1075
+ warn: { accent: "warn" },
1076
+ success: { accent: "success" },
1077
+ disabled: { accent: "disabled" },
1078
+ ghost: {
1079
+ accent: "ghost",
1080
+ onAccent: "on-primary"
1081
+ }
1082
+ };
1059
1083
  var tagVariant = (c, role) => ({ [role]: {
1060
1084
  backgroundColor: c[`${role}-container`],
1061
1085
  color: c[`on-${role}-container`],
@@ -1192,18 +1216,24 @@ var buildComponents = (c) => ({
1192
1216
  activeColor: "primary-container",
1193
1217
  maxSuggestions: 8
1194
1218
  } },
1195
- checkbox: { options: {
1196
- size: 20,
1197
- boxColor: "surface",
1198
- borderRadius: 2,
1199
- focusRingGap: 2
1200
- } },
1201
- radio: { options: {
1202
- size: 20,
1203
- ringColor: "outline",
1204
- fillColor: "surface",
1205
- motion: "control"
1206
- } },
1219
+ checkbox: {
1220
+ options: {
1221
+ size: 20,
1222
+ boxColor: "surface",
1223
+ borderRadius: 2,
1224
+ focusRingGap: 2
1225
+ },
1226
+ variantOptions: SELECTION_ACCENTS
1227
+ },
1228
+ radio: {
1229
+ options: {
1230
+ size: 20,
1231
+ ringColor: "outline",
1232
+ fillColor: "surface",
1233
+ motion: "control"
1234
+ },
1235
+ variantOptions: SELECTION_ACCENTS
1236
+ },
1207
1237
  dialog: { options: {
1208
1238
  borderRadius: "lg",
1209
1239
  color: "primary-surface",
@@ -1265,13 +1295,16 @@ var buildComponents = (c) => ({
1265
1295
  activeSymbol: "check",
1266
1296
  motion: "control"
1267
1297
  },
1268
- variants: { warn: {
1269
- color: c.warn,
1270
- [HOVER_OR_KEYBOARD_FOCUS]: {
1271
- backgroundColor: c["warn-container"],
1272
- color: c["on-warn-container"]
1298
+ variants: {
1299
+ primary: {},
1300
+ warn: {
1301
+ color: c.warn,
1302
+ [HOVER_OR_KEYBOARD_FOCUS]: {
1303
+ backgroundColor: c["warn-container"],
1304
+ color: c["on-warn-container"]
1305
+ }
1273
1306
  }
1274
- } }
1307
+ }
1275
1308
  },
1276
1309
  popover: { options: {
1277
1310
  color: "primary-surface",
@@ -1820,6 +1853,7 @@ var buildComponents = (c) => ({
1820
1853
  knobColor: "surface",
1821
1854
  motion: "control"
1822
1855
  },
1856
+ variantOptions: SELECTION_ACCENTS,
1823
1857
  sizes: {
1824
1858
  sm: {
1825
1859
  width: 28,
@@ -2642,6 +2676,17 @@ var checkComponents = (value, issues) => {
2642
2676
  }
2643
2677
  for (const [key, style] of Object.entries(styles)) if (style !== void 0) checkStyleExpression(style, `components.${name}.${section}.${key}`, issues);
2644
2678
  }
2679
+ const variantOptions = entry["variantOptions"];
2680
+ if (variantOptions !== void 0) {
2681
+ if (!isRecord(variantOptions)) issues.push({
2682
+ path: `components.${name}.variantOptions`,
2683
+ message: "must be an object"
2684
+ });
2685
+ else for (const [key, roles] of Object.entries(variantOptions)) if (roles !== void 0 && !isRecord(roles)) issues.push({
2686
+ path: `components.${name}.variantOptions.${key}`,
2687
+ message: "must be an object"
2688
+ });
2689
+ }
2645
2690
  if (entry["options"] !== void 0 && !isRecord(entry["options"])) issues.push({
2646
2691
  path: `components.${name}.options`,
2647
2692
  message: "must be an object"