@tangible/ui 0.2.45 → 0.2.47

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 (38) hide show
  1. package/components/PasswordInput/PasswordInput.d.ts +7 -0
  2. package/components/PasswordInput/PasswordInput.js +64 -0
  3. package/components/PasswordInput/index.d.ts +3 -0
  4. package/components/PasswordInput/index.js +2 -0
  5. package/components/PasswordInput/types.d.ts +45 -0
  6. package/components/PasswordInput/types.js +6 -0
  7. package/components/PasswordStrength/PasswordStrength.d.ts +7 -0
  8. package/components/PasswordStrength/PasswordStrength.js +73 -0
  9. package/components/PasswordStrength/index.d.ts +3 -0
  10. package/components/PasswordStrength/index.js +2 -0
  11. package/components/PasswordStrength/types.d.ts +36 -0
  12. package/components/PasswordStrength/types.js +4 -0
  13. package/components/SecretInput/SecretInput.js +10 -33
  14. package/components/index.d.ts +4 -0
  15. package/components/index.js +2 -0
  16. package/figma-tokens.json +1 -1
  17. package/icons/icons.svg +1 -1
  18. package/icons/sprite-version.js +1 -1
  19. package/icons/sprite.php +1 -1
  20. package/package.json +9 -1
  21. package/skills/building-with-tui/SKILL.md +11 -3
  22. package/styles/all.css +1 -1
  23. package/styles/all.expanded.css +108 -0
  24. package/styles/all.expanded.unlayered.css +108 -0
  25. package/styles/all.unlayered.css +1 -1
  26. package/styles/components/_bundle.scss +7 -1
  27. package/styles/components/password-input.scss +24 -0
  28. package/styles/components/password-strength.scss +95 -0
  29. package/styles/components/secret-input.scss +1 -65
  30. package/styles/system/_reveal.scss +82 -0
  31. package/styles/system/index.scss +1 -0
  32. package/tui-manifest.json +161 -2
  33. package/utils/reveal/RevealToggle.d.ts +32 -0
  34. package/utils/reveal/RevealToggle.js +57 -0
  35. package/utils/reveal/index.d.ts +3 -0
  36. package/utils/reveal/index.js +4 -0
  37. package/utils/reveal/useReveal.d.ts +26 -0
  38. package/utils/reveal/useReveal.js +55 -0
