@digitalwalletcorp/vue-core 1.0.1 → 1.2.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 (77) hide show
  1. package/README.md +7 -4
  2. package/lib/accordion-fieldset.cjs +1 -1
  3. package/lib/accordion-fieldset.d.cts +25 -0
  4. package/lib/accordion-fieldset.d.ts +0 -2
  5. package/lib/accordion-fieldset.js +1 -1
  6. package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-n-IZxUiu.js +66 -0
  7. package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-t9NqmoZW.cjs +1 -0
  8. package/lib/accordion-section.cjs +1 -0
  9. package/lib/accordion-section.d.cts +34 -0
  10. package/lib/accordion-section.d.ts +34 -0
  11. package/lib/accordion-section.js +4 -0
  12. package/lib/accordion-section.vue_vue_type_style_index_0_lang-CFDdUEnn.cjs +1 -0
  13. package/lib/accordion-section.vue_vue_type_style_index_0_lang-Gvjjx02P.js +78 -0
  14. package/lib/components-CNOeuZPu.cjs +1 -0
  15. package/lib/components-DBK8NUBh.js +24 -0
  16. package/lib/components.d.cts +9 -0
  17. package/lib/components.d.ts +3 -0
  18. package/lib/global.d.cts +7 -0
  19. package/lib/hourglass-loading.d.cts +23 -0
  20. package/lib/index.cjs +1 -1
  21. package/lib/index.d.cts +3 -0
  22. package/lib/index.js +18 -12
  23. package/lib/internal/tab-group-context.d.cts +16 -0
  24. package/lib/internal/use-shrinkable.d.cts +12 -0
  25. package/lib/internal/use-shrinkable.d.ts +12 -0
  26. package/lib/label-button.cjs +1 -1
  27. package/lib/label-button.d.cts +30 -0
  28. package/lib/label-button.js +1 -1
  29. package/lib/{label-button.vue_vue_type_script_setup_true_lang-DqhdCgmJ.cjs → label-button.vue_vue_type_script_setup_true_lang-BwVOxaJP.cjs} +1 -1
  30. package/lib/{label-button.vue_vue_type_script_setup_true_lang-CoHrTUSs.js → label-button.vue_vue_type_script_setup_true_lang-DorC4pKz.js} +1 -1
  31. package/lib/label-icon.cjs +1 -1
  32. package/lib/label-icon.d.cts +30 -0
  33. package/lib/label-icon.js +1 -1
  34. package/lib/{label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.cjs → label-icon.vue_vue_type_style_index_0_lang-D9Cimu20.cjs} +1 -1
  35. package/lib/{label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js → label-icon.vue_vue_type_style_index_0_lang-me52HE2V.js} +1 -1
  36. package/lib/nuxt.cjs +1 -1
  37. package/lib/nuxt.d.cts +10 -0
  38. package/lib/nuxt.js +1 -1
  39. package/lib/page-section.cjs +1 -0
  40. package/lib/page-section.d.cts +34 -0
  41. package/lib/page-section.d.ts +34 -0
  42. package/lib/page-section.js +4 -0
  43. package/lib/page-section.vue_vue_type_style_index_0_lang-DEAkTLxd.cjs +1 -0
  44. package/lib/page-section.vue_vue_type_style_index_0_lang-DpVQe_rV.js +54 -0
  45. package/lib/page-title.cjs +1 -0
  46. package/lib/page-title.d.cts +20 -0
  47. package/lib/page-title.d.ts +20 -0
  48. package/lib/page-title.js +4 -0
  49. package/lib/page-title.vue_vue_type_style_index_0_lang-BqIsIks5.cjs +1 -0
  50. package/lib/page-title.vue_vue_type_style_index_0_lang-ChZot85K.js +36 -0
  51. package/lib/register.cjs +1 -1
  52. package/lib/register.d.cts +9 -0
  53. package/lib/register.js +1 -1
  54. package/lib/style.css +1 -1
  55. package/lib/tab-content.d.cts +39 -0
  56. package/lib/tab-group.cjs +1 -1
  57. package/lib/tab-group.d.cts +44 -0
  58. package/lib/tab-group.js +1 -1
  59. package/lib/{tab-group.vue_vue_type_style_index_0_lang-CjnBkvvZ.js → tab-group.vue_vue_type_style_index_0_lang-C84mDEOC.js} +1 -1
  60. package/lib/{tab-group.vue_vue_type_style_index_0_lang-CwVGYZAo.cjs → tab-group.vue_vue_type_style_index_0_lang-CMaufRJV.cjs} +1 -1
  61. package/lib/types/label-preset.d.cts +12 -0
  62. package/lib/use-shrinkable-CS2bmsJJ.js +17 -0
  63. package/lib/use-shrinkable-Cu9JQZll.cjs +1 -0
  64. package/package.json +25 -10
  65. package/src/accordion-fieldset.vue +4 -35
  66. package/src/accordion-section.vue +194 -0
  67. package/src/components.ts +3 -0
  68. package/src/internal/use-shrinkable.ts +37 -0
  69. package/src/label-icon.vue +2 -2
  70. package/src/page-section.vue +103 -0
  71. package/src/page-title.vue +56 -0
  72. package/src/tab-content.vue +7 -7
  73. package/src/tab-group.vue +15 -15
  74. package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-Cod0KnrE.cjs +0 -1
  75. package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-Dk5Id0dl.js +0 -79
  76. package/lib/components-CvmuAs2C.cjs +0 -1
  77. package/lib/components-p1BluzXb.js +0 -18
