@surflane/ui 0.1.0 → 0.3.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.
Files changed (87) hide show
  1. package/README.md +8 -8
  2. package/dist/advanced-forms.d.ts +2 -2
  3. package/dist/advanced-forms.js +39 -39
  4. package/dist/app-shell.d.ts +3 -2
  5. package/dist/app-shell.js +29 -13
  6. package/dist/button.d.ts +5 -5
  7. package/dist/button.js +12 -12
  8. package/dist/chart.d.ts +3 -3
  9. package/dist/chart.js +36 -34
  10. package/dist/commands.d.ts +5 -5
  11. package/dist/commands.js +17 -17
  12. package/dist/content.d.ts +2 -2
  13. package/dist/content.js +66 -28
  14. package/dist/context-overlays.d.ts +3 -3
  15. package/dist/context-overlays.js +11 -11
  16. package/dist/data.d.ts +58 -13
  17. package/dist/data.js +63 -21
  18. package/dist/date-picker.d.ts +8 -8
  19. package/dist/date-picker.js +18 -18
  20. package/dist/dialog-focus.js +7 -7
  21. package/dist/dialog.d.ts +5 -5
  22. package/dist/dialog.js +16 -16
  23. package/dist/feedback.d.ts +5 -5
  24. package/dist/feedback.js +20 -20
  25. package/dist/file-upload.d.ts +9 -9
  26. package/dist/file-upload.js +64 -63
  27. package/dist/filter-bar.d.ts +1 -1
  28. package/dist/filter-bar.js +9 -9
  29. package/dist/form-state.d.ts +1 -1
  30. package/dist/form-state.js +11 -11
  31. package/dist/forms.d.ts +5 -5
  32. package/dist/forms.js +32 -32
  33. package/dist/foundations.d.ts +10 -10
  34. package/dist/foundations.js +26 -26
  35. package/dist/icon.d.ts +8 -7
  36. package/dist/icon.js +23 -22
  37. package/dist/index.d.ts +38 -37
  38. package/dist/index.js +39 -38
  39. package/dist/input-extensions.d.ts +3 -3
  40. package/dist/input-extensions.js +21 -21
  41. package/dist/input.d.ts +2 -2
  42. package/dist/input.js +7 -7
  43. package/dist/markdown.d.ts +2 -2
  44. package/dist/markdown.js +38 -38
  45. package/dist/menu.d.ts +2 -2
  46. package/dist/menu.js +19 -19
  47. package/dist/messages.d.ts +2 -2
  48. package/dist/messages.js +18 -18
  49. package/dist/navigation-menu.d.ts +2 -2
  50. package/dist/navigation-menu.js +16 -16
  51. package/dist/navigation.d.ts +5 -5
  52. package/dist/navigation.js +40 -40
  53. package/dist/otp-field.d.ts +1 -1
  54. package/dist/otp-field.js +14 -14
  55. package/dist/pagination.d.ts +2 -2
  56. package/dist/pagination.js +12 -12
  57. package/dist/panels.d.ts +8 -8
  58. package/dist/panels.js +39 -39
  59. package/dist/parts.d.ts +2 -2
  60. package/dist/parts.js +8 -8
  61. package/dist/popover.d.ts +3 -3
  62. package/dist/popover.js +6 -6
  63. package/dist/scroll-area.d.ts +1 -1
  64. package/dist/scroll-area.js +20 -20
  65. package/dist/select.d.ts +8 -8
  66. package/dist/select.js +21 -21
  67. package/dist/sizing.d.ts +3 -3
  68. package/dist/sizing.js +9 -9
  69. package/dist/slot.d.ts +1 -1
  70. package/dist/slot.js +4 -4
  71. package/dist/status.d.ts +4 -4
  72. package/dist/status.js +8 -8
  73. package/dist/syntax-engine.js +43 -43
  74. package/dist/syntax-highlighter.d.ts +2 -2
  75. package/dist/syntax-highlighter.js +32 -32
  76. package/dist/table-selection.d.ts +31 -0
  77. package/dist/table-selection.js +50 -0
  78. package/dist/toast.d.ts +4 -4
  79. package/dist/toast.js +33 -33
  80. package/dist/tone-transition.d.ts +1 -1
  81. package/dist/tone-transition.js +17 -17
  82. package/dist/tooltip.d.ts +1 -1
  83. package/dist/tooltip.js +4 -4
  84. package/dist/tree.d.ts +4 -4
  85. package/dist/tree.js +60 -60
  86. package/package.json +2 -2
  87. package/src/styles.css +266 -142
