nuxt-hs-ui 2.12.7 → 4.0.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.
Files changed (131) hide show
  1. package/README.md +202 -14
  2. package/dist/module.d.mts +3 -4
  3. package/dist/module.json +9 -6
  4. package/dist/module.mjs +109 -99
  5. package/dist/runtime/assets/flatpickr-dark.css +1 -1
  6. package/dist/runtime/assets/main.css +1 -0
  7. package/dist/runtime/assets/tabulator-custom.css +1 -1
  8. package/dist/runtime/components/form/_select/hidden-item-toggle.vue +28 -0
  9. package/dist/runtime/components/form/_select/hidden-item-toggle.vue.d.ts +10 -0
  10. package/dist/runtime/components/form/_select/item-container.vue +63 -0
  11. package/dist/runtime/components/form/_select/item-container.vue.d.ts +19 -0
  12. package/dist/runtime/components/form/_select/item-label.vue +31 -0
  13. package/dist/runtime/components/form/_select/item-label.vue.d.ts +13 -0
  14. package/dist/runtime/components/form/_select/item-row.vue +62 -0
  15. package/dist/runtime/components/form/_select/item-row.vue.d.ts +34 -0
  16. package/dist/runtime/components/form/btn-line-loading.vue +62 -81
  17. package/dist/runtime/components/form/btn-line-loading.vue.d.ts +14 -0
  18. package/dist/runtime/components/form/btn.vue +411 -494
  19. package/dist/runtime/components/form/btn.vue.d.ts +0 -0
  20. package/dist/runtime/components/form/check-box.vue +200 -315
  21. package/dist/runtime/components/form/check-box.vue.d.ts +71 -0
  22. package/dist/runtime/components/form/check-list.vue +234 -364
  23. package/dist/runtime/components/form/check-list.vue.d.ts +99 -0
  24. package/dist/runtime/components/form/combo-box.vue +340 -0
  25. package/dist/runtime/components/form/combo-box.vue.d.ts +69 -0
  26. package/dist/runtime/components/form/datepicker.vue +717 -883
  27. package/dist/runtime/components/form/datepicker.vue.d.ts +122 -0
  28. package/dist/runtime/components/form/input-frame.vue +174 -258
  29. package/dist/runtime/components/form/input-frame.vue.d.ts +88 -0
  30. package/dist/runtime/components/form/radio.vue +451 -614
  31. package/dist/runtime/components/form/radio.vue.d.ts +62 -0
  32. package/dist/runtime/components/form/select-img-icon.vue +38 -53
  33. package/dist/runtime/components/form/select-img-icon.vue.d.ts +15 -0
  34. package/dist/runtime/components/form/select.vue +733 -579
  35. package/dist/runtime/components/form/select.vue.d.ts +63 -0
  36. package/dist/runtime/components/form/text-box.vue +266 -365
  37. package/dist/runtime/components/form/text-box.vue.d.ts +105 -0
  38. package/dist/runtime/components/form/textarea.vue +338 -421
  39. package/dist/runtime/components/form/textarea.vue.d.ts +98 -0
  40. package/dist/runtime/components/form/value-box.vue +512 -641
  41. package/dist/runtime/components/form/value-box.vue.d.ts +128 -0
  42. package/dist/runtime/components/interactive/alert.vue +49 -113
  43. package/dist/runtime/components/interactive/alert.vue.d.ts +30 -0
  44. package/dist/runtime/components/interactive/block-loading.vue +91 -119
  45. package/dist/runtime/components/interactive/block-loading.vue.d.ts +22 -0
  46. package/dist/runtime/components/interactive/dialog.vue +252 -407
  47. package/dist/runtime/components/interactive/dialog.vue.d.ts +3 -0
  48. package/dist/runtime/components/interactive/modal-bg.vue +72 -82
  49. package/dist/runtime/components/interactive/modal-bg.vue.d.ts +11 -0
  50. package/dist/runtime/components/interactive/modal.vue +121 -169
  51. package/dist/runtime/components/interactive/modal.vue.d.ts +38 -0
  52. package/dist/runtime/components/interactive/toast.vue +164 -206
  53. package/dist/runtime/components/interactive/toast.vue.d.ts +3 -0
  54. package/dist/runtime/components/interactive/window-loader.vue +61 -84
  55. package/dist/runtime/components/interactive/window-loader.vue.d.ts +3 -0
  56. package/dist/runtime/components/layout/accordion-down.vue +72 -0
  57. package/dist/runtime/components/layout/accordion-down.vue.d.ts +26 -0
  58. package/dist/runtime/components/layout/accordion.vue +47 -78
  59. package/dist/runtime/components/layout/accordion.vue.d.ts +22 -0
  60. package/dist/runtime/components/layout/aspect-box.vue +29 -58
  61. package/dist/runtime/components/layout/aspect-box.vue.d.ts +29 -0
  62. package/dist/runtime/components/layout/card-item.vue +148 -193
  63. package/dist/runtime/components/layout/card-item.vue.d.ts +0 -0
  64. package/dist/runtime/components/layout/card.vue +27 -42
  65. package/dist/runtime/components/layout/card.vue.d.ts +23 -0
  66. package/dist/runtime/components/layout/container.vue +25 -40
  67. package/dist/runtime/components/layout/container.vue.d.ts +35 -0
  68. package/dist/runtime/components/layout/divider-h.vue +30 -50
  69. package/dist/runtime/components/layout/divider-h.vue.d.ts +18 -0
  70. package/dist/runtime/components/misc/breadcrumb.vue +47 -95
  71. package/dist/runtime/components/misc/breadcrumb.vue.d.ts +22 -0
  72. package/dist/runtime/components/misc/tabulator.vue +122 -190
  73. package/dist/runtime/components/misc/tabulator.vue.d.ts +28 -0
  74. package/dist/runtime/components/misc/view-name-display.vue +53 -68
  75. package/dist/runtime/components/misc/view-name-display.vue.d.ts +14 -0
  76. package/dist/runtime/components/test.vue +13 -0
  77. package/dist/runtime/components/test.vue.d.ts +3 -0
  78. package/dist/runtime/composables/test.d.ts +8 -0
  79. package/dist/runtime/composables/test.js +12 -0
  80. package/dist/runtime/composables/use-hs-dialog.d.ts +3 -20
  81. package/dist/runtime/composables/use-hs-dialog.js +3 -9
  82. package/dist/runtime/composables/use-hs-is-mobile.d.ts +8 -2
  83. package/dist/runtime/composables/use-hs-is-mobile.js +43 -25
  84. package/dist/runtime/composables/use-hs-misc.d.ts +8 -38
  85. package/dist/runtime/composables/use-hs-misc.js +9 -61
  86. package/dist/runtime/composables/use-hs-modal.js +1 -3
  87. package/dist/runtime/composables/use-hs-multi-lang.d.ts +23 -40
  88. package/dist/runtime/composables/use-hs-multi-lang.js +30 -74
  89. package/dist/runtime/composables/use-hs-scroll-lock.d.ts +1 -1
  90. package/dist/runtime/composables/use-hs-scroll-lock.js +2 -1
  91. package/dist/runtime/composables/use-hs-toast.d.ts +2 -2
  92. package/dist/runtime/composables/use-hs-toast.js +12 -4
  93. package/dist/runtime/composables/use-pinia.d.ts +1 -0
  94. package/dist/runtime/composables/use-pinia.js +2 -0
  95. package/dist/runtime/plugin.d.ts +2 -0
  96. package/dist/runtime/plugin.js +4 -0
  97. package/dist/runtime/server/tsconfig.json +3 -3
  98. package/dist/runtime/types/dialog.d.ts +11 -20
  99. package/dist/runtime/types/dialog.js +2 -1
  100. package/dist/runtime/types/flatpickr/default.js +2 -23
  101. package/dist/runtime/types/flatpickr/ja.js +3 -37
  102. package/dist/runtime/types/toast.d.ts +1 -1
  103. package/dist/runtime/utils/dayjs.d.ts +8 -6
  104. package/dist/runtime/utils/dayjs.js +12 -5
  105. package/dist/runtime/utils/modal.d.ts +9 -28
  106. package/dist/runtime/utils/modal.js +7 -36
  107. package/dist/runtime/utils/multi-lang-object.d.ts +2 -2
  108. package/dist/runtime/utils/multi-lang-object.js +1 -5
  109. package/dist/runtime/utils/multi-lang.js +12 -22
  110. package/dist/runtime/utils/object.js +1 -1
  111. package/dist/runtime/utils/select-item.d.ts +3 -1
  112. package/dist/runtime/utils/stop-watch.js +6 -4
  113. package/dist/runtime/utils/string.js +4 -4
  114. package/dist/runtime/utils/tabulator.d.ts +1 -42
  115. package/dist/runtime/utils/tabulator.js +2 -99
  116. package/dist/runtime/utils/theme.d.ts +20 -20
  117. package/dist/runtime/utils/theme.js +180 -30
  118. package/dist/runtime/utils/tv.d.ts +1 -101
  119. package/dist/runtime/utils/tv.js +0 -22
  120. package/dist/types.d.mts +3 -1
  121. package/package.json +61 -119
  122. package/dist/module.cjs +0 -5
  123. package/dist/module.d.ts +0 -16
  124. package/dist/runtime/assets/vue-select.css +0 -1
  125. package/dist/runtime/components/misc/view-name-display-target.vue +0 -39
  126. package/dist/runtime/plugin/v-select.d.ts +0 -2
  127. package/dist/runtime/plugin/v-select.js +0 -5
  128. package/dist/runtime/style.css +0 -22
  129. package/dist/runtime/tailwind.css +0 -78
  130. package/dist/runtime/types/app.config.d.ts +0 -5
  131. package/dist/types.d.ts +0 -1
