@nmorph/nmorph-ui-kit 2.2.37 → 2.2.38

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 (52) hide show
  1. package/dist/components/data/nmorph-card/NmorphCard.vue2.js +19 -16
  2. package/dist/components/form/nmorph-autocomplete/NmorphAutocomplete.vue2.js +67 -65
  3. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.css +1 -1
  4. package/dist/components/form/nmorph-checkbox/NmorphCheckbox.vue2.js +28 -26
  5. package/dist/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue2.js +25 -20
  6. package/dist/components/form/nmorph-color-picker/NmorphColorPicker.vue2.js +43 -42
  7. package/dist/components/form/nmorph-date-picker/NmorphDatePicker.vue2.js +52 -40
  8. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue.js +20 -16
  9. package/dist/components/form/nmorph-file-upload/NmorphFileUpload.vue2.js +113 -86
  10. package/dist/components/form/nmorph-form/NmorphForm.vue2.js +9 -9
  11. package/dist/components/form/nmorph-form/components/nmorph-form-item/NmorphFormItem.vue2.js +33 -24
  12. package/dist/components/form/nmorph-form/use-form-item-input.js +29 -8
  13. package/dist/components/form/nmorph-number-input/NmorphNumberInput.vue2.js +41 -35
  14. package/dist/components/form/nmorph-otp-input/NmorphOTPInput.vue2.js +65 -61
  15. package/dist/components/form/nmorph-radio/NmorphRadio.css +1 -1
  16. package/dist/components/form/nmorph-radio-group/NmorphRadioGroup.vue2.js +24 -22
  17. package/dist/components/form/nmorph-select/NmorphSelect.css +1 -1
  18. package/dist/components/form/nmorph-select/NmorphSelect.vue2.js +91 -81
  19. package/dist/components/form/nmorph-select-button/NmorphSelectButton.vue2.js +28 -26
  20. package/dist/components/form/nmorph-slider/NmorphSlider.vue2.js +49 -48
  21. package/dist/components/form/nmorph-switch/NmorphSwitch.vue2.js +37 -36
  22. package/dist/components/form/nmorph-text-input/NmorphTextInput.css +1 -1
  23. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue.js +1 -1
  24. package/dist/components/form/nmorph-text-input/NmorphTextInput.vue2.js +34 -30
  25. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue.js +1 -1
  26. package/dist/components/form/nmorph-textarea/NmorphTextarea.vue2.js +29 -25
  27. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue.js +1 -1
  28. package/dist/components/form/nmorph-time-picker/NmorphTimePicker.vue2.js +69 -68
  29. package/dist/hooks/use-field-validation.js +71 -42
  30. package/dist/hooks/use-form-validation.js +62 -24
  31. package/dist/index.umd.js +26 -26
  32. package/dist/package.json.js +1 -1
  33. package/dist/src/components/basic/nmorph-button/NmorphButton.vue.d.ts +1 -1
  34. package/dist/src/components/basic/nmorph-link/NmorphLink.vue.d.ts +1 -1
  35. package/dist/src/components/data/nmorph-avatar/NmorphAvatar.vue.d.ts +1 -1
  36. package/dist/src/components/data/nmorph-badge/NmorphBadge.vue.d.ts +1 -1
  37. package/dist/src/components/data/nmorph-empty/NmorphEmpty.vue.d.ts +1 -1
  38. package/dist/src/components/data/nmorph-progress/NmorphProgress.vue.d.ts +1 -1
  39. package/dist/src/components/data/nmorph-table/NmorphTable.vue.d.ts +1 -1
  40. package/dist/src/components/feedback/nmorph-callout/NmorphCallout.vue.d.ts +1 -1
  41. package/dist/src/components/form/nmorph-checkbox-group/NmorphCheckboxGroup.vue.d.ts +2 -2
  42. package/dist/src/components/form/nmorph-date-picker/NmorphDatePicker.vue.d.ts +2 -2
  43. package/dist/src/components/form/nmorph-file-upload/NmorphFileUpload.vue.d.ts +6 -3
  44. package/dist/src/components/form/nmorph-file-upload/types.d.ts +4 -0
  45. package/dist/src/components/form/nmorph-form/types.d.ts +15 -5
  46. package/dist/src/components/form/nmorph-form/use-form-item-input.d.ts +10 -0
  47. package/dist/src/components/form/nmorph-radio-group/NmorphRadioGroup.vue.d.ts +2 -2
  48. package/dist/src/hooks/use-field-validation.d.ts +15 -0
  49. package/dist/src/hooks/use-form-validation.d.ts +5 -0
  50. package/dist/style.css +1 -1
  51. package/dist/utils/common.js +6 -7
  52. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
1
  import './NmorphCard.css';