@@ -0,0 +1,7 @@
1
+ export declare const PasswordInput: import("react").ForwardRefExoticComponent<Omit<import("..").TextInputProps, "type" | "autoCapitalize" | "spellCheck" | "prefix" | "autoCorrect" | "autoComplete" | "suffix"> & {
2
+ purpose: import("./types").PasswordInputPurpose;
3
+ revealed?: boolean;
4
+ defaultRevealed?: boolean;
5
+ onRevealChange?: (revealed: boolean) => void;
6
+ labels?: import("./types").PasswordInputLabels;
7
+ } & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useRef } from 'react';
3
+ import { cx } from '../../utils/cx.js';
4
+ import { composeRefs } from '../../utils/compose-refs.js';
5
+ import { TextInput } from '../TextInput/index.js';
6
+ import { RevealToggle, useReveal } from '../../utils/reveal/index.js';
7
+ import { defaultPasswordInputLabels } from './types.js';
8
+ // =============================================================================
9
+ // PasswordInput Component
10
+ // =============================================================================
11
+ //
12
+ // TextInput variant for a password someone signs in with or chooses: masked,
13
+ // with a show/hide toggle. Its sibling SecretInput is for stored secrets (API
14
+ // keys) and does the opposite with password managers, keeping them out; this
15
+ // one is built to let them in.
16
+ //
17
+ // - `purpose` sets autocomplete (current-password / new-password), so managers
18
+ // fill a saved password or offer to generate one.
19
+ // - Shown as text, it must not be autocorrected, capitalised or spellchecked:
20
+ // those would change what's typed, and a cloud spellchecker would send it
21
+ // off the page. So those three are set after the consumer's props.
22
+ // - A native submit masks it again, quietly, so a password left showing isn't
23
+ // saved as plain text in a browser's form history. A submit the app cancels
24
+ // (preventDefault) leaves it as it is.
25
+ // - The reveal toggle is shared with SecretInput (src/utils/reveal and the
26
+ // system reveal-button mixin), so the two can't drift.
27
+ //
28
+ // =============================================================================
29
+ export const PasswordInput = forwardRef(function PasswordInput({ purpose, revealed: revealedProp, defaultRevealed, onRevealChange, labels, className, inputClassName, disabled, ...rest }, forwardedRef) {
30
+ const text = { ...defaultPasswordInputLabels, ...labels };
31
+ const inputRef = useRef(null);
32
+ const { revealed, setRevealed, announcement } = useReveal({
33
+ revealed: revealedProp,
34
+ defaultRevealed,
35
+ onRevealChange,
36
+ shown: text.shown,
37
+ hidden: text.hidden,
38
+ });
39
+ // Re-mask when the form really submits. Listened for on the document in
40
+ // the bubble phase, so it runs after React's own handlers and can see
41
+ // whether one cancelled the submit: an app that handles sign-in itself
42
+ // (preventDefault) keeps the password showing, so a failed attempt can be
43
+ // checked for a typo. A native submit masks it first, so the browser never
44
+ // stores it as plain text in form history. Matched to the field's form at
45
+ // the time, so it holds if the field mounts before its form. The ref keeps
46
+ // the latest setter without re-adding the listener on every toggle.
47
+ const remask = useRef(() => { });
48
+ remask.current = () => setRevealed(false, { announce: false });
49
+ useEffect(() => {
50
+ const doc = inputRef.current?.ownerDocument;
51
+ if (!doc)
52
+ return;
53
+ const onSubmit = (event) => {
54
+ if (!event.defaultPrevented && event.target === inputRef.current?.form)
55
+ remask.current();
56
+ };
57
+ doc.addEventListener('submit', onSubmit);
58
+ return () => doc.removeEventListener('submit', onSubmit);
59
+ }, []);
60
+ return (_jsx(TextInput, { ...rest, ref: composeRefs(forwardedRef, inputRef), type: revealed ? 'text' : 'password', autoComplete: purpose === 'new' ? 'new-password' : 'current-password', spellCheck: false, autoCapitalize: "off", autoCorrect: "off", disabled: disabled, className: cx('tui-password-input', className),
61
+ // tui-input-reset strips Edge's own ::-ms-reveal eye, which would sit
62
+ // beside our toggle and unmask the field without changing `type`.
63
+ inputClassName: cx('tui-input-reset', 'tui-password-input__input', inputClassName), suffix: _jsx(RevealToggle, { revealed: revealed, onToggle: () => setRevealed(!revealed), revealLabel: text.reveal, hideLabel: text.hide, announcement: announcement, disabled: disabled, className: "tui-password-input__reveal", inputRef: inputRef, rootClassName: "tui-password-input" }) }));
64
+ });
@@ -0,0 +1,3 @@
1
+ export { PasswordInput } from './PasswordInput';
2
+ export { defaultPasswordInputLabels } from './types';
3
+ export type { PasswordInputProps, PasswordInputLabels, PasswordInputPurpose } from './types';
@@ -0,0 +1,2 @@
1
+ export { PasswordInput } from './PasswordInput.js';
2
+ export { defaultPasswordInputLabels } from './types.js';
@@ -0,0 +1,45 @@
1
+ import type { TextInputProps } from '../TextInput/types';
2
+ /**
3
+ * What the password is for. It sets `autocomplete`, which is how browsers and
4
+ * password managers know to fill a saved password (`current`) or offer to
5
+ * generate and save a new one (`new`). A wrong value fails silently, so it's
6
+ * a required prop rather than a default.
7
+ */
8
+ export type PasswordInputPurpose = 'current' | 'new';
9
+ /** Overridable strings, for i18n and for naming a second field on a page. */
10
+ export type PasswordInputLabels = {
11
+ /**
12
+ * The reveal toggle's name while the password is masked. Two password
13
+ * fields on one page need different names ("Show new password"): override
14
+ * all four strings together, so the announcements name the field too.
15
+ * @default "Show password"
16
+ */
17
+ reveal?: string;
18
+ /** @default "Hide password" */
19
+ hide?: string;
20
+ /** Announced when the password is shown. @default "Password shown." */
21
+ shown?: string;
22
+ /** Announced when it's masked again. @default "Password hidden." */
23
+ hidden?: string;
24
+ };
25
+ export declare const defaultPasswordInputLabels: Required<PasswordInputLabels>;
26
+ /**
27
+ * `autoComplete` comes from `purpose`; `spellCheck`, `autoCapitalize` and
28
+ * `autoCorrect` are always off (shown as text, they'd change or send the
29
+ * password), so none of the four is a prop.
30
+ */
31
+ export type PasswordInputProps = Omit<TextInputProps, 'type' | 'prefix' | 'suffix' | 'autoComplete' | 'spellCheck' | 'autoCapitalize' | 'autoCorrect'> & {
32
+ /**
33
+ * `current` to sign in or confirm who you are; `new` to choose a password
34
+ * (sign up, reset, change). Sets `autocomplete` to `current-password` or
35
+ * `new-password`.
36
+ */
37
+ purpose: PasswordInputPurpose;
38
+ /** Controlled: whether the password shows as text */
39
+ revealed?: boolean;
40
+ /** Uncontrolled: start shown. @default false */
41
+ defaultRevealed?: boolean;
42
+ /** Fires on the toggle, and with `false` when a native submit re-masks the field */
43
+ onRevealChange?: (revealed: boolean) => void;
44
+ labels?: PasswordInputLabels;
45
+ };
@@ -0,0 +1,6 @@
1
+ export const defaultPasswordInputLabels = {
2
+ reveal: 'Show password',
3
+ hide: 'Hide password',
4
+ shown: 'Password shown.',
5
+ hidden: 'Password hidden.',
6
+ };
@@ -0,0 +1,7 @@
1
+ import type { PasswordStrengthScore } from './types';
2
+ export declare const PasswordStrength: import("react").ForwardRefExoticComponent<Omit<import("react").HTMLAttributes<HTMLDivElement>, "children"> & {
3
+ score?: PasswordStrengthScore;
4
+ feedback?: string;
5
+ labels?: import("./types").PasswordStrengthLabels;
6
+ announce?: boolean;
7
+ } & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useRef, useState } from 'react';
3
+ import { cx } from '../../utils/cx.js';
4
+ import { defaultPasswordStrengthLabels } from './types.js';
5
+ // =============================================================================
6
+ // PasswordStrength Component
7
+ // =============================================================================
8
+ //
9
+ // A meter for a new password: four bars and the score in words, with an
10
+ // optional hint. Display only: the app supplies the score (zxcvbn-ts or a
11
+ // server check), and it advises, it doesn't gate. The password rule stays
12
+ // the field's validation.
13
+ //
14
+ // - The bars are decoration (aria-hidden); the words carry the meaning, so
15
+ // it never relies on colour.
16
+ // - Link it to the field: give it an `id` and pass that as the input's
17
+ // `aria-describedby` (Field.Control merges it with help and errors), so
18
+ // the score is read whenever the field is focused.
19
+ // - A polite live region says the score a second after it settles on a new
20
+ // value, never on every keystroke. Only the score: the hint is read with
21
+ // the field. The region sits beside the element `id` names, never inside
22
+ // it, or the field's description would read the score twice.
23
+ // - Render it from the first paint, score or not: a live region inserted
24
+ // together with its text may not be announced.
25
+ //
26
+ // =============================================================================
27
+ /** How long a new score must hold before it's announced */
28
+ const ANNOUNCE_AFTER_MS = 1000;
29
+ /** Bars lit per score: something typed always lights one */
30
+ const BARS = 4;
31
+ const lit = (score) => Math.max(1, score);
32
+ /** Anything but a whole number from 0 to 4 (null, NaN, 7) is no score */
33
+ const validScore = (score) => typeof score === 'number' && Number.isInteger(score) && score >= 0 && score <= 4
34
+ ? score
35
+ : undefined;
36
+ /** How long an announcement stays before it's cleared, as Toast's announcers do */
37
+ const CLEAR_AFTER_MS = 3000;
38
+ export const PasswordStrength = forwardRef(function PasswordStrength({ score: scoreProp, feedback, labels, announce = true, className, ...rest }, ref) {
39
+ const score = validScore(scoreProp);
40
+ // Per key, so a label passed as undefined (a missing translation) falls back
41
+ const text = {
42
+ label: labels?.label ?? defaultPasswordStrengthLabels.label,
43
+ scores: labels?.scores ?? defaultPasswordStrengthLabels.scores,
44
+ };
45
+ const scoreText = score === undefined ? undefined : text.scores[score];
46
+ // Announce a changed score once it has held for a second
47
+ const [spoken, setSpoken] = useState('');
48
+ const lastSpoken = useRef(undefined);
49
+ useEffect(() => {
50
+ if (!announce)
51
+ return;
52
+ if (scoreText === lastSpoken.current)
53
+ return;
54
+ // The old score is wrong now: clear it at once (silently), so nobody
55
+ // reading the region finds it in the meantime
56
+ lastSpoken.current = undefined;
57
+ setSpoken('');
58
+ if (scoreText === undefined)
59
+ return;
60
+ let clear;
61
+ const timer = setTimeout(() => {
62
+ lastSpoken.current = scoreText;
63
+ setSpoken(`${text.label}: ${scoreText}`);
64
+ // Then clear it, so browse mode doesn't come across a stale score
65
+ clear = setTimeout(() => setSpoken(''), CLEAR_AFTER_MS);
66
+ }, ANNOUNCE_AFTER_MS);
67
+ return () => {
68
+ clearTimeout(timer);
69
+ clearTimeout(clear);
70
+ };
71
+ }, [announce, scoreText, text.label]);
72
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { ...rest, ref: ref, className: cx('tui-password-strength', className), "data-score": score, children: [_jsx("div", { className: "tui-password-strength__bars", "aria-hidden": "true", children: Array.from({ length: BARS }, (_, i) => (_jsx("span", { className: "tui-password-strength__bar", "data-lit": score !== undefined && i < lit(score) ? 'true' : undefined }, i))) }), scoreText !== undefined && (_jsxs("p", { className: "tui-password-strength__text", children: [_jsxs("span", { className: "tui-password-strength__label", children: [text.label, ":"] }), ' ', _jsxs("span", { className: "tui-password-strength__score", children: [scoreText, "."] }), feedback && (_jsxs(_Fragment, { children: [' ', _jsx("span", { className: "tui-password-strength__feedback", children: feedback })] }))] }))] }), announce && (_jsx("span", { role: "status", className: "tui-visually-hidden", children: spoken }))] }));
73
+ });
@@ -0,0 +1,3 @@
1
+ export { PasswordStrength } from './PasswordStrength';
2
+ export { defaultPasswordStrengthLabels } from './types';
3
+ export type { PasswordStrengthProps, PasswordStrengthLabels, PasswordStrengthScore } from './types';
@@ -0,0 +1,2 @@
1
+ export { PasswordStrength } from './PasswordStrength.js';
2
+ export { defaultPasswordStrengthLabels } from './types.js';
@@ -0,0 +1,36 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ /**
3
+ * How hard the password is to guess, 0 to 4: the scale zxcvbn and its ports
4
+ * return, so a score from one can be passed straight in. TUI doesn't estimate
5
+ * it: a meter that counts character types praises `Password1!` and marks down
6
+ * a long passphrase.
7
+ */
8
+ export type PasswordStrengthScore = 0 | 1 | 2 | 3 | 4;
9
+ export type PasswordStrengthLabels = {
10
+ /** Names the meter, before the score. @default "Password strength" */
11
+ label?: string;
12
+ /** One per score, 0 to 4. @default ["Very weak", "Weak", "Fair", "Strong", "Very strong"] */
13
+ scores?: readonly [string, string, string, string, string];
14
+ };
15
+ export declare const defaultPasswordStrengthLabels: Required<PasswordStrengthLabels>;
16
+ /** Rest props land on the meter (bars and words), the element `id` names for `aria-describedby` */
17
+ export type PasswordStrengthProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
18
+ /**
19
+ * The estimate, 0 to 4. Leave it out while the field is empty, or while an
20
+ * estimator is still loading: the meter then shows no score and says
21
+ * nothing. Anything but a whole number from 0 to 4 counts as no score.
22
+ */
23
+ score?: PasswordStrengthScore;
24
+ /** What would make it stronger: "Add another word or two." */
25
+ feedback?: string;
26
+ labels?: PasswordStrengthLabels;
27
+ /**
28
+ * Say the score through a polite live region a second after it settles on
29
+ * a new value. Only the score: the hint is read with the field. Off, both
30
+ * are still read with the field, through `aria-describedby` on the input.
31
+ * Render the meter from the first paint, even with no score, so the region
32
+ * exists before it has anything to say.
33
+ * @default true
34
+ */
35
+ announce?: boolean;
36
+ };
@@ -0,0 +1,4 @@
1
+ export const defaultPasswordStrengthLabels = {
2
+ label: 'Password strength',
3
+ scores: ['Very weak', 'Weak', 'Fair', 'Strong', 'Very strong'],
4
+ };
@@ -6,7 +6,8 @@ import { isDev } from '../../utils/is-dev.js';
6
6
  import { Icon } from '../Icon/index.js';