File without changes
@@ -1,317 +1,202 @@
1
- <script setup lang="ts">
2
- /* ----------------------------------------------------------------------------
3
- // src\runtime\components\form\check-box.vue
4
- // ----------------------------------------------------------------------------
5
- // CheckBox
6
- // CheckBoxCheckBox
7
- ----------------------------------------------------------------------------- */
8
-
9
- // [ tailwind ]
10
- import { twMerge } from "tailwind-merge";
11
- // [ NUXT ]
12
- import { reactive, ref, watch, computed, useId, nextTick } from "#imports";
13
- // [ utils ]
14
- import { type ClassType, ClassTypeToString } from "../../utils/class-style";
15
- import type { MultiLang } from "../../utils/multi-lang";
16
- // [ composables ]
17
- import { useHsFocus } from "../../composables/use-hs-focus";
18
- import { useHsToast } from "../../composables/use-hs-toast";
19
- import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
20
- // [ Components ]
21
- import SelectImgIcon from "./select-img-icon.vue";
22
- // ----------------------------------------------------------------------------
23
- const hsFocus = useHsFocus();
24
- const Toast = useHsToast();
25
- // ----------------------------------------------------------------------------
26
- // [ Props ]
27
- type Props = {
28
- // ----------------------------------------------------------------------------
29
- // Input 種類別
30
- // imageObjectFit?: 'contain' | 'cover';
31
- // imageBorder?: string;
32
- image?: boolean;
33
- imgUrl?: string | null;
34
- classImg?: ClassType;
35
- classImgTag?: ClassType;
36
- classLabel?: ClassType;
37
- // ----------------------------------------------------------------------------
38
- data: boolean | null;
39
- diff?: boolean | null | undefined;
40
- tabindex?: string | undefined;
41
- // ----------------------------------------------------------------------------
42
- // 状態
43
- disabled?: boolean;
44
- // ----------------------------------------------------------------------------
45
- // 表示
46
- label?: MultiLang;
47
- warn?: string;
48
- warnTimeOut?: number;
49
- // ----------------------------------------------------------------------------
50
- // 設定
51
- size?: "s" | "m" | "l";
52
- // ----------------------------------------------------------------------------
53
- uiText?: {
54
- validError: {
55
- title: MultiLang;
56
- };
57
- };
58
- };
59
-
60
- const props = withDefaults(defineProps<Props>(), {
61
- // imageObjectFit: 'contain',
62
- // imageBorder: 'border-gray'
63
- image: false,
64
- imgUrl: null,
65
- classImg: "",
66
- classImgTag: "",
67
- classLabel: "",
68
- // ----------------------------------------------------------------------------
69
- diff: undefined,
70
- tabindex: undefined,
71
- // ----------------------------------------------------------------------------
72
- // 状態
73
- disabled: false,
74
- // ----------------------------------------------------------------------------
75
- // 表示
76
- label: "",
77
- warn: "",
78
- warnTimeOut: 3000,
79
- // ----------------------------------------------------------------------------
80
- // 設定
81
- size: "m",
82
- uiText: () => {
83
- return {
84
- validError: {
85
- title: { ja: "入力値の警告", en: "Input Value Warning" },
86
- },
87
- };
88
- },
89
- });
90
- // ----------------------------------------------------------------------------
91
- // [ emit ]
92
- type Emits = {
93
- ref: [element: HTMLElement];
94
- focus: [elm: HTMLElement];
95
- blur: [elm: HTMLElement];
96
- // ----------------------------
97
- "update:data": [value: boolean];
98
- "value-change": [after: boolean, before: boolean | null];
99
- // ----------------------------
100
- keydown: [event: KeyboardEvent];
101
- keyup: [event: KeyboardEvent];
102
- // ----------------------------
103
- };
104
- const emit = defineEmits<Emits>();
105
- // ----------------------------------------------------------------------------
106
-
107
- const multiLang = useHsMultiLang();
108
- const tx = multiLang.tx;
109
- // ----------------------------------------------------------------------------
110
- // [ getCurrentInstance ]
111
- const uid = useId();
112
- // ----------------------------------------------------------------------------
113
- // [ ref ]
114
- const inputElement = ref();
115
-
116
- const setRef = (elm: any) => {
117
- inputElement.value = elm;
118
- emit("ref", elm);
119
- };
120
-
121
- const switchValue = () => {
122
- const before = props.data as boolean | null;
123
- if (props.disabled === true) return;
124
-
125
- if (props.data === true) {
126
- emit("update:data", false);
127
- nextTick(() => {
128
- emit("value-change", false, before);
129
- });
130
- } else {
131
- emit("update:data", true);
132
- nextTick(() => {
133
- emit("value-change", true, before);
134
- });
135
- }
136
- if (inputElement.value !== null) {
137
- inputElement.value.focus();
138
- }
139
- };
140
-
141
- /**
142
- * 強制focus
143
- */
144
- const elmFocus = () => {
145
- inputElement.value.focus();
146
- };
147
-
148
- // [ focus, blur ]
149
- interface FocusState {
150
- isActivate: boolean;
151
- isMmousedown: boolean;
152
- }
153
-
154
- const focusState = reactive<FocusState>({
155
- isActivate: false,
156
- isMmousedown: false,
157
- });
158
-
159
- /**
160
- * コントロールのFocus判定
161
- */
162
- const computedActivate = computed(() => {
163
- // console.log(JSON.stringify(focusState));
164
- if (props.disabled === true) return false;
165
- if (hsFocus.state.id !== uid) return false;
166
- if (focusState.isActivate) return true;
167
- if (focusState.isMmousedown) return true;
168
- return false;
169
- });
170
-
171
- /**
172
- * focus, blur イベント
173
- */
174
- watch(computedActivate, (value) => {
175
- if (value === true) {
176
- // クリックでの遷移の場合に
177
- // 一つ前のコントロールのblurイベントよりも早くfocusが発生しないようにする対策で10ミリ秒処理をずらす
178
- setTimeout(() => {
179
- emit("focus", inputElement.value);
180
- }, 10);
181
- } else {
182
- emit("blur", inputElement.value);
183
- }
184
- });
185
- const onMousedown = () => {
186
- if (props.disabled === true) return;
187
- focusState.isMmousedown = true;
188
- };
189
- const onMouseup = () => {
190
- if (props.disabled === true) return;
191
- elmFocus();
192
- focusState.isMmousedown = false;
193
- };
194
- const onFocus = () => {
195
- if (props.disabled === true) return;
196
- focusState.isActivate = true;
197
- hsFocus.state.id = uid;
198
- };
199
- const onBlur = () => {
200
- focusState.isActivate = false;
201
- };
202
-
203
- // [ iconEventShowWarn ]
204
- const iconEventShowWarn = () => {
205
- Toast.Warning(props.warn, props.uiText.validError.title, props.warnTimeOut);
206
- };
207
- const tabindex = computed(() => {
208
- if (props.disabled === true) return -1;
209
- return props.tabindex;
210
- });
211
- //
212
- // ----------------------------------------------------------------------------
213
- // Class
214
-
215
- const baseClass = computed(() => {
216
- return {
217
- disabled: props.disabled,
218
- activate: computedActivate.value,
219
- diff:
220
- props.diff !== undefined &&
221
- props.diff !== props.data &&
222
- !(props.diff === null && props.data === true),
223
- };
224
- });
225
-
226
- const boxClass = computed(() => {
227
- return [
228
- twMerge(
229
- "border border-gray-700",
230
- !props.disabled ? "cursor-pointer" : "cursor-not-allowed",
231
- !props.disabled ? "bg-white" : "bg-gray-100",
232
- props.size === "s" ? "w-[16px] h-[16px] " : "",
233
- props.size === "m" ? "w-[18px] h-[18px] " : "",
234
- props.size === "l" ? "w-[22px] h-[22px] " : ""
235
- ),
236
- ];
237
- });
238
-
239
- const checkClass = computed(() => {
240
- return [
241
- twMerge(
242
- "absolute inset-0",
243
- "flex items-center justify-center",
244
- props.size === "s" ? "text-[14px]" : "",
245
- props.size === "m" ? "text-[16px]" : "",
246
- props.size === "l" ? "text-[18px]" : "",
247
- props.data === true ? "scale-100" : "scale-0"
248
- ),
249
- ];
250
- });
251
- const labelClass = computed(() => {
252
- return [
253
- twMerge(
254
- "flex items-center gap-[2px]",
255
- !props.disabled ? "cursor-pointer" : "cursor-not-allowed",
256
- props.size === "s" ? "text-[14px] ps-[6px]" : "",
257
- props.size === "m" ? "text-[16px] ps-[8px]" : "",
258
- props.size === "l" ? "text-[20px] ps-[10px]" : "",
259
- ClassTypeToString(props.classLabel)
260
- ),
261
- ];
262
- });
263
-
264
- // ----------------------------------------------------------------------------
265
- </script>
266
-
267
- <template>
268
- <div class="nac-checkbox" :class="baseClass">
269
- <input
270
- :ref="(e) => setRef(e)"
271
- :tabindex="tabindex"
272
- type="checkbox"
273
- class="checkbox"
274
- @blur="onBlur()"
275
- @focus="onFocus()"
276
- />
277
- <div
278
- class="nac-checkbox-box flex-none"
279
- :class="[boxClass, { checked: props.data === true }]"
280
- @click="switchValue()"
281
- >
282
- <div :class="checkClass">
283
- <i class="fas fa-check text-green-600"></i>
284
- </div>
285
- </div>
286
- <div
287
- class="nac-checkbox-text"
288
- :class="labelClass"
289
- @mousedown="onMousedown()"
290
- @mouseup="onMouseup()"
291
- @click="switchValue()"
292
- >
293
- <SelectImgIcon
294
- v-if="props.image"
295
- class="flex-none"
296
- :img-url="props.imgUrl"
297
- :class-img="props.classImg"
298
- :class-img-tag="props.classImgTag"
299
- />
300
- <div class="flex-1 min-w-[0] whitespace-pre-wrap break-words">
301
- {{ tx(label) }}
302
- <slot />
303
- </div>
304
- <span
305
- v-if="props.warn.length !== 0"
306
- class="warn flex-none"
307
- @click.stop="iconEventShowWarn()"
308
- >
309
- <i class="fas fa-exclamation-triangle"></i>{{ props.warn }}
310
- </span>
311
- </div>
312
- </div>
313
- </template>
314
-
1
+ <script setup>
2
+ import { twMerge } from "tailwind-merge";
3
+ import { reactive, ref, watch, computed, useId, nextTick } from "#imports";
4
+ import { ClassTypeToString } from "../../utils/class-style";
5
+ import { useHsFocus } from "../../composables/use-hs-focus";
6
+ import { useHsToast } from "../../composables/use-hs-toast";
7
+ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
8
+ import { useHsPinia } from "../../composables/use-pinia";
9
+ import SelectImgIcon from "./select-img-icon.vue";
10
+ const hsFocus = useHsFocus(useHsPinia());
11
+ const Toast = useHsToast(useHsPinia());
12
+ const props = defineProps({
13
+ image: { type: Boolean, required: false, default: false },
14
+ imgUrl: { type: [String, null], required: false, default: null },
15
+ classImg: { type: [String, Object, Array], required: false, default: "" },
16
+ classImgTag: { type: [String, Object, Array], required: false, default: "" },
17
+ classLabel: { type: [String, Object, Array], required: false, default: "" },
18
+ data: { type: [Boolean, null], required: true },
19
+ diff: { type: [Boolean, null], required: false, skipCheck: true, default: void 0 },
20
+ tabindex: { type: null, required: false, default: void 0 },
21
+ disabled: { type: Boolean, required: false, default: false },
22
+ label: { type: [String, Object], required: false, default: "" },
23
+ warn: { type: String, required: false, default: "" },
24
+ warnTimeOut: { type: Number, required: false, default: 3e3 },
25
+ size: { type: String, required: false, default: "m" },
26
+ uiText: { type: Object, required: false, default: () => {
27
+ return {
28
+ validError: {
29
+ title: { ja: "\u5165\u529B\u5024\u306E\u8B66\u544A", en: "Input Value Warning" }
30
+ }
31
+ };
32
+ } }
33
+ });
34
+ const emit = defineEmits(["ref", "focus", "blur", "update:data", "value-change", "keydown", "keyup"]);
35
+ const multiLang = useHsMultiLang(useHsPinia());
36
+ const tx = multiLang.tx;
37
+ const uid = useId();
38
+ const inputElement = ref();
39
+ defineExpose({ el: inputElement });
40
+ const setRef = (elm) => {
41
+ inputElement.value = elm;
42
+ emit("ref", elm);
43
+ };
44
+ const switchValue = () => {
45
+ const before = props.data;
46
+ if (props.disabled === true) return;
47
+ if (props.data === true) {
48
+ emit("update:data", false);
49
+ nextTick(() => {
50
+ emit("value-change", false, before);
51
+ });
52
+ } else {
53
+ emit("update:data", true);
54
+ nextTick(() => {
55
+ emit("value-change", true, before);
56
+ });
57
+ }
58
+ if (inputElement.value !== null) {
59
+ inputElement.value.focus();
60
+ }
61
+ };
62
+ const elmFocus = () => {
63
+ inputElement.value.focus();
64
+ };
65
+ const focusState = reactive({
66
+ isActivate: false,
67
+ isMmousedown: false
68
+ });
69
+ const computedActivate = computed(() => {
70
+ if (props.disabled === true) return false;
71
+ if (hsFocus.state.id !== uid) return false;
72
+ if (focusState.isActivate) return true;
73
+ if (focusState.isMmousedown) return true;
74
+ return false;
75
+ });
76
+ watch(computedActivate, (value) => {
77
+ if (value === true) {
78
+ setTimeout(() => {
79
+ emit("focus", inputElement.value);
80
+ }, 10);
81
+ } else {
82
+ emit("blur", inputElement.value);
83
+ }
84
+ });
85
+ const onMousedown = () => {
86
+ if (props.disabled === true) return;
87
+ focusState.isMmousedown = true;
88
+ };
89
+ const onMouseup = () => {
90
+ if (props.disabled === true) return;
91
+ elmFocus();
92
+ focusState.isMmousedown = false;
93
+ };
94
+ const onFocus = () => {
95
+ if (props.disabled === true) return;
96
+ focusState.isActivate = true;
97
+ if (hsFocus.state.id !== uid) {
98
+ hsFocus.state.id = uid;
99
+ }
100
+ };
101
+ const onBlur = () => {
102
+ focusState.isActivate = false;
103
+ };
104
+ const iconEventShowWarn = () => {
105
+ Toast.Warning(props.warn, props.uiText.validError.title, props.warnTimeOut);
106
+ };
107
+ const tabindex = computed(() => {
108
+ if (props.disabled === true) return -1;
109
+ return props.tabindex;
110
+ });
111
+ const baseClass = computed(() => {
112
+ return {
113
+ disabled: props.disabled,
114
+ activate: computedActivate.value,
115
+ diff: props.diff !== void 0 && props.diff !== props.data && !(props.diff === null && props.data === true)
116
+ };
117
+ });
118
+ const boxClass = computed(() => {
119
+ return [
120
+ twMerge(
121
+ "border border-gray-700",
122
+ !props.disabled ? "cursor-pointer" : "cursor-not-allowed",
123
+ !props.disabled ? "bg-white" : "bg-gray-100",
124
+ props.size === "s" ? "w-[16px] h-[16px] " : "",
125
+ props.size === "m" ? "w-[18px] h-[18px] " : "",
126
+ props.size === "l" ? "w-[22px] h-[22px] " : ""
127
+ )
128
+ ];
129
+ });
130
+ const checkClass = computed(() => {
131
+ return [
132
+ twMerge(
133
+ "absolute inset-0",
134
+ "flex items-center justify-center",
135
+ props.size === "s" ? "text-[14px]" : "",
136
+ props.size === "m" ? "text-[16px]" : "",
137
+ props.size === "l" ? "text-[18px]" : "",
138
+ props.data === true ? "scale-100" : "scale-0"
139
+ )
140
+ ];
141
+ });
142
+ const labelClass = computed(() => {
143
+ return [
144
+ twMerge(
145
+ "flex items-center gap-[2px]",
146
+ !props.disabled ? "cursor-pointer" : "cursor-not-allowed",
147
+ props.size === "s" ? "text-[14px] ps-[6px]" : "",
148
+ props.size === "m" ? "text-[16px] ps-[8px]" : "",
149
+ props.size === "l" ? "text-[20px] ps-[10px]" : "",
150
+ ClassTypeToString(props.classLabel)
151
+ )
152
+ ];
153
+ });
154
+ </script>
155
+
156
+ <template>
157
+ <div class="nac-checkbox" :class="baseClass">
158
+ <input
159
+ :ref="(e) => setRef(e)"
160
+ :tabindex="tabindex"
161
+ type="checkbox"
162
+ class="checkbox"
163
+ @blur="onBlur()"
164
+ @focus="onFocus()"
165
+ />
166
+ <div
167
+ class="nac-checkbox-box flex-none relative"
168
+ :class="[boxClass, { checked: props.data === true }]"
169
+ @click="switchValue()"
170
+ >
171
+ <div :class="checkClass">
172
+ <i class="fas fa-check text-green-600"></i>
173
+ </div>
174
+ </div>
175
+ <div
176
+ class="nac-checkbox-text"
177
+ :class="labelClass"
178
+ @mousedown="onMousedown()"
179
+ @mouseup="onMouseup()"
180
+ @click="switchValue()"
181
+ >
182
+ <SelectImgIcon
183
+ v-if="props.image"
184
+ class="flex-none"
185
+ :img-url="props.imgUrl"
186
+ :class-img="props.classImg"
187
+ :class-img-tag="props.classImgTag"
188
+ />
189
+ <div class="flex-1 min-w-0 whitespace-pre-wrap wrap-break-word">
190
+ {{ tx(label) }}
191
+ <slot />
192
+ </div>
193
+ <span v-if="props.warn.length !== 0" class="warn flex-none" @click.stop="iconEventShowWarn()">
194
+ <i class="fas fa-exclamation-triangle"></i>{{ props.warn }}
195
+ </span>
196
+ </div>
197
+ </div>
198
+ </template>
199
+
315
200
  <style scoped>
