@lism-css/ui 0.2.2 → 0.8.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/LICENSE +21 -0
- package/dist/components/Accordion/astro/index.d.ts +10 -10
- package/dist/components/Accordion/getProps.d.ts +40 -19
- package/dist/components/Accordion/react/AccIcon.d.ts +1 -6
- package/dist/components/Accordion/react/Accordion.d.ts +23 -7
- package/dist/components/Accordion/react/index.d.ts +6 -4
- package/dist/components/Accordion/setAccordion.d.ts +4 -1
- package/dist/components/Accordion/setAccordion.js +39 -42
- package/dist/components/Callout/getProps.d.ts +1 -1
- package/dist/components/Details/astro/index.d.ts +13 -0
- package/dist/components/Details/getProps.d.ts +40 -0
- package/dist/components/Details/react/Details.d.ts +37 -0
- package/dist/components/Details/react/index.d.ts +9 -0
- package/dist/components/Modal/getProps.d.ts +2 -2
- package/dist/components/Modal/setModal.d.ts +3 -0
- package/dist/components/Modal/setModal.js +25 -30
- package/dist/components/Tabs/getProps.d.ts +1 -1
- package/dist/components/astro.d.ts +1 -0
- package/dist/components/react.d.ts +1 -0
- package/dist/helper/animation.d.ts +18 -0
- package/dist/helper/animation.js +12 -0
- package/dist/helper/uuid.d.ts +1 -0
- package/dist/scripts/tabs.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +68 -68
- package/src/components/Accordion/_style.css +61 -36
- package/src/components/Accordion/astro/Button.astro +13 -0
- package/src/components/Accordion/astro/Heading.astro +10 -0
- package/src/components/Accordion/astro/Icon.astro +15 -0
- package/src/components/Accordion/astro/Item.astro +31 -0
- package/src/components/Accordion/astro/Panel.astro +14 -0
- package/src/components/Accordion/astro/Root.astro +17 -0
- package/src/components/Accordion/astro/index.js +10 -7
- package/src/components/Accordion/getProps.js +61 -16
- package/src/components/Accordion/react/AccIcon.jsx +5 -4
- package/src/components/Accordion/react/Accordion.jsx +56 -28
- package/src/components/Accordion/react/index.js +6 -3
- package/src/components/Accordion/setAccordion.js +114 -88
- package/src/components/Callout/getProps.ts +1 -1
- package/src/components/Details/_style.css +48 -0
- package/src/components/Details/astro/Content.astro +17 -0
- package/src/components/Details/astro/Details.astro +18 -0
- package/src/components/Details/astro/Icon.astro +14 -0
- package/src/components/{Accordion/astro/AccLabel.astro → Details/astro/Summary.astro} +1 -2
- package/src/components/Details/astro/Title.astro +10 -0
- package/src/components/Details/astro/index.js +10 -0
- package/src/components/Details/getProps.js +23 -0
- package/src/components/Details/react/Details.jsx +66 -0
- package/src/components/Details/react/index.js +6 -0
- package/src/components/Modal/_style.css +7 -7
- package/src/components/Modal/getProps.js +3 -3
- package/src/components/Modal/script.js +1 -0
- package/src/components/Modal/setModal.ts +65 -69
- package/src/components/Tabs/_style.css +4 -4
- package/src/components/Tabs/astro/Tab.astro +1 -1
- package/src/components/Tabs/astro/TabList.astro +1 -1
- package/src/components/Tabs/astro/TabPanel.astro +1 -1
- package/src/components/Tabs/astro/Tabs.astro +4 -3
- package/src/components/Tabs/getProps.js +1 -1
- package/src/components/Tabs/react/Tab.jsx +1 -1
- package/src/components/Tabs/react/TabList.jsx +1 -1
- package/src/components/Tabs/react/TabPanel.jsx +1 -1
- package/src/components/Tabs/script.js +1 -1
- package/src/components/astro.ts +1 -0
- package/src/components/react.ts +1 -0
- package/src/helper/animation.ts +36 -0
- package/src/{components/Tabs/astro/helper.js → helper/uuid.js} +1 -1
- package/dist/components/Tabs/astro/helper.d.ts +0 -1
- package/src/components/Accordion/astro/AccBody.astro +0 -13
- package/src/components/Accordion/astro/AccHeader.astro +0 -13
- package/src/components/Accordion/astro/AccHeaderLabel.astro +0 -12
- package/src/components/Accordion/astro/AccIcon.astro +0 -17
- package/src/components/Accordion/astro/Accordion.astro +0 -22
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Loos, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { default as Root } from './
|
|
2
|
-
import { default as
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as Icon } from './
|
|
6
|
-
import { default as
|
|
1
|
+
import { default as Root } from './Root.astro';
|
|
2
|
+
import { default as Item } from './Item.astro';
|
|
3
|
+
import { default as Heading } from './Heading.astro';
|
|
4
|
+
import { default as Panel } from './Panel.astro';
|
|
5
|
+
import { default as Icon } from './Icon.astro';
|
|
6
|
+
import { default as Button } from './Button.astro';
|
|
7
7
|
declare namespace _default {
|
|
8
8
|
export { Root };
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
9
|
+
export { Item };
|
|
10
|
+
export { Heading };
|
|
11
|
+
export { Panel };
|
|
12
12
|
export { Icon };
|
|
13
|
-
export {
|
|
13
|
+
export { Button };
|
|
14
14
|
}
|
|
15
15
|
export default _default;
|
|
@@ -1,31 +1,52 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function getRootProps({ lismClass, allowMultiple, ...props }: {
|
|
2
2
|
[x: string]: any;
|
|
3
3
|
lismClass: any;
|
|
4
|
+
allowMultiple: any;
|
|
4
5
|
}): {
|
|
5
6
|
[x: string]: any;
|
|
6
7
|
};
|
|
7
|
-
export function
|
|
8
|
+
export function getItemProps({ lismClass, ...props }: {
|
|
8
9
|
[x: string]: any;
|
|
9
|
-
|
|
10
|
+
lismClass: any;
|
|
10
11
|
}): {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
};
|
|
14
|
+
export function getHeadingProps(props: any): any;
|
|
15
|
+
export function getPanelProps({ lismClass, _contextID, accID, isOpen, ...props }: {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
lismClass: any;
|
|
18
|
+
_contextID: any;
|
|
19
|
+
accID?: string | undefined;
|
|
20
|
+
isOpen?: boolean | undefined;
|
|
21
|
+
}): {
|
|
22
|
+
panelProps: {
|
|
23
|
+
lismClass: string;
|
|
24
|
+
id: any;
|
|
25
|
+
hidden: string | undefined;
|
|
26
|
+
pos: string;
|
|
27
|
+
ov: string;
|
|
28
|
+
};
|
|
29
|
+
contentProps: {
|
|
30
|
+
lismClass: string;
|
|
31
|
+
layout: string;
|
|
32
|
+
};
|
|
13
33
|
};
|
|
14
34
|
export namespace defaultProps {
|
|
15
|
-
namespace
|
|
35
|
+
namespace button {
|
|
16
36
|
let lismClass: string;
|
|
37
|
+
let tag: string;
|
|
38
|
+
let layout: string;
|
|
39
|
+
let setPlain: number;
|
|
40
|
+
let g: string;
|
|
41
|
+
let w: string;
|
|
42
|
+
let ai: string;
|
|
43
|
+
let jc: string;
|
|
17
44
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export { lismClass_2 as lismClass };
|
|
26
|
-
}
|
|
27
|
-
namespace inner {
|
|
28
|
-
let lismClass_3: string;
|
|
29
|
-
export { lismClass_3 as lismClass };
|
|
30
|
-
}
|
|
45
|
+
let icon: {
|
|
46
|
+
lismClass: string;
|
|
47
|
+
tag: string;
|
|
48
|
+
pi: string;
|
|
49
|
+
fxsh: string;
|
|
50
|
+
'aria-hidden': string;
|
|
51
|
+
};
|
|
31
52
|
}
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export default function AccIcon(
|
|
2
|
-
[x: string]: any;
|
|
3
|
-
icon?: string | undefined;
|
|
4
|
-
viewBox: any;
|
|
5
|
-
children?: null | undefined;
|
|
6
|
-
}): import("react").JSX.Element;
|
|
1
|
+
export default function AccIcon(props: any): import("react").JSX.Element;
|
|
@@ -1,23 +1,39 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 複数の AccordionItem をラップするルート要素
|
|
4
|
+
*/
|
|
5
|
+
export function AccordionRoot({ children, ...props }: {
|
|
3
6
|
[x: string]: any;
|
|
4
7
|
children: any;
|
|
5
8
|
}): React.JSX.Element;
|
|
6
|
-
|
|
9
|
+
/**
|
|
10
|
+
* 個別のアコーディオンアイテム(<div> ベース、setEvent で開閉イベントを登録)
|
|
11
|
+
*/
|
|
12
|
+
export function AccordionItem({ children, ...props }: {
|
|
7
13
|
[x: string]: any;
|
|
8
14
|
children: any;
|
|
9
15
|
}): React.JSX.Element;
|
|
10
|
-
|
|
16
|
+
/**
|
|
17
|
+
* 見出しエリアのラッパー(デフォルトは <div role="heading">)
|
|
18
|
+
* tag に h2〜h6 を指定すると role は付与されない
|
|
19
|
+
*/
|
|
20
|
+
export function Heading({ children, ...props }: {
|
|
11
21
|
[x: string]: any;
|
|
12
22
|
children: any;
|
|
13
23
|
}): React.JSX.Element;
|
|
14
|
-
|
|
24
|
+
/**
|
|
25
|
+
* 開閉トリガーボタン
|
|
26
|
+
* accID: Context から取得できればそれを優先、なければ props / プレースホルダー
|
|
27
|
+
*/
|
|
28
|
+
export function Button({ children, accID: _accID, ...props }: {
|
|
15
29
|
[x: string]: any;
|
|
16
30
|
children: any;
|
|
17
|
-
|
|
18
|
-
innerProps: any;
|
|
31
|
+
accID?: string | undefined;
|
|
19
32
|
}): React.JSX.Element;
|
|
20
|
-
|
|
33
|
+
/**
|
|
34
|
+
* パネル
|
|
35
|
+
*/
|
|
36
|
+
export function Panel({ children, ...props }: {
|
|
21
37
|
[x: string]: any;
|
|
22
38
|
children: any;
|
|
23
39
|
}): React.JSX.Element;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AccordionRoot as Root, AccordionItem as Item, Heading, Panel, Button } from './Accordion';
|
|
2
2
|
import { default as Icon } from './AccIcon';
|
|
3
3
|
declare namespace _default {
|
|
4
4
|
export { Root };
|
|
5
|
+
export { Item };
|
|
5
6
|
export { Header };
|
|
6
|
-
export {
|
|
7
|
+
export { Heading };
|
|
8
|
+
export { Panel };
|
|
7
9
|
export { Icon };
|
|
8
|
-
export {
|
|
9
|
-
export { HeaderLabel };
|
|
10
|
+
export { Button };
|
|
10
11
|
}
|
|
11
12
|
export default _default;
|
|
13
|
+
declare const Header: typeof Heading;
|
|
@@ -1,48 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}, i = (e) => {
|
|
11
|
-
let t = !1;
|
|
12
|
-
const n = e.parentNode;
|
|
13
|
-
return n != null && (t = n.dataset.multiple !== "disallow"), t;
|
|
14
|
-
}, p = (e, t) => {
|
|
15
|
-
if (e.open)
|
|
16
|
-
e.open && a(e);
|
|
17
|
-
else {
|
|
18
|
-
if (!t) {
|
|
19
|
-
const o = e.parentNode.querySelector("[data-opened]");
|
|
20
|
-
requestAnimationFrame(() => {
|
|
21
|
-
o != null && a(o);
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
s(e);
|
|
25
|
-
}
|
|
26
|
-
}, u = (e) => {
|
|
27
|
-
const t = e.open, n = e.hasAttribute("data-opened");
|
|
28
|
-
t && !n && e.setAttribute("data-opened", ""), !t && n && e.removeAttribute("data-opened");
|
|
29
|
-
}, d = (e) => {
|
|
30
|
-
const t = i(e), n = e.querySelector("summary");
|
|
31
|
-
if (!n) return;
|
|
32
|
-
const o = (c) => {
|
|
33
|
-
c.preventDefault(), p(e, t);
|
|
34
|
-
}, r = () => {
|
|
35
|
-
u(e);
|
|
1
|
+
import { maybePauseAnimation as l, waitFrame as s, waitAnimation as u } from "../../helper/animation.js";
|
|
2
|
+
let d = "until-found";
|
|
3
|
+
const i = (e) => {
|
|
4
|
+
const t = e.querySelector(".c--accordion_heading"), n = e.querySelector(".c--accordion_panel");
|
|
5
|
+
return {
|
|
6
|
+
heading: t,
|
|
7
|
+
button: t.querySelector("button"),
|
|
8
|
+
panel: n,
|
|
9
|
+
content: n.querySelector(".c--accordion_content")
|
|
36
10
|
};
|
|
37
|
-
|
|
38
|
-
|
|
11
|
+
}, f = (e) => {
|
|
12
|
+
const t = e.parentNode;
|
|
13
|
+
t && (t.hasAttribute("data-allow-multiple") || t.querySelectorAll(":scope > [data-opened]").forEach((n) => p(n)));
|
|
14
|
+
};
|
|
15
|
+
async function A(e) {
|
|
16
|
+
const { panel: t, content: n, button: a } = i(e);
|
|
17
|
+
l(t), t.removeAttribute("hidden"), await s(), e.style.setProperty("--_panel-h", `${n.offsetHeight}px`), await s(), e.setAttribute("data-opened", ""), a.setAttribute("aria-expanded", "true"), await u(t) !== "canceled" && e.style.removeProperty("--_panel-h");
|
|
18
|
+
}
|
|
19
|
+
async function p(e) {
|
|
20
|
+
const { panel: t, button: n } = i(e);
|
|
21
|
+
l(t), e.style.setProperty("--_panel-h", `${t.offsetHeight}px`), await s(), e.removeAttribute("data-opened"), n.setAttribute("aria-expanded", "false"), e.style.removeProperty("--_panel-h"), await u(t) !== "canceled" && t.setAttribute("hidden", d);
|
|
22
|
+
}
|
|
23
|
+
function c(e) {
|
|
24
|
+
e.hasAttribute("data-opened") ? p(e) : (f(e), A(e));
|
|
25
|
+
}
|
|
26
|
+
const b = (e) => {
|
|
27
|
+
const { button: t, panel: n } = i(e);
|
|
28
|
+
n.hasAttribute("hidden") && (d = n.getAttribute("hidden"));
|
|
29
|
+
const a = (r) => {
|
|
30
|
+
r.preventDefault(), c(e);
|
|
31
|
+
}, o = (r) => {
|
|
32
|
+
r.preventDefault(), c(e);
|
|
33
|
+
};
|
|
34
|
+
return t.addEventListener("click", a), n.addEventListener("beforematch", o), () => {
|
|
35
|
+
t.removeEventListener("click", a), n.removeEventListener("beforematch", o);
|
|
39
36
|
};
|
|
40
|
-
},
|
|
41
|
-
document.querySelectorAll(".
|
|
42
|
-
|
|
37
|
+
}, y = () => {
|
|
38
|
+
document.querySelectorAll(".c--accordion_item").forEach((t) => {
|
|
39
|
+
b(t);
|
|
43
40
|
});
|
|
44
41
|
};
|
|
45
42
|
export {
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
y as default,
|
|
44
|
+
b as setEvent
|
|
48
45
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as Root } from './Details.astro';
|
|
2
|
+
import { default as Summary } from './Summary.astro';
|
|
3
|
+
import { default as Title } from './Title.astro';
|
|
4
|
+
import { default as Content } from './Content.astro';
|
|
5
|
+
import { default as Icon } from './Icon.astro';
|
|
6
|
+
declare namespace _default {
|
|
7
|
+
export { Root };
|
|
8
|
+
export { Summary };
|
|
9
|
+
export { Title };
|
|
10
|
+
export { Content };
|
|
11
|
+
export { Icon };
|
|
12
|
+
}
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detailsコンポーネントのルート要素用プロパティを生成
|
|
3
|
+
* @param {Object} props - コンポーネントのプロパティ
|
|
4
|
+
* @param {string} props.lismClass - 追加のLismクラス
|
|
5
|
+
* @returns {Object} 処理済みプロパティ
|
|
6
|
+
*/
|
|
7
|
+
export function getDetailsProps({ lismClass, ...props }: {
|
|
8
|
+
lismClass: string;
|
|
9
|
+
}): Object;
|
|
10
|
+
export namespace defaultProps {
|
|
11
|
+
namespace summary {
|
|
12
|
+
let lismClass: string;
|
|
13
|
+
let layout: string;
|
|
14
|
+
let g: string;
|
|
15
|
+
let ai: string;
|
|
16
|
+
}
|
|
17
|
+
namespace title {
|
|
18
|
+
let lismClass_1: string;
|
|
19
|
+
export { lismClass_1 as lismClass };
|
|
20
|
+
export let tag: string;
|
|
21
|
+
export let fx: string;
|
|
22
|
+
export let setPlain: number;
|
|
23
|
+
}
|
|
24
|
+
let icon: {
|
|
25
|
+
lismClass: string;
|
|
26
|
+
tag: string;
|
|
27
|
+
'aria-hidden': string;
|
|
28
|
+
};
|
|
29
|
+
namespace body {
|
|
30
|
+
let lismClass_2: string;
|
|
31
|
+
export { lismClass_2 as lismClass };
|
|
32
|
+
}
|
|
33
|
+
namespace content {
|
|
34
|
+
let lismClass_3: string;
|
|
35
|
+
export { lismClass_3 as lismClass };
|
|
36
|
+
let layout_1: string;
|
|
37
|
+
export { layout_1 as layout };
|
|
38
|
+
export let flow: string;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Details - ルートコンポーネント
|
|
3
|
+
* details要素をレンダリング
|
|
4
|
+
*/
|
|
5
|
+
export function Details({ children, ...props }: {
|
|
6
|
+
[x: string]: any;
|
|
7
|
+
children: any;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
/**
|
|
10
|
+
* Summary - サマリーコンポーネント
|
|
11
|
+
* details要素のsummary部分
|
|
12
|
+
*/
|
|
13
|
+
export function Summary({ children, ...props }: {
|
|
14
|
+
[x: string]: any;
|
|
15
|
+
children: any;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Title - タイトルコンポーネント
|
|
19
|
+
*/
|
|
20
|
+
export function Title({ children, ...props }: {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
children: any;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
/**
|
|
25
|
+
* Icon - アイコンコンポーネント
|
|
26
|
+
*/
|
|
27
|
+
export function Icon({ children, ...props }: {
|
|
28
|
+
[x: string]: any;
|
|
29
|
+
children: any;
|
|
30
|
+
}): import("react").JSX.Element;
|
|
31
|
+
/**
|
|
32
|
+
* Content - コンテンツコンポーネント
|
|
33
|
+
*/
|
|
34
|
+
export function Content({ children, ...props }: {
|
|
35
|
+
[x: string]: any;
|
|
36
|
+
children: any;
|
|
37
|
+
}): import("react").JSX.Element;
|
|
@@ -5,7 +5,7 @@ export function getProps({ lismClass, duration, style, ...props }: {
|
|
|
5
5
|
style?: {} | undefined;
|
|
6
6
|
}): {
|
|
7
7
|
style: {};
|
|
8
|
-
lismClass:
|
|
8
|
+
lismClass: string;
|
|
9
9
|
setPlain: boolean;
|
|
10
10
|
tag: string;
|
|
11
11
|
};
|
|
@@ -15,7 +15,7 @@ export function getInnerProps({ lismClass, offset, style, ...props }: {
|
|
|
15
15
|
offset: any;
|
|
16
16
|
style?: {} | undefined;
|
|
17
17
|
}): {
|
|
18
|
-
lismClass:
|
|
18
|
+
lismClass: string;
|
|
19
19
|
style: {};
|
|
20
20
|
};
|
|
21
21
|
export namespace defaultProps {
|
|
@@ -1,42 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const n = e.getAnimations();
|
|
4
|
-
n.length > 0 && await Promise.allSettled(n.map((c) => c.finished));
|
|
5
|
-
};
|
|
6
|
-
async function d(e) {
|
|
7
|
-
e.open && e.dataset.isOpen || (e.showModal(), requestAnimationFrame(() => {
|
|
8
|
-
e.dataset.isOpen = "1";
|
|
9
|
-
}));
|
|
10
|
-
}
|
|
11
|
-
async function a(e) {
|
|
12
|
-
e.dataset.isOpen !== void 0 && (delete e.dataset.isOpen, await o(e), e.close());
|
|
13
|
-
}
|
|
14
|
-
function l(e) {
|
|
1
|
+
import { waitAnimation as o } from "../../helper/animation.js";
|
|
2
|
+
function r(e) {
|
|
15
3
|
if (!e || !e.id) return;
|
|
16
|
-
|
|
17
|
-
e.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
4
|
+
let n = null;
|
|
5
|
+
const a = document.querySelectorAll(`[data-modal-open="${e.id}"]`), c = e.querySelectorAll(`[data-modal-close="${e.id}"]`), i = () => {
|
|
6
|
+
e.open && e.hasAttribute("data-is-open") || (e.showModal(), requestAnimationFrame(() => {
|
|
7
|
+
e.dataset.isOpen = "1";
|
|
8
|
+
}));
|
|
9
|
+
}, s = async () => {
|
|
10
|
+
e.hasAttribute("data-is-open") && (e.removeAttribute("data-is-open"), await o(e), e.close());
|
|
11
|
+
};
|
|
12
|
+
a.forEach((t) => {
|
|
13
|
+
t == null || t.addEventListener("click", () => {
|
|
14
|
+
t.dataset.targetOpened = "1", n = t, i();
|
|
24
15
|
});
|
|
25
16
|
}), c.forEach((t) => {
|
|
26
|
-
t == null || t.addEventListener("click", (
|
|
27
|
-
|
|
17
|
+
t == null || t.addEventListener("click", () => {
|
|
18
|
+
s();
|
|
28
19
|
});
|
|
20
|
+
}), e.addEventListener("click", (t) => {
|
|
21
|
+
t.target === e && s();
|
|
22
|
+
}), e.addEventListener("close", () => {
|
|
23
|
+
n && (n.removeAttribute("data-target-opened"), n = null);
|
|
29
24
|
}), e.addEventListener("cancel", (t) => {
|
|
30
|
-
t.preventDefault(),
|
|
25
|
+
t.preventDefault(), s();
|
|
31
26
|
});
|
|
32
27
|
}
|
|
33
|
-
const
|
|
34
|
-
const e = document.querySelectorAll(".
|
|
28
|
+
const d = () => {
|
|
29
|
+
const e = document.querySelectorAll(".c--modal");
|
|
35
30
|
e == null || e.forEach((n) => {
|
|
36
|
-
|
|
31
|
+
r(n);
|
|
37
32
|
});
|
|
38
33
|
};
|
|
39
34
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
d as default,
|
|
36
|
+
r as setEvent
|
|
42
37
|
};
|
|
@@ -5,6 +5,7 @@ export { default as Badge } from './Badge/astro';
|
|
|
5
5
|
export { default as Button } from './Button/astro';
|
|
6
6
|
export { default as Callout } from './Callout/astro';
|
|
7
7
|
export { default as Chat } from './Chat/astro';
|
|
8
|
+
export { default as Details } from './Details/astro';
|
|
8
9
|
export { default as Modal } from './Modal/astro';
|
|
9
10
|
export { default as NavMenu } from './NavMenu/astro';
|
|
10
11
|
export { default as ShapeDivider } from './ShapeDivider/astro';
|
|
@@ -5,6 +5,7 @@ export { default as Badge } from './Badge/react';
|
|
|
5
5
|
export { default as Button } from './Button/react';
|
|
6
6
|
export { default as Callout } from './Callout/react';
|
|
7
7
|
export { default as Chat } from './Chat/react';
|
|
8
|
+
export { default as Details } from './Details/react';
|
|
8
9
|
export { default as Modal } from './Modal/react';
|
|
9
10
|
export { default as NavMenu } from './NavMenu/react';
|
|
10
11
|
export { default as ShapeDivider } from './ShapeDivider/react';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type AnimationStatus = 'none' | 'finished' | 'canceled';
|
|
2
|
+
/**
|
|
3
|
+
* 1フレーム待機する(requestAnimationFrame のPromiseラッパー)
|
|
4
|
+
*/
|
|
5
|
+
export declare const waitFrame: () => Promise<number>;
|
|
6
|
+
/**
|
|
7
|
+
* 要素のアニメーションが完了するのを待つ
|
|
8
|
+
* @returns アニメーションの結果ステータス
|
|
9
|
+
* - 'none': アニメーションが実行されていなかった
|
|
10
|
+
* - 'finished': すべてのアニメーションが正常に完了
|
|
11
|
+
* - 'canceled': pause() 等でキャンセルされたアニメーションがあった
|
|
12
|
+
*/
|
|
13
|
+
export declare const waitAnimation: (el: HTMLElement) => Promise<AnimationStatus>;
|
|
14
|
+
/**
|
|
15
|
+
* 実行中のアニメーションがあれば一旦停止させる
|
|
16
|
+
*/
|
|
17
|
+
export declare const maybePauseAnimation: (el: HTMLElement) => void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const a = () => new Promise((n) => requestAnimationFrame(n)), s = async (n) => {
|
|
2
|
+
const t = n.getAnimations();
|
|
3
|
+
return t.length === 0 ? "none" : (await Promise.allSettled(t.map((e) => e.finished))).every((e) => e.status === "fulfilled") ? "finished" : "canceled";
|
|
4
|
+
}, o = (n) => {
|
|
5
|
+
const t = n.getAnimations();
|
|
6
|
+
t.length !== 0 && t.forEach((i) => i.pause());
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
o as maybePauseAnimation,
|
|
10
|
+
s as waitAnimation,
|
|
11
|
+
a as waitFrame
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function uuidv4(): string;
|
package/dist/scripts/tabs.js
CHANGED
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer lism.modules{.
|
|
1
|
+
@layer lism.modules{.c--accordion{--duration:var(--acc-duration,0.25s)}.c--accordion_item{--_panel-h:0px;--_icon-transform:rotate(0deg)}.c--accordion_item[data-opened]{--_icon-transform:rotate(90deg);--_panel-h:auto}.c--accordion_panel{height:var(--_panel-h);transition:height var(--duration)}[hidden]>.c--accordion_content{position:absolute}.c--accordion_icon{display:grid;height:1em;width:1em;&:after,&:before{background-color:currentColor;content:"";display:block;grid-area:1/1}&:before{height:100%;transform:var(--_icon-transform);transition:transform var(--duration);width:.1em}&:after{height:.1em;width:100%}}.c--accordion_button:focus-visible{outline:2px solid currentColor;outline-color:revert;outline-offset:-3px}@media (prefers-reduced-motion:reduce){.c--accordion_item{--duration:0s}}@media (scripting:none){.c--accordion_panel{content-visibility:visible!important;height:auto!important}.c--accordion_content{position:static!important}}}@layer lism.modules{.c--badge{--c:var(--base);--bgc:var(--text);--bdc:transparent;background-color:var(--bgc);border:1px solid var(--bdc);color:var(--c)}.c--badge--outline{--c:var(--text);--bgc:transparent;--bdc:currentColor}.c--button{--c:var(--base);--bgc:var(--text);--bdc:var(--bgc);background-color:var(--bgc);border:1px solid var(--bdc);color:var(--c);gap:var(--s10);place-content:center;place-items:center;text-decoration:none}.c--button--outline{--c:var(--text);--bgc:transparent;--bdc:var(--c)}}@layer lism.modules{:where(.c--button)>.a--icon{scale:1.05}.c--button:where(.l--grid){grid-template-columns:minmax(1em,auto) 1fr minmax(1em,auto);justify-items:center}.c--button:where(.l--grid)>:not(.a--icon){grid-column:2}}@layer lism.modules{.c--chat{--cbox-bgPct:8%;--gta:"avatar name" "avatar body";--gtc:auto 1fr;--gtr:minmax(1.5rem,auto) auto;--_avator-size:clamp(48px,32px + 5cqw,64px);--_deco-size:calc(min(var(--_avator-size), 80px)/4 + 0.25rem);--_deco-mask:none;--_deco-t:0;--_deco-scale:1;--_deco-inset-x:0;gap:0 calc(var(--_deco-size) + 1px)}.c--chat_avatar{grid-area:avatar;width:var(--_avator-size)}.c--chat_name{grid-area:name}.c--chat_body{grid-area:body}.c--chat_content{max-width:var(--sz--s)}.c--chat_deco{height:var(--_deco-size);top:var(--_deco-t);inset-inline:var(--_deco-inset-x);-webkit-mask:var(--_deco-mask) center/contain no-repeat;mask:var(--_deco-mask) center/contain no-repeat;scale:var(--_deco-scale);width:var(--_deco-size)}.c--chat--speak{--_deco-mask:url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8"><path d="M8,8L8,8C7.4,4.8,5.4,2,2.6,0.4L2,0h6V8z"/></svg>')}[data-chat-dir=start]{--_deco-inset-x:auto calc(100% - 1px)}[data-chat-dir=end]{--_deco-scale:-1 1;--_deco-inset-x:calc(100% - 1px) auto;--gta:"name avatar" "body avatar";--gtc:1fr auto}}.c--chat--speak[data-chat-dir=start]>div>.c--chat_content{border-start-start-radius:0}.c--chat--speak[data-chat-dir=end]>div>.c--chat_content{border-start-end-radius:0}@layer lism.modules{.c--navMenu{--link-td:none;--hl:var(--hl--s);--_item-p:var(--s20);--focus-offset:-1px}.c--navMenu_nest{--_item-p:inherit}.c--navMenu_link{padding:var(--_item-p)}.c--navMenu_item,.c--navMenu_nest{--bdc:inherit}.c--shapeDivider{--level:0;--_inner-offset:0px;--_inner-stretch:1;--_flipX:1;--_flipY:1;height:clamp(5px * var(--level),1cqw * var(--level),12px * var(--level));overflow:visible}}@layer lism.modules{.c--shapeDivider:where([data-flip^=X]){--_flipX:-1}.c--shapeDivider:where([data-flip$=Y]){--_flipY:-1}.c--shapeDivider_inner{--offsetY:0.5px;--offsetX:-0.5px;height:100%;scale:calc(var(--_flipX)*var(--_inner-stretch)) var(--_flipY);translate:calc(var(--offsetX) + var(--_inner-offset)) calc(var(--offsetY)*var(--_flipY));width:calc(100% + 1px)}.c--shapeDivider_svg{display:block}:where([data-has-animation=true]) .c--shapeDivider_svg{animation:lism--slideShape 12s linear infinite alternate;transform-origin:100% 0}}@keyframes lism--slideShape{0%{transform:scaleX(4)}to{transform:scaleX(4) translateX(75%)}}
|