@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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/dist/components/Accordion/AccIcon.d.ts +6 -0
  3. package/dist/components/Accordion/Accordion.d.ts +23 -0
  4. package/dist/components/Accordion/astro/__setEvent.d.ts +1 -0
  5. package/dist/components/Accordion/astro/index.d.ts +9 -0
  6. package/dist/components/Accordion/getProps.d.ts +31 -0
  7. package/dist/components/Accordion/index.d.ts +11 -0
  8. package/dist/components/Accordion/script.d.ts +1 -0
  9. package/dist/components/Accordion/setAccordion.d.ts +3 -0
  10. package/dist/components/Accordion/setAccordion.js +37 -0
  11. package/dist/components/Modal/Body.d.ts +4 -0
  12. package/dist/components/Modal/CloseBtn.d.ts +7 -0
  13. package/dist/components/Modal/Inner.d.ts +4 -0
  14. package/dist/components/Modal/Modal.d.ts +6 -0
  15. package/dist/components/Modal/OpenBtn.d.ts +5 -0
  16. package/dist/components/Modal/getProps.d.ts +41 -0
  17. package/dist/components/Modal/index.d.ts +13 -0
  18. package/dist/components/Modal/script.d.ts +1 -0
  19. package/dist/components/Modal/setModal.d.ts +3 -0
  20. package/dist/components/Modal/setModal.js +42 -0
  21. package/dist/components/Tabs/Tab.d.ts +6 -0
  22. package/dist/components/Tabs/TabItem.d.ts +4 -0
  23. package/dist/components/Tabs/TabList.d.ts +1 -0
  24. package/dist/components/Tabs/TabPanel.d.ts +6 -0
  25. package/dist/components/Tabs/Tabs.d.ts +8 -0
  26. package/dist/components/Tabs/getProps.d.ts +6 -0
  27. package/dist/components/Tabs/index.d.ts +13 -0
  28. package/dist/components/Tabs/script.d.ts +1 -0
  29. package/dist/components/Tabs/setEvent.d.ts +2 -0
  30. package/dist/components/Tabs/setEvent.js +29 -0
  31. package/dist/components/__contexts.d.ts +2 -0
  32. package/dist/components/astro.d.ts +1 -0
  33. package/dist/components/react.d.ts +1 -0
  34. package/dist/scripts/accordion.js +4 -0
  35. package/dist/scripts/modal.js +4 -0
  36. package/dist/scripts/tabs.js +6 -0
  37. package/dist/style.css +1 -0
  38. package/package.json +71 -74
  39. package/src/components/Accordion/Accordion.jsx +2 -0
  40. package/src/components/Accordion/_style.css +52 -0
  41. package/src/components/Accordion/astro/Accordion.astro +2 -0
  42. package/src/style.scss +1 -0
  43. 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,6 @@