2
- import { defineComponent as n, useSlots as p, computed as d } from "vue";
3
- import { NmorphShadowType as l } from "../../../types/index.js";
4
- import { useModifiers as u } from "../../../utils/create-modifiers.js";
5
- import { toCssSize as f } from "../../../utils/common.js";
6
- const S = /* @__PURE__ */ n({
2
+ import { defineComponent as p, useSlots as l, computed as o } from "vue";
3
+ import { NmorphShadowType as u } from "../../../types/index.js";
4
+ import { useModifiers as f } from "../../../utils/create-modifiers.js";
5
+ import { toCssSize as m } from "../../../utils/common.js";
6
+ const S = /* @__PURE__ */ p({
7
7
  __name: "NmorphCard",
8
8
  props: {
9
9
  shadowType: { type: null, required: !1, default: "outset" },
@@ -13,19 +13,22 @@ const S = /* @__PURE__ */ n({
13
13
  fill: { type: Boolean, required: !1, default: !0 },
14
14
  tag: { type: String, required: !1, default: "div" }
15
15
  },
16
- setup(o, { expose: t }) {
17
- t();
18
- const e = o, i = p(), a = d(
19
- () => u({
20
- nmorph: [l[e.shadowType]],
16
+ setup(t, { expose: i }) {
17
+ i();
18
+ const e = t, a = l(), n = o(
19
+ () => f({
20
+ nmorph: [u[e.shadowType]],
21
21
  "nmorph-card": [e.shadowType, e.fill ? "fill" : "fit-content"]
22
22
  })
23
- ), s = d(() => ({
24
- ...e.shadowType === "combined" && {
25
- "--nmorph-card-combined-border-width": `${e.combinedShadowBorderWidth}px`
26
- },
27
- ...e.cardPadding !== void 0 && { "--card-padding": f(e.cardPadding) }
28
- })), r = { props: e, slots: i, modifiers: a, styles: s };
23
+ ), s = o(() => {
24
+ const d = e.cardPadding !== void 0 ? m(e.cardPadding) : void 0;
25
+ return {
26
+ ...e.shadowType === "combined" && {
27
+ "--nmorph-card-combined-border-width": `${e.combinedShadowBorderWidth}px`
28
+ },
29
+ ...d !== void 0 && { "--card-padding": d, padding: d }
30
+ };
31
+ }), r = { props: e, slots: a, modifiers: n, styles: s };
29
32
  return Object.defineProperty(r, "__isScriptSetup", { enumerable: !1, value: !0 }), r;
30
33
  }
31
34
  });
@@ -1,15 +1,16 @@
1
1
  import './NmorphAutocomplete.css';
2
- import { defineComponent as G, ref as s, computed as l, watch as c, nextTick as J } from "vue";
3
- import { useModifiers as C } from "../../../utils/create-modifiers.js";
4
- import { getNmorphOptionHeight as K, toCssSize as Q, resolveDomElement as W } from "../../../utils/common.js";
5
- import { NmorphComponentHeight as X } from "../../../types/index.js";
6
- import { useVirtualList as Y } from "../../../hooks/use-virtual-list.js";
7
- import { useZIndex as ee } from "../../../hooks/use-z-index.js";
8
- import te from "../nmorph-text-input/NmorphTextInput.vue.js";
9
- import ae from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
10
- import le from "../../basic/nmorph-icon/NmorphIcon.vue.js";
11
- import re from "../../../assets/icons/loader.svg.js";
12
- const fe = /* @__PURE__ */ G({
2
+ import { defineComponent as K, ref as s, computed as l, watch as c, nextTick as Q } from "vue";
3
+ import { useModifiers as M } from "../../../utils/create-modifiers.js";
4
+ import { getNmorphOptionHeight as W, toCssSize as X, resolveDomElement as Y } from "../../../utils/common.js";
5
+ import { NmorphComponentHeight as ee } from "../../../types/index.js";
6
+ import { useFormItemModel as te } from "../nmorph-form/use-form-item-input.js";
7
+ import { useVirtualList as ae } from "../../../hooks/use-virtual-list.js";
8
+ import { useZIndex as le } from "../../../hooks/use-z-index.js";
9
+ import re from "../nmorph-text-input/NmorphTextInput.vue.js";
10
+ import oe from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
11
+ import ue from "../../basic/nmorph-icon/NmorphIcon.vue.js";
12
+ import ne from "../../../assets/icons/loader.svg.js";
13
+ const Ie = /* @__PURE__ */ K({
13
14
  __name: "NmorphAutocomplete",
14
15
  props: {
15
16
  modelValue: { type: String, required: !1, default: "" },
@@ -31,83 +32,84 @@ const fe = /* @__PURE__ */ G({
31
32
  tabindex: { type: Number, required: !1 }
32
33
  },
33
34
  emits: ["update:model-value", "select"],
34
- setup(_, { expose: O, emit: L }) {
35
- O();
36
- const t = _, o = s(t.modelValue), d = L, V = l(
37
- () => C({
35
+ setup(O, { expose: L, emit: V }) {
36
+ L();
37
+ const t = O, p = V, { modelValue: m, updateModelValue: v } = te(
38
+ t,
39
+ (e) => p("update:model-value", e),
40
+ ""
41
+ ), o = s(m.value), A = l(
42
+ () => M({
38
43
  "nmorph-autocomplete": [a.value && "open"]
39
44
  })
40
- ), i = s(!1), y = (e) => {
41
- i.value = e === "", o.value = e, a.value = !i.value && r.value.length > 0, u.value = 0, d("update:model-value", o.value);
42
- }, A = l({
45
+ ), i = s(!1), b = (e) => {
46
+ i.value = e === "", o.value = e, a.value = !i.value && r.value.length > 0, u.value = 0, v(o.value);
47
+ }, T = l({
43
48
  get: () => o.value,
44
- set: y
45
- }), a = s(!1), M = s(null), I = () => {
49
+ set: b
50
+ }), a = s(!1), z = s(null), x = () => {
46
51
  i.value = !0, a.value = !1;
47
- }, r = l(() => t.list.filter((e) => Object.keys(e).some((g) => String(e[g]).toLowerCase().includes(o.value.toLowerCase())))), m = l(() => t.virtual && r.value.length > 0), b = l(() => t.virtualItemHeight || K(t.height)), x = l(() => t.virtualOverscan), H = l(() => t.virtualDynamicHeight), n = Y(r, {
48
- enabled: m,
49
- itemHeight: b,
50
- overscan: x,
51
- dynamic: H
52
- }), T = l(() => n.virtualItems.value), z = n.spacerStyle, B = n.contentStyle, E = l(() => Q(t.virtualMaxHeight)), u = s(0), v = l(() => r.value[u.value]), f = l(() => `${t.id || t.name || "nmorph-autocomplete"}-listbox`), q = (e) => `${f.value}-option-${e}`;
53
- c(
54
- () => t.modelValue,
55
- (e) => {
56
- e !== o.value && (o.value = e);
57
- }
58
- ), c(r, async (e) => {
59
- a.value = !i.value && o.value !== "" && e.length > 0, u.value = 0, await J(), n.scrollToIndex(0), n.refresh();
52
+ }, r = l(() => t.list.filter((e) => Object.keys(e).some((I) => String(e[I]).toLowerCase().includes(o.value.toLowerCase())))), f = l(() => t.virtual && r.value.length > 0), H = l(() => t.virtualItemHeight || W(t.height)), q = l(() => t.virtualOverscan), N = l(() => t.virtualDynamicHeight), n = ae(r, {
53
+ enabled: f,
54
+ itemHeight: H,
55
+ overscan: q,
56
+ dynamic: N
57
+ }), B = l(() => n.virtualItems.value), E = n.spacerStyle, $ = n.contentStyle, j = l(() => X(t.virtualMaxHeight)), u = s(0), h = l(() => r.value[u.value]), g = l(() => `${t.id || t.name || "nmorph-autocomplete"}-listbox`), D = (e) => `${g.value}-option-${e}`;
58
+ c(m, (e) => {
59
+ e !== o.value && (o.value = e);
60
+ }), c(r, async (e) => {
61
+ a.value = !i.value && o.value !== "" && e.length > 0, u.value = 0, await Q(), n.scrollToIndex(0), n.refresh();
60
62
  });
61
- const h = (e) => {
62
- d("select", e), o.value = e.value, d("update:model-value", o.value), setTimeout(() => {
63
+ const y = (e) => {
64
+ p("select", e), o.value = e.value, v(o.value), setTimeout(() => {
63
65
  i.value = !0, a.value = !1;
64
66
  });
65
- }, $ = (e) => {
66
- h(e);
67
- }, j = () => {
67
+ }, F = (e) => {
68
+ y(e);
69
+ }, R = () => {
68
70
  i.value = !1, a.value = r.value.length > 0;
69
- }, p = s(!1);
71
+ }, d = s(!1);
70
72
  c(o, async (e) => {
71
- e !== "" && t.actionCallback && (p.value = !0, await t.actionCallback(), p.value = !1);
72
- }), c(p, (e) => {
73
+ e !== "" && t.actionCallback && (d.value = !0, await t.actionCallback(), d.value = !1);
74
+ }), c(d, (e) => {
73
75
  e && (a.value = !0);
74
76
  }), c(u, (e) => {
75
- m.value && n.scrollToIndex(e);
77
+ f.value && n.scrollToIndex(e);
76
78
  });
77
- const N = () => {
79
+ const S = () => {
78
80
  r.value.length && (a.value = !0, u.value = (u.value + 1) % r.value.length);
79
- }, D = () => {
81
+ }, w = () => {
80
82
  r.value.length && (a.value = !0, u.value = (u.value - 1 + r.value.length) % r.value.length);
81
- }, S = () => {
82
- !a.value || !v.value || h(v.value);
83
- }, R = (e) => {
84
- e.key === "ArrowDown" ? (e.preventDefault(), N()) : e.key === "ArrowUp" ? (e.preventDefault(), D()) : e.key === "Enter" ? (e.preventDefault(), S()) : e.key === "Escape" && (e.preventDefault(), I());
85
- }, U = l(() => ({
83
+ }, k = () => {
84
+ !a.value || !h.value || y(h.value);
85
+ }, U = (e) => {
86
+ e.key === "ArrowDown" ? (e.preventDefault(), S()) : e.key === "ArrowUp" ? (e.preventDefault(), w()) : e.key === "Enter" ? (e.preventDefault(), k()) : e.key === "Escape" && (e.preventDefault(), x());
87
+ }, Z = l(() => ({
86
88
  role: "combobox",
87
89
  "aria-autocomplete": "list",
88
90
  "aria-expanded": a.value,
89
- "aria-controls": f.value,
90
- "aria-activedescendant": a.value ? q(u.value) : void 0
91
- })), Z = (e, g) => {
92
- n.measureElement(g, W(e));
93
- }, w = ee(a, () => t.zIndex), F = l(() => ({
94
- "--nmorph-autocomplete-input-z-index": w.value + 1
95
- })), P = l(
96
- () => C({
97
- nmorph: [X[t.height]]
91
+ "aria-controls": g.value,
92
+ "aria-activedescendant": a.value ? D(u.value) : void 0
93
+ })), P = (e, I) => {
94
+ n.measureElement(I, Y(e));
95
+ }, C = le(a, () => t.zIndex), G = l(() => ({
96
+ "--nmorph-autocomplete-input-z-index": C.value + 1
97
+ })), J = l(
98
+ () => M({
99
+ nmorph: [ee[t.height]]
98
100
  })
99
- ), k = { props: t, initialValue: o, emit: d, modifiers: V, userClosed: i, updateValueHandler: y, inputValue: A, open: a, nmorphAutocompleteDOMRef: M, closeHandler: I, filteredList: r, virtualEnabled: m, virtualItemHeight: b, virtualOverscan: x, virtualDynamicHeight: H, virtualList: n, virtualItems: T, virtualSpacerStyle: z, virtualContentStyle: B, virtualMaxHeight: E, currentIndex: u, activeItem: v, listboxId: f, getOptionId: q, selectItem: h, clickHandler: $, focusHandler: j, loader: p, arrowDownHandler: N, arrowUpHandler: D, enterHandler: S, keydownHandler: R, inputAttrs: U, setVirtualItemRef: Z, dropdownZIndex: w, styles: F, optionHeightModifiers: P, get NmorphIcon() {
100
- return le;
101
+ ), _ = { props: t, emit: p, modelValue: m, updateModelValue: v, initialValue: o, modifiers: A, userClosed: i, updateValueHandler: b, inputValue: T, open: a, nmorphAutocompleteDOMRef: z, closeHandler: x, filteredList: r, virtualEnabled: f, virtualItemHeight: H, virtualOverscan: q, virtualDynamicHeight: N, virtualList: n, virtualItems: B, virtualSpacerStyle: E, virtualContentStyle: $, virtualMaxHeight: j, currentIndex: u, activeItem: h, listboxId: g, getOptionId: D, selectItem: y, clickHandler: F, focusHandler: R, loader: d, arrowDownHandler: S, arrowUpHandler: w, enterHandler: k, keydownHandler: U, inputAttrs: Z, setVirtualItemRef: P, dropdownZIndex: C, styles: G, optionHeightModifiers: J, get NmorphIcon() {
102
+ return ue;
101
103
  }, get NmorphDropdown() {
102
- return ae;
104
+ return oe;
103
105
  }, get NmorphTextInput() {
104
- return te;
105
- }, get NmorphIconLoaderDots() {
106
106
  return re;
107
+ }, get NmorphIconLoaderDots() {
108
+ return ne;
107
109
  } };
108
- return Object.defineProperty(k, "__isScriptSetup", { enumerable: !1, value: !0 }), k;
110
+ return Object.defineProperty(_, "__isScriptSetup", { enumerable: !1, value: !0 }), _;
109
111
  }
110
112
  });
111
113
  export {
112
- fe as default
114
+ Ie as default
113
115
  };
@@ -1 +1 @@
1
- .nmorph-checkbox{--size: var(--height);display:inline-flex;align-items:center;vertical-align:middle;cursor:pointer}.nmorph-checkbox .nmorph-checkbox__content{position:relative;display:flex;justify-content:center;align-items:center}.nmorph-checkbox .nmorph-checkbox__input-wrapper{position:relative;width:var(--size);height:var(--size)}.nmorph-checkbox input{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0}.nmorph-checkbox input:focus-visible{outline:2px solid var(--nmorph-accent-color);opacity:1;scale:.95}.nmorph-checkbox .nmorph-checkbox__fake{position:absolute;top:0;left:0;width:100%;height:100%;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox .nmorph-checkbox__label,.nmorph-checkbox .nmorph-checkbox__fake span{font-weight:400;font-size:var(--font-size-small);line-height:var(--line-height-regular)}.nmorph-checkbox .nmorph-checkbox__fake-checked{position:absolute;top:50%;left:50%;width:50%;height:50%;background:var(--nmorph-accent-color);border-radius:var(--border-radius-20);transform:translate(-50%,-50%)}.nmorph-checkbox .nmorph-checkbox__label{margin-left:var(--indentation-02);line-height:1}.nmorph-checkbox .nmorph-checkbox__fake span{line-height:.8}.nmorph-checkbox.nmorph-checkbox--button .nmorph-checkbox__fake{position:relative;display:flex;justify-content:center;align-items:center;width:auto;min-width:var(--size);height:var(--size);padding:var(--indentation-03);background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox.nmorph--extra-thin-component .nmorph-checkbox__label,.nmorph-checkbox.nmorph--extra-thin-component .nmorph-checkbox__fake span{font-size:var(--font-size-tiny);line-height:var(--line-height-line)}.nmorph-checkbox.nmorph--extra-thin-component.nmorph-checkbox--button .nmorph-checkbox__fake{padding:var(--indentation-02)}.nmorph-checkbox.nmorph-checkbox--checked .nmorph-checkbox__fake{background:var(--nmorph-main-color);box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox.nmorph-checkbox--disabled{cursor:not-allowed;opacity:.6}
1
+ .nmorph-checkbox{--size: var(--height);--nmorph-selection-control-font-size: var(--font-size-small);--nmorph-selection-control-line-height: var(--line-height-regular);--nmorph-selection-control-inline-padding: var(--indentation-03);display:inline-flex;align-items:center;vertical-align:middle;cursor:pointer}.nmorph-checkbox.nmorph{height:auto;min-height:var(--size)}.nmorph-checkbox .nmorph-checkbox__content{position:relative;display:flex;justify-content:center;align-items:center;min-height:var(--size)}.nmorph-checkbox .nmorph-checkbox__input-wrapper{position:relative;width:var(--size);height:var(--size)}.nmorph-checkbox input{position:absolute;top:0;left:0;width:100%;height:100%;opacity:0}.nmorph-checkbox input:focus-visible{outline:2px solid var(--nmorph-accent-color);opacity:1;scale:.95}.nmorph-checkbox .nmorph-checkbox__fake{position:absolute;top:0;left:0;width:100%;height:100%;background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox .nmorph-checkbox__label,.nmorph-checkbox .nmorph-checkbox__fake span{font-weight:400;font-size:var(--nmorph-selection-control-font-size);line-height:var(--nmorph-selection-control-line-height)}.nmorph-checkbox .nmorph-checkbox__fake-checked{position:absolute;top:50%;left:50%;width:50%;height:50%;background:var(--nmorph-accent-color);border-radius:var(--border-radius-20);transform:translate(-50%,-50%)}.nmorph-checkbox .nmorph-checkbox__label{margin-left:var(--indentation-02);line-height:1}.nmorph-checkbox .nmorph-checkbox__fake span{line-height:.8}.nmorph-checkbox.nmorph-checkbox--button .nmorph-checkbox__fake{position:relative;display:flex;justify-content:center;align-items:center;width:auto;min-width:var(--size);height:var(--size);padding:var(--nmorph-selection-control-inline-padding);background:var(--nmorph-main-color);border-radius:var(--default-border-radius);box-shadow:var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox.nmorph--extra-thin-component{--nmorph-selection-control-font-size: var(--font-size-tiny);--nmorph-selection-control-line-height: var(--line-height-line);--nmorph-selection-control-inline-padding: var(--indentation-02)}.nmorph-checkbox.nmorph--thin-component{--nmorph-selection-control-font-size: var(--font-size-extra-small)}.nmorph-checkbox.nmorph--basic-component{--nmorph-selection-control-font-size: var(--font-size-small)}.nmorph-checkbox.nmorph--thick-component{--nmorph-selection-control-font-size: var(--font-size-base)}.nmorph-checkbox.nmorph-checkbox--checked .nmorph-checkbox__fake{background:var(--nmorph-main-color);box-shadow:inset var(--base-shadow-width) var(--base-shadow-width) var(--base-shadow-blur) var(--nmorph-dark-shade-color),inset calc(-1 * var(--base-shadow-width)) calc(-1 * var(--base-shadow-width)) var(--base-shadow-blur) var(--nmorph-light-shade-color)}.nmorph-checkbox.nmorph-checkbox--disabled{cursor:not-allowed;opacity:.6}
@@ -1,8 +1,9 @@
1
1
  import './NmorphCheckbox.css';
2
- import { defineComponent as y, inject as u, watch as k, ref as i, computed as r } from "vue";
3
- import { useModifiers as x } from "../../../utils/create-modifiers.js";
4
- import { NmorphSelectionControlHeight as S } from "../../../types/index.js";
5
- const j = /* @__PURE__ */ y({
2
+ import { defineComponent as x, inject as i, watch as S, ref as n, computed as d } from "vue";
3
+ import { useModifiers as q } from "../../../utils/create-modifiers.js";
4
+ import { NmorphSelectionControlHeight as V } from "../../../types/index.js";
5
+ import { useFormItemModel as C } from "../nmorph-form/use-form-item-input.js";
6
+ const H = /* @__PURE__ */ x({
6
7
  __name: "NmorphCheckbox",
7
8
  props: {
8
9
  id: { type: String, required: !1, default: "" },
@@ -13,43 +14,44 @@ const j = /* @__PURE__ */ y({
13
14
  height: { type: null, required: !1 }
14
15
  },
15
16
  emits: ["update:model-value"],
16
- setup(f, { expose: m, emit: v }) {
17
- const l = u(
17
+ setup(g, { expose: b, emit: _ }) {
18
+ const o = i(
18
19
  "checkbox-group-selected-value",
19
20
  void 0
20
- ), a = u(
21
+ ), u = i(
21
22
  "change-checkbox-value-handler",
22
23
  void 0
23
- ), n = u("checkbox-group-height", void 0), e = f;
24
- k(
25
- () => e.modelValue,
26
- (_) => {
27
- t.value = _;
28
- }
24
+ ), s = i("checkbox-group-height", void 0), e = g, c = _, { modelValue: l, updateModelValue: p } = C(
25
+ e,
26
+ (r) => c("update:model-value", r),
27
+ !1
29
28
  );
30
- const d = i(null);
31
- m({ inputDOMRef: d });
32
- const o = l !== void 0, t = o ? i(l.value) : i(e.modelValue), s = r(() => o ? l.value.includes(e.id) : e.modelValue), c = r(() => e.height || n?.value || "thin"), p = v, g = () => {
29
+ S(l, (r) => {
30
+ t.value = r;
31
+ });
32
+ const f = n(null);
33
+ b({ inputDOMRef: f });
34
+ const a = o !== void 0, t = a ? n(o.value) : n(l.value), h = d(() => a ? o.value.includes(e.id) : l.value), m = d(() => e.height || s?.value || "thin"), y = () => {
33
35
  if (!e.disabled) {
34
- if (!o) {
35
- t.value = !t.value, p("update:model-value", t.value);
36
+ if (!a) {
37
+ t.value = !t.value, p(t.value);
36
38
  return;
37
39
  }
38
- a && Array.isArray(t.value) && a(e.id, t.value);
40
+ u && Array.isArray(t.value) && u(e.id, t.value);
39
41
  }
40
- }, b = r(
41
- () => x({
42
- nmorph: [S[c.value]],
42
+ }, k = d(
43
+ () => q({
44
+ nmorph: [V[m.value]],
43
45
  "nmorph-checkbox": [
44
- s.value && "checked",
46
+ h.value && "checked",
45
47
  e.disabled && "disabled",
46
48
  e.design === "button" && "button"
47
49
  ]
48
50
  })
49
- ), h = { groupSelectedValue: l, changeValue: a, groupHeight: n, props: e, inputDOMRef: d, hasGroup: o, initialValue: t, checked: s, height: c, emit: p, handleChange: g, modifiers: b };
50
- return Object.defineProperty(h, "__isScriptSetup", { enumerable: !1, value: !0 }), h;
51
+ ), v = { groupSelectedValue: o, changeValue: u, groupHeight: s, props: e, emit: c, modelValue: l, updateModelValue: p, inputDOMRef: f, hasGroup: a, initialValue: t, checked: h, height: m, handleChange: y, modifiers: k };
52
+ return Object.defineProperty(v, "__isScriptSetup", { enumerable: !1, value: !0 }), v;
51
53
  }
52
54
  });
53
55
  export {
54
- j as default
56
+ H as default
55
57
  };
@@ -1,11 +1,12 @@
1
1
  import './NmorphCheckboxGroup.css';
2
- import { defineComponent as m, ref as h, watch as g, computed as d, provide as o } from "vue";
3
- import { useModifiers as b } from "../../../utils/create-modifiers.js";
4
- import y from "../nmorph-checkbox/NmorphCheckbox.vue.js";
5
- const _ = /* @__PURE__ */ m({
2
+ import { defineComponent as g, ref as b, watch as v, computed as p, provide as u } from "vue";
3
+ import { useModifiers as y } from "../../../utils/create-modifiers.js";
4
+ import { useFormItemModel as q } from "../nmorph-form/use-form-item-input.js";
5
+ import x from "../nmorph-checkbox/NmorphCheckbox.vue.js";
6
+ const N = /* @__PURE__ */ g({
6
7
  __name: "NmorphCheckboxGroup",
7
8
  props: {
8
- modelValue: { type: Array, required: !0, default: () => [] },
9
+ modelValue: { type: Array, required: !1, default: () => [] },
9
10
  options: { type: Array, required: !1, default: () => [] },
10
11
  design: { type: String, required: !1, default: "button" },
11
12
  direction: { type: null, required: !1, default: "row" },
@@ -17,30 +18,34 @@ const _ = /* @__PURE__ */ m({
17
18
  tabindex: { type: Number, required: !1 }
18
19
  },
19
20
  emits: ["update:model-value"],
20
- setup(n, { expose: p, emit: s }) {
21
- p();
22
- const r = n, e = h([...r.modelValue]);
23
- g(
24
- () => r.modelValue,
21
+ setup(s, { expose: c, emit: f }) {
22
+ c();
23
+ const r = s, a = f, { modelValue: o, updateModelValue: l } = q(
24
+ r,
25
+ (t) => a("update:model-value", t),
26
+ []
27
+ ), e = b([...o.value]);
28
+ v(
29
+ o,
25
30
  (t) => {
26
31
  e.value = [...t];
27
32
  },
28
33
  { deep: !0 }
29
34
  );
30
- const u = s, a = (t) => {
31
- e.value = e.value.includes(t) ? e.value.filter((f) => f !== t) : [...e.value, t], u("update:model-value", e.value);
32
- }, c = d(
33
- () => b({
35
+ const i = (t) => {
36
+ e.value = e.value.includes(t) ? e.value.filter((h) => h !== t) : [...e.value, t], l(e.value);
37
+ }, m = p(
38
+ () => y({
34
39
  "nmorph-checkbox-group": [r.design, r.direction]
35
40
  })
36
- ), l = d(() => r.height);
37
- o("checkbox-group-selected-value", e), o("change-checkbox-value-handler", a), o("checkbox-group-height", l);
38
- const i = { props: r, initialValue: e, emit: u, changeHandler: a, modifiers: c, height: l, get NmorphCheckbox() {
39
- return y;
41
+ ), d = p(() => r.height);
42
+ u("checkbox-group-selected-value", e), u("change-checkbox-value-handler", i), u("checkbox-group-height", d);
43
+ const n = { props: r, emit: a, modelValue: o, updateModelValue: l, initialValue: e, changeHandler: i, modifiers: m, height: d, get NmorphCheckbox() {
44
+ return x;
40
45
  } };
41
- return Object.defineProperty(i, "__isScriptSetup", { enumerable: !1, value: !0 }), i;
46
+ return Object.defineProperty(n, "__isScriptSetup", { enumerable: !1, value: !0 }), n;
42
47
  }
43
48
  });
44
49
  export {
45
- _ as default
50
+ N as default
46
51
  };
@@ -1,9 +1,9 @@
1
1
  import './NmorphColorPicker.css';
2
- import { defineComponent as R, ref as h, watch as j, onMounted as k, computed as C } from "vue";
3
- import { NmorphComponentHeight as B } from "../../../types/index.js";
4
- import { useModifiers as H } from "../../../utils/create-modifiers.js";
5
- import { useFormItemInput as L } from "../nmorph-form/use-form-item-input.js";
6
- const E = /* @__PURE__ */ R({
2
+ import { defineComponent as k, ref as g, watch as B, onMounted as H, computed as _ } from "vue";
3
+ import { NmorphComponentHeight as L } from "../../../types/index.js";
4
+ import { useModifiers as O } from "../../../utils/create-modifiers.js";
5
+ import { useFormItemInput as z, useFormItemModel as A } from "../nmorph-form/use-form-item-input.js";
6
+ const G = /* @__PURE__ */ k({
7
7
  __name: "NmorphColorPicker",
8
8
  props: {
9
9
  modelValue: { type: String, required: !1, default: "" },
@@ -17,51 +17,52 @@ const E = /* @__PURE__ */ R({
17
17
  tabindex: { type: Number, required: !1 }
18
18
  },
19
19
  emits: ["update:model-value", "focus", "blur"],
20
- setup(_, { expose: q, emit: M }) {
21
- const o = _, g = M, { id: V, name: S, tabindex: x } = L(o), s = (e, r = "#000000") => {
20
+ setup(q, { expose: S, emit: V }) {
21
+ const n = q, b = V, { id: x, name: I, tabindex: F } = z(n), { modelValue: d, updateModelValue: y } = A(
22
+ n,
23
+ (e) => b("update:model-value", e),
24
+ ""
25
+ ), l = (e, r = "#000000") => {
22
26
  const t = e?.trim() || "";
23
- return /^#[\da-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[\da-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((n) => `${n}${n}`).join("").toLowerCase()}` : r;
24
- }, c = h(null), m = () => {
27
+ return /^#[\da-f]{6}$/i.test(t) ? t.toLowerCase() : /^#[\da-f]{3}$/i.test(t) ? `#${t.slice(1).split("").map((o) => `${o}${o}`).join("").toLowerCase()}` : r;
28
+ }, p = g(null), m = () => {
25
29
  if (typeof document > "u") return "#006cb6";
26
- const e = c.value || document.documentElement, r = getComputedStyle(e).getPropertyValue("--nmorph-accent-color").trim();
27
- return s(r, "#006cb6");
28
- }, a = h(s(o.modelValue)), b = h(!1);
29
- j(
30
- () => o.modelValue,
31
- (e) => {
32
- a.value = e ? s(e) : m();
33
- }
34
- );
35
- const I = (e) => {
36
- const r = e.target, t = s(r.value);
37
- a.value = t, g("update:model-value", t);
38
- }, p = (e) => [
30
+ const e = p.value || document.documentElement, r = getComputedStyle(e).getPropertyValue("--nmorph-accent-color").trim();
31
+ return l(r, "#006cb6");
32
+ }, a = g(l(d.value)), v = g(!1);
33
+ B(d, (e) => {
34
+ a.value = e ? l(e) : m();
35
+ });
36
+ const w = (e) => {
37
+ const r = e.target, t = l(r.value);
38
+ a.value = t, y(t);
39
+ }, f = (e) => [
39
40
  parseInt(e.slice(1, 3), 16),
40
41
  parseInt(e.slice(3, 5), 16),
41
42
  parseInt(e.slice(5, 7), 16)
42
- ], y = (e) => {
43
- const [r, t, n] = p(e);
44
- return `rgb(${r}, ${t}, ${n})`;
45
- }, v = (e) => {
46
- const [r, t, n] = p(e).map((P) => P / 255), l = Math.max(r, t, n), u = Math.min(r, t, n), f = (l + u) / 2;
47
- if (l === u)
48
- return `hsl(0, 0%, ${Math.round(f * 100)}%)`;
49
- const i = l - u, N = f > 0.5 ? i / (2 - l - u) : i / (l + u);
50
- let d = 0;
51
- return l === r ? d = (t - n) / i + (t < n ? 6 : 0) : l === t ? d = (n - r) / i + 2 : d = (r - t) / i + 4, `hsl(${Math.round(d * 60)}, ${Math.round(N * 100)}%, ${Math.round(f * 100)}%)`;
43
+ ], $ = (e) => {
44
+ const [r, t, o] = f(e);
45
+ return `rgb(${r}, ${t}, ${o})`;
46
+ }, M = (e) => {
47
+ const [r, t, o] = f(e).map((j) => j / 255), s = Math.max(r, t, o), u = Math.min(r, t, o), h = (s + u) / 2;
48
+ if (s === u)
49
+ return `hsl(0, 0%, ${Math.round(h * 100)}%)`;
50
+ const i = s - u, R = h > 0.5 ? i / (2 - s - u) : i / (s + u);
51
+ let c = 0;
52
+ return s === r ? c = (t - o) / i + (t < o ? 6 : 0) : s === t ? c = (o - r) / i + 2 : c = (r - t) / i + 4, `hsl(${Math.round(c * 60)}, ${Math.round(R * 100)}%, ${Math.round(h * 100)}%)`;
52
53
  };
53
- k(() => {
54
- o.modelValue || (a.value = m());
55
- }), q({ inputDOMRef: c });
56
- const F = C(
57
- () => H({
58
- nmorph: [B[o.height], b.value && "focused"],
59
- "nmorph-color-picker": [o.disabled && "disabled", o.displayFormat]
54
+ H(() => {
55
+ d.value || (a.value = m());
56
+ }), S({ inputDOMRef: p });
57
+ const N = _(
58
+ () => O({
59
+ nmorph: [L[n.height], v.value && "focused"],
60
+ "nmorph-color-picker": [n.disabled && "disabled", n.displayFormat]
60
61
  })
61
- ), w = C(() => o.displayFormat === "rgb" ? y(a.value) : o.displayFormat === "hsl" ? v(a.value) : a.value.toUpperCase()), $ = { props: o, emit: g, id: V, name: S, tabindex: x, normalizeColor: s, inputDOMRef: c, resolveAccentColor: m, currentValue: a, focused: b, handleInput: I, hexToRgb: p, formatRgb: y, formatHsl: v, modifiers: F, displayValue: w };
62
- return Object.defineProperty($, "__isScriptSetup", { enumerable: !1, value: !0 }), $;
62
+ ), P = _(() => n.displayFormat === "rgb" ? $(a.value) : n.displayFormat === "hsl" ? M(a.value) : a.value.toUpperCase()), C = { props: n, emit: b, id: x, name: I, tabindex: F, modelValue: d, updateModelValue: y, normalizeColor: l, inputDOMRef: p, resolveAccentColor: m, currentValue: a, focused: v, handleInput: w, hexToRgb: f, formatRgb: $, formatHsl: M, modifiers: N, displayValue: P };
63
+ return Object.defineProperty(C, "__isScriptSetup", { enumerable: !1, value: !0 }), C;
63
64
  }
64
65
  });
65
66
  export {
66
- E as default
67
+ G as default
67
68
  };
@@ -1,21 +1,21 @@
1
1
  import './NmorphDatePicker.css';
2
- import { defineComponent as O, computed as a, ref as u } from "vue";
3
- import { useModifiers as k } from "../../../utils/create-modifiers.js";
4
- import { toCssSize as s } from "../../../utils/common.js";
5
- import { NmorphComponentHeight as B } from "../../../types/index.js";
6
- import P from "./inner-components/nmorph-clear-button/NmorphClearButton.vue.js";
7
- import V from "./inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue.js";
8
- import { useI18n as j } from "vue-i18n";
9
- import { useFormItemInput as z } from "../nmorph-form/use-form-item-input.js";
10
- import { formatDate as f } from "../../data/nmorph-calendar/utils.js";
11
- import L from "../../../assets/icons/calendar.svg.js";
12
- import M from "../../basic/nmorph-icon/NmorphIcon.vue.js";
13
- import R from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
14
- const ee = /* @__PURE__ */ O({
2
+ import { defineComponent as B, computed as a, ref as u, watch as M } from "vue";
3
+ import { useModifiers as V } from "../../../utils/create-modifiers.js";
4
+ import { toCssSize as m } from "../../../utils/common.js";
5
+ import { NmorphComponentHeight as P } from "../../../types/index.js";
6
+ import j from "./inner-components/nmorph-clear-button/NmorphClearButton.vue.js";
7
+ import z from "./inner-components/nmorph-date-picker-content/NmorphDatePickerContent.vue.js";
8
+ import { useI18n as L } from "vue-i18n";
9
+ import { useFormItemInput as R, useFormItemModel as T } from "../nmorph-form/use-form-item-input.js";
10
+ import { formatDate as c } from "../../data/nmorph-calendar/utils.js";
11
+ import E from "../../../assets/icons/calendar.svg.js";
12
+ import G from "../../basic/nmorph-icon/NmorphIcon.vue.js";
13
+ import J from "../../navigation/nmorph-dropdown/NmorphDropdown.vue.js";
14
+ const le = /* @__PURE__ */ B({
15
15
  __name: "NmorphDatePicker",
16
16
  props: {
17
17
  placeholder: { type: String, required: !1, default: "" },
18
- modelValue: { type: [Date, Array, null], required: !0, default: null },
18
+ modelValue: { type: [Date, Array, null], required: !1, default: null },
19
19
  type: { type: null, required: !1, default: "date" },
20
20
  textSeparator: { type: String, required: !1, default: "-" },
21
21
  initialDate: { type: Date, required: !1, default: () => /* @__PURE__ */ new Date() },
@@ -36,25 +36,29 @@ const ee = /* @__PURE__ */ O({
36
36
  tabindex: { type: Number, required: !1 }
37
37
  },
38
38
  emits: ["update:model-value"],
39
- setup(m, { expose: c, emit: v }) {
40
- c();
41
- const { t: i } = j(), e = m, { id: y, name: h, autocomplete: g } = z(e), n = a(() => e.placeholder ? e.placeholder : i("pickADate")), t = u(e.modelValue), d = v, l = u(!1), q = () => {
39
+ setup(v, { expose: h, emit: y }) {
40
+ h();
41
+ const { t: p } = L(), e = v, { id: g, name: q, autocomplete: S } = R(e), n = a(() => e.placeholder ? e.placeholder : p("pickADate")), s = y, { modelValue: d, updateModelValue: i } = T(
42
+ e,
43
+ (r) => s("update:model-value", r),
44
+ null
45
+ ), t = u(d.value), l = u(!1), N = () => {
42
46
  l.value = !0;
43
- }, S = () => {
47
+ }, D = () => {
44
48
  l.value = !1;
45
- }, N = a(
46
- () => k({
47
- nmorph: [B[e.height]],
49
+ }, b = a(
50
+ () => V({
51
+ nmorph: [P[e.height]],
48
52
  "nmorph-date-picker": [e.disabled && "disabled", e.type, l.value && "focus"]
49
53
  })
50
- ), D = a(() => ({
51
- ...e.width !== void 0 && { "--width": s(e.width) },
54
+ ), C = a(() => ({
55
+ ...e.width !== void 0 && { "--width": m(e.width) },
52
56
  ...e.calendarCellHeight !== void 0 && {
53
- "--date-picker-calendar-cell-height": s(e.calendarCellHeight)
57
+ "--date-picker-calendar-cell-height": m(e.calendarCellHeight)
54
58
  }
55
- })), o = u(!1), b = u(null), C = () => {
59
+ })), o = u(!1), I = u(null), _ = () => {
56
60
  o.value = !1;
57
- }, _ = () => {
61
+ }, w = () => {
58
62
  o.value = !o.value;
59
63
  }, A = a(() => {
60
64
  if (!t.value) return n.value;
@@ -66,25 +70,33 @@ const ee = /* @__PURE__ */ O({
66
70
  };
67
71
  if (Array.isArray(t.value)) {
68
72
  if (t.value.length === 0) return n.value;
69
- const F = f(t.value, r), x = e.type === "daterange" ? e.rangeSeparator : e.valueSeparator;
70
- return F.join(x);
73
+ const O = c(t.value, r), k = e.type === "daterange" ? e.rangeSeparator : e.valueSeparator;
74
+ return O.join(k);
71
75
  } else
72
- return f(t.value, r);
73
- }), H = () => {
76
+ return c(t.value, r);
77
+ }), F = () => {
74
78
  const r = Array.isArray(t.value) ? [] : null;
75
- t.value = r, d("update:model-value", t.value);
76
- }, I = (r) => {
77
- t.value = r, d("update:model-value", t.value);
78
- }, w = a(() => Array.isArray(t.value) ? t.value.length > 0 : !!t.value), p = { t: i, props: e, id: y, name: h, autocomplete: g, placeholderText: n, selectedDate: t, emit: d, focus: l, focusHandler: q, blurHandler: S, modifiers: N, styles: D, open: o, nmorphInputDOMRef: b, closeHandler: C, toggleOpen: _, displayValue: A, clearHandler: H, updateSelectedDateHandler: I, showClearButton: w, get NmorphDropdown() {
79
- return R;
79
+ t.value = r, i(t.value);
80
+ }, H = (r) => {
81
+ t.value = r, i(t.value);
82
+ };
83
+ M(
84
+ d,
85
+ (r) => {
86
+ t.value = r;
87
+ },
88
+ { deep: !0 }
89
+ );
90
+ const x = a(() => Array.isArray(t.value) ? t.value.length > 0 : !!t.value), f = { t: p, props: e, id: g, name: q, autocomplete: S, placeholderText: n, emit: s, modelValue: d, updateModelValue: i, selectedDate: t, focus: l, focusHandler: N, blurHandler: D, modifiers: b, styles: C, open: o, nmorphInputDOMRef: I, closeHandler: _, toggleOpen: w, displayValue: A, clearHandler: F, updateSelectedDateHandler: H, showClearButton: x, get NmorphDropdown() {
91
+ return J;
80
92
  }, get NmorphIcon() {
81
- return M;
93
+ return G;
82
94
  }, get NmorphIconCalendar() {
83
- return L;
84
- }, NmorphClearButton: P, NmorphDatePickerContent: V };
85
- return Object.defineProperty(p, "__isScriptSetup", { enumerable: !1, value: !0 }), p;
95
+ return E;
96
+ }, NmorphClearButton: j, NmorphDatePickerContent: z };
97
+ return Object.defineProperty(f, "__isScriptSetup", { enumerable: !1, value: !0 }), f;
86
98
  }
87
99
  });
88
100
  export {
89
- ee as default
101
+ le as default
90
102
  };