package/dist/select.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { type ComponentSizeAlias } from "./sizing.js";
1
+ import * as React from 'react';
2
+ import { type ComponentSizeAlias } from './sizing.js';
3
3
  export type SelectOption = {
4
4
  value: string;
5
5
  label: React.ReactNode;
@@ -19,15 +19,15 @@ export type SelectProps = {
19
19
  inputRef?: React.Ref<HTMLInputElement>;
20
20
  triggerRef?: React.Ref<HTMLButtonElement>;
21
21
  size?: ComponentSizeAlias;
22
- "aria-label"?: string;
23
- "aria-labelledby"?: string;
24
- "aria-describedby"?: string;
25
- "aria-invalid"?: React.AriaAttributes["aria-invalid"];
22
+ 'aria-label'?: string;
23
+ 'aria-labelledby'?: string;
24
+ 'aria-describedby'?: string;
25
+ 'aria-invalid'?: React.AriaAttributes['aria-invalid'];
26
26
  };
27
27
  export declare function Select({ options, value, defaultValue, onValueChange, className, inputRef, triggerRef, size, ...props }: SelectProps): React.JSX.Element;
28
28
  /** Transitional HTML-option adapter. Submitted values use Base UI's native hidden input. */
29
29
  export declare const NativeSelect: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, "ref">, "size" | "multiple"> & {
30
30
  size?: ComponentSizeAlias;
31
31
  } & React.RefAttributes<HTMLButtonElement>>;
32
- export declare function NativeSelectOption(props: React.ComponentProps<"option">): React.JSX.Element;
33
- export declare function NativeSelectOptGroup(props: React.ComponentProps<"optgroup">): React.JSX.Element;
32
+ export declare function NativeSelectOption(props: React.ComponentProps<'option'>): React.JSX.Element;
33
+ export declare function NativeSelectOptGroup(props: React.ComponentProps<'optgroup'>): React.JSX.Element;
package/dist/select.js CHANGED
@@ -1,20 +1,20 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import { useComponentSize } from "./sizing.js";
5
- import { Select as BaseSelect } from "@base-ui/react/select";
6
- const cx = (...v) => v.filter(Boolean).join(" ");
3
+ import * as React from 'react';
4
+ import { useComponentSize } from './sizing.js';
5
+ import { Select as BaseSelect } from '@base-ui/react/select';
6
+ const cx = (...v) => v.filter(Boolean).join(' ');
7
7
  function Chevron() {
8
- return (_jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.7", "aria-hidden": "true", children: _jsx("path", { d: "m7 10 5 5 5-5" }) }));
8
+ return (_jsx("svg", { width: '16', height: '16', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.7', "aria-hidden": 'true', children: _jsx("path", { d: 'm7 10 5 5 5-5' }) }));
9
9
  }
10
10
  function Check() {
11
- return (_jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.7", "aria-hidden": "true", children: _jsx("path", { d: "m5 12 4 4L19 6" }) }));
11
+ return (_jsx("svg", { width: '14', height: '14', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.7', "aria-hidden": 'true', children: _jsx("path", { d: 'm5 12 4 4L19 6' }) }));
12
12
  }
13
13
  export function Select({ options, value, defaultValue, onValueChange, className, inputRef, triggerRef, size, ...props }) {
14
14
  const scheme = useComponentSize(size);
15
- const [localValue, setLocalValue] = React.useState(defaultValue ?? options[0]?.value ?? "");
15
+ const [localValue, setLocalValue] = React.useState(defaultValue ?? options[0]?.value ?? '');
16
16
  const nativeInput = React.useRef(null);
17
- const initialValue = defaultValue ?? options[0]?.value ?? "";
17
+ const initialValue = defaultValue ?? options[0]?.value ?? '';
18
18
  const resetCallback = React.useRef(onValueChange);
19
19
  resetCallback.current = onValueChange;
20
20
  React.useEffect(() => {
@@ -32,24 +32,24 @@ export function Select({ options, value, defaultValue, onValueChange, className,
32
32
  }, 0);
33
33
  pending.add(timer);
34
34
  };
35
- owner.addEventListener("reset", reset);
35
+ owner.addEventListener('reset', reset);
36
36
  return () => {
37
- owner.removeEventListener("reset", reset);
37
+ owner.removeEventListener('reset', reset);
38
38
  pending.forEach(clearTimeout);
39
39
  };
40
40
  }, [initialValue, props.form]);
41
41
  const selected = value ?? localValue;
42
42
  const { name, form, required, disabled, id, ...aria } = props;
43
- return (_jsx("span", { className: cx("pui-select control-shell select-control", className), "data-size": size, "data-ui-size": scheme, "data-disabled": disabled || undefined, children: _jsxs(BaseSelect.Root, { items: options, value: selected, onValueChange: (v) => {
44
- setLocalValue(v ?? "");
45
- onValueChange?.(v ?? "");
43
+ return (_jsx("span", { className: cx('pui-select control-shell select-control', className), "data-size": size, "data-ui-size": scheme, "data-disabled": disabled || undefined, children: _jsxs(BaseSelect.Root, { items: options, value: selected, onValueChange: (v) => {
44
+ setLocalValue(v ?? '');
45
+ onValueChange?.(v ?? '');
46
46
  }, inputRef: (node) => {
47
47
  nativeInput.current = node;
48
- if (typeof inputRef === "function")
48
+ if (typeof inputRef === 'function')
49
49
  inputRef(node);
50
50
  else if (inputRef)
51
51
  inputRef.current = node;
52
- }, name: name, form: form, required: required, disabled: disabled, id: id, children: [_jsxs(BaseSelect.Trigger, { ...aria, ref: triggerRef, className: "pui-select-trigger form-control", "data-value": selected, children: [_jsx(BaseSelect.Value, {}), _jsx(BaseSelect.Icon, { className: "pui-select-icon select-chevron", children: _jsx(Chevron, {}) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { className: "pui-positioner", sideOffset: 6, alignItemWithTrigger: false, children: _jsx(BaseSelect.Popup, { className: "pui-select-popup", "data-ui-size": scheme, children: _jsx(BaseSelect.List, { children: options.map((o) => (_jsxs(BaseSelect.Item, { className: "pui-select-item", value: o.value, "data-option-value": o.value, disabled: o.disabled, children: [_jsx(BaseSelect.ItemIndicator, { className: "pui-select-check", children: _jsx(Check, {}) }), _jsx(BaseSelect.ItemText, { children: o.label })] }, o.value))) }) }) }) })] }) }));
52
+ }, name: name, form: form, required: required, disabled: disabled, id: id, children: [_jsxs(BaseSelect.Trigger, { ...aria, ref: triggerRef, className: 'pui-select-trigger form-control', "data-value": selected, children: [_jsx(BaseSelect.Value, {}), _jsx(BaseSelect.Icon, { className: 'pui-select-icon select-chevron', children: _jsx(Chevron, {}) })] }), _jsx(BaseSelect.Portal, { children: _jsx(BaseSelect.Positioner, { className: 'pui-positioner', sideOffset: 6, alignItemWithTrigger: false, children: _jsx(BaseSelect.Popup, { className: 'pui-select-popup', "data-ui-size": scheme, children: _jsx(BaseSelect.List, { children: options.map((o) => (_jsxs(BaseSelect.Item, { className: 'pui-select-item', value: o.value, "data-option-value": o.value, disabled: o.disabled, children: [_jsx(BaseSelect.ItemIndicator, { className: 'pui-select-check', children: _jsx(Check, {}) }), _jsx(BaseSelect.ItemText, { children: o.label })] }, o.value))) }) }) }) })] }) }));
53
53
  }
54
54
  function optionList(children) {
55
55
  return React.Children.toArray(children).flatMap((child) => {
@@ -57,12 +57,12 @@ function optionList(children) {
57
57
  return [];
58
58
  const p = child.props;
59
59
  if (child.type === React.Fragment ||
60
- child.type === "optgroup" ||
60
+ child.type === 'optgroup' ||
61
61
  child.type === NativeSelectOptGroup)
62
62
  return optionList(p.children);
63
63
  return [
64
64
  {
65
- value: String(p.value ?? p.children ?? ""),
65
+ value: String(p.value ?? p.children ?? ''),
66
66
  label: p.label ?? p.children,
67
67
  disabled: p.disabled,
68
68
  },
@@ -73,15 +73,15 @@ function optionList(children) {
73
73
  export const NativeSelect = React.forwardRef(function NativeSelect({ children, onChange, value, defaultValue, className, size, ...props }, ref) {
74
74
  const input = React.useRef(null);
75
75
  const options = optionList(children);
76
- return (_jsx(Select, { options: options, value: value === undefined ? undefined : String(value), defaultValue: defaultValue === undefined ? undefined : String(defaultValue), className: className, size: size, inputRef: input, triggerRef: ref, name: props.name, form: props.form, disabled: props.disabled, required: props.required, id: props.id, "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], "aria-describedby": props["aria-describedby"], "aria-invalid": props["aria-invalid"], onValueChange: (next) => {
76
+ return (_jsx(Select, { options: options, value: value === undefined ? undefined : String(value), defaultValue: defaultValue === undefined ? undefined : String(defaultValue), className: className, size: size, inputRef: input, triggerRef: ref, name: props.name, form: props.form, disabled: props.disabled, required: props.required, id: props.id, "aria-label": props['aria-label'], "aria-labelledby": props['aria-labelledby'], "aria-describedby": props['aria-describedby'], "aria-invalid": props['aria-invalid'], onValueChange: (next) => {
77
77
  if (!onChange)
78
78
  return;
79
79
  const target = input.current;
80
80
  if (!target)
81
81
  return;
82
- const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
82
+ const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set;
83
83
  setter?.call(target, next);
84
- const event = new Event("change", { bubbles: true });
84
+ const event = new Event('change', { bubbles: true });
85
85
  Object.defineProperties(event, {
86
86
  target: { value: target },
87
87
  currentTarget: { value: target },
package/dist/sizing.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as React from "react";
2
- export type ComponentSize = "small" | "default" | "large";
3
- export type ComponentSizeAlias = ComponentSize | "sm" | "md" | "lg";
1
+ import * as React from 'react';
2
+ export type ComponentSize = 'small' | 'default' | 'large';
3
+ export type ComponentSizeAlias = ComponentSize | 'sm' | 'md' | 'lg';
4
4
  export declare const ComponentSizeContext: React.Context<ComponentSize | undefined>;
5
5
  export declare function normalizeSize(size?: ComponentSizeAlias): ComponentSize | undefined;
6
6
  /** Explicit sizes override the surrounding scheme; portals retain React context. */
package/dist/sizing.js CHANGED
@@ -1,14 +1,14 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import * as React from "react";
3
+ import * as React from 'react';
4
4
  export const ComponentSizeContext = React.createContext(undefined);
5
5
  export function normalizeSize(size) {
6
- return size === "sm"
7
- ? "small"
8
- : size === "md"
9
- ? "default"
10
- : size === "lg"
11
- ? "large"
6
+ return size === 'sm'
7
+ ? 'small'
8
+ : size === 'md'
9
+ ? 'default'
10
+ : size === 'lg'
11
+ ? 'large'
12
12
  : size;
13
13
  }
14
14
  /** Explicit sizes override the surrounding scheme; portals retain React context. */
@@ -19,5 +19,5 @@ export function useComponentSize(size) {
19
19
  /** No layout box: grid/flex items and semantic children retain their own layout.
20
20
  * For table internals, place the provider outside the table, never inside tbody. */
21
21
  export function SizeProvider({ size, children, }) {
22
- return (_jsx(ComponentSizeContext.Provider, { value: size, children: _jsx("div", { className: "pui-size-scope", "data-ui-size": size, children: children }) }));
22
+ return (_jsx(ComponentSizeContext.Provider, { value: size, children: _jsx("div", { className: 'pui-size-scope', "data-ui-size": size, children: children }) }));
23
23
  }
package/dist/slot.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  export declare function Slot({ children, ...props }: React.HTMLAttributes<HTMLElement>): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
package/dist/slot.js CHANGED
@@ -1,10 +1,10 @@
1
- "use client";
2
- import * as React from "react";
3
- import { useRender } from "@base-ui/react/use-render";
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import { useRender } from '@base-ui/react/use-render';
4
4
  export function Slot({ children, ...props }) {
5
5
  return useRender({
6
6
  render: React.isValidElement(children) ? children : undefined,
7
7
  props: React.isValidElement(children) ? props : { ...props, children },
8
- defaultTagName: "span",
8
+ defaultTagName: 'span',
9
9
  });
10
10
  }
package/dist/status.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as React from "react";
2
- import { type ComponentSize } from "./sizing.js";
3
- export type StatusTone = "neutral" | "success" | "danger" | "caution" | "progress";
4
- export type BadgeProps = React.ComponentPropsWithoutRef<"span"> & {
1
+ import * as React from 'react';
2
+ import { type ComponentSize } from './sizing.js';
3
+ export type StatusTone = 'neutral' | 'success' | 'danger' | 'caution' | 'progress';
4
+ export type BadgeProps = React.ComponentPropsWithoutRef<'span'> & {
5
5
  size?: ComponentSize;
6
6
  tone?: StatusTone;
7
7
  icon?: React.ReactNode;
package/dist/status.js CHANGED
@@ -1,17 +1,17 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import { useComponentSize } from "./sizing.js";
5
- import { useToneTransition } from "./tone-transition.js";
6
- export const Badge = React.forwardRef(function Badge({ tone = "neutral", icon, children, className, size, ...props }, ref) {
3
+ import * as React from 'react';
4
+ import { useComponentSize } from './sizing.js';
5
+ import { useToneTransition } from './tone-transition.js';
6
+ export const Badge = React.forwardRef(function Badge({ tone = 'neutral', icon, children, className, size, ...props }, ref) {
7
7
  const scheme = useComponentSize(size);
8
8
  const elementRef = useToneTransition(tone, ref);
9
- return (_jsxs("span", { ...props, ref: elementRef, className: ["pui-badge", className].filter(Boolean).join(" "), "data-tone": tone, "data-ui-size": scheme, children: [icon && (_jsx("span", { className: "pui-badge-icon", "aria-hidden": "true", children: icon })), children] }));
9
+ return (_jsxs("span", { ...props, ref: elementRef, className: ['pui-badge', className].filter(Boolean).join(' '), "data-tone": tone, "data-ui-size": scheme, children: [icon && (_jsx("span", { className: 'pui-badge-icon', "aria-hidden": 'true', children: icon })), children] }));
10
10
  });
11
11
  export function StatusIcon({ tone }) {
12
- return (_jsx("svg", { width: "13", height: "13", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.7", "aria-hidden": "true", children: tone === "success" ? (_jsx("path", { d: "m5 12 4 4L19 6" })) : tone === "caution" ? (_jsxs(_Fragment, { children: [_jsx("path", { d: "m12 3 10 18H2L12 3Z" }), _jsx("path", { d: "M12 9v4m0 3v1" })] })) : tone === "danger" ? (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "9" }), _jsx("path", { d: "M12 7v6m0 3v1" })] })) : tone === "progress" ? (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "9" }), _jsx("path", { d: "M12 7v6l4 2" })] })) : (_jsxs(_Fragment, { children: [_jsx("circle", { cx: "12", cy: "12", r: "9" }), _jsx("path", { d: "M8 12h8" })] })) }));
12
+ return (_jsx("svg", { width: '13', height: '13', viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: '1.7', "aria-hidden": 'true', children: tone === 'success' ? (_jsx("path", { d: 'm5 12 4 4L19 6' })) : tone === 'caution' ? (_jsxs(_Fragment, { children: [_jsx("path", { d: 'm12 3 10 18H2L12 3Z' }), _jsx("path", { d: 'M12 9v4m0 3v1' })] })) : tone === 'danger' ? (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '12', r: '9' }), _jsx("path", { d: 'M12 7v6m0 3v1' })] })) : tone === 'progress' ? (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '12', r: '9' }), _jsx("path", { d: 'M12 7v6l4 2' })] })) : (_jsxs(_Fragment, { children: [_jsx("circle", { cx: '12', cy: '12', r: '9' }), _jsx("path", { d: 'M8 12h8' })] })) }));
13
13
  }
14
14
  /** Domain status labels and live announcements remain the caller's responsibility. */
15
- export const StatusBadge = React.forwardRef(function StatusBadge({ tone = "neutral", icon, ...props }, ref) {
15
+ export const StatusBadge = React.forwardRef(function StatusBadge({ tone = 'neutral', icon, ...props }, ref) {
16
16
  return (_jsx(Badge, { ...props, ref: ref, tone: tone, icon: icon === undefined ? _jsx(StatusIcon, { tone: tone }) : icon }));
17
17
  });
@@ -1,29 +1,29 @@
1
- import { createHighlighterCore } from "shiki/core";
2
- import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
1
+ import { createHighlighterCore } from 'shiki/core';
2
+ import { createJavaScriptRegexEngine } from 'shiki/engine/javascript';
3
3
  const loaders = {
4
- tsx: () => import("shiki/langs/tsx.mjs"),
5
- jsx: () => import("shiki/langs/jsx.mjs"),
6
- typescript: () => import("shiki/langs/typescript.mjs"),
7
- javascript: () => import("shiki/langs/javascript.mjs"),
8
- css: () => import("shiki/langs/css.mjs"),
9
- html: () => import("shiki/langs/html.mjs"),
10
- json: () => import("shiki/langs/json.mjs"),
11
- bash: () => import("shiki/langs/bash.mjs"),
12
- yaml: () => import("shiki/langs/yaml.mjs"),
13
- python: () => import("shiki/langs/python.mjs"),
14
- sql: () => import("shiki/langs/sql.mjs"),
15
- markdown: () => import("shiki/langs/markdown.mjs"),
4
+ tsx: () => import('shiki/langs/tsx.mjs'),
5
+ jsx: () => import('shiki/langs/jsx.mjs'),
6
+ typescript: () => import('shiki/langs/typescript.mjs'),
7
+ javascript: () => import('shiki/langs/javascript.mjs'),
8
+ css: () => import('shiki/langs/css.mjs'),
9
+ html: () => import('shiki/langs/html.mjs'),
10
+ json: () => import('shiki/langs/json.mjs'),
11
+ bash: () => import('shiki/langs/bash.mjs'),
12
+ yaml: () => import('shiki/langs/yaml.mjs'),
13
+ python: () => import('shiki/langs/python.mjs'),
14
+ sql: () => import('shiki/langs/sql.mjs'),
15
+ markdown: () => import('shiki/langs/markdown.mjs'),
16
16
  };
17
17
  const roles = [
18
- "plain",
19
- "comment",
20
- "keyword",
21
- "string",
22
- "number",
23
- "function",
24
- "tag",
25
- "attribute",
26
- "punctuation",
18
+ 'plain',
19
+ 'comment',
20
+ 'keyword',
21
+ 'string',
22
+ 'number',
23
+ 'function',
24
+ 'tag',
25
+ 'attribute',
26
+ 'punctuation',
27
27
  ];
28
28
  const colors = Object.fromEntries(roles.map((role, i) => [`#00000${i + 1}`, role]));
29
29
  const color = (index) => `#00000${index + 1}`;
@@ -35,53 +35,53 @@ function highlighter() {
35
35
  langs: [],
36
36
  themes: [
37
37
  {
38
- name: "platform-quiet",
39
- type: "dark",
38
+ name: 'platform-quiet',
39
+ type: 'dark',
40
40
  colors: {
41
- "editor.foreground": color(0),
42
- "editor.background": "#000000",
41
+ 'editor.foreground': color(0),
42
+ 'editor.background': '#000000',
43
43
  },
44
44
  tokenColors: [
45
45
  {
46
- scope: ["comment", "punctuation.definition.comment"],
46
+ scope: ['comment', 'punctuation.definition.comment'],
47
47
  settings: { foreground: color(1) },
48
48
  },
49
49
  {
50
- scope: ["keyword", "storage", "constant.language"],
50
+ scope: ['keyword', 'storage', 'constant.language'],
51
51
  settings: { foreground: color(2) },
52
52
  },
53
53
  {
54
- scope: ["string", "markup.inline.raw", "markup.fenced_code.block"],
54
+ scope: ['string', 'markup.inline.raw', 'markup.fenced_code.block'],
55
55
  settings: { foreground: color(3) },
56
56
  },
57
57
  {
58
- scope: ["constant.numeric", "constant.character"],
58
+ scope: ['constant.numeric', 'constant.character'],
59
59
  settings: { foreground: color(4) },
60
60
  },
61
61
  {
62
62
  scope: [
63
- "entity.name.function",
64
- "support.function",
65
- "entity.name.type",
66
- "support.type",
67
- "entity.name.class",
63
+ 'entity.name.function',
64
+ 'support.function',
65
+ 'entity.name.type',
66
+ 'support.type',
67
+ 'entity.name.class',
68
68
  ],
69
69
  settings: { foreground: color(5) },
70
70
  },
71
71
  {
72
- scope: ["entity.name.tag", "markup.heading"],
72
+ scope: ['entity.name.tag', 'markup.heading'],
73
73
  settings: { foreground: color(6) },
74
74
  },
75
75
  {
76
76
  scope: [
77
- "entity.other.attribute-name",
78
- "support.type.property-name",
79
- "variable.other.property",
77
+ 'entity.other.attribute-name',
78
+ 'support.type.property-name',
79
+ 'variable.other.property',
80
80
  ],
81
81
  settings: { foreground: color(7) },
82
82
  },
83
83
  {
84
- scope: ["punctuation", "meta.brace"],
84
+ scope: ['punctuation', 'meta.brace'],
85
85
  settings: { foreground: color(8) },
86
86
  },
87
87
  ],
@@ -115,10 +115,10 @@ export async function highlightCode(code, language) {
115
115
  }));
116
116
  await languages.get(language);
117
117
  const tokens = instance
118
- .codeToTokensBase(code, { lang: language, theme: "platform-quiet" })
118
+ .codeToTokensBase(code, { lang: language, theme: 'platform-quiet' })
119
119
  .map((line) => line.map((token) => ({
120
120
  content: token.content,
121
- role: colors[token.color?.toLowerCase() ?? ""] ?? "plain",
121
+ role: colors[token.color?.toLowerCase() ?? ''] ?? 'plain',
122
122
  })));
123
123
  if (code.length <= 8000) {
124
124
  cache.set(key, tokens);
@@ -1,6 +1,6 @@
1
- import * as React from "react";
1
+ import * as React from 'react';
2
2
  export declare const syntaxLanguages: readonly ["tsx", "jsx", "typescript", "javascript", "css", "html", "json", "bash", "yaml", "python", "sql", "markdown", "text"];
3
- export type SyntaxHighlighterProps = Omit<React.ComponentPropsWithoutRef<"code">, "children"> & {
3
+ export type SyntaxHighlighterProps = Omit<React.ComponentPropsWithoutRef<'code'>, 'children'> & {
4
4
  code: string;
5
5
  language?: string;
6
6
  inline?: boolean;
@@ -1,46 +1,46 @@
1
- "use client";
1
+ 'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import * as React from "react";
4
- import { ScrollArea } from "./scroll-area.js";
3
+ import * as React from 'react';
4
+ import { ScrollArea } from './scroll-area.js';
5
5
  export const syntaxLanguages = [
6
- "tsx",
7
- "jsx",
8
- "typescript",
9
- "javascript",
10
- "css",
11
- "html",
12
- "json",
13
- "bash",
14
- "yaml",
15
- "python",
16
- "sql",
17
- "markdown",
18
- "text",
6
+ 'tsx',
7
+ 'jsx',
8
+ 'typescript',
9
+ 'javascript',
10
+ 'css',
11
+ 'html',
12
+ 'json',
13
+ 'bash',
14
+ 'yaml',
15
+ 'python',
16
+ 'sql',
17
+ 'markdown',
18
+ 'text',
19
19
  ];
20
20
  const aliases = {
21
- ts: "typescript",
22
- js: "javascript",
23
- sh: "bash",
24
- shell: "bash",
25
- yml: "yaml",
26
- py: "python",
27
- md: "markdown",
28
- xml: "html",
29
- plaintext: "text",
30
- txt: "text",
21
+ ts: 'typescript',
22
+ js: 'javascript',
23
+ sh: 'bash',
24
+ shell: 'bash',
25
+ yml: 'yaml',
26
+ py: 'python',
27
+ md: 'markdown',
28
+ xml: 'html',
29
+ plaintext: 'text',
30
+ txt: 'text',
31
31
  };
32
32
  /** Rendering remains selectable React text; it never inserts executable HTML. */
33
- export const SyntaxHighlighter = React.forwardRef(function SyntaxHighlighter({ code, language = "text", inline = false, label = "Highlighted source", wrap = false, className, ...props }, ref) {
33
+ export const SyntaxHighlighter = React.forwardRef(function SyntaxHighlighter({ code, language = 'text', inline = false, label = 'Highlighted source', wrap = false, className, ...props }, ref) {
34
34
  const name = language.trim().toLowerCase();
35
35
  const lang = aliases[name] ?? name;
36
36
  const [result, setResult] = React.useState();
37
37
  React.useEffect(() => {
38
38
  let current = true;
39
- if (lang === "text" ||
39
+ if (lang === 'text' ||
40
40
  !syntaxLanguages.includes(lang) ||
41
41
  code.length > 50000)
42
42
  return;
43
- import("./syntax-engine.js")
43
+ import('./syntax-engine.js')
44
44
  .then((engine) => engine.highlightCode(code, lang))
45
45
  .then((tokens) => {
46
46
  if (current)
@@ -57,8 +57,8 @@ export const SyntaxHighlighter = React.forwardRef(function SyntaxHighlighter({ c
57
57
  const tokens = result?.code === code && result.language === lang ? result.tokens : null;
58
58
  const eols = code.match(/\r\n|\n|\r/g) ?? [];
59
59
  const valid = tokens && tokens.length === eols.length + 1;
60
- const element = (_jsx("code", { ...props, ref: ref, className: ["pui-syntax", className].filter(Boolean).join(" "), "data-language": lang, "data-highlighted": valid ? "true" : "false", children: valid
61
- ? tokens.map((line, i) => (_jsxs(React.Fragment, { children: [line.map((token, j) => (_jsx("span", { "data-syntax": token.role, children: token.content }, j))), eols[i] ?? ""] }, i)))
60
+ const element = (_jsx("code", { ...props, ref: ref, className: ['pui-syntax', className].filter(Boolean).join(' '), "data-language": lang, "data-highlighted": valid ? 'true' : 'false', children: valid
61
+ ? tokens.map((line, i) => (_jsxs(React.Fragment, { children: [line.map((token, j) => (_jsx("span", { "data-syntax": token.role, children: token.content }, j))), eols[i] ?? ''] }, i)))
62
62
  : code }));
63
- return inline ? (element) : (_jsx(ScrollArea, { label: label, orientation: "horizontal", children: _jsx("pre", { className: "pui-syntax-pre", "data-wrap": wrap || undefined, children: element }) }));
63
+ return inline ? (element) : (_jsx(ScrollArea, { label: label, orientation: 'horizontal', rootClassName: 'pui-syntax-scroll', children: _jsx("pre", { className: 'pui-syntax-pre', "data-wrap": wrap || undefined, children: element }) }));
64
64
  });
@@ -0,0 +1,31 @@
1
+ export type TableSelectionOptions<Row> = {
2
+ /** Rows on the current page, in display order. */
3
+ rows: readonly Row[];
4
+ getId: (row: Row) => string;
5
+ /** Rows that fail stay unselectable, such as read-only resources. */
6
+ canSelect?: (row: Row) => boolean;
7
+ selected?: readonly string[];
8
+ defaultSelected?: readonly string[];
9
+ onSelectedChange?: (selected: string[]) => void;
10
+ };
11
+ export type TableSelectionCheckbox = {
12
+ checked: boolean;
13
+ indeterminate?: boolean;
14
+ disabled: boolean;
15
+ onCheckedChange: (checked: boolean) => void;
16
+ };
17
+ /**
18
+ * Row selection by stable ID that survives paging, sorting and filtering.
19
+ * The page checkbox covers only the selectable rows on the current page;
20
+ * hiddenCount reports selections the reader cannot see.
21
+ */
22
+ export declare function useTableSelection<Row>({ rows, getId, canSelect, selected: controlled, defaultSelected, onSelectedChange, }: TableSelectionOptions<Row>): {
23
+ selected: readonly string[];
24
+ isSelected: (id: string) => boolean;
25
+ toggle: (id: string, checked: boolean) => void;
26
+ clear: () => void;
27
+ /** Selected rows that are not on the current page. */
28
+ hiddenCount: number;
29
+ pageCheckbox: TableSelectionCheckbox;
30
+ rowCheckbox: (row: Row) => TableSelectionCheckbox;
31
+ };
@@ -0,0 +1,50 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ /**
4
+ * Row selection by stable ID that survives paging, sorting and filtering.
5
+ * The page checkbox covers only the selectable rows on the current page;
6
+ * hiddenCount reports selections the reader cannot see.
7
+ */
8
+ export function useTableSelection({ rows, getId, canSelect = () => true, selected: controlled, defaultSelected = [], onSelectedChange, }) {
9
+ const [uncontrolled, setUncontrolled] = React.useState(defaultSelected);
10
+ const selected = controlled ?? uncontrolled;
11
+ const update = (next) => {
12
+ if (controlled === undefined)
13
+ setUncontrolled(next);
14
+ onSelectedChange?.(next);
15
+ };
16
+ const chosen = new Set(selected);
17
+ const onPage = new Set(rows.map(getId));
18
+ const selectable = rows.filter(canSelect).map(getId);
19
+ const pageChosen = selectable.filter((id) => chosen.has(id)).length;
20
+ const toggle = (id, checked) => update(checked
21
+ ? chosen.has(id)
22
+ ? [...selected]
23
+ : [...selected, id]
24
+ : selected.filter((other) => other !== id));
25
+ const pageCheckbox = {
26
+ checked: selectable.length > 0 && pageChosen === selectable.length,
27
+ indeterminate: pageChosen > 0 && pageChosen < selectable.length,
28
+ disabled: selectable.length === 0,
29
+ onCheckedChange: (checked) => update(checked
30
+ ? [...new Set([...selected, ...selectable])]
31
+ : selected.filter((id) => !selectable.includes(id))),
32
+ };
33
+ return {
34
+ selected: selected,
35
+ isSelected: (id) => chosen.has(id),
36
+ toggle,
37
+ clear: () => update([]),
38
+ /** Selected rows that are not on the current page. */
39
+ hiddenCount: selected.filter((id) => !onPage.has(id)).length,
40
+ pageCheckbox,
41
+ rowCheckbox: (row) => {
42
+ const id = getId(row);
43
+ return {
44
+ checked: chosen.has(id),
45
+ disabled: !canSelect(row),
46
+ onCheckedChange: (checked) => toggle(id, checked),
47
+ };
48
+ },
49
+ };
50
+ }
package/dist/toast.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import * as React from "react";
2
- import { Toast as BaseToast } from "@base-ui/react/toast";
3
- import { type StatusTone } from "./status.js";
1
+ import * as React from 'react';
2
+ import { Toast as BaseToast } from '@base-ui/react/toast';
3
+ import { type StatusTone } from './status.js';
4
4
  export type ToastRootProps = React.ComponentPropsWithoutRef<typeof BaseToast.Root> & {
5
5
  tone?: StatusTone;
6
6
  };
7
7
  export type ToastViewportProps = React.ComponentPropsWithoutRef<typeof BaseToast.Viewport> & {
8
- layout?: "stack" | "list" | "anchored";
8
+ layout?: 'stack' | 'list' | 'anchored';
9
9
  };
10
10
  export declare const Toast: {
11
11
  Root: React.ForwardRefExoticComponent<Omit<Omit<import("@base-ui/react/toast").ToastRootProps, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {