@hussmartinez/ui 0.7.0 → 0.9.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
@@ -159,9 +159,11 @@ Every component follows one contract ([ADR 0003](https://github.com/ie-huss-mart
159
159
  | `Dialog` | A modal dialog on the native `<dialog>`: focus moves in and is trapped, the page behind is inert, Escape asks to close through `onOpenChange(false)`, and focus returns to the opener. Controlled by `open`; labelled by `title`. Long content scrolls in the body, which becomes keyboard-scrollable when it overflows |
160
160
  | `Spinner` | Loading for an unknown time. An indeterminate progress bar to assistive technology, named by `label`; its size follows `--hm-spinner-size` |
161
161
  | `ProgressBar` | Progress for a known amount, on the native `<progress>`: `value`, `max`, `label`, `valueText`. Indeterminate without `value`. It needs no inline styles, so it works under a strict Content Security Policy |
162
- | `Field` | A visible `label`, an optional `description` and an optional `error`, wired to one control: the label names it, the description and error describe it, and an error marks it `aria-invalid`. `Slider`, `NumberField` and `TextField` connect themselves; for a native `<input>` or `<select>`, pass a function and spread the props it receives |
162
+ | `Field` | A visible `label`, an optional `description` and an optional `error`, wired to one control: the label names it, the description and error describe it, and an error marks it `aria-invalid`. `Slider`, `NumberField`, `TextField`, `TextArea` and `ColorField` connect themselves; for a native `<input>` or `<select>`, pass a function and spread the props it receives |
163
163
  | `NumberField` | A number typed as text, exposed as a spin button. Typing is committed on blur or Enter and kept within `min` and `max`; text that isn't a number goes back to the last value, so `onValueChange` never receives `NaN`. Arrow Up and Down step by `step`, Page Up and Down by `largeStep`, and Escape throws the typing away. `parse` and `format` default to the `locale`, or `UiMessagesProvider`'s, digits and separators included; replace them for units or a timecode. With `name`, forms receive the number |
164
164
  | `TextField` | Single-line text: `text`, `search`, `email`, `url`, `tel` or `password`. Native input props pass through, plus `onValueChange(value)`. In a `Field`, it takes the field's label, description and error, and shows the error with its border |
165
+ | `TextArea` | Multi-line text, styled like `TextField` and with its tokens. `rows` sets its height, three by default, and the user can drag it taller. Native textarea props pass through, plus `onValueChange(value)`; the value separates lines with `\n`. In a `Field`, it takes the field's label, description and error |
166
+ | `ColorField` | A colour: a hex input (`#rrggbb` or `#rgb`, with or without the `#`) beside a preview, and optional `swatches` to pick from, each `{ value, label }`. Controlled with `value` and `onValueChange`, or uncontrolled from `defaultValue`; the value is always lowercase `#rrggbb`. Typing commits on Enter or blur, text that isn't a colour goes back to the last value, and Escape throws the typing away. The swatches are a radio group with one Tab stop, named after the field. It doesn't use the browser's own colour picker. In a `Field`, it takes the field's label, description and error |
165
167
  | `Slider` | A value in a range, such as volume or zoom, on the native `<input type="range">`: `value` or `defaultValue`, `onValueChange`, `min`, `max`, `step` and `largeStep`. `formatValue` gives screen readers the value as text, such as "−6 dB". Arrow keys, Page Up and Down, Home and End work the same in every browser, mirrored in right-to-left text. In a `Toolbar`, it keeps the arrow keys, so put it last |
166
168
  | `AnnouncerProvider`, `useAnnounce` | Announcements for screen readers, such as "Saved 1.3 MB": `announce(message, { politeness })`. The provider renders the live regions once, on the server too |
167
169
  | `usePlatform` | The platform for keyboard shortcuts: `"apple"` on macOS, iOS and iPadOS, where `Mod` is ⌘, otherwise `"other"`. It's `"other"` on the server and during hydration, then Apple devices switch right after, so hydration never mismatches. Pass it to sdk-core's `createShortcutRegistry({ platform })`, and never read `navigator` during render for this |
package/dist/index.d.ts CHANGED
@@ -61,7 +61,7 @@ export declare type CompleteThemeTokens = ThemeTokens & {
61
61
  *
62
62
  * @public
63
63
  */
64
- export declare type ComponentTokenName = "button-height" | "button-small-height" | "button-padding-x" | "button-gap" | "button-icon-size" | "button-radius" | "button-font-weight" | "button-bg" | "button-bg-hover" | "button-bg-active" | "button-fg" | "button-border-color" | "button-primary-bg" | "button-primary-bg-hover" | "button-primary-bg-active" | "button-primary-fg" | "button-quiet-bg-hover" | "button-quiet-bg-active" | "button-danger-bg" | "button-danger-bg-hover" | "button-danger-fg" | "button-pressed-bg" | "button-pressed-border-color" | "button-pressed-fg" | "toolbar-bg" | "toolbar-border-color" | "toolbar-radius" | "toolbar-padding" | "toolbar-gap" | "toolbar-group-gap" | "toolbar-separator-color" | "segmented-control-height" | "segmented-control-small-height" | "segmented-control-padding" | "segmented-control-gap" | "segmented-control-radius" | "segmented-control-bg" | "segmented-control-border-color" | "segmented-control-option-padding-x" | "segmented-control-option-fg" | "segmented-control-option-bg-hover" | "segmented-control-option-checked-bg" | "segmented-control-option-checked-fg" | "segmented-control-option-checked-border-color" | "dialog-bg" | "dialog-fg" | "dialog-border-color" | "dialog-radius" | "dialog-shadow" | "dialog-padding" | "dialog-gap" | "dialog-backdrop" | "dialog-title-font-size" | "dialog-small-width" | "dialog-width" | "dialog-large-width" | "spinner-size" | "spinner-thickness" | "spinner-color" | "spinner-track-color" | "spinner-duration" | "progress-height" | "progress-radius" | "progress-track-color" | "progress-fill-color" | "progress-duration" | "slider-track-size" | "slider-track-color" | "slider-radius" | "slider-thumb-size" | "slider-thumb-color" | "slider-thumb-color-hover" | "slider-thumb-color-active" | "field-gap" | "field-label-fg" | "field-label-font-weight" | "field-description-fg" | "field-error-fg" | "field-message-font-size" | "number-field-height" | "number-field-padding-x" | "number-field-radius" | "number-field-bg" | "number-field-fg" | "number-field-border-color" | "number-field-invalid-border-color" | "file-drop-zone-gap" | "file-drop-zone-padding" | "file-drop-zone-radius" | "file-drop-zone-border-color" | "file-drop-zone-dragging-border-color" | "file-drop-zone-dragging-bg" | "file-drop-zone-hint-fg" | "tooltip-bg" | "tooltip-fg" | "tooltip-radius" | "tooltip-padding" | "tooltip-font-size" | "tooltip-shadow" | "tooltip-max-width" | "tooltip-offset" | "text-field-height" | "text-field-padding-x" | "text-field-radius" | "text-field-bg" | "text-field-fg" | "text-field-placeholder-fg" | "text-field-border-color" | "text-field-invalid-border-color";
64
+ export declare type ComponentTokenName = "button-height" | "button-small-height" | "button-padding-x" | "button-gap" | "button-icon-size" | "button-radius" | "button-font-weight" | "button-bg" | "button-bg-hover" | "button-bg-active" | "button-fg" | "button-border-color" | "button-primary-bg" | "button-primary-bg-hover" | "button-primary-bg-active" | "button-primary-fg" | "button-quiet-bg-hover" | "button-quiet-bg-active" | "button-danger-bg" | "button-danger-bg-hover" | "button-danger-fg" | "button-pressed-bg" | "button-pressed-border-color" | "button-pressed-fg" | "toolbar-bg" | "toolbar-border-color" | "toolbar-radius" | "toolbar-padding" | "toolbar-gap" | "toolbar-group-gap" | "toolbar-separator-color" | "segmented-control-height" | "segmented-control-small-height" | "segmented-control-padding" | "segmented-control-gap" | "segmented-control-radius" | "segmented-control-bg" | "segmented-control-border-color" | "segmented-control-option-padding-x" | "segmented-control-option-fg" | "segmented-control-option-bg-hover" | "segmented-control-option-checked-bg" | "segmented-control-option-checked-fg" | "segmented-control-option-checked-border-color" | "dialog-bg" | "dialog-fg" | "dialog-border-color" | "dialog-radius" | "dialog-shadow" | "dialog-padding" | "dialog-gap" | "dialog-backdrop" | "dialog-title-font-size" | "dialog-small-width" | "dialog-width" | "dialog-large-width" | "spinner-size" | "spinner-thickness" | "spinner-color" | "spinner-track-color" | "spinner-duration" | "progress-height" | "progress-radius" | "progress-track-color" | "progress-fill-color" | "progress-duration" | "slider-track-size" | "slider-track-color" | "slider-radius" | "slider-thumb-size" | "slider-thumb-color" | "slider-thumb-color-hover" | "slider-thumb-color-active" | "field-gap" | "field-label-fg" | "field-label-font-weight" | "field-description-fg" | "field-error-fg" | "field-message-font-size" | "number-field-height" | "number-field-padding-x" | "number-field-radius" | "number-field-bg" | "number-field-fg" | "number-field-border-color" | "number-field-invalid-border-color" | "file-drop-zone-gap" | "file-drop-zone-padding" | "file-drop-zone-radius" | "file-drop-zone-border-color" | "file-drop-zone-dragging-border-color" | "file-drop-zone-dragging-bg" | "file-drop-zone-hint-fg" | "tooltip-bg" | "tooltip-fg" | "tooltip-radius" | "tooltip-padding" | "tooltip-font-size" | "tooltip-shadow" | "tooltip-max-width" | "tooltip-offset" | "text-field-height" | "text-field-padding-x" | "text-field-radius" | "text-field-bg" | "text-field-fg" | "text-field-placeholder-fg" | "text-field-border-color" | "text-field-invalid-border-color" | "text-area-padding-y" | "color-field-gap" | "color-field-swatch-size" | "color-field-swatch-radius" | "color-field-swatch-border-color" | "color-field-swatch-checked-border-color";
65
65
 
66
66
  /**
67
67
  * Component tokens from SDKs, such as `pdf-thumb-radius`. `ui`'s own
@@ -200,7 +200,7 @@ export declare interface ExtendingThemeInput extends ThemeInputBase {
200
200
  *
201
201
  * @public
202
202
  */
203
- export declare type IconName = "add" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "close" | "crop" | "delete" | "download" | "fade-in" | "fade-out" | "fit" | "flip-horizontal" | "flip-vertical" | "highlighter" | "info" | "loop" | "menu" | "more" | "muted" | "open" | "page-grid" | "page-single" | "pan" | "pause" | "pen" | "play" | "redo" | "remove" | "rotate-left" | "rotate-right" | "search" | "select" | "skip-back" | "skip-forward" | "snap" | "split" | "stop" | "trim-end" | "trim-start" | "undo" | "upload" | "volume" | "warning" | "zoom-in" | "zoom-out";
203
+ export declare type IconName = "add" | "arrow" | "check" | "chevron-down" | "chevron-left" | "chevron-right" | "close" | "crop" | "delete" | "download" | "duplicate" | "ellipse" | "fade-in" | "fade-out" | "fit" | "flip-horizontal" | "flip-vertical" | "hidden" | "highlighter" | "info" | "layers" | "loop" | "menu" | "more" | "move-down" | "move-up" | "muted" | "open" | "page-add" | "page-grid" | "page-single" | "pan" | "pause" | "pen" | "play" | "rectangle" | "redact" | "redo" | "remove" | "rotate-left" | "rotate-right" | "search" | "select" | "skip-back" | "skip-forward" | "snap" | "split" | "stop" | "text" | "trim-end" | "trim-start" | "undo" | "upload" | "visible" | "volume" | "warning" | "zoom-in" | "zoom-out";
204
204
 
205
205
  /**
206
206
  * The built-in light theme.
@@ -434,6 +434,7 @@ export declare type UiErrorCode = "INVALID_THEME_TOKEN" | "INVALID_THEME_SELECTO
434
434
  * @public
435
435
  */
436
436
  export declare const uiMessages: {
437
+ readonly "colorField.swatches": "swatches";
437
438
  readonly "dialog.close": "Close";
438
439
  readonly "fileDropZone.choose": "Choose a file";
439
440
  readonly "fileDropZone.chooseMultiple": "Choose files";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as uiMessages, i as warnInDevelopment, n as cssWriterOf, o as UiError, r as registerTheme, t as isThemePair } from "./shared/pair-DLVFV6vU.js";
1
+ import { a as uiMessages, i as warnInDevelopment, n as cssWriterOf, o as UiError, r as registerTheme, t as isThemePair } from "./shared/pair-pt-vUVwu.js";
2
2
  // src/tokens/base.ts
3
3
  var baseValues = {
4
4
  "gray-50": "oklch(0.985 0.008 260)",
@@ -1128,7 +1128,13 @@ var component = {
1128
1128
  "text-field-fg": { fallback: "color-text" },
1129
1129
  "text-field-placeholder-fg": { fallback: "color-text-muted" },
1130
1130
  "text-field-border-color": { fallback: "color-border-strong" },
1131
- "text-field-invalid-border-color": { fallback: "color-danger-text" }
1131
+ "text-field-invalid-border-color": { fallback: "color-danger-text" },
1132
+ "text-area-padding-y": { fallback: "inset-tight" },
1133
+ "color-field-gap": { fallback: "gap-tight" },
1134
+ "color-field-swatch-size": { fallback: "control-height-small" },
1135
+ "color-field-swatch-radius": { fallback: "radius-control" },
1136
+ "color-field-swatch-border-color": { fallback: "color-border-strong" },
1137
+ "color-field-swatch-checked-border-color": { fallback: "color-text" }
1132
1138
  };
1133
1139
  function baseDefinitions() {
1134
1140
  const list = [];