package/lib/nuxt.d.cts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * コンポーネントをNuxtのコンポーネント自動importへ登録するモジュール。
3
+ * グローバル登録(registerComponents)と違い、テンプレートで使ったコンポーネントだけがバンドルされ、
4
+ * 型は Nuxt が .nuxt/components.d.ts へ生成するため、利用側に型定義は要らない。
5
+ *
6
+ * 名前の一覧を得るためだけに ./components をimportしている。
7
+ * このモジュールはビルド時にNuxtが読み込むもので、アプリの実行時バンドルには入らない
8
+ */
9
+ declare const _default: import('@nuxt/schema').NuxtModule<import('@nuxt/schema').ModuleOptions, import('@nuxt/schema').ModuleOptions, false>;
10
+ export default _default;
package/lib/nuxt.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineNuxtModule as t, createResolver as r, addComponent as n } from "@nuxt/kit";
2
- import { c as a } from "./components-p1BluzXb.js";
2
+ import { c as a } from "./components-DBK8NUBh.js";
3
3
  const c = t({
4
4
  meta: {
5
5
  name: "@digitalwalletcorp/vue-core",
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./page-section.vue_vue_type_style_index_0_lang-DEAkTLxd.cjs");exports.default=e._sfc_main;
@@ -0,0 +1,34 @@
1
+ import { ClassValue, StyleValue } from 'vue';
2
+ /** 見出しのアイコンとして選べるもの */
3
+ type PageSectionIcon = 'diamond' | 'circle' | 'square' | 'pushpin' | 'round-pushpin';
4
+ interface Props {
5
+ /** 見出しの文字。未指定なら見出しを表示しない */
6
+ title?: string;
7
+ /** 見出しのアイコン。これ以外のアイコンは#iconスロットで渡す デフォルト 'diamond' */
8
+ icon?: PageSectionIcon;
9
+ /** diamond・circle・squareの大きさ。未指定ならアイコンの既定値(large) */
10
+ iconVariant?: 'large' | 'medium' | 'small';
11
+ /** diamond・circle・squareの色。未指定ならdiamondは#1a44b6、circleは#e78b2f、squareは#d13a2b */
12
+ iconColor?: string;
13
+ /** 見出しに付けるclass */
14
+ titleClass?: ClassValue;
15
+ /** 見出しに付けるstyle */
16
+ titleStyle?: StyleValue;
17
+ }
18
+ interface Slots {
19
+ /** 見出しの文字の前に表示するアイコン。iconより優先する */
20
+ icon?(): unknown;
21
+ default?(): unknown;
22
+ }
23
+ type __VLS_Slots = Slots;
24
+ declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
25
+ icon: PageSectionIcon;
26
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
27
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
30
+ type __VLS_WithSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,34 @@
1
+ import { ClassValue, StyleValue } from 'vue';
2
+ /** 見出しのアイコンとして選べるもの */
3
+ type PageSectionIcon = 'diamond' | 'circle' | 'square' | 'pushpin' | 'round-pushpin';
4
+ interface Props {
5
+ /** 見出しの文字。未指定なら見出しを表示しない */
6
+ title?: string;
7
+ /** 見出しのアイコン。これ以外のアイコンは#iconスロットで渡す デフォルト 'diamond' */
8
+ icon?: PageSectionIcon;
9
+ /** diamond・circle・squareの大きさ。未指定ならアイコンの既定値(large) */
10
+ iconVariant?: 'large' | 'medium' | 'small';
11
+ /** diamond・circle・squareの色。未指定ならdiamondは#1a44b6、circleは#e78b2f、squareは#d13a2b */
12
+ iconColor?: string;
13
+ /** 見出しに付けるclass */
14
+ titleClass?: ClassValue;
15
+ /** 見出しに付けるstyle */
16
+ titleStyle?: StyleValue;
17
+ }
18
+ interface Slots {
19
+ /** 見出しの文字の前に表示するアイコン。iconより優先する */
20
+ icon?(): unknown;
21
+ default?(): unknown;
22
+ }
23
+ type __VLS_Slots = Slots;
24
+ declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
25
+ icon: PageSectionIcon;
26
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
27
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
28
+ declare const _default: typeof __VLS_export;
29
+ export default _default;
30
+ type __VLS_WithSlots<T, S> = T & {
31
+ new (): {
32
+ $slots: S;
33
+ };
34
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./page-section.vue_vue_type_style_index_0_lang-DpVQe_rV.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),n=require("@digitalwalletcorp/vue-svg-icons"),r=require("./label-icon.vue_vue_type_style_index_0_lang-D9Cimu20.cjs"),a={class:"dwui-page-section"},i={class:"dwui-page-section-content"},p=e.defineComponent({__name:"page-section",props:{title:{},icon:{default:"diamond"},iconVariant:{},iconColor:{},titleClass:{type:[Boolean,null,String,Object,Array]},titleStyle:{type:[Boolean,null,String,Object,Array]}},setup(l){const o=l,s={diamond:{component:n.SvgDiamond,shape:!0,color:"#1a44b6"},circle:{component:n.SvgCircle,shape:!0,color:"#e78b2f"},square:{component:n.SvgSquare,shape:!0,color:"#d13a2b"},pushpin:{component:n.SvgPushpin,shape:!1},"round-pushpin":{component:n.SvgRoundPushpin,shape:!1}},c=e.computed(()=>{const t=s[o.icon];return{component:t.component,props:t.shape?{variant:o.iconVariant,color:o.iconColor??t.color}:{}}});return(t,u)=>(e.openBlock(),e.createElementBlock("section",a,[o.title!=null?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["dwui-page-section-title",o.titleClass]),style:e.normalizeStyle(o.titleStyle)},[e.createVNode(r._sfc_main,null,{icon:e.withCtx(()=>[e.renderSlot(t.$slots,"icon",{},()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value.component),e.normalizeProps(e.guardReactiveProps(c.value.props)),null,16))])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(o.title),1)]),_:3})],6)):e.createCommentVNode("",!0),e.createElementVNode("div",i,[e.renderSlot(t.$slots,"default")])]))}});exports._sfc_main=p;
@@ -0,0 +1,54 @@
1
+ import { defineComponent as i, computed as p, openBlock as t, createElementBlock as r, normalizeStyle as m, normalizeClass as u, createVNode as d, withCtx as a, createTextVNode as S, toDisplayString as h, renderSlot as l, createBlock as _, resolveDynamicComponent as g, normalizeProps as f, guardReactiveProps as v, createCommentVNode as y, createElementVNode as C } from "vue";
2
+ import { SvgRoundPushpin as V, SvgPushpin as b, SvgSquare as B, SvgCircle as N, SvgDiamond as P } from "@digitalwalletcorp/vue-svg-icons";
3
+ import { _ as k } from "./label-icon.vue_vue_type_style_index_0_lang-me52HE2V.js";
4
+ const w = { class: "dwui-page-section" }, E = { class: "dwui-page-section-content" }, $ = /* @__PURE__ */ i({
5
+ __name: "page-section",
6
+ props: {
7
+ title: {},
8
+ icon: { default: "diamond" },
9
+ iconVariant: {},
10
+ iconColor: {},
11
+ titleClass: { type: [Boolean, null, String, Object, Array] },
12
+ titleStyle: { type: [Boolean, null, String, Object, Array] }
13
+ },
14
+ setup(s) {
15
+ const e = s, c = {
16
+ diamond: { component: P, shape: !0, color: "#1a44b6" },
17
+ circle: { component: N, shape: !0, color: "#e78b2f" },
18
+ square: { component: B, shape: !0, color: "#d13a2b" },
19
+ pushpin: { component: b, shape: !1 },
20
+ "round-pushpin": { component: V, shape: !1 }
21
+ }, n = p(() => {
22
+ const o = c[e.icon];
23
+ return {
24
+ component: o.component,
25
+ props: o.shape ? { variant: e.iconVariant, color: e.iconColor ?? o.color } : {}
26
+ };
27
+ });
28
+ return (o, z) => (t(), r("section", w, [
29
+ e.title != null ? (t(), r("div", {
30
+ key: 0,
31
+ class: u(["dwui-page-section-title", e.titleClass]),
32
+ style: m(e.titleStyle)
33
+ }, [
34
+ d(k, null, {
35
+ icon: a(() => [
36
+ l(o.$slots, "icon", {}, () => [
37
+ (t(), _(g(n.value.component), f(v(n.value.props)), null, 16))
38
+ ])
39
+ ]),
40
+ default: a(() => [
41
+ S(" " + h(e.title), 1)
42
+ ]),
43
+ _: 3
44
+ })
45
+ ], 6)) : y("", !0),
46
+ C("div", E, [
47
+ l(o.$slots, "default")
48
+ ])
49
+ ]));
50
+ }
51
+ });
52
+ export {
53
+ $ as _
54
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./page-title.vue_vue_type_style_index_0_lang-BqIsIks5.cjs");exports.default=e._sfc_main;
@@ -0,0 +1,20 @@
1
+ interface Props {
2
+ /** タイトルの文字 */
3
+ title: string;
4
+ }
5
+ interface Slots {
6
+ /** タイトルの文字の前に表示するアイコン */
7
+ icon?(): unknown;
8
+ /** タイトルバーの右側に表示する内容 */
9
+ default?(): unknown;
10
+ }
11
+ type __VLS_Slots = Slots;
12
+ declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,20 @@
1
+ interface Props {
2
+ /** タイトルの文字 */
3
+ title: string;
4
+ }
5
+ interface Slots {
6
+ /** タイトルの文字の前に表示するアイコン */
7
+ icon?(): unknown;
8
+ /** タイトルバーの右側に表示する内容 */
9
+ default?(): unknown;
10
+ }
11
+ type __VLS_Slots = Slots;
12
+ declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./page-title.vue_vue_type_style_index_0_lang-ChZot85K.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("vue"),l=require("./label-icon.vue_vue_type_style_index_0_lang-D9Cimu20.cjs"),c={class:"dwui-page-title"},i={key:0,class:"dwui-page-title-actions"},a=e.defineComponent({__name:"page-title",props:{title:{}},setup(n){const s=n,t=e.useSlots();return(o,r)=>(e.openBlock(),e.createElementBlock("section",c,[e.createVNode(l._sfc_main,{class:"dwui-page-title-label"},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(s.title),1)]),_:2},[t.icon!=null?{name:"icon",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"icon")]),key:"0"}:void 0]),1024),t.default!=null?(e.openBlock(),e.createElementBlock("span",i,[e.renderSlot(o.$slots,"default")])):e.createCommentVNode("",!0)]))}});exports._sfc_main=a;
@@ -0,0 +1,36 @@
1
+ import { defineComponent as c, useSlots as r, openBlock as o, createElementBlock as s, createVNode as p, createSlots as d, withCtx as l, createTextVNode as u, toDisplayString as _, renderSlot as n, createCommentVNode as m } from "vue";
2
+ import { _ as f } from "./label-icon.vue_vue_type_style_index_0_lang-me52HE2V.js";
3
+ const g = { class: "dwui-page-title" }, h = {
4
+ key: 0,
5
+ class: "dwui-page-title-actions"
6
+ }, y = /* @__PURE__ */ c({
7
+ __name: "page-title",
8
+ props: {
9
+ title: {}
10
+ },
11
+ setup(a) {
12
+ const i = a, e = r();
13
+ return (t, k) => (o(), s("section", g, [
14
+ p(f, { class: "dwui-page-title-label" }, d({
15
+ default: l(() => [
16
+ u(" " + _(i.title), 1)
17
+ ]),
18
+ _: 2
19
+ }, [
20
+ e.icon != null ? {
21
+ name: "icon",
22
+ fn: l(() => [
23
+ n(t.$slots, "icon")
24
+ ]),
25
+ key: "0"
26
+ } : void 0
27
+ ]), 1024),
28
+ e.default != null ? (o(), s("span", h, [
29
+ n(t.$slots, "default")
30
+ ])) : m("", !0)
31
+ ]));
32
+ }
33
+ });
34
+ export {
35
+ y as _
36
+ };
package/lib/register.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components-CvmuAs2C.cjs");function r(e){for(const[o,n]of Object.entries(t.components))e.component(o,n)}exports.registerComponents=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components-CNOeuZPu.cjs");function r(e){for(const[o,n]of Object.entries(t.components))e.component(o,n)}exports.registerComponents=r;
@@ -0,0 +1,9 @@
1
+ import { App } from 'vue';
2
+ import * as components from './components.cjs';
3
+ type VueCoreComponents = typeof components;
4
+ declare module 'vue' {
5
+ interface GlobalComponents extends VueCoreComponents {
6
+ }
7
+ }
8
+ export declare function registerComponents(app: App): void;
9
+ export {};
package/lib/register.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as t } from "./components-p1BluzXb.js";
1
+ import { c as t } from "./components-DBK8NUBh.js";
2
2
  function m(o) {
3
3
  for (const [n, e] of Object.entries(t))
4
4
  o.component(n, e);
package/lib/style.css CHANGED
@@ -1 +1 @@
1
- :where(.dwui-label-icon){display:inline-block}:where(.dwui-label-icon>.dwui-label){display:inline-block}:where(.dwui-label-icon>.dwui-label:not(:first-child)){margin-left:var(--dwui-label-icon-gap, .25em)}:where(.dwui-accordion-fieldset){position:relative}:where(.dwui-accordion-toggle){display:inline-flex;align-items:center;gap:4px;margin-left:4px;padding:0;border:none;background:none;color:inherit;cursor:pointer}:where(.dwui-accordion-toggle:disabled){opacity:.6;cursor:not-allowed}:where(.dwui-accordion-contents){position:relative;width:fit-content;padding:2px;overflow:hidden;opacity:1}:where(.dwui-accordion-contents.dwui-expanded){transition:all .3s linear}:where(.dwui-accordion-contents.dwui-shrunk){height:auto;max-height:70px;opacity:.75;transition:all .3s linear}:where(.dwui-hourglass-loading){animation:dwui-hourglass-loading-spin 1.2s linear infinite}@keyframes dwui-hourglass-loading-spin{to{transform:rotate(360deg)}}:where(.dwui-tab-content[aria-checked=false]){display:none}:where(.dwui-tab-content[aria-checked=true]){display:block;position:relative;padding:4px 8px;overflow:hidden;animation:dwui-tab-slide-in var(--dwui-tab-slide-duration, .35s) var(--dwui-tab-slide-easing, cubic-bezier(.22, 1, .36, 1))}:where(.dwui-tab-loading){position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:var(--dwui-loading-overlay, rgba(0, 0, 0, .25))}:where(.dwui-tab-loading-spinner){width:var(--dwui-loading-spinner-size, 40px);height:var(--dwui-loading-spinner-size, 40px);border:4px solid var(--dwui-loading-spinner-track, rgba(255, 255, 255, .4));border-top-color:var(--dwui-loading-spinner-color, #ffffff);border-radius:50%;animation:dwui-tab-loading-spin .8s linear infinite}@keyframes dwui-tab-loading-spin{to{transform:rotate(360deg)}}@keyframes dwui-tab-slide-in{0%{opacity:0;transform:translate(var(--dwui-tab-slide-distance, -128px))}to{opacity:1;transform:translate(0)}}:where(.dwui-tab-group){margin-bottom:8px}:where(.dwui-tab-headers){display:flex;flex-direction:row;flex-wrap:wrap;margin-top:5px;padding-bottom:4px}:where(.dwui-tab-radio){display:none}:where(.dwui-tab-item){display:block;min-width:100px;padding:0 4px;border:1px solid var(--dwui-tab-border, #565656);border-bottom:1px solid var(--dwui-tab-header-accent, #5ab4bd);background:var(--dwui-tab-header-bg, linear-gradient(#1313c7, navy));line-height:2em;text-align:center;white-space:nowrap;color:var(--dwui-tab-header-text, azure);text-overflow:ellipsis;cursor:pointer;transition:all .2s ease}:where(.dwui-tab-radio:checked+.dwui-tab-item){background:var(--dwui-tab-header-selected-bg, linear-gradient(#1313c7, rgb(149, 149, 234), #1313c7));color:var(--dwui-tab-header-selected-text, azure);cursor:default}:where(.dwui-tab-radio:disabled+.dwui-tab-item){background:var(--dwui-tab-header-disabled-bg, gray);cursor:not-allowed}:where(.dwui-tab-item.dwui-tab-warn){background:var(--dwui-tab-header-warn-bg, #efef13);color:var(--dwui-tab-header-warn-text, midnightblue)}:where(.dwui-tab-radio:checked+.dwui-tab-item.dwui-tab-warn){background:var(--dwui-tab-header-warn-selected-bg, linear-gradient(#fafa06, rgb(232, 238, 206), #fafa06))}:where(.dwui-tab-item.dwui-tab-error){background:var(--dwui-tab-header-error-bg, red);color:var(--dwui-tab-header-error-text, azure)}:where(.dwui-tab-radio:checked+.dwui-tab-item.dwui-tab-error){background:var(--dwui-tab-header-error-selected-bg, linear-gradient(#ff0000, rgb(240, 136, 136), #ff0000))}:where(.dwui-tab-radio:not(:checked)+.dwui-tab-item:hover){box-shadow:inset 0 0 0 999px var(--dwui-tab-header-hover-overlay, rgba(255, 255, 255, .35))}:where(.dwui-tab-items){height:100%;border:1px solid var(--dwui-tab-border, #565656);overflow:hidden}
1
+ :where(.dwui-label-icon){display:inline-block}:where(.dwui-label-icon>.dwui-label){display:inline-block}:where(.dwui-label-icon>.dwui-label:not(:first-child)){margin-left:var(--dwui-gap-label-icon, .25em)}:where(.dwui-accordion-fieldset){position:relative}:where(.dwui-accordion-toggle){display:inline-flex;align-items:center;gap:4px;margin-left:4px;padding:0;border:none;background:none;color:inherit;cursor:pointer}:where(.dwui-accordion-toggle:disabled){opacity:.6;cursor:not-allowed}:where(.dwui-accordion-contents){position:relative;width:fit-content;padding:2px;overflow:hidden;opacity:1}:where(.dwui-accordion-contents.dwui-expanded){transition:all .3s linear}:where(.dwui-accordion-contents.dwui-shrunk){height:auto;max-height:70px;opacity:.75;transition:all .3s linear}:where(.dwui-accordion-section){position:relative}:where(.dwui-accordion-section-contents){position:relative;width:fit-content;overflow:hidden}:where(.dwui-accordion-section-contents.dwui-expanded){transition:all .3s linear}:where(.dwui-accordion-section-contents.dwui-shrunk){height:auto;max-height:70px;transition:all .3s linear}:where(.dwui-accordion-section-contents.dwui-shrunk:not(.dwui-no-gradient)):after{content:"";position:absolute;inset:0;background-image:linear-gradient(180deg,transparent 0%,transparent 60%,var(--dwui-color-accordion-section-fade, Canvas) 100%);pointer-events:none}:where(.dwui-accordion-section-control){position:relative;display:flex;justify-content:center;width:100%}:where(.dwui-accordion-section-toggle){display:inline-flex;align-items:center;cursor:pointer}:where(.dwui-accordion-section-toggle:disabled){opacity:.6;cursor:not-allowed}:where(.dwui-accordion-section-toggle[aria-expanded=true]){margin-top:8px}:where(.dwui-accordion-section-toggle[aria-expanded=false]){margin-top:-10px}:where(.dwui-hourglass-loading){animation:dwui-hourglass-loading-spin 1.2s linear infinite}@keyframes dwui-hourglass-loading-spin{to{transform:rotate(360deg)}}:where(.dwui-page-section){display:block;margin:4px 0 8px;padding-top:2px;font-size:var(--dwui-font-size-page-section, 12px);font-weight:500}:where(.dwui-page-section-title){display:flex;align-items:center;font-size:var(--dwui-font-size-page-section-title, 14px)}:where(.dwui-page-section-content){margin:8px 0 8px 16px}:where(.dwui-page-title){display:flex;align-items:center;justify-content:space-between;width:var(--dwui-width-page-title, auto);padding:4px;border-radius:4px;background:var(--dwui-background-page-title, linear-gradient(#323232 0%, rgb(32, 32, 31) 25%, rgb(32, 32, 31) 75%, #323232 100%));color:var(--dwui-color-text-page-title, rgb(220, 220, 220));font-size:var(--dwui-font-size-page-title, 14px);font-weight:var(--dwui-font-weight-page-title, normal)}:where(.dwui-tab-content[aria-checked=false]){display:none}:where(.dwui-tab-content[aria-checked=true]){display:block;position:relative;padding:4px 8px;overflow:hidden;animation:dwui-tab-slide-in var(--dwui-duration-tab-slide, .35s) var(--dwui-easing-tab-slide, cubic-bezier(.22, 1, .36, 1))}:where(.dwui-tab-loading){position:absolute;inset:0;z-index:1;display:flex;align-items:center;justify-content:center;background:var(--dwui-overlay-color-loading, rgba(0, 0, 0, .25))}:where(.dwui-tab-loading-spinner){width:var(--dwui-size-loading-spinner, 40px);height:var(--dwui-size-loading-spinner, 40px);border:4px solid var(--dwui-border-color-loading-spinner-track, rgba(255, 255, 255, .4));border-top-color:var(--dwui-border-color-loading-spinner, #ffffff);border-radius:50%;animation:dwui-tab-loading-spin .8s linear infinite}@keyframes dwui-tab-loading-spin{to{transform:rotate(360deg)}}@keyframes dwui-tab-slide-in{0%{opacity:0;transform:translate(var(--dwui-distance-tab-slide, -128px))}to{opacity:1;transform:translate(0)}}:where(.dwui-tab-group){margin-bottom:8px}:where(.dwui-tab-headers){display:flex;flex-direction:row;flex-wrap:wrap;margin-top:5px;padding-bottom:4px}:where(.dwui-tab-radio){display:none}:where(.dwui-tab-item){display:block;min-width:100px;padding:0 4px;border:1px solid var(--dwui-border-color-tab, #565656);border-bottom:1px solid var(--dwui-border-color-tab-header-accent, #5ab4bd);background:var(--dwui-background-tab-header, linear-gradient(#1313c7, navy));line-height:2em;text-align:center;white-space:nowrap;color:var(--dwui-color-text-tab-header, azure);text-overflow:ellipsis;cursor:pointer;transition:all .2s ease}:where(.dwui-tab-radio:checked+.dwui-tab-item){background:var(--dwui-background-tab-header-selected, linear-gradient(#1313c7, rgb(149, 149, 234), #1313c7));color:var(--dwui-color-text-tab-header-selected, azure);cursor:default}:where(.dwui-tab-radio:disabled+.dwui-tab-item){background:var(--dwui-background-tab-header-disabled, gray);cursor:not-allowed}:where(.dwui-tab-item.dwui-tab-warn){background:var(--dwui-background-tab-header-warn, #efef13);color:var(--dwui-color-text-tab-header-warn, midnightblue)}:where(.dwui-tab-radio:checked+.dwui-tab-item.dwui-tab-warn){background:var(--dwui-background-tab-header-warn-selected, linear-gradient(#fafa06, rgb(232, 238, 206), #fafa06))}:where(.dwui-tab-item.dwui-tab-error){background:var(--dwui-background-tab-header-error, red);color:var(--dwui-color-text-tab-header-error, azure)}:where(.dwui-tab-radio:checked+.dwui-tab-item.dwui-tab-error){background:var(--dwui-background-tab-header-error-selected, linear-gradient(#ff0000, rgb(240, 136, 136), #ff0000))}:where(.dwui-tab-radio:not(:checked)+.dwui-tab-item:hover){box-shadow:inset 0 0 0 999px var(--dwui-overlay-color-tab-header-hover, rgba(255, 255, 255, .35))}:where(.dwui-tab-items){height:100%;border:1px solid var(--dwui-border-color-tab, #565656);overflow:hidden}
@@ -0,0 +1,39 @@
1
+ import { ClassValue, StyleValue } from 'vue';
2
+ import { TabContentStatus } from './internal/tab-group-context.cjs';
3
+ interface Props {
4
+ /** タブを識別するID。TabGroupのselectedTabLabelIdに渡す値 */
5
+ labelId: string;
6
+ /** タブの見出しの文字 */
7
+ description: string;
8
+ /** trueの場合、タブを選べなくし、中身も描画しない */
9
+ disabled?: boolean;
10
+ /** タブの見出しの状態。見出しの色が変わる */
11
+ status?: TabContentStatus;
12
+ /** タブの見出しに付けるclass */
13
+ headerClass?: ClassValue;
14
+ /** タブの見出しに付けるstyle */
15
+ headerStyle?: StyleValue;
16
+ }
17
+ interface Slots {
18
+ /** タブの見出しの文字の前に表示するアイコン */
19
+ icon?(): unknown;
20
+ /**
21
+ * タブの中身
22
+ * activated: タブが選ばれて表示されている間はtrue。中身のコンポーネントにpropsで渡し、選ばれたときの処理の契機にする
23
+ * setLoading: trueを渡すと読み込み中の表示にする。表示はTabGroupの#loadingスロット、未指定なら既定の表示
24
+ */
25
+ default?(props: {
26
+ activated: boolean;
27
+ setLoading: (loading: boolean) => void;
28
+ }): unknown;
29
+ }
30
+ type __VLS_Slots = Slots;
31
+ declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
32
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
33
+ declare const _default: typeof __VLS_export;
34
+ export default _default;
35
+ type __VLS_WithSlots<T, S> = T & {
36
+ new (): {
37
+ $slots: S;
38
+ };
39
+ };
package/lib/tab-group.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tab-group.vue_vue_type_style_index_0_lang-CwVGYZAo.cjs");exports.default=e._sfc_main;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tab-group.vue_vue_type_style_index_0_lang-CMaufRJV.cjs");exports.default=e._sfc_main;
@@ -0,0 +1,44 @@
1
+ import { ClassValue, StyleValue, VNode } from 'vue';
2
+ interface Props {
3
+ /** ラジオボタンのname。未指定なら自動で採番する */
4
+ tabGroupName?: string;
5
+ /** selectedTabLabelIdが未指定のとき、trueならdisabledでない最初のタブを選ぶ。falseなら先頭のタブ(disabledなら中身は空になる) */
6
+ selectFirstEnabled?: boolean;
7
+ /** タブの見出しを並べる部分に付けるclass */
8
+ headerClass?: ClassValue;
9
+ /** タブの見出しを並べる部分に付けるstyle */
10
+ headerStyle?: StyleValue;
11
+ /** タブの見出しを移動する先(Teleportのto) */
12
+ teleport?: string;
13
+ }
14
+ type __VLS_Props = Props;
15
+ interface Slots {
16
+ default?(): VNode[];
17
+ /** 読み込み中のTabContentに重ねて表示する内容。未指定なら既定の読み込み中表示 */
18
+ loading?(): VNode[];
19
+ }
20
+ type __VLS_Slots = Slots;
21
+ type __VLS_ModelProps = {
22
+ /**
23
+ * 選択するタブのlabelId。未指定なら先頭のタブ
24
+ * 親がいつ代入しても選び直せるよう、v-model:selected-tab-label-idで同期する前提とする
25
+ */
26
+ 'selectedTabLabelId'?: string;
27
+ };
28
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
29
+ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
30
+ "update:selectedTabLabelId": (value: string | undefined) => any;
31
+ } & {
32
+ "emit:changeSelectedTab": (labelId: string) => any;
33
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
34
+ "onEmit:changeSelectedTab"?: ((labelId: string) => any) | undefined;
35
+ "onUpdate:selectedTabLabelId"?: ((value: string | undefined) => any) | undefined;
36
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
37
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
38
+ declare const _default: typeof __VLS_export;
39
+ export default _default;
40
+ type __VLS_WithSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
package/lib/tab-group.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./tab-group.vue_vue_type_style_index_0_lang-CjnBkvvZ.js";
1
+ import { _ as f } from "./tab-group.vue_vue_type_style_index_0_lang-C84mDEOC.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as L, useModel as B, useSlots as N, useId as x, computed as y, ref as A, provide as E, onMounted as M, openBlock as s, createElementBlock as i, createBlock as _, Teleport as F, createElementVNode as o, normalizeStyle as v, normalizeClass as g, Fragment as S, renderList as G, unref as c, createVNode as V, createSlots as j, withCtx as I, createTextVNode as z, toDisplayString as D, resolveDynamicComponent as O, renderSlot as H, mergeModels as C } from "vue";
2
- import { _ as K } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
2
+ import { _ as K } from "./label-icon.vue_vue_type_style_index_0_lang-me52HE2V.js";
3
3
  import { t as P, _ as q } from "./tab-content.vue_vue_type_style_index_0_lang-CcQLHmIF.js";
4
4
  const J = { class: "dwui-tab-group" }, Q = ["id", "name", "disabled", "checked", "onChange"], R = ["for", "data-test-tab-content-control"], U = { class: "dwui-tab-items" }, Z = /* @__PURE__ */ L({
5
5
  __name: "tab-group",
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),v=require("./label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.cjs"),m=require("./tab-content.vue_vue_type_style_index_0_lang-BeCi7Xkp.cjs"),g={class:"dwui-tab-group"},S=["id","name","disabled","checked","onChange"],C=["for","data-test-tab-content-control"],I={class:"dwui-tab-items"},k=e.defineComponent({__name:"tab-group",props:e.mergeModels({tabGroupName:{},selectFirstEnabled:{type:Boolean},headerClass:{type:[Boolean,null,String,Object,Array]},headerStyle:{type:[Boolean,null,String,Object,Array]},teleport:{}},{selectedTabLabelId:{},selectedTabLabelIdModifiers:{}}),emits:e.mergeModels(["emit:changeSelectedTab"],["update:selectedTabLabelId"]),setup(r,{emit:h}){const n=r,_=h,o=e.useModel(r,"selectedTabLabelId"),c=e.useSlots(),s=n.tabGroupName??e.useId(),y=a=>{if(a.type!==m._sfc_main)return;const l=a.props??{},t=l.disabled;return{labelId:String(l["label-id"]??l.labelId),description:l.description,disabled:t===""||!!t,status:l.status,headerClass:l["header-class"]??l.headerClass,headerStyle:l["header-style"]??l.headerStyle,icon:a.children?.icon}},d=e.computed(()=>{const a=[];for(const l of c.default?.()??[]){const t=Array.isArray(l.children)?l.children:[l];for(const b of t){const p=y(b);p&&a.push(p)}}return a}),i=e.computed(()=>o.value!=null?o.value:(n.selectFirstEnabled?d.value.find(l=>!l.disabled):d.value[0])?.labelId),u=e.ref(!1);e.provide(m.tabGroupContextKey,{activeLabelId:i,mounted:u,loadingSlot:()=>c.loading}),e.onMounted(()=>{u.value=!0});const f=a=>{o.value=a,_("emit:changeSelectedTab",a)};return(a,l)=>(e.openBlock(),e.createElementBlock("div",g,[(e.openBlock(),e.createBlock(e.Teleport,{to:n.teleport??"body",disabled:n.teleport==null},[e.createElementVNode("div",{class:e.normalizeClass(["dwui-tab-headers",n.headerClass]),style:e.normalizeStyle(n.headerStyle)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.labelId},[e.createElementVNode("input",{id:`${e.unref(s)}-${t.labelId}`,type:"radio",class:"dwui-tab-radio",name:e.unref(s),disabled:t.disabled,checked:t.labelId===i.value,onChange:b=>f(t.labelId)},null,40,S),e.createElementVNode("label",{for:`${e.unref(s)}-${t.labelId}`,class:e.normalizeClass(["dwui-tab-item",[t.status!=null?`dwui-tab-${t.status}`:void 0,t.headerClass]]),style:e.normalizeStyle(t.headerStyle),"data-test-tab-content-control":t.labelId},[e.createVNode(v._sfc_main,null,e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.description),1)]),_:2},[t.icon!=null?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon)))]),key:"0"}:void 0]),1024)],14,C)],64))),128))],6)],8,["to","disabled"])),e.createElementVNode("div",I,[e.renderSlot(a.$slots,"default")])]))}});exports._sfc_main=k;
1
+ "use strict";const e=require("vue"),v=require("./label-icon.vue_vue_type_style_index_0_lang-D9Cimu20.cjs"),m=require("./tab-content.vue_vue_type_style_index_0_lang-BeCi7Xkp.cjs"),g={class:"dwui-tab-group"},S=["id","name","disabled","checked","onChange"],C=["for","data-test-tab-content-control"],I={class:"dwui-tab-items"},k=e.defineComponent({__name:"tab-group",props:e.mergeModels({tabGroupName:{},selectFirstEnabled:{type:Boolean},headerClass:{type:[Boolean,null,String,Object,Array]},headerStyle:{type:[Boolean,null,String,Object,Array]},teleport:{}},{selectedTabLabelId:{},selectedTabLabelIdModifiers:{}}),emits:e.mergeModels(["emit:changeSelectedTab"],["update:selectedTabLabelId"]),setup(r,{emit:h}){const n=r,_=h,o=e.useModel(r,"selectedTabLabelId"),c=e.useSlots(),s=n.tabGroupName??e.useId(),y=a=>{if(a.type!==m._sfc_main)return;const l=a.props??{},t=l.disabled;return{labelId:String(l["label-id"]??l.labelId),description:l.description,disabled:t===""||!!t,status:l.status,headerClass:l["header-class"]??l.headerClass,headerStyle:l["header-style"]??l.headerStyle,icon:a.children?.icon}},d=e.computed(()=>{const a=[];for(const l of c.default?.()??[]){const t=Array.isArray(l.children)?l.children:[l];for(const b of t){const p=y(b);p&&a.push(p)}}return a}),i=e.computed(()=>o.value!=null?o.value:(n.selectFirstEnabled?d.value.find(l=>!l.disabled):d.value[0])?.labelId),u=e.ref(!1);e.provide(m.tabGroupContextKey,{activeLabelId:i,mounted:u,loadingSlot:()=>c.loading}),e.onMounted(()=>{u.value=!0});const f=a=>{o.value=a,_("emit:changeSelectedTab",a)};return(a,l)=>(e.openBlock(),e.createElementBlock("div",g,[(e.openBlock(),e.createBlock(e.Teleport,{to:n.teleport??"body",disabled:n.teleport==null},[e.createElementVNode("div",{class:e.normalizeClass(["dwui-tab-headers",n.headerClass]),style:e.normalizeStyle(n.headerStyle)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.labelId},[e.createElementVNode("input",{id:`${e.unref(s)}-${t.labelId}`,type:"radio",class:"dwui-tab-radio",name:e.unref(s),disabled:t.disabled,checked:t.labelId===i.value,onChange:b=>f(t.labelId)},null,40,S),e.createElementVNode("label",{for:`${e.unref(s)}-${t.labelId}`,class:e.normalizeClass(["dwui-tab-item",[t.status!=null?`dwui-tab-${t.status}`:void 0,t.headerClass]]),style:e.normalizeStyle(t.headerStyle),"data-test-tab-content-control":t.labelId},[e.createVNode(v._sfc_main,null,e.createSlots({default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.description),1)]),_:2},[t.icon!=null?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon)))]),key:"0"}:void 0]),1024)],14,C)],64))),128))],6)],8,["to","disabled"])),e.createElementVNode("div",I,[e.renderSlot(a.$slots,"default")])]))}});exports._sfc_main=k;
@@ -0,0 +1,12 @@
1
+ import { Component } from 'vue';
2
+ /**
3
+ * アイコンとラベルの組み合わせ
4
+ */
5
+ export interface LabelPreset {
6
+ /** アイコンのコンポーネント */
7
+ icon: Component;
8
+ /** アイコンに渡すProps */
9
+ iconProps?: Record<string, unknown>;
10
+ /** ラベル。言語切替に追従させる場合は、描画のたびに呼ばれる関数で渡す */
11
+ label: string | (() => string);
12
+ }
@@ -0,0 +1,17 @@
1
+ import { ref as t, onMounted as s, onBeforeUnmount as u } from "vue";
2
+ const l = 70;
3
+ function c(o) {
4
+ const r = t(!0);
5
+ let e;
6
+ return s(() => {
7
+ const n = o.value;
8
+ n != null && (e = new ResizeObserver(() => {
9
+ r.value = l <= n.scrollHeight;
10
+ }), e.observe(n));
11
+ }), u(() => {
12
+ e?.disconnect();
13
+ }), r;
14
+ }
15
+ export {
16
+ c as u
17
+ };
@@ -0,0 +1 @@
1
+ "use strict";const r=require("vue"),u=70;function o(t){const s=r.ref(!0);let e;return r.onMounted(()=>{const n=t.value;n!=null&&(e=new ResizeObserver(()=>{s.value=u<=n.scrollHeight}),e.observe(n))}),r.onBeforeUnmount(()=>{e?.disconnect()}),s}exports.useShrinkable=o;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitalwalletcorp/vue-core",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "description": "Basic UI components for Vue 3",
6
6
  "main": "lib/index.cjs",
