@momoi-labs/kiso-react 0.13.0 → 0.14.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/dist/steps.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useId, useState } from "react";
4
4
  import { clsx as cn } from "clsx";
5
+ import { Check, Lock } from "lucide-react";
5
6
  const defaultLabels = {
6
7
  upcoming: "Upcoming", current: "Current", completed: "Completed", error: "Needs attention",
7
8
  disabled: "Unavailable", expand: "View steps", collapse: "Hide steps",
@@ -18,7 +19,7 @@ export function Steps({ label, items, current, orientation = "horizontal", respo
18
19
  const status = item.status ?? "upcoming";
19
20
  const active = item.id === current;
20
21
  const canNavigate = status !== "disabled" && (item.href || (item.navigable && onStepChange));
21
- const content = _jsxs(_Fragment, { children: [_jsx("span", { className: "steps-marker", "aria-hidden": "true", children: status === "completed" ? _jsx("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "2", children: _jsx("path", { d: "m3 8 3 3 7-7" }) }) : status === "disabled" ? _jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: [_jsx("rect", { x: "3.5", y: "7", width: "9", height: "7", rx: "1" }), _jsx("path", { d: "M5.5 7V4a2.5 2.5 0 0 1 5 0v3" })] }) : status === "error" ? "!" : index + 1 }), _jsxs("span", { className: "steps-copy", children: [_jsx("span", { className: "steps-label", children: item.label }), _jsx("span", { className: "steps-state", children: active ? `${text.current}${status === "error" ? `, ${text.error}` : ""}` : text[status] }), item.description != null && _jsx("span", { className: "steps-description", children: item.description })] })] });
22
+ const content = _jsxs(_Fragment, { children: [_jsx("span", { className: "steps-marker", "aria-hidden": "true", children: status === "completed" ? _jsx(Check, {}) : status === "disabled" ? _jsx(Lock, {}) : status === "error" ? "!" : index + 1 }), _jsxs("span", { className: "steps-copy", children: [_jsx("span", { className: "steps-label", children: item.label }), _jsx("span", { className: "steps-state", children: active ? `${text.current}${status === "error" ? `, ${text.error}` : ""}` : text[status] }), item.description != null && _jsx("span", { className: "steps-description", children: item.description })] })] });
22
23
  return _jsx("li", { "data-state": status, "data-current": active, "aria-current": active ? "step" : undefined, children: canNavigate && item.href ? _jsx("a", { className: "steps-item", href: item.href, children: content })
23
24
  : canNavigate ? _jsx("button", { type: "button", className: "steps-item", onClick: () => onStepChange?.(item.id), children: content })
24
25
  : _jsx("div", { className: "steps-item", children: content }) }, item.id);
package/dist/styles.css CHANGED
@@ -319,6 +319,57 @@
319
319
  box-shadow: var(--shadow-md);
320
320
  max-width: min(24rem, calc(100vw - 2 * var(--spacing-lg)));
321
321
  }
322
+
323
+ .detail-select { display: grid; gap: var(--spacing-sm); min-width: 0; }
324
+ .detail-select-trigger { display: flex; align-items: center; gap: var(--spacing-sm); width: 100%; text-align: start; }
325
+ .detail-select-trigger > :last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
326
+ .detail-select-icon { display: inline-flex; flex: none; }
327
+ .detail-select-content {
328
+ gap: 0;
329
+ width: min(40rem, calc(100vw - 2 * var(--spacing-lg)));
330
+ max-width: min(40rem, calc(100vw - 2 * var(--spacing-lg)));
331
+ max-height: min(32rem, var(--radix-popover-content-available-height));
332
+ overflow-y: auto; overscroll-behavior: contain; padding: 0;
333
+ }
334
+ .detail-select-option { display: grid; grid-template-columns: minmax(0, 8rem) minmax(0, 1fr); gap: var(--spacing-lg); padding: var(--spacing-md); border-bottom: 1px solid var(--color-border); }
335
+ .detail-select-option:last-child { border-bottom: 0; }
336
+ .detail-select-option:not([data-disabled]) { cursor: pointer; }
337
+ @media (hover: hover) {
338
+ .detail-select-option:where(:not([data-disabled]):hover) { background-color: var(--color-accent-surface-hover); }
339
+ }
340
+ .detail-select-option[data-selected="true"], .detail-select-option:has(.detail-select-choice:focus-visible) { background-color: var(--color-selected); color: var(--color-selected-foreground); }
341
+ .detail-select-option:is([data-selected="true"], :has(.detail-select-choice:focus-visible)) :is(.detail-select-choice, .detail-select-description) { color: inherit; }
342
+ @media (forced-colors: active) {
343
+ .detail-select-option:has(.detail-select-choice:focus-visible) { outline: 2px solid Highlight; outline-offset: -2px; }
344
+ }
345
+ .detail-select-illustration { min-width: 0; align-self: start; padding-top: var(--spacing-sm); }
346
+ .detail-select-illustration :is(img, svg, video) { max-width: 100%; }
347
+ .detail-select-body { min-width: 0; overflow-wrap: anywhere; }
348
+ .detail-select-heading { margin: 0; }
349
+ .detail-select-choice { display: flex; align-items: center; justify-content: space-between; gap: var(--spacing-sm); width: 100%; min-height: var(--size-control-sm); padding: 0; border: 0; background: transparent; color: var(--color-foreground); font: inherit; font-size: var(--type-size-body); font-weight: var(--type-weight-medium); text-align: start; cursor: pointer; }
350
+ .detail-select-choice:focus-visible { outline: none; }
351
+ .detail-select-choice:disabled { color: var(--color-disabled); cursor: default; }
352
+ .detail-select-choice .icon { flex: none; }
353
+ .detail-select-description { color: var(--color-muted-foreground); font-size: var(--type-size-label); overflow-x: auto; }
354
+ .detail-select-description > * { margin-block: 0 var(--spacing-sm); }
355
+ .detail-select-description > :last-child { margin-bottom: 0; }
356
+ .detail-select-description a { color: var(--color-link); text-decoration: underline; text-underline-offset: var(--spacing-2xs); }
357
+ .detail-select-empty { padding: var(--spacing-md); margin: 0; color: var(--color-muted-foreground); }
358
+ @media (max-width: 480px) {
359
+ .detail-select-option { grid-template-columns: minmax(0, 4rem) minmax(0, 1fr); gap: var(--spacing-sm); padding: var(--spacing-sm); }
360
+ }
361
+ @media (pointer: coarse) {
362
+ .detail-select-choice { min-height: var(--size-touch-min); }
363
+ .detail-select-description a { display: inline-block; min-height: var(--size-touch-min); align-content: center; }
364
+ }
365
+ /* When frames include controls, these surfaces take the control shape, as
366
+ the control-sized surfaces in ui.css do. */
367
+ :where([data-frame-scope="all"]) :is(.kiso-react-popover, .theme-buttons, .accent-preview) {
368
+ border-radius: var(--radius-lg) calc(var(--radius-lg) * var(--corner-control-opposite, var(--appearance-control-opposite, 1)));
369
+ }
370
+ :where([data-frame-scope="all"]) .skeleton-text {
371
+ border-radius: var(--radius-sm) calc(var(--radius-sm) * var(--corner-control-opposite, var(--appearance-control-opposite, 1)));
372
+ }
322
373
  [data-slot="tooltip-content"] { max-width: 28ch; }
323
374
 
324
375
  .kiso-react-switch {
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useId, useRef } from "react";
4
+ import { Monitor, Moon, Sun } from "lucide-react";
4
5
  import { Button } from "./button.js";
5
6
  function ThemePreview({ theme }) {
6
7
  const schemes = theme === "system" ? ["light", "dark"] : [theme];
@@ -16,25 +17,25 @@ export function ThemeSelector({ theme, onChange, variant = "compact", }) {
16
17
  label: "Follow system",
17
18
  name: "System",
18
19
  description: "Follow your device",
19
- path: "M2 2h12v9H2zM8 11v3M5 14h6",
20
+ Icon: Monitor,
20
21
  },
21
22
  {
22
23
  value: "light",
23
24
  label: "Light theme",
24
25
  name: "Light",
25
26
  description: "Always use light colors",
26
- path: "M11 8a3 3 0 1 1-6 0 3 3 0 0 1 6 0ZM8 0v2m0 12v2M0 8h2m12 0h2M2 2l2 2m8 8 2 2M2 14l2-2M12 4l2-2",
27
+ Icon: Sun,
27
28
  },
28
29
  {
29
30
  value: "dark",
30
31
  label: "Dark theme",
31
32
  name: "Dark",
32
33
  description: "Always use dark colors",
33
- path: "M13.5 10A6 6 0 0 1 6 2.5a6 6 0 1 0 7.5 7.5Z",
34
+ Icon: Moon,
34
35
  },
35
36
  ];
36
37
  return (_jsxs("div", { "data-slot": "theme-selector", "data-variant": variant, className: cards ? "theme-selector-cards" : "theme-row", children: [_jsx("span", { className: "t-label", children: "Theme" }), _jsx("div", { className: cards ? "theme-cards" : "theme-buttons", role: "radiogroup", "aria-label": "Theme", children: options.map((option, index) => {
37
- const icon = _jsx("svg", { className: "icon icon-sm", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.4", "aria-hidden": "true", children: _jsx("path", { d: option.path }) });
38
+ const icon = _jsx(option.Icon, { className: "icon icon-sm", "aria-hidden": "true" });
38
39
  return (_jsx(Button, { ref: (button) => { buttons.current[index] = button; }, variant: "ghost", size: "sm", className: cards ? "theme-card" : "btn-icon", role: "radio", "aria-label": option.label, "aria-describedby": cards ? `${id}-${option.value}-description` : undefined, title: option.label, "aria-checked": theme === option.value, tabIndex: theme === option.value ? 0 : -1, onClick: () => onChange(option.value), onKeyDown: (event) => {
39
40
  if (event.altKey || event.ctrlKey || event.metaKey)
40
41
  return;
@@ -2,6 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import { clsx as cn } from "clsx";
5
+ import { ChevronDown } from "lucide-react";
5
6
  import { Button } from "./button.js";
6
7
  import { Form, FormActions } from "./form.js";
7
8
  import { Input } from "./input.js";
@@ -31,7 +32,7 @@ export function TimeRangeControl({ value, bounds, onValueChange, label = "Time r
31
32
  throw new RangeError("Time range preset durations must be positive milliseconds.");
32
33
  }
33
34
  const apply = (range) => { onValueChange(range); setOpen(false); };
34
- return _jsxs(Popover, { open: open, onOpenChange: next => { setOpen(next); setCustom(false); }, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { disabled: disabled, className: cn("time-range-trigger", className), "aria-label": `${label}: ${dateInput(value.from).replace("T", " ")} to ${dateInput(value.to).replace("T", " ")} UTC`, children: [shortRange(value), " ", _jsx("span", { "aria-hidden": "true", children: "\u2304" })] }) }), _jsx(PopoverContent, { className: "time-range-content", "aria-label": label, children: custom ? _jsxs("div", { className: "stack-sm", children: [_jsx(Button, { variant: "ghost", onClick: () => setCustom(false), children: "Back to presets" }), _jsx(TimeRangeForm, { value: value, bounds: bounds, onApply: apply }, `${value.from}-${value.to}-${open}`)] }) : _jsxs("div", { className: "time-range-presets", children: [_jsxs(Button, { variant: "ghost", onClick: () => apply(bounds), children: [_jsx("span", { children: "Entire run" }), _jsx("small", { children: shortRange(bounds) })] }), presets.map(preset => {
35
+ return _jsxs(Popover, { open: open, onOpenChange: next => { setOpen(next); setCustom(false); }, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { disabled: disabled, className: cn("time-range-trigger", className), "aria-label": `${label}: ${dateInput(value.from).replace("T", " ")} to ${dateInput(value.to).replace("T", " ")} UTC`, children: [shortRange(value), " ", _jsx(ChevronDown, { className: "icon icon-sm", "aria-hidden": "true" })] }) }), _jsx(PopoverContent, { className: "time-range-content", "aria-label": label, children: custom ? _jsxs("div", { className: "stack-sm", children: [_jsx(Button, { variant: "ghost", onClick: () => setCustom(false), children: "Back to presets" }), _jsx(TimeRangeForm, { value: value, bounds: bounds, onApply: apply }, `${value.from}-${value.to}-${open}`)] }) : _jsxs("div", { className: "time-range-presets", children: [_jsxs(Button, { variant: "ghost", onClick: () => apply(bounds), children: [_jsx("span", { children: "Entire run" }), _jsx("small", { children: shortRange(bounds) })] }), presets.map(preset => {
35
36
  const range = { from: Math.max(bounds.from, bounds.to - preset.duration), to: bounds.to };
36
37
  return _jsxs(Button, { variant: "ghost", onClick: () => apply(range), children: [_jsx("span", { children: preset.label }), _jsx("small", { children: shortRange(range) })] }, preset.label);
37
38
  }), _jsx(Button, { variant: "ghost", onClick: () => setCustom(true), children: "Custom range" })] }) })] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momoi-labs/kiso-react",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Kiso React components built with shadcn/ui and Radix",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  "prepack": "npm run build"
33
33
  },
34
34
  "dependencies": {
35
- "@momoi-labs/kiso": "^0.17.0",
35
+ "@momoi-labs/kiso": "^0.18.0",
36
36
  "class-variance-authority": "0.7.1",
37
37
  "clsx": "2.1.1",
38
38
  "radix-ui": "1.6.7",
@@ -41,12 +41,14 @@
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": "^19.0.0",
44
- "react-dom": "^19.0.0"
44
+ "react-dom": "^19.0.0",
45
+ "lucide-react": ">=1.0.0"
45
46
  },
46
47
  "devDependencies": {
47
48
  "@types/react": "19.2.18",
48
49
  "@types/react-dom": "19.2.7",
49
- "typescript": "7.0.2"
50
+ "typescript": "7.0.2",
51
+ "lucide-react": "1.53.0"
50
52
  },
51
53
  "publishConfig": {
52
54
  "access": "public",