@bridge-ui/vue 0.0.3 → 0.0.5

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.
Files changed (31) hide show
  1. package/dist/Components/Checkbox/Checkbox.vue.d.ts +3 -3
  2. package/dist/Components/Checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js +23 -22
  3. package/dist/Components/Checkbox/checkbox.types.d.ts +7 -6
  4. package/dist/Components/Checkbox/composables/useCheckbox.d.ts +1 -1
  5. package/dist/Components/Checkbox/composables/useCheckbox.js +2 -1
  6. package/dist/Components/NumberField/NumberField.vue_vue_type_script_setup_true_lang.js +37 -30
  7. package/dist/Components/NumberField/composables/useNumberField.js +2 -2
  8. package/dist/Components/NumberField/numberField.types.d.ts +7 -0
  9. package/dist/Components/PasswordField/PasswordField.vue_vue_type_script_setup_true_lang.js +24 -17
  10. package/dist/Components/PasswordField/composables/usePasswordField.js +2 -2
  11. package/dist/Components/PasswordField/passwordField.types.d.ts +7 -0
  12. package/dist/Components/Radio/Radio.vue_vue_type_script_setup_true_lang.js +15 -15
  13. package/dist/Components/Radio/composables/useRadio.d.ts +1 -1
  14. package/dist/Components/Radio/composables/useRadio.js +2 -1
  15. package/dist/Components/Radio/radio.types.d.ts +7 -6
  16. package/dist/Components/Select/Select.vue_vue_type_script_setup_true_lang.js +60 -54
  17. package/dist/Components/Select/select.types.d.ts +4 -1
  18. package/dist/Components/Snackbar/snackbar.types.d.ts +1 -1
  19. package/dist/Components/Switch/Switch.vue.d.ts +3 -3
  20. package/dist/Components/Switch/Switch.vue_vue_type_script_setup_true_lang.js +19 -18
  21. package/dist/Components/Switch/composables/useSwitch.d.ts +1 -1
  22. package/dist/Components/Switch/composables/useSwitch.js +2 -1
  23. package/dist/Components/Switch/switch.types.d.ts +7 -6
  24. package/dist/Components/TextField/TextField.vue_vue_type_script_setup_true_lang.js +15 -8
  25. package/dist/Components/TextField/composables/useTextField.js +7 -4
  26. package/dist/Components/TextField/textField.types.d.ts +9 -1
  27. package/dist/Components/Textarea/Textarea.vue_vue_type_script_setup_true_lang.js +19 -12
  28. package/dist/Components/Textarea/composables/useTextarea.js +2 -1
  29. package/dist/Components/Textarea/textarea.types.d.ts +7 -0
  30. package/dist/theme.css +12 -12
  31. package/package.json +2 -2
@@ -2,13 +2,13 @@ import { CheckboxOwnProps, CheckboxSlots } from './checkbox.types';
2
2
  type __VLS_Slots = CheckboxSlots;
3
3
  type __VLS_Props = CheckboxOwnProps;
4
4
  type __VLS_ModelProps = {
5
- modelValue?: boolean;
5
+ modelValue?: boolean | undefined;
6
6
  };
7
7
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
8
  declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
- "update:modelValue": (value: boolean) => any;
9
+ "update:modelValue": (value: boolean | undefined) => any;
10
10
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
11
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
11
+ "onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
12
12
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
14
  declare const _default: typeof __VLS_export;
@@ -1,20 +1,20 @@
1
1
  import e from "../FormControl/FormControl.js";
2
2
  import { useCheckbox as t } from "./composables/useCheckbox.js";
3
- import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, guardReactiveProps as c, mergeModels as l, mergeProps as u, normalizeClass as d, normalizeProps as f, openBlock as p, unref as m, useAttrs as h, useModel as g, withCtx as _ } from "vue";
4
- import { cn as v } from "@bridge-ui/core";
5
- import { Check as y } from "@lucide/vue";
3
+ import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, defineComponent as s, guardReactiveProps as c, mergeModels as l, mergeProps as u, normalizeClass as d, normalizeProps as f, openBlock as p, ref as m, unref as h, useAttrs as g, useModel as _, withCtx as v } from "vue";
4
+ import { cn as y } from "@bridge-ui/core";
5
+ import { Check as b } from "@lucide/vue";
6
6
  //#region src/Components/Checkbox/Checkbox.vue?vue&type=script&setup=true&lang.ts
