@lism-css/ui 0.9.3 → 0.10.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.ja.md +137 -0
- package/README.md +93 -5
- package/dist/components/Chat/getProps.js +1 -6
- package/dist/components/DummyImage/astro/index.d.ts +1 -0
- package/dist/components/DummyImage/react/DummyImage.d.ts +2 -0
- package/dist/components/DummyImage/react/DummyImage.js +8 -0
- package/dist/components/DummyImage/react/index.d.ts +1 -0
- package/dist/components/DummyText/astro/index.d.ts +1 -0
- package/dist/components/DummyText/getContent.d.ts +11 -0
- package/dist/components/DummyText/getContent.js +9 -0
- package/dist/components/DummyText/react/DummyText.d.ts +10 -0
- package/dist/components/DummyText/react/DummyText.js +10 -0
- package/dist/components/DummyText/react/index.d.ts +1 -0
- package/dist/components/DummyText/texts.d.ts +22 -0
- package/dist/components/DummyText/texts.js +39 -0
- package/dist/components/NavMenu/getProps.js +2 -2
- package/dist/components/Tabs/react/Tab.js +1 -12
- package/dist/components/Tabs/react/Tabs.js +1 -3
- package/dist/components/astro.d.ts +2 -0
- package/dist/components/react.d.ts +2 -0
- package/dist/components/react.js +20 -16
- package/dist/lism-css/dist/components/atomic/Decorator/getProps.js +10 -10
- package/dist/lism-css/dist/components/atomic/Icon/getProps.js +28 -27
- package/dist/lism-css/dist/config/defaults/props.js +6 -1
- package/dist/lism-css/dist/config/defaults/tokens.js +1 -1
- package/dist/lism-css/dist/lib/getMaybeCssVar.js +26 -21
- package/dist/style.css +1 -1
- package/dist/ui.css +1 -1
- package/package.json +5 -4
- package/src/components/Accordion/_style.css +69 -69
- package/src/components/Accordion/astro/Button.astro +2 -2
- package/src/components/Accordion/astro/Heading.astro +1 -1
- package/src/components/Accordion/astro/Item.astro +7 -7
- package/src/components/Accordion/astro/Panel.astro +3 -3
- package/src/components/Accordion/astro/Root.astro +3 -3
- package/src/components/Accordion/getProps.js +54 -54
- package/src/components/Accordion/react/AccIcon.jsx +1 -1
- package/src/components/Accordion/react/Accordion.jsx +34 -34
- package/src/components/Accordion/script.js +1 -1
- package/src/components/Accordion/setAccordion.js +93 -93
- package/src/components/Alert/astro/Alert.astro +6 -6
- package/src/components/Alert/getProps.ts +22 -22
- package/src/components/Alert/presets.ts +26 -26
- package/src/components/Alert/react/Alert.tsx +9 -9
- package/src/components/Avatar/astro/Avatar.astro +2 -2
- package/src/components/Avatar/react/Avatar.jsx +5 -5
- package/src/components/Badge/_style.css +14 -14
- package/src/components/Badge/astro/Badge.astro +4 -4
- package/src/components/Badge/react/Badge.jsx +6 -6
- package/src/components/Button/_style.css +29 -29
- package/src/components/Button/astro/Button.astro +4 -4
- package/src/components/Button/react/Button.jsx +6 -6
- package/src/components/Callout/astro/Callout.astro +13 -13
- package/src/components/Callout/getProps.ts +24 -24
- package/src/components/Callout/presets.ts +26 -26
- package/src/components/Callout/react/Callout.tsx +16 -16
- package/src/components/Chat/_style.css +49 -49
- package/src/components/Chat/astro/Chat.astro +27 -27
- package/src/components/Chat/getProps.js +40 -45
- package/src/components/Chat/react/Chat.jsx +17 -17
- package/src/components/Details/_style.css +39 -39
- package/src/components/Details/astro/Content.astro +3 -3
- package/src/components/Details/astro/Details.astro +1 -1
- package/src/components/Details/astro/Icon.astro +1 -1
- package/src/components/Details/astro/Summary.astro +2 -2
- package/src/components/Details/astro/Title.astro +1 -1
- package/src/components/Details/getProps.js +7 -7
- package/src/components/Details/react/Details.jsx +24 -24
- package/src/components/DummyImage/astro/DummyImage.astro +7 -0
- package/src/components/DummyImage/astro/index.ts +1 -0
- package/src/components/DummyImage/react/DummyImage.tsx +5 -0
- package/src/components/DummyImage/react/index.ts +1 -0
- package/src/components/DummyText/astro/DummyText.astro +9 -0
- package/src/components/DummyText/astro/index.ts +1 -0
- package/src/components/DummyText/getContent.ts +39 -0
- package/src/components/DummyText/react/DummyText.tsx +15 -0
- package/src/components/DummyText/react/index.ts +1 -0
- package/src/components/DummyText/texts.ts +39 -0
- package/src/components/Modal/_style.css +34 -34
- package/src/components/Modal/astro/Body.astro +1 -1
- package/src/components/Modal/astro/CloseBtn.astro +10 -10
- package/src/components/Modal/astro/Inner.astro +1 -1
- package/src/components/Modal/astro/Modal.astro +3 -3
- package/src/components/Modal/astro/OpenBtn.astro +1 -1
- package/src/components/Modal/getProps.js +19 -19
- package/src/components/Modal/react/Body.jsx +5 -5
- package/src/components/Modal/react/CloseBtn.jsx +13 -13
- package/src/components/Modal/react/Inner.jsx +1 -1
- package/src/components/Modal/react/Modal.jsx +10 -10
- package/src/components/Modal/react/OpenBtn.jsx +5 -5
- package/src/components/Modal/script.js +1 -1
- package/src/components/Modal/setModal.ts +92 -92
- package/src/components/NavMenu/_style.css +17 -17
- package/src/components/NavMenu/astro/Item.astro +1 -1
- package/src/components/NavMenu/astro/Link.astro +1 -1
- package/src/components/NavMenu/astro/Nest.astro +1 -1
- package/src/components/NavMenu/astro/Root.astro +1 -1
- package/src/components/NavMenu/getProps.js +28 -28
- package/src/components/NavMenu/react/NavMenu.jsx +4 -4
- package/src/components/ShapeDivider/_style.css +51 -51
- package/src/components/ShapeDivider/astro/ShapeDivider.astro +20 -20
- package/src/components/ShapeDivider/getProps.js +23 -23
- package/src/components/ShapeDivider/react/ShapeDivider.jsx +24 -24
- package/src/components/Tabs/_style.css +29 -29
- package/src/components/Tabs/astro/Tab.astro +2 -2
- package/src/components/Tabs/astro/TabItem.astro +1 -1
- package/src/components/Tabs/astro/TabList.astro +2 -2
- package/src/components/Tabs/astro/TabPanel.astro +2 -2
- package/src/components/Tabs/astro/Tabs.astro +20 -20
- package/src/components/Tabs/astro/transformTabitems.js +30 -30
- package/src/components/Tabs/getProps.js +4 -4
- package/src/components/Tabs/react/Tab.jsx +4 -12
- package/src/components/Tabs/react/TabItem.jsx +1 -1
- package/src/components/Tabs/react/TabList.jsx +2 -2
- package/src/components/Tabs/react/TabPanel.jsx +2 -2
- package/src/components/Tabs/react/Tabs.jsx +44 -46
- package/src/components/Tabs/script.js +4 -4
- package/src/components/Tabs/setTabs.js +70 -70
- package/src/components/astro.ts +2 -0
- package/src/components/react.ts +2 -0
- package/src/helper/animation.ts +10 -10
- package/src/helper/uuid.js +3 -3
- package/dist/lism-css/dist/components/getFilterProps.js +0 -23
- package/dist/lism-css/dist/components/setMaybeTransformStyles.js +0 -7
|
@@ -4,7 +4,7 @@ const e = {
|
|
|
4
4
|
hl: ["base", "xs", "s", "l"],
|
|
5
5
|
lts: ["base", "s", "l"],
|
|
6
6
|
ff: ["base", "accent", "mono"],
|
|
7
|
-
fw: ["
|
|
7
|
+
fw: ["light", "normal", "bold"],
|
|
8
8
|
o: ["-10", "-20", "-30"],
|
|
9
9
|
bdrs: ["5", "10", "20", "30", "40", "50", "99", "inner"],
|
|
10
10
|
bxsh: ["5", "10", "20", "30", "40", "50"],
|
|
@@ -1,37 +1,42 @@
|
|
|
1
|
-
import { TOKENS as
|
|
1
|
+
import { TOKENS as n } from "../config/index.js";
|
|
2
2
|
import a from "./helper/isNumStr.js";
|
|
3
3
|
import o from "./getMaybeTokenValue.js";
|
|
4
|
-
function m(
|
|
5
|
-
if (!
|
|
6
|
-
switch (
|
|
4
|
+
function m(t, e) {
|
|
5
|
+
if (!e) return String(t);
|
|
6
|
+
switch (e) {
|
|
7
7
|
case "space":
|
|
8
|
-
return c(
|
|
8
|
+
return c(t);
|
|
9
9
|
case "color":
|
|
10
|
-
return
|
|
10
|
+
return u(t);
|
|
11
11
|
case "bxsh":
|
|
12
|
-
return
|
|
12
|
+
return t === "0" || t === 0 ? "none" : o(e, t, n);
|
|
13
13
|
default:
|
|
14
|
-
return o(
|
|
14
|
+
return o(e, t, n);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
function c(
|
|
18
|
-
|
|
17
|
+
function c(t) {
|
|
18
|
+
if (t === 0 || t === "0") return "0";
|
|
19
|
+
if (typeof t == "number" || a(t)) {
|
|
20
|
+
const e = typeof t == "number" ? t : Number(t);
|
|
21
|
+
return e < 0 ? `calc(-1 * var(--s${Math.abs(e)}))` : `var(--s${t})`;
|
|
22
|
+
}
|
|
23
|
+
return typeof t == "string" && t.includes(" ") && !t.includes("calc(") && !t.includes("var(") && !t.includes(",") ? t.split(" ").map((e) => c(e)).join(" ") : String(t);
|
|
19
24
|
}
|
|
20
|
-
function
|
|
21
|
-
if (typeof
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
const [i, s, r] =
|
|
25
|
-
return `color-mix(in srgb, ${o("color", i,
|
|
26
|
-
} else if (
|
|
27
|
-
const [i, s] =
|
|
28
|
-
return `color-mix(in srgb, ${o("color", i,
|
|
25
|
+
function u(t) {
|
|
26
|
+
if (typeof t == "string" && t.endsWith("%")) {
|
|
27
|
+
const e = t.split(":");
|
|
28
|
+
if (e.length === 3) {
|
|
29
|
+
const [i, s, r] = e;
|
|
30
|
+
return `color-mix(in srgb, ${o("color", i, n)} ${r}, ${o("color", s, n)})`;
|
|
31
|
+
} else if (e.length === 2) {
|
|
32
|
+
const [i, s] = e;
|
|
33
|
+
return `color-mix(in srgb, ${o("color", i, n)} ${s}, transparent)`;
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
|
-
return o("color",
|
|
36
|
+
return o("color", t, n);
|
|
32
37
|
}
|
|
33
38
|
export {
|
|
34
39
|
m as default,
|
|
35
|
-
|
|
40
|
+
u as getMaybeColorVar,
|
|
36
41
|
c as getMaybeSpaceVar
|
|
37
42
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer lism
|
|
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%)}}
|
package/dist/ui.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer lism
|
|
1
|
+
@layer lism-modules{.c--accordion{--duration: var(--acc-duration, .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;width:1em;height:1em}.c--accordion_icon:before,.c--accordion_icon:after{content:"";display:block;grid-area:1 / 1;background-color:currentColor}.c--accordion_icon:before{width:.1em;height:100%;transition:transform var(--duration);transform:var(--_icon-transform)}.c--accordion_icon:after{height:.1em;width:100%}.c--accordion_button:focus-visible{outline:solid 2px currentColor;outline-color:revert;outline-offset:-3px}@media(prefers-reduced-motion:reduce){.c--accordion_item{--duration: 0s}}@media(scripting:none){.c--accordion_panel{height:auto!important;content-visibility:visible!important}.c--accordion_content{position:static!important}}}@layer lism-modules{.c--details{--duration: var(--acc-duration, .25s);--_icon-scale: 1.1;--_icon-transform: rotate(0deg);--_content-gtr: 0fr}.c--details[open]{--_icon-transform: scaleY(-1);--_content-gtr: 1fr}.c--details_summary::-webkit-details-marker{display:none}.c--details_icon{--svg: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="1em" height="1em" fill="currentColor"><path d="M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"></path></svg>');display:inline-grid;background-color:currentColor;-webkit-mask:var(--svg) no-repeat center center / contain;mask:var(--svg) no-repeat center center / contain;scale:var(--_icon-scale);transition:transform var(--duration);transform:var(--_icon-transform)}.c--details::details-content{display:grid;grid-template-rows:var(--_content-gtr);transition-duration:var(--duration);transition-property:content-visibility,grid-template;transition-behavior:allow-discrete}.c--details_body{overflow:hidden}}@layer lism-modules{.c--modal{--flow: 0;--duration: var(--modal-duration, .4s);width:100%;height:100%;max-width:100%;max-height:100%;overflow:unset;background:var(--backdrop-bg, rgb(0 0 0 / .6));transition-duration:var(--duration);transition-property:opacity}.c--modal::backdrop{background:none}.c--modal[open]{display:flex;flex-direction:column;justify-content:center}.c--modal_inner{--offset: 0 0;background-color:var(--base);transition:translate var(--duration);max-height:100%}.c--modal:not([data-is-open]){opacity:0}.c--modal:not([data-is-open])>.c--modal_inner{translate:var(--offset)}}@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_nest,.c--navMenu_item{--bdc: inherit}}@layer lism-modules{.c--tabs{display:grid;grid:"list" "panel" / 100%}.c--tabs_list{grid-area:list;display:flex;overflow-x:auto}.c--tabs_tab[aria-selected=true]{--_notSelected: }.c--tabs_tab[aria-selected=false]{--_isSelected: }:where(.c--tabs_tab){color:var(--_notSelected, var(--text-2))}.c--tabs_panel{grid-area:panel;width:100%}.c--tabs_panel:where([aria-hidden=true]){display:none}}@layer lism-modules{.c--badge{--c: var(--base);--bgc: var(--text);--bdc: transparent;color:var(--c);background-color:var(--bgc);border:solid 1px var(--bdc)}.c--badge--outline{--c: var(--text);--bgc: transparent;--bdc: currentColor}}@layer lism-modules{.c--button{--c: var(--base);--bgc: var(--text);--bdc: var(--bgc);color:var(--c);background-color:var(--bgc);border:solid 1px var(--bdc);gap:var(--s10);text-decoration:none;place-content:center;place-items:center}.c--button--outline{--c: var(--text);--bgc: transparent;--bdc: var(--c)}: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 + .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{top:var(--_deco-t);inset-inline:var(--_deco-inset-x);width:var(--_deco-size);height:var(--_deco-size);scale:var(--_deco-scale);-webkit-mask:var(--_deco-mask) center / contain no-repeat;mask:var(--_deco-mask) center / contain no-repeat}.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--shapeDivider{--level: 0;--_inner-offset: 0px;--_inner-stretch: 1;--_flipX: 1;--_flipY: 1;height:clamp(calc(5px * var(--level)),calc(1cqw * var(--level)),calc(12px * var(--level)));overflow:visible}.c--shapeDivider:where([data-flip^=X]){--_flipX: -1}.c--shapeDivider:where([data-flip$=Y]){--_flipY: -1}.c--shapeDivider_inner{--offsetY: .5px;--offsetX: -.5px;height:100%;width:calc(100% + 1px);scale:calc(var(--_flipX) * var(--_inner-stretch)) var(--_flipY);translate:calc(var(--offsetX) + var(--_inner-offset)) calc(var(--offsetY) * var(--_flipY))}.c--shapeDivider_svg{display:block}:where([data-has-animation=true]) .c--shapeDivider_svg{transform-origin:100% 0;animation:lism--slideShape 12s infinite alternate linear}}@keyframes lism--slideShape{0%{transform:scaleX(4)}to{transform:scaleX(4) translate(75%)}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lism-css/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "UI components by lism-css.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "ddryo",
|
|
@@ -30,16 +30,16 @@
|
|
|
30
30
|
"./scripts/*": "./dist/scripts/*.js",
|
|
31
31
|
"./style.css": "./dist/style.css"
|
|
32
32
|
},
|
|
33
|
-
"homepage": "https://
|
|
33
|
+
"homepage": "https://lism-css.com",
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
|
36
|
-
"url": "https://github.com/lism-css/lism-css/tree/main/packages/lism-
|
|
36
|
+
"url": "https://github.com/lism-css/lism-css/tree/main/packages/lism-ui"
|
|
37
37
|
},
|
|
38
38
|
"bugs": {
|
|
39
39
|
"url": "https://github.com/lism-css/lism-css/issues"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"lism-css": "0.
|
|
42
|
+
"lism-css": "0.10.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@babel/cli": "^7.28.6",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"sideEffects": false,
|
|
66
66
|
"scripts": {
|
|
67
|
+
"format": "prettier --write . --ignore-path ../../.prettierignore",
|
|
67
68
|
"dev": "vite",
|
|
68
69
|
"build": "vite build && pnpm build:css",
|
|
69
70
|
"build:css": "node build-css.js"
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
@layer lism
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
@layer lism-modules {
|
|
2
|
+
.c--accordion {
|
|
3
|
+
--duration: var(--acc-duration, 0.25s);
|
|
4
|
+
}
|
|
5
|
+
.c--accordion_item {
|
|
6
|
+
--_panel-h: 0px;
|
|
7
|
+
--_icon-transform: rotate(0deg);
|
|
8
|
+
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
/* 開いている時 */
|
|
11
|
+
.c--accordion_item[data-opened] {
|
|
12
|
+
--_icon-transform: rotate(90deg);
|
|
13
|
+
--_panel-h: auto; /* Note: アニメーション時、jsでセットされる */
|
|
14
|
+
}
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
/* .c--accordion_button {} */
|
|
17
|
+
.c--accordion_panel {
|
|
18
|
+
height: var(--_panel-h);
|
|
19
|
+
transition: height var(--duration);
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
/* コンテンツの paddingは __panel ではなくこっちにつける */
|
|
23
|
+
/* .c--accordion_content {} */
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
/* パネルが完全に閉じている時にabsoluteで飛ばしておくと、Chromeでも検索時に正常にハイライトされるようになる(なぜかは不明) */
|
|
26
|
+
[hidden] > .c--accordion_content {
|
|
27
|
+
position: absolute;
|
|
28
|
+
}
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
/* アイコンの描画 */
|
|
31
|
+
.c--accordion_icon {
|
|
32
|
+
display: grid;
|
|
33
|
+
width: 1em;
|
|
34
|
+
height: 1em;
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
&::before,
|
|
37
|
+
&::after {
|
|
38
|
+
content: '';
|
|
39
|
+
display: block;
|
|
40
|
+
grid-area: 1 / 1;
|
|
41
|
+
background-color: currentColor;
|
|
42
|
+
}
|
|
43
|
+
&::before {
|
|
44
|
+
width: 0.1em;
|
|
45
|
+
height: 100%;
|
|
46
|
+
transition: transform var(--duration);
|
|
47
|
+
transform: var(--_icon-transform);
|
|
48
|
+
}
|
|
49
|
+
&::after {
|
|
50
|
+
height: 0.1em;
|
|
51
|
+
width: 100%;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
/* フォーカス時のアウトラインを少し内側に寄せる( overflow:hidden によって途切れてしまうので) */
|
|
56
|
+
.c--accordion_button:focus-visible {
|
|
57
|
+
outline: solid 2px currentColor;
|
|
58
|
+
outline-color: revert;
|
|
59
|
+
outline-offset: -3px; /* offset 調整だけだとブラウザ間の差が大きい */
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
/* --- 「視差効果を減らす」設定を考慮 --- */
|
|
63
|
+
@media (prefers-reduced-motion: reduce) {
|
|
64
|
+
.c--accordion_item {
|
|
65
|
+
--duration: 0s;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
/* --- JSオフ環境の考慮 --- */
|
|
70
|
+
@media (scripting: none) {
|
|
71
|
+
.c--accordion_panel {
|
|
72
|
+
height: auto !important;
|
|
73
|
+
content-visibility: visible !important;
|
|
74
|
+
}
|
|
75
|
+
.c--accordion_content {
|
|
76
|
+
position: static !important;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
79
|
}
|
|
@@ -21,11 +21,11 @@ const slotHtml = rendered.includes('__LISM_ACC_ID__') ? rendered.replaceAll('__L
|
|
|
21
21
|
---
|
|
22
22
|
|
|
23
23
|
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
slotHtml !== null ? (
|
|
25
|
+
<div {...lismProps} set:html={slotHtml} />
|
|
26
|
+
) : (
|
|
27
|
+
<div {...lismProps}>
|
|
28
|
+
<slot />
|
|
29
|
+
</div>
|
|
30
|
+
)
|
|
31
31
|
}
|
|
@@ -8,10 +8,10 @@ const rootProps = getRootProps(Astro.props || {});
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<Stack {...rootProps}>
|
|
11
|
-
|
|
11
|
+
<slot />
|
|
12
12
|
</Stack>
|
|
13
13
|
|
|
14
14
|
<script>
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import setAccordion from '../setAccordion';
|
|
16
|
+
setAccordion();
|
|
17
17
|
</script>
|
|
@@ -1,77 +1,77 @@
|
|
|
1
1
|
import atts from 'lism-css/lib/helper/atts';
|
|
2
2
|
|
|
3
3
|
export function getRootProps({ lismClass, allowMultiple, ...props }) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
props.lismClass = atts(lismClass, 'c--accordion');
|
|
5
|
+
if (allowMultiple) props['data-allow-multiple'] = '';
|
|
6
|
+
return props;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// duration: [s]
|
|
10
10
|
export function getItemProps({ lismClass, ...props }) {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
props.lismClass = atts(lismClass, 'c--accordion_item');
|
|
12
|
+
return props;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export function getHeadingProps(props) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
const defaultProps = {
|
|
17
|
+
lismClass: 'c--accordion_heading',
|
|
18
|
+
as: 'div',
|
|
19
|
+
setPlain: 1,
|
|
20
|
+
};
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
const returnProps = { ...defaultProps, ...props };
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
// div の時は role 付与
|
|
25
|
+
if (returnProps.as === 'div') {
|
|
26
|
+
returnProps.role = 'heading';
|
|
27
|
+
}
|
|
28
|
+
return returnProps;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// id: Context から取得できればそれを優先(React用)
|
|
32
32
|
export function getPanelProps({ lismClass, _contextID, accID = '__LISM_ACC_ID__', isOpen = false, ...props }) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
// panel側は必要最低限のプロパティのみ。
|
|
34
|
+
const panelProps = {
|
|
35
|
+
lismClass: atts(lismClass, 'c--accordion_panel'),
|
|
36
|
+
id: _contextID || accID,
|
|
37
|
+
hidden: isOpen ? undefined : 'until-found',
|
|
38
|
+
pos: 'relative',
|
|
39
|
+
ov: 'hidden',
|
|
40
|
+
};
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// 余白などその他の指定は全て _content 側へ渡す
|
|
43
|
+
const contentProps = { lismClass: 'c--accordion_content', layout: 'flow', ...props };
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
45
|
+
// content側へ移すprops
|
|
46
|
+
// ['p', 'px', 'py', 'pl', 'pr', 'pt', 'pb', 'px-s', 'px-e', 'py-s', 'py-e'].forEach((prop) => {
|
|
47
|
+
// if (props[prop]) {
|
|
48
|
+
// contentProps[prop] = props[prop];
|
|
49
|
+
// delete props[prop];
|
|
50
|
+
// }
|
|
51
|
+
// });
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
// 2つ返す
|
|
54
|
+
return { panelProps, contentProps };
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export const defaultProps = {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
// header: { lismClass: 'c--accordion_header' },
|
|
59
|
+
button: {
|
|
60
|
+
lismClass: 'c--accordion_button',
|
|
61
|
+
as: 'button',
|
|
62
|
+
layout: 'flex',
|
|
63
|
+
setPlain: 1,
|
|
64
|
+
g: '10',
|
|
65
|
+
w: '100%',
|
|
66
|
+
ai: 'center',
|
|
67
|
+
jc: 'between',
|
|
68
|
+
},
|
|
69
|
+
icon: {
|
|
70
|
+
lismClass: 'c--accordion_icon a--icon',
|
|
71
|
+
as: 'span',
|
|
72
|
+
// d: 'grid',
|
|
73
|
+
pi: 'center',
|
|
74
|
+
fxsh: '0',
|
|
75
|
+
'aria-hidden': 'true',
|
|
76
|
+
},
|
|
77
77
|
};
|
|
@@ -16,34 +16,34 @@ const AccordionContext = createContext(null);
|
|
|
16
16
|
* 複数の AccordionItem をラップするルート要素
|
|
17
17
|
*/
|
|
18
18
|
export function AccordionRoot({ children, ...props }) {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const rootProps = getRootProps(props);
|
|
20
|
+
return <Stack {...rootProps}>{children}</Stack>;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* 個別のアコーディオンアイテム(<div> ベース、setEvent で開閉イベントを登録)
|
|
25
25
|
*/
|
|
26
26
|
export function AccordionItem({ children, ...props }) {
|
|
27
|
-
|
|
27
|
+
const ref = useRef(null);
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
// コンポーネント単位でユニークIDを生成
|
|
30
|
+
const accID = useId();
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
// マウント時に開閉イベントを登録(アンマウント時にクリーンアップ)
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (!ref.current) return;
|
|
35
|
+
return setEvent(ref.current);
|
|
36
|
+
}, []);
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
const lismProps = getLismProps(getItemProps(props));
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
return (
|
|
41
|
+
<AccordionContext.Provider value={{ accID }}>
|
|
42
|
+
<div ref={ref} {...lismProps}>
|
|
43
|
+
{children}
|
|
44
|
+
</div>
|
|
45
|
+
</AccordionContext.Provider>
|
|
46
|
+
);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
@@ -51,7 +51,7 @@ export function AccordionItem({ children, ...props }) {
|
|
|
51
51
|
* as に h2〜h6 を指定すると role は付与されない
|
|
52
52
|
*/
|
|
53
53
|
export function Heading({ children, ...props }) {
|
|
54
|
-
|
|
54
|
+
return <Lism {...getHeadingProps(props)}>{children}</Lism>;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/**
|
|
@@ -59,27 +59,27 @@ export function Heading({ children, ...props }) {
|
|
|
59
59
|
* accID: Context から取得できればそれを優先、なければ props / プレースホルダー
|
|
60
60
|
*/
|
|
61
61
|
export function Button({ children, accID: _accID = '__LISM_ACC_ID__', ...props }) {
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
const ctx = useContext(AccordionContext);
|
|
63
|
+
const accID = ctx?.accID || _accID;
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
return (
|
|
66
|
+
<Lism {...defaultProps.button} {...props} aria-controls={accID} aria-expanded="false">
|
|
67
|
+
{children}
|
|
68
|
+
<AccIcon />
|
|
69
|
+
</Lism>
|
|
70
|
+
);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
74
|
* パネル
|
|
75
75
|
*/
|
|
76
76
|
export function Panel({ children, ...props }) {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const ctx = useContext(AccordionContext);
|
|
78
|
+
const { panelProps, contentProps } = getPanelProps({ _contextID: ctx?.accID, ...props });
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
80
|
+
return (
|
|
81
|
+
<Lism {...panelProps}>
|
|
82
|
+
<Lism {...contentProps}>{children}</Lism>
|
|
83
|
+
</Lism>
|
|
84
|
+
);
|
|
85
85
|
}
|