nuxt-hs-ui 2.12.6 → 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 -26
  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
@@ -0,0 +1,122 @@
1
+ import type { ClassType } from '../../utils/class-style.js';
2
+ import type { MultiLang } from '../../utils/multi-lang.js';
3
+ import { type ThemeColor } from '../../utils/theme.js';
4
+ type Props = {
5
+ theme?: ThemeColor;
6
+ textAlign?: 'left' | 'center' | 'right';
7
+ mode?: 'all' | 'date' | 'time';
8
+ /** mode=time の場合、[HH:mm:ss.SSS] に固定 */
9
+ dataFormat?: string;
10
+ /** mode=time の場合、[HH:mm] に固定 */
11
+ showFormat?: string;
12
+ minDate?: string | null;
13
+ maxDate?: string | null;
14
+ hideDeleteBtn?: boolean;
15
+ hideTodayBtn?: boolean;
16
+ disableMobile?: boolean;
17
+ hasShift?: boolean;
18
+ /** 言語設定
19
+ * * 例 'ja-JP' 'en-US'" */
20
+ locale?: string | undefined;
21
+ portal?: string | false | true | HTMLElement;
22
+ data: string | null;
23
+ diff?: string | null | undefined;
24
+ tabindex?: string | undefined;
25
+ class?: ClassType;
26
+ classHeader?: ClassType;
27
+ classInput?: ClassType;
28
+ focusColor?: string;
29
+ changeColor?: string;
30
+ error?: boolean;
31
+ errorColor?: string;
32
+ disabled?: boolean;
33
+ disabledColor?: string;
34
+ readonly?: boolean;
35
+ headerless?: boolean;
36
+ label?: MultiLang;
37
+ require?: boolean;
38
+ requireText?: MultiLang;
39
+ warn?: string;
40
+ warnTimeOut?: number;
41
+ size?: 's' | 'm' | 'l';
42
+ uiText?: {
43
+ error: {
44
+ inputRangeTitle: MultiLang;
45
+ inputRangeMessage: MultiLang;
46
+ };
47
+ };
48
+ };
49
+ type __VLS_Slots = {
50
+ default(props: {
51
+ msg: string;
52
+ }): any;
53
+ overlay?(): any;
54
+ 'right-icons'?(): any;
55
+ 'left-icons'?(): any;
56
+ 'label-prepend'?(): any;
57
+ 'label-append'?(): any;
58
+ 'header-right'?(): any;
59
+ };
60
+ declare const __VLS_base: import("vue").DefineComponent<Props, {
61
+ el: import("vue").Ref<any, any>;
62
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
63
+ blur: (elm: HTMLElement) => any;
64
+ focus: (elm: HTMLElement) => any;
65
+ ref: (element: HTMLElement) => any;
66
+ "update:data": (value: string | null) => any;
67
+ "value-change": (after: string | null, before: string | null) => any;
68
+ "reset-piceker-func": (func: any) => any;
69
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
70
+ onBlur?: ((elm: HTMLElement) => any) | undefined;
71
+ onFocus?: ((elm: HTMLElement) => any) | undefined;
72
+ onRef?: ((element: HTMLElement) => any) | undefined;
73
+ "onUpdate:data"?: ((value: string | null) => any) | undefined;
74
+ "onValue-change"?: ((after: string | null, before: string | null) => any) | undefined;
75
+ "onReset-piceker-func"?: ((func: any) => any) | undefined;
76
+ }>, {
77
+ error: boolean;
78
+ size: "s" | "m" | "l";
79
+ disabled: boolean;
80
+ warn: string;
81
+ theme: ThemeColor;
82
+ class: ClassType;
83
+ textAlign: "left" | "center" | "right";
84
+ diff: string | null;
85
+ tabindex: string;
86
+ label: MultiLang;
87
+ warnTimeOut: number;
88
+ uiText: {
89
+ error: {
90
+ inputRangeTitle: MultiLang;
91
+ inputRangeMessage: MultiLang;
92
+ };
93
+ };
94
+ classHeader: ClassType;
95
+ classInput: ClassType;
96
+ focusColor: string;
97
+ changeColor: string;
98
+ errorColor: string;
99
+ disabledColor: string;
100
+ readonly: boolean;
101
+ headerless: boolean;
102
+ require: boolean;
103
+ requireText: MultiLang;
104
+ mode: "all" | "date" | "time";
105
+ dataFormat: string;
106
+ showFormat: string;
107
+ minDate: string | null;
108
+ maxDate: string | null;
109
+ hideDeleteBtn: boolean;
110
+ disableMobile: boolean;
111
+ hasShift: boolean;
112
+ locale: string;
113
+ portal: string | false | true | HTMLElement;
114
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
115
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
116
+ declare const _default: typeof __VLS_export;
117
+ export default _default;
118
+ type __VLS_WithSlots<T, S> = T & {
119
+ new (): {
120
+ $slots: S;
121
+ };
122
+ };
@@ -1,275 +1,191 @@
1
- <script setup lang="ts">
2
- /* ----------------------------------------------------------------------------
3
- // src\runtime\components\form\input-frame.vue
4
- // ----------------------------------------------------------------------------
5
- // InputFrame
6
- // InputFrameInputFrame
7
- ----------------------------------------------------------------------------- */
8
-
9
- // [ tailwind ]
10
- import { twMerge } from "tailwind-merge";
11
- // [ NUXT ]
12
- import { computed, useSlots } 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 { useHsToast } from "../../composables/use-hs-toast";
18
- import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
19
- // ----------------------------------------------------------------------------
20
- // [ Props ]
21
- type Props = {
22
- class?: ClassType;
23
- classHeader?: ClassType;
24
- classInput?: ClassType;
25
- // ----------------------------------------------------------------------------
26
- // 状態
27
- focus?: boolean;
28
- focusColor?: string;
29
- change?: boolean;
30
- changeColor?: string;
31
- error?: boolean;
32
- errorColor?: string;
33
- disabled?: boolean;
34
- disabledColor?: string;
35
- readonly?: boolean;
36
- headerless?: boolean;
37
- // ----------------------------------------------------------------------------
38
-
39
- // 表示
40
- label?: MultiLang;
41
- // 表示-副情報
42
- require?: boolean;
43
- requireText?: MultiLang;
44
- warn?: string;
45
- warnTimeOut?: number;
46
- // ----------------------------------------------------------------------------
47
- // 設定
48
- size?: "s" | "m" | "l";
49
- };
50
- const props = withDefaults(defineProps<Props>(), {
51
- class: "",
52
- classHeader: "",
53
- classInput: "",
54
- // ----------------------------------------------------------------------------
55
- // 状態
56
- focus: false,
57
- focusColor: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]",
58
- change: false,
59
- changeColor: "shadow-[inset_0px_0px_1px_2px_#fd9831be]",
60
- error: false,
61
- errorColor: "shadow-[inset_0px_0px_1px_2px_#d80000dc]",
62
- disabled: false,
63
- disabledColor: "",
64
- readonly: false,
65
- headerless: false,
66
- // ----------------------------------------------------------------------------
67
- // 表示
68
- label: "",
69
- // 表示-副情報
70
- require: false,
71
- requireText: () => ({ ja: "必須", en: "Required" }),
72
- warn: "",
73
- warnTimeOut: 3000,
74
- // ----------------------------------------------------------------------------
75
- // 設定
76
- size: "m",
77
- });
78
-
79
- type Emits = {
80
- // ----------------------------
81
- "header-label-click": [];
82
- // ----------------------------
83
- };
84
- const emit = defineEmits<Emits>();
85
- // ----------------------------------------------------------------------------
86
-
87
- const toast = useHsToast();
88
-
89
- const multiLang = useHsMultiLang();
90
- const tx = multiLang.tx;
91
- // ----------------------------------------------------------------------------
92
- const baseClass = computed(() => {
93
- return [
94
- twMerge(
95
- //
96
- "flex max-w-full",
97
- "border-[1px] border-main0",
98
- "bg-white",
99
- props.size === "s" ? "h-[44px]" : "",
100
- props.size === "m" ? "h-[48px]" : "",
101
- props.size === "l" ? "h-[60px]" : "",
102
- props.change ? props.changeColor : "",
103
- props.error ? props.errorColor : "",
104
- props.warn ? props.errorColor : "",
105
- props.focus ? props.focusColor : "",
106
- props.disabled ? "shadow-none bg-slate-300" : "",
107
- props.disabled ? props.disabledColor : "",
108
- props.readonly ? "shadow-none bg-transparent " : "",
109
- ClassTypeToString(props.class)
110
- ),
111
- props.disabled ? "disabled " : "",
112
- props.readonly ? "readonly " : "",
113
- ];
114
- });
115
-
116
- const headerClass = computed(() => {
117
- return [
118
- twMerge(
119
- //
120
- "px-1",
121
- "overflow-hidden",
122
- "text-[#996655]",
123
- props.size === "s" ? "h-[18px] text-[12px]" : "",
124
- props.size === "m" ? "h-[20px] text-[14px]" : "",
125
- props.size === "l" ? "h-[22px] text-[15px]" : "",
126
- ClassTypeToString(props.classHeader)
127
- ),
128
- ];
129
- });
130
-
131
- const headerIconClass = computed(() => {
132
- return [
133
- twMerge(
134
- //
135
- props.size === "s"
136
- ? "text-[12px] rounded leading-[12px] px-[2px] py-[2px]"
137
- : "",
138
- props.size === "m"
139
- ? "text-[13px] rounded leading-[13px] px-[2px] py-[2px]"
140
- : "",
141
- props.size === "l"
142
- ? "text-[14px] rounded leading-[14px] px-[2px] py-[3px]"
143
- : ""
144
- ),
145
- ];
146
- });
147
-
148
- const inputClass = computed(() => {
149
- return [
150
- twMerge(
151
- "px-1",
152
- "truncate",
153
- //
154
- "w-full",
155
- // 'max-w-full max-h-full w-full',
156
- props.size === "s" ? "text-[14px]" : "",
157
- props.size === "m" ? "text-[16px]" : "",
158
- props.size === "l" ? "text-[20px]" : "",
159
- ClassTypeToString(props.classInput)
160
- ),
161
- ];
162
- });
163
- // ----------------------------------------------------------------------------
164
- const iconDisabled = computed(() => {
165
- if (props.disabled) return true;
166
- if (props.readonly) return true;
167
- return false;
168
- });
169
- // ----------------------------------------------------------------------------
170
- const label = computed(() => tx(props.label).value);
171
- // ----------------------------------------------------------------------------
172
- const slots = useSlots();
173
- const hasHeader = computed(() => {
174
- if (label.value.length !== 0) return true;
175
- if (props.require && !props.readonly) return true;
176
- // if (slots.label) return true;
177
- if (slots["label-prepend"]) return true;
178
- if (slots["label-append"]) return true;
179
- if (slots["header-right"]) return true;
180
- return false;
181
- });
182
- // ----------------------------------------------------------------------------
183
- </script>
184
-
185
- <template>
186
- <div ref="el" class="hc-ui-input-frame" :class="baseClass">
187
- <div
188
- v-if="$slots['left-icons']"
189
- class="icons left-icons flex-none"
190
- :class="iconDisabled ? 'disabled' : ''"
191
- >
192
- <slot name="left-icons" :disabled="iconDisabled" />
193
- </div>
194
- <div class="flex-1 flex flex-col overflow-hidden justify-start">
195
- <div
196
- v-if="hasHeader && !props.headerless"
197
- class="flex-none flex items-end"
198
- :class="headerClass"
199
- >
200
- <div
201
- class="hc-input-label grow-0 shrink-1 truncate leading-[1.5em]"
202
- :title="label"
203
- @click.stop="emit('header-label-click')"
204
- >
205
- <slot name="label-prepend" />{{ label }}<slot name="label-append" />
206
- </div>
207
- <div class="flex-1"></div>
208
- <div class="flex-none flex gap-2">
209
- <slot name="header-right" :default-class="headerIconClass" />
210
- <div
211
- v-if="props.require && !props.readonly"
212
- :class="headerIconClass"
213
- class="text-white bg-error"
214
- >
215
- <span data-type="require">{{ tx(props.requireText) }}</span>
216
- </div>
217
- </div>
218
- </div>
219
- <div class="hc-input-body flex-1 flex flex-col justify-center">
220
- <div :class="inputClass"><slot /></div>
221
- </div>
222
- </div>
223
- <div
224
- v-if="$slots['right-icons'] || props.warn"
225
- class="icons right-icons flex-none"
226
- :class="iconDisabled ? 'disabled' : ''"
227
- >
228
- <slot name="right-icons" :disabled="iconDisabled" />
229
- <div
230
- v-if="props.warn"
231
- @click="toast.Warning(props.warn, '', props.warnTimeOut)"
232
- >
233
- <i
234
- class="fa-solid fa-triangle-exclamation text-error cursor-pointer"
235
- ></i>
236
- </div>
237
- </div>
238
- <slot name="overlay"></slot>
239
- </div>
240
- </template>
241
-
242
- <style scoped>
243
- .icons {
1
+ <script setup>
2
+ import { twMerge } from "tailwind-merge";
3
+ import { computed, useSlots } from "#imports";
4
+ import { ClassTypeToString } from "../../utils/class-style";
5
+ import { useHsToast } from "../../composables/use-hs-toast";
6
+ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
7
+ import { useHsPinia } from "../../composables/use-pinia";
8
+ const props = defineProps({
9
+ class: { type: [String, Object, Array], required: false, default: "" },
10
+ classHeader: { type: [String, Object, Array], required: false, default: "" },
11
+ classInput: { type: [String, Object, Array], required: false, default: "" },
12
+ focus: { type: Boolean, required: false, default: false },
13
+ focusColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]" },
14
+ change: { type: Boolean, required: false, default: false },
15
+ changeColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#fd9831be]" },
16
+ error: { type: Boolean, required: false, default: false },
17
+ errorColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#d80000dc]" },
18
+ disabled: { type: Boolean, required: false, default: false },
19
+ disabledColor: { type: String, required: false, default: "" },
20
+ readonly: { type: Boolean, required: false, default: false },
21
+ headerless: { type: Boolean, required: false, default: false },
22
+ label: { type: [String, Object], required: false, default: "" },
23
+ require: { type: Boolean, required: false, default: false },
24
+ requireText: { type: [String, Object], required: false, default: () => ({ ja: "\u5FC5\u9808", en: "Required" }) },
25
+ warn: { type: String, required: false, default: "" },
26
+ warnTimeOut: { type: Number, required: false, default: 3e3 },
27
+ size: { type: String, required: false, default: "m" }
28
+ });
29
+ const emit = defineEmits(["header-label-click", "ref", "focus"]);
30
+ const toast = useHsToast(useHsPinia());
31
+ const multiLang = useHsMultiLang(useHsPinia());
32
+ const tx = multiLang.tx;
33
+ const baseClass = computed(() => {
34
+ return [
35
+ twMerge(
36
+ //
37
+ "flex max-w-full relative",
38
+ "border-[1px] border-[#183C5E]",
39
+ "bg-white",
40
+ "min-w-[100px]",
41
+ props.size === "s" ? "min-h-[44px]" : "",
42
+ props.size === "m" ? "min-h-[48px]" : "",
43
+ props.size === "l" ? "min-h-[60px]" : "",
44
+ props.change ? props.changeColor : "",
45
+ props.error ? props.errorColor : "",
46
+ props.warn ? props.errorColor : "",
47
+ props.focus ? props.focusColor : "",
48
+ props.disabled ? "shadow-none bg-slate-300" : "",
49
+ props.disabled ? props.disabledColor : "",
50
+ props.readonly ? "shadow-none bg-transparent " : "",
51
+ ClassTypeToString(props.class)
52
+ ),
53
+ props.disabled ? "disabled " : "",
54
+ props.readonly ? "readonly " : ""
55
+ ];
56
+ });
57
+ const headerClass = computed(() => {
58
+ return [
59
+ twMerge(
60
+ //
61
+ "px-1",
62
+ "overflow-hidden",
63
+ "text-[#996655]",
64
+ props.size === "s" ? "h-[18px] text-[12px]" : "",
65
+ props.size === "m" ? "h-[20px] text-[14px]" : "",
66
+ props.size === "l" ? "h-[22px] text-[15px]" : "",
67
+ ClassTypeToString(props.classHeader)
68
+ )
69
+ ];
70
+ });
71
+ const headerIconClass = computed(() => {
72
+ return [
73
+ twMerge(
74
+ //
75
+ props.size === "s" ? "text-[12px] rounded leading-[12px] px-[2px] py-[2px]" : "",
76
+ props.size === "m" ? "text-[13px] rounded leading-[13px] px-[2px] py-[2px]" : "",
77
+ props.size === "l" ? "text-[14px] rounded leading-[14px] px-[2px] py-[3px]" : ""
78
+ )
79
+ ];
80
+ });
81
+ const inputClass = computed(() => {
82
+ return [
83
+ twMerge(
84
+ "px-1",
85
+ "truncate relative",
86
+ "flex items-center",
87
+ "text-black",
88
+ props.disabled ? "text-gray-600 " : "",
89
+ // props.readonly ? 'text-black' : '',
90
+ "w-full",
91
+ // 'max-w-full max-h-full w-full',
92
+ props.size === "s" ? "text-[16px]" : "",
93
+ props.size === "m" ? "text-[16px]" : "",
94
+ props.size === "l" ? "text-[20px]" : "",
95
+ ClassTypeToString(props.classInput)
96
+ )
97
+ ];
98
+ });
99
+ const iconDisabled = computed(() => {
100
+ if (props.disabled) return true;
101
+ if (props.readonly) return true;
102
+ return false;
103
+ });
104
+ const label = computed(() => tx(props.label).value);
105
+ const slots = useSlots();
106
+ const hasHeader = computed(() => {
107
+ if (label.value) return true;
108
+ if (props.require && !props.readonly) return true;
109
+ if (slots["label-prepend"]) return true;
110
+ if (slots["label-append"]) return true;
111
+ if (slots["header-right"]) return true;
112
+ return false;
113
+ });
114
+ const setRef = (e) => {
115
+ emit("ref", e);
116
+ };
117
+ </script>
118
+
119
+ <template>
120
+ <div :ref="(e) => setRef(e)" class="hc-ui-input-frame" :class="baseClass">
121
+ <div
122
+ v-if="$slots['left-icons']"
123
+ class="icons left-icons flex-none text-accent1 relative"
124
+ :class="iconDisabled ? 'disabled' : ''"
125
+ >
126
+ <slot name="left-icons" :disabled="iconDisabled" />
127
+ </div>
128
+ <div class="flex-1 flex flex-col overflow-hidden justify-start relative">
129
+ <div v-if="hasHeader && !props.headerless" class="flex-none flex items-end relative" :class="headerClass">
130
+ <div
131
+ class="hc-input-label grow-0 shrink truncate leading-[1.5em] relative"
132
+ :title="label"
133
+ @click="emit('header-label-click')"
134
+ >
135
+ <slot name="label-prepend" />{{ label }}<slot name="label-append" />
136
+ </div>
137
+ <div class="flex-1"></div>
138
+ <div class="flex-none flex gap-2 relative">
139
+ <slot name="header-right" :default-class="headerIconClass" />
140
+ <div v-if="props.require && !props.readonly" :class="headerIconClass" class="text-white bg-error">
141
+ <span data-type="require">{{ tx(props.requireText) }}</span>
142
+ </div>
143
+ </div>
144
+ </div>
145
+ <div class="hc-input-body flex-1 flex flex-col justify-center relative">
146
+ <div :class="inputClass"><slot name="default" :focus="props.focus" :change="props.change" /></div>
147
+ </div>
148
+ </div>
149
+ <div
150
+ v-if="$slots['right-icons'] || props.warn"
151
+ class="icons right-icons flex-none relative"
152
+ :class="iconDisabled ? 'disabled' : ''"
153
+ >
154
+ <slot name="right-icons" :disabled="iconDisabled" />
155
+ <div v-if="props.warn" class="relative" @click="toast.Warning(props.warn, '', props.warnTimeOut)">
156
+ <i class="fa-solid fa-triangle-exclamation text-error cursor-pointer"></i>
157
+ </div>
158
+ </div>
159
+ <slot name="overlay" :focus="props.focus" :change="props.change"></slot>
160
+ </div>
161
+ </template>
162
+
163
+ <style>
164
+ .hc-ui-input-frame .icons {
244
165
  display: flex;
166
+ align-items: center;
245
167
  }
