@lism-css/ui 0.0.0-dev.1 → 0.0.0-dev.3
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/AccIcon.d.ts +6 -0
- package/dist/components/Accordion/Accordion.d.ts +23 -0
- package/dist/components/Accordion/astro/__setEvent.d.ts +1 -0
- package/dist/components/Accordion/astro/index.d.ts +9 -0
- package/dist/components/Accordion/getProps.d.ts +31 -0
- package/dist/components/Accordion/index.d.ts +11 -0
- package/dist/components/Accordion/script.d.ts +1 -0
- package/dist/components/Accordion/setAccordion.d.ts +3 -0
- package/dist/components/Accordion/setAccordion.js +37 -0
- package/dist/components/Modal/Body.d.ts +4 -0
- package/dist/components/Modal/CloseBtn.d.ts +7 -0
- package/dist/components/Modal/Inner.d.ts +4 -0
- package/dist/components/Modal/Modal.d.ts +6 -0
- package/dist/components/Modal/OpenBtn.d.ts +5 -0
- package/dist/components/Modal/getProps.d.ts +41 -0
- package/dist/components/Modal/index.d.ts +13 -0
- package/dist/components/Modal/script.d.ts +1 -0
- package/dist/components/Modal/setModal.d.ts +3 -0
- package/dist/components/Modal/setModal.js +42 -0
- package/dist/components/Tabs/Tab.d.ts +6 -0
- package/dist/components/Tabs/TabItem.d.ts +4 -0
- package/dist/components/Tabs/TabList.d.ts +1 -0
- package/dist/components/Tabs/TabPanel.d.ts +6 -0
- package/dist/components/Tabs/Tabs.d.ts +8 -0
- package/dist/components/Tabs/getProps.d.ts +6 -0
- package/dist/components/Tabs/index.d.ts +13 -0
- package/dist/components/Tabs/script.d.ts +1 -0
- package/dist/components/Tabs/setEvent.d.ts +2 -0
- package/dist/components/Tabs/setEvent.js +29 -0
- package/dist/components/__contexts.d.ts +2 -0
- package/dist/components/astro.d.ts +1 -0
- package/dist/components/react.d.ts +1 -0
- package/dist/scripts/accordion.js +4 -0
- package/dist/scripts/modal.js +4 -0
- package/dist/scripts/tabs.js +6 -0
- package/dist/style.css +1 -0
- package/package.json +71 -74
- package/src/components/Accordion/Accordion.jsx +2 -0
- package/src/components/Accordion/_style.css +52 -0
- package/src/components/Accordion/astro/Accordion.astro +2 -0
- package/src/style.scss +1 -0
- package/src/components/Accordion/_style.scss +0 -54
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.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export function Accordion({ children, ...props }: {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
children: any;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
export function Header({ children, ...props }: {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
children: any;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
export function Label({ children, ...props }: {
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
children: any;
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
export function Body({ children, flow, innerProps, ...props }: {
|
|
15
|
+
[x: string]: any;
|
|
16
|
+
children: any;
|
|
17
|
+
flow: any;
|
|
18
|
+
innerProps: any;
|
|
19
|
+
}): React.JSX.Element;
|
|
20
|
+
export function HeaderLabel({ children, ...props }: {
|
|
21
|
+
[x: string]: any;
|
|
22
|
+
children: any;
|
|
23
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default setEvent;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function getAccProps({ lismClass, ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
lismClass: any;
|
|
4
|
+
}): {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
};
|
|
7
|
+
export function getAccIconProps({ isTrigger, ...props }: {
|
|
8
|
+
[x: string]: any;
|
|
9
|
+
isTrigger: any;
|
|
10
|
+
}): {
|
|
11
|
+
lismClass: string;
|
|
12
|
+
tag: string;
|
|
13
|
+
};
|
|
14
|
+
export namespace defaultProps {
|
|
15
|
+
namespace header {
|
|
16
|
+
let lismClass: string;
|
|
17
|
+
}
|
|
18
|
+
namespace label {
|
|
19
|
+
let lismClass_1: string;
|
|
20
|
+
export { lismClass_1 as lismClass };
|
|
21
|
+
export let tag: string;
|
|
22
|
+
}
|
|
23
|
+
namespace body {
|
|
24
|
+
let lismClass_2: string;
|
|
25
|
+
export { lismClass_2 as lismClass };
|
|
26
|
+
}
|
|
27
|
+
namespace inner {
|
|
28
|
+
let lismClass_3: string;
|
|
29
|
+
export { lismClass_3 as lismClass };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Accordion as Root, Header, Label, Body, HeaderLabel } from './Accordion';
|
|
2
|
+
import { default as Icon } from './AccIcon';
|
|
3
|
+
declare namespace _default {
|
|
4
|
+
export { Root };
|
|
5
|
+
export { Header };
|
|
6
|
+
export { Label };
|
|
7
|
+
export { Icon };
|
|
8
|
+
export { Body };
|
|
9
|
+
export { HeaderLabel };
|
|
10
|
+
}
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const s = (t) => Promise.all(t.getAnimations().map((e) => e.finished)), d = async (t, e = !1) => {
|
|
2
|
+
if (t.dataset.animating && !e) return;
|
|
3
|
+
t.dataset.animating = "1";
|
|
4
|
+
const n = t.querySelector(".d--accordion_body");
|
|
5
|
+
t.open ? t.open && (t.removeAttribute("data-opened"), await s(n), delete t.dataset.animating, t.open = !1) : (t.open = !0, setTimeout(async () => {
|
|
6
|
+
t.setAttribute("data-opened", ""), await s(n), delete t.dataset.animating;
|
|
7
|
+
}, 5));
|
|
8
|
+
}, u = (t, e) => {
|
|
9
|
+
const n = e.open, o = e.hasAttribute("data-opened");
|
|
10
|
+
n && !o && e.setAttribute("data-opened", ""), !n && o && e.removeAttribute("data-opened");
|
|
11
|
+
}, p = (t) => {
|
|
12
|
+
const e = t, n = e.querySelector('[data-role="trigger"]') || e.querySelector("summary");
|
|
13
|
+
if (!n) return;
|
|
14
|
+
let o = !1;
|
|
15
|
+
const r = e.parentNode;
|
|
16
|
+
r != null && (o = r.dataset.accordionMultiple !== "disallow");
|
|
17
|
+
const c = (a) => {
|
|
18
|
+
if (a.preventDefault(), !o && !e.open) {
|
|
19
|
+
const l = r.querySelector("[data-opened]");
|
|
20
|
+
l != null && d(l, !0);
|
|
21
|
+
}
|
|
22
|
+
d(e);
|
|
23
|
+
}, i = (a) => {
|
|
24
|
+
u(a, e);
|
|
25
|
+
};
|
|
26
|
+
return n.addEventListener("click", c), e.addEventListener("toggle", i), () => {
|
|
27
|
+
n.removeEventListener("click", c), e.removeEventListener("toggle", i);
|
|
28
|
+
};
|
|
29
|
+
}, m = () => {
|
|
30
|
+
document.querySelectorAll(".d--accordion").forEach((e) => {
|
|
31
|
+
p(e);
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
m as default,
|
|
36
|
+
p as setEvent
|
|
37
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export function getProps({ lismClass, duration, style, ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
lismClass?: string | undefined;
|
|
4
|
+
duration: any;
|
|
5
|
+
style?: {} | undefined;
|
|
6
|
+
}): {
|
|
7
|
+
style: {};
|
|
8
|
+
lismClass: any;
|
|
9
|
+
setPlain: boolean;
|
|
10
|
+
tag: string;
|
|
11
|
+
};
|
|
12
|
+
export function getInnerProps({ lismClass, offset, style, ...props }: {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
lismClass?: string | undefined;
|
|
15
|
+
offset: any;
|
|
16
|
+
style?: {} | undefined;
|
|
17
|
+
}): {
|
|
18
|
+
lismClass: any;
|
|
19
|
+
style: {};
|
|
20
|
+
};
|
|
21
|
+
export namespace defaultProps {
|
|
22
|
+
namespace body {
|
|
23
|
+
let lismClass: string;
|
|
24
|
+
}
|
|
25
|
+
namespace closeBtn {
|
|
26
|
+
let tag: string;
|
|
27
|
+
let setPlain: boolean;
|
|
28
|
+
let hov: string;
|
|
29
|
+
let d: string;
|
|
30
|
+
}
|
|
31
|
+
namespace openBtn {
|
|
32
|
+
let tag_1: string;
|
|
33
|
+
export { tag_1 as tag };
|
|
34
|
+
let setPlain_1: boolean;
|
|
35
|
+
export { setPlain_1 as setPlain };
|
|
36
|
+
let hov_1: string;
|
|
37
|
+
export { hov_1 as hov };
|
|
38
|
+
let d_1: string;
|
|
39
|
+
export { d_1 as d };
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as Root } from './Modal';
|
|
2
|
+
import { default as Inner } from './Inner';
|
|
3
|
+
import { default as Body } from './Body';
|
|
4
|
+
import { default as CloseBtn } from './CloseBtn';
|
|
5
|
+
import { default as OpenBtn } from './OpenBtn';
|
|
6
|
+
declare namespace _default {
|
|
7
|
+
export { Root };
|
|
8
|
+
export { Inner };
|
|
9
|
+
export { Body };
|
|
10
|
+
export { CloseBtn };
|
|
11
|
+
export { OpenBtn };
|
|
12
|
+
}
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
let s = null;
|
|
2
|
+
const o = async (e) => {
|
|
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) {
|
|
15
|
+
if (!e || !e.id) return;
|
|
16
|
+
const n = document.querySelectorAll(`[data-modal-open="${e.id}"]`), c = e.querySelectorAll(`[data-modal-close="${e.id}"]`);
|
|
17
|
+
e.addEventListener("click", (t) => {
|
|
18
|
+
t.target === e && a(e);
|
|
19
|
+
}), e.addEventListener("close", (t) => {
|
|
20
|
+
s && (delete s.dataset.targetOpened, s = null), a(e);
|
|
21
|
+
}), n.forEach((t) => {
|
|
22
|
+
t == null || t.addEventListener("click", (i) => {
|
|
23
|
+
t.dataset.targetOpened = "1", s = t, d(e);
|
|
24
|
+
});
|
|
25
|
+
}), c.forEach((t) => {
|
|
26
|
+
t == null || t.addEventListener("click", (i) => {
|
|
27
|
+
a(e);
|
|
28
|
+
});
|
|
29
|
+
}), e.addEventListener("cancel", (t) => {
|
|
30
|
+
t.preventDefault(), a(e);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const u = () => {
|
|
34
|
+
const e = document.querySelectorAll(".d--modal");
|
|
35
|
+
e == null || e.forEach((n) => {
|
|
36
|
+
l(n);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
u as default,
|
|
41
|
+
l as setEvent
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function TabList(props: any): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export default function Tabs({ tabId, defaultIndex, listProps, children, ...props }: {
|
|
3
|
+
[x: string]: any;
|
|
4
|
+
tabId?: string | undefined;
|
|
5
|
+
defaultIndex?: number | undefined;
|
|
6
|
+
listProps?: {} | undefined;
|
|
7
|
+
children: any;
|
|
8
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as Root } from './Tabs';
|
|
2
|
+
import { default as List } from './TabList';
|
|
3
|
+
import { default as Panel } from './TabPanel';
|
|
4
|
+
import { default as Item } from './TabItem';
|
|
5
|
+
import { default as Tab } from './Tab';
|
|
6
|
+
declare namespace _default {
|
|
7
|
+
export { Root };
|
|
8
|
+
export { List };
|
|
9
|
+
export { Panel };
|
|
10
|
+
export { Item };
|
|
11
|
+
export { Tab };
|
|
12
|
+
}
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function b(t) {
|
|
2
|
+
t.preventDefault();
|
|
3
|
+
const r = t.currentTarget;
|
|
4
|
+
c(r);
|
|
5
|
+
}
|
|
6
|
+
const c = (t) => {
|
|
7
|
+
if (t.getAttribute("aria-selected") === "true") return;
|
|
8
|
+
const e = t.getAttribute("aria-controls"), n = document.getElementById(e);
|
|
9
|
+
if (n === null) return;
|
|
10
|
+
const s = t.parentNode.parentNode.querySelector('[aria-selected="true"]'), o = s.getAttribute("aria-controls"), a = document.getElementById(o);
|
|
11
|
+
t.setAttribute("aria-selected", "true"), s.setAttribute("aria-selected", "false"), a.setAttribute("aria-hidden", "true"), n.setAttribute("aria-hidden", "false");
|
|
12
|
+
};
|
|
13
|
+
function f(t) {
|
|
14
|
+
var i;
|
|
15
|
+
t.querySelectorAll('button[role="tab"]').forEach((d) => {
|
|
16
|
+
d.addEventListener("click", function(u) {
|
|
17
|
+
b(u);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
const e = (i = window == null ? void 0 : window.location) == null ? void 0 : i.href;
|
|
21
|
+
if (!e || !(e.indexOf("?lism-tab=") !== -1)) return;
|
|
22
|
+
const o = new URL(e).searchParams.get("lism-tab"), a = t.querySelector(`[aria-controls="${o}"]`);
|
|
23
|
+
a && (t.dataset.hasTabLink = "1", c(a), setTimeout(() => {
|
|
24
|
+
delete t.dataset.hasTabLink;
|
|
25
|
+
}, 10));
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
f as default
|
|
29
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Accordion } from './Accordion/astro';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Accordion } from './Accordion';
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.d--accordion{--duration:var(--acc-duration,0.4s)}.d--accordion[data-opened]{--_notOpen: }.d--accordion:not([data-opened]){--_isOpen: }.d--accordion_header{align-items:center;display:grid;gap:.5em;grid:auto/1fr auto;outline-offset:-1px;&::-webkit-details-marker{display:none}}.d--accordion_body{display:grid;grid:1fr/auto;transition-duration:var(--duration);transition-property:margin-block,padding-block,opacity,grid-template}.d--accordion_inner{overflow:hidden}.d--accordion:not([data-opened])>.d--accordion_body{grid:0fr/auto;margin-block:0!important;padding-block:0!important}.d--accordion_icon{display:grid}.d--accordion_icon .a--icon{rotate:var(--_isOpen,-180deg);transition-duration:var(--duration)}
|
package/package.json
CHANGED
|
@@ -1,75 +1,72 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
"sideEffects": false
|
|
75
|
-
}
|
|
2
|
+
"name": "@lism-css/ui",
|
|
3
|
+
"version": "0.0.0-dev.3",
|
|
4
|
+
"description": "UI components by lism-css.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "ddryo",
|
|
7
|
+
"url": "https://github.com/ddryo"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"css-framework",
|
|
12
|
+
"astro-component",
|
|
13
|
+
"react-component"
|
|
14
|
+
],
|
|
15
|
+
"bin": {
|
|
16
|
+
"lism-css": "./bin/cli.mjs"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src"
|
|
21
|
+
],
|
|
22
|
+
"type": "module",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"exports": {
|
|
25
|
+
"./react": {
|
|
26
|
+
"import": "./src/components/react.js",
|
|
27
|
+
"types": "./dist/components/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./astro": {
|
|
30
|
+
"import": "./src/components/astro.js",
|
|
31
|
+
"types": "./dist/components/index.d.ts"
|
|
32
|
+
},
|
|
33
|
+
"./scripts/*": "./dist/scripts/*.js",
|
|
34
|
+
"./style.css": "./dist/style.css"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://www.lism.style",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/lism-css/lism-css/tree/main/packages/lism-css"
|
|
40
|
+
},
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/lism-css/lism-css/issues"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"lism-css": "0.8.0-rc.2"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@babel/cli": "^7.27.2",
|
|
49
|
+
"@babel/core": "^7.27.3",
|
|
50
|
+
"@babel/preset-env": "^7.27.2",
|
|
51
|
+
"@babel/preset-react": "^7.27.1",
|
|
52
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
53
|
+
"@vitejs/plugin-react-swc": "^3.10.0",
|
|
54
|
+
"glob": "^11.0.2",
|
|
55
|
+
"rollup": "^4.41.1",
|
|
56
|
+
"typescript": "~5.8.3",
|
|
57
|
+
"unplugin-dts": "1.0.0-beta.6",
|
|
58
|
+
"vite": "^6.3.5"
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@types/react": "*",
|
|
62
|
+
"@types/react-dom": "*",
|
|
63
|
+
"react": "^18 || ^19",
|
|
64
|
+
"react-dom": "^18 || ^19"
|
|
65
|
+
},
|
|
66
|
+
"sideEffects": false,
|
|
67
|
+
"scripts": {
|
|
68
|
+
"dev": "vite",
|
|
69
|
+
"build": "vite build && pnpm build:css",
|
|
70
|
+
"build:css": "node build-css.js"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
.d--accordion {
|
|
2
|
+
--duration: var(--acc-duration, 0.4s);
|
|
3
|
+
}
|
|
4
|
+
.d--accordion[data-opened] {
|
|
5
|
+
--_notOpen: ;
|
|
6
|
+
}
|
|
7
|
+
.d--accordion:not([data-opened]) {
|
|
8
|
+
--_isOpen: ;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.d--accordion_header {
|
|
12
|
+
display: grid;
|
|
13
|
+
grid: auto / 1fr auto;
|
|
14
|
+
gap: 0.5em;
|
|
15
|
+
align-items: center;
|
|
16
|
+
outline-offset: -1px; /* overflow:clip|hidden; で見えなくなってしまうのを防ぐ */
|
|
17
|
+
|
|
18
|
+
/* Safariで表示されるデフォルトの三角形アイコンを消す */
|
|
19
|
+
&::-webkit-details-marker {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.d--accordion_body {
|
|
25
|
+
display: grid;
|
|
26
|
+
grid: 1fr / auto;
|
|
27
|
+
transition-property: margin-block, padding-block, opacity, grid-template;
|
|
28
|
+
transition-duration: var(--duration);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* ※ 正常な animation には必須 */
|
|
32
|
+
.d--accordion_inner {
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* 閉じている時 */
|
|
37
|
+
.d--accordion:not([data-opened]) > .d--accordion_body {
|
|
38
|
+
grid: 0fr / auto;
|
|
39
|
+
padding-block: 0 !important;
|
|
40
|
+
margin-block: 0 !important;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* アコーディオンブロックのネスト時、別のアイコンタイプにすると表示が崩れるがそこまでは考慮しない。 */
|
|
44
|
+
.d--accordion_icon {
|
|
45
|
+
display: grid;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* .d--accordion_icon 自体にborderつけたりすると回転が見えてしまうので、中にある .a--icon を回転させる。 */
|
|
49
|
+
.d--accordion_icon .a--icon {
|
|
50
|
+
transition-duration: var(--duration);
|
|
51
|
+
rotate: var(--_isOpen, -180deg);
|
|
52
|
+
}
|
package/src/style.scss
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use './components/Accordion/_style.css';
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
.d--accordion {
|
|
2
|
-
--duration: var(--acc-duration, 0.4s);
|
|
3
|
-
&[data-opened] {
|
|
4
|
-
--_notOpen: ;
|
|
5
|
-
}
|
|
6
|
-
&:not([data-opened]) {
|
|
7
|
-
--_isOpen: ;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.d--accordion_header {
|
|
12
|
-
display: grid;
|
|
13
|
-
grid: auto / 1fr auto;
|
|
14
|
-
gap: 0.5em;
|
|
15
|
-
align-items: center;
|
|
16
|
-
outline-offset: -1px; // overflow:clip|hidden; で見えなくなってしまうのを防ぐ
|
|
17
|
-
|
|
18
|
-
/* Safariで表示されるデフォルトの三角形アイコンを消す */
|
|
19
|
-
&::-webkit-details-marker {
|
|
20
|
-
display: none;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.d--accordion_body {
|
|
25
|
-
display: grid;
|
|
26
|
-
grid: 1fr / auto;
|
|
27
|
-
transition-property: margin-block, padding-block, opacity, grid-template;
|
|
28
|
-
transition-duration: var(--duration);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// ※ 正常な animation には必須
|
|
32
|
-
.d--accordion_inner {
|
|
33
|
-
overflow: hidden;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// 閉じている時
|
|
37
|
-
.d--accordion:not([data-opened]) {
|
|
38
|
-
> .d--accordion_body {
|
|
39
|
-
grid: 0fr / auto;
|
|
40
|
-
padding-block: 0 !important;
|
|
41
|
-
margin-block: 0 !important;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// アコーディオンブロックのネスト時、別のアイコンタイプにすると表示が崩れるがそこまでは考慮しない。
|
|
46
|
-
.d--accordion_icon {
|
|
47
|
-
display: grid;
|
|
48
|
-
|
|
49
|
-
// __icon 自体にborderつけたりすると回転が見えてしまうので、 icon自体を回転させる。
|
|
50
|
-
> .a--icon {
|
|
51
|
-
transition-duration: var(--duration);
|
|
52
|
-
rotate: var(--_isOpen, -180deg);
|
|
53
|
-
}
|
|
54
|
-
}
|