@lism-css/ui 0.9.1 → 0.9.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 (85) hide show
  1. package/README.md +49 -0
  2. package/dist/components/Accordion/getProps.js +53 -0
  3. package/dist/components/Accordion/react/AccIcon.js +9 -0
  4. package/dist/components/Accordion/react/Accordion.d.ts +5 -6
  5. package/dist/components/Accordion/react/Accordion.js +45 -0
  6. package/dist/components/Accordion/react/index.js +6 -0
  7. package/dist/components/Alert/getProps.js +20 -0
  8. package/dist/components/Alert/presets.js +29 -0
  9. package/dist/components/Alert/react/Alert.js +16 -0
  10. package/dist/components/Avatar/react/Avatar.js +8 -0
  11. package/dist/components/Badge/react/Badge.js +12 -0
  12. package/dist/components/Button/react/Button.js +12 -0
  13. package/dist/components/Callout/getProps.js +22 -0
  14. package/dist/components/Callout/presets.js +29 -0
  15. package/dist/components/Callout/react/Callout.js +20 -0
  16. package/dist/components/Chat/getProps.js +52 -0
  17. package/dist/components/Chat/react/Chat.js +22 -0
  18. package/dist/components/Details/getProps.js +15 -0
  19. package/dist/components/Details/react/Details.js +28 -0
  20. package/dist/components/Details/react/index.js +5 -0
  21. package/dist/components/Modal/getProps.js +25 -0
  22. package/dist/components/Modal/react/Body.js +9 -0
  23. package/dist/components/Modal/react/CloseBtn.js +13 -0
  24. package/dist/components/Modal/react/Inner.js +9 -0
  25. package/dist/components/Modal/react/Modal.d.ts +1 -2
  26. package/dist/components/Modal/react/Modal.js +17 -0
  27. package/dist/components/Modal/react/OpenBtn.js +9 -0
  28. package/dist/components/Modal/react/index.js +9 -0
  29. package/dist/components/Modal/setModal.js +16 -17
  30. package/dist/components/NavMenu/getProps.js +40 -0
  31. package/dist/components/NavMenu/react/NavMenu.js +24 -0
  32. package/dist/components/NavMenu/react/index.js +5 -0
  33. package/dist/components/ShapeDivider/getProps.js +22 -0
  34. package/dist/components/ShapeDivider/react/ShapeDivider.js +26 -0
  35. package/dist/components/Tabs/getProps.js +10 -0
  36. package/dist/components/Tabs/react/Tab.js +20 -0
  37. package/dist/components/Tabs/react/TabItem.js +7 -0
  38. package/dist/components/Tabs/react/TabList.js +8 -0
  39. package/dist/components/Tabs/react/TabPanel.js +9 -0
  40. package/dist/components/Tabs/react/Tabs.d.ts +1 -2
  41. package/dist/components/Tabs/react/Tabs.js +50 -0
  42. package/dist/components/Tabs/react/index.js +9 -0
  43. package/dist/components/Tabs/setTabs.js +10 -11
  44. package/dist/components/react.js +26 -0
  45. package/dist/lism-css/dist/components/Center/index.js +8 -0
  46. package/dist/lism-css/dist/components/Flex/index.js +8 -0
  47. package/dist/lism-css/dist/components/Flow/index.js +8 -0
  48. package/dist/lism-css/dist/components/Frame/index.js +8 -0
  49. package/dist/lism-css/dist/components/Grid/index.js +8 -0
  50. package/dist/lism-css/dist/components/Lism/index.js +8 -0
  51. package/dist/lism-css/dist/components/Stack/index.js +8 -0
  52. package/dist/lism-css/dist/components/atomic/Decorator/getProps.js +15 -0
  53. package/dist/lism-css/dist/components/atomic/Decorator/index.js +9 -0
  54. package/dist/lism-css/dist/components/atomic/Icon/SVG.js +22 -0
  55. package/dist/lism-css/dist/components/atomic/Icon/getProps.js +55 -0
  56. package/dist/lism-css/dist/components/atomic/Icon/index.js +12 -0
  57. package/dist/lism-css/dist/components/atomic/Icon/presets.js +276 -0
  58. package/dist/lism-css/dist/components/getFilterProps.js +23 -0
  59. package/dist/lism-css/dist/components/setMaybeTransformStyles.js +7 -0
  60. package/dist/lism-css/dist/config/default-config.js +11 -0
  61. package/dist/lism-css/dist/config/defaults/props.js +335 -0
  62. package/dist/lism-css/dist/config/defaults/states.js +39 -0
  63. package/dist/lism-css/dist/config/defaults/tokens.js +30 -0
  64. package/dist/lism-css/dist/config/helper/getSvgUrl.js +4 -0
  65. package/dist/lism-css/dist/config/helper.js +27 -0
  66. package/dist/lism-css/dist/config/index.js +17 -0
  67. package/dist/lism-css/dist/lib/getBpData.js +19 -0
  68. package/dist/lism-css/dist/lib/getLayoutProps.js +30 -0
  69. package/dist/lism-css/dist/lib/getLismProps.js +188 -0
  70. package/dist/lism-css/dist/lib/getMaybeCssVar.js +37 -0
  71. package/dist/lism-css/dist/lib/getMaybeTokenValue.js +26 -0
  72. package/dist/lism-css/dist/lib/getUtilKey.js +13 -0
  73. package/dist/lism-css/dist/lib/helper/atts.js +11 -0
  74. package/dist/lism-css/dist/lib/helper/filterEmptyObj.js +10 -0
  75. package/dist/lism-css/dist/lib/helper/hasSomeKeys.js +6 -0
  76. package/dist/lism-css/dist/lib/helper/isEmptyObj.js +6 -0
  77. package/dist/lism-css/dist/lib/helper/isNumStr.js +6 -0
  78. package/dist/lism-css/dist/lib/helper/splitWithComma.js +6 -0
  79. package/dist/lism-css/dist/lib/isPresetValue.js +13 -0
  80. package/dist/lism-css/dist/lib/isTokenValue.js +27 -0
  81. package/dist/ui.css +1 -0
  82. package/package.json +6 -5
  83. package/src/components/Accordion/react/Accordion.jsx +8 -7
  84. package/src/components/Modal/react/Modal.jsx +4 -3
  85. package/src/components/Tabs/react/Tabs.jsx +9 -8