246
- .icons > * {
168
+ .hc-ui-input-frame .icons > * {
169
+ position: relative;
247
170
  height: 100%;
248
171
  min-width: 2em;
249
172
  display: flex;
250
173
  justify-content: center;
251
174
  align-items: center;
252
- color: theme("colors.accent1");
253
175
  }
254
- .icons > *::after {
176
+ .hc-ui-input-frame .icons > *::after {
255
177
  content: "";
256
178
  width: 1px;
257
179
  position: absolute;
258
- background-color: theme("colors.main0");
180
+ background-color: #9faab3;
259
181
  }
260
- .icons.disabled > * {
261
- color: theme("colors.dark");
182
+ .hc-ui-input-frame .icons.disabled > * {
183
+ color: #224466;
262
184
  }
263
-
264
- .left-icons > *::after {
185
+ .hc-ui-input-frame .left-icons > *::after {
265
186
  inset: 2px 0 2px auto;
266
187
  }
267
-
268
- .right-icons > *::after {
188
+ .hc-ui-input-frame .right-icons > *::after {
269
189
  inset: 2px auto 2px 0;
270
190
  }
271
-
272
- .hc-ui-input-frame {
273
- min-width: 100px;
274
- }
275
- </style>
191
+ </style>
@@ -0,0 +1,88 @@
1
+ import { type ClassType } from '../../utils/class-style.js';
2
+ import type { MultiLang } from '../../utils/multi-lang.js';
3
+ type Props = {
4
+ class?: ClassType;
5
+ classHeader?: ClassType;
6
+ classInput?: ClassType;
7
+ focus?: boolean;
8
+ focusColor?: string;
9
+ change?: boolean;
10
+ changeColor?: string;
11
+ error?: boolean;
12
+ errorColor?: string;
13
+ disabled?: boolean;
14
+ disabledColor?: string;
15
+ readonly?: boolean;
16
+ headerless?: boolean;
17
+ label?: MultiLang;
18
+ require?: boolean;
19
+ requireText?: MultiLang;
20
+ warn?: string;
21
+ warnTimeOut?: number;
22
+ size?: 's' | 'm' | 'l';
23
+ };
24
+ declare var __VLS_1: {
25
+ disabled: any;
26
+ }, __VLS_3: {}, __VLS_5: {}, __VLS_7: {
27
+ defaultClass: any;
28
+ }, __VLS_9: {
29
+ focus: boolean;
30
+ change: boolean;
31
+ }, __VLS_11: {
32
+ disabled: any;
33
+ }, __VLS_13: {
34
+ focus: boolean;
35
+ change: boolean;
36
+ };
37
+ type __VLS_Slots = {} & {
38
+ 'left-icons'?: (props: typeof __VLS_1) => any;
39
+ } & {
40
+ 'label-prepend'?: (props: typeof __VLS_3) => any;
41
+ } & {
42
+ 'label-append'?: (props: typeof __VLS_5) => any;
43
+ } & {
44
+ 'header-right'?: (props: typeof __VLS_7) => any;
45
+ } & {
46
+ default?: (props: typeof __VLS_9) => any;
47
+ } & {
48
+ 'right-icons'?: (props: typeof __VLS_11) => any;
49
+ } & {
50
+ overlay?: (props: typeof __VLS_13) => any;
51
+ };
52
+ declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
53
+ focus: (flag: boolean) => any;
54
+ ref: (elm: HTMLElement) => any;
55
+ "header-label-click": () => any;
56
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
57
+ onFocus?: ((flag: boolean) => any) | undefined;
58
+ onRef?: ((elm: HTMLElement) => any) | undefined;
59
+ "onHeader-label-click"?: (() => any) | undefined;
60
+ }>, {
61
+ change: boolean;
62
+ error: boolean;
63
+ focus: boolean;
64
+ size: "s" | "m" | "l";
65
+ disabled: boolean;
66
+ warn: string;
67
+ class: ClassType;
68
+ label: MultiLang;
69
+ warnTimeOut: number;
70
+ classHeader: ClassType;
71
+ classInput: ClassType;
72
+ focusColor: string;
73
+ changeColor: string;
74
+ errorColor: string;
75
+ disabledColor: string;
76
+ readonly: boolean;
77
+ headerless: boolean;
78
+ require: boolean;
79
+ requireText: MultiLang;
80
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
81
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
82
+ declare const _default: typeof __VLS_export;
83
+ export default _default;
84
+ type __VLS_WithSlots<T, S> = T & {
85
+ new (): {
86
+ $slots: S;
87
+ };
88
+ };