@@ -11,27 +11,42 @@
11
11
  ],
12
12
  "exports": {
13
13
  ".": {
14
- "types": "./lib/index.d.ts",
15
- "import": "./lib/index.js",
16
- "require": "./lib/index.cjs"
14
+ "import": {
15
+ "types": "./lib/index.d.ts",
16
+ "default": "./lib/index.js"
17
+ },
18
+ "require": {
19
+ "types": "./lib/index.d.cts",
20
+ "default": "./lib/index.cjs"
21
+ }
17
22
  },
18
23
  "./nuxt": {
19
24
  "types": "./lib/nuxt.d.ts",
20
25
  "import": "./lib/nuxt.js"
21
26
  },
22
27
  "./register": {
23
- "types": "./lib/register.d.ts",
24
- "import": "./lib/register.js",
25
- "require": "./lib/register.cjs"
28
+ "import": {
29
+ "types": "./lib/register.d.ts",
30
+ "default": "./lib/register.js"
31
+ },
32
+ "require": {
33
+ "types": "./lib/register.d.cts",
34
+ "default": "./lib/register.cjs"
35
+ }
26
36
  },
27
37
  "./global": {
28
38
  "types": "./lib/global.d.ts"
29
39
  },
30
40
  "./style.css": "./lib/style.css",
31
41
  "./*": {
32
- "types": "./lib/*.d.ts",
33
- "import": "./lib/*.js",
34
- "require": "./lib/*.cjs"
42
+ "import": {
43
+ "types": "./lib/*.d.ts",
44
+ "default": "./lib/*.js"
45
+ },
46
+ "require": {
47
+ "types": "./lib/*.d.cts",
48
+ "default": "./lib/*.cjs"
49
+ }
35
50
  }
36
51
  },