@@ -0,0 +1,188 @@
1
+ import { STATES as P, PROPS as S } from "../config/index.js";
2
+ import j from "./getLayoutProps.js";
3
+ import U from "./isPresetValue.js";
4
+ import w from "./isTokenValue.js";
5
+ import v from "./getUtilKey.js";
6
+ import m from "./getMaybeCssVar.js";
7
+ import z from "./getBpData.js";
8
+ import E from "./helper/atts.js";
9
+ import N from "./helper/isEmptyObj.js";
10
+ import C from "./helper/filterEmptyObj.js";
11
+ import k from "./helper/splitWithComma.js";
12
+ const _ = (h) => {
13
+ const s = S[h];
14
+ return s && s?.token || "";
15
+ };
16
+ class x {
17
+ // propList = {};
18
+ className = "";
19
+ uClasses = [];
20
+ lismState = [];
21
+ styles = {};
22
+ attrs = {};
23
+ _propConfig;
24
+ constructor(s) {
25
+ const { forwardedRef: t, class: e, className: i, lismClass: o, variant: r, style: l = {}, _propConfig: n = {}, ...c } = s;
26
+ this.styles = { ...l }, this._propConfig = { ...n };
27
+ let f = o || "";
28
+ if (r && o) {
29
+ const y = o.split(" "), a = y[0], u = `${a}--${r}`;
30
+ f = [a, u, ...y.slice(1)].join(" ");
31
+ }
32
+ N(c) || (this.attrs = { ...c }, this.analyzeProps()), t && (this.attrs.ref = t), this.className = E(i || e, f, this.lismState, this.uClasses);
33
+ }
34
+ analyzeState(s, t) {
35
+ const { className: e, preset: i, presetClass: o, customVar: r, tokenKey: l, setStyles: n } = s;
36
+ t === !0 ? this.lismState.push(e) : i && U(i, t) ? this.lismState.push(`${e} ${o}:${String(t)}`) : t && (this.lismState.push(e), l && r ? this.addStyle(r, m(t, l)) : n && typeof t == "string" && this.addStyles(n(t)));
37
+ }
38
+ // prop解析
39
+ analyzeProps() {
40
+ Object.keys(this.attrs).forEach((s) => {
41
+ if (Object.hasOwn(P, s)) {
42
+ const t = this.extractProp(s), e = P[s];
43
+ typeof e == "string" ? t && this.lismState.push(e) : this.analyzeState(e, t);
44
+ } else if (Object.hasOwn(S, s)) {
45
+ const t = this.attrs[s];
46
+ delete this.attrs[s], this.analyzeLismProp(s, t);
47
+ } else if (s === "hov") {
48
+ const t = this.extractProp(s);
49
+ this.setHovProps(t);
50
+ } else if (s === "css") {
51
+ const t = this.extractProp("css");
52
+ this.addStyles(t);
53
+ }
54
+ });
55
+ }
56
+ // Lism Prop 解析
57
+ analyzeLismProp(s, t) {
58
+ if (t == null) return;
59
+ let e = S[s] || null;
60
+ if (e === null) return;
61
+ this._propConfig?.[s] && (e = Object.assign({}, e, this._propConfig[s]));
62
+ const { base: i, ...o } = z(t);
63
+ this.setAttrs(s, i, e), Object.keys(o).forEach((r) => {
64
+ e && this.setAttrs(s, o[r], e, r);
65
+ });
66
+ }
67
+ addUtil(s) {
68
+ this.uClasses.push(s);
69
+ }
70
+ addUtils(s) {
71
+ this.uClasses.push(...s);
72
+ }
73
+ // addState(state) {
74
+ // this.stateClasses.push(state);
75
+ // }
76
+ addStyle(s, t) {
77
+ this.styles[s] = t;
78
+ }
79
+ addStyles(s) {
80
+ this.styles = { ...this.styles, ...s };
81
+ }
82
+ addAttrs(s) {
83
+ this.addStyles(s.styles || {}), this.addUtils(s.utils || []);
84
+ }
85
+ extractProp(s) {
86
+ const t = this.attrs[s];
87
+ return this.attrs[s] === void 0 ? null : (delete this.attrs[s], t);
88
+ }
89
+ extractProps(s) {
90
+ const t = {};
91
+ return s.forEach((e) => {
92
+ this.attrs[e] !== void 0 && (t[e] = this.attrs[e], delete this.attrs[e]);
93
+ }), t;
94
+ }
95
+ // utilクラスを追加するか、styleにセットするかの分岐処理 @base
96
+ // 値が null, undefined, '', false の時はスキップ
97
+ setAttrs(s, t, e = {}, i = "") {
98
+ if (t == null || t === "" || t === !1) return;
99
+ let o = `--${s}`, r = `-${String(e.utilKey || s)}`;
100
+ if (i && (o = `--${s}_${i}`, r += `_${i}`), typeof t == "string" && t.startsWith(":")) {
101
+ this.addUtil(`${r}:${t.replace(":", "")}`);
102
+ return;
103
+ }
104
+ if (!i) {
105
+ const { presets: u, tokenClass: O, utils: g, shorthands: b } = e;
106
+ if (u && U(u, t)) {
107
+ const d = typeof t == "string" || typeof t == "number" ? String(t) : "";
108
+ d && this.addUtil(`${r}:${d}`);
109
+ return;
110
+ }
111
+ if (O && e.token && w(e.token, t)) {
112
+ const d = typeof t == "string" || typeof t == "number" ? String(t) : "";
113
+ d && this.addUtil(`${r}:${d}`);
114
+ return;
115
+ }
116
+ let p = "";
117
+ if (g && typeof t == "string" && (p = v(g, t)), !p && b && typeof t == "string" && (p = v(b, t, !0)), p) {
118
+ this.addUtil(`${r}:${p}`);
119
+ return;
120
+ }
121
+ }
122
+ if (t === !0 || t === "-") {
123
+ this.addUtil(r);
124
+ return;
125
+ }
126
+ const { prop: l, isVar: n, alwaysVar: c, token: f, bp: y } = e;
127
+ let a;
128
+ if (f && (typeof t == "string" || typeof t == "number") ? a = m(t, f) : typeof t == "string" || typeof t == "number" ? a = t : a = JSON.stringify(t), !i) {
129
+ if (n) {
130
+ this.addStyle(`--${s}`, a);
131
+ return;
132
+ } else if (!y && !c) {
133
+ this.addStyle(l, a);
134
+ return;
135
+ }
136
+ }
137
+ this.addUtil(r), this.addStyle(o, a);
138
+ }
139
+ // setPassProps(passVars) {
140
+ // let dataList = [];
141
+ // Object.keys(passVars).forEach((propName) => {
142
+ // // プロバイダーリストに追加
143
+ // dataList.push(propName);
144
+ // // 渡す値
145
+ // let value = passVars[propName];
146
+ // if (null === value) return;
147
+ // // トークン値であれば変換
148
+ // value = getMaybeCssVar(value, getTokenKey(propName));
149
+ // this.addStyle(`--pass_${propName}`, value);
150
+ // });
151
+ // }
152
+ setHovProps(s) {
153
+ s && (s === "-" || s === !0 ? this.addUtil("-hov") : typeof s == "string" ? k(s).forEach((t) => {
154
+ this.addUtil(`-hov:${t}`);
155
+ }) : typeof s == "object" && Object.keys(s).forEach((t) => {
156
+ const e = s[t];
157
+ if (!(e == null || e === "" || e === !1)) {
158
+ if (e === "-" || e === !0)
159
+ this.addUtil(`-hov:${t}`);
160
+ else if (t === "class")
161
+ k(e).forEach((i) => {
162
+ this.addUtil(`-hov:${i}`);
163
+ });
164
+ else if (typeof e == "string" || typeof e == "number") {
165
+ const i = m(e, _(t));
166
+ this.addUtil(`-hov:${t}`), this.addStyle(`--hov-${t}`, i);
167
+ }
168
+ }
169
+ }));
170
+ }
171
+ }
172
+ function q(h) {
173
+ if (Object.keys(h).length === 0)
174
+ return {};
175
+ const { layout: s, ...t } = h, e = new x(j(s, t));
176
+ return {
177
+ ...C({
178
+ className: e.className,
179
+ style: C(e.styles)
180
+ }),
181
+ ...e.attrs
182
+ // data-* などHTMLの標準属性はそのまま渡す
183
+ };
184
+ }
185
+ export {
186
+ x as LismPropsData,
187
+ q as default
188
+ };
@@ -0,0 +1,37 @@
1
+ import { TOKENS as t } from "../config/index.js";
2
+ import a from "./helper/isNumStr.js";
3
+ import o from "./getMaybeTokenValue.js";
4
+ function m(e, n) {
5
+ if (!n) return String(e);
6
+ switch (n) {
7
+ case "space":
8
+ return c(e);
9
+ case "color":
10
+ return l(e);
11
+ case "bxsh":
12
+ return e === "0" || e === 0 ? "none" : o(n, e, t);
13
+ default:
14
+ return o(n, e, t);
15
+ }
16
+ }
17
+ function c(e) {
18
+ return e === 0 || e === "0" ? "0" : typeof e == "number" || a(e) ? `var(--s${e})` : typeof e == "string" && e.includes(" ") && !e.includes("calc(") && !e.includes("var(") && !e.includes(",") ? e.split(" ").map((n) => c(n)).join(" ") : String(e);
19
+ }
20
+ function l(e) {
21
+ if (typeof e == "string" && e.endsWith("%")) {
22
+ const n = e.split(":");
23
+ if (n.length === 3) {
24
+ const [i, s, r] = n;
25
+ return `color-mix(in srgb, ${o("color", i, t)} ${r}, ${o("color", s, t)})`;
26
+ } else if (n.length === 2) {
27
+ const [i, s] = n;
28
+ return `color-mix(in srgb, ${o("color", i, t)} ${s}, transparent)`;
29
+ }
30
+ }
31
+ return o("color", e, t);
32
+ }
33
+ export {
34
+ m as default,
35
+ l as getMaybeColorVar,
36
+ c as getMaybeSpaceVar
37
+ };
@@ -0,0 +1,26 @@
1
+ function u(n, e, a) {
2
+ if (n === "color") {
3
+ let t = u("c", e, a);
4
+ return t === String(e) && (t = u("palette", e, a)), t;
5
+ }
6
+ const i = a[n];
7
+ if (!i) return String(e);
8
+ let r = typeof e == "number" ? `${e}` : e;
9
+ if (i instanceof Set) {
10
+ if (i.has(r))
11
+ return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${n}--${r})`;
12
+ } else if (Array.isArray(i)) {
13
+ if (i.includes(r))
14
+ return r.startsWith("-") && (r = `n${r.slice(1)}`), `var(--${n}--${r})`;
15
+ } else if ("pre" in i || "values" in i) {
16
+ const { pre: t = "", values: s = [] } = i;
17
+ if (s instanceof Set && s.has(r))
18
+ return `var(${t}${r})`;
19
+ if (Array.isArray(s) && s.includes(r))
20
+ return `var(${t}${r})`;
21
+ }
22
+ return String(e);
23
+ }
24
+ export {
25
+ u as default
26
+ };
@@ -0,0 +1,13 @@
1
+ function i(t, f, n = !1) {
2
+ if (t == null || typeof t != "object") return "";
3
+ if (f in t)
4
+ return n ? String(t[f]) : f;
5
+ if (n) return "";
6
+ for (const [r, e] of Object.entries(t))
7
+ if (e === f)
8
+ return r;
9
+ return "";
10
+ }
11
+ export {
12
+ i as default
13
+ };
@@ -0,0 +1,11 @@
1
+ function i(...s) {
2
+ let e = [];
3
+ for (let r = 0; r < s.length; r++) {
4
+ const t = s[r];
5
+ t && (typeof t == "string" ? e.push(...t.trim().split(" ")) : typeof t == "number" ? e.push(t) : Array.isArray(t) ? e.push(...t.filter((n) => n != null)) : t instanceof Set ? e.push(...t) : typeof t == "object" && e.push(...Object.keys(t).filter((n) => !!t[n])));
6
+ }
7
+ return e = [...new Set(e)], e.join(" ").trim();
8
+ }
9
+ export {
10
+ i as default
11
+ };
@@ -0,0 +1,10 @@
1
+ import r from "./isEmptyObj.js";
2
+ function c(o) {
3
+ const e = {};
4
+ for (const n in o)
5
+ o[n] === "" || o[n] === null || o[n] === void 0 || typeof o[n] == "object" && r(o[n]) || (e[n] = o[n]);
6
+ return e;
7
+ }
8
+ export {
9
+ c as default
10
+ };
@@ -0,0 +1,6 @@
1
+ function l(t, e) {
2
+ return t == null ? !1 : e.some((a) => Object.prototype.hasOwnProperty.call(t, a));
3
+ }
4
+ export {
5
+ l as default
6
+ };
@@ -0,0 +1,6 @@
1
+ function t(e) {
2
+ return Object.keys(e).length < 1;
3
+ }
4
+ export {
5
+ t as default
6
+ };
@@ -0,0 +1,6 @@
1
+ function e(t) {
2
+ return typeof t != "string" ? !1 : !isNaN(Number(t));
3
+ }
4
+ export {
5
+ e as default
6
+ };
@@ -0,0 +1,6 @@
1
+ function a(t) {
2
+ return Array.isArray(t) ? t : typeof t != "string" ? [] : t.split(",").map((r) => r.trim());
3
+ }
4
+ export {
5
+ a as default
6
+ };
@@ -0,0 +1,13 @@
1
+ function s(e, t) {
2
+ let n;
3
+ if (typeof t == "number")
4
+ n = `${t}`;
5
+ else if (typeof t == "string")
6
+ n = t;
7
+ else
8
+ return !1;
9
+ return e instanceof Set ? e.has(n) : Array.isArray(e) ? e.includes(n) : !1;
10
+ }
11
+ export {
12
+ s as default
13
+ };
@@ -0,0 +1,27 @@
1
+ import { TOKENS as f } from "../config/index.js";
2
+ function s(i, n) {
3
+ let e;
4
+ if (typeof n == "number")
5
+ e = `${n}`;
6
+ else if (typeof n == "string")
7
+ e = n;
8
+ else
9
+ return !1;
10
+ if (!(i in f)) return !1;
11
+ const r = f[i];
12
+ if (r instanceof Set)
13
+ return r.has(e);
14
+ if (Array.isArray(r))
15
+ return r.includes(e);
16
+ if ("values" in r) {
17
+ const t = r.values;
18
+ if (t instanceof Set)
19
+ return t.has(e);
20
+ if (Array.isArray(t))
21
+ return t.includes(e);
22
+ }
23
+ return !1;
24
+ }
25
+ export {
26
+ s as default
27
+ };
package/dist/ui.css ADDED
@@ -0,0 +1 @@
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.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "UI components by lism-css.",
5
5
  "author": {
6
6
  "name": "ddryo",
@@ -20,7 +20,7 @@
20
20
  "main": "./dist/index.js",
21
21
  "exports": {
22
22
  "./react": {
23
- "import": "./src/components/react.js",
23
+ "import": "./dist/components/react.js",
24
24
  "types": "./dist/components/index.d.ts"
25
25
  },
26
26
  "./astro": {
@@ -39,7 +39,7 @@
39
39
  "url": "https://github.com/lism-css/lism-css/issues"
40
40
  },
41
41
  "dependencies": {
42
- "lism-css": "0.9.1"
42
+ "lism-css": "0.9.3"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@babel/cli": "^7.28.6",
@@ -51,9 +51,10 @@
51
51
  "@vitejs/plugin-react-swc": "^3.11.0",
52
52
  "glob": "^13.0.6",
53
53
  "rollup": "^4.59.0",
54
- "typescript": "~5.8.3",
54
+ "rollup-plugin-preserve-directives": "^0.4.0",
55
+ "typescript": "^5.8.3",
55
56
  "unplugin-dts": "1.0.0-beta.6",
56
- "vite": "^6.4.1"
57
+ "vite": "^7.3.1"
57
58
  },
58
59
  "peerDependencies": {
59
60
  "@types/react": "*",
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ 'use client';
2
+ import { createContext, useRef, useId, useEffect, useContext } from 'react';
2
3
  import getLismProps from 'lism-css/lib/getLismProps';
3
4
  import { Lism, Stack } from 'lism-css/react';
4
5
  import { getRootProps, getItemProps, getHeadingProps, getPanelProps, defaultProps } from '../getProps';
@@ -9,7 +10,7 @@ import '../_style.css';
9
10
 
10
11
  // Context: 純粋なReact環境で AccordionItem → Button / Panel へ accID を共有
11
12
  // Astro 環境では Context が使えないため null がフォールバック
12
- const AccordionContext = React.createContext(null);
13
+ const AccordionContext = createContext(null);
13
14
 
14
15
  /**
15
16
  * 複数の AccordionItem をラップするルート要素
@@ -23,13 +24,13 @@ export function AccordionRoot({ children, ...props }) {
23
24
  * 個別のアコーディオンアイテム(<div> ベース、setEvent で開閉イベントを登録)
24
25
  */
25
26
  export function AccordionItem({ children, ...props }) {
26
- const ref = React.useRef(null);
27
+ const ref = useRef(null);
27
28
 
28
29
  // コンポーネント単位でユニークIDを生成
29
- const accID = React.useId();
30
+ const accID = useId();
30
31
 
31
32
  // マウント時に開閉イベントを登録(アンマウント時にクリーンアップ)
32
- React.useEffect(() => {
33
+ useEffect(() => {
33
34
  if (!ref.current) return;
34
35
  return setEvent(ref.current);
35
36
  }, []);
@@ -58,7 +59,7 @@ export function Heading({ children, ...props }) {
58
59
  * accID: Context から取得できればそれを優先、なければ props / プレースホルダー
59
60
  */
60
61
  export function Button({ children, accID: _accID = '__LISM_ACC_ID__', ...props }) {
61
- const ctx = React.useContext(AccordionContext);
62
+ const ctx = useContext(AccordionContext);
62
63
  const accID = ctx?.accID || _accID;
63
64
 
64
65
  return (
@@ -73,7 +74,7 @@ export function Button({ children, accID: _accID = '__LISM_ACC_ID__', ...props }
73
74
  * パネル
74
75
  */
75
76
  export function Panel({ children, ...props }) {
76
- const ctx = React.useContext(AccordionContext);
77
+ const ctx = useContext(AccordionContext);
77
78
  const { panelProps, contentProps } = getPanelProps({ _contextID: ctx?.accID, ...props });
78
79
 
79
80
  return (
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ 'use client';
2
+ import { useRef, useEffect } from 'react';
2
3
  import { Lism } from 'lism-css/react';
3
4
  import { setEvent } from '../setModal';
4
5
  import { getProps } from '../getProps';
@@ -7,8 +8,8 @@ import '../_style.css';
7
8
 
8
9
  // duration: [s]
9
10
  const Modal = ({ children, ...props }) => {
10
- const ref = React.useRef(null);
11
- React.useEffect(() => {
11
+ const ref = useRef(null);
12
+ useEffect(() => {
12
13
  if (!ref?.current) return;
13
14
  return setEvent(ref?.current);
14
15
  }, [ref]);
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ 'use client';
2
+ import { useState, useId, Children, isValidElement } from 'react';
2
3
  import { Lism } from 'lism-css/react';
3
4
  import Tab from './Tab';
4
5
  import TabItem from './TabItem';
@@ -10,19 +11,19 @@ import getTabsProps from '../getProps';
10
11
  import '../_style.css';
11
12
 
12
13
  export default function Tabs({ tabId = '', defaultIndex = 1, listProps = {}, children, ...props }) {
13
- const [activeIndex, setActiveIndex] = React.useState(defaultIndex);
14
- const theTabId = tabId || React.useId();
14
+ const [activeIndex, setActiveIndex] = useState(defaultIndex);
15
+ const theTabId = tabId || useId();
15
16
  const btns = [];
16
17
  const panels = [];
17
18
 
18
19
  // Tabs.Item の処理
19
- React.Children.forEach(children, (child, index) => {
20
+ Children.forEach(children, (child, index) => {
20
21
  const tabIndex = index + 1; // 1 はじまり
21
- // console.log('child.type', React.isValidElement(child), child.type);
22
+ // console.log('child.type', isValidElement(child), child.type);
22
23
 
23
- if (React.isValidElement(child) && child.type === TabItem) {
24
- React.Children.forEach(child.props.children, (nestedChild) => {
25
- if (React.isValidElement(nestedChild)) {
24
+ if (isValidElement(child) && child.type === TabItem) {
25
+ Children.forEach(child.props.children, (nestedChild) => {
26
+ if (isValidElement(nestedChild)) {
26
27
  if (nestedChild.type === Tab) {
27
28
  const tabProps = nestedChild.props;
28
29
  btns.push(