@digitalwalletcorp/vue-core 0.1.2 → 0.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.
- package/README.md +11 -2
- package/lib/accordion-fieldset.cjs +1 -0
- package/lib/accordion-fieldset.d.ts +27 -0
- package/lib/accordion-fieldset.js +4 -0
- package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-Cod0KnrE.cjs +1 -0
- package/lib/accordion-fieldset.vue_vue_type_style_index_0_lang-Dk5Id0dl.js +79 -0
- package/lib/components-B3xZ0gFq.js +12 -0
- package/lib/components-CrmajA9z.cjs +1 -0
- package/lib/components.d.ts +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.js +6 -4
- package/lib/nuxt.cjs +1 -1
- package/lib/nuxt.js +1 -1
- package/lib/register.cjs +1 -1
- package/lib/register.js +1 -1
- package/lib/style.css +1 -1
- package/package.json +4 -1
- package/src/accordion-fieldset.vue +155 -0
- package/src/components.ts +1 -0
- package/lib/components-CIzBo8qB.cjs +0 -1
- package/lib/components-D-qeo7yx.js +0 -10
package/README.md
CHANGED
|
@@ -66,13 +66,14 @@ export default defineNuxtConfig({
|
|
|
66
66
|
|
|
67
67
|
##### 📐 Stylesheet
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
Import the stylesheets to ensure default alignment and icon styles.
|
|
70
70
|
|
|
71
71
|
* **Vue:** Import in your entry file.
|
|
72
72
|
|
|
73
73
|
```ts
|
|
74
74
|
// main.ts
|
|
75
75
|
import '@digitalwalletcorp/vue-core/style.css';
|
|
76
|
+
import '@digitalwalletcorp/vue-svg-icons/style.css'; // Required for components using icons from vue-svg-icons
|
|
76
77
|
```
|
|
77
78
|
|
|
78
79
|
* **Nuxt:** Add to your config array.
|
|
@@ -80,14 +81,22 @@ import '@digitalwalletcorp/vue-core/style.css';
|
|
|
80
81
|
```ts
|
|
81
82
|
// nuxt.config.ts
|
|
82
83
|
export default defineNuxtConfig({
|
|
83
|
-
css: [
|
|
84
|
+
css: [
|
|
85
|
+
'@digitalwalletcorp/vue-core/style.css',
|
|
86
|
+
'@digitalwalletcorp/vue-svg-icons/style.css' // Required for components using icons from vue-svg-icons
|
|
87
|
+
]
|
|
84
88
|
});
|
|
85
89
|
```
|
|
86
90
|
|
|
91
|
+
> **💡 Icon Styles**
|
|
92
|
+
>
|
|
93
|
+
> Components such as `AccordionFieldset` rely on [@digitalwalletcorp/vue-svg-icons](https://www.npmjs.com/package/@digitalwalletcorp/vue-svg-icons). Importing its stylesheet ensures icons align properly with text.
|
|
94
|
+
|
|
87
95
|
#### 🧰 Components
|
|
88
96
|
|
|
89
97
|
| Component | Description |
|
|
90
98
|
| --------- | ----------- |
|
|
99
|
+
| [`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. |
|
|
91
100
|
| [`LabelIcon`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/label-icon.md) | Displays an icon and a text label side by side. |
|
|
92
101
|
| [`LabelButton`](https://github.com/digitalwalletcorp/vue-core/blob/main/docs/components/label-button.md) | Renders a button containing an icon and a text label. |
|
|
93
102
|
|
|
@@ -0,0 +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-Cod0KnrE.cjs");exports.default=e._sfc_main;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
/** 凡例の文字。HTMLを含める場合は#legendスロットを使う */
|
|
3
|
+
legend?: string;
|
|
4
|
+
/** trueの場合、fieldsetを無効にする */
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
/** trueの場合、開いた状態で表示する デフォルト false */
|
|
7
|
+
initialExpand?: boolean;
|
|
8
|
+
/** 変化したときに、中身の高さを測り直して開閉できるかを判定し直す値 */
|
|
9
|
+
observer?: unknown;
|
|
10
|
+
}
|
|
11
|
+
interface Slots {
|
|
12
|
+
/** 凡例の文字の前に表示するアイコン */
|
|
13
|
+
icon?(): unknown;
|
|
14
|
+
/** 凡例。legendより優先する */
|
|
15
|
+
legend?(): unknown;
|
|
16
|
+
default?(): unknown;
|
|
17
|
+
}
|
|
18
|
+
type __VLS_Slots = Slots;
|
|
19
|
+
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>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
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;
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { _ as o } from "./accordion-fieldset.vue_vue_type_style_index_0_lang-Dk5Id0dl.js";
|
|
2
|
+
import { _ as e } from "./label-button.vue_vue_type_script_setup_true_lang-CoHrTUSs.js";
|
|
3
|
+
import { _ as t } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
|
|
4
|
+
const a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
5
|
+
__proto__: null,
|
|
6
|
+
AccordionFieldset: o,
|
|
7
|
+
LabelButton: e,
|
|
8
|
+
LabelIcon: t
|
|
9
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
10
|
+
export {
|
|
11
|
+
a as c
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("./accordion-fieldset.vue_vue_type_style_index_0_lang-Cod0KnrE.cjs"),_=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"),n=Object.freeze(Object.defineProperty({__proto__:null,AccordionFieldset:e._sfc_main,LabelButton:_._sfc_main,LabelIcon:t._sfc_main},Symbol.toStringTag,{value:"Module"}));exports.components=n;
|
package/lib/components.d.ts
CHANGED
package/lib/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=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");exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./accordion-fieldset.vue_vue_type_style_index_0_lang-Cod0KnrE.cjs"),_=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");exports.AccordionFieldset=e._sfc_main;exports.LabelButton=_._sfc_main;exports.LabelIcon=t._sfc_main;
|
package/lib/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { _ as
|
|
2
|
-
import { _ as
|
|
1
|
+
import { _ as r } from "./accordion-fieldset.vue_vue_type_style_index_0_lang-Dk5Id0dl.js";
|
|
2
|
+
import { _ as a } from "./label-button.vue_vue_type_script_setup_true_lang-CoHrTUSs.js";
|
|
3
|
+
import { _ as c } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
|
|
3
4
|
export {
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
r as AccordionFieldset,
|
|
6
|
+
a as LabelButton,
|
|
7
|
+
c as LabelIcon
|
|
6
8
|
};
|
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-CrmajA9z.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
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-CrmajA9z.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)}
|
|
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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitalwalletcorp/vue-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Basic UI components for Vue 3",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
@@ -85,5 +85,8 @@
|
|
|
85
85
|
"vitest": "3.2.4",
|
|
86
86
|
"vue": "^3.5.29",
|
|
87
87
|
"vue-tsc": "3.1.5"
|
|
88
|
+
},
|
|
89
|
+
"dependencies": {
|
|
90
|
+
"@digitalwalletcorp/vue-svg-icons": "^1.13.0"
|
|
88
91
|
}
|
|
89
92
|
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
中身を開閉できるfieldset
|
|
3
|
+
-->
|
|
4
|
+
<template>
|
|
5
|
+
<fieldset
|
|
6
|
+
class="dwui-accordion-fieldset"
|
|
7
|
+
:disabled="props.disabled"
|
|
8
|
+
>
|
|
9
|
+
<legend>
|
|
10
|
+
<button
|
|
11
|
+
type="button"
|
|
12
|
+
class="dwui-accordion-toggle"
|
|
13
|
+
:aria-expanded="pageContext.expanded"
|
|
14
|
+
@click="onClickToggle"
|
|
15
|
+
>
|
|
16
|
+
<SvgTriangleButton :direction="pageContext.expanded ? 'up' : 'down'" />
|
|
17
|
+
<LabelIcon v-if="props.legend != null || slots.legend != null || slots.icon != null">
|
|
18
|
+
<!-- 渡されたスロットだけを中継する。空のラベルを渡すとアイコンの後ろに間隔が空くため -->
|
|
19
|
+
<template
|
|
20
|
+
v-if="slots.icon != null"
|
|
21
|
+
#icon
|
|
22
|
+
>
|
|
23
|
+
<slot name="icon" />
|
|
24
|
+
</template>
|
|
25
|
+
<template
|
|
26
|
+
v-if="props.legend != null || slots.legend != null"
|
|
27
|
+
#default
|
|
28
|
+
>
|
|
29
|
+
<slot name="legend">{{ props.legend }}</slot>
|
|
30
|
+
</template>
|
|
31
|
+
</LabelIcon>
|
|
32
|
+
</button>
|
|
33
|
+
</legend>
|
|
34
|
+
<div
|
|
35
|
+
ref="refContents"
|
|
36
|
+
:class="[ 'dwui-accordion-contents', pageContext.expandable ? pageContext.expanded ? 'dwui-expanded' : 'dwui-shrunk' : '' ]"
|
|
37
|
+
>
|
|
38
|
+
<slot />
|
|
39
|
+
</div>
|
|
40
|
+
</fieldset>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup lang="ts">
|
|
44
|
+
import { onMounted, reactive, ref, watch } from 'vue';
|
|
45
|
+
import { SvgTriangleButton } from '@digitalwalletcorp/vue-svg-icons';
|
|
46
|
+
import LabelIcon from '@/label-icon.vue';
|
|
47
|
+
|
|
48
|
+
/** 縮めたときの中身の高さ(px)。中身がこれより低い場合は開閉しない */
|
|
49
|
+
const SHRUNK_HEIGHT = 70;
|
|
50
|
+
|
|
51
|
+
interface Props {
|
|
52
|
+
/** 凡例の文字。HTMLを含める場合は#legendスロットを使う */
|
|
53
|
+
legend?: string;
|
|
54
|
+
/** trueの場合、fieldsetを無効にする */
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
/** trueの場合、開いた状態で表示する デフォルト false */
|
|
57
|
+
initialExpand?: boolean;
|
|
58
|
+
/** 変化したときに、中身の高さを測り直して開閉できるかを判定し直す値 */
|
|
59
|
+
observer?: unknown;
|
|
60
|
+
}
|
|
61
|
+
const props = defineProps<Props>();
|
|
62
|
+
|
|
63
|
+
interface Slots {
|
|
64
|
+
/** 凡例の文字の前に表示するアイコン */
|
|
65
|
+
icon?(): unknown;
|
|
66
|
+
/** 凡例。legendより優先する */
|
|
67
|
+
legend?(): unknown;
|
|
68
|
+
default?(): unknown;
|
|
69
|
+
}
|
|
70
|
+
const slots = defineSlots<Slots>();
|
|
71
|
+
|
|
72
|
+
const refContents = ref<HTMLElement>();
|
|
73
|
+
const pageContext = reactive({
|
|
74
|
+
expandable: true,
|
|
75
|
+
expanded: true
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const onClickToggle = () => {
|
|
79
|
+
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
|
+
};
|
|
95
|
+
|
|
96
|
+
onMounted(() => {
|
|
97
|
+
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
|
+
});
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<style>
|
|
115
|
+
:where(.dwui-accordion-fieldset) {
|
|
116
|
+
position: relative;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* 詳細度0のため、利用側がbutton要素に装飾を当てている場合はそちらが優先される。打ち消しは利用側のCSSで行う */
|
|
120
|
+
:where(.dwui-accordion-toggle) {
|
|
121
|
+
display: inline-flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
gap: 4px;
|
|
124
|
+
margin-left: 4px;
|
|
125
|
+
padding: 0;
|
|
126
|
+
border: none;
|
|
127
|
+
background: none;
|
|
128
|
+
color: inherit;
|
|
129
|
+
cursor: pointer;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
:where(.dwui-accordion-toggle:disabled) {
|
|
133
|
+
opacity: 0.6;
|
|
134
|
+
cursor: not-allowed;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:where(.dwui-accordion-contents) {
|
|
138
|
+
position: relative;
|
|
139
|
+
width: fit-content;
|
|
140
|
+
padding: 2px;
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
opacity: 1;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:where(.dwui-accordion-contents.dwui-expanded) {
|
|
146
|
+
transition: all 0.3s linear;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:where(.dwui-accordion-contents.dwui-shrunk) {
|
|
150
|
+
height: auto;
|
|
151
|
+
max-height: 70px;
|
|
152
|
+
opacity: 0.75;
|
|
153
|
+
transition: all 0.3s linear;
|
|
154
|
+
}
|
|
155
|
+
</style>
|
package/src/components.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=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"),_=Object.freeze(Object.defineProperty({__proto__:null,LabelButton:e._sfc_main,LabelIcon:t._sfc_main},Symbol.toStringTag,{value:"Module"}));exports.components=_;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { _ as o } from "./label-button.vue_vue_type_script_setup_true_lang-CoHrTUSs.js";
|
|
2
|
-
import { _ as e } from "./label-icon.vue_vue_type_style_index_0_lang-bQFkQ_gC.js";
|
|
3
|
-
const r = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4
|
-
__proto__: null,
|
|
5
|
-
LabelButton: o,
|
|
6
|
-
LabelIcon: e
|
|
7
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
8
|
-
export {
|
|
9
|
-
r as c
|
|
10
|
-
};
|