@digitalwalletcorp/vue-core 1.0.1 → 1.1.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.
- package/README.md +3 -0
- package/lib/accordion-fieldset.cjs +1 -1
- package/lib/accordion-fieldset.d.ts +0 -2
- package/lib/accordion-fieldset.js +1 -1
- package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-Dd8HXuVm.cjs +1 -0
- package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-tzJhLHyT.js +66 -0
- package/lib/accordion-section.cjs +1 -0
- package/lib/accordion-section.d.ts +34 -0
- package/lib/accordion-section.js +4 -0
- package/lib/accordion-section.vue_vue_type_style_index_0_lang-BBEywIH3.cjs +1 -0
- package/lib/accordion-section.vue_vue_type_style_index_0_lang-DAlUN0wH.js +78 -0
- package/lib/components-YAonMRcW.cjs +1 -0
- package/lib/components-xNQBXMzx.js +24 -0
- package/lib/components.d.ts +3 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +18 -12
- package/lib/internal/use-shrinkable.d.ts +12 -0
- package/lib/nuxt.cjs +1 -1
- package/lib/nuxt.js +1 -1
- package/lib/page-section.cjs +1 -0
- package/lib/page-section.d.ts +34 -0
- package/lib/page-section.js +4 -0
- package/lib/page-section.vue_vue_type_style_index_0_lang-4MLb_sDZ.js +54 -0
- package/lib/page-section.vue_vue_type_style_index_0_lang-bvQeBjUP.cjs +1 -0
- package/lib/page-title.cjs +1 -0
- package/lib/page-title.d.ts +20 -0
- package/lib/page-title.js +4 -0
- package/lib/page-title.vue_vue_type_style_index_0_lang-CzfdMzXf.js +36 -0
- package/lib/page-title.vue_vue_type_style_index_0_lang-DcmGICoo.cjs +1 -0
- package/lib/register.cjs +1 -1
- package/lib/register.js +1 -1
- package/lib/style.css +1 -1
- package/lib/use-shrinkable-CS2bmsJJ.js +17 -0
- package/lib/use-shrinkable-Cu9JQZll.cjs +1 -0
- package/package.json +1 -1
- package/src/accordion-fieldset.vue +4 -35
- package/src/accordion-section.vue +194 -0
- package/src/components.ts +3 -0
- package/src/internal/use-shrinkable.ts +37 -0
- package/src/page-section.vue +103 -0
- package/src/page-title.vue +56 -0
- package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-Cod0KnrE.cjs +0 -1
- package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-Dk5Id0dl.js +0 -79
- package/lib/components-CvmuAs2C.cjs +0 -1
- package/lib/components-p1BluzXb.js +0 -18
package/README.md
CHANGED
|
@@ -125,9 +125,12 @@ export default defineNuxtConfig({
|
|
|
125
125
|
| Component | Description |
|
|
126
126
|
| --------- | ----------- |
|
|
127
127
|
| [`AccordionFieldset`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/accordion-fieldset.md) | A fieldset whose contents can be collapsed and expanded from the legend. |
|
|
128
|
+
| [`AccordionSection`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/accordion-section.md) | An area whose contents can be collapsed and expanded with a toggle button below them. |
|
|
128
129
|
| [`HourglassLoading`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/hourglass-loading.md) | Shows an hourglass in place of a value while it is loading. |
|
|
129
130
|
| [`LabelIcon`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/label-icon.md) | Displays an icon and a text label side by side. |
|
|
130
131
|
| [`LabelButton`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/label-button.md) | Renders a button containing an icon and a text label. |
|
|
132
|
+
| [`PageSection`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/page-section.md) | A section of a page with a heading. |
|
|
133
|
+
| [`PageTitle`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/page-title.md) | The title bar of a page, with the contents of the default slot on its right side. |
|
|
131
134
|
| [`TabGroup` / `TabContent`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/tab-group.md) | Switches between contents with tab headers. |
|
|
132
135
|
|
|
133
136
|
#### 📜 License
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./accordion-fieldset.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./accordion-fieldset.vue_vue_type_style_index_0_lang-Dd8HXuVm.cjs");exports.default=e._sfc_main;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),r=require("@digitalwalletcorp/vue-svg-icons"),c=require("./label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.cjs"),u=require("./use-shrinkable-Cu9JQZll.cjs"),p=["disabled"],_=["aria-expanded"],f=e.defineComponent({__name:"accordion-fieldset",props:{legend:{},disabled:{type:Boolean},initialExpand:{type:Boolean}},setup(a){const t=a,o=e.useSlots(),l=e.ref(),n=e.reactive({expanded:!0}),i=u.useShrinkable(l),s=()=>{n.expanded=!n.expanded};return e.onMounted(()=>{n.expanded=!!t.initialExpand}),(d,g)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"dwui-accordion-fieldset",disabled:t.disabled},[e.createElementVNode("legend",null,[e.createElementVNode("button",{type:"button",class:"dwui-accordion-toggle","aria-expanded":n.expanded,onClick:s},[e.createVNode(e.unref(r.SvgTriangleButton),{direction:n.expanded?"up":"down"},null,8,["direction"]),t.legend!=null||o.legend!=null||o.icon!=null?(e.openBlock(),e.createBlock(c._sfc_main,{key:0},e.createSlots({_:2},[o.icon!=null?{name:"icon",fn:e.withCtx(()=>[e.renderSlot(d.$slots,"icon")]),key:"0"}:void 0,t.legend!=null||o.legend!=null?{name:"default",fn:e.withCtx(()=>[e.renderSlot(d.$slots,"legend",{},()=>[e.createTextVNode(e.toDisplayString(t.legend),1)])]),key:"1"}:void 0]),1024)):e.createCommentVNode("",!0)],8,_)]),e.createElementVNode("div",{ref_key:"refContents",ref:l,class:e.normalizeClass(["dwui-accordion-contents",e.unref(i)?n.expanded?"dwui-expanded":"dwui-shrunk":""])},[e.renderSlot(d.$slots,"default")],2)],8,p))}});exports._sfc_main=f;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { defineComponent as f, useSlots as m, ref as g, reactive as x, onMounted as _, openBlock as i, createElementBlock as k, createElementVNode as d, createVNode as C, unref as s, createBlock as b, createSlots as y, withCtx as r, renderSlot as l, createTextVNode as h, toDisplayString as w, createCommentVNode as B, normalizeClass as S } from "vue";
|
|
2
|
+
import { SvgTriangleButton as v } from "@digitalwalletcorp/vue-svg-icons";
|
|
3
|
+
import { _ as E } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
|
|
4
|
+
import { u as N } from "./use-shrinkable-CS2bmsJJ.js";
|
|
5
|
+
const V = ["disabled"], $ = ["aria-expanded"], q = /* @__PURE__ */ f({
|
|
6
|
+
__name: "accordion-fieldset",
|
|
7
|
+
props: {
|
|
8
|
+
legend: {},
|
|
9
|
+
disabled: { type: Boolean },
|
|
10
|
+
initialExpand: { type: Boolean }
|
|
11
|
+
},
|
|
12
|
+
setup(c) {
|
|
13
|
+
const n = c, o = m(), a = g(), e = x({
|
|
14
|
+
expanded: !0
|
|
15
|
+
}), p = N(a), u = () => {
|
|
16
|
+
e.expanded = !e.expanded;
|
|
17
|
+
};
|
|
18
|
+
return _(() => {
|
|
19
|
+
e.expanded = !!n.initialExpand;
|
|
20
|
+
}), (t, T) => (i(), k("fieldset", {
|
|
21
|
+
class: "dwui-accordion-fieldset",
|
|
22
|
+
disabled: n.disabled
|
|
23
|
+
}, [
|
|
24
|
+
d("legend", null, [
|
|
25
|
+
d("button", {
|
|
26
|
+
type: "button",
|
|
27
|
+
class: "dwui-accordion-toggle",
|
|
28
|
+
"aria-expanded": e.expanded,
|
|
29
|
+
onClick: u
|
|
30
|
+
}, [
|
|
31
|
+
C(s(v), {
|
|
32
|
+
direction: e.expanded ? "up" : "down"
|
|
33
|
+
}, null, 8, ["direction"]),
|
|
34
|
+
n.legend != null || o.legend != null || o.icon != null ? (i(), b(E, { key: 0 }, y({ _: 2 }, [
|
|
35
|
+
o.icon != null ? {
|
|
36
|
+
name: "icon",
|
|
37
|
+
fn: r(() => [
|
|
38
|
+
l(t.$slots, "icon")
|
|
39
|
+
]),
|
|
40
|
+
key: "0"
|
|
41
|
+
} : void 0,
|
|
42
|
+
n.legend != null || o.legend != null ? {
|
|
43
|
+
name: "default",
|
|
44
|
+
fn: r(() => [
|
|
45
|
+
l(t.$slots, "legend", {}, () => [
|
|
46
|
+
h(w(n.legend), 1)
|
|
47
|
+
])
|
|
48
|
+
]),
|
|
49
|
+
key: "1"
|
|
50
|
+
} : void 0
|
|
51
|
+
]), 1024)) : B("", !0)
|
|
52
|
+
], 8, $)
|
|
53
|
+
]),
|
|
54
|
+
d("div", {
|
|
55
|
+
ref_key: "refContents",
|
|
56
|
+
ref: a,
|
|
57
|
+
class: S(["dwui-accordion-contents", s(p) ? e.expanded ? "dwui-expanded" : "dwui-shrunk" : ""])
|
|
58
|
+
}, [
|
|
59
|
+
l(t.$slots, "default")
|
|
60
|
+
], 2)
|
|
61
|
+
], 8, V));
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
export {
|
|
65
|
+
q as _
|
|
66
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./accordion-section.vue_vue_type_style_index_0_lang-BBEywIH3.cjs");exports.default=e._sfc_main;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { LabelPreset } from './types/label-preset';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** trueの場合、開閉ボタンを無効にする */
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
/** trueの場合、開いた状態で表示する デフォルト false */
|
|
6
|
+
initialExpand?: boolean;
|
|
7
|
+
/** trueの場合、縮めたときに中身の下側をぼかさない */
|
|
8
|
+
noGradient?: boolean;
|
|
9
|
+
/** 縮めているときの開閉ボタン(開く)のラベル */
|
|
10
|
+
openLabel?: string;
|
|
11
|
+
/** 開いているときの開閉ボタン(閉じる)のラベル */
|
|
12
|
+
closeLabel?: string;
|
|
13
|
+
/** 縮めているときの開閉ボタン(開く)のアイコンとラベル */
|
|
14
|
+
openPreset?: LabelPreset;
|
|
15
|
+
/** 開いているときの開閉ボタン(閉じる)のアイコンとラベル */
|
|
16
|
+
closePreset?: LabelPreset;
|
|
17
|
+
}
|
|
18
|
+
interface Slots {
|
|
19
|
+
/** 縮めているときの開閉ボタン(開く)のアイコン */
|
|
20
|
+
'open-icon'?(): unknown;
|
|
21
|
+
/** 開いているときの開閉ボタン(閉じる)のアイコン */
|
|
22
|
+
'close-icon'?(): unknown;
|
|
23
|
+
default?(): unknown;
|
|
24
|
+
}
|
|
25
|
+
type __VLS_Slots = Slots;
|
|
26
|
+
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>;
|
|
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 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),k=require("@digitalwalletcorp/vue-svg-icons"),v=require("./label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.cjs"),x=require("./use-shrinkable-Cu9JQZll.cjs"),f={class:"dwui-accordion-section"},g={key:0,class:"dwui-accordion-section-control"},m=["disabled","aria-expanded"],b=e.defineComponent({__name:"accordion-section",props:{disabled:{type:Boolean},initialExpand:{type:Boolean},noGradient:{type:Boolean},openLabel:{},closeLabel:{},openPreset:{},closePreset:{}},setup(u){const o=u,l=e.useSlots(),r=e.ref(),n=e.reactive({expanded:!0}),d=x.useShrinkable(r),s=e.computed(()=>n.expanded?o.closePreset:o.openPreset),a=()=>(n.expanded?l["close-icon"]:l["open-icon"])??s.value?.icon,p=()=>(n.expanded?l["close-icon"]:l["open-icon"])==null?s.value?.iconProps:void 0,i=e.computed(()=>{const t=n.expanded?o.closeLabel:o.openLabel;if(t!=null)return t;const c=s.value?.label;return typeof c=="function"?c():c}),_=()=>{n.expanded=!n.expanded};return e.onMounted(()=>{n.expanded=!!o.initialExpand}),(t,c)=>(e.openBlock(),e.createElementBlock("div",f,[e.createElementVNode("div",{ref_key:"refContents",ref:r,class:e.normalizeClass(["dwui-accordion-section-contents",[e.unref(d)?n.expanded?"dwui-expanded":"dwui-shrunk":"",{"dwui-no-gradient":o.noGradient}]])},[e.renderSlot(t.$slots,"default")],2),e.unref(d)?(e.openBlock(),e.createElementBlock("div",g,[e.createElementVNode("button",{type:"button",class:"dwui-accordion-section-toggle",disabled:o.disabled,"aria-expanded":n.expanded,onClick:e.withModifiers(_,["stop"])},[a()!=null||i.value!=null?(e.openBlock(),e.createBlock(v._sfc_main,{key:0},e.createSlots({_:2},[a()!=null?{name:"icon",fn:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a()),e.normalizeProps(e.guardReactiveProps(p())),null,16))]),key:"0"}:void 0,i.value!=null?{name:"default",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.value),1)]),key:"1"}:void 0]),1024)):(e.openBlock(),e.createBlock(e.unref(k.SvgTriangleButton),{key:1,direction:n.expanded?"up":"down"},null,8,["direction"]))],8,m)])):e.createCommentVNode("",!0)]))}});exports._sfc_main=b;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent as k, useSlots as y, ref as w, reactive as C, computed as m, onMounted as h, openBlock as t, createElementBlock as f, createElementVNode as x, normalizeClass as P, unref as d, renderSlot as B, withModifiers as L, createBlock as r, createSlots as S, withCtx as g, resolveDynamicComponent as E, normalizeProps as N, guardReactiveProps as T, createTextVNode as V, toDisplayString as z, createCommentVNode as D } from "vue";
|
|
2
|
+
import { SvgTriangleButton as G } from "@digitalwalletcorp/vue-svg-icons";
|
|
3
|
+
import { _ as I } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
|
|
4
|
+
import { u as M } from "./use-shrinkable-CS2bmsJJ.js";
|
|
5
|
+
const $ = { class: "dwui-accordion-section" }, R = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "dwui-accordion-section-control"
|
|
8
|
+
}, j = ["disabled", "aria-expanded"], J = /* @__PURE__ */ k({
|
|
9
|
+
__name: "accordion-section",
|
|
10
|
+
props: {
|
|
11
|
+
disabled: { type: Boolean },
|
|
12
|
+
initialExpand: { type: Boolean },
|
|
13
|
+
noGradient: { type: Boolean },
|
|
14
|
+
openLabel: {},
|
|
15
|
+
closeLabel: {},
|
|
16
|
+
openPreset: {},
|
|
17
|
+
closePreset: {}
|
|
18
|
+
},
|
|
19
|
+
setup(_) {
|
|
20
|
+
const o = _, s = y(), p = w(), e = C({
|
|
21
|
+
expanded: !0
|
|
22
|
+
}), u = M(p), l = m(() => e.expanded ? o.closePreset : o.openPreset), i = () => (e.expanded ? s["close-icon"] : s["open-icon"]) ?? l.value?.icon, b = () => (e.expanded ? s["close-icon"] : s["open-icon"]) == null ? l.value?.iconProps : void 0, c = m(() => {
|
|
23
|
+
const n = e.expanded ? o.closeLabel : o.openLabel;
|
|
24
|
+
if (n != null)
|
|
25
|
+
return n;
|
|
26
|
+
const a = l.value?.label;
|
|
27
|
+
return typeof a == "function" ? a() : a;
|
|
28
|
+
}), v = () => {
|
|
29
|
+
e.expanded = !e.expanded;
|
|
30
|
+
};
|
|
31
|
+
return h(() => {
|
|
32
|
+
e.expanded = !!o.initialExpand;
|
|
33
|
+
}), (n, a) => (t(), f("div", $, [
|
|
34
|
+
x("div", {
|
|
35
|
+
ref_key: "refContents",
|
|
36
|
+
ref: p,
|
|
37
|
+
class: P(["dwui-accordion-section-contents", [
|
|
38
|
+
d(u) ? e.expanded ? "dwui-expanded" : "dwui-shrunk" : "",
|
|
39
|
+
{ "dwui-no-gradient": o.noGradient }
|
|
40
|
+
]])
|
|
41
|
+
}, [
|
|
42
|
+
B(n.$slots, "default")
|
|
43
|
+
], 2),
|
|
44
|
+
d(u) ? (t(), f("div", R, [
|
|
45
|
+
x("button", {
|
|
46
|
+
type: "button",
|
|
47
|
+
class: "dwui-accordion-section-toggle",
|
|
48
|
+
disabled: o.disabled,
|
|
49
|
+
"aria-expanded": e.expanded,
|
|
50
|
+
onClick: L(v, ["stop"])
|
|
51
|
+
}, [
|
|
52
|
+
i() != null || c.value != null ? (t(), r(I, { key: 0 }, S({ _: 2 }, [
|
|
53
|
+
i() != null ? {
|
|
54
|
+
name: "icon",
|
|
55
|
+
fn: g(() => [
|
|
56
|
+
(t(), r(E(i()), N(T(b())), null, 16))
|
|
57
|
+
]),
|
|
58
|
+
key: "0"
|
|
59
|
+
} : void 0,
|
|
60
|
+
c.value != null ? {
|
|
61
|
+
name: "default",
|
|
62
|
+
fn: g(() => [
|
|
63
|
+
V(z(c.value), 1)
|
|
64
|
+
]),
|
|
65
|
+
key: "1"
|
|
66
|
+
} : void 0
|
|
67
|
+
]), 1024)) : (t(), r(d(G), {
|
|
68
|
+
key: 1,
|
|
69
|
+
direction: e.expanded ? "up" : "down"
|
|
70
|
+
}, null, 8, ["direction"]))
|
|
71
|
+
], 8, j)
|
|
72
|
+
])) : D("", !0)
|
|
73
|
+
]));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
J as _
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./accordion-fieldset.vue_vue_type_style_index_0_lang-Dd8HXuVm.cjs"),_=require("./accordion-section.vue_vue_type_style_index_0_lang-BBEywIH3.cjs"),n=require("./hourglass-loading.vue_vue_type_style_index_0_lang-C72UVA9W.cjs"),t=require("./label-button.vue_vue_type_script_setup_true_lang-DqhdCgmJ.cjs"),i=require("./label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.cjs"),o=require("./page-section.vue_vue_type_style_index_0_lang-bvQeBjUP.cjs"),c=require("./page-title.vue_vue_type_style_index_0_lang-DcmGICoo.cjs"),s=require("./tab-content.vue_vue_type_style_index_0_lang-BeCi7Xkp.cjs"),u=require("./tab-group.vue_vue_type_style_index_0_lang-CwVGYZAo.cjs"),a=Object.freeze(Object.defineProperty({__proto__:null,AccordionFieldset:e._sfc_main,AccordionSection:_._sfc_main,HourglassLoading:n._sfc_main,LabelButton:t._sfc_main,LabelIcon:i._sfc_main,PageSection:o._sfc_main,PageTitle:c._sfc_main,TabContent:s._sfc_main,TabGroup:u._sfc_main},Symbol.toStringTag,{value:"Module"}));exports.components=a;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { _ as o } from "./accordion-fieldset.vue_vue_type_style_index_0_lang-tzJhLHyT.js";
|
|
2
|
+
import { _ } from "./accordion-section.vue_vue_type_style_index_0_lang-DAlUN0wH.js";
|
|
3
|
+
import { _ as a } from "./hourglass-loading.vue_vue_type_style_index_0_lang-DkUGIxQ2.js";
|
|
4
|
+
import { _ as m } from "./label-button.vue_vue_type_script_setup_true_lang-CoHrTUSs.js";
|
|
5
|
+
import { _ as r } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
|
|
6
|
+
import { _ as i } from "./page-section.vue_vue_type_style_index_0_lang-4MLb_sDZ.js";
|
|
7
|
+
import { _ as t } from "./page-title.vue_vue_type_style_index_0_lang-CzfdMzXf.js";
|
|
8
|
+
import { _ as n } from "./tab-content.vue_vue_type_style_index_0_lang-CcQLHmIF.js";
|
|
9
|
+
import { _ as s } from "./tab-group.vue_vue_type_style_index_0_lang-CjnBkvvZ.js";
|
|
10
|
+
const u = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
11
|
+
__proto__: null,
|
|
12
|
+
AccordionFieldset: o,
|
|
13
|
+
AccordionSection: _,
|
|
14
|
+
HourglassLoading: a,
|
|
15
|
+
LabelButton: m,
|
|
16
|
+
LabelIcon: r,
|
|
17
|
+
PageSection: i,
|
|
18
|
+
PageTitle: t,
|
|
19
|
+
TabContent: n,
|
|
20
|
+
TabGroup: s
|
|
21
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
22
|
+
export {
|
|
23
|
+
u as c
|
|
24
|
+
};
|
package/lib/components.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { default as AccordionFieldset } from './accordion-fieldset';
|
|
2
|
+
export { default as AccordionSection } from './accordion-section';
|
|
2
3
|
export { default as HourglassLoading } from './hourglass-loading';
|
|
3
4
|
export { default as LabelButton } from './label-button';
|
|
4
5
|
export { default as LabelIcon } from './label-icon';
|
|
6
|
+
export { default as PageSection } from './page-section';
|
|
7
|
+
export { default as PageTitle } from './page-title';
|
|
5
8
|
export { default as TabContent } from './tab-content';
|
|
6
9
|
export { default as TabGroup } from './tab-group';
|
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./accordion-fieldset.vue_vue_type_style_index_0_lang-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./accordion-fieldset.vue_vue_type_style_index_0_lang-Dd8HXuVm.cjs"),_=require("./accordion-section.vue_vue_type_style_index_0_lang-BBEywIH3.cjs"),n=require("./hourglass-loading.vue_vue_type_style_index_0_lang-C72UVA9W.cjs"),t=require("./label-button.vue_vue_type_script_setup_true_lang-DqhdCgmJ.cjs"),i=require("./label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.cjs"),a=require("./page-section.vue_vue_type_style_index_0_lang-bvQeBjUP.cjs"),u=require("./page-title.vue_vue_type_style_index_0_lang-DcmGICoo.cjs"),o=require("./tab-content.vue_vue_type_style_index_0_lang-BeCi7Xkp.cjs"),s=require("./tab-group.vue_vue_type_style_index_0_lang-CwVGYZAo.cjs");exports.AccordionFieldset=e._sfc_main;exports.AccordionSection=_._sfc_main;exports.HourglassLoading=n._sfc_main;exports.LabelButton=t._sfc_main;exports.LabelIcon=i._sfc_main;exports.PageSection=a._sfc_main;exports.PageTitle=u._sfc_main;exports.TabContent=o._sfc_main;exports.TabGroup=s._sfc_main;
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { _ as t } from "./
|
|
3
|
-
import { _ as p } from "./
|
|
4
|
-
import { _ as m } from "./label-
|
|
5
|
-
import { _ as x } from "./
|
|
6
|
-
import { _ as
|
|
1
|
+
import { _ as e } from "./accordion-fieldset.vue_vue_type_style_index_0_lang-tzJhLHyT.js";
|
|
2
|
+
import { _ as t } from "./accordion-section.vue_vue_type_style_index_0_lang-DAlUN0wH.js";
|
|
3
|
+
import { _ as p } from "./hourglass-loading.vue_vue_type_style_index_0_lang-DkUGIxQ2.js";
|
|
4
|
+
import { _ as m } from "./label-button.vue_vue_type_script_setup_true_lang-CoHrTUSs.js";
|
|
5
|
+
import { _ as x } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
|
|
6
|
+
import { _ as c } from "./page-section.vue_vue_type_style_index_0_lang-4MLb_sDZ.js";
|
|
7
|
+
import { _ as l } from "./page-title.vue_vue_type_style_index_0_lang-CzfdMzXf.js";
|
|
8
|
+
import { _ as d } from "./tab-content.vue_vue_type_style_index_0_lang-CcQLHmIF.js";
|
|
9
|
+
import { _ as u } from "./tab-group.vue_vue_type_style_index_0_lang-CjnBkvvZ.js";
|
|
7
10
|
export {
|
|
8
|
-
|
|
9
|
-
t as
|
|
10
|
-
p as
|
|
11
|
-
m as
|
|
12
|
-
x as
|
|
13
|
-
|
|
11
|
+
e as AccordionFieldset,
|
|
12
|
+
t as AccordionSection,
|
|
13
|
+
p as HourglassLoading,
|
|
14
|
+
m as LabelButton,
|
|
15
|
+
x as LabelIcon,
|
|
16
|
+
c as PageSection,
|
|
17
|
+
l as PageTitle,
|
|
18
|
+
d as TabContent,
|
|
19
|
+
u as TabGroup
|
|
14
20
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/** 縮めたときの中身の高さ(px)。中身がこれより低い場合は開閉しない */
|
|
3
|
+
export declare const SHRUNK_HEIGHT = 70;
|
|
4
|
+
/**
|
|
5
|
+
* 中身が縮めたときの高さ以上あり、開閉できるかを返す
|
|
6
|
+
* 中身の大きさが変わるたびに測り直すため、隠れたタブの中にあって後から表示された場合や、中身が増減した場合も再判定される
|
|
7
|
+
* 縮めている間も中身の本来の高さで判定する
|
|
8
|
+
*
|
|
9
|
+
* @param {Ref<HTMLElement | undefined>} contents 開閉する中身の要素
|
|
10
|
+
* @returns {Ref<boolean>}
|
|
11
|
+
*/
|
|
12
|
+
export declare function useShrinkable(contents: Ref<HTMLElement | undefined>): Ref<boolean>;
|
package/lib/nuxt.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("@nuxt/kit"),r=require("./components-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("@nuxt/kit"),r=require("./components-YAonMRcW.cjs");var t=typeof document<"u"?document.currentScript:null;const u=e.defineNuxtModule({meta:{name:"@digitalwalletcorp/vue-core",configKey:"vueCore"},setup(){const n=e.createResolver(typeof document>"u"?require("url").pathToFileURL(__filename).href:t&&t.tagName.toUpperCase()==="SCRIPT"&&t.src||new URL("nuxt.cjs",document.baseURI).href);for(const o of Object.keys(r.components))e.addComponent({name:o,export:o,filePath:n.resolve("./index")})}});exports.default=u;
|
package/lib/nuxt.js
CHANGED
|
@@ -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-bvQeBjUP.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,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-bQFkQ_gC.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";const e=require("vue"),n=require("@digitalwalletcorp/vue-svg-icons"),r=require("./label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.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 @@
|
|
|
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-DcmGICoo.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,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-bQFkQ_gC.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
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),l=require("./label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.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;
|
package/lib/register.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./components-YAonMRcW.cjs");function r(e){for(const[o,n]of Object.entries(t.components))e.component(o,n)}exports.registerComponents=r;
|
package/lib/register.js
CHANGED
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-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-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-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-page-section-font-size, 12px);font-weight:500}:where(.dwui-page-section-title){display:flex;align-items:center;font-size:var(--dwui-page-section-title-font-size, 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-page-title-width, auto);padding:4px;border-radius:4px;background:var(--dwui-page-title-bg, linear-gradient(#323232 0%, rgb(32, 32, 31) 25%, rgb(32, 32, 31) 75%, #323232 100%));color:var(--dwui-page-title-text, rgb(220, 220, 220));font-size:var(--dwui-page-title-font-size, 14px);font-weight:var(--dwui-page-title-font-weight, 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-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}
|
|
@@ -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
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
</legend>
|
|
34
34
|
<div
|
|
35
35
|
ref="refContents"
|
|
36
|
-
:class="[ 'dwui-accordion-contents',
|
|
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
|
|
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
|
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
中身を開閉できる領域。中身の下に開閉ボタンを置く
|
|
3
|
+
-->
|
|
4
|
+
<template>
|
|
5
|
+
<div class="dwui-accordion-section">
|
|
6
|
+
<div
|
|
7
|
+
ref="refContents"
|
|
8
|
+
class="dwui-accordion-section-contents"
|
|
9
|
+
:class="[
|
|
10
|
+
shrinkable ? pageContext.expanded ? 'dwui-expanded' : 'dwui-shrunk' : '',
|
|
11
|
+
{ 'dwui-no-gradient': props.noGradient }
|
|
12
|
+
]"
|
|
13
|
+
>
|
|
14
|
+
<slot />
|
|
15
|
+
</div>
|
|
16
|
+
<div
|
|
17
|
+
v-if="shrinkable"
|
|
18
|
+
class="dwui-accordion-section-control"
|
|
19
|
+
>
|
|
20
|
+
<button
|
|
21
|
+
type="button"
|
|
22
|
+
class="dwui-accordion-section-toggle"
|
|
23
|
+
:disabled="props.disabled"
|
|
24
|
+
:aria-expanded="pageContext.expanded"
|
|
25
|
+
@click.stop="onClickToggle"
|
|
26
|
+
>
|
|
27
|
+
<LabelIcon v-if="toggleIcon() != null || toggleLabel != null">
|
|
28
|
+
<template
|
|
29
|
+
v-if="toggleIcon() != null"
|
|
30
|
+
#icon
|
|
31
|
+
>
|
|
32
|
+
<component
|
|
33
|
+
:is="toggleIcon()"
|
|
34
|
+
v-bind="toggleIconProps()"
|
|
35
|
+
/>
|
|
36
|
+
</template>
|
|
37
|
+
<template
|
|
38
|
+
v-if="toggleLabel != null"
|
|
39
|
+
#default
|
|
40
|
+
>
|
|
41
|
+
{{ toggleLabel }}
|
|
42
|
+
</template>
|
|
43
|
+
</LabelIcon>
|
|
44
|
+
<SvgTriangleButton
|
|
45
|
+
v-else
|
|
46
|
+
:direction="pageContext.expanded ? 'up' : 'down'"
|
|
47
|
+
/>
|
|
48
|
+
</button>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script setup lang="ts">
|
|
54
|
+
import { computed, onMounted, reactive, ref } from 'vue';
|
|
55
|
+
import type { Component, Slot } from 'vue';
|
|
56
|
+
import { SvgTriangleButton } from '@digitalwalletcorp/vue-svg-icons';
|
|
57
|
+
import LabelIcon from '@/label-icon.vue';
|
|
58
|
+
import { useShrinkable } from '@/internal/use-shrinkable';
|
|
59
|
+
import type { LabelPreset } from '@/types/label-preset';
|
|
60
|
+
|
|
61
|
+
// 開閉ボタンのアイコンとラベルは別々に決める。どちらも、スロット/ラベルの指定 > プリセット の順で使う
|
|
62
|
+
// 何も指定が無い場合だけ、既定の三角を表示する
|
|
63
|
+
interface Props {
|
|
64
|
+
/** trueの場合、開閉ボタンを無効にする */
|
|
65
|
+
disabled?: boolean;
|
|
66
|
+
/** trueの場合、開いた状態で表示する デフォルト false */
|
|
67
|
+
initialExpand?: boolean;
|
|
68
|
+
/** trueの場合、縮めたときに中身の下側をぼかさない */
|
|
69
|
+
noGradient?: boolean;
|
|
70
|
+
/** 縮めているときの開閉ボタン(開く)のラベル */
|
|
71
|
+
openLabel?: string;
|
|
72
|
+
/** 開いているときの開閉ボタン(閉じる)のラベル */
|
|
73
|
+
closeLabel?: string;
|
|
74
|
+
/** 縮めているときの開閉ボタン(開く)のアイコンとラベル */
|
|
75
|
+
openPreset?: LabelPreset;
|
|
76
|
+
/** 開いているときの開閉ボタン(閉じる)のアイコンとラベル */
|
|
77
|
+
closePreset?: LabelPreset;
|
|
78
|
+
}
|
|
79
|
+
const props = defineProps<Props>();
|
|
80
|
+
|
|
81
|
+
interface Slots {
|
|
82
|
+
/** 縮めているときの開閉ボタン(開く)のアイコン */
|
|
83
|
+
'open-icon'?(): unknown;
|
|
84
|
+
/** 開いているときの開閉ボタン(閉じる)のアイコン */
|
|
85
|
+
'close-icon'?(): unknown;
|
|
86
|
+
default?(): unknown;
|
|
87
|
+
}
|
|
88
|
+
const slots = defineSlots<Slots>();
|
|
89
|
+
|
|
90
|
+
const refContents = ref<HTMLElement>();
|
|
91
|
+
const pageContext = reactive({
|
|
92
|
+
expanded: true
|
|
93
|
+
});
|
|
94
|
+
const shrinkable = useShrinkable(refContents);
|
|
95
|
+
|
|
96
|
+
const togglePreset = computed((): LabelPreset | undefined => pageContext.expanded ? props.closePreset : props.openPreset);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* 開閉ボタンに表示するアイコン。スロットは関数のままコンポーネントとして描画する
|
|
100
|
+
* スロットはリアクティブではないため、computedでキャッシュせず描画のたびに取り出す
|
|
101
|
+
*
|
|
102
|
+
* @returns {Slot | Component | undefined}
|
|
103
|
+
*/
|
|
104
|
+
const toggleIcon = (): Slot | Component | undefined => {
|
|
105
|
+
const slot = pageContext.expanded ? slots['close-icon'] : slots['open-icon'];
|
|
106
|
+
return (slot as Slot | undefined) ?? togglePreset.value?.icon;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* プリセットのアイコンに渡すProps。スロットで渡したアイコンには渡さない
|
|
111
|
+
*
|
|
112
|
+
* @returns {Record<string, unknown> | undefined}
|
|
113
|
+
*/
|
|
114
|
+
const toggleIconProps = (): Record<string, unknown> | undefined => {
|
|
115
|
+
const slot = pageContext.expanded ? slots['close-icon'] : slots['open-icon'];
|
|
116
|
+
return slot == null ? togglePreset.value?.iconProps : undefined;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const toggleLabel = computed((): string | undefined => {
|
|
120
|
+
const label = pageContext.expanded ? props.closeLabel : props.openLabel;
|
|
121
|
+
if (label != null) {
|
|
122
|
+
return label;
|
|
123
|
+
}
|
|
124
|
+
const presetLabel = togglePreset.value?.label;
|
|
125
|
+
return typeof presetLabel === 'function' ? presetLabel() : presetLabel;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const onClickToggle = () => {
|
|
129
|
+
pageContext.expanded = !pageContext.expanded;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
onMounted(() => {
|
|
133
|
+
pageContext.expanded = !!props.initialExpand;
|
|
134
|
+
});
|
|
135
|
+
</script>
|
|
136
|
+
|
|
137
|
+
<style>
|
|
138
|
+
:where(.dwui-accordion-section) {
|
|
139
|
+
position: relative;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
:where(.dwui-accordion-section-contents) {
|
|
143
|
+
position: relative;
|
|
144
|
+
width: fit-content;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:where(.dwui-accordion-section-contents.dwui-expanded) {
|
|
149
|
+
transition: all 0.3s linear;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
:where(.dwui-accordion-section-contents.dwui-shrunk) {
|
|
153
|
+
height: auto;
|
|
154
|
+
max-height: 70px;
|
|
155
|
+
transition: all 0.3s linear;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* 縮めたときは中身の下側を背景色へ溶け込ませ、続きがあることを示す */
|
|
159
|
+
:where(.dwui-accordion-section-contents.dwui-shrunk:not(.dwui-no-gradient))::after {
|
|
160
|
+
content: '';
|
|
161
|
+
position: absolute;
|
|
162
|
+
inset: 0;
|
|
163
|
+
background-image: linear-gradient(180deg, transparent 0%, transparent 60%, var(--dwui-accordion-section-fade, Canvas) 100%);
|
|
164
|
+
pointer-events: none;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
:where(.dwui-accordion-section-control) {
|
|
168
|
+
/* 中身(position: relative)より後に描き、縮めたときに重ねたボタンがぼかしの下に隠れないようにする */
|
|
169
|
+
position: relative;
|
|
170
|
+
display: flex;
|
|
171
|
+
justify-content: center;
|
|
172
|
+
width: 100%;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
:where(.dwui-accordion-section-toggle) {
|
|
176
|
+
display: inline-flex;
|
|
177
|
+
align-items: center;
|
|
178
|
+
cursor: pointer;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:where(.dwui-accordion-section-toggle:disabled) {
|
|
182
|
+
opacity: 0.6;
|
|
183
|
+
cursor: not-allowed;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
:where(.dwui-accordion-section-toggle[aria-expanded='true']) {
|
|
187
|
+
margin-top: 8px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* 縮めたときはボタンを中身のぼかしに少し重ね、中身とボタンの間を詰める */
|
|
191
|
+
:where(.dwui-accordion-section-toggle[aria-expanded='false']) {
|
|
192
|
+
margin-top: -10px;
|
|
193
|
+
}
|
|
194
|
+
</style>
|
package/src/components.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
// 公開するコンポーネントをここに列挙する。index/register/nuxtはここから読む
|
|
2
2
|
export { default as AccordionFieldset } from '@/accordion-fieldset.vue';
|
|
3
|
+
export { default as AccordionSection } from '@/accordion-section.vue';
|
|
3
4
|
export { default as HourglassLoading } from '@/hourglass-loading.vue';
|
|
4
5
|
export { default as LabelButton } from '@/label-button.vue';
|
|
5
6
|
export { default as LabelIcon } from '@/label-icon.vue';
|
|
7
|
+
export { default as PageSection } from '@/page-section.vue';
|
|
8
|
+
export { default as PageTitle } from '@/page-title.vue';
|
|
6
9
|
export { default as TabContent } from '@/tab-content.vue';
|
|
7
10
|
export { default as TabGroup } from '@/tab-group.vue';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { onBeforeUnmount, onMounted, ref } from 'vue';
|
|
2
|
+
import type { Ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
/** 縮めたときの中身の高さ(px)。中身がこれより低い場合は開閉しない */
|
|
5
|
+
export const SHRUNK_HEIGHT = 70;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* 中身が縮めたときの高さ以上あり、開閉できるかを返す
|
|
9
|
+
* 中身の大きさが変わるたびに測り直すため、隠れたタブの中にあって後から表示された場合や、中身が増減した場合も再判定される
|
|
10
|
+
* 縮めている間も中身の本来の高さで判定する
|
|
11
|
+
*
|
|
12
|
+
* @param {Ref<HTMLElement | undefined>} contents 開閉する中身の要素
|
|
13
|
+
* @returns {Ref<boolean>}
|
|
14
|
+
*/
|
|
15
|
+
export function useShrinkable(contents: Ref<HTMLElement | undefined>): Ref<boolean> {
|
|
16
|
+
// 測るまではSSRの出力と揃えるため、開閉できるものとして扱う
|
|
17
|
+
const shrinkable = ref(true);
|
|
18
|
+
let resizeObserver: ResizeObserver | undefined;
|
|
19
|
+
|
|
20
|
+
onMounted(() => {
|
|
21
|
+
const element = contents.value;
|
|
22
|
+
if (element == null) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// 監視を始めた時点でも1回呼ばれる
|
|
26
|
+
resizeObserver = new ResizeObserver(() => {
|
|
27
|
+
shrinkable.value = SHRUNK_HEIGHT <= element.scrollHeight;
|
|
28
|
+
});
|
|
29
|
+
resizeObserver.observe(element);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
onBeforeUnmount(() => {
|
|
33
|
+
resizeObserver?.disconnect();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return shrinkable;
|
|
37
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
見出し付きの区画
|
|
3
|
+
-->
|
|
4
|
+
<template>
|
|
5
|
+
<section class="dwui-page-section">
|
|
6
|
+
<div
|
|
7
|
+
v-if="props.title != null"
|
|
8
|
+
class="dwui-page-section-title"
|
|
9
|
+
:class="props.titleClass"
|
|
10
|
+
:style="props.titleStyle"
|
|
11
|
+
>
|
|
12
|
+
<LabelIcon>
|
|
13
|
+
<template #icon>
|
|
14
|
+
<slot name="icon">
|
|
15
|
+
<component
|
|
16
|
+
:is="presetIcon.component"
|
|
17
|
+
v-bind="presetIcon.props"
|
|
18
|
+
/>
|
|
19
|
+
</slot>
|
|
20
|
+
</template>
|
|
21
|
+
{{ props.title }}
|
|
22
|
+
</LabelIcon>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="dwui-page-section-content">
|
|
25
|
+
<slot />
|
|
26
|
+
</div>
|
|
27
|
+
</section>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import { computed } from 'vue';
|
|
32
|
+
import type { ClassValue, Component, StyleValue } from 'vue';
|
|
33
|
+
import { SvgCircle, SvgDiamond, SvgPushpin, SvgRoundPushpin, SvgSquare } from '@digitalwalletcorp/vue-svg-icons';
|
|
34
|
+
import LabelIcon from '@/label-icon.vue';
|
|
35
|
+
|
|
36
|
+
/** 見出しのアイコンとして選べるもの */
|
|
37
|
+
type PageSectionIcon = 'diamond' | 'circle' | 'square' | 'pushpin' | 'round-pushpin';
|
|
38
|
+
|
|
39
|
+
interface Props {
|
|
40
|
+
/** 見出しの文字。未指定なら見出しを表示しない */
|
|
41
|
+
title?: string;
|
|
42
|
+
/** 見出しのアイコン。これ以外のアイコンは#iconスロットで渡す デフォルト 'diamond' */
|
|
43
|
+
icon?: PageSectionIcon;
|
|
44
|
+
/** diamond・circle・squareの大きさ。未指定ならアイコンの既定値(large) */
|
|
45
|
+
iconVariant?: 'large' | 'medium' | 'small';
|
|
46
|
+
/** diamond・circle・squareの色。未指定ならdiamondは#1a44b6、circleは#e78b2f、squareは#d13a2b */
|
|
47
|
+
iconColor?: string;
|
|
48
|
+
/** 見出しに付けるclass */
|
|
49
|
+
titleClass?: ClassValue;
|
|
50
|
+
/** 見出しに付けるstyle */
|
|
51
|
+
titleStyle?: StyleValue;
|
|
52
|
+
}
|
|
53
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
54
|
+
icon: 'diamond'
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
interface Slots {
|
|
58
|
+
/** 見出しの文字の前に表示するアイコン。iconより優先する */
|
|
59
|
+
icon?(): unknown;
|
|
60
|
+
default?(): unknown;
|
|
61
|
+
}
|
|
62
|
+
defineSlots<Slots>();
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* プリセットのアイコン。shapeがtrueのものは、大きさと色を受け取る
|
|
66
|
+
* 見出しの既定のアイコンの色は、アイコン側の既定値が変わっても変わらないようにここで持つ
|
|
67
|
+
*/
|
|
68
|
+
const PRESET_ICONS: Record<PageSectionIcon, { component: Component; shape: boolean; color?: string }> = {
|
|
69
|
+
'diamond': { component: SvgDiamond, shape: true, color: '#1a44b6' },
|
|
70
|
+
'circle': { component: SvgCircle, shape: true, color: '#e78b2f' },
|
|
71
|
+
'square': { component: SvgSquare, shape: true, color: '#d13a2b' },
|
|
72
|
+
'pushpin': { component: SvgPushpin, shape: false },
|
|
73
|
+
'round-pushpin': { component: SvgRoundPushpin, shape: false }
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const presetIcon = computed((): { component: Component; props: Record<string, unknown> } => {
|
|
77
|
+
const preset = PRESET_ICONS[props.icon];
|
|
78
|
+
return {
|
|
79
|
+
component: preset.component,
|
|
80
|
+
props: preset.shape ? { variant: props.iconVariant, color: props.iconColor ?? preset.color } : {}
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
<style>
|
|
86
|
+
:where(.dwui-page-section) {
|
|
87
|
+
display: block;
|
|
88
|
+
margin: 4px 0 8px;
|
|
89
|
+
padding-top: 2px;
|
|
90
|
+
font-size: var(--dwui-page-section-font-size, 12px);
|
|
91
|
+
font-weight: 500;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
:where(.dwui-page-section-title) {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
font-size: var(--dwui-page-section-title-font-size, 14px);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
:where(.dwui-page-section-content) {
|
|
101
|
+
margin: 8px 0 8px 16px;
|
|
102
|
+
}
|
|
103
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
画面のタイトルバー。右側にスロットで渡されたものを space-between で配置する。
|
|
3
|
+
-->
|
|
4
|
+
<template>
|
|
5
|
+
<section class="dwui-page-title">
|
|
6
|
+
<LabelIcon class="dwui-page-title-label">
|
|
7
|
+
<!-- 渡されたスロットだけを中継する。空のスロットを渡すとアイコンの位置に間隔が空くため -->
|
|
8
|
+
<template
|
|
9
|
+
v-if="slots.icon != null"
|
|
10
|
+
#icon
|
|
11
|
+
>
|
|
12
|
+
<slot name="icon" />
|
|
13
|
+
</template>
|
|
14
|
+
{{ props.title }}
|
|
15
|
+
</LabelIcon>
|
|
16
|
+
<span
|
|
17
|
+
v-if="slots.default != null"
|
|
18
|
+
class="dwui-page-title-actions"
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</span>
|
|
22
|
+
</section>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import LabelIcon from '@/label-icon.vue';
|
|
27
|
+
|
|
28
|
+
interface Props {
|
|
29
|
+
/** タイトルの文字 */
|
|
30
|
+
title: string;
|
|
31
|
+
}
|
|
32
|
+
const props = defineProps<Props>();
|
|
33
|
+
|
|
34
|
+
interface Slots {
|
|
35
|
+
/** タイトルの文字の前に表示するアイコン */
|
|
36
|
+
icon?(): unknown;
|
|
37
|
+
/** タイトルバーの右側に表示する内容 */
|
|
38
|
+
default?(): unknown;
|
|
39
|
+
}
|
|
40
|
+
const slots = defineSlots<Slots>();
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<style>
|
|
44
|
+
:where(.dwui-page-title) {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: space-between;
|
|
48
|
+
width: var(--dwui-page-title-width, auto);
|
|
49
|
+
padding: 4px;
|
|
50
|
+
border-radius: 4px;
|
|
51
|
+
background: var(--dwui-page-title-bg, linear-gradient(#323232 0%, rgb(32, 32, 31) 25%, rgb(32, 32, 31) 75%, #323232 100%));
|
|
52
|
+
color: var(--dwui-page-title-text, rgb(220, 220, 220));
|
|
53
|
+
font-size: var(--dwui-page-title-font-size, 14px);
|
|
54
|
+
font-weight: var(--dwui-page-title-font-weight, normal);
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),i=require("@digitalwalletcorp/vue-svg-icons"),c=require("./label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.cjs"),u=["disabled"],p=["aria-expanded"],f=70,g=e.defineComponent({__name:"accordion-fieldset",props:{legend:{},disabled:{type:Boolean},initialExpand:{type:Boolean},observer:{}},setup(s){const t=s,d=e.useSlots(),l=e.ref(),n=e.reactive({expandable:!0,expanded:!0}),r=()=>{n.expanded=!n.expanded,n.expandable=a()},a=()=>{if(l.value){const o=l.value.getBoundingClientRect();return f<=o.height}return!1};return e.onMounted(()=>{n.expanded=!!t.initialExpand,t.observer&&(n.expandable=a())}),e.watch(()=>t.observer,o=>{o&&(n.expandable=a())},{deep:!0,flush:"post"}),(o,x)=>(e.openBlock(),e.createElementBlock("fieldset",{class:"dwui-accordion-fieldset",disabled:t.disabled},[e.createElementVNode("legend",null,[e.createElementVNode("button",{type:"button",class:"dwui-accordion-toggle","aria-expanded":n.expanded,onClick:r},[e.createVNode(e.unref(i.SvgTriangleButton),{direction:n.expanded?"up":"down"},null,8,["direction"]),t.legend!=null||d.legend!=null||d.icon!=null?(e.openBlock(),e.createBlock(c._sfc_main,{key:0},e.createSlots({_:2},[d.icon!=null?{name:"icon",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"icon")]),key:"0"}:void 0,t.legend!=null||d.legend!=null?{name:"default",fn:e.withCtx(()=>[e.renderSlot(o.$slots,"legend",{},()=>[e.createTextVNode(e.toDisplayString(t.legend),1)])]),key:"1"}:void 0]),1024)):e.createCommentVNode("",!0)],8,p)]),e.createElementVNode("div",{ref_key:"refContents",ref:l,class:e.normalizeClass(["dwui-accordion-contents",n.expandable?n.expanded?"dwui-expanded":"dwui-shrunk":""])},[e.renderSlot(o.$slots,"default")],2)],8,u))}});exports._sfc_main=g;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { defineComponent as u, useSlots as f, ref as x, reactive as g, onMounted as m, watch as b, openBlock as s, createElementBlock as _, createElementVNode as a, createVNode as k, unref as h, createBlock as v, createSlots as C, withCtx as r, renderSlot as i, createTextVNode as w, toDisplayString as y, createCommentVNode as B, normalizeClass as E } from "vue";
|
|
2
|
-
import { SvgTriangleButton as S } from "@digitalwalletcorp/vue-svg-icons";
|
|
3
|
-
import { _ as N } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
|
|
4
|
-
const T = ["disabled"], V = ["aria-expanded"], $ = 70, G = /* @__PURE__ */ u({
|
|
5
|
-
__name: "accordion-fieldset",
|
|
6
|
-
props: {
|
|
7
|
-
legend: {},
|
|
8
|
-
disabled: { type: Boolean },
|
|
9
|
-
initialExpand: { type: Boolean },
|
|
10
|
-
observer: {}
|
|
11
|
-
},
|
|
12
|
-
setup(c) {
|
|
13
|
-
const n = c, o = f(), d = x(), e = g({
|
|
14
|
-
expandable: !0,
|
|
15
|
-
expanded: !0
|
|
16
|
-
}), p = () => {
|
|
17
|
-
e.expanded = !e.expanded, e.expandable = l();
|
|
18
|
-
}, l = () => {
|
|
19
|
-
if (d.value) {
|
|
20
|
-
const t = d.value.getBoundingClientRect();
|
|
21
|
-
return $ <= t.height;
|
|
22
|
-
}
|
|
23
|
-
return !1;
|
|
24
|
-
};
|
|
25
|
-
return m(() => {
|
|
26
|
-
e.expanded = !!n.initialExpand, n.observer && (e.expandable = l());
|
|
27
|
-
}), b(() => n.observer, (t) => {
|
|
28
|
-
t && (e.expandable = l());
|
|
29
|
-
}, {
|
|
30
|
-
deep: !0,
|
|
31
|
-
// 高さの計測はDOM反映後に行う
|
|
32
|
-
flush: "post"
|
|
33
|
-
}), (t, H) => (s(), _("fieldset", {
|
|
34
|
-
class: "dwui-accordion-fieldset",
|
|
35
|
-
disabled: n.disabled
|
|
36
|
-
}, [
|
|
37
|
-
a("legend", null, [
|
|
38
|
-
a("button", {
|
|
39
|
-
type: "button",
|
|
40
|
-
class: "dwui-accordion-toggle",
|
|
41
|
-
"aria-expanded": e.expanded,
|
|
42
|
-
onClick: p
|
|
43
|
-
}, [
|
|
44
|
-
k(h(S), {
|
|
45
|
-
direction: e.expanded ? "up" : "down"
|
|
46
|
-
}, null, 8, ["direction"]),
|
|
47
|
-
n.legend != null || o.legend != null || o.icon != null ? (s(), v(N, { key: 0 }, C({ _: 2 }, [
|
|
48
|
-
o.icon != null ? {
|
|
49
|
-
name: "icon",
|
|
50
|
-
fn: r(() => [
|
|
51
|
-
i(t.$slots, "icon")
|
|
52
|
-
]),
|
|
53
|
-
key: "0"
|
|
54
|
-
} : void 0,
|
|
55
|
-
n.legend != null || o.legend != null ? {
|
|
56
|
-
name: "default",
|
|
57
|
-
fn: r(() => [
|
|
58
|
-
i(t.$slots, "legend", {}, () => [
|
|
59
|
-
w(y(n.legend), 1)
|
|
60
|
-
])
|
|
61
|
-
]),
|
|
62
|
-
key: "1"
|
|
63
|
-
} : void 0
|
|
64
|
-
]), 1024)) : B("", !0)
|
|
65
|
-
], 8, V)
|
|
66
|
-
]),
|
|
67
|
-
a("div", {
|
|
68
|
-
ref_key: "refContents",
|
|
69
|
-
ref: d,
|
|
70
|
-
class: E(["dwui-accordion-contents", e.expandable ? e.expanded ? "dwui-expanded" : "dwui-shrunk" : ""])
|
|
71
|
-
}, [
|
|
72
|
-
i(t.$slots, "default")
|
|
73
|
-
], 2)
|
|
74
|
-
], 8, T));
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
export {
|
|
78
|
-
G as _
|
|
79
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./accordion-fieldset.vue_vue_type_style_index_0_lang-Cod0KnrE.cjs"),_=require("./hourglass-loading.vue_vue_type_style_index_0_lang-C72UVA9W.cjs"),n=require("./label-button.vue_vue_type_script_setup_true_lang-DqhdCgmJ.cjs"),t=require("./label-icon.vue_vue_type_style_index_0_lang-C2URq6GP.cjs"),o=require("./tab-content.vue_vue_type_style_index_0_lang-BeCi7Xkp.cjs"),s=require("./tab-group.vue_vue_type_style_index_0_lang-CwVGYZAo.cjs"),u=Object.freeze(Object.defineProperty({__proto__:null,AccordionFieldset:e._sfc_main,HourglassLoading:_._sfc_main,LabelButton:n._sfc_main,LabelIcon:t._sfc_main,TabContent:o._sfc_main,TabGroup:s._sfc_main},Symbol.toStringTag,{value:"Module"}));exports.components=u;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { _ as o } from "./accordion-fieldset.vue_vue_type_style_index_0_lang-Dk5Id0dl.js";
|
|
2
|
-
import { _ } from "./hourglass-loading.vue_vue_type_style_index_0_lang-DkUGIxQ2.js";
|
|
3
|
-
import { _ as a } from "./label-button.vue_vue_type_script_setup_true_lang-CoHrTUSs.js";
|
|
4
|
-
import { _ as r } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
|
|
5
|
-
import { _ as m } from "./tab-content.vue_vue_type_style_index_0_lang-CcQLHmIF.js";
|
|
6
|
-
import { _ as t } from "./tab-group.vue_vue_type_style_index_0_lang-CjnBkvvZ.js";
|
|
7
|
-
const p = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
8
|
-
__proto__: null,
|
|
9
|
-
AccordionFieldset: o,
|
|
10
|
-
HourglassLoading: _,
|
|
11
|
-
LabelButton: a,
|
|
12
|
-
LabelIcon: r,
|
|
13
|
-
TabContent: m,
|
|
14
|
-
TabGroup: t
|
|
15
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
16
|
-
export {
|
|
17
|
-
p as c
|
|
18
|
-
};
|