rei-kit 2.3.1 → 2.4.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.
@@ -1,52 +1,55 @@
1
- type __VLS_Props = {
2
- label: string;
3
- error?: string | undefined;
4
- hint?: string | undefined;
5
- /**
6
- * Hides the label visually but keeps it for assistive tech. For fields whose
7
- * surrounding row already names them — dropping the label entirely would
8
- * leave the input with no accessible name at all.
9
- */
10
- labelHidden?: boolean | undefined;
11
- /**
12
- * Every type a text field can be, because the ones missing were the ones
13
- * apps needed: `date` and `search` were hand-written three times each and
14
- * `url` twice, in files that already imported this component.
15
- */
16
- type?: 'text' | 'email' | 'password' | 'number' | 'search' | 'tel' | 'url' | 'date' | 'time' | 'datetime-local' | undefined;
17
- /** `sm` for a field inside a row rather than in a form of its own. */
18
- size?: 'sm' | 'md' | undefined;
19
- /**
20
- * `unstyled` keeps the wiring and drops the surface.
21
- *
22
- * The label, the generated id, `aria-describedby` and the error are what a
23
- * field is; the border and the height are what it looks like. A search box
24
- * inside a bordered row, a url field in an editor popover — those places
25
- * were hand-writing the whole thing to avoid the appearance, and losing the
26
- * wiring with it.
27
- *
28
- * The same reasoning as `BaseButton`'s `unstyled`, and the same test: a
29
- * primitive is finished when the app can take its behaviour without its
30
- * paint.
31
- */
32
- variant?: 'default' | 'unstyled' | undefined;
1
+ import { InputHTMLAttributes } from 'vue';
2
+ declare const __VLS_export: <T extends string | number | undefined = string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: import('vue').PublicProps & __VLS_PrettifyLocal<({
4
+ /** The value, with `v-model`. Its type is whatever you bind. */
5
+ modelValue?: T | undefined;
6
+ label: string;
7
+ error?: string | undefined;
8
+ hint?: string | undefined;
9
+ /**
10
+ * Hides the label visually but keeps it for assistive tech. For fields whose
11
+ * surrounding row already names them — dropping the label entirely would
12
+ * leave the input with no accessible name at all.
13
+ */
14
+ labelHidden?: boolean | undefined;
15
+ /**
16
+ * Every type a text field can be, because the ones missing were the ones
17
+ * apps needed: `date` and `search` were hand-written three times each and
18
+ * `url` twice, in files that already imported this component.
19
+ */
20
+ type?: "text" | "email" | "password" | "number" | "search" | "tel" | "url" | "date" | "time" | "datetime-local" | undefined;
21
+ /** `sm` for a field inside a row rather than in a form of its own. */
22
+ size?: "sm" | "md" | undefined;
23
+ /**
24
+ * `unstyled` keeps the wiring and drops the surface.
25
+ *
26
+ * The label, the generated id, `aria-describedby` and the error are what a
27
+ * field is; the border and the height are what it looks like. A search box
28
+ * inside a bordered row, a url field in an editor popover — those places
29
+ * were hand-writing the whole thing to avoid the appearance, and losing the
30
+ * wiring with it.
31
+ *
32
+ * The same reasoning as `BaseButton`'s `unstyled`, and the same test: a
33
+ * primitive is finished when the app can take its behaviour without its
34
+ * paint.
35
+ */
36
+ variant?: "default" | "unstyled" | undefined;
37
+ } & Omit<InputHTMLAttributes, "type" | "size">) & {
38
+ "onUpdate:modelValue"?: (value: T) => any;
39
+ }> & (typeof globalThis extends {
40
+ __VLS_PROPS_FALLBACK: infer P;
41
+ } ? P : {});
42
+ expose: (exposed: {}) => void;
43
+ attrs: any;
44
+ slots: {};
45
+ emit: (evt: "update:modelValue", value: T) => void;
46
+ }>) => import('vue').VNode & {
47
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
33
48
  };
34
- type __VLS_ModelProps = {
35
- /**
36
- * A number field's value is a number.
37
- *
38
- * Typed to `string` alone, `type="number"` forced the caller to keep a string
39
- * ref and convert on both sides of it — and a component you have to wrap in
40
- * order to use is one you write yourself instead, which is exactly what the
41
- * first numeric field tried to reach for it did.
42
- */
43
- modelValue?: string | number | undefined;
44
- };
45
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
46
- declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
47
- "update:modelValue": (value: string | number | undefined) => any;
48
- }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
49
- "onUpdate:modelValue"?: (value: string | number | undefined) => any;
50
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
51
49
  declare const _default: typeof __VLS_export;