7
7
  import { TextInput } from '../TextInput/index.js';
8
8
  import { defaultSecretInputLabels } from './types.js';
9
- import { LockSmall as LockSmallIcon, View as ViewIcon, ViewOff as ViewOffIcon } from '../../icons/system/index.js';
9
+ import { RevealToggle, useReveal } from '../../utils/reveal/index.js';
10
+ import { LockSmall as LockSmallIcon } from '../../icons/system/index.js';
10
11
  // =============================================================================
11
12
  // SecretInput Component
12
13
  // =============================================================================
@@ -29,11 +30,13 @@ export const SecretInput = forwardRef(function SecretInput({ isSet = false, reve
29
30
  // none of them is assembled from fragments.
30
31
  const text = { ...defaultSecretInputLabels, ...labels };
31
32
  const inputRef = useRef(null);
32
- const [revealedState, setRevealedState] = useState(defaultRevealed);
33
- // Locked in at mount, like the rest of the family: a component that flips
34
- // between controlled and uncontrolled mid-life pollutes its own state.
35
- const [isRevealControlled] = useState(revealedProp !== undefined);
36
- const revealed = isRevealControlled ? !!revealedProp : revealedState;
33
+ const { revealed, setRevealed, announcement } = useReveal({
34
+ revealed: revealedProp,
35
+ defaultRevealed,
36
+ onRevealChange,
37
+ shown: text.shown,
38
+ hidden: text.hidden,
39
+ });
37
40
  const [isValueControlled] = useState(value !== undefined);
38
41
  // Emptiness decides the set-state, which drives an ARIA description as well
39
42
  // as the placeholder — so a wrong answer here tells a screen-reader user
@@ -82,30 +85,6 @@ export const SecretInput = forwardRef(function SecretInput({ isSet = false, reve
82
85
  setDomHasValue(e.target.value.length > 0);
83
86
  onChange?.(e);
84
87
  };
85
- // Announced state, for the screen-reader-plus-mouse case: pointerdown is
86
- // prevented so focus stays in the field, which means the toggle is never
87
- // focused on a mouse click and neither its name nor its state is ever read.
88
- // Without this, a user flips their key into the clear in total silence.
89
- // Empty until the first toggle so nothing is announced on mount.
90
- const [announcement, setAnnouncement] = useState('');
91
- const toggleReveal = () => {
92
- const next = !revealed;
93
- if (!isRevealControlled)
94
- setRevealedState(next);
95
- setAnnouncement(next ? text.shown : text.hidden);
96
- onRevealChange?.(next);
97
- };
98
- const handleToggleClick = () => {
99
- toggleReveal();
100
- // Pointer activation leaves focus wherever it was — including on <body>
101
- // if nothing was focused, which strands the user at the top of the
102
- // document. Recover only in that case: on keyboard activation focus is
103
- // already on the button, and stealing it would break the toggle.
104
- const input = inputRef.current;
105
- const active = input?.ownerDocument.activeElement;
106
- if (input && !active?.closest('.tui-secret-input'))
107
- input.focus();
108
- };
109
88
  // The set-state treatment only makes sense while there is nothing typed —
110
89
  // once there is, the field shows what the user is entering.
111
90
  const showSetState = isSet && isEmpty;
@@ -142,7 +121,5 @@ export const SecretInput = forwardRef(function SecretInput({ isSet = false, reve
142
121
  // tui-input-reset strips native in-field chrome — here Edge's own
143
122
  // ::-ms-reveal eye, which would sit beside our toggle AND unmask the
144
123
  // field without changing `type`, so the toggle's state would be wrong.
145
- inputClassName: cx('tui-input-reset', 'tui-secret-input__input', inputClassName), suffix: _jsxs(_Fragment, { children: [describeSetState && (_jsx("span", { id: setDescId, className: "tui-visually-hidden", children: text.valueSetDescription })), locked ? (_jsxs(_Fragment, { children: [_jsx("span", { id: lockedDescId, className: "tui-visually-hidden", children: lockedMessage ?? text.locked }), _jsx(Icon, { name: LockSmallIcon, className: "tui-secret-input__lock" })] })) : (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "tui-secret-input__reveal", "aria-label": revealed ? text.hide : text.reveal, "data-revealed": revealed ? 'true' : undefined, disabled: disabled, onClick: handleToggleClick,
146
- // Keep pointerdown from stealing focus before the click fires.
147
- onPointerDown: (e) => e.preventDefault(), children: _jsx(Icon, { name: revealed ? ViewOffIcon : ViewIcon }) }), _jsx("span", { role: "status", "aria-live": "polite", className: "tui-visually-hidden", children: announcement })] }))] }) }));
124
+ inputClassName: cx('tui-input-reset', 'tui-secret-input__input', inputClassName), suffix: _jsxs(_Fragment, { children: [describeSetState && (_jsx("span", { id: setDescId, className: "tui-visually-hidden", children: text.valueSetDescription })), locked ? (_jsxs(_Fragment, { children: [_jsx("span", { id: lockedDescId, className: "tui-visually-hidden", children: lockedMessage ?? text.locked }), _jsx(Icon, { name: LockSmallIcon, className: "tui-secret-input__lock" })] })) : (_jsx(RevealToggle, { revealed: revealed, onToggle: () => setRevealed(!revealed), revealLabel: text.reveal, hideLabel: text.hide, announcement: announcement, disabled: disabled, className: "tui-secret-input__reveal", inputRef: inputRef, rootClassName: "tui-secret-input" }))] }) }));
148
125
  });
