ksk-design-system 2.4.0 → 2.5.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.md CHANGED
@@ -88,6 +88,12 @@ DS のルールが適用されません。既存ファイルはスキップさ
88
88
 
89
89
  独自ブランドのテーマを使う場合は、この後にテーマCSSをimportしてください。
90
90
 
91
+ `preset` を使わずトークン CSS を個別 subpath で import する構成では、角丸トークン
92
+ (`--Radius-Surface` / `--Radius-Modal` / `--Radius-Sheet`)は
93
+ `ksk-design-system/tokens/product-theme` に含まれます(issue #553)。
94
+ product-theme を読まず Radius だけが欲しい場合は
95
+ `@import "ksk-design-system/tokens/radius";` を使ってください。
96
+
91
97
  Tailwind CSS v4 は `node_modules` を既定では走査しません。`@source` がないと、
92
98
  DS 内部だけで使うレイアウト・サイズ・状態クラスが生成されず、コンポーネントの表示や操作が崩れます。
93
99
  consumer 側の Tailwind と DS を同じビルドで処理するため、上記の設定をセットで使用してください。
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "name": "KSK Design System — Component Contracts",
4
- "version": "2.4.0",
4
+ "version": "2.5.0",
5
5
  "description": "全コンポーネントの構造化定義。バリアント・アクセシビリティ要件・使用ルールを機械可読形式で管理。",
6
6
  "counts": {
7
7
  "ui": 68,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "meta": {
3
3
  "name": "KSK Design System — Semantic Token Hex Cache",
4
- "version": "2.4.0",
4
+ "version": "2.5.0",
5
5
  "description": "semantic / semanticDark トークン(var(--Primitive-*) 参照)を実 hex に解決したサイドカー生成物。hex はデフォルト(Blue)テーマでの解決値であり、Brand 系(meta.themeDependentKeys に列挙)はテーマ差し替え(orange/green/violet 等)で実色が変わる。テーマ別の完全解決値は `ksk-design-system/native` エクスポート(バンドル済み native トークンモジュール)の themes を参照。tokens.json 本体のスキーマは変更せず、AI がこのファイルだけで実色を把握できるようにし、primitive 値の変更による semantic 実色のドリフトを --check で機械検出する。",
6
6
  "generatedBy": "scripts/generate-token-hex-cache.mjs",
7
7
  "theme": "default",
package/dist/index.js CHANGED
@@ -7619,7 +7619,16 @@ function Yl({ value: e, onChange: t, placeholder: n, minRows: r = 3, density: i
7619
7619
  d();
7620
7620
  }, [e, d]), u.useEffect(() => {
7621
7621
  let e = () => d();
7622
- return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
7622
+ window.addEventListener("resize", e);
7623
+ let t = l.current, n = t?.getBoundingClientRect().width, r = null, i = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
7624
+ let e = t?.getBoundingClientRect().width;
7625
+ e !== n && (n = e, r !== null && cancelAnimationFrame(r), r = requestAnimationFrame(() => {
7626
+ r = null, d();
7627
+ }));
7628
+ });
7629
+ return t && i?.observe(t), () => {
7630
+ window.removeEventListener("resize", e), i?.disconnect(), r !== null && cancelAnimationFrame(r);
7631
+ };
7623
7632
  }, [d]);
7624
7633
  let f = a != null && a > 0 ? e.length / a : 0, p = a == null ? "" : e.length >= a ? "text-[var(--Text-Caution)]" : f >= .7 ? "text-[var(--Text-Warning)]" : "text-[var(--Text-Low-Emphasis)]", m = o === void 0 ? a != null : o;
7625
7634
  return /* @__PURE__ */ V("div", {
@@ -14231,12 +14240,24 @@ function sp({ className: e, steps: t, currentStep: n, ...r }) {
14231
14240
  }
14232
14241
  //#endregion
14233
14242
  //#region src/components/patterns/search-bar.tsx
14234
- function cp({ className: e, onSearch: t, asForm: n = !1, ...r }) {
14235
- let i = (e) => {
14236
- n || e.key === "Enter" && !su(e) && t && t(e.currentTarget.value);
14237
- }, a = (e) => {
14238
- e.preventDefault(), t && t(e.currentTarget.elements.namedItem("search")?.value ?? "");
14239
- }, o = /* @__PURE__ */ V("svg", {
14243
+ function cp({ className: e, onSearch: t, asForm: n = !1, onKeyDown: r, onCompositionStart: i, onCompositionEnd: a, ...o }) {
14244
+ let s = u.useRef(!1), c = u.useRef(!1), l = u.useRef(null);
14245
+ u.useEffect(() => () => {
14246
+ l.current !== null && clearTimeout(l.current);
14247
+ }, []);
14248
+ let d = (e) => {
14249
+ if (r?.(e), !(e.defaultPrevented || e.key !== "Enter")) {
14250
+ if (s.current || su(e)) {
14251
+ c.current = !0, l.current !== null && clearTimeout(l.current), l.current = setTimeout(() => {
14252
+ c.current = !1, l.current = null;
14253
+ }, 0);
14254
+ return;
14255
+ }
14256
+ c.current = !1, l.current !== null && (clearTimeout(l.current), l.current = null), n || t?.(e.currentTarget.value);
14257
+ }
14258
+ }, f = (e) => {
14259
+ e.preventDefault(), !s.current && !c.current && t && t(e.currentTarget.elements.namedItem("search")?.value ?? "");
14260
+ }, p = /* @__PURE__ */ V("svg", {
14240
14261
  width: "20",
14241
14262
  height: "20",
14242
14263
  viewBox: "0 0 20 20",
@@ -14255,25 +14276,31 @@ function cp({ className: e, onSearch: t, asForm: n = !1, ...r }) {
14255
14276
  strokeWidth: "2",
14256
14277
  strokeLinecap: "round"
14257
14278
  })]
14258
- }), s = /* @__PURE__ */ B("input", {
14279
+ }), m = /* @__PURE__ */ B("input", {
14259
14280
  type: "search",
14260
14281
  name: "search",
14261
14282
  "data-slot": "input",
14262
14283
  enterKeyHint: "search",
14263
14284
  className: G("flex h-12 w-full rounded-full border border-[var(--Border-Medium-Emphasis)] bg-[var(--Surface-Primary)] pl-10 pr-4 typo-body-md text-[var(--Text-High-Emphasis)]", "placeholder:text-[var(--Text-Low-Emphasis)]", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--Focus-High-Emphasis)]/50 focus-visible:border-[var(--Border-Accent-Primary)]", "disabled:cursor-not-allowed disabled:opacity-50"),
14264
- onKeyDown: i,
14265
- ...r
14285
+ onKeyDown: d,
14286
+ onCompositionStart: (e) => {
14287
+ s.current = !0, i?.(e);
14288
+ },
14289
+ onCompositionEnd: (e) => {
14290
+ s.current = !1, a?.(e);
14291
+ },
14292
+ ...o
14266
14293
  });
14267
14294
  return n ? /* @__PURE__ */ V("form", {
14268
14295
  "data-slot": "search-bar",
14269
14296
  role: "search",
14270
14297
  className: G("relative w-full", e),
14271
- onSubmit: a,
14272
- children: [o, s]
14298
+ onSubmit: f,
14299
+ children: [p, m]
14273
14300
  }) : /* @__PURE__ */ V("div", {
14274
14301
  "data-slot": "search-bar",
14275
14302
  className: G("relative w-full", e),
14276
- children: [o, s]
14303
+ children: [p, m]
14277
14304
  });
14278
14305
  }
14279
14306
  //#endregion
@@ -18191,27 +18218,29 @@ var _g = {
18191
18218
  }
18192
18219
  };
18193
18220
  function vg({ url: e, title: t, providers: n, region: r = "global", layout: i = "circle", className: a, onShare: o, onCopy: s, copiedLabel: c = "コピーしました", copyErrorLabel: l = "コピーできませんでした", feedbackDuration: d = 2e3, groupLabel: f = "シェア" }) {
18194
- let [p, m] = u.useState(null), h = u.useRef(null), g = n ?? hg[r];
18221
+ let [p, m] = u.useState(null), h = u.useRef(null), g = u.useRef(0), _ = n ?? hg[r];
18195
18222
  u.useEffect(() => () => {
18196
- h.current && clearTimeout(h.current);
18223
+ g.current += 1, h.current && clearTimeout(h.current);
18197
18224
  }, []);
18198
- let _ = (e, t) => {
18225
+ let v = (e, t) => {
18199
18226
  h.current && clearTimeout(h.current), m({
18200
18227
  provider: e,
18201
18228
  result: t
18202
- }), s?.(t), h.current = setTimeout(() => {
18229
+ }), h.current = setTimeout(() => {
18203
18230
  m(null), h.current = null;
18204
18231
  }, d);
18205
- }, v = async (t) => {
18232
+ }, y = async (t) => {
18233
+ let n = ++g.current, r = "success";
18206
18234
  try {
18207
18235
  if (typeof navigator > "u" || !navigator.clipboard?.writeText) throw Error("Clipboard API is unavailable");
18208
- await navigator.clipboard.writeText(e), _(t, "success");
18236
+ await navigator.clipboard.writeText(e);
18209
18237
  } catch {
18210
- _(t, "error");
18238
+ r = "error";
18211
18239
  }
18212
- }, y = async (n) => {
18240
+ n === g.current && v(t, r), s?.(r);
18241
+ }, b = async (n) => {
18213
18242
  if (o?.(n), n === "copy") {
18214
- await v(n);
18243
+ await y(n);
18215
18244
  return;
18216
18245
  }
18217
18246
  let r = _g[n];
@@ -18225,7 +18254,7 @@ function vg({ url: e, title: t, providers: n, region: r = "global", layout: i =
18225
18254
  return;
18226
18255
  }
18227
18256
  if (r.webShare) {
18228
- await v(n);
18257
+ await y(n);
18229
18258
  return;
18230
18259
  }
18231
18260
  r.buildUrl && window.open(r.buildUrl(e, t), "_blank", "noopener,noreferrer,width=600,height=500");
@@ -18237,11 +18266,11 @@ function vg({ url: e, title: t, providers: n, region: r = "global", layout: i =
18237
18266
  role: "group",
18238
18267
  "aria-label": f,
18239
18268
  "data-region": r,
18240
- children: g.map((e) => {
18269
+ children: _.map((e) => {
18241
18270
  let t = _g[e], n = p?.provider === e ? p.result : null, r = n === "success" ? c : n === "error" ? l : t.label;
18242
18271
  return /* @__PURE__ */ V("button", {
18243
18272
  type: "button",
18244
- onClick: () => void y(e),
18273
+ onClick: () => void b(e),
18245
18274
  "aria-label": t.label,
18246
18275
  className: "flex min-h-11 shrink-0 flex-col items-center gap-2 rounded-lg cursor-pointer focus-visible:ring-[3px] focus-visible:ring-[var(--Focus-High-Emphasis)]/50",
18247
18276
  children: [/* @__PURE__ */ V("span", {
@@ -18272,11 +18301,11 @@ function vg({ url: e, title: t, providers: n, region: r = "global", layout: i =
18272
18301
  role: "group",
18273
18302
  "aria-label": f,
18274
18303
  "data-region": r,
18275
- children: g.map((e) => {
18304
+ children: _.map((e) => {
18276
18305
  let t = _g[e], n = p?.provider === e ? p.result : null, r = n === "success" ? c : n === "error" ? l : t.label;
18277
18306
  return /* @__PURE__ */ V("button", {
18278
18307
  type: "button",
18279
- onClick: () => void y(e),
18308
+ onClick: () => void b(e),
18280
18309
  "aria-label": t.label,
18281
18310
  className: G("inline-flex min-h-11 items-center gap-2 px-3 py-2 rounded-full border border-[var(--Border-Medium-Emphasis)] typo-label-xs transition-colors focus-visible:ring-[3px] focus-visible:ring-[var(--Focus-High-Emphasis)]/50", t.inlineClass),
18282
18311
  children: [/* @__PURE__ */ V("span", {