@tangible/ui 0.2.34 → 0.2.36

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.
@@ -1,5 +1,6 @@
1
1
  export declare const SecretInput: import("react").ForwardRefExoticComponent<Omit<import("..").TextInputProps, "type" | "prefix" | "suffix"> & {
2
2
  isSet?: boolean;
3
+ placeholder?: string;
3
4
  defaultRevealed?: boolean;
4
5
  revealed?: boolean;
5
6
  onRevealChange?: (revealed: boolean) => void;
@@ -127,9 +127,10 @@ export const SecretInput = forwardRef(function SecretInput({ isSet = false, reve
127
127
  type: revealed && !locked ? 'text' : 'password', value: value, defaultValue: defaultValue, onChange: handleChange, readOnly: locked || rest.readOnly, disabled: disabled, "aria-describedby": describedBy,
128
128
  // The bullets are a placeholder, never a value — a real value would
129
129
  // submit and overwrite the stored secret with eight bullet characters.
130
- // A consumer-supplied placeholder wins; the description still carries
131
- // the set-state to AT either way.
132
- placeholder: placeholder ?? (showSetState ? text.valueSet : undefined), className: cx('tui-secret-input', showSetState && 'is-set', locked && 'is-locked', className),
130
+ // The consumer's placeholder is for the empty state: while a value is
131
+ // saved, `labels.valueSet` wins, or the field would invite pasting a
132
+ // key that is already there. Reword the set state via `labels`.
133
+ placeholder: showSetState ? text.valueSet : placeholder, className: cx('tui-secret-input', showSetState && 'is-set', locked && 'is-locked', className),
133
134
  // `off` is the one value browsers deliberately ignore on a password
134
135
  // field; `new-password` is what actually stops Chrome/Safari/Firefox
135
136
  // offering a saved credential. That matters beyond annoyance: an
@@ -41,7 +41,8 @@ export type SecretInputLabels = {
41
41
  * being concatenated in code.
42
42
  *
43
43
  * @remarks Placeholder text only. It is never a value, so nothing submits
44
- * unless the user types. A `placeholder` prop overrides it.
44
+ * unless the user types. It wins over the `placeholder` prop while the
45
+ * set-state shows; see `placeholder`.
45
46
  * @default "•••••••• Saved"
46
47
  */
47
48
  valueSet?: string;
@@ -85,7 +86,8 @@ export declare const defaultSecretInputLabels: Required<SecretInputLabels>;
85
86
  export type SecretInputProps = Omit<TextInputProps, 'type' | 'prefix' | 'suffix'> & {
86
87
  /**
87
88
  * A value exists server-side that is deliberately not shown. Renders the
88
- * set-state treatment while the input is empty.
89
+ * set-state treatment while the input is empty, including the
90
+ * `labels.valueSet` placeholder, which replaces `placeholder`.
89
91
  *
90
92
  * The stored value must never be passed to this component — see the contract
91
93
  * above; a dev-only warning fires if it is alongside `isSet`. Nothing is submitted unless the user types, so an empty submit means
@@ -94,6 +96,18 @@ export type SecretInputProps = Omit<TextInputProps, 'type' | 'prefix' | 'suffix'
94
96
  * @default false
95
97
  */
96
98
  isSet?: boolean;
99
+ /**
100
+ * Placeholder for the empty field when nothing is saved. While `isSet` and
101
+ * the field is empty, `labels.valueSet` is shown instead and this is
102
+ * ignored. Put format hints ("sk-…") in `Field` help text, which stays
103
+ * visible in both states.
104
+ *
105
+ * @remarks A deliberate exception to "an explicit prop beats its `labels`
106
+ * default": this is the empty-state prompt, and on a saved field a prompt
107
+ * such as "Paste your API key" reads as if nothing were stored. Reword the
108
+ * saved state through `labels.valueSet`.
109
+ */
110
+ placeholder?: string;
97
111
  /**
98
112
  * Initial reveal state (uncontrolled).
99
113
  * @default false
@@ -94,3 +94,4 @@ export type { ToolbarProps, ToolbarGroupProps, ToolbarItemProps, ToolbarOrientat
94
94
  export type { TooltipProps, TooltipProviderProps, TooltipTriggerProps, TooltipContentProps, TooltipType } from './Tooltip';
95
95
  export { GENERATIVE_COLORS, stringToGenerativeColor } from '../utils/generative';
96
96
  export type { GenerativeColor } from '../utils/generative';
97
+ export * from '../utils/color-scheme';
@@ -47,3 +47,6 @@ export { Toolbar } from './Toolbar/index.js';
47
47
  export { Tooltip, TooltipProvider, TooltipTrigger, TooltipContent } from './Tooltip/index.js';
48
48
  // Generative colors (The Jellybean Bag) — deterministic identity colors
49
49
  export { GENERATIVE_COLORS, stringToGenerativeColor } from '../utils/generative.js';
50
+ // Color scheme switching (instant: no controls fading into the new theme)
51
+ // (the module's whole surface: one list, kept in color-scheme.ts)
52
+ export * from '../utils/color-scheme.js';
package/figma-tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.34",
2
+ "version": "0.2.36",
3
3
  "source": "publish/styles/all.expanded.css",
4
4
  "prefix": "tui-",
5
5
  "note": "Layer 1 primitives only. Component API tokens (--tui-{component}-*) are never defined in CSS — they exist only as fallback reads — so they have no Figma representation. CONTRACT: consumers read TUI defaults from this file at build time (variables[].cssVar, the \"Light\"/\"Dark\" mode names, and alias chains into TUI/Primitives). Renaming a cssVar or a mode is a breaking change to those consumers even when the CSS value is unchanged — a rename silently becomes an undefined default downstream — so treat it as at least a minor bump and call it out in the CHANGELOG.",
@@ -230,6 +230,18 @@
230
230
  }
231
231
  }
232
232
  },
233
+ {
234
+ "name": "palette/gray/150",
235
+ "type": "COLOR",
236
+ "values": {
237
+ "Default": {
238
+ "r": 0.9254901960784314,
239
+ "g": 0.9333333333333333,
240
+ "b": 0.9450980392156862,
241
+ "a": 1
242
+ }
243
+ }
244
+ },
233
245
  {
234
246
  "name": "palette/gray/200",
235
247
  "type": "COLOR",
@@ -3330,9 +3342,9 @@
3330
3342
  "type": "COLOR",
3331
3343
  "values": {
3332
3344
  "Light": {
3333
- "alias": "palette/gray/100",
3345
+ "alias": "palette/gray/150",
3334
3346
  "collection": "TUI/Primitives",
3335
- "hex": "#f3f4f6"
3347
+ "hex": "#eceef1"
3336
3348
  },
3337
3349
  "Dark": {
3338
3350
  "alias": "palette/gray/800",
package/icons/icons.svg CHANGED
@@ -1,4 +1,4 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" data-tui-icon-sprite="all" data-tui-icon-sprite-version="0.2.34" aria-hidden="true" focusable="false" style="position:absolute;width:0;height:0;overflow:hidden">
1
+ <svg xmlns="http://www.w3.org/2000/svg" data-tui-icon-sprite="all" data-tui-icon-sprite-version="0.2.36" aria-hidden="true" focusable="false" style="position:absolute;width:0;height:0;overflow:hidden">
2
2
  <symbol id="tui-cred-badge-check" viewBox="0 0 24 24"><path fill-rule="evenodd" d="M10.893 4.558a1.377 1.377 0 0 1 2.214 0c.381.515 1.068.7 1.656.444a1.377 1.377 0 0 1 1.917 1.106c.072.637.575 1.14 1.212 1.213a1.377 1.377 0 0 1 1.106 1.916 1.38 1.38 0 0 0 .444 1.656c.744.55.744 1.663 0 2.214a1.38 1.38 0 0 0-.444 1.656 1.377 1.377 0 0 1-1.106 1.917 1.38 1.38 0 0 0-1.212 1.212 1.377 1.377 0 0 1-1.917 1.106 1.38 1.38 0 0 0-1.656.444 1.377 1.377 0 0 1-2.214 0 1.38 1.38 0 0 0-1.656-.444 1.377 1.377 0 0 1-1.916-1.106 1.38 1.38 0 0 0-1.213-1.212 1.377 1.377 0 0 1-1.106-1.917 1.38 1.38 0 0 0-.444-1.656 1.377 1.377 0 0 1 0-2.214c.515-.381.7-1.068.444-1.656a1.377 1.377 0 0 1 1.106-1.916 1.38 1.38 0 0 0 1.213-1.213 1.377 1.377 0 0 1 1.916-1.106 1.38 1.38 0 0 0 1.656-.444m5.193 5.91a.75.75 0 0 0-1.172-.936l-3.531 4.414-1.914-1.532a.75.75 0 1 0-.937 1.172l3.085 2.468z" clip-rule="evenodd"/></symbol>
3
3
  <symbol id="tui-cred-badge-ribbon" viewBox="0 0 24 24"><path d="M11.032 3.488a1.205 1.205 0 0 1 1.936 0c.334.451.935.612 1.45.388a1.205 1.205 0 0 1 1.677.969c.063.557.503.997 1.06 1.06.805.092 1.291.935.969 1.678a1.204 1.204 0 0 0 .388 1.449c.65.481.65 1.455 0 1.936a1.205 1.205 0 0 0-.388 1.45 1.205 1.205 0 0 1-.969 1.677 1.204 1.204 0 0 0-1.06 1.06 1.205 1.205 0 0 1-1.678.969 1.205 1.205 0 0 0-1.449.388c-.481.65-1.455.65-1.936 0a1.204 1.204 0 0 0-1.45-.388 1.205 1.205 0 0 1-1.677-.969 1.205 1.205 0 0 0-1.06-1.06 1.205 1.205 0 0 1-.969-1.678 1.205 1.205 0 0 0-.388-1.449 1.205 1.205 0 0 1 0-1.936c.451-.334.612-.935.388-1.45a1.205 1.205 0 0 1 .969-1.677 1.205 1.205 0 0 0 1.06-1.06 1.205 1.205 0 0 1 1.678-.969 1.205 1.205 0 0 0 1.449-.388M8 17.482c.442.175.953.185 1.437-.025a.88.88 0 0 1 1.054.282 1.877 1.877 0 0 0 3.018 0 .88.88 0 0 1 1.054-.282c.484.21.995.2 1.437.025V21l-4-2.286L8 21z"/></symbol>
4
4
  <symbol id="tui-cred-badge" viewBox="0 0 24 24"><path d="M13.107 4.558a1.377 1.377 0 0 0-2.214 0c-.381.515-1.068.7-1.656.444a1.377 1.377 0 0 0-1.916 1.106 1.38 1.38 0 0 1-1.213 1.213 1.377 1.377 0 0 0-1.106 1.916 1.38 1.38 0 0 1-.444 1.656 1.377 1.377 0 0 0 0 2.214c.515.381.7 1.068.444 1.656a1.377 1.377 0 0 0 1.106 1.917c.637.072 1.14.575 1.213 1.212a1.377 1.377 0 0 0 1.916 1.106 1.38 1.38 0 0 1 1.656.444c.55.744 1.663.744 2.214 0a1.38 1.38 0 0 1 1.656-.444 1.377 1.377 0 0 0 1.917-1.106 1.38 1.38 0 0 1 1.212-1.212 1.377 1.377 0 0 0 1.106-1.917 1.38 1.38 0 0 1 .444-1.656 1.377 1.377 0 0 0 0-2.214 1.38 1.38 0 0 1-.444-1.656 1.377 1.377 0 0 0-1.106-1.916 1.38 1.38 0 0 1-1.212-1.213 1.377 1.377 0 0 0-1.917-1.106 1.38 1.38 0 0 1-1.656-.444"/></symbol>
@@ -1 +1 @@
1
- export const SPRITE_VERSION = '0.2.34';
1
+ export const SPRITE_VERSION = '0.2.36';
package/icons/sprite.php CHANGED
@@ -21,7 +21,7 @@
21
21
  */
22
22
 
23
23
  // Replaced with the package version at build time.
24
- $GLOBALS['tangible_ui_icon_sprite_copies'][__DIR__] = '0.2.34';
24
+ $GLOBALS['tangible_ui_icon_sprite_copies'][__DIR__] = '0.2.36';
25
25
 
26
26
  if (!function_exists('tangible_ui_print_icon_sprite')) {
27
27
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangible/ui",
3
- "version": "0.2.34",
3
+ "version": "0.2.36",
4
4
  "description": "Tangible Design System",
5
5
  "type": "module",
6
6
  "main": "./components/index.js",
@@ -50,6 +50,10 @@
50
50
  "import": "./utils/color/gradient.js",
51
51
  "types": "./utils/color/gradient.d.ts"
52
52
  },
53
+ "./utils/color-scheme": {
54
+ "import": "./utils/color-scheme.js",
55
+ "types": "./utils/color-scheme.d.ts"
56
+ },
53
57
  "./icons": {
54
58
  "import": "./icons/registry.js",
55
59
  "types": "./icons/registry.d.ts"
@@ -145,6 +145,27 @@ is actually applied to the document — a `MutationObserver` on `<html>`'s `clas
145
145
  explicit toggles and OS changes alike — and mirror it onto your wrapper. Resolve to explicit
146
146
  `light`/`dark` rather than TUI's `auto`, or an explicit light choice on a dark OS will be wrong.
147
147
 
148
+ **Switch themes instantly.** Controls transition their colours for hover, so a bare `data-theme`
149
+ change makes every button and field fade into the new theme while the page behind snaps. All of
150
+ these come from `@tangible/ui`:
151
+
152
+ - **React renders `data-theme`** (the usual app shape): call `markThemeSwitch()` in the handler,
153
+ before the state change — `onCheckedChange={(dark) => { markThemeSwitch(); setDark(dark); }}`.
154
+ It puts `data-tui-theme-switching` on `<html>` until two frames later, which zeroes
155
+ `--tui-motion-duration` while React commits.
156
+ - **Nothing else owns the attribute**: `setColorScheme(scheme, root)` / `toggleColorScheme(root)`
157
+ write `data-theme` on `root` and mark the switch for you.
158
+ - **A mirror** (the Tailwind `MutationObserver` above) calls `markThemeSwitch()` before it writes.
159
+ Setting the marker by hand: put it on `<html>` or `<body>`, never the interface, which misses the
160
+ body-level portal root.
161
+
162
+ An OS change under `auto` still fades: measured in Chromium, a `matchMedia` listener fires after
163
+ the restyle. Spinners keep spinning; looping animations deliberately ignore the marker.
164
+
165
+ The toggle itself: a `Switch` with a stable name ("Dark mode"), not a button whose label flips and
166
+ also carries `aria-pressed` (it announces twice). Light / dark / system is a `SegmentedControl`,
167
+ not a cycling button. Keep focus on the control, and don't toast "Theme changed".
168
+
148
169
  **4. Pick the stylesheet by host.**
149
170
 
150
171
  - Host with **its own CSS layers** (Tailwind v4, or any `@layer` author): `@tangible/ui/styles/unlayered`.
@@ -684,6 +705,13 @@ One live trap there: **memoize `data`, or pass `autoResetPageIndex={false}`.** A
684
705
  a new identity every render, TanStack queues a page-0 reset on every `data` identity change, and
685
706
  with a controlled `pageIndex` that races your parent back to page 0 permanently.
686
707
 
708
+ And one in layout: **a DataTable inside a wrapper that can't shrink never scrolls.** A grid or
709
+ flex item that is not itself a scroll container (a Card, a `<section>`) keeps `min-width: auto`,
710
+ so it can't shrink below the table's width, and the page widens instead. That holds for an `auto`
711
+ track and a bare `1fr` track alike. Use `grid-template-columns: minmax(0, 1fr)`, or put
712
+ `min-width: 0` on the item. A DataTable placed directly in the track is fine: its root is the
713
+ scroll container.
714
+
687
715
  ## Vanilla modal (no React)
688
716
 
689
717
  For templates and plugin PHP with no React build (Tangible Blocks, L&L): `@tangible/ui` ships a framework-free modal on the native `<dialog>`. It replaces MicroModal; there is no compat layer, so the markup differs.