1
+ export default function AccIcon({ icon, viewBox, children, ...props }: {
2
+ [x: string]: any;
3
+ icon?: string | undefined;
4
+ viewBox: any;
5
+ children?: null | undefined;
6
+ }): import("react").JSX.Element;
@@ -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,9 @@
1
+ declare namespace _default {
2
+ export { Root };
3
+ export { Header };
4
+ export { HeaderLabel };
5
+ export { Body };
6
+ export { Icon };
7
+ export { Label };
8
+ }
9
+ export default _default;
@@ -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,3 @@
1
+ export function setEvent(currentRef: any): (() => void) | undefined;
2
+ export default setAccordion;
3
+ declare function setAccordion(): void;
@@ -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,4 @@
1
+ export default function ModalBody({ children, ...props }: {
2
+ [x: string]: any;
3
+ children: any;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ export default function CloseBtn({ children, modalId, icon, srText, ...props }: {
2
+ [x: string]: any;
3
+ children: any;
4
+ modalId?: string | undefined;
5
+ icon: any;
6
+ srText?: string | undefined;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default function ModalInner({ children, ...props }: {
2
+ [x: string]: any;
3
+ children: any;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ export default Modal;
3
+ declare function Modal({ children, ...props }: {
4
+ [x: string]: any;
5
+ children: any;
6
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ export default function OpenBtn({ children, modalId, ...props }: {
2
+ [x: string]: any;
3
+ children: any;
4
+ modalId?: string | undefined;
5
+ }): import("react").JSX.Element;
@@ -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,3 @@
1
+ export declare function setEvent(modal: HTMLDialogElement): void;
2
+ declare const setModal: () => void;
3
+ export default setModal;
@@ -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,6 @@
1
+ export default function Tab({ tabId, index, isActive, ...props }: {
2
+ [x: string]: any;
3
+ tabId?: string | undefined;
4
+ index?: number | undefined;
5
+ isActive?: boolean | undefined;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,4 @@
1
+ export default function TabItem({ isTabItem, children }: {
2
+ isTabItem?: boolean | undefined;
3
+ children: any;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export default function TabList(props: any): import("react").JSX.Element;
@@ -0,0 +1,6 @@
1
+ export default function TabPanel({ tabId, isActive, index, ...props }: {
2
+ [x: string]: any;
3
+ tabId?: string | undefined;
4
+ isActive?: boolean | undefined;
5
+ index?: number | undefined;
6
+ }): 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,6 @@
1
+ export default function getTabsProps({ lismClass, ...props }: {
2
+ [x: string]: any;
3
+ lismClass: any;
4
+ }): {
5
+ lismClass: any;
6
+ };
@@ -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,2 @@
1
+ export default setEvent;
2
+ declare function setEvent(tabs: any): void;
@@ -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,2 @@
1
+ import { default as React } from 'react';
2
+ export const LayoutContext: React.Context<null>;
@@ -0,0 +1 @@
1
+ export { default as Accordion } from './Accordion/astro';
@@ -0,0 +1 @@
1
+ export { default as Accordion } from './Accordion';
@@ -0,0 +1,4 @@
1
+ import n from "../components/Accordion/setAccordion.js";
2
+ document.addEventListener("DOMContentLoaded", function() {
3
+ n();
4
+ });
@@ -0,0 +1,4 @@
1
+ import t from "../components/Modal/setModal.js";
2
+ document.addEventListener("DOMContentLoaded", function() {
3
+ t();
4
+ });
@@ -0,0 +1,6 @@
1
+ import e from "../components/Tabs/setEvent.js";
2
+ document.addEventListener("DOMContentLoaded", function() {
3
+ document.querySelectorAll(".d--tabs").forEach((t) => {
4
+ e(t);
5
+ });
6
+ });
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
- "name": "@lism-css/ui",
3
- "version": "0.0.0-dev.1",
4
- "description": "A layout-first CSS framework for websites.",
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
- "scripts": {
16
- "dev": "vite",
17
- "build": "vite build && pnpm build:css",
18
- "build:vite": "vite build",
19
- "build:css": "node bin/script-build-css.js",
20
- "lint": "pnpm lint:style",
21
- "lint:style": "stylelint '**/*.{css,scss}'",
22
- "preview": "vite preview"
23
- },
24
- "bin": {
25
- "lism-css": "./bin/cli.mjs"
26
- },
27
- "files": [
28
- "dist",
29
- "src"
30
- ],
31
- "type": "module",
32
- "main": "./dist/index.js",
33
- "exports": {
34
- "./react": {
35
- "import": "./src/components/react.js",
36
- "types": "./dist/components/index.d.ts"
37
- },
38
- "./astro": {
39
- "import": "./src/components/astro.js",
40
- "types": "./dist/components/index.d.ts"
41
- },
42
- "./*.css": "./dist/css/*.css"
43
- },
44
- "homepage": "https://www.lism.style",
45
- "repository": {
46
- "type": "git",
47
- "url": "https://github.com/lism-css/lism-css/tree/main/packages/lism-css"
48
- },
49
- "bugs": {
50
- "url": "https://github.com/lism-css/lism-css/issues"
51
- },
52
- "dependencies": {
53
- "lism-css": "workspace:*"
54
- },
55
- "devDependencies": {
56
- "@babel/cli": "^7.27.2",
57
- "@babel/core": "^7.27.3",
58
- "@babel/preset-env": "^7.27.2",
59
- "@babel/preset-react": "^7.27.1",
60
- "@rollup/plugin-babel": "^6.0.4",
61
- "@vitejs/plugin-react-swc": "^3.10.0",
62
- "glob": "^11.0.2",
63
- "rollup": "^4.41.1",
64
- "typescript": "~5.8.3",
65
- "unplugin-dts": "1.0.0-beta.6",
66
- "vite": "^6.3.5"
67
- },
68
- "peerDependencies": {
69
- "@types/react": "*",
70
- "@types/react-dom": "*",
71
- "react": "^18 || ^19",
72
- "react-dom": "^18 || ^19"
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
+ }
@@ -5,6 +5,8 @@ import { getAccProps, defaultProps } from './getProps';
5
5
  import { setEvent } from './setAccordion';
6
6
  import AccIcon from './AccIcon';
7
7
 
8
+ import './_style.css';
9
+
8
10
  // import { AccContext } from './context';
9
11
 
10
12
  // duration: [s]
@@ -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
+ }
@@ -3,6 +3,8 @@
3
3
  import getLismProps from 'lism-css/lib/getLismProps';
4
4
  import { getAccProps } from '../getProps';
5
5
 
6
+ import '../_style.css';
7
+
6
8
  // Propsの定義
7
9
  // interface Props extends LismProps {
8
10
  // duration?: string | number;
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
- }