37
52
  "scripts": {
@@ -33,7 +33,7 @@
33
33
  </legend>
34
34
  <div
35
35
  ref="refContents"
36
- :class="[ 'dwui-accordion-contents', pageContext.expandable ? pageContext.expanded ? 'dwui-expanded' : 'dwui-shrunk' : '' ]"
36
+ :class="[ 'dwui-accordion-contents', shrinkable ? pageContext.expanded ? 'dwui-expanded' : 'dwui-shrunk' : '' ]"
37
37
  >
38
38
  <slot />
39
39
  </div>
@@ -41,12 +41,10 @@
41
41
  </template>
42
42
 
43
43
  <script setup lang="ts">
44
- import { onMounted, reactive, ref, watch } from 'vue';
44
+ import { onMounted, reactive, ref } from 'vue';
45
45
  import { SvgTriangleButton } from '@digitalwalletcorp/vue-svg-icons';
46
46
  import LabelIcon from '@/label-icon.vue';
47
-
48
- /** 縮めたときの中身の高さ(px)。中身がこれより低い場合は開閉しない */
49
- const SHRUNK_HEIGHT = 70;
47
+ import { useShrinkable } from '@/internal/use-shrinkable';
50
48
 
51
49
  interface Props {
52
50
  /** 凡例の文字。HTMLを含める場合は#legendスロットを使う */
@@ -55,8 +53,6 @@ interface Props {
55
53
  disabled?: boolean;
56
54
  /** trueの場合、開いた状態で表示する デフォルト false */
57
55
  initialExpand?: boolean;
58
- /** 変化したときに、中身の高さを測り直して開閉できるかを判定し直す値 */
59
- observer?: unknown;
60
56
  }
61
57
  const props = defineProps<Props>();
62
58
 
@@ -71,43 +67,16 @@ const slots = defineSlots<Slots>();
71
67
 
72
68
  const refContents = ref<HTMLElement>();
73
69
  const pageContext = reactive({
74
- expandable: true,
75
70
  expanded: true
76
71
  });
72
+ const shrinkable = useShrinkable(refContents);
77
73
 
78
74
  const onClickToggle = () => {
79
75
  pageContext.expanded = !pageContext.expanded;
80
- pageContext.expandable = checkExpandable();
81
- };
82
-
83
- /**
84
- * 中身が縮めたときの高さ以上あり、開閉できるかを返す
85
- *
86
- * @returns {boolean}
87
- */
88
- const checkExpandable = (): boolean => {
89
- if (refContents.value) {
90
- const rect = refContents.value.getBoundingClientRect();
91
- return SHRUNK_HEIGHT <= rect.height;
92
- }
93
- return false;
94
76
  };
95
77
 
96
78
  onMounted(() => {
97
79
  pageContext.expanded = !!props.initialExpand;
98
- if (props.observer) {
99
- pageContext.expandable = checkExpandable();
100
- }
101
- });
102
-
103
- watch(() => props.observer, (newValue: unknown) => {
104
- if (newValue) {
105
- pageContext.expandable = checkExpandable();
106
- }
107
- }, {
108
- deep: true,
109
- // 高さの計測はDOM反映後に行う
110
- flush: 'post'
111
80
  });
112
81
  </script>
113
82