52
50
  export default _default;
51
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
52
+ [K in keyof T]: T[K];
53
+ } : {
54
+ [K in keyof T as K]: T[K];
55
+ }) & {};
@@ -10,6 +10,8 @@
10
10
  * are options for.
11
11
  */
12
12
  type __VLS_Props = {
13
+ /** The chosen option's value, with `v-model`. */
14
+ modelValue?: string | undefined;
13
15
  legend: string;
14
16
  options: readonly {
15
17
  value: string;
@@ -20,14 +22,10 @@ type __VLS_Props = {
20
22
  hint?: string | undefined;
21
23
  legendHidden?: boolean | undefined;
22
24
  };
23
- type __VLS_ModelProps = {
24
- modelValue?: string | undefined;
25
- };
26
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
27
- declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
28
- "update:modelValue": (value: string | undefined) => any;
29
- }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
30
- "onUpdate:modelValue"?: (value: string | undefined) => any;
25
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
26
+ "update:modelValue": (value: string) => any;
27
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
28
+ "onUpdate:modelValue"?: (value: string) => any;
31
29
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
32
30
  declare const _default: typeof __VLS_export;
33
31
  export default _default;
@@ -1,4 +1,6 @@
1
1
  type __VLS_Props = {
2
+ /** The text, with `v-model`. */
3
+ modelValue?: string | undefined;
2
4
  label: string;
3
5
  error?: string | undefined;
4
6
  hint?: string | undefined;
@@ -26,14 +28,10 @@ type __VLS_Props = {
26
28
  */
27
29
  variant?: 'default' | 'unstyled' | undefined;
28
30
  };
29
- type __VLS_ModelProps = {
30
- modelValue?: string | undefined;
31
- };
32
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
33
- declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
34
- "update:modelValue": (value: string | undefined) => any;
35
- }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
36
- "onUpdate:modelValue"?: (value: string | undefined) => any;
31
+ declare const __VLS_export: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
32
+ "update:modelValue": (value: string) => any;
33
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
34
+ "onUpdate:modelValue"?: (value: string) => any;
37
35
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
38
36
  declare const _default: typeof __VLS_export;
39
37
  export default _default;
@@ -0,0 +1,20 @@
1
+ import { WritableComputedRef } from 'vue';
2
+ /**
3
+ * A `v-model` that accepts `undefined` and emits only what a field produces.
4
+ *
5
+ * `defineModel` could not be typed both ways. Without a default it declares
6
+ * that it may emit `undefined`, so under vue-tsc's strictTemplates a
7
+ * `ref('')` cannot be bound to it. With a default it drops `undefined` from
8
+ * what it accepts, so under `exactOptionalPropertyTypes` a form library's
9
+ * `string | undefined` cannot be. Hibi binds exactly that, and 2.4.0 as first
10
+ * written broke it — the consumer check caught it before the tag.
11
+ *
12
+ * So the prop and the event are declared by hand — the prop as
13
+ * `T | undefined`, the event as `T` — and this is the rest of what
14
+ * `defineModel` did: follow the prop, and keep a value of its own when
15
+ * nothing is bound. Vue applies `.trim` and `.number` to the event itself, so
16
+ * modifiers behave as they did.
17
+ *
18
+ * Internal: not exported from the package.
19
+ */
20
+ export declare function useBoundValue<T>(read: () => T | undefined, write: (value: T) => void): WritableComputedRef<T | undefined>;
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { a as addDays, c as lastNDays, d as toDateKey, f as todayKey, i as needsIosInstall, l as leadingBlanks, n as isApplePortable, o as eachDayOfYear, r as isInstalled, s as fromDateKey, t as SettingsGroup_default, u as startOfWeek } from "./SettingsGroup-BXkajKGl.js";
2
2
  import { n as formatNumber, r as setFormatLocale, t as formatDate } from "./format-BEvBK1SJ.js";
3
- import { _ as toRedirectPath, a as FormField_default, c as useVisualViewport, d as isThemePreference, f as readStoredTheme, g as safeRedirect, h as tapFeedback, i as BaseInput_default, l as useOnline, m as useTheme, n as BaseCheckbox_default, o as BaseAlert_default, p as setThemeStorageKey, r as BaseSheet_default, s as useToast, t as GoogleButton_default, u as applyTheme, v as SHEET_ROOT_ID, y as ensureSheetRoot } from "./GoogleButton-D82EoXSQ.js";
3
+ import { _ as safeRedirect, a as useBoundValue, b as ensureSheetRoot, c as useToast, d as applyTheme, f as isThemePreference, g as tapFeedback, h as useTheme, i as BaseInput_default, l as useVisualViewport, m as setThemeStorageKey, n as BaseCheckbox_default, o as FormField_default, p as readStoredTheme, r as BaseSheet_default, s as BaseAlert_default, t as GoogleButton_default, u as useOnline, v as toRedirectPath, y as SHEET_ROOT_ID } from "./GoogleButton-tEyI7znu.js";
4
4
  import { n as registerErrorMapper, r as toAppError, t as AppError } from "./app-error-DF9cijE0.js";
5
5
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BOaGB7Aw.js";
6
6
  import { n as BaseButton_default, t as SettingsRow_default } from "./SettingsRow-BXFn8tCk.js";
7
- import { Fragment, Teleport, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onErrorCaptured, onMounted, onScopeDispose, openBlock, readonly, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, useId, useModel, vModelRadio, vModelSelect, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withModifiers } from "vue";
7
+ import { Fragment, Teleport, TransitionGroup, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, isRef, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onErrorCaptured, onMounted, onScopeDispose, openBlock, readonly, ref, renderList, renderSlot, resolveDynamicComponent, toDisplayString, unref, useId, useModel, vModelRadio, vModelSelect, vModelText, vShow, watch, watchEffect, withCtx, withDirectives, withModifiers } from "vue";
8
8
  import { ArrowDown, ArrowRight, ArrowUp, CheckCircle2, ChevronDown, Info, TriangleAlert, X, XCircle } from "lucide-vue-next";
9
9
  import { RouterLink } from "vue-router";
10
10
  import { createI18n } from "vue-i18n";
@@ -866,7 +866,8 @@ var _hoisted_3$9 = { class: "text-ink text-sm" };
866
866
  //#region src/components/BaseRadioGroup.vue
867
867
  var BaseRadioGroup_default = /* @__PURE__ */ defineComponent({
868
868
  __name: "BaseRadioGroup",
869
- props: /*@__PURE__*/ mergeModels({
869
+ props: {
870
+ modelValue: { default: () => void 0 },
870
871
  legend: {},
871
872
  options: {},
872
873
  error: { default: "" },
@@ -875,13 +876,11 @@ var BaseRadioGroup_default = /* @__PURE__ */ defineComponent({
875
876
  type: Boolean,
876
877
  default: false
877
878
  }
878
- }, {
879
- "modelValue": {},
880
- "modelModifiers": {}
881
- }),
879
+ },
882
880
  emits: ["update:modelValue"],
883
- setup(__props) {
884
- const model = useModel(__props, "modelValue");
881
+ setup(__props, { emit: __emit }) {
882
+ const emit = __emit;
883
+ const model = useBoundValue(() => __props.modelValue, (value) => emit("update:modelValue", value));
885
884
  const id = useId();
886
885
  const errorId = `${id}-error`;
887
886
  const hintId = `${id}-hint`;
@@ -900,13 +899,13 @@ var BaseRadioGroup_default = /* @__PURE__ */ defineComponent({
900
899
  key: option.value,
901
900
  class: normalizeClass(["flex items-center gap-3", option.disabled ? "opacity-50" : "cursor-pointer"])
902
901
  }, [withDirectives(createElementVNode("input", {
903
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
902
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
904
903
  type: "radio",
905
904
  name: unref(id),
906
905
  value: option.value,
907
906
  disabled: option.disabled,
908
907
  class: "accent-primary focus-visible:outline-primary size-4 shrink-0 focus-visible:outline-2 focus-visible:outline-offset-2"
909
- }, null, 8, _hoisted_2$15), [[vModelRadio, model.value]]), createElementVNode("span", _hoisted_3$9, toDisplayString(option.label), 1)], 2);
908
+ }, null, 8, _hoisted_2$15), [[vModelRadio, unref(model)]]), createElementVNode("span", _hoisted_3$9, toDisplayString(option.label), 1)], 2);
910
909
  }), 128)),