@@ -41,6 +41,8 @@ export { DataTable, BulkActionsBar, defaultDataTableLabels, defaultBulkActionsBa
41
41
  export { CommandPalette, CommandPaletteItem, CommandPaletteGroup, CommandPaletteLabel, CommandPaletteTrigger, defaultCommandPaletteLabels, } from './CommandPalette';
42
42
  export { SearchInput } from './SearchInput';
43
43
  export { SecretInput, defaultSecretInputLabels } from './SecretInput';
44
+ export { PasswordInput, defaultPasswordInputLabels } from './PasswordInput';
45
+ export { PasswordStrength, defaultPasswordStrengthLabels } from './PasswordStrength';
44
46
  export { SearchSelect, SearchSelectTrigger, SearchSelectContent, SearchSelectOption, SearchSelectGroup, SearchSelectLabel, useSearchSelect, } from './SearchSelect';
45
47
  export { Switch } from './Switch';
46
48
  export { Tabs } from './Tabs';
@@ -92,6 +94,8 @@ export type { CommandPaletteProps, CommandPaletteItemProps, CommandPaletteGroupP
92
94
  export type { SearchInputProps } from './SearchInput';
93
95
  export type { SliderProps } from './Slider';
94
96
  export type { SecretInputProps, SecretInputLabels } from './SecretInput';
97
+ export type { PasswordInputProps, PasswordInputLabels, PasswordInputPurpose } from './PasswordInput';
98
+ export type { PasswordStrengthProps, PasswordStrengthLabels, PasswordStrengthScore } from './PasswordStrength';
95
99
  export type { SearchSelectProps, SearchSelectTriggerProps, SearchSelectContentProps, SearchSelectOptionProps, SearchSelectGroupProps, SearchSelectLabelProps, SearchSelectLabels, } from './SearchSelect';
96
100
  export type { SwitchProps } from './Switch';
97
101
  export type { TextareaProps, TextareaResize } from './Textarea';
@@ -39,6 +39,8 @@ export { DataTable, BulkActionsBar, defaultDataTableLabels, defaultBulkActionsBa
39
39
  export { CommandPalette, CommandPaletteItem, CommandPaletteGroup, CommandPaletteLabel, CommandPaletteTrigger, defaultCommandPaletteLabels, } from './CommandPalette/index.js';
40
40
  export { SearchInput } from './SearchInput/index.js';
41
41
  export { SecretInput, defaultSecretInputLabels } from './SecretInput/index.js';
42
+ export { PasswordInput, defaultPasswordInputLabels } from './PasswordInput/index.js';
43
+ export { PasswordStrength, defaultPasswordStrengthLabels } from './PasswordStrength/index.js';
42
44
  export { SearchSelect, SearchSelectTrigger, SearchSelectContent, SearchSelectOption, SearchSelectGroup, SearchSelectLabel, useSearchSelect, } from './SearchSelect/index.js';
43
45
  export { Switch } from './Switch/index.js';
44
46
  export { Tabs } from './Tabs/index.js';
package/figma-tokens.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.45",
2
+ "version": "0.2.47",
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.",
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.45" 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.47" 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.45';
1
+ export const SPRITE_VERSION = '0.2.47';
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.45';
24
+ $GLOBALS['tangible_ui_icon_sprite_copies'][__DIR__] = '0.2.47';
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.45",
3
+ "version": "0.2.47",
4
4
  "description": "React design system for Tangible's products: standalone React apps and WordPress plugins. Components, CSS custom property tokens, cascade layers.",
5
5
  "type": "module",
6
6
  "main": "./components/index.js",
@@ -188,6 +188,14 @@
188
188
  "import": "./components/Pager/index.js",
189
189
  "types": "./components/Pager/index.d.ts"
190
190
  },
191
+ "./components/PasswordInput": {
192
+ "import": "./components/PasswordInput/index.js",
193
+ "types": "./components/PasswordInput/index.d.ts"
194
+ },
195
+ "./components/PasswordStrength": {
196
+ "import": "./components/PasswordStrength/index.js",
197
+ "types": "./components/PasswordStrength/index.d.ts"
198
+ },
191
199
  "./components/Popover": {
192
200
  "import": "./components/Popover/index.js",
193
201
  "types": "./components/Popover/index.d.ts"
@@ -737,9 +737,17 @@ together (same blue). `showLabels={false}` leaves sighted users with color alone
737
737
  numbers elsewhere; `showPercent` replaces counts for screen readers too. Don't re-point
738
738
  `--tui-progress-zN-fill` per position and pass a legend as children: plain `segments` without
739
739
  `breakdown` stay cumulative ("Pending 100%").
740
- **Password / API key / token field → `SecretInput`** (a `TextInput` variant: masked, with a reveal
741
- toggle whose name flips Show/Hide; `isSet` is a boolean so a stored secret never reaches the client,
742
- it shows a "Saved" placeholder and typing replaces it; `locked` makes it read-only with no toggle). No Breadcrumb, no Skeleton, and no *standalone* time picker — but
740
+ **Sign-in or new password → `PasswordInput`** (a `TextInput` variant: masked, with a reveal toggle
741
+ named "Show password"; `purpose: 'current' | 'new'` is required and sets `autocomplete`, so password
742
+ managers fill or generate it; never autocorrected or spellchecked when shown; a native submit masks
743
+ it again, an app-handled one leaves it; for a second field on a page override all four `labels`,
744
+ "Show new password" / "New password shown."). **API key / token
745
+ field → `SecretInput`** (masked, with the same toggle, but it keeps password managers out; `isSet`
746
+ is a boolean so a stored secret never reaches the client, it shows a "Saved" placeholder and typing
747
+ replaces it; `locked` makes it read-only with no toggle). Don't use one for the other: SecretInput on
748
+ a login stops managers filling it. **Password strength → `PasswordStrength`** under the field (display only: pass a 0–4
749
+ `score` from zxcvbn-ts or a server check, never a character-type count; link it with the input's
750
+ `aria-describedby`; it advises, the length rule still validates). No Breadcrumb, no Skeleton, and no *standalone* time picker — but
743
751
  `DatePicker` / `DateRangePicker` take `withTime` for an hour/minute field (12- or 24-hour via
744
752
  `hour12`) plus a display-only `zoneLabel`; the value is a plain `Date` with wall-clock semantics,
745
753
  so timezone interpretation stays yours. A range with a start and no end (a membership, a