rei-kit 0.5.0 → 0.5.2

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.
@@ -15,6 +15,16 @@ type __VLS_Props = {
15
15
  error?: string | undefined;
16
16
  hint?: string | undefined;
17
17
  disabled?: boolean | undefined;
18
+ /**
19
+ * `md` is a setting: a line the reader came here to change, in ink.
20
+ * `sm` is an aside — "remember me" under a sign-in form, "show the ones I
21
+ * have learned" above a list — quieter and tighter.
22
+ *
23
+ * The two are not a guess. Of the five hand-written checkboxes across the
24
+ * three consuming apps, four were the aside and one was the setting, and
25
+ * they differed in exactly these two ways.
26
+ */
27
+ size?: 'sm' | 'md' | undefined;
18
28
  };
19
29
  type __VLS_ModelProps = {
20
30
  modelValue?: boolean;
@@ -9,6 +9,8 @@ type __VLS_Props = {
9
9
  */
10
10
  labelHidden?: boolean | undefined;
11
11
  type?: 'text' | 'email' | 'password' | 'number' | undefined;
12
+ /** `sm` for a field inside a row rather than in a form of its own. */
13
+ size?: 'sm' | 'md' | undefined;
12
14
  };
13
15
  type __VLS_ModelProps = {
14
16
  modelValue?: string | undefined;
@@ -26,6 +26,12 @@ type __VLS_Props = {
26
26
  * someone go back to having answered nothing, which no form wants.
27
27
  */
28
28
  placeholder?: string | undefined;
29
+ /**
30
+ * `sm` for a select that filters or sorts rather than answers a form.
31
+ *
32
+ * Every hand-written select across the three consuming apps was this one.
33
+ */
34
+ size?: 'sm' | 'md' | undefined;
29
35
  };
30
36
  type __VLS_ModelProps = {
31
37
  modelValue?: string | undefined;
@@ -4,6 +4,8 @@ type __VLS_Props = {
4
4
  hint?: string | undefined;
5
5
  labelHidden?: boolean | undefined;
6
6
  rows?: number | undefined;
7
+ /** `sm` for editing in place, inside a row that is already small. */
8
+ size?: 'sm' | 'md' | undefined;
7
9
  };
8
10
  type __VLS_ModelProps = {
9
11
  modelValue?: string | undefined;
@@ -25,6 +25,15 @@ type __VLS_Props = {
25
25
  label: string;
26
26
  error?: string | undefined;
27
27
  hint?: string | undefined;
28
+ /**
29
+ * `sm` for a control that sits inside something else — a toolbar, a filter
30
+ * row, a settings line — rather than in a form of its own.
31
+ *
32
+ * It exists because every hand-written select in all three apps was the
33
+ * small one, and the kit only had the large one. A part is not reusable if
34
+ * reaching for it costs a size somebody chose on purpose.
35
+ */
36
+ size?: 'sm' | 'md' | undefined;
28
37
  /**
29
38
  * Hides the label visually but keeps it for assistive tech. For fields whose
30
39
  * surrounding row already names them — dropping the label entirely would
@@ -36,6 +45,7 @@ declare var __VLS_1: {
36
45
  id: string;
37
46
  describedBy: string | undefined;
38
47
  invalid: boolean;
48
+ size: "sm" | "md";
39
49
  };
40
50
  type __VLS_Slots = {} & {
41
51
  default?: (props: typeof __VLS_1) => any;
package/dist/index.js CHANGED
@@ -729,7 +729,7 @@ function useVisualViewport() {
729
729
  //#endregion
730
730
  //#region src/components/BaseAlert.vue?vue&type=script&setup=true&lang.ts
731
731
  var _hoisted_1$22 = ["role", "aria-live"];
732
- var _hoisted_2$17 = { class: "min-w-0 flex-1" };
732
+ var _hoisted_2$16 = { class: "min-w-0 flex-1" };
733
733
  var _hoisted_3$12 = {
734
734
  key: 0,
735
735
  class: "text-ink font-semibold"
@@ -771,7 +771,7 @@ var BaseAlert_default = /* @__PURE__ */ defineComponent({
771
771
  class: normalizeClass(["mt-px grid size-6 shrink-0 place-items-center rounded-full text-xs font-semibold", mark.value]),
772
772
  "aria-hidden": "true"
773
773
  }, [renderSlot(_ctx.$slots, "mark")], 2)) : createCommentVNode("", true),
774
- createElementVNode("div", _hoisted_2$17, [_ctx.$slots.title ? (openBlock(), createElementBlock("p", _hoisted_3$12, [renderSlot(_ctx.$slots, "title")])) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(_ctx.$slots.title ? "mt-1" : "") }, [renderSlot(_ctx.$slots, "default")], 2)]),
774
+ createElementVNode("div", _hoisted_2$16, [_ctx.$slots.title ? (openBlock(), createElementBlock("p", _hoisted_3$12, [renderSlot(_ctx.$slots, "title")])) : createCommentVNode("", true), createElementVNode("div", { class: normalizeClass(_ctx.$slots.title ? "mt-1" : "") }, [renderSlot(_ctx.$slots, "default")], 2)]),
775
775
  renderSlot(_ctx.$slots, "action")
776
776
  ], 10, _hoisted_1$22);