7
- var b = ["for"], x = ["checked"], S = {
7
+ var x = ["for"], S = ["checked"], C = {
8
8
  key: 1,
9
9
  class: "block h-0.5 w-[55%] rounded-full bg-white"
10
- }, C = /* @__PURE__ */ s({
10
+ }, w = /* @__PURE__ */ s({
11
11
  inheritAttrs: !1,
12
12
  __name: "Checkbox",
13
13
  props: /* @__PURE__ */ l({
14
- checked: { type: Boolean },
15
14
  classes: {},
16
15
  color: {},
17
16
  customProps: {},
17
+ defaultChecked: { type: Boolean },
18
18
  indeterminate: { type: Boolean },
19
19
  rounded: {},
20
20
  size: {},
@@ -32,38 +32,39 @@ var b = ["for"], x = ["checked"], S = {
32
32
  }, {
33
33
  modelValue: {
34
34
  type: Boolean,
35
- default: !1
35
+ default: void 0
36
36
  },
37
37
  modelModifiers: {}
38
38
  }),
39
39
  emits: ["update:modelValue"],
40
40
  setup(s) {
41
- let l = h(), C = s, w = g(s, "modelValue"), { merged: T, iconBind: E, inputRef: D, fieldBind: O, inputBind: k, isChecked: A, formControl: j, controlBind: M } = t(() => ({
41
+ let l = g(), w = s, T = m(!!w.defaultChecked), E = _(s, "modelValue"), { merged: D, iconBind: O, inputRef: k, fieldBind: A, inputBind: j, isChecked: M, formControl: N, controlBind: P } = t(() => ({
42
42
  ...l,
43
- ...C
43
+ ...w
44
44
  }), {
45
45
  size: "md",
46
46
  rounded: "sm",
47
47
  color: "primary"
48
- }, n(() => w.value));
49
- function N(e) {
50
- w.value = e.target.checked;
48
+ }, n(() => E.value ?? T.value));
49
+ function F(e) {
50
+ let t = e.target;
51
+ E.value = t.checked, T.value = t.checked;
51
52
  }
52
- return (t, n) => (p(), r(m(e), { field: m(j) }, {
53
- default: _(() => [o("label", u(m(O), { for: m(j).controlId.value }), [o("input", u({
53
+ return (t, n) => (p(), r(h(e), { field: h(N) }, {
54
+ default: v(() => [o("label", u(h(A), { for: h(N).controlId.value }), [o("input", u({
54
55
  ref_key: "inputRef",
55
- ref: D
56
- }, m(k), {
57
- checked: m(A),
58
- onChange: N
59
- }), null, 16, x), o("span", f(c(m(M))), [m(A) && !m(T).indeterminate ? (p(), r(m(y), {
56
+ ref: k
57
+ }, h(j), {
58
+ checked: h(M),
59
+ onChange: F
60
+ }), null, 16, S), o("span", f(c(h(P))), [h(M) && !h(D).indeterminate ? (p(), r(h(b), {
60
61
  key: 0,
61
62
  "stroke-width": 3,
62
- class: d(m(v)("h-[65%] w-[65%]", m(E).class))
63
- }, null, 8, ["class"])) : m(T).indeterminate ? (p(), a("span", S)) : i("", !0)], 16)], 16, b)]),
63
+ class: d(h(y)("h-[65%] w-[65%]", h(O).class))
64
+ }, null, 8, ["class"])) : h(D).indeterminate ? (p(), a("span", C)) : i("", !0)], 16)], 16, x)]),
64
65
  _: 1
65
66
  }, 8, ["field"]));
66
67
  }
67
68
  });
68
69
  //#endregion
69
- export { C as default };
70
+ export { w as default };
@@ -39,12 +39,6 @@ export interface CheckboxEmits {
39
39
  "update:modelValue": [value: boolean];
40
40
  }
41
41
  export interface CheckboxOwnProps extends Omit<FormControlOwnProps, "field" | "slots" | "classes" | "customProps"> {
42
- /**
43
- * Whether the checkbox is checked.
44
- *
45
- * @default undefined
46
- */
47
- checked?: boolean;
48
42
  /**
49
43
  * Classes for the form control chrome and the checkbox control.
50
44
  *
@@ -63,6 +57,13 @@ export interface CheckboxOwnProps extends Omit<FormControlOwnProps, "field" | "s
63
57
  * @default undefined
64
58
  */
65
59
  customProps?: CheckboxCustomProps;
60
+ /**
61
+ * Initial checked state for uncontrolled usage (when `v-model` /
62
+ * `modelValue` is not bound).
63
+ *
64
+ * @default false
65
+ */
66
+ defaultChecked?: boolean;
66
67
  /**
67
68
  * Whether the checkbox is in an indeterminate state.
68
69
  *
@@ -229,7 +229,7 @@ export declare function useCheckbox(props: MaybeRefOrGetter<CheckboxOwnProps>, l
229
229
  onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
230
230
  onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
231
231
  onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
232
- }, Partial<Omit<CheckboxOwnProps, "color" | "size" | "classes" | "customProps" | "rounded" | "indeterminate">>>>;
232
+ }, Partial<Omit<CheckboxOwnProps, "color" | "size" | "classes" | "customProps" | "rounded" | "indeterminate" | "defaultChecked">>>>;
233
233
  isChecked: import('vue').ComputedRef<boolean>;
234
234
  formControl: {
235
235
  slots: Readonly<{
@@ -11,7 +11,8 @@ var v = [
11
11
  "classes",
12
12
  "rounded",
13
13
  "customProps",
14
- "indeterminate"
14
+ "indeterminate",
15
+ "defaultChecked"
15
16
  ];
16
17
  function y(y, b, x) {
17
18
  let S = s(), C = a(null), w = r(() => ({
@@ -3,16 +3,18 @@ import { mergePartBind as t, resolveFieldAdornmentIconSize as n } from "../../Ut
3
3
  import r from "../Icon/Icon.js";
4
4
  import i from "../FormField/FormField.js";
5
5
  import { useNumberField as a } from "./composables/useNumberField.js";
6
- import { computed as o, createBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, guardReactiveProps as d, isRef as f, mergeModels as p, mergeProps as m, normalizeProps as h, openBlock as g, unref as _, useModel as v, vModelDynamic as y, withCtx as b, withDirectives as x } from "vue";
7
- import { cn as S } from "@bridge-ui/core";
8
- import { ChevronDown as C, ChevronUp as w } from "@lucide/vue";
6
+ import { computed as o, createBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, guardReactiveProps as d, isRef as f, mergeModels as p, mergeProps as m, normalizeProps as h, openBlock as g, ref as _, unref as v, useModel as y, vModelDynamic as b, withCtx as x, withDirectives as S } from "vue";
7
+ import { isUndefined as C } from "es-toolkit/compat";
8
+ import { cn as w } from "@bridge-ui/core";
9
+ import { ChevronDown as T, ChevronUp as E } from "@lucide/vue";
9
10
  //#region src/Components/NumberField/NumberField.vue?vue&type=script&setup=true&lang.ts
10
- var T = { class: "bridge-end-adornment flex h-full min-w-9 flex-col gap-px overflow-hidden" }, E = /* @__PURE__ */ u({
11
+ var D = { class: "bridge-end-adornment flex h-full min-w-9 flex-col gap-px overflow-hidden" }, O = /* @__PURE__ */ u({
11
12
  inheritAttrs: !1,
12
13
  __name: "NumberField",
13
14
  props: /* @__PURE__ */ p({
14
15
  classes: {},
15
16
  customProps: {},
17
+ defaultValue: {},
16
18
  max: {},
17
19
  min: {},
18
20
  step: { default: 1 },
@@ -41,41 +43,46 @@ var T = { class: "bridge-end-adornment flex h-full min-w-9 flex-col gap-px overf
41
43
  }),
42
44
  emits: /* @__PURE__ */ p(["change", "update:modelValue"], ["update:modelValue"]),
43
45
  setup(u, { emit: p }) {
44
- let E = p, D = v(u, "modelValue"), O = u, { decrement: k, formField: A, increment: j, inputBind: M, stringModel: N, mergedClasses: P } = a(O, D, { onChange: (e) => E("change", e) }), F = e(() => j(), () => ({ disabled: O.disabled })), I = e(() => k(), () => ({ disabled: O.disabled })), L = o(() => n(O.size)), R = o(() => t(O.customProps?.increment, {
46
+ let O = p, k = y(u, "modelValue"), A = u, j = _(A.defaultValue), { decrement: M, formField: N, increment: P, inputBind: F, stringModel: I, mergedClasses: L } = a(A, o({
47
+ set: (e) => {
48
+ k.value = e, j.value = e;
49
+ },
50
+ get: () => C(k.value) ? j.value : k.value
51
+ }), { onChange: (e) => O("change", e) }), R = e(() => P(), () => ({ disabled: A.disabled })), z = e(() => M(), () => ({ disabled: A.disabled })), B = o(() => n(A.size)), V = o(() => t(A.customProps?.increment, {
45
52
  type: "button",
46
- disabled: O.disabled,
53
+ disabled: A.disabled,
47
54
  "aria-label": "Increment value",
48
- onClick: F.onPressClick,
49
- onPointerup: F.onPressPointerUp,
50
- onPointerdown: F.onPressPointerDown,
51
- onLostpointercapture: F.onPressLostPointerCapture
52
- }, S({
55
+ onClick: R.onPressClick,
56
+ onPointerup: R.onPressPointerUp,
57
+ onPointerdown: R.onPressPointerDown,
58
+ onLostpointercapture: R.onPressLostPointerCapture
59
+ }, w({
53
60
  "bridge-field-adornment-button inline-flex min-h-0 min-w-8 flex-1 items-center justify-center": !0,
54
- [P.value.increment ?? ""]: !0
55
- }))), z = o(() => t(O.customProps?.decrement, {
61
+ [L.value.increment ?? ""]: !0
62
+ }))), H = o(() => t(A.customProps?.decrement, {
56
63
  type: "button",
57
- disabled: O.disabled,
64
+ disabled: A.disabled,
58
65
  "aria-label": "Decrement value",
59
- onClick: I.onPressClick,
60
- onPointerup: I.onPressPointerUp,
61
- onPointerdown: I.onPressPointerDown,
62
- onLostpointercapture: I.onPressLostPointerCapture
63
- }, S({
66
+ onClick: z.onPressClick,
67
+ onPointerup: z.onPressPointerUp,
68
+ onPointerdown: z.onPressPointerDown,
69
+ onLostpointercapture: z.onPressLostPointerCapture
70
+ }, w({
64
71
  "bridge-field-adornment-button inline-flex min-h-0 min-w-8 flex-1 items-center justify-center": !0,
65
- [P.value.decrement ?? ""]: !0
72
+ [L.value.decrement ?? ""]: !0
66
73
  })));
67
- return (e, t) => (g(), s(_(i), { field: _(A) }, {
68
- end: b(() => [c("div", T, [c("button", h(d(R.value)), [l(_(r), m({
69
- icon: _(w),
70
- size: L.value
71
- }, O.customProps?.incrementIcon), null, 16, ["icon", "size"])], 16), c("button", h(d(z.value)), [l(_(r), m({
72
- icon: _(C),
73
- size: L.value
74
- }, O.customProps?.decrementIcon), null, 16, ["icon", "size"])], 16)])]),
75
- default: b(() => [x(c("input", m({ "onUpdate:modelValue": t[0] ||= (e) => f(N) ? N.value = e : null }, _(M)), null, 16), [[y, _(N)]])]),
74
+ return (e, t) => (g(), s(v(i), { field: v(N) }, {
75
+ end: x(() => [c("div", D, [c("button", h(d(V.value)), [l(v(r), m({
76
+ icon: v(E),
77
+ size: B.value
78
+ }, A.customProps?.incrementIcon), null, 16, ["icon", "size"])], 16), c("button", h(d(H.value)), [l(v(r), m({
79
+ icon: v(T),
80
+ size: B.value
81
+ }, A.customProps?.decrementIcon), null, 16, ["icon", "size"])], 16)])]),
82
+ default: x(() => [S(c("input", m({ "onUpdate:modelValue": t[0] ||= (e) => f(I) ? I.value = e : null }, v(F)), null, 16), [[b, v(I)]])]),
76
83
  _: 1
77
84
  }, 8, ["field"]));
78
85
  }
79
86
  });
80
87
  //#endregion
81
- export { E as default };
88
+ export { O as default };
@@ -12,10 +12,10 @@ function c(c, l, u = {}) {
12
12
  entry: p,
13
13
  props: () => ({ classes: c.classes })
14
14
  }), h = r(() => {
15
- let { min: e, max: t, step: n, classes: r, ...i } = c;
15
+ let { min: e, max: t, step: n, classes: r, defaultValue: i, ...a } = c;
16
16
  return {
17
17
  ...d,
18
- ...i,
18
+ ...a,
19
19
  withErrorIcon: !1,
20
20
  classes: m.value
21
21
  };
@@ -60,6 +60,13 @@ export interface NumberFieldOwnProps extends Omit<FormFieldOwnProps, "field" | "
60
60
  * @default undefined
61
61
  */
62
62
  customProps?: NumberFieldCustomProps;
63
+ /**
64
+ * Initial value for uncontrolled usage (when `v-model` / `modelValue` is
65
+ * not bound).
66
+ *
67
+ * @default undefined
68
+ */
69
+ defaultValue?: number;
63
70
  /**
64
71
  * The maximum value.
65
72
  */
@@ -2,16 +2,18 @@ import { mergePartBind as e, resolveFieldAdornmentIconSize as t } from "../../Ut
2
2
  import n from "../Icon/Icon.js";
3
3
  import r from "../FormField/FormField.js";
4
4
  import { usePasswordField as i } from "./composables/usePasswordField.js";
5
- import { computed as a, createBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, guardReactiveProps as u, mergeModels as d, mergeProps as f, normalizeProps as p, openBlock as m, unref as h, useModel as g, vModelDynamic as _, withCtx as v, withDirectives as y } from "vue";
6
- import { cn as b } from "@bridge-ui/core";
7
- import { Eye as x, EyeOff as S } from "@lucide/vue";
5
+ import { computed as a, createBlock as o, createElementVNode as s, createVNode as c, defineComponent as l, guardReactiveProps as u, mergeModels as d, mergeProps as f, normalizeProps as p, openBlock as m, ref as h, unref as g, useModel as _, vModelDynamic as v, withCtx as y, withDirectives as b } from "vue";
6
+ import { isUndefined as x } from "es-toolkit/compat";
7
+ import { cn as S } from "@bridge-ui/core";
8
+ import { Eye as C, EyeOff as w } from "@lucide/vue";
8
9
  //#region src/Components/PasswordField/PasswordField.vue?vue&type=script&setup=true&lang.ts
9
- var C = /* @__PURE__ */ l({
10
+ var T = /* @__PURE__ */ l({
10
11
  inheritAttrs: !1,
11
12
  __name: "PasswordField",
12
13
  props: /* @__PURE__ */ d({
13
14
  classes: {},
14
15
  customProps: {},
16
+ defaultValue: {},
15
17
  visible: {
16
18
  type: [null, Boolean],
17
19
  default: null
@@ -43,24 +45,29 @@ var C = /* @__PURE__ */ l({
43
45
  }),
44
46
  emits: /* @__PURE__ */ d(["visibility-change"], ["update:modelValue"]),
45
47
  setup(l, { emit: d }) {
46
- let C = d, w = g(l, "modelValue"), T = l, { formField: E, inputBind: D, isVisible: O, mergedClasses: k, toggleVisibility: A } = i(T, { onVisibilityChange: (e) => C("visibility-change", e) }), j = a(() => e(T.customProps?.toggle, {
48
+ let T = d, E = _(l, "modelValue"), D = l, O = h(D.defaultValue), k = a({
49
+ set: (e) => {
50
+ E.value = e, O.value = e;
51
+ },
52
+ get: () => x(E.value) ? O.value : E.value
53
+ }), { formField: A, inputBind: j, isVisible: M, mergedClasses: N, toggleVisibility: P } = i(D, { onVisibilityChange: (e) => T("visibility-change", e) }), F = a(() => e(D.customProps?.toggle, {
47
54
  type: "button",
48
- disabled: T.disabled,
49
- onClick: A,
50
- "aria-label": O.value ? "Hide password" : "Show password"
51
- }, b({
55
+ disabled: D.disabled,
56
+ onClick: P,
57
+ "aria-label": M.value ? "Hide password" : "Show password"
58
+ }, S({
52
59
  "bridge-end-adornment bridge-field-adornment-button inline-flex h-full items-center justify-center px-2.5": !0,
53
- [k.value.toggle ?? ""]: !0
60
+ [N.value.toggle ?? ""]: !0
54
61
  })));
55
- return (e, i) => (m(), o(h(r), { field: h(E) }, {
56
- end: v(() => [s("button", p(u(j.value)), [c(h(n), f({
57
- icon: h(O) ? h(S) : h(x),
58
- size: h(t)(T.size)
59
- }, T.customProps?.toggleIcon), null, 16, ["icon", "size"])], 16)]),
60
- default: v(() => [y(s("input", f({ "onUpdate:modelValue": i[0] ||= (e) => w.value = e }, h(D)), null, 16), [[_, w.value]])]),
62
+ return (e, i) => (m(), o(g(r), { field: g(A) }, {
63
+ end: y(() => [s("button", p(u(F.value)), [c(g(n), f({
64
+ icon: g(M) ? g(w) : g(C),
65
+ size: g(t)(D.size)
66
+ }, D.customProps?.toggleIcon), null, 16, ["icon", "size"])], 16)]),
67
+ default: y(() => [b(s("input", f({ "onUpdate:modelValue": i[0] ||= (e) => k.value = e }, g(j)), null, 16), [[v, k.value]])]),
61
68
  _: 1
62
69
  }, 8, ["field"]));
63
70
  }
64
71
  });
65
72
  //#endregion
66
- export { C as default };
73
+ export { T as default };
@@ -11,10 +11,10 @@ function l(l, u = {}) {
11
11
  entry: _,
12
12
  props: () => ({ classes: l.classes })
13
13
  }), y = r(() => {
14
- let { visible: e, classes: t, ...n } = l;
14
+ let { visible: e, classes: t, defaultValue: n, ...r } = l;
15
15
  return {
16
16
  ...d,
17
- ...n,
17
+ ...r,
18
18
  withErrorIcon: !1,
19
19
  classes: v.value
20
20
  };
@@ -40,6 +40,13 @@ export interface PasswordFieldOwnProps extends Omit<FormFieldOwnProps, "type" |
40
40
  * @default undefined
41
41
  */
42
42
  customProps?: PasswordFieldCustomProps;
43
+ /**
44
+ * Initial value for uncontrolled usage (when `v-model` / `modelValue` is
45
+ * not bound).
46
+ *
47
+ * @default undefined
48
+ */
49
+ defaultValue?: string;
43
50
  /**
44
51
  * Whether the password is visible. Omit for uncontrolled mode.
45
52
  */
@@ -1,16 +1,16 @@
1
1
  import e from "../FormControl/FormControl.js";
2
2
  import { useRadio as t } from "./composables/useRadio.js";
3
- import { computed as n, createBlock as r, createElementVNode as i, defineComponent as a, guardReactiveProps as o, mergeModels as s, mergeProps as c, normalizeProps as l, openBlock as u, unref as d, useAttrs as f, useModel as p, withCtx as m } from "vue";
4
- import { isNil as h } from "es-toolkit/compat";
3
+ import { computed as n, createBlock as r, createElementVNode as i, defineComponent as a, guardReactiveProps as o, mergeModels as s, mergeProps as c, normalizeProps as l, openBlock as u, ref as d, unref as f, useAttrs as p, useModel as m, withCtx as h } from "vue";
4
+ import { isNil as g } from "es-toolkit/compat";
5
5
  //#region src/Components/Radio/Radio.vue?vue&type=script&setup=true&lang.ts
6
- var g = ["for"], _ = ["checked"], v = /* @__PURE__ */ a({
6
+ var _ = ["for"], v = ["checked"], y = /* @__PURE__ */ a({
7
7
  inheritAttrs: !1,
8
8
  __name: "Radio",
9
9
  props: /* @__PURE__ */ s({
10
- checked: { type: Boolean },
11
10
  classes: {},
12
11
  color: {},
13
12
  customProps: {},
13
+ defaultChecked: { type: Boolean },
14
14
  name: {},
15
15
  rounded: {},
16
16
  size: {},
@@ -32,25 +32,25 @@ var g = ["for"], _ = ["checked"], v = /* @__PURE__ */ a({
32
32
  }),
33
33
  emits: ["update:modelValue"],
34
34
  setup(a) {
35
- let s = f(), v = a, y = p(a, "modelValue"), { merged: b, dotBind: x, fieldBind: S, inputBind: C, isChecked: w, formControl: T, controlBind: E } = t(() => ({
35
+ let s = p(), y = a, b = m(a, "modelValue"), x = d(!!y.defaultChecked), { merged: S, dotBind: C, fieldBind: w, inputBind: T, isChecked: E, formControl: D, controlBind: O } = t(() => ({
36
36
  ...s,
37
- ...v
37
+ ...y
38
38
  }), {
39
39
  size: "md",
40
40
  rounded: "full",
41
41
  color: "primary"
42
- }, n(() => y.value));
43
- function D() {
44
- h(b.value.value) || (y.value = b.value.value);
42
+ }, n(() => g(b.value) && x.value ? y.value : b.value));
43
+ function k() {
44
+ x.value = !0, g(S.value.value) || (b.value = S.value.value);
45
45
  }
46
- return (t, n) => (u(), r(d(e), { field: d(T) }, {
47
- default: m(() => [i("label", c(d(S), { for: d(T).controlId.value }), [i("input", c(d(C), {
48
- checked: d(w),
49
- onChange: D
50
- }), null, 16, _), i("span", l(o(d(E))), [i("span", l(o(d(x))), null, 16)], 16)], 16, g)]),
46
+ return (t, n) => (u(), r(f(e), { field: f(D) }, {
47
+ default: h(() => [i("label", c(f(w), { for: f(D).controlId.value }), [i("input", c(f(T), {
48
+ checked: f(E),
49
+ onChange: k
50
+ }), null, 16, v), i("span", l(o(f(O))), [i("span", l(o(f(C))), null, 16)], 16)], 16, _)]),
51
51
  _: 1
52
52
  }, 8, ["field"]));
53
53
  }
54
54
  });
55
55
  //#endregion
56
- export { v as default };
56
+ export { y as default };
@@ -228,7 +228,7 @@ export declare function useRadio(props: MaybeRefOrGetter<RadioOwnProps>, libDefa
228
228
  onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
229
229
  onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
230
230
  onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
231
- }, Partial<Omit<RadioOwnProps, "color" | "name" | "size" | "value" | "classes" | "customProps" | "rounded">>>>;
231
+ }, Partial<Omit<RadioOwnProps, "color" | "name" | "size" | "value" | "classes" | "customProps" | "rounded" | "defaultChecked">>>>;
232
232
  isChecked: import('vue').ComputedRef<boolean>;
233
233
  formControl: {
234
234
  slots: Readonly<{
@@ -12,7 +12,8 @@ var g = [
12
12
  "value",
13
13
  "classes",
14
14
  "rounded",
15
- "customProps"
15
+ "customProps",
16
+ "defaultChecked"
16
17
  ];
17
18
  function _(_, v, y) {
18
19
  let b = o(), x = r(() => ({
@@ -39,12 +39,6 @@ export interface RadioEmits {
39
39
  "update:modelValue": [value: number | string];
40
40
  }
41
41
  export interface RadioOwnProps extends Omit<FormControlOwnProps, "field" | "slots" | "classes" | "customProps"> {
42
- /**
43
- * Whether the radio is checked.
44
- *
45
- * @default undefined
46
- */
47
- checked?: boolean;
48
42
  /**
49
43
  * Classes for the form control chrome and the radio control.
50
44
  *
@@ -63,6 +57,13 @@ export interface RadioOwnProps extends Omit<FormControlOwnProps, "field" | "slot
63
57
  * @default undefined
64
58
  */
65
59
  customProps?: RadioCustomProps;
60
+ /**
61
+ * Initial selected state for uncontrolled usage (when `v-model` /
62
+ * `modelValue` is not bound). For interactive groups, prefer `v-model`.
63
+ *
64
+ * @default false
65
+ */
66
+ defaultChecked?: boolean;
66
67
  /**
67
68
  * The `name` attribute shared by radios in the same group.
68
69
  *
@@ -1,28 +1,29 @@
1
1
  import { hasNamedSlot as e, resolveNamedSlot as t } from "../../Utils/slotOrProp.js";
2
2
  import { mergeNestedComponentProps as n } from "../../Utils/index.js";
3
- import ee from "../Icon/Icon.js";
4
- import r from "../Chip/Chip.js";
3
+ import r from "../Icon/Icon.js";
4
+ import ee from "../Chip/Chip.js";
5
5
  import i from "../FormField/FormField.js";
6
6
  import a from "../Listbox/Listbox.js";
7
7
  import { useSelect as o } from "./composables/useSelect.js";
8
8
  import { SELECT_OPTION_KEY as s } from "./selectInjectionKey.js";
9
- import { Fragment as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createSlots as p, createTextVNode as m, createVNode as h, defineComponent as g, guardReactiveProps as _, isRef as v, mergeModels as y, mergeProps as b, normalizeProps as x, openBlock as S, provide as C, ref as w, renderList as T, renderSlot as E, resolveDynamicComponent as D, toDisplayString as O, unref as k, useModel as te, useTemplateRef as A, withCtx as j, withKeys as M, withModifiers as N } from "vue";
10
- import { X as P } from "@lucide/vue";
9
+ import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createSlots as te, createTextVNode as ne, createVNode as m, defineComponent as h, guardReactiveProps as g, isRef as _, mergeModels as v, mergeProps as y, normalizeProps as b, openBlock as x, provide as re, ref as S, renderList as C, renderSlot as w, resolveDynamicComponent as T, toDisplayString as ie, unref as E, useModel as ae, useTemplateRef as D, withCtx as O, withKeys as k, withModifiers as A } from "vue";
10
+ import { isUndefined as j } from "es-toolkit/compat";
11
+ import { X as M } from "@lucide/vue";
11
12
  //#region src/Components/Select/Select.vue?vue&type=script&setup=true&lang.ts
12
- var F = {
13
+ var N = {
13
14
  key: 0,
14
15
  class: "flex min-w-0 flex-1 flex-wrap items-center gap-0.5"
15
- }, I = {
16
+ }, P = {
16
17
  key: 1,
17
18
  class: "flex min-w-0 flex-1 items-center gap-1"
18
- }, L = {
19
+ }, F = {
19
20
  key: 0,
20
21
  hidden: "",
21
22
  "aria-hidden": "true"
22
- }, R = /* @__PURE__ */ g({
23
+ }, I = /* @__PURE__ */ h({
23
24
  inheritAttrs: !1,
24
25
  __name: "Select",
25
- props: /* @__PURE__ */ y({
26
+ props: /* @__PURE__ */ v({
26
27
  asyncData: {},
27
28
  clearable: {
28
29
  type: Boolean,
@@ -77,7 +78,7 @@ var F = {
77
78
  modelValue: {},
78
79
  modelModifiers: {}
79
80
  }),
80
- emits: /* @__PURE__ */ y([
81
+ emits: /* @__PURE__ */ v([
81
82
  "change",
82
83
  "clear",
83
84
  "close",
@@ -87,9 +88,14 @@ var F = {
87
88
  "select",
88
89
  "update:modelValue"
89
90
  ], ["update:modelValue"]),
90
- setup(g, { emit: y }) {
91
- let R = te(g, "modelValue"), z = g, B = y, V = A("trigger"), H = w([]);
92
- C(s, {
91
+ setup(h, { emit: v }) {
92
+ let I = ae(h, "modelValue"), L = h, R = v, z = S(L.defaultValue), B = l({
93
+ set: (e) => {
94
+ I.value = e, z.value = e;
95
+ },
96
+ get: () => j(I.value) ? z.value : I.value
97
+ }), V = D("trigger"), H = S([]);
98
+ re(s, {
93
99
  unregister(e) {
94
100
  H.value = H.value.filter((t) => String(t.value) !== String(e));
95
101
  },
@@ -97,76 +103,76 @@ var F = {
97
103
  H.value.some((t) => String(t.value) === String(e.value)) || (H.value = [...H.value, e]);
98
104
  }
99
105
  });
100
- let { open: U, slots: W, hasValue: G, multiple: K, formField: q, clearable: J, clearBind: Y, clearValue: X, removeChip: Z, triggerBind: Q, selectOption: ne, containerRef: re, listboxProps: ie, clearIconSize: ae, mergedClasses: oe, selectedOptions: se, hasComposedList: $, handleRegisteredOptionsChange: ce } = o(z, R, V, B, H);
101
- return (o, s) => (S(), d(c, null, [
102
- h(k(i), { field: k(q) }, {
103
- default: j(() => [k(K) ? (S(), d("div", F, [(S(!0), d(c, null, T(k(se), (e) => (S(), l(k(r), b({
106
+ let { open: U, slots: W, hasValue: G, multiple: K, formField: q, clearable: J, clearBind: Y, clearValue: X, removeChip: oe, triggerBind: Z, selectOption: se, containerRef: ce, listboxProps: le, clearIconSize: ue, mergedClasses: Q, selectedOptions: de, hasComposedList: $, handleRegisteredOptionsChange: fe } = o(L, B, V, R, H);
107
+ return (o, s) => (x(), f(c, null, [
108
+ m(E(i), { field: E(q) }, {
109
+ default: O(() => [E(K) ? (x(), f("div", N, [(x(!0), f(c, null, C(E(de), (e) => (x(), u(E(ee), y({
104
110
  dismissible: "",
105
111
  key: String(e.value),
106
- size: k(q).merged.value.size,
107
- disabled: k(q).isDisabled.value,
112
+ size: E(q).merged.value.size,
113
+ disabled: E(q).isDisabled.value,
108
114
  "clear-label": `Remove ${e.label}`,
109
- onDismiss: (t) => k(Z)(e, t)
110
- }, { ref_for: !0 }, k(n)(z.customProps?.chip, {
111
- classes: { root: k(oe).chip },
112
- customProps: { clear: k(Y) }
115
+ onDismiss: (t) => E(oe)(e, t)
116
+ }, { ref_for: !0 }, E(n)(L.customProps?.chip, {
117
+ classes: { root: E(Q).chip },
118
+ customProps: { clear: E(Y) }
113
119
  })), {
114
- default: j(() => [E(o.$slots, "chip", { option: e }, () => [m(O(e.label), 1)])]),
120
+ default: O(() => [w(o.$slots, "chip", { option: e }, () => [ne(ie(e.label), 1)])]),
115
121
  _: 2
116
122
  }, 1040, [
117
123
  "size",
118
124
  "disabled",
119
125
  "clear-label",
120
126
  "onDismiss"
121
- ]))), 128)), f("textarea", b({ ref: "trigger" }, k(Q)), null, 16)])) : (S(), d("div", I, [f("input", b({
127
+ ]))), 128)), p("textarea", y({ ref: "trigger" }, E(Z)), null, 16)])) : (x(), f("div", P, [p("input", y({
122
128
  ref: "trigger",
123
129
  class: "min-w-0 flex-1"
124
- }, k(Q)), null, 16), k(J) && k(G) && !k(q).isDisabled.value ? (S(), d("span", b({ key: 0 }, k(Y), {
125
- onClick: s[0] ||= (...e) => k(X) && k(X)(...e),
130
+ }, E(Z)), null, 16), E(J) && E(G) && !E(q).isDisabled.value ? (x(), f("span", y({ key: 0 }, E(Y), {
131
+ onClick: s[0] ||= (...e) => E(X) && E(X)(...e),
126
132
  "aria-label": "Clear selection",
127
- onKeydown: [s[1] ||= M(N((...e) => k(X) && k(X)(...e), ["prevent"]), ["enter"]), s[2] ||= M(N((...e) => k(X) && k(X)(...e), ["prevent"]), ["space"])]
128
- }), [h(k(ee), b({
129
- icon: k(P),
130
- size: k(ae)
131
- }, z.customProps?.clearIcon), null, 16, ["icon", "size"])], 16)) : u("", !0)]))]),
133
+ onKeydown: [s[1] ||= k(A((...e) => E(X) && E(X)(...e), ["prevent"]), ["enter"]), s[2] ||= k(A((...e) => E(X) && E(X)(...e), ["prevent"]), ["space"])]
134
+ }), [m(E(r), y({
135
+ icon: E(M),
136
+ size: E(ue)
137
+ }, L.customProps?.clearIcon), null, 16, ["icon", "size"])], 16)) : d("", !0)]))]),
132
138
  _: 3
133
139
  }, 8, ["field"]),
134
- h(k(a), b({
135
- modelValue: k(U),
136
- "onUpdate:modelValue": s[3] ||= (e) => v(U) ? U.value = e : null
137
- }, k(ie), {
138
- "anchor-el": k(re),
139
- onSelect: k(ne),
140
- onRegisteredOptionsChange: k(ce)
141
- }), p({ _: 2 }, [
142
- k($) ? {
140
+ m(E(a), y({
141
+ modelValue: E(U),
142
+ "onUpdate:modelValue": s[3] ||= (e) => _(U) ? U.value = e : null
143
+ }, E(le), {
144
+ "anchor-el": E(ce),
145
+ onSelect: E(se),
146
+ onRegisteredOptionsChange: E(fe)
147
+ }), te({ _: 2 }, [
148
+ E($) ? {
143
149
  name: "default",
144
- fn: j(() => [E(o.$slots, "default")]),
150
+ fn: O(() => [w(o.$slots, "default")]),
145
151
  key: "0"
146
152
  } : void 0,
147
- k(e)(k(W), "beforeOptions") ? {
153
+ E(e)(E(W), "beforeOptions") ? {
148
154
  name: "beforeOptions",
149
- fn: j(() => [(S(), l(D(k(t)(k(W), "beforeOptions"))))]),
155
+ fn: O(() => [(x(), u(T(E(t)(E(W), "beforeOptions"))))]),
150
156
  key: "1"
151
157
  } : void 0,
152
- k(e)(k(W), "loading") ? {
158
+ E(e)(E(W), "loading") ? {
153
159
  name: "loading",
154
- fn: j(() => [(S(), l(D(k(t)(k(W), "loading"))))]),
160
+ fn: O(() => [(x(), u(T(E(t)(E(W), "loading"))))]),
155
161
  key: "2"
156
162
  } : void 0,
157
- k(e)(k(W), "option") ? {
163
+ E(e)(E(W), "option") ? {
158
164
  name: "option",
159
- fn: j((e) => [E(o.$slots, "option", x(_(e)))]),
165
+ fn: O((e) => [w(o.$slots, "option", b(g(e)))]),
160
166
  key: "3"
161
167
  } : void 0,
162
- k(e)(k(W), "empty") ? {
168
+ E(e)(E(W), "empty") ? {
163
169
  name: "empty",
164
- fn: j(() => [(S(), l(D(k(t)(k(W), "empty"))))]),
170
+ fn: O(() => [(x(), u(T(E(t)(E(W), "empty"))))]),
165
171
  key: "4"
166
172
  } : void 0,
167
- k(e)(k(W), "afterOptions") ? {
173
+ E(e)(E(W), "afterOptions") ? {
168
174
  name: "afterOptions",
169
- fn: j(() => [(S(), l(D(k(t)(k(W), "afterOptions"))))]),
175
+ fn: O(() => [(x(), u(T(E(t)(E(W), "afterOptions"))))]),
170
176
  key: "5"
171
177
  } : void 0
172
178
  ]), 1040, [
@@ -175,9 +181,9 @@ var F = {
175
181
  "onSelect",
176
182
  "onRegisteredOptionsChange"
177
183
  ]),
178
- k($) ? u("", !0) : (S(), d("div", L, [E(o.$slots, "default")]))
184
+ E($) ? d("", !0) : (x(), f("div", F, [w(o.$slots, "default")]))
179
185
  ], 64));
180
186
  }
181
187
  });
182
188
  //#endregion
183
- export { R as default };
189
+ export { I as default };
@@ -120,7 +120,10 @@ export interface SelectOwnProps extends Omit<FormFieldOwnProps, "field"> {
120
120
  */
121
121
  customProps?: SelectCustomProps;
122
122
  /**
123
- * Initial value when uncontrolled.
123
+ * Initial value for uncontrolled usage (when `v-model` / `modelValue` is
124
+ * not bound).
125
+ *
126
+ * @default undefined
124
127
  */
125
128
  defaultValue?: SelectModel;
126
129
  /**
@@ -199,7 +199,7 @@ export interface SnackbarSlots {
199
199
  */
200
200
  icon?: Slot<undefined>;
201
201
  /**
202
- * Vertical action column on the right edge (WireUI `rightButtons` layout).
202
+ * Vertical action column on the right edge.
203
203
  */
204
204
  right?: Slot<undefined>;
205
205
  /**
@@ -2,13 +2,13 @@ import { SwitchOwnProps, SwitchSlots } from './switch.types';
2
2
  type __VLS_Slots = SwitchSlots;
3
3
  type __VLS_Props = SwitchOwnProps;
4
4
  type __VLS_ModelProps = {
5
- modelValue?: boolean;
5
+ modelValue?: boolean | undefined;
6
6
  };
7
7
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
8
  declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
9
- "update:modelValue": (value: boolean) => any;
9
+ "update:modelValue": (value: boolean | undefined) => any;
10
10
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
11
- "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
11
+ "onUpdate:modelValue"?: ((value: boolean | undefined) => any) | undefined;
12
12
  }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
14
  declare const _default: typeof __VLS_export;
@@ -1,15 +1,15 @@
1
1
  import e from "../FormControl/FormControl.js";
2
2
  import { useSwitch as t } from "./composables/useSwitch.js";
3
- import { computed as n, createBlock as r, createElementVNode as i, defineComponent as a, guardReactiveProps as o, mergeModels as s, mergeProps as c, normalizeProps as l, openBlock as u, unref as d, useAttrs as f, useModel as p, withCtx as m } from "vue";
3
+ import { computed as n, createBlock as r, createElementVNode as i, defineComponent as a, guardReactiveProps as o, mergeModels as s, mergeProps as c, normalizeProps as l, openBlock as u, ref as d, unref as f, useAttrs as p, useModel as m, withCtx as h } from "vue";
4
4
  //#region src/Components/Switch/Switch.vue?vue&type=script&setup=true&lang.ts
5
- var h = ["checked"], g = /* @__PURE__ */ a({
5
+ var g = ["checked"], _ = /* @__PURE__ */ a({
6
6
  inheritAttrs: !1,
7
7
  __name: "Switch",
8
8
  props: /* @__PURE__ */ s({
9
- checked: { type: Boolean },
10
9
  classes: {},
11
10
  color: {},
12
11
  customProps: {},
12
+ defaultChecked: { type: Boolean },
13
13
  rounded: {},
14
14
  size: {},
15
15
  slots: {},
@@ -26,35 +26,36 @@ var h = ["checked"], g = /* @__PURE__ */ a({
26
26
  }, {
27
27
  modelValue: {
28
28
  type: Boolean,
29
- default: !1
29
+ default: void 0
30
30
  },
31
31
  modelModifiers: {}
32
32
  }),
33
33
  emits: ["update:modelValue"],
34
34
  setup(a) {
35
- let s = f(), g = a, _ = p(a, "modelValue"), { fieldBind: v, inputBind: y, thumbBind: b, trackBind: x, formControl: S } = t(() => ({
35
+ let s = p(), _ = a, v = d(!!_.defaultChecked), y = m(a, "modelValue"), { fieldBind: b, inputBind: x, isChecked: S, thumbBind: C, trackBind: w, formControl: T } = t(() => ({
36
36
  ...s,
37
- ...g
37
+ ..._
38
38
  }), {
39
39
  size: "md",
40
40
  rounded: "full",
41
41
  color: "primary"
42
- }, n(() => _.value));
43
- function C(e) {
44
- _.value = e.target.checked;
42
+ }, n(() => y.value ?? v.value));
43
+ function E(e) {
44
+ let t = e.target;
45
+ y.value = t.checked, v.value = t.checked;
45
46
  }
46
- return (t, n) => (u(), r(d(e), { field: d(S) }, {
47
- default: m(() => [i("label", l(o(d(v))), [
48
- i("input", c(d(y), {
49
- checked: _.value,
50
- onChange: C
51
- }), null, 16, h),
52
- i("span", l(o(d(x))), null, 16),
53
- i("span", l(o(d(b))), null, 16)
47
+ return (t, n) => (u(), r(f(e), { field: f(T) }, {
48
+ default: h(() => [i("label", l(o(f(b))), [
49
+ i("input", c(f(x), {
50
+ checked: f(S),
51
+ onChange: E
52
+ }), null, 16, g),
53
+ i("span", l(o(f(w))), null, 16),
54
+ i("span", l(o(f(C))), null, 16)
54
55
  ], 16)]),
55
56
  _: 1
56
57
  }, 8, ["field"]));
57
58
  }
58
59
  });
59
60
  //#endregion
60
- export { g as default };
61
+ export { _ as default };
@@ -225,7 +225,7 @@ export declare function useSwitch(props: MaybeRefOrGetter<SwitchOwnProps>, libDe
225
225
  onTransitionend?: ((payload: TransitionEvent) => void) | undefined;
226
226
  onTransitionrun?: ((payload: TransitionEvent) => void) | undefined;
227
227
  onTransitionstart?: ((payload: TransitionEvent) => void) | undefined;
228
- }, Partial<Omit<SwitchOwnProps, "color" | "size" | "classes" | "customProps" | "rounded">>>>;
228
+ }, Partial<Omit<SwitchOwnProps, "color" | "size" | "classes" | "customProps" | "rounded" | "defaultChecked">>>>;
229
229
  isChecked: import('vue').ComputedRef<boolean>;
230
230
  thumbBind: import('vue').ComputedRef<import('@bridge-ui/core').MergePartBind<object, "class", import('vue').InputHTMLAttributes | undefined, {
231
231
  "aria-hidden": boolean;
@@ -10,7 +10,8 @@ var g = [
10
10
  "color",
11
11
  "classes",
12
12
  "rounded",
13
- "customProps"
13
+ "customProps",
14
+ "defaultChecked"
14
15
  ];
15
16
  function _(_, v, y) {
16
17
  let b = o(), x = r(() => ({
@@ -39,12 +39,6 @@ export interface SwitchEmits {
39
39
  "update:modelValue": [value: boolean];
40
40
  }
41
41
  export interface SwitchOwnProps extends Omit<FormControlOwnProps, "field" | "slots" | "classes" | "customProps"> {
42
- /**
43
- * Whether the switch is on.
44
- *
45
- * @default undefined
46
- */
47
- checked?: boolean;
48
42
  /**
49
43
  * Classes for the form control chrome and the switch control.
50
44
  *
@@ -63,6 +57,13 @@ export interface SwitchOwnProps extends Omit<FormControlOwnProps, "field" | "slo
63
57
  * @default undefined
64
58
  */
65
59
  customProps?: SwitchCustomProps;
60
+ /**
61
+ * Initial on state for uncontrolled usage (when `v-model` / `modelValue`
62
+ * is not bound).
63
+ *
64
+ * @default false
65
+ */
66
+ defaultChecked?: boolean;
66
67
  /**
67
68
  * The roundedness of the switch track.
68
69
  *
@@ -1,11 +1,13 @@
1
1
  import e from "../FormField/FormField.js";
2
2
  import { useTextField as t } from "./composables/useTextField.js";
3
- import { createBlock as n, createElementVNode as r, defineComponent as i, mergeModels as a, mergeProps as o, openBlock as s, unref as c, useModel as l, vModelDynamic as u, withCtx as d, withDirectives as f } from "vue";
3
+ import { computed as n, createBlock as r, createElementVNode as i, defineComponent as a, mergeModels as o, mergeProps as s, openBlock as c, ref as l, unref as u, useModel as d, vModelDynamic as f, withCtx as p, withDirectives as m } from "vue";
4
+ import { isUndefined as h } from "es-toolkit/compat";
4
5
  //#region src/Components/TextField/TextField.vue?vue&type=script&setup=true&lang.ts
5
- var p = /* @__PURE__ */ i({
6
+ var g = /* @__PURE__ */ a({
6
7
  inheritAttrs: !1,
7
8
  __name: "TextField",
8
- props: /* @__PURE__ */ a({
9
+ props: /* @__PURE__ */ o({
10
+ defaultValue: {},
9
11
  classes: {},
10
12
  color: {},
11
13
  controlId: {},
@@ -37,13 +39,18 @@ var p = /* @__PURE__ */ i({
37
39
  modelModifiers: {}
38
40
  }),
39
41
  emits: ["update:modelValue"],
40
- setup(i) {
41
- let a = l(i, "modelValue"), { formField: p, inputBind: m } = t(i);
42
- return (t, i) => (s(), n(c(e), { field: c(p) }, {
43
- default: d(() => [f(r("input", o({ "onUpdate:modelValue": i[0] ||= (e) => a.value = e }, c(m)), null, 16), [[u, a.value]])]),
42
+ setup(a) {
43
+ let o = d(a, "modelValue"), g = a, _ = l(g.defaultValue), v = n({
44
+ set: (e) => {
45
+ o.value = e, _.value = e;
46
+ },
47
+ get: () => h(o.value) ? _.value : o.value
48
+ }), { formField: y, inputBind: b } = t(g);
49
+ return (t, n) => (c(), r(u(e), { field: u(y) }, {
50
+ default: p(() => [m(i("input", s({ "onUpdate:modelValue": n[0] ||= (e) => v.value = e }, u(b)), null, 16), [[f, v.value]])]),
44
51
  _: 1
45
52
  }, 8, ["field"]));
46
53
  }
47
54
  });
48
55
  //#endregion
49
- export { p as default };
56
+ export { g as default };
@@ -2,10 +2,13 @@ import { useFormField as e } from "../../FormField/composables/useFormField.js";
2
2
  import { useAttrs as t } from "vue";
3
3
  //#region src/Components/TextField/composables/useTextField.ts
4
4
  function n(n) {
5
- let r = t(), i = e(() => ({
6
- ...r,
7
- ...n
8
- }), {
5
+ let r = t(), i = e(() => {
6
+ let { defaultValue: e, ...t } = n;
7
+ return {
8
+ ...r,
9
+ ...t
10
+ };
11
+ }, {
9
12
  size: "md",
10
13
  rounded: "md",
11
14
  color: "primary",
@@ -3,7 +3,15 @@ import { MergeHtmlProps } from '@bridge-ui/core';
3
3
  import { FormFieldClasses, FormFieldCustomProps, FormFieldOwnProps, FormFieldSlots } from '../FormField/formField.types';
4
4
  export interface TextFieldClasses extends FormFieldClasses {}
5
5
  export interface TextFieldCustomProps extends FormFieldCustomProps {}
6
- export interface TextFieldOwnProps extends Omit<FormFieldOwnProps, "field"> {}
6
+ export interface TextFieldOwnProps extends Omit<FormFieldOwnProps, "field"> {
7
+ /**
8
+ * Initial value for uncontrolled usage (when `v-model` / `modelValue` is
9
+ * not bound).
10
+ *
11
+ * @default undefined
12
+ */
13
+ defaultValue?: string;
14
+ }
7
15
  export interface TextFieldSlots extends FormFieldSlots {}
8
16
  export type TextFieldProps = MergeHtmlProps<TextFieldOwnProps, InputHTMLAttributes> & {
9
17
  /**
@@ -1,12 +1,14 @@
1
1
  import e from "../FormField/FormField.js";
2
2
  import { useTextarea as t } from "./composables/useTextarea.js";
3
- import { createBlock as n, createElementVNode as r, defineComponent as i, mergeModels as a, mergeProps as o, openBlock as s, unref as c, useModel as l, useTemplateRef as u, vModelText as d, watch as f, withCtx as p, withDirectives as m } from "vue";
3
+ import { computed as n, createBlock as r, createElementVNode as i, defineComponent as a, mergeModels as o, mergeProps as s, openBlock as c, ref as l, unref as u, useModel as d, useTemplateRef as f, vModelText as p, watch as m, withCtx as h, withDirectives as g } from "vue";
4
+ import { isUndefined as _ } from "es-toolkit/compat";
4
5
  //#region src/Components/Textarea/Textarea.vue?vue&type=script&setup=true&lang.ts
5
- var h = /* @__PURE__ */ i({
6
+ var v = /* @__PURE__ */ a({
6
7
  inheritAttrs: !1,
7
8
  __name: "Textarea",
8
- props: /* @__PURE__ */ a({
9
+ props: /* @__PURE__ */ o({
9
10
  autosize: { type: Boolean },
11
+ defaultValue: {},
10
12
  likeInput: { type: Boolean },
11
13
  resize: {},
12
14
  classes: {},
@@ -40,18 +42,23 @@ var h = /* @__PURE__ */ i({
40
42
  modelModifiers: {}
41
43
  }),
42
44
  emits: ["update:modelValue"],
43
- setup(i) {
44
- let a = l(i, "modelValue"), h = i, g = u("textarea"), { formField: _, textareaBind: v, adjustHeight: y } = t(h, g);
45
- return f(a, () => {
46
- y(g.value);
47
- }), (t, i) => (s(), n(c(e), { field: c(_) }, {
48
- default: p(() => [m(r("textarea", o({
45
+ setup(a) {
46
+ let o = d(a, "modelValue"), v = a, y = l(v.defaultValue), b = n({
47
+ set: (e) => {
48
+ o.value = e, y.value = e;
49
+ },
50
+ get: () => _(o.value) ? y.value : o.value
51
+ }), x = f("textarea"), { formField: S, textareaBind: C, adjustHeight: w } = t(v, x);
52
+ return m(b, () => {
53
+ w(x.value);
54
+ }), (t, n) => (c(), r(u(e), { field: u(S) }, {
55
+ default: h(() => [g(i("textarea", s({
49
56
  ref: "textarea",
50
- "onUpdate:modelValue": i[0] ||= (e) => a.value = e
51
- }, c(v)), null, 16), [[d, a.value]])]),
57
+ "onUpdate:modelValue": n[0] ||= (e) => b.value = e
58
+ }, u(C)), null, 16), [[p, b.value]])]),
52
59
  _: 1
53
60
  }, 8, ["field"]));
54
61
  }
55
62
  });
56
63
  //#endregion
57
- export { h as default };
64
+ export { v as default };
@@ -28,7 +28,8 @@ function h(h, g) {
28
28
  ...u(h, [
29
29
  "autosize",
30
30
  "resize",
31
- "likeInput"
31
+ "likeInput",
32
+ "defaultValue"
32
33
  ]),
33
34
  classes: x.value
34
35
  }), {
@@ -11,6 +11,13 @@ export interface TextareaOwnProps extends Omit<FormFieldOwnProps, "field"> {
11
11
  * Defaults to `true` when `likeInput` is set; otherwise `false`.
12
12
  */
13
13
  autosize?: boolean;
14
+ /**
15
+ * Initial value for uncontrolled usage (when `v-model` / `modelValue` is
16
+ * not bound).
17
+ *
18
+ * @default undefined
19
+ */
20
+ defaultValue?: string;
14
21
  /**
15
22
  * Use compact TextField-like sizing instead of the default multiline textarea profile.
16
23
  * Enables `autosize` and `rows={1}` by default; both can be overridden explicitly.
package/dist/theme.css CHANGED
@@ -29,18 +29,18 @@
29
29
  --color-dark-900: var(--color-slate-900);
30
30
  --color-dark-950: var(--color-slate-950);
31
31
 
32
- /* Primary (purple) */
33
- --color-primary-50: var(--color-purple-50);
34
- --color-primary-100: var(--color-purple-100);
35
- --color-primary-200: var(--color-purple-200);
36
- --color-primary-300: var(--color-purple-300);
37
- --color-primary-400: var(--color-purple-400);
38
- --color-primary-500: var(--color-purple-500);
39
- --color-primary-600: var(--color-purple-600);
40
- --color-primary-700: var(--color-purple-700);
41
- --color-primary-800: var(--color-purple-800);
42
- --color-primary-900: var(--color-purple-900);
43
- --color-primary-950: var(--color-purple-950);
32
+ /* Primary (teal) */
33
+ --color-primary-50: var(--color-teal-50);
34
+ --color-primary-100: var(--color-teal-100);
35
+ --color-primary-200: var(--color-teal-200);
36
+ --color-primary-300: var(--color-teal-300);
37
+ --color-primary-400: var(--color-teal-400);
38
+ --color-primary-500: var(--color-teal-500);
39
+ --color-primary-600: var(--color-teal-600);
40
+ --color-primary-700: var(--color-teal-700);
41
+ --color-primary-800: var(--color-teal-800);
42
+ --color-primary-900: var(--color-teal-900);
43
+ --color-primary-950: var(--color-teal-950);
44
44
 
45
45
  /* Secondary (amber) */
46
46
  --color-secondary-50: var(--color-amber-50);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "license": "MIT",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "author": "BridgeUI",
6
6
  "sideEffects": false,
7
7
  "name": "@bridge-ui/vue",
@@ -60,7 +60,7 @@
60
60
  "dist"
61
61
  ],
62
62
  "peerDependencies": {
63
- "@bridge-ui/core": "^0.0.3",
63
+ "@bridge-ui/core": "^0.0.5",
64
64
  "@lucide/vue": ">=1.0.0",
65
65
  "vue": "^3.4.0"
66
66
  },