nuxt-hs-ui 2.7.0 → 2.8.1

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.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.15.0"
6
6
  },
7
- "version": "2.7.0",
7
+ "version": "2.8.1",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -12,9 +12,11 @@ import { twMerge } from "tailwind-merge";
12
12
  import { reactive, ref, watch, computed, useId, nextTick } from "#imports";
13
13
  // [ utils ]
14
14
  import { type ClassType, ClassTypeToString } from "../../utils/class-style";
15
+ import type { MultiLang } from "../../utils/multi-lang";
15
16
  // [ composables ]
16
17
  import { useHsFocus } from "../../composables/use-hs-focus";
17
18
  import { useHsToast } from "../../composables/use-hs-toast";
19
+ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
18
20
  // [ Components ]
19
21
  import SelectImgIcon from "./select-img-icon.vue";
20
22
  // ----------------------------------------------------------------------------
@@ -41,7 +43,7 @@ type Props = {
41
43
  disabled?: boolean;
42
44
  // ----------------------------------------------------------------------------
43
45
  // 表示
44
- label?: string;
46
+ label?: MultiLang;
45
47
  warn?: string;
46
48
  warnTimeOut?: number;
47
49
  // ----------------------------------------------------------------------------
@@ -50,7 +52,7 @@ type Props = {
50
52
  // ----------------------------------------------------------------------------
51
53
  uiText?: {
52
54
  validError: {
53
- title: string;
55
+ title: MultiLang;
54
56
  };
55
57
  };
56
58
  };
@@ -80,7 +82,7 @@ const props = withDefaults(defineProps<Props>(), {
80
82
  uiText: () => {
81
83
  return {
82
84
  validError: {
83
- title: "入力値の警告",
85
+ title: { ja: "入力値の警告", en: "Input Value Warning" },
84
86
  },
85
87
  };
86
88
  },
@@ -101,6 +103,10 @@ type Emits = {
101
103
  };
102
104
  const emit = defineEmits<Emits>();
103
105
  // ----------------------------------------------------------------------------
106
+
107
+ const multiLang = useHsMultiLang();
108
+ const tx = multiLang.tx;
109
+ // ----------------------------------------------------------------------------
104
110
  // [ getCurrentInstance ]
105
111
  const uid = useId();
106
112
  // ----------------------------------------------------------------------------
@@ -292,7 +298,7 @@ const labelClass = computed(() => {
292
298
  :class-img-tag="props.classImgTag"
293
299
  />
294
300
  <div class="flex-1 min-w-[0] whitespace-pre-wrap break-words">
295
- {{ label }}
301
+ {{ tx(label) }}
296
302
  <slot />
297
303
  </div>
298
304
  <span
@@ -56,7 +56,7 @@ type Props = {
56
56
  readonly?: boolean;
57
57
  // ----------------------------------------------------------------------------
58
58
  // 表示
59
- label?: string;
59
+ label?: MultiLang;
60
60
  // 表示-副情報
61
61
  require?: boolean;
62
62
  requireText?: MultiLang;
@@ -107,7 +107,7 @@ type Props = {
107
107
  readonly?: boolean;
108
108
  // ----------------------------------------------------------------------------
109
109
  // 表示
110
- label?: string;
110
+ label?: MultiLang;
111
111
  // 表示-副情報
112
112
  require?: boolean;
113
113
  requireText?: MultiLang;
@@ -119,8 +119,8 @@ type Props = {
119
119
  // ----------------------------------------------------------------------------
120
120
  uiText?: {
121
121
  error: {
122
- inputRangeTitle: string;
123
- inputRangeMessage: string;
122
+ inputRangeTitle: MultiLang;
123
+ inputRangeMessage: MultiLang;
124
124
  };
125
125
  };
126
126
  };
@@ -170,8 +170,11 @@ const props = withDefaults(defineProps<Props>(), {
170
170
  uiText: () => {
171
171
  return {
172
172
  error: {
173
- inputRangeTitle: "入力値エラー",
174
- inputRangeMessage: "入力範囲外です",
173
+ inputRangeTitle: { ja: "入力値の警告", en: "Input Value Warning" },
174
+ inputRangeMessage: {
175
+ ja: "入力範囲外です",
176
+ en: "Input is out of range",
177
+ },
175
178
  },
176
179
  };
177
180
  },
@@ -36,7 +36,7 @@ type Props = {
36
36
  // ----------------------------------------------------------------------------
37
37
 
38
38
  // 表示
39
- label?: string;
39
+ label?: MultiLang;
40
40
  // 表示-副情報
41
41
  require?: boolean;
42
42
  requireText?: MultiLang;
@@ -165,9 +165,11 @@ const iconDisabled = computed(() => {
165
165
  return false;
166
166
  });
167
167
  // ----------------------------------------------------------------------------
168
+ const label = computed(() => tx(props.label).value);
169
+ // ----------------------------------------------------------------------------
168
170
  const slots = useSlots();
169
171
  const hasHeader = computed(() => {
170
- if (props.label.length !== 0) return true;
172
+ if (label.value.length !== 0) return true;
171
173
  if (props.require && !props.readonly) return true;
172
174
  // if (slots.label) return true;
173
175
  if (slots["label-prepend"]) return true;
@@ -195,11 +197,10 @@ const hasHeader = computed(() => {
195
197
  >
196
198
  <div
197
199
  class="grow-0 shrink-1 truncate leading-[1.5em]"
198
- :title="props.label"
200
+ :title="label"
199
201
  @click.stop="emit('header-label-click')"
200
202
  >
201
- <slot name="label-prepend" />{{ props.label
202
- }}<slot name="label-append" />
203
+ <slot name="label-prepend" />{{ label }}<slot name="label-append" />
203
204
  </div>
204
205
  <div class="flex-1"></div>
205
206
  <div class="flex-none flex gap-2">
@@ -64,7 +64,7 @@ type Props = {
64
64
  readonly?: boolean;
65
65
  // ----------------------------------------------------------------------------
66
66
  // 表示
67
- label?: string;
67
+ label?: MultiLang;
68
68
  // 表示-副情報
69
69
  require?: boolean;
70
70
  requireText?: MultiLang;
@@ -61,7 +61,7 @@ type Props = {
61
61
  readonly?: boolean;
62
62
  // ----------------------------------------------------------------------------
63
63
  // 表示
64
- label?: string;
64
+ label?: MultiLang;
65
65
  // 表示-副情報
66
66
  require?: boolean;
67
67
  requireText?: MultiLang;
@@ -63,7 +63,7 @@ type Props = {
63
63
  readonly?: boolean;
64
64
  // ----------------------------------------------------------------------------
65
65
  // 表示
66
- label?: string;
66
+ label?: MultiLang;
67
67
  // 表示-副情報
68
68
  require?: boolean;
69
69
  requireText?: MultiLang;
@@ -16,6 +16,7 @@ import type { MultiLang } from "../../utils/multi-lang";
16
16
  // [ composables ]
17
17
  import { useHsFocus } from "../../composables/use-hs-focus";
18
18
  import { useHsMisc } from "../../composables/use-hs-misc";
19
+ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
19
20
  // [ Components ]
20
21
  import InputFrame from "./input-frame.vue";
21
22
  // ----------------------------------------------------------------------------
@@ -50,7 +51,7 @@ type Props = {
50
51
  readonly?: boolean;
51
52
  // ----------------------------------------------------------------------------
52
53
  // 表示
53
- label?: string;
54
+ label?: MultiLang;
54
55
  // 表示-副情報
55
56
  require?: boolean;
56
57
  requireText?: MultiLang;
@@ -61,7 +62,7 @@ type Props = {
61
62
  size?: "s" | "m" | "l";
62
63
  // ----------------------------------------------------------------------------
63
64
  uiText?: {
64
- rowsUnit: string;
65
+ rowsUnit: MultiLang;
65
66
  };
66
67
  };
67
68
  const props = withDefaults(defineProps<Props>(), {
@@ -99,11 +100,10 @@ const props = withDefaults(defineProps<Props>(), {
99
100
  // ----------------------------------------------------------------------------
100
101
  // 設定
101
102
  size: "m",
102
-
103
103
  // ----------------------------------------------------------------------------
104
104
  uiText: () => {
105
105
  return {
106
- rowsUnit: "行",
106
+ rowsUnit: { ja: "行", en: "Rows" },
107
107
  };
108
108
  },
109
109
  });
@@ -123,7 +123,12 @@ type Emits = {
123
123
  };
124
124
  const emit = defineEmits<Emits>();
125
125
  // ----------------------------------------------------------------------------
126
+
127
+ const multiLang = useHsMultiLang();
128
+ const tx = multiLang.tx;
129
+
126
130
  // [ getCurrentInstance ]
131
+
127
132
  const uid = useId();
128
133
  // ----------------------------------------------------------------------------
129
134
 
@@ -373,7 +378,7 @@ const textAreaClass = computed(() => {
373
378
  </div>
374
379
  <div v-if="props.maxRows !== 0" :class="[defaultClass, rowLabelClass]">
375
380
  {{ state.value.split("\n").length }} / {{ props.maxRows }}
376
- {{ props.uiText.rowsUnit }}
381
+ {{ tx(props.uiText.rowsUnit) }}
377
382
  </div>
378
383
  </template>
379
384
  <div
@@ -75,7 +75,7 @@ type Props = {
75
75
  readonly?: boolean;
76
76
  // ----------------------------------------------------------------------------
77
77
  // 表示
78
- label?: string;
78
+ label?: MultiLang;
79
79
  // 表示-副情報
80
80
  require?: boolean;
81
81
  requireText?: MultiLang;
@@ -47,7 +47,7 @@ const classStyleUnlink = computed(() => {
47
47
  theme="back"
48
48
  variant="body"
49
49
  >
50
- <div class="flex flex-wrap gap-[2px] sm:gap-[4px]">
50
+ <div class="flex flex-wrap gap-[2px] sm:gap-[4px] max-w-full">
51
51
  <template v-for="(item, index) in props.links" :key="index">
52
52
  <div class="truncate min-w-0 w-full sm:w-auto">
53
53
  <NuxtLink
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-hs-ui",
3
- "version": "2.7.0",
3
+ "version": "2.8.1",
4
4
  "description": "My new Nuxt module",
5
5
  "repository": "https://github.com/hare-systems-ryo/nuxt-hs-ui",
6
6
  "license": "MIT",