777
777
  };
@@ -881,8 +881,7 @@ var BaseButton_default = /* @__PURE__ */ defineComponent({
881
881
  });
882
882
  //#endregion
883
883
  //#region src/components/FormField.vue?vue&type=script&setup=true&lang.ts
884
- var _hoisted_1$20 = { class: "flex flex-col gap-1.5" };
885
- var _hoisted_2$16 = ["for"];
884
+ var _hoisted_1$20 = ["for"];
886
885
  //#endregion
887
886
  //#region src/components/FormField.vue
888
887
  var FormField_default = /* @__PURE__ */ defineComponent({
@@ -891,6 +890,7 @@ var FormField_default = /* @__PURE__ */ defineComponent({
891
890
  label: {},
892
891
  error: { default: "" },
893
892
  hint: { default: "" },
893
+ size: { default: "md" },
894
894
  labelHidden: {
895
895
  type: Boolean,
896
896
  default: false
@@ -905,15 +905,16 @@ var FormField_default = /* @__PURE__ */ defineComponent({
905
905
  if (__props.hint) return hintId;
906
906
  });
907
907
  return (_ctx, _cache) => {
908
- return openBlock(), createElementBlock("div", _hoisted_1$20, [
908
+ return openBlock(), createElementBlock("div", { class: normalizeClass(["flex flex-col", __props.size === "sm" ? "gap-1" : "gap-1.5"]) }, [
909
909
  createElementVNode("label", {
910
910
  for: unref(id),
911
- class: normalizeClass(["text-ink text-sm font-medium", __props.labelHidden ? "sr-only" : ""])
912
- }, toDisplayString(__props.label), 11, _hoisted_2$16),
911
+ class: normalizeClass(["font-medium", [__props.labelHidden ? "sr-only" : "", __props.size === "sm" ? "text-ink-soft text-xs" : "text-ink text-sm"]])
912
+ }, toDisplayString(__props.label), 11, _hoisted_1$20),
913
913
  renderSlot(_ctx.$slots, "default", {
914
914
  id: unref(id),
915
915
  describedBy: describedBy.value,
916
- invalid: Boolean(__props.error)
916
+ invalid: Boolean(__props.error),
917
+ size: __props.size
917
918
  }),
918
919
  __props.error ? (openBlock(), createElementBlock("p", {
919
920
  key: 0,
@@ -924,7 +925,7 @@ var FormField_default = /* @__PURE__ */ defineComponent({
924
925
  id: hintId,
925
926
  class: "text-ink-soft text-xs"
926
927
  }, toDisplayString(__props.hint), 1)) : createCommentVNode("", true)
927
- ]);
928
+ ], 2);
928
929
  };
929
930
  }
930
931
  });
@@ -949,20 +950,26 @@ var BaseInput_default = /* @__PURE__ */ defineComponent({
949
950
  type: Boolean,
950
951
  default: false
951
952
  },
952
- type: { default: "text" }
953
+ type: { default: "text" },
954
+ size: { default: "md" }
953
955
  }, {
954
956
  "modelValue": {},
955
957
  "modelModifiers": {}
956
958
  }),
957
959
  emits: ["update:modelValue"],
958
960
  setup(__props) {
961
+ const SIZE_CLASS = {
962
+ sm: "h-11 text-sm",
963
+ md: "h-11 text-base"
964
+ };
959
965
  const model = useModel(__props, "modelValue");
960
966
  return (_ctx, _cache) => {
961
967
  return openBlock(), createBlock(FormField_default, {
962
968
  label: __props.label,
963
969
  error: __props.error,
964
970
  hint: __props.hint,
965
- "label-hidden": __props.labelHidden
971
+ "label-hidden": __props.labelHidden,
972
+ size: __props.size
966
973
  }, {
967
974
  default: withCtx(({ id, describedBy, invalid }) => [withDirectives(createElementVNode("input", mergeProps({
968
975
  id,
@@ -970,13 +977,14 @@ var BaseInput_default = /* @__PURE__ */ defineComponent({
970
977
  type: __props.type,
971
978
  "aria-invalid": invalid,
972
979
  "aria-describedby": describedBy
973
- }, _ctx.$attrs, { class: ["border-hair bg-surface text-ink rounded-card focus-visible:outline-primary h-11 border px-3 focus-visible:outline-2 focus-visible:outline-offset-1", invalid ? "border-negative" : ""] }), null, 16, _hoisted_1$19), [[vModelDynamic, model.value]])]),
980
+ }, _ctx.$attrs, { class: ["border-hair bg-surface text-ink rounded-card focus-visible:outline-primary border px-3 focus-visible:outline-2 focus-visible:outline-offset-1", [SIZE_CLASS[__props.size], invalid ? "border-negative" : ""]] }), null, 16, _hoisted_1$19), [[vModelDynamic, model.value]])]),
974
981
  _: 1
975
982
  }, 8, [
976
983
  "label",
977
984
  "error",
978
985
  "hint",
979
- "label-hidden"
986
+ "label-hidden",
987
+ "size"
980
988
  ]);
