@uni-design-system/uni-core 10.0.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`],
@@ -1098,7 +1122,30 @@ var buildComponents = (c) => ({
1098
1122
  divider: "light",
1099
1123
  elevation: "menu",
1100
1124
  padding: "md",
1101
- backdrop: { background: "rgba(0, 0, 0, 0.4)" }
1125
+ backdrop: { background: "rgba(0, 0, 0, 0.4)" },
1126
+ scrim: true,
1127
+ background: "solid"
1128
+ } },
1129
+ drawerHeader: { options: {
1130
+ color: void 0,
1131
+ height: 56,
1132
+ padding: "md",
1133
+ textRole: "title-medium",
1134
+ textAlign: "left",
1135
+ divider: "light",
1136
+ closeButtonIcon: "close",
1137
+ closeButtonSize: "md"
1138
+ } },
1139
+ drawerButtons: { options: {
1140
+ gap: "sm",
1141
+ padding: "md",
1142
+ justifyContent: "flex-end",
1143
+ confirmButtonVariant: "primary",
1144
+ cancelButtonVariant: "quaternary",
1145
+ buttonSize: "md",
1146
+ divider: "light",
1147
+ stretch: false,
1148
+ reverseOrder: false
1102
1149
  } },
1103
1150
  avatar: {
1104
1151
  options: {
@@ -1169,18 +1216,24 @@ var buildComponents = (c) => ({
1169
1216
  activeColor: "primary-container",
1170
1217
  maxSuggestions: 8
1171
1218
  } },
1172
- checkbox: { options: {
1173
- size: 20,
1174
- boxColor: "surface",
1175
- borderRadius: 2,
1176
- focusRingGap: 2
1177
- } },
1178
- radio: { options: {
1179
- size: 20,
1180
- ringColor: "outline",
1181
- fillColor: "surface",
1182
- motion: "control"
1183
- } },
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
+ },
1184
1237
  dialog: { options: {
1185
1238
  borderRadius: "lg",
1186
1239
  color: "primary-surface",
@@ -1242,13 +1295,16 @@ var buildComponents = (c) => ({
1242
1295
  activeSymbol: "check",
1243
1296
  motion: "control"
1244
1297
  },
1245
- variants: { warn: {
1246
- color: c.warn,
1247
- [HOVER_OR_KEYBOARD_FOCUS]: {
1248
- backgroundColor: c["warn-container"],
1249
- 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
+ }
1250
1306
  }
1251
- } }
1307
+ }
1252
1308
  },
1253
1309
  popover: { options: {
1254
1310
  color: "primary-surface",
@@ -1319,9 +1375,6 @@ var buildComponents = (c) => ({
1319
1375
  } },
1320
1376
  quantityStepper: {
1321
1377
  options: {
1322
- color: "primary-surface",
1323
- border: "light",
1324
- borderRadius: "xs",
1325
1378
  incrementIcon: "plus",
1326
1379
  decrementIcon: "minus",
1327
1380
  deleteIcon: "delete",
@@ -1794,11 +1847,31 @@ var buildComponents = (c) => ({
1794
1847
  grade: 0,
1795
1848
  opticalSize: 24
1796
1849
  } },
1797
- toggle: { options: {
1798
- size: 20,
1799
- trackColor: "surface-variant",
1800
- knobColor: "surface"
1801
- } },
1850
+ toggle: {
1851
+ options: {
1852
+ trackColor: "surface-variant",
1853
+ knobColor: "surface",
1854
+ motion: "control"
1855
+ },
1856
+ variantOptions: SELECTION_ACCENTS,
1857
+ sizes: {
1858
+ sm: {
1859
+ width: 28,
1860
+ height: 16,
1861
+ padding: 3
1862
+ },
1863
+ md: {
1864
+ width: 32,
1865
+ height: 18,
1866
+ padding: 3
1867
+ },
1868
+ lg: {
1869
+ width: 40,
1870
+ height: 20,
1871
+ padding: 2
1872
+ }
1873
+ }
1874
+ },
1802
1875
  tooltip: { options: {
1803
1876
  border: void 0,
1804
1877
  borderRadius: "xs",
@@ -2603,6 +2676,17 @@ var checkComponents = (value, issues) => {
2603
2676
  }
2604
2677
  for (const [key, style] of Object.entries(styles)) if (style !== void 0) checkStyleExpression(style, `components.${name}.${section}.${key}`, issues);
2605
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
+ }
2606
2690
  if (entry["options"] !== void 0 && !isRecord(entry["options"])) issues.push({
2607
2691
  path: `components.${name}.options`,
2608
2692
  message: "must be an object"