316
201
  .nac-checkbox {
317
202
  display: inline-flex;
@@ -353,4 +238,4 @@ const labelClass = computed(() => {
353
238
  .nac-checkbox.activate:not(.disabled) .nac-checkbox-text {
354
239
  text-decoration: underline;
355
240
  }
356
- </style>
241
+ </style>
@@ -0,0 +1,71 @@
1
+ import { type ClassType } from '../../utils/class-style.js';
2
+ import type { MultiLang } from '../../utils/multi-lang.js';
3
+ type Props = {
4
+ image?: boolean;
5
+ imgUrl?: string | null;
6
+ classImg?: ClassType;
7
+ classImgTag?: ClassType;
8
+ classLabel?: ClassType;
9
+ data: boolean | null;
10
+ diff?: boolean | null | undefined;
11
+ tabindex?: string | undefined;
12
+ disabled?: boolean;
13
+ label?: MultiLang;
14
+ warn?: string;
15
+ warnTimeOut?: number;
16
+ size?: 's' | 'm' | 'l';
17
+ uiText?: {
18
+ validError: {
19
+ title: MultiLang;
20
+ };
21
+ };
22
+ };
23
+ declare var __VLS_6: {};
24
+ type __VLS_Slots = {} & {
25
+ default?: (props: typeof __VLS_6) => any;
26
+ };
27
+ declare const __VLS_base: import("vue").DefineComponent<Props, {
28
+ el: import("vue").Ref<any, any>;
29
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
+ blur: (elm: HTMLElement) => any;
31
+ focus: (elm: HTMLElement) => any;
32
+ keydown: (event: KeyboardEvent) => any;
33
+ keyup: (event: KeyboardEvent) => any;
34
+ ref: (element: HTMLElement) => any;
35
+ "update:data": (value: boolean) => any;
36
+ "value-change": (after: boolean, before: boolean | null) => any;
37
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
38
+ onBlur?: ((elm: HTMLElement) => any) | undefined;
39
+ onFocus?: ((elm: HTMLElement) => any) | undefined;
40
+ onKeydown?: ((event: KeyboardEvent) => any) | undefined;
41
+ onKeyup?: ((event: KeyboardEvent) => any) | undefined;
42
+ onRef?: ((element: HTMLElement) => any) | undefined;
43
+ "onUpdate:data"?: ((value: boolean) => any) | undefined;
44
+ "onValue-change"?: ((after: boolean, before: boolean | null) => any) | undefined;
45
+ }>, {
46
+ size: "s" | "m" | "l";
47
+ image: boolean;
48
+ disabled: boolean;
49
+ warn: string;
50
+ imgUrl: string | null;
51
+ classImg: ClassType;
52
+ classImgTag: ClassType;
53
+ classLabel: ClassType;
54
+ diff: boolean | null;
55
+ tabindex: string;
56
+ label: MultiLang;
57
+ warnTimeOut: number;
58
+ uiText: {
59
+ validError: {
60
+ title: MultiLang;
61
+ };
62
+ };
63
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
64
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
65
+ declare const _default: typeof __VLS_export;
66
+ export default _default;
67
+ type __VLS_WithSlots<T, S> = T & {
68
+ new (): {
69
+ $slots: S;
70
+ };
71
+ };