911
910
  __props.error ? (openBlock(), createElementBlock("p", {
912
911
  key: 0,
@@ -1272,7 +1271,8 @@ var _hoisted_1$12 = [
1272
1271
  var BaseTextarea_default = /* @__PURE__ */ defineComponent({
1273
1272
  inheritAttrs: false,
1274
1273
  __name: "BaseTextarea",
1275
- props: /*@__PURE__*/ mergeModels({
1274
+ props: {
1275
+ modelValue: { default: () => void 0 },
1276
1276
  label: {},
1277
1277
  error: { default: "" },
1278
1278
  hint: { default: "" },
@@ -1283,13 +1283,11 @@ var BaseTextarea_default = /* @__PURE__ */ defineComponent({
1283
1283
  rows: { default: 4 },
1284
1284
  size: { default: "md" },
1285
1285
  variant: { default: "default" }
1286
- }, {
1287
- "modelValue": {},
1288
- "modelModifiers": {}
1289
- }),
1286
+ },
1290
1287
  emits: ["update:modelValue"],
1291
- setup(__props) {
1292
- const model = useModel(__props, "modelValue");
1288
+ setup(__props, { emit: __emit }) {
1289
+ const emit = __emit;
1290
+ const model = useBoundValue(() => __props.modelValue, (value) => emit("update:modelValue", value));
1293
1291
  return (_ctx, _cache) => {
1294
1292
  return openBlock(), createBlock(FormField_default, {
1295
1293
  label: __props.label,
@@ -1300,7 +1298,7 @@ var BaseTextarea_default = /* @__PURE__ */ defineComponent({
1300
1298
  }, {
1301
1299
  default: withCtx(({ id, describedBy, invalid }) => [withDirectives(createElementVNode("textarea", mergeProps({
1302
1300
  id,
1303
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
1301
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
1304
1302
  rows: __props.rows,
1305
1303
  "aria-invalid": invalid,
1306
1304
  "aria-describedby": describedBy
@@ -1308,7 +1306,7 @@ var BaseTextarea_default = /* @__PURE__ */ defineComponent({
1308
1306
  __props.variant === "unstyled" ? "" : "control text-ink rounded-card focus-visible:outline-primary resize-y px-3 py-2 leading-relaxed focus-visible:outline-2 focus-visible:outline-offset-1",
1309
1307
  "text-base",
1310
1308
  __props.variant !== "unstyled" && invalid ? "border-negative" : ""
1311
- ] }), null, 16, _hoisted_1$12), [[vModelText, model.value]])]),
1309
+ ] }), null, 16, _hoisted_1$12), [[vModelText, unref(model)]])]),
1312
1310
  _: 1
1313
1311
  }, 8, [
1314
1312
  "label",
@@ -2056,7 +2054,7 @@ function createI18nRuntime(options) {
2056
2054
  *
2057
2055
  * The fallback keeps `vitest` and `vite dev` honest, where no define runs.
2058
2056
  */
2059
- var VERSION = "2.3.1";
2057
+ var VERSION = "2.4.0";
2060
2058
  //#endregion
2061
2059
  export { AppError, BaseAlert_default as BaseAlert, BaseAvatar_default as BaseAvatar, BaseBadge_default as BaseBadge, BaseButton_default as BaseButton, BaseCard_default as BaseCard, BaseCheckbox_default as BaseCheckbox, BaseCombobox_default as BaseCombobox, BaseInput_default as BaseInput, BaseMenu_default as BaseMenu, BaseRadioGroup_default as BaseRadioGroup, BaseSelect_default as BaseSelect, BaseSheet_default as BaseSheet, BaseSlider_default as BaseSlider, BaseSpinner_default as BaseSpinner, BaseSwitch_default as BaseSwitch, BaseTable_default as BaseTable, BaseTextarea_default as BaseTextarea, EmptyState_default as EmptyState, ErrorBoundary_default as ErrorBoundary, FormField_default as FormField, GoogleButton_default as GoogleButton, LocaleLinks_default as LocaleLinks, MATERIALS, PALETTES, PageContainer_default as PageContainer, PageHeader_default as PageHeader, PriceCard_default as PriceCard, ProgressBar_default as ProgressBar, SHEET_ROOT_ID, 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, ToastHost_default as ToastHost, ToneDot_default as ToneDot, VERSION, addDays, applyMaterial, applyPalette, applyTheme, createI18nRuntime, downloadJson, eachDayOfYear, ensureSheetRoot, formatDate, formatNumber, fromDateKey, isApplePortable, isInstalled, isMaterial, isPaletteName, isThemePreference, lastNDays, leadingBlanks, needsIosInstall, readStoredTheme, registerErrorMapper, relativeDayLabel, safeRedirect, setFormatLocale, setMaterialStorageKey, setPaletteStorageKey, setThemeStorageKey, startOfWeek, tapFeedback, toAppError, toDateKey, toRedirectPath, todayKey, useDebouncedCallback, useDragScroll, useMaterial, useMediaQuery, useOnline, usePalette, useTheme, useToast, useToday, useVisualViewport };
2062
2060