981
989
  };
982
990
  }
@@ -986,7 +994,7 @@ var BaseInput_default = /* @__PURE__ */ defineComponent({
986
994
  var _hoisted_1$18 = { class: "shell-frame md:rounded-shell relative flex max-h-full flex-col justify-end overflow-hidden" };
987
995
  var _hoisted_2$15 = ["aria-label"];
988
996
  var _hoisted_3$11 = { class: "flex shrink-0 items-start gap-3 px-6 pt-4 pb-5" };
989
- var _hoisted_4$8 = { class: "min-w-0 flex-1" };
997
+ var _hoisted_4$7 = { class: "min-w-0 flex-1" };
990
998
  var _hoisted_5$4 = { class: "text-ink text-xl leading-tight font-semibold" };
991
999
  var _hoisted_6$2 = {
992
1000
  key: 0,
@@ -1080,7 +1088,7 @@ var BaseSheet_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
1080
1088
  class: "flex shrink-0 justify-center pt-3",
1081
1089
  "aria-hidden": "true"
1082
1090
  }, [createElementVNode("span", { class: "bg-hair h-1.5 w-10 rounded-full" })], -1)),
1083
- createElementVNode("header", _hoisted_3$11, [createElementVNode("div", _hoisted_4$8, [createElementVNode("h2", _hoisted_5$4, toDisplayString(__props.title), 1), __props.subtitle ? (openBlock(), createElementBlock("p", _hoisted_6$2, toDisplayString(__props.subtitle), 1)) : createCommentVNode("", true)]), createElementVNode("button", {
1091
+ createElementVNode("header", _hoisted_3$11, [createElementVNode("div", _hoisted_4$7, [createElementVNode("h2", _hoisted_5$4, toDisplayString(__props.title), 1), __props.subtitle ? (openBlock(), createElementBlock("p", _hoisted_6$2, toDisplayString(__props.subtitle), 1)) : createCommentVNode("", true)]), createElementVNode("button", {
1084
1092
  type: "button",
1085
1093
  class: "text-ink-soft hover:bg-muted hover:text-ink -mt-1 flex size-10 shrink-0 items-center justify-center rounded-full transition-colors active:scale-90",
1086
1094
  "aria-label": __props.closeLabel,
@@ -1160,7 +1168,6 @@ var _hoisted_3$9 = [
1160
1168
  "aria-invalid",
1161
1169
  "aria-describedby"
1162
1170
  ];
1163
- var _hoisted_4$7 = { class: "text-ink text-sm" };
1164
1171
  //#endregion
1165
1172
  //#region src/components/BaseCheckbox.vue
1166
1173
  var BaseCheckbox_default = /* @__PURE__ */ defineComponent({
@@ -1172,7 +1179,8 @@ var BaseCheckbox_default = /* @__PURE__ */ defineComponent({
1172
1179
  disabled: {
1173
1180
  type: Boolean,
1174
1181
  default: false
1175
- }
1182
+ },
1183
+ size: { default: "md" }
1176
1184
  }, {
1177
1185
  "modelValue": {
1178
1186
  type: Boolean,
@@ -1193,7 +1201,7 @@ var BaseCheckbox_default = /* @__PURE__ */ defineComponent({
1193
1201
  return (_ctx, _cache) => {
1194
1202
  return openBlock(), createElementBlock("div", _hoisted_1$16, [createElementVNode("label", {
1195
1203
  for: unref(id),
1196
- class: normalizeClass(["flex items-center gap-3", __props.disabled ? "opacity-50" : "cursor-pointer"])
1204
+ class: normalizeClass(["flex items-center", [__props.size === "sm" ? "gap-2" : "gap-3", __props.disabled ? "opacity-50" : "cursor-pointer"]])
1197
1205
  }, [withDirectives(createElementVNode("input", {
1198
1206
  id: unref(id),
1199
1207
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
@@ -1202,7 +1210,7 @@ var BaseCheckbox_default = /* @__PURE__ */ defineComponent({
1202
1210
  "aria-invalid": Boolean(__props.error),
1203
1211
  "aria-describedby": describedBy.value,
1204
1212
  class: "accent-primary focus-visible:outline-primary size-4 shrink-0 focus-visible:outline-2 focus-visible:outline-offset-2"
1205
- }, null, 8, _hoisted_3$9), [[vModelCheckbox, model.value]]), createElementVNode("span", _hoisted_4$7, toDisplayString(__props.label), 1)], 10, _hoisted_2$13), __props.error ? (openBlock(), createElementBlock("p", {
1213
+ }, null, 8, _hoisted_3$9), [[vModelCheckbox, model.value]]), createElementVNode("span", { class: normalizeClass(["text-sm", __props.size === "sm" ? "text-ink-soft" : "text-ink"]) }, toDisplayString(__props.label), 3)], 10, _hoisted_2$13), __props.error ? (openBlock(), createElementBlock("p", {
1206
1214
  key: 0,
1207
1215
  id: errorId,
1208
1216
  class: "text-negative text-xs"
@@ -1309,27 +1317,33 @@ var BaseSelect_default = /* @__PURE__ */ defineComponent({
1309
1317
  type: Boolean,
1310
1318
  default: false
1311
1319
  },
1312
- placeholder: { default: "" }
1320
+ placeholder: { default: "" },
1321
+ size: { default: "md" }
1313
1322
  }, {
1314
1323
  "modelValue": {},
1315
1324
  "modelModifiers": {}
1316
1325
  }),
1317
1326
  emits: ["update:modelValue"],
1318
1327
  setup(__props) {
1328
+ const SIZE_CLASS = {
1329
+ sm: "h-11 text-sm",
1330
+ md: "h-11 text-base"
1331
+ };
1319
1332
  const model = useModel(__props, "modelValue");
1320
1333
  return (_ctx, _cache) => {
1321
1334
  return openBlock(), createBlock(FormField_default, {
1322
1335
  label: __props.label,
1323
1336
  error: __props.error,
1324
1337
  hint: __props.hint,
1325
- "label-hidden": __props.labelHidden
1338
+ "label-hidden": __props.labelHidden,
1339
+ size: __props.size
1326
1340
  }, {
1327
1341
  default: withCtx(({ id, describedBy, invalid }) => [createElementVNode("div", _hoisted_1$14, [withDirectives(createElementVNode("select", {
1328
1342
  id,
1329
1343
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
1330
1344
  "aria-invalid": invalid,
1331
1345
  "aria-describedby": describedBy,
1332
- class: normalizeClass(["border-hair bg-surface text-ink rounded-card focus-visible:outline-primary h-11 w-full appearance-none border py-0 pr-10 pl-3 focus-visible:outline-2 focus-visible:outline-offset-1", invalid ? "border-negative" : ""])
1346
+ class: normalizeClass(["border-hair bg-surface text-ink rounded-card focus-visible:outline-primary w-full appearance-none border py-0 pr-10 pl-3 focus-visible:outline-2 focus-visible:outline-offset-1", [SIZE_CLASS[__props.size], invalid ? "border-negative" : ""]])
1333
1347
  }, [__props.placeholder ? (openBlock(), createElementBlock("option", _hoisted_3$7, toDisplayString(__props.placeholder), 1)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
1334
1348
  return openBlock(), createElementBlock("option", {
1335
1349
  key: option.value,
@@ -1345,7 +1359,8 @@ var BaseSelect_default = /* @__PURE__ */ defineComponent({
1345
1359
  "label",
1346
1360
  "error",
1347
1361
  "hint",
1348
- "label-hidden"
1362
+ "label-hidden",
1363
+ "size"
1349
1364
  ]);
1350
1365
  };
1351
1366
  }
@@ -1371,7 +1386,8 @@ var BaseTextarea_default = /* @__PURE__ */ defineComponent({
1371
1386
  type: Boolean,
1372
1387
  default: false
1373
1388
  },
1374
- rows: { default: 4 }
1389
+ rows: { default: 4 },
1390
+ size: { default: "md" }
1375
1391
  }, {
1376
1392
  "modelValue": {},
1377
1393
  "modelModifiers": {}
@@ -1384,7 +1400,8 @@ var BaseTextarea_default = /* @__PURE__ */ defineComponent({
1384
1400
  label: __props.label,
1385
1401
  error: __props.error,
1386
1402
  hint: __props.hint,
1387
- "label-hidden": __props.labelHidden
1403
+ "label-hidden": __props.labelHidden,
1404
+ size: __props.size
1388
1405
  }, {
1389
1406
  default: withCtx(({ id, describedBy, invalid }) => [withDirectives(createElementVNode("textarea", mergeProps({
1390
1407
  id,
@@ -1392,13 +1409,14 @@ var BaseTextarea_default = /* @__PURE__ */ defineComponent({
1392
1409
  rows: __props.rows,
1393
1410
  "aria-invalid": invalid,
1394
1411
  "aria-describedby": describedBy
1395
- }, _ctx.$attrs, { class: ["border-hair bg-surface text-ink rounded-card focus-visible:outline-primary resize-y border px-3 py-2 leading-relaxed focus-visible:outline-2 focus-visible:outline-offset-1", invalid ? "border-negative" : ""] }), null, 16, _hoisted_1$13), [[vModelText, model.value]])]),
1412
+ }, _ctx.$attrs, { class: ["border-hair bg-surface text-ink rounded-card focus-visible:outline-primary resize-y border px-3 py-2 leading-relaxed focus-visible:outline-2 focus-visible:outline-offset-1", [__props.size === "sm" ? "text-sm" : "text-base", invalid ? "border-negative" : ""]] }), null, 16, _hoisted_1$13), [[vModelText, model.value]])]),
1396
1413
  _: 1
1397
1414
  }, 8, [
1398
1415
  "label",
1399
1416
  "error",
1400
1417
  "hint",
1401
- "label-hidden"
1418
+ "label-hidden",
1419
+ "size"
1402
1420
  ]);
1403
1421
  };
1404
1422
  }
@@ -2124,7 +2142,7 @@ function createI18nRuntime(options) {
2124
2142
  *
2125
2143
  * The fallback keeps `vitest` and `vite dev` honest, where no define runs.
2126
2144
  */
2127
- var VERSION = "0.5.0";
2145
+ var VERSION = "0.5.2";
2128
2146
  //#endregion
2129
2147
  export { AppError, BaseAlert_default as BaseAlert, BaseBadge_default as BaseBadge, BaseButton_default as BaseButton, BaseCard_default as BaseCard, BaseCheckbox_default as BaseCheckbox, BaseInput_default as BaseInput, BaseRadioGroup_default as BaseRadioGroup, BaseSelect_default as BaseSelect, BaseSheet_default as BaseSheet, BaseTextarea_default as BaseTextarea, EmptyState_default as EmptyState, ErrorBoundary_default as ErrorBoundary, FormField_default as FormField, GoogleButton_default as GoogleButton, LocaleLinks_default as LocaleLinks, PageContainer_default as PageContainer, PageHeader_default as PageHeader, PriceCard_default as PriceCard, ProgressBar_default as ProgressBar, SectionHeading_default as SectionHeading, SegmentedControl_default as SegmentedControl, SettingsGroup_default as SettingsGroup, SettingsRow_default as SettingsRow, SkeletonList_default as SkeletonList, StatCard_default as StatCard, TabBar_default as TabBar, ToneDot_default as ToneDot, VERSION, addDays, applyTheme, createI18nRuntime, downloadJson, eachDayOfYear, formatDate, fromDateKey, isApplePortable, isInstalled, isThemePreference, lastNDays, leadingBlanks, needsIosInstall, readStoredTheme, registerErrorMapper, relativeDayLabel, safeRedirect, setFormatLocale, setThemeStorageKey, startOfWeek, tapFeedback, toAppError, toDateKey, todayKey, useDebouncedCallback, useDragScroll, useMediaQuery, useOnline, useTheme, useToday, useVisualViewport };
2130
2148