@seanyeh77/ui 0.46.0 → 0.47.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 (64) hide show
  1. package/dist/bundle.js +16 -16
  2. package/dist/components/Badge/Badge.d.ts +4 -4
  3. package/dist/components/Badge/Badge.js +7 -1
  4. package/dist/components/Badge/Badge.js.map +1 -1
  5. package/dist/components/Breadcrumb/Breadcrumb.js +1 -0
  6. package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
  7. package/dist/components/DataTable/DataTable.js +12 -3
  8. package/dist/components/DataTable/DataTable.js.map +1 -1
  9. package/dist/components/EmptyState/EmptyState.js +19 -1
  10. package/dist/components/EmptyState/EmptyState.js.map +1 -1
  11. package/dist/components/InlineCode/InlineCode.js +1 -1
  12. package/dist/components/InlineCode/InlineCode.js.map +1 -1
  13. package/dist/components/KpiCard/KpiCard.d.ts +2 -2
  14. package/dist/components/KpiCard/KpiCard.js +1 -1
  15. package/dist/components/KpiCard/KpiCard.js.map +1 -1
  16. package/dist/components/LayerGraph/LayerGraph.js +5 -5
  17. package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
  18. package/dist/components/MultiSelect/MultiSelect.js +1 -0
  19. package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
  20. package/dist/components/SettingsLayout/SettingsLayout.js +3 -1
  21. package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
  22. package/dist/components/TextField/TextField.d.ts +8 -2
  23. package/dist/components/TextField/TextField.js +59 -13
  24. package/dist/components/TextField/TextField.js.map +1 -1
  25. package/dist/css/Alert.css +9 -1
  26. package/dist/css/DataTable.css +27 -2
  27. package/dist/css/EmptyState.css +4 -4
  28. package/dist/css/EventTimeline.css +3 -1
  29. package/dist/css/LayerGraph.css +1 -1
  30. package/dist/css/LoadingBar.css +4 -1
  31. package/dist/css/MobileTabBar.css +6 -4
  32. package/dist/css/SettingsLayout.css +1 -0
  33. package/dist/css/Tabs.css +15 -2
  34. package/dist/css/base.css +86 -3
  35. package/dist/css/end.css +3 -1
  36. package/dist/i18n.js +1 -0
  37. package/dist/i18n.js.map +1 -1
  38. package/dist/icons/Icon.d.ts +2 -1
  39. package/dist/icons/Icon.js +4 -3
  40. package/dist/icons/Icon.js.map +1 -1
  41. package/dist/icons/store.d.ts +3 -1
  42. package/dist/icons/store.js +17 -12
  43. package/dist/icons/store.js.map +1 -1
  44. package/dist/index.d.ts +2 -2
  45. package/dist/index.js +2 -2
  46. package/dist/internal/util.js +4 -3
  47. package/dist/internal/util.js.map +1 -1
  48. package/dist/styles.css +248 -109
  49. package/dist/theme.d.ts +7 -0
  50. package/dist/theme.js +39 -15
  51. package/dist/theme.js.map +1 -1
  52. package/docs/Badge.md +2 -1
  53. package/docs/EmptyState.md +1 -1
  54. package/docs/EventTimeline.md +1 -1
  55. package/docs/Graph.md +1 -1
  56. package/docs/KpiCard.md +1 -1
  57. package/docs/LoadingBar.md +1 -1
  58. package/docs/MobileTabBar.md +1 -1
  59. package/docs/MultiSelect.md +1 -1
  60. package/docs/Tabs.md +10 -9
  61. package/docs/TextField.md +2 -0
  62. package/docs/agents.md +6 -6
  63. package/docs/theme.md +5 -2
  64. package/package.json +2 -2
@@ -119,6 +119,7 @@ function MultiSelect({ label, hideLabel, hint, error, required, disabled, name,
119
119
  error ? /* @__PURE__ */ jsx(FieldErrorIcon, { inline: true }) : null,
120
120
  value.length > 1 && !disabled ? /* @__PURE__ */ jsx(Combobox.Clear, {
121
121
  className: "ui-ms-clear",
122
+ tabIndex: 0,
122
123
  "aria-label": tr("清除{name}", { name: label }),
123
124
  children: /* @__PURE__ */ jsx(Icon, {
124
125
  name: "x",
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.js","names":["phX"],"sources":["../../../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Combobox } from '@base-ui/react/combobox';\nimport { announce } from '../../announce';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { CheckMark, FieldErrorIcon, FieldLabel, FieldMessage, type FieldProps } from '../../internal/Field';\nimport { includeIcons } from '../../icons/store';\nimport phX from '../../icons/ph/x';\n\nincludeIcons(phX);\n\nexport interface MultiSelectOption {\n value: string;\n label: string;\n}\n\nexport interface MultiSelectProps extends FieldProps {\n /** The options, each { value, label }. */\n options: MultiSelectOption[];\n /** The chosen values, in the order they were picked. */\n value: string[];\n /** Receives every chosen value after a change. */\n onChange: (value: string[]) => void;\n /** Allow adding values that are not in options (Enter, or the 「新增」 row). */\n creatable?: boolean;\n /** Chips shown before 「+n」. Default 2. */\n maxChips?: number;\n /** Default 「搜尋」. */\n placeholder?: string;\n /** Default 「找不到符合的選項」. */\n emptyText?: string;\n /** Extra class on the root element. */\n className?: string;\n}\n\nconst CREATE = '\\u0000create:';\n\n/** Pick several options: chips inside the field, type to filter, Backspace removes the last chip. */\nexport function MultiSelect({\n label,\n hideLabel,\n hint,\n error,\n required,\n disabled,\n name,\n options,\n value,\n onChange,\n creatable,\n maxChips = 2,\n placeholder,\n emptyText,\n className,\n}: MultiSelectProps) {\n const id = React.useId();\n const [query, setQuery] = React.useState('');\n // Whether the list is shown: Esc closes it then, and otherwise is left to the page (a Drawer or Dialog around it).\n const [open, setOpen] = React.useState(false);\n // Removing is said aloud: a chip's ×, Backspace or 清除.\n const change = (next: string[]) => {\n const gone = value.filter((v) => !next.includes(v));\n if (!next.length && gone.length > 1) announce(tr('已清除{name}', { name: label }));\n else if (gone.length === 1 && next.length === value.length - 1) announce(tr('已移除 {name}', { name: labelOf(gone[0]) }));\n onChange(next);\n };\n const labels = React.useMemo(() => new Map(options.map((o) => [o.value, o.label])), [options]);\n const labelOf = (v: string) => (v.startsWith(CREATE) ? tr('新增「{q}」', { q: v.slice(CREATE.length) }) : (labels.get(v) ?? v));\n const q = query.trim();\n const exists = options.some((o) => o.label === q) || value.includes(q);\n const items = [...options.map((o) => o.value), ...value.filter((v) => !labels.has(v)), ...(creatable && q && !exists ? [CREATE + q] : [])];\n const shown = value.slice(0, maxChips);\n const more = value.length - shown.length;\n return (\n <div className={cx('ui-field', error && 'has-error', disabled && 'is-disabled', className)}>\n <FieldLabel htmlFor={id} id={id + '-label'} required={required} hidden={hideLabel}>\n {label}\n </FieldLabel>\n <Combobox.Root\n multiple\n name={name}\n disabled={disabled}\n required={required}\n autoHighlight\n items={items}\n value={value}\n inputValue={query}\n onInputValueChange={setQuery}\n onOpenChange={setOpen}\n itemToStringLabel={labelOf}\n onValueChange={(next: string[]) => {\n change(next.map((v) => (v.startsWith(CREATE) ? v.slice(CREATE.length) : v)));\n setQuery('');\n }}\n >\n <Combobox.InputGroup className={cx('ui-ms', error && 'is-invalid')}>\n <Combobox.Chips className=\"ui-ms-chips\">\n {shown.map((v) => (\n <Combobox.Chip key={v} className=\"ui-chip\" aria-label={labelOf(v)}>\n {labelOf(v)}\n <Combobox.ChipRemove className=\"ui-chip-x\" aria-label={tr('移除 {name}', { name: labelOf(v) })}>\n <Icon name=\"x\" size={12} />\n </Combobox.ChipRemove>\n </Combobox.Chip>\n ))}\n {more > 0 ? (\n // Seen as 「+3」; read as 「另外 3 個:…」 with the names the chips leave out.\n <span className=\"ui-chip-more\" title={value.slice(maxChips).map(labelOf).join(tr('、'))}>\n <span aria-hidden=\"true\">{'+' + more}</span>\n <span className=\"ui-visually-hidden\">{tr('另外 {n} 個:{list}', { n: more, list: value.slice(maxChips).map(labelOf).join(tr('、')) })}</span>\n </span>\n ) : null}\n <Combobox.Input\n id={id}\n // Named by the label's id too: while the list is open the page around it is hidden from assistive\n // technology, and a <label for> outside no longer names the field.\n aria-labelledby={id + '-label'}\n className=\"ui-ms-input\"\n aria-invalid={error ? true : undefined}\n aria-required={required || undefined}\n aria-describedby={error || hint ? id + '-err' : undefined}\n placeholder={value.length ? '' : placeholder || tr('搜尋')}\n onKeyDown={(e) => {\n // Hidden chips (+n) still count: Backspace removes the last value, not the last visible chip.\n if (e.key === 'Backspace' && !query && value.length) {\n e.preventBaseUIHandler();\n change(value.slice(0, -1));\n }\n // Esc with the list closed: Base UI would clear every value, with no undo. It clears only the typed\n // text, if any; else it goes on to the Drawer or Dialog around the field, which closes.\n if (e.key === 'Escape' && !open) {\n e.preventBaseUIHandler();\n if (query) {\n e.stopPropagation();\n setQuery('');\n }\n }\n }}\n />\n </Combobox.Chips>\n {error ? <FieldErrorIcon inline /> : null}\n {value.length > 1 && !disabled ? (\n <Combobox.Clear className=\"ui-ms-clear\" aria-label={tr('清除{name}', { name: label })}>\n <Icon name=\"x\" size={16} />\n </Combobox.Clear>\n ) : null}\n </Combobox.InputGroup>\n <Combobox.Portal>\n <Combobox.Positioner className=\"ui-float is-match\" align=\"start\" sideOffset={6}>\n <Combobox.Popup className=\"ui-select-menu ui-ms-menu\">\n <Combobox.Empty className=\"ui-select-empty\">{emptyText || tr('找不到符合的選項')}</Combobox.Empty>\n <Combobox.List>\n {(v: string) =>\n v.startsWith(CREATE) ? (\n <Combobox.Item key={v} value={v} className=\"ui-select-opt ui-ms-create\">\n {labelOf(v)}\n </Combobox.Item>\n ) : (\n <Combobox.Item key={v} value={v} className={cx('ui-select-opt', 'ui-ms-opt', value.includes(v) && 'is-on')}>\n <span className={cx('ui-check-box', value.includes(v) && 'is-on')} aria-hidden=\"true\">\n <CheckMark v={value.includes(v)} />\n </span>\n <span>{labelOf(v)}</span>\n </Combobox.Item>\n )\n }\n </Combobox.List>\n </Combobox.Popup>\n </Combobox.Positioner>\n </Combobox.Portal>\n </Combobox.Root>\n <FieldMessage id={id + '-err'} error={error} hint={hint} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAUA,aAAaA,SAAG;AA0BhB,MAAM,SAAS;;AAGf,SAAgB,YAAY,EAC1B,OACA,WACA,MACA,OACA,UACA,UACA,MACA,SACA,OACA,UACA,WACA,WAAW,GACX,aACA,WACA,aACmB;CACnB,MAAM,KAAK,MAAM,MAAM;CACvB,MAAM,CAAC,OAAO,YAAY,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M,SAAS,CAAC,KAAK,OAAO;QAAG,eAAY;QAC7E,UAAA,oBAAC,WAAD,EAAW,GAAG,MAAM,SAAS,CAAC,EAAI,CAAA;OAC9B,CAAA,GACN,oBAAC,QAAD,EAAA,UAAO,QAAQ,CAAC,EAAQ,CAAA,CACX;MALK,GAAA,CAKL,EAGN,CAAA,CACD;;IACG,CAAA,EACN,CAAA,CACJ;;GACf,oBAAC,cAAD;IAAc,IAAI,KAAK;IAAe;IAAa;GAAO,CAAA;EACvD;;AAET"}
1
+ {"version":3,"file":"MultiSelect.js","names":["phX"],"sources":["../../../src/components/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Combobox } from '@base-ui/react/combobox';\nimport { announce } from '../../announce';\nimport { tr } from '../../i18n';\nimport { Icon } from '../../icons/Icon';\nimport { cx } from '../../internal/util';\nimport { CheckMark, FieldErrorIcon, FieldLabel, FieldMessage, type FieldProps } from '../../internal/Field';\nimport { includeIcons } from '../../icons/store';\nimport phX from '../../icons/ph/x';\n\nincludeIcons(phX);\n\nexport interface MultiSelectOption {\n value: string;\n label: string;\n}\n\nexport interface MultiSelectProps extends FieldProps {\n /** The options, each { value, label }. */\n options: MultiSelectOption[];\n /** The chosen values, in the order they were picked. */\n value: string[];\n /** Receives every chosen value after a change. */\n onChange: (value: string[]) => void;\n /** Allow adding values that are not in options (Enter, or the 「新增」 row). */\n creatable?: boolean;\n /** Chips shown before 「+n」. Default 2. */\n maxChips?: number;\n /** Default 「搜尋」. */\n placeholder?: string;\n /** Default 「找不到符合的選項」. */\n emptyText?: string;\n /** Extra class on the root element. */\n className?: string;\n}\n\nconst CREATE = '\\u0000create:';\n\n/** Pick several options: chips inside the field, type to filter, Backspace removes the last chip. */\nexport function MultiSelect({\n label,\n hideLabel,\n hint,\n error,\n required,\n disabled,\n name,\n options,\n value,\n onChange,\n creatable,\n maxChips = 2,\n placeholder,\n emptyText,\n className,\n}: MultiSelectProps) {\n const id = React.useId();\n const [query, setQuery] = React.useState('');\n // Whether the list is shown: Esc closes it then, and otherwise is left to the page (a Drawer or Dialog around it).\n const [open, setOpen] = React.useState(false);\n // Removing is said aloud: a chip's ×, Backspace or 清除.\n const change = (next: string[]) => {\n const gone = value.filter((v) => !next.includes(v));\n if (!next.length && gone.length > 1) announce(tr('已清除{name}', { name: label }));\n else if (gone.length === 1 && next.length === value.length - 1) announce(tr('已移除 {name}', { name: labelOf(gone[0]) }));\n onChange(next);\n };\n const labels = React.useMemo(() => new Map(options.map((o) => [o.value, o.label])), [options]);\n const labelOf = (v: string) => (v.startsWith(CREATE) ? tr('新增「{q}」', { q: v.slice(CREATE.length) }) : (labels.get(v) ?? v));\n const q = query.trim();\n const exists = options.some((o) => o.label === q) || value.includes(q);\n const items = [...options.map((o) => o.value), ...value.filter((v) => !labels.has(v)), ...(creatable && q && !exists ? [CREATE + q] : [])];\n const shown = value.slice(0, maxChips);\n const more = value.length - shown.length;\n return (\n <div className={cx('ui-field', error && 'has-error', disabled && 'is-disabled', className)}>\n <FieldLabel htmlFor={id} id={id + '-label'} required={required} hidden={hideLabel}>\n {label}\n </FieldLabel>\n <Combobox.Root\n multiple\n name={name}\n disabled={disabled}\n required={required}\n autoHighlight\n items={items}\n value={value}\n inputValue={query}\n onInputValueChange={setQuery}\n onOpenChange={setOpen}\n itemToStringLabel={labelOf}\n onValueChange={(next: string[]) => {\n change(next.map((v) => (v.startsWith(CREATE) ? v.slice(CREATE.length) : v)));\n setQuery('');\n }}\n >\n <Combobox.InputGroup className={cx('ui-ms', error && 'is-invalid')}>\n <Combobox.Chips className=\"ui-ms-chips\">\n {shown.map((v) => (\n <Combobox.Chip key={v} className=\"ui-chip\" aria-label={labelOf(v)}>\n {labelOf(v)}\n <Combobox.ChipRemove className=\"ui-chip-x\" aria-label={tr('移除 {name}', { name: labelOf(v) })}>\n <Icon name=\"x\" size={12} />\n </Combobox.ChipRemove>\n </Combobox.Chip>\n ))}\n {more > 0 ? (\n // Seen as 「+3」; read as 「另外 3 個:…」 with the names the chips leave out.\n <span className=\"ui-chip-more\" title={value.slice(maxChips).map(labelOf).join(tr('、'))}>\n <span aria-hidden=\"true\">{'+' + more}</span>\n <span className=\"ui-visually-hidden\">{tr('另外 {n} 個:{list}', { n: more, list: value.slice(maxChips).map(labelOf).join(tr('、')) })}</span>\n </span>\n ) : null}\n <Combobox.Input\n id={id}\n // Named by the label's id too: while the list is open the page around it is hidden from assistive\n // technology, and a <label for> outside no longer names the field.\n aria-labelledby={id + '-label'}\n className=\"ui-ms-input\"\n aria-invalid={error ? true : undefined}\n aria-required={required || undefined}\n aria-describedby={error || hint ? id + '-err' : undefined}\n placeholder={value.length ? '' : placeholder || tr('搜尋')}\n onKeyDown={(e) => {\n // Hidden chips (+n) still count: Backspace removes the last value, not the last visible chip.\n if (e.key === 'Backspace' && !query && value.length) {\n e.preventBaseUIHandler();\n change(value.slice(0, -1));\n }\n // Esc with the list closed: Base UI would clear every value, with no undo. It clears only the typed\n // text, if any; else it goes on to the Drawer or Dialog around the field, which closes.\n if (e.key === 'Escape' && !open) {\n e.preventBaseUIHandler();\n if (query) {\n e.stopPropagation();\n setQuery('');\n }\n }\n }}\n />\n </Combobox.Chips>\n {error ? <FieldErrorIcon inline /> : null}\n {value.length > 1 && !disabled ? (\n // In the Tab order (Base UI leaves it out): the one control that clears every value from the keyboard.\n <Combobox.Clear className=\"ui-ms-clear\" tabIndex={0} aria-label={tr('清除{name}', { name: label })}>\n <Icon name=\"x\" size={16} />\n </Combobox.Clear>\n ) : null}\n </Combobox.InputGroup>\n <Combobox.Portal>\n <Combobox.Positioner className=\"ui-float is-match\" align=\"start\" sideOffset={6}>\n <Combobox.Popup className=\"ui-select-menu ui-ms-menu\">\n <Combobox.Empty className=\"ui-select-empty\">{emptyText || tr('找不到符合的選項')}</Combobox.Empty>\n <Combobox.List>\n {(v: string) =>\n v.startsWith(CREATE) ? (\n <Combobox.Item key={v} value={v} className=\"ui-select-opt ui-ms-create\">\n {labelOf(v)}\n </Combobox.Item>\n ) : (\n <Combobox.Item key={v} value={v} className={cx('ui-select-opt', 'ui-ms-opt', value.includes(v) && 'is-on')}>\n <span className={cx('ui-check-box', value.includes(v) && 'is-on')} aria-hidden=\"true\">\n <CheckMark v={value.includes(v)} />\n </span>\n <span>{labelOf(v)}</span>\n </Combobox.Item>\n )\n }\n </Combobox.List>\n </Combobox.Popup>\n </Combobox.Positioner>\n </Combobox.Portal>\n </Combobox.Root>\n <FieldMessage id={id + '-err'} error={error} hint={hint} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAUA,aAAaA,SAAG;AA0BhB,MAAM,SAAS;;AAGf,SAAgB,YAAY,EAC1B,OACA,WACA,MACA,OACA,UACA,UACA,MACA,SACA,OACA,UACA,WACA,WAAW,GACX,aACA,WACA,aACmB;CACnB,MAAM,KAAK,MAAM,MAAM;CACvB,MAAM,CAAC,OAAO,YAAY,MAAM,SAAS,EAAE;CAE3C,MAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;CAE5C,MAAM,UAAU,SAAmB;EACjC,MAAM,OAAO,MAAM,QAAQ,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC;EAClD,IAAI,CAAC,KAAK,UAAU,KAAK,SAAS,GAAG,SAAS,GAAG,aAAa,EAAE,MAAM,MAAM,CAAC,CAAC;OACzE,IAAI,KAAK,WAAW,KAAK,KAAK,WAAW,MAAM,SAAS,GAAG,SAAS,GAAG,cAAc,EAAE,MAAM,QAAQ,KAAK,EAAE,EAAE,CAAC,CAAC;EACrH,SAAS,IAAI;CACf;CACA,MAAM,SAAS,MAAM,cAAc,IAAI,IAAI,QAAQ,KAAK,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;CAC7F,MAAM,WAAW,MAAe,EAAE,WAAW,MAAM,IAAI,GAAG,WAAW,EAAE,GAAG,EAAE,MAAM,CAAa,EAAE,CAAC,IAAK,OAAO,IAAI,CAAC,KAAK;CACxH,MAAM,I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ACe;IACrB,CAAA,GAAA,oBAAC,SAAS,QAAV,EAAA,UACE,oBAAC,SAAS,YAAV;KAAqB,WAAU;KAAoB,OAAM;KAAQ,YAAY;KAC3E,UAAA,qBAAC,SAAS,OAAV;MAAgB,WAAU;MAA1B,UAAA,CACE,oBAAC,SAAS,OAAV;OAAgB,WAAU;OAAmB,UAAA,aAAa,GAAG,UAAU;MAAkB,CAAA,GACzF,oBAAC,SAAS,MAAV,EAAA,WACI,MACA,EAAE,WAAW,MAAM,IACjB,oBAAC,SAAS,MAAV;OAAuB,OAAO;OAAG,WAAU;OACxC,UAAA,QAAQ,CAAC;MACG,GAFK,CAEL,IAEf,qBAAC,SAAS,MAAV;OAAuB,OAAO;OAAG,WAAW,GAAG,iBAAiB,aAAa,MAAM,SAAS,CAAC,KAAK,OAAO;OAAzG,UAAA,CACE,oBAAC,QAAD;QAAM,WAAW,GAAG,gBAAgB,MAAM,SAAS,CAAC,KAAK,OAAO;QAAG,eAAY;QAC7E,UAAA,oBAAC,WAAD,EAAW,GAAG,MAAM,SAAS,CAAC,EAAI,CAAA;OAC9B,CAAA,GACN,oBAAC,QAAD,EAAA,UAAO,QAAQ,CAAC,EAAQ,CAAA,CACX;MALK,GAAA,CAKL,EAGN,CAAA,CACD;;IACG,CAAA,EACN,CAAA,CACJ;;GACf,oBAAC,cAAD;IAAc,IAAI,KAAK;IAAe;IAAa;GAAO,CAAA;EACvD;;AAET"}
@@ -46,7 +46,9 @@ function SettingsLayout({ title, categories, value, onChange, urlSync = true, to
46
46
  const choose = (c, said = false) => {
47
47
  if (c.id === item?.id) return;
48
48
  setOwn(c.id);
49
- if (sync && typeof window !== "undefined" && window.history?.replaceState && !hashRouted()) window.history.replaceState(window.history.state, "", location.pathname + location.search + "#settings-" + encodeURIComponent(c.id));
49
+ if (sync && typeof window !== "undefined" && window.history?.replaceState && !hashRouted()) try {
50
+ window.history.replaceState(window.history.state, "", location.pathname + location.search + "#settings-" + encodeURIComponent(c.id));
51
+ } catch {}
50
52
  if (!said) announce(c.label);
51
53
  onChange?.(c.id);
52
54
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsLayout.js","names":["toast"],"sources":["../../../src/components/SettingsLayout/SettingsLayout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport { cx, useNarrow } from '../../internal/util';\nimport { Tabs } from '../Tabs/Tabs';\nimport { Button } from '../Button/Button';\nimport { devWarn } from '../../internal/dev';\nimport { ShellTitle } from '../../internal/shell';\nimport { announce } from '../../announce';\nimport { AutoToaster, toast as showToast } from '../Toast/Toast';\nimport { codeText } from '../InlineCode/InlineCode';\n\nexport interface SettingsCategory {\n /** Also the URL hash of the category (#settings-notifications): letters, digits and hyphens. */\n id: string;\n /** The name in the category list, a noun: 「通知」. */\n label: string;\n /** SettingsSections; a DangerZone goes last in the last category. */\n content: React.ReactNode;\n}\n\nexport interface SettingsLayoutProps {\n /** The page title. Inside AppShell leave it out and give AppShell title=\"設定\": the title shows once. */\n title?: string;\n /** The categories, in order. */\n categories: SettingsCategory[];\n /** Controlled category id. */\n value?: string;\n /** Called with the category id when another category is chosen. */\n onChange?: (id: string) => void;\n /** Uncontrolled: keep the open category in the URL hash (#settings-notifications), so a reload or a shared link\n * opens it. Off by itself while the hash is a hash router's route (#/settings). Default true. */\n urlSync?: boolean;\n /** @deprecated call toast('已儲存', { id: 'saved' }) when a change is saved; AppShell shows it. Until removed: a\n * non-empty text shows through toast(), an empty one closes it. */\n toast?: string;\n /** Extra class on the root element. */\n className?: string;\n}\n\n// The hash names the category with a prefix no other part of the page uses: #settings-notifications.\nconst HASH_PREFIX = 'settings-';\n// A hash router keeps its route in the hash (#/settings): the category then stays out of it, or the route would go.\nconst hashRouted = () => typeof location !== 'undefined' && location.hash.startsWith('#/');\n\n/** A settings page: categories on the left, their sections on the right. Changes save at once. */\nexport function SettingsLayout({ title, categories, value, onChange, urlSync = true, toast, className }: SettingsLayoutProps) {\n const shell = React.useContext(ShellTitle);\n devWarn(\n toast !== undefined,\n 'SettingsLayout',\n \"toast is deprecated: call toast('已儲存', { id: 'saved' }) from @seanyeh77/ui when a change is saved. AppShell shows it above the phone tab bar; outside AppShell put one <Toaster /> on the page.\",\n );\n // The old prop, through the toast system: one toast that restarts when the text changes, closed when it is emptied.\n React.useEffect(() => {\n if (toast === undefined) return;\n if (toast) showToast(toast, { id: 'ui-settings-saved' });\n else showToast.close('ui-settings-saved');\n }, [toast]);\n devWarn(\n title && shell.title,\n 'SettingsLayout',\n 'the page title shows twice: AppShell has `title` and SettingsLayout has `title`. Inside AppShell, give the title to AppShell only.',\n );\n const sync = urlSync && value === undefined;\n const fromHash = () => {\n if (!sync || typeof location === 'undefined' || hashRouted()) return undefined;\n // #settings-notifications, and the plain #notifications of links written before the prefix.\n const raw = decodeURIComponent(location.hash.slice(1));\n const id = raw.startsWith(HASH_PREFIX) ? raw.slice(HASH_PREFIX.length) : raw;\n return categories.some((c) => c.id === id) ? id : undefined;\n };\n const [own, setOwn] = React.useState<string | undefined>(() => fromHash() ?? value ?? categories[0]?.id);\n const active = value ?? own;\n const item = categories.find((c) => c.id === active) ?? categories[0];\n // A link or the back button that changes the hash opens that category.\n React.useEffect(() => {\n if (!sync) return;\n const onHash = () => {\n const id = fromHash();\n if (id) setOwn(id);\n };\n window.addEventListener('hashchange', onHash);\n return () => window.removeEventListener('hashchange', onHash);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- categories are read when the hash changes\n }, [sync]);\n const narrow = useNarrow();\n const choose = (c: SettingsCategory, said = false) => {\n if (c.id === item?.id) return;\n setOwn(c.id);\n if (sync && typeof window !== 'undefined' && window.history?.replaceState && !hashRouted())\n window.history.replaceState(window.history.state, '', location.pathname + location.search + '#' + HASH_PREFIX + encodeURIComponent(c.id));\n // Tabs (on a phone) say the name themselves.\n if (!said) announce(c.label);\n onChange?.(c.id);\n };\n return (\n <div className={cx('ui-settings', className)}>\n {title ? <h1 className=\"ui-settings-title\">{title}</h1> : null}\n <div className=\"ui-settings-body\">\n {narrow ? (\n // On a phone: the same Tabs as everywhere else (a row that scrolls sideways when the names do not fit).\n <Tabs\n className=\"ui-settings-tabs\"\n label={tr('設定分類')}\n items={categories.map((c) => ({ id: c.id, label: c.label }))}\n value={item?.id ?? ''}\n onChange={(id) => {\n const c = categories.find((x) => x.id === id);\n if (c) choose(c, true);\n }}\n />\n ) : (\n <nav className=\"ui-settings-nav\" aria-label={tr('設定分類')}>\n {categories.map((c) => {\n const on = c.id === item?.id;\n return (\n <button\n key={c.id}\n type=\"button\"\n className={cx('ui-settings-cat', on && 'is-on')}\n aria-current={on ? 'page' : undefined}\n onClick={() => choose(c)}\n >\n {c.label}\n </button>\n );\n })}\n </nav>\n )}\n <div className=\"ui-settings-content\">{item?.content}</div>\n </div>\n {toast !== undefined ? <AutoToaster /> : null}\n </div>\n );\n}\n\nexport interface SettingsSectionProps {\n /** The section's heading, 17 px like a Card title. */\n title?: string;\n /** One sentence under the title; `backticks` are code. */\n description?: string;\n /** Quiet buttons at the right end of the title row, like Card's: 「還原預設」. Not inside SettingsRows. */\n actions?: React.ReactNode;\n /** Fields and SettingsRows. */\n children?: React.ReactNode;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** One group of settings with a heading. It is a card on its own; inside a Card it drops its shadow. */\nexport function SettingsSection({ title, description, actions, children, className }: SettingsSectionProps) {\n return (\n <section className={cx('ui-settings-section', className)}>\n {title || actions ? (\n <div className=\"ui-settings-head\">\n {title ? <h2 className=\"ui-settings-h\">{title}</h2> : null}\n {actions ? <div className=\"ui-settings-actions\">{actions}</div> : null}\n </div>\n ) : null}\n {description ? <p className=\"ui-settings-desc\">{codeText(description)}</p> : null}\n {children}\n </section>\n );\n}\n\nexport interface SettingsRowProps {\n /** What the setting does, a short noun phrase: 「部署失敗時寄 Email」. Also give it to the Switch's `label`. */\n label: string;\n /** One sentence under the label; `backticks` are code. */\n description?: string;\n /** The control at the right end: a Switch (or a Select). */\n children: React.ReactElement<{ 'aria-describedby'?: string }>;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** One setting on one row: the label and a sentence on the left, the control on the right. The whole row is a\n * `<label>`, so clicking the text toggles a Switch. */\nexport function SettingsRow({ label, description, children, className }: SettingsRowProps) {\n const id = React.useId();\n // The row is a <label>: a button inside it is pressed by a click anywhere on the row.\n devWarn(\n React.isValidElement(children) && children.type === Button,\n 'SettingsRow',\n \"a Button inside SettingsRow is pressed by a click anywhere on the row, since the row is a <label>. Put the action in SettingsSection's actions instead.\",\n );\n const control = description && React.isValidElement(children) ? React.cloneElement(children, { 'aria-describedby': id }) : children;\n return (\n <label className={cx('ui-settings-row', className)}>\n <span className=\"ui-settings-rowtext\">\n <span className=\"ui-settings-rowlabel\">{label}</span>\n {description ? (\n <span id={id} className=\"ui-settings-rowdesc\">\n {codeText(description)}\n </span>\n ) : null}\n </span>\n {control}\n </label>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,MAAM,cAAc;AAEpB,MAAM,mBAAmB,OAAO,aAAa,eAAe,SAAS,KAAK,WAAW,IAAI;;AAGzF,SAAgB,eAAe,EAAE,OAAO,YAAY,OAAO,UAAU,UAAU,MAAM,OAAA,SAAO,aAAkC;CAC5H,MAAM,QAAQ,MAAM,WAAW,UAAU;CACzC,QACEA,YAAU,KAAA,GACV,kBACA,iMACF;CAEA,MAAM,gBAAgB;EACpB,IAAIA,YAAU,KAAA,GAAW;EACzB,IAAIA,SAAO,MAAUA,SAAO,EAAE,IAAI,oBAAoB,CAAC;OAClD,MAAU,MAAM,mBAAmB;CAC1C,GAAG,CAACA,OAAK,CAAC;CACV,QACE,SAAS,MAAM,OACf,kBACA,oIACF;CACA,MAAM,OAAO,WAAW,UAAU,KAAA;CAClC,MAAM,iBAAiB;EACrB,IAAI,CAAC,QAAQ,OAAO,aAAa,eAAe,WAAW,GAAG,OAAO,KAAA;EAErE,MAAM,MAAM,mBAAmB,SAAS,KAAK,MAAM,CAAC,CAAC;EACrD,MAAM,KAAK,IAAI,WAAW,WAAW,I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oBAAoB,GAAG,CAAC,IAAI;CAC3H,OACE,qBAAC,SAAD;EAAO,WAAW,GAAG,mBAAmB,SAAS;EAAjD,UAAA,CACE,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,oBAAC,QAAD;IAAM,WAAU;IAAwB,UAAA;GAAY,CAAA,GACnD,cACC,oBAAC,QAAD;IAAU;IAAI,WAAU;IACrB,UAAA,SAAS,WAAW;GACjB,CAAA,IACJ,IACA;EACL,CAAA,GAAA,OACI;;AAEX"}
1
+ {"version":3,"file":"SettingsLayout.js","names":["toast"],"sources":["../../../src/components/SettingsLayout/SettingsLayout.tsx"],"sourcesContent":["import * as React from 'react';\nimport { tr } from '../../i18n';\nimport { cx, useNarrow } from '../../internal/util';\nimport { Tabs } from '../Tabs/Tabs';\nimport { Button } from '../Button/Button';\nimport { devWarn } from '../../internal/dev';\nimport { ShellTitle } from '../../internal/shell';\nimport { announce } from '../../announce';\nimport { AutoToaster, toast as showToast } from '../Toast/Toast';\nimport { codeText } from '../InlineCode/InlineCode';\n\nexport interface SettingsCategory {\n /** Also the URL hash of the category (#settings-notifications): letters, digits and hyphens. */\n id: string;\n /** The name in the category list, a noun: 「通知」. */\n label: string;\n /** SettingsSections; a DangerZone goes last in the last category. */\n content: React.ReactNode;\n}\n\nexport interface SettingsLayoutProps {\n /** The page title. Inside AppShell leave it out and give AppShell title=\"設定\": the title shows once. */\n title?: string;\n /** The categories, in order. */\n categories: SettingsCategory[];\n /** Controlled category id. */\n value?: string;\n /** Called with the category id when another category is chosen. */\n onChange?: (id: string) => void;\n /** Uncontrolled: keep the open category in the URL hash (#settings-notifications), so a reload or a shared link\n * opens it. Off by itself while the hash is a hash router's route (#/settings). Default true. */\n urlSync?: boolean;\n /** @deprecated call toast('已儲存', { id: 'saved' }) when a change is saved; AppShell shows it. Until removed: a\n * non-empty text shows through toast(), an empty one closes it. */\n toast?: string;\n /** Extra class on the root element. */\n className?: string;\n}\n\n// The hash names the category with a prefix no other part of the page uses: #settings-notifications.\nconst HASH_PREFIX = 'settings-';\n// A hash router keeps its route in the hash (#/settings): the category then stays out of it, or the route would go.\nconst hashRouted = () => typeof location !== 'undefined' && location.hash.startsWith('#/');\n\n/** A settings page: categories on the left, their sections on the right. Changes save at once. */\nexport function SettingsLayout({ title, categories, value, onChange, urlSync = true, toast, className }: SettingsLayoutProps) {\n const shell = React.useContext(ShellTitle);\n devWarn(\n toast !== undefined,\n 'SettingsLayout',\n \"toast is deprecated: call toast('已儲存', { id: 'saved' }) from @seanyeh77/ui when a change is saved. AppShell shows it above the phone tab bar; outside AppShell put one <Toaster /> on the page.\",\n );\n // The old prop, through the toast system: one toast that restarts when the text changes, closed when it is emptied.\n React.useEffect(() => {\n if (toast === undefined) return;\n if (toast) showToast(toast, { id: 'ui-settings-saved' });\n else showToast.close('ui-settings-saved');\n }, [toast]);\n devWarn(\n title && shell.title,\n 'SettingsLayout',\n 'the page title shows twice: AppShell has `title` and SettingsLayout has `title`. Inside AppShell, give the title to AppShell only.',\n );\n const sync = urlSync && value === undefined;\n const fromHash = () => {\n if (!sync || typeof location === 'undefined' || hashRouted()) return undefined;\n // #settings-notifications, and the plain #notifications of links written before the prefix.\n const raw = decodeURIComponent(location.hash.slice(1));\n const id = raw.startsWith(HASH_PREFIX) ? raw.slice(HASH_PREFIX.length) : raw;\n return categories.some((c) => c.id === id) ? id : undefined;\n };\n const [own, setOwn] = React.useState<string | undefined>(() => fromHash() ?? value ?? categories[0]?.id);\n const active = value ?? own;\n const item = categories.find((c) => c.id === active) ?? categories[0];\n // A link or the back button that changes the hash opens that category.\n React.useEffect(() => {\n if (!sync) return;\n const onHash = () => {\n const id = fromHash();\n if (id) setOwn(id);\n };\n window.addEventListener('hashchange', onHash);\n return () => window.removeEventListener('hashchange', onHash);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- categories are read when the hash changes\n }, [sync]);\n const narrow = useNarrow();\n const choose = (c: SettingsCategory, said = false) => {\n if (c.id === item?.id) return;\n setOwn(c.id);\n if (sync && typeof window !== 'undefined' && window.history?.replaceState && !hashRouted()) {\n // A sandboxed iframe can refuse history changes: the category still changes, only the address stays.\n try {\n window.history.replaceState(window.history.state, '', location.pathname + location.search + '#' + HASH_PREFIX + encodeURIComponent(c.id));\n } catch {\n /* the address is not updated */\n }\n }\n // Tabs (on a phone) say the name themselves.\n if (!said) announce(c.label);\n onChange?.(c.id);\n };\n return (\n <div className={cx('ui-settings', className)}>\n {title ? <h1 className=\"ui-settings-title\">{title}</h1> : null}\n <div className=\"ui-settings-body\">\n {narrow ? (\n // On a phone: the same Tabs as everywhere else (a row that scrolls sideways when the names do not fit).\n <Tabs\n className=\"ui-settings-tabs\"\n label={tr('設定分類')}\n items={categories.map((c) => ({ id: c.id, label: c.label }))}\n value={item?.id ?? ''}\n onChange={(id) => {\n const c = categories.find((x) => x.id === id);\n if (c) choose(c, true);\n }}\n />\n ) : (\n <nav className=\"ui-settings-nav\" aria-label={tr('設定分類')}>\n {categories.map((c) => {\n const on = c.id === item?.id;\n return (\n <button\n key={c.id}\n type=\"button\"\n className={cx('ui-settings-cat', on && 'is-on')}\n aria-current={on ? 'page' : undefined}\n onClick={() => choose(c)}\n >\n {c.label}\n </button>\n );\n })}\n </nav>\n )}\n <div className=\"ui-settings-content\">{item?.content}</div>\n </div>\n {toast !== undefined ? <AutoToaster /> : null}\n </div>\n );\n}\n\nexport interface SettingsSectionProps {\n /** The section's heading, 17 px like a Card title. */\n title?: string;\n /** One sentence under the title; `backticks` are code. */\n description?: string;\n /** Quiet buttons at the right end of the title row, like Card's: 「還原預設」. Not inside SettingsRows. */\n actions?: React.ReactNode;\n /** Fields and SettingsRows. */\n children?: React.ReactNode;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** One group of settings with a heading. It is a card on its own; inside a Card it drops its shadow. */\nexport function SettingsSection({ title, description, actions, children, className }: SettingsSectionProps) {\n return (\n <section className={cx('ui-settings-section', className)}>\n {title || actions ? (\n <div className=\"ui-settings-head\">\n {title ? <h2 className=\"ui-settings-h\">{title}</h2> : null}\n {actions ? <div className=\"ui-settings-actions\">{actions}</div> : null}\n </div>\n ) : null}\n {description ? <p className=\"ui-settings-desc\">{codeText(description)}</p> : null}\n {children}\n </section>\n );\n}\n\nexport interface SettingsRowProps {\n /** What the setting does, a short noun phrase: 「部署失敗時寄 Email」. Also give it to the Switch's `label`. */\n label: string;\n /** One sentence under the label; `backticks` are code. */\n description?: string;\n /** The control at the right end: a Switch (or a Select). */\n children: React.ReactElement<{ 'aria-describedby'?: string }>;\n /** Extra class on the root element. */\n className?: string;\n}\n\n/** One setting on one row: the label and a sentence on the left, the control on the right. The whole row is a\n * `<label>`, so clicking the text toggles a Switch. */\nexport function SettingsRow({ label, description, children, className }: SettingsRowProps) {\n const id = React.useId();\n // The row is a <label>: a button inside it is pressed by a click anywhere on the row.\n devWarn(\n React.isValidElement(children) && children.type === Button,\n 'SettingsRow',\n \"a Button inside SettingsRow is pressed by a click anywhere on the row, since the row is a <label>. Put the action in SettingsSection's actions instead.\",\n );\n const control = description && React.isValidElement(children) ? React.cloneElement(children, { 'aria-describedby': id }) : children;\n return (\n <label className={cx('ui-settings-row', className)}>\n <span className=\"ui-settings-rowtext\">\n <span className=\"ui-settings-rowlabel\">{label}</span>\n {description ? (\n <span id={id} className=\"ui-settings-rowdesc\">\n {codeText(description)}\n </span>\n ) : null}\n </span>\n {control}\n </label>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,MAAM,cAAc;AAEpB,MAAM,mBAAmB,OAAO,aAAa,eAAe,SAAS,KAAK,WAAW,IAAI;;AAGzF,SAAgB,eAAe,EAAE,OAAO,YAAY,OAAO,UAAU,UAAU,MAAM,OAAA,SAAO,aAAkC;CAC5H,MAAM,QAAQ,MAAM,WAAW,UAAU;CACzC,QACEA,YAAU,KAAA,GACV,kBACA,iMACF;CAEA,MAAM,gBAAgB;EACpB,IAAIA,YAAU,KAAA,GAAW;EACzB,IAAIA,SAAO,MAAUA,SAAO,EAAE,IAAI,o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CAAA,IAAI,IAC/D;GACH,CAAA,IAAA;GACH,cAAc,oBAAC,KAAD;IAAG,WAAU;IAAoB,UAAA,SAAS,WAAW;GAAK,CAAA,IAAI;GAC5E;EACM;;AAEb;;;AAeA,SAAgB,YAAY,EAAE,OAAO,aAAa,UAAU,aAA+B;CACzF,MAAM,KAAK,MAAM,MAAM;CAEvB,QACE,MAAM,eAAe,QAAQ,KAAK,SAAS,SAAS,QACpD,eACA,yJACF;CACA,MAAM,UAAU,eAAe,MAAM,eAAe,QAAQ,IAAI,MAAM,aAAa,UAAU,EAAE,oBAAoB,GAAG,CAAC,IAAI;CAC3H,OACE,qBAAC,SAAD;EAAO,WAAW,GAAG,mBAAmB,SAAS;EAAjD,UAAA,CACE,qBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA,CACE,oBAAC,QAAD;IAAM,WAAU;IAAwB,UAAA;GAAY,CAAA,GACnD,cACC,oBAAC,QAAD;IAAU;IAAI,WAAU;IACrB,UAAA,SAAS,WAAW;GACjB,CAAA,IACJ,IACA;EACL,CAAA,GAAA,OACI;;AAEX"}
@@ -1,12 +1,18 @@
1
1
  import { FieldProps } from "../../internal/Field.js";
2
2
  import * as React from "react";
3
- export interface TextFieldProps extends FieldProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'name' | 'required' | 'disabled'> {
3
+ export interface TextFieldProps extends FieldProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'name' | 'required' | 'disabled' | 'prefix'> {
4
4
  /** The text. */
5
5
  value?: string;
6
+ /** Muted text inside the box before the value, e.g. 「NT$」 or 「https://」. */
7
+ prefix?: string;
8
+ /** Muted text inside the box at its end, e.g. 「元」 or 「.example.com」. */
9
+ suffix?: string;
10
+ /** The value's unit, muted, right after the typed text (「12 GB」), or after the placeholder while empty. */
11
+ unit?: string;
6
12
  /** Receives the new text, then the native event: onChange={(v) => setName(v)}. */
7
13
  onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
8
14
  /** The underlying <input>. */
9
15
  ref?: React.Ref<HTMLInputElement>;
10
16
  }
11
17
  /** A labelled one-line input with a hint or an error under it. */
12
- export declare function TextField({ label, hideLabel, hint, error, id, className, required, disabled, onChange, ...native }: TextFieldProps): React.JSX.Element;
18
+ export declare function TextField({ label, hideLabel, hint, error, id, className, required, disabled, onChange, prefix, suffix, unit, ...native }: TextFieldProps): React.JSX.Element;
@@ -5,10 +5,32 @@ import * as React from "react";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  // src/components/TextField/TextField.tsx
7
7
  /** A labelled one-line input with a hint or an error under it. */
8
- function TextField({ label, hideLabel, hint, error, id, className, required, disabled, onChange, ...native }) {
8
+ function TextField({ label, hideLabel, hint, error, id, className, required, disabled, onChange, prefix, suffix, unit, ...native }) {
9
9
  const auto = React.useId();
10
10
  const fieldId = id || auto;
11
11
  const msg = error ? fieldId + "-err" : hint ? fieldId + "-hint" : void 0;
12
+ const [typed, setTyped] = React.useState(String(native.defaultValue ?? ""));
13
+ const affixed = !!(prefix || suffix || unit);
14
+ const affixIds = [
15
+ prefix && fieldId + "-pre",
16
+ unit && fieldId + "-unit",
17
+ suffix && fieldId + "-suf"
18
+ ];
19
+ const input = /* @__PURE__ */ jsx("input", {
20
+ type: "text",
21
+ ...native,
22
+ required,
23
+ disabled,
24
+ id: fieldId,
25
+ className: "ui-input",
26
+ onChange: onChange || unit && native.value === void 0 ? (e) => {
27
+ if (unit && native.value === void 0) setTyped(e.target.value);
28
+ onChange?.(e.target.value, e);
29
+ } : void 0,
30
+ "aria-invalid": error ? true : native["aria-invalid"],
31
+ "aria-describedby": describedBy(native["aria-describedby"], ...affixIds, msg)
32
+ });
33
+ const shown = String(native.value ?? typed) || native.placeholder || "";
12
34
  return /* @__PURE__ */ jsxs("div", {
13
35
  className: cx("ui-field", error && "has-error", disabled && "is-disabled", className),
14
36
  children: [
@@ -19,18 +41,42 @@ function TextField({ label, hideLabel, hint, error, id, className, required, dis
19
41
  children: label
20
42
  }),
21
43
  /* @__PURE__ */ jsxs("div", {
22
- className: "ui-field-box",
23
- children: [/* @__PURE__ */ jsx("input", {
24
- type: "text",
25
- ...native,
26
- required,
27
- disabled,
28
- id: fieldId,
29
- className: "ui-input",
30
- onChange: onChange ? (e) => onChange(e.target.value, e) : void 0,
31
- "aria-invalid": error ? true : native["aria-invalid"],
32
- "aria-describedby": describedBy(native["aria-describedby"], msg)
33
- }), error ? /* @__PURE__ */ jsx(FieldErrorIcon, {}) : null]
44
+ className: cx("ui-field-box", affixed && "has-affix"),
45
+ children: [
46
+ prefix ? /* @__PURE__ */ jsx("span", {
47
+ id: fieldId + "-pre",
48
+ className: "ui-field-affix",
49
+ children: prefix
50
+ }) : null,
51
+ unit ? /* @__PURE__ */ jsxs("span", {
52
+ className: "ui-field-unitwrap",
53
+ children: [
54
+ input,
55
+ /* @__PURE__ */ jsxs("span", {
56
+ className: "ui-field-unitline",
57
+ "aria-hidden": "true",
58
+ children: [/* @__PURE__ */ jsx("span", {
59
+ className: "ui-field-mirror",
60
+ children: shown
61
+ }), /* @__PURE__ */ jsx("span", {
62
+ className: "ui-field-affix",
63
+ children: (shown ? "\xA0" : "") + unit
64
+ })]
65
+ }),
66
+ /* @__PURE__ */ jsx("span", {
67
+ id: fieldId + "-unit",
68
+ className: "ui-visually-hidden",
69
+ children: unit
70
+ })
71
+ ]
72
+ }) : input,
73
+ suffix ? /* @__PURE__ */ jsx("span", {
74
+ id: fieldId + "-suf",
75
+ className: "ui-field-affix",
76
+ children: suffix
77
+ }) : null,
78
+ error ? /* @__PURE__ */ jsx(FieldErrorIcon, { inline: affixed }) : null
79
+ ]
34
80
  }),
35
81
  msg ? /* @__PURE__ */ jsx(FieldMessage, {
36
82
  id: msg,
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","names":[],"sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../internal/util';\nimport { describedBy, FieldErrorIcon, FieldLabel, FieldMessage, type FieldProps } from '../../internal/Field';\n\nexport interface TextFieldProps extends FieldProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'name' | 'required' | 'disabled'> {\n /** The text. */\n value?: string;\n /** Receives the new text, then the native event: onChange={(v) => setName(v)}. */\n onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;\n /** The underlying <input>. */\n ref?: React.Ref<HTMLInputElement>;\n}\n\n/** A labelled one-line input with a hint or an error under it. */\nexport function TextField({ label, hideLabel, hint, error, id, className, required, disabled, onChange, ...native }: TextFieldProps) {\n const auto = React.useId();\n const fieldId = id || auto;\n const msg = error ? fieldId + '-err' : hint ? fieldId + '-hint' : undefined;\n return (\n <div className={cx('ui-field', error && 'has-error', disabled && 'is-disabled', className)}>\n <FieldLabel htmlFor={fieldId} required={required} hidden={hideLabel}>\n {label}\n </FieldLabel>\n <div className=\"ui-field-box\">\n <input\n type=\"text\"\n {...native}\n required={required}\n disabled={disabled}\n id={fieldId}\n className=\"ui-input\"\n onChange={onChange ? (e) => onChange(e.target.value, e) : undefined}\n aria-invalid={error ? true : native['aria-invalid']}\n // Your own description first, then the hint or the error.\n aria-describedby={describedBy(native['aria-describedby'], msg)}\n />\n {error ? <FieldErrorIcon /> : null}\n </div>\n {msg ? <FieldMessage id={msg} error={error} hint={hint} /> : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAcA,SAAgB,UAAU,EAAE,OAAO,WAAW,MAAM,OAAO,IAAI,WAAW,UAAU,UAAU,UAAU,GAAG,UAA0B;CACnI,MAAM,OAAO,MAAM,MAAM;CACzB,MAAM,UAAU,MAAM;CACtB,MAAM,MAAM,QAAQ,UAAU,SAAS,OAAO,UAAU,UAAU,KAAA;CAClE,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,SAAS,aAAa,YAAY,eAAe,SAAS;EAAzF,UAAA;GACE,oBAAC,YAAD;IAAY,SAAS;IAAmB;IAAU,QAAQ;IACvD,UAAA;GACS,CAAA;GACZ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,SAAD;KACE,MAAK;KACL,GAAI;KACM;KACA;KACV,IAAI;KACJ,WAAU;KACV,UAAU,YAAY,MAAM,SAAS,EAAE,OAAO,OAAO,CAAC,IAAI,KAAA;KAC1D,gBAAc,QAAQ,OAAO,OAAO;KAEpC,oBAAkB,YAAY,OAAO,qBAAqB,GAAG;IAC9D,CAAA,GACA,QAAQ,oBAAC,gBAAD,CAAiB,CAAA,IAAI,IAC3B;;GACJ,MAAM,oBAAC,cAAD;IAAc,IAAI;IAAY;IAAa;GAAO,CAAA,IAAI;EAC1D;;AAET"}
1
+ {"version":3,"file":"TextField.js","names":[],"sources":["../../../src/components/TextField/TextField.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cx } from '../../internal/util';\nimport { describedBy, FieldErrorIcon, FieldLabel, FieldMessage, type FieldProps } from '../../internal/Field';\n\nexport interface TextFieldProps\n extends FieldProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value' | 'name' | 'required' | 'disabled' | 'prefix'> {\n /** The text. */\n value?: string;\n /** Muted text inside the box before the value, e.g. 「NT$」 or 「https://」. */\n prefix?: string;\n /** Muted text inside the box at its end, e.g. 「元」 or 「.example.com」. */\n suffix?: string;\n /** The value's unit, muted, right after the typed text (「12 GB」), or after the placeholder while empty. */\n unit?: string;\n /** Receives the new text, then the native event: onChange={(v) => setName(v)}. */\n onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;\n /** The underlying <input>. */\n ref?: React.Ref<HTMLInputElement>;\n}\n\n/** A labelled one-line input with a hint or an error under it. */\nexport function TextField({ label, hideLabel, hint, error, id, className, required, disabled, onChange, prefix, suffix, unit, ...native }: TextFieldProps) {\n const auto = React.useId();\n const fieldId = id || auto;\n const msg = error ? fieldId + '-err' : hint ? fieldId + '-hint' : undefined;\n // Uncontrolled with a unit: the typed text, so the unit follows it.\n const [typed, setTyped] = React.useState(String(native.defaultValue ?? ''));\n const affixed = !!(prefix || suffix || unit);\n // Screen readers hear the prefix, suffix and unit with the field's description.\n const affixIds = [prefix && fieldId + '-pre', unit && fieldId + '-unit', suffix && fieldId + '-suf'];\n const input = (\n <input\n type=\"text\"\n {...native}\n required={required}\n disabled={disabled}\n id={fieldId}\n className=\"ui-input\"\n onChange={\n onChange || (unit && native.value === undefined)\n ? (e) => {\n if (unit && native.value === undefined) setTyped(e.target.value);\n onChange?.(e.target.value, e);\n }\n : undefined\n }\n aria-invalid={error ? true : native['aria-invalid']}\n // Your own description first, then the prefix, unit and suffix, then the hint or the error.\n aria-describedby={describedBy(native['aria-describedby'], ...affixIds, msg)}\n />\n );\n const shown = String(native.value ?? typed) || native.placeholder || '';\n return (\n <div className={cx('ui-field', error && 'has-error', disabled && 'is-disabled', className)}>\n <FieldLabel htmlFor={fieldId} required={required} hidden={hideLabel}>\n {label}\n </FieldLabel>\n <div className={cx('ui-field-box', affixed && 'has-affix')}>\n {prefix ? (\n <span id={fieldId + '-pre'} className=\"ui-field-affix\">\n {prefix}\n </span>\n ) : null}\n {unit ? (\n // The unit sits after the text: an invisible copy of the text pushes it there.\n <span className=\"ui-field-unitwrap\">\n {input}\n <span className=\"ui-field-unitline\" aria-hidden=\"true\">\n <span className=\"ui-field-mirror\">{shown}</span>\n <span className=\"ui-field-affix\">{(shown ? '\\u00a0' : '') + unit}</span>\n </span>\n <span id={fieldId + '-unit'} className=\"ui-visually-hidden\">\n {unit}\n </span>\n </span>\n ) : (\n input\n )}\n {suffix ? (\n <span id={fieldId + '-suf'} className=\"ui-field-affix\">\n {suffix}\n </span>\n ) : null}\n {error ? <FieldErrorIcon inline={affixed} /> : null}\n </div>\n {msg ? <FieldMessage id={msg} error={error} hint={hint} /> : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAqBA,SAAgB,UAAU,EAAE,OAAO,WAAW,MAAM,OAAO,IAAI,WAAW,UAAU,UAAU,UAAU,QAAQ,QAAQ,MAAM,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AA,GAC/C,oBAAC,QAAD;SAAM,WAAU;SAAmB,WAAA,QAAQ,SAAW,MAAM;QAAW,CAAA,CACnE;;OACN,oBAAC,QAAD;QAAM,IAAI,UAAU;QAAS,WAAU;QACpC,UAAA;OACG,CAAA;MACF;KAEN,CAAA,IAAA;KAED,SACC,oBAAC,QAAD;MAAM,IAAI,UAAU;MAAQ,WAAU;MACnC,UAAA;KACG,CAAA,IACJ;KACH,QAAQ,oBAAC,gBAAD,EAAgB,QAAQ,QAAU,CAAA,IAAI;IAC5C;;GACJ,MAAM,oBAAC,cAAD;IAAc,IAAI;IAAY;IAAa;GAAO,CAAA,IAAI;EAC1D;;AAET"}
@@ -68,7 +68,8 @@
68
68
  grid-row: 1;
69
69
  width: 40px;
70
70
  height: 40px;
71
- margin: -8px -8px -8px var(--space-3);
71
+ /* Its box ends at the padding edge, where an action button ends in an alert without ✕. */
72
+ margin: -8px 0 -8px var(--space-3);
72
73
  border: 0;
73
74
  border-radius: var(--radius-sm);
74
75
  background: transparent;
@@ -78,6 +79,13 @@
78
79
  align-items: center;
79
80
  justify-content: center;
80
81
  }
82
+ /* Beside an action: centred on the same line as the button, not at the top. */
83
+ @container (min-width: 480px) {
84
+ .ui-alert:has(> .ui-alert-action) > .ui-alert-close {
85
+ align-self: center;
86
+ margin-block: 0;
87
+ }
88
+ }
81
89
  .ui-alert-close:hover {
82
90
  background: var(--surface-sub);
83
91
  }
@@ -279,6 +279,8 @@
279
279
  /* The summary keeps the segmented look (a gray track, the current part a raised white pill), the user's choice for
280
280
  summaries; plain Tabs are underlined. */
281
281
  .ui-tabs.ui-dt-summary {
282
+ display: inline-flex;
283
+ width: auto;
282
284
  height: auto;
283
285
  padding: 4px;
284
286
  border-radius: var(--radius-md);
@@ -453,10 +455,24 @@
453
455
  .ui-dt-time wbr {
454
456
  display: none;
455
457
  }
456
- /* Hugging columns are measured on one line (DataTable adds is-measuring for the read only). */
458
+ /* Code and paths in a row are the row's size, in Geist Mono: one text size per row. */
459
+ .ui-dt-body .ui-dt-cell .ui-code,
460
+ .ui-dt-body .ui-dt-cell .ui-code.is-link.is-location {
461
+ font-size: inherit;
462
+ }
463
+ /* Hugging columns are measured on one line (DataTable adds is-measuring for the read only), headings at their full
464
+ width too, so a column is never narrower than its heading, also while it holds only loading bars. */
457
465
  .ui-dt.is-measuring .ui-dt-cell.is-hug {
458
466
  white-space: nowrap;
459
467
  }
468
+ .ui-dt.is-measuring .ui-dt-cell.is-hug > .ui-dt-sort {
469
+ flex: none;
470
+ max-width: none;
471
+ }
472
+ /* Loading bars keep their width in the cell (a flex box would shrink them). */
473
+ .ui-dt-skelrow .ui-skel {
474
+ flex: none;
475
+ }
460
476
 
461
477
  .ui-dt-body .ui-dt-row:last-child {
462
478
  border-bottom: 0;
@@ -950,6 +966,14 @@
950
966
  .ui-dt-body .ui-dt-cell .ui-dt-time wbr {
951
967
  display: inline;
952
968
  }
969
+ /* Each part stays whole while it fits on a line; only a card narrower than the part (320 px, wide text spacing)
970
+ breaks inside it, rather than overflowing the card. */
971
+ .ui-dt-body .ui-dt-cell .ui-dt-nowrap {
972
+ display: inline-block;
973
+ max-width: 100%;
974
+ white-space: normal;
975
+ overflow-wrap: anywhere;
976
+ }
953
977
  .ui-dt-body .ui-dt-cell.is-num {
954
978
  white-space: normal;
955
979
  }
@@ -964,7 +988,8 @@
964
988
  color: var(--ink-muted);
965
989
  font-family: var(--font-sans);
966
990
  font-size: var(--text-small);
967
- line-height: inherit;
991
+ /* The value's line height (1lh here is the cell's), so the smaller name sits on the value's baseline. */
992
+ line-height: 1lh;
968
993
  font-weight: 400;
969
994
  white-space: nowrap;
970
995
  }
@@ -21,11 +21,11 @@
21
21
  font-size: var(--text-compact);
22
22
  color: var(--ink-muted);
23
23
  }
24
- /* Phones: a description that wraps reads from the left (long text is left-aligned on phones); one that fits on a line
25
- stays centred, its box only as wide as the text. */
24
+ /* Phones: a description of more than 2 lines (EmptyState adds is-long) left-aligns the whole block, title, steps and
25
+ button with it, so nothing is centred above left-aligned text; up to 2 lines everything stays centred. */
26
26
  @media (max-width: 599px) {
27
- .ui-empty-desc {
28
- width: fit-content;
27
+ .ui-empty.is-long {
28
+ align-items: flex-start;
29
29
  text-align: start;
30
30
  }
31
31
  }
@@ -27,8 +27,8 @@
27
27
  border-bottom: 0;
28
28
  }
29
29
  .ui-events-time {
30
+ /* The row's size: the time, the icon and the sentence are one row, so one text size. */
30
31
  font-family: var(--font-mono);
31
- font-size: var(--text-small);
32
32
  color: var(--ink-muted);
33
33
  font-variant-numeric: tabular-nums;
34
34
  }
@@ -68,6 +68,8 @@
68
68
  }
69
69
  .ui-events-actor {
70
70
  color: var(--ink-muted);
71
+ /* A name stays whole: it moves to the next line rather than splitting (「系/統」). */
72
+ white-space: nowrap;
71
73
  }
72
74
  .ui-events-empty {
73
75
  margin: 0;
@@ -1,9 +1,9 @@
1
1
  @layer theme, base, ui, components, utilities;
2
2
  @layer ui.tokens, ui.components;
3
- @import './Tabs.css';
4
3
  @import './Switch.css';
5
4
  @import './IconButton.css';
6
5
  @import './Graph.css';
6
+ @import './SegmentedControl.css';
7
7
  @layer ui.components {
8
8
  /* LayerGraph */
9
9
  .ui-lg-scroller {
@@ -34,12 +34,15 @@
34
34
  ui-drop-l var(--dur-loop) cubic-bezier(0.65, 0, 0.35, 1) infinite,
35
35
  ui-drop-r var(--dur-loop) var(--ease-standard) infinite;
36
36
  }
37
+ /* Reduced motion: a still bar across the whole track, accent stripes on the track (full accent, 3:1 against it), so it
38
+ reads as 「busy」 and not as a fixed amount done. */
37
39
  @media (prefers-reduced-motion: reduce) {
38
40
  .ui-loading-drop {
39
41
  animation: none;
40
42
  left: 0;
41
43
  right: 0;
42
- opacity: 0.5;
44
+ border-radius: 0;
45
+ background: repeating-linear-gradient(-45deg, var(--accent) 0 6px, transparent 6px 12px);
43
46
  }
44
47
  }
45
48
  }
@@ -32,17 +32,19 @@
32
32
  .ui-tabbar-item.is-selected {
33
33
  color: var(--accent-text);
34
34
  }
35
- /* MA: an 11 px label under each icon; the pill sits behind the icon only. */
35
+ /* MA: an 11 px label under each icon; the pill sits behind the icon only: centred on it (22 px icon, 28 px pill) and
36
+ clear of the label (6 px gap). The icon, gap and label (42 px) are centred in the bar, so the pill's centre is the
37
+ bar's middle less 21 px plus 11 px. */
36
38
  .ui-tabbar.has-labels {
37
39
  height: 64px;
38
40
  }
39
41
  .ui-tabbar.has-labels .ui-tabbar-item {
40
42
  flex-direction: column;
41
- gap: 2px;
42
- padding-top: 2px;
43
+ gap: 6px;
43
44
  }
44
45
  .ui-tabbar.has-labels .ui-tabbar-pill {
45
- top: 8px;
46
+ top: calc(50% - 24px);
47
+ height: 28px;
46
48
  }
47
49
  .ui-tabbar-label {
48
50
  font-size: var(--text-mini);
@@ -136,6 +136,7 @@
136
136
  .ui-settings-body {
137
137
  flex-direction: column;
138
138
  align-items: stretch;
139
+ gap: var(--space-4);
139
140
  }
140
141
  /* The categories as Tabs, like every other row of tabs: the row scrolls sideways when the names do not fit. */
141
142
  .ui-settings-tabs {
package/dist/css/Tabs.css CHANGED
@@ -3,10 +3,11 @@
3
3
  @layer ui.components {
4
4
  /* Tabs switch between different content: text on a 1 px baseline rule, the current tab underlined in the accent (an
5
5
  underline, not a raised pill, so it never reads like SegmentedControl, which switches how the same content shows).
6
- 40 px tall, the height of the controls beside it in a toolbar. */
6
+ 40 px tall, the height of the controls beside it in a toolbar. The baseline runs the full width of the container. */
7
7
  .ui-tabs {
8
8
  position: relative;
9
- display: inline-flex;
9
+ display: flex;
10
+ width: 100%;
10
11
  max-width: 100%;
11
12
  box-sizing: border-box;
12
13
  height: var(--control-height);
@@ -62,6 +63,18 @@
62
63
  font-weight: 700;
63
64
  }
64
65
 
66
+ /* Forced colors drop backgrounds and box shadows: the underline is drawn in Highlight and the baseline is a border. */
67
+ @media (forced-colors: active) {
68
+ .ui-tabs {
69
+ box-shadow: none;
70
+ border-bottom: 1px solid CanvasText;
71
+ }
72
+ .ui-tabs-ind {
73
+ forced-color-adjust: none;
74
+ background: Highlight;
75
+ }
76
+ }
77
+
65
78
  @media (prefers-reduced-motion: reduce) {
66
79
  .ui-tabs-ind {
67
80
  transition: opacity var(--dur-hover) ease !important;
package/dist/css/base.css CHANGED
@@ -183,11 +183,18 @@ html.ui-theme-fade * {
183
183
  click area wrap the control, not the whole row, as on Switch. Still a block, so each sits on its own line. */
184
184
  .ui-check,
185
185
  .ui-radio {
186
- display: flex;
186
+ /* A grid, not a flex row: the box sits on the first line of a label that wraps (align-items: start, see the box's
187
+ margin), while one line stays centred in the 40 px height (align-content: center). */
188
+ display: grid;
189
+ grid-template-columns: auto;
190
+ grid-auto-flow: column;
191
+ grid-auto-columns: minmax(0, max-content);
187
192
  width: max-content;
188
193
  max-width: 100%;
189
- align-items: center;
190
- gap: 12px;
194
+ justify-content: start;
195
+ align-items: start;
196
+ align-content: center;
197
+ column-gap: 12px;
191
198
  min-height: var(--control-height);
192
199
  padding: 0;
193
200
  border: 0;
@@ -198,6 +205,11 @@ html.ui-theme-fade * {
198
205
  text-align: left;
199
206
  cursor: pointer;
200
207
  }
208
+ .ui-check > .ui-check-box,
209
+ .ui-radio > .ui-radio-ring {
210
+ /* Centred on the first line of the label. */
211
+ margin-top: calc((1lh - 22px) / 2);
212
+ }
201
213
  .ui-check:disabled,
202
214
  .ui-radio:disabled {
203
215
  color: var(--ink-muted);
@@ -286,6 +298,77 @@ html.ui-theme-fade * {
286
298
  label:has(> .ui-switch) {
287
299
  font-size: var(--text-control);
288
300
  }
301
+ /* TextField with prefix, suffix or unit: the box draws the border (like the password field) and the input inside is
302
+ bare, so the muted text sits inside the same frame. */
303
+ .ui-field-box.has-affix {
304
+ display: flex;
305
+ align-items: center;
306
+ gap: var(--space-2);
307
+ height: var(--control-height);
308
+ box-sizing: border-box;
309
+ padding: 0 var(--space-3);
310
+ /* The frame is an inset shadow, not a border, so the input inside is the full 40 px (48 px on phones) tall: the
311
+ whole box is its touch target. */
312
+ box-shadow: inset 0 0 0 1px var(--line-strong);
313
+ border-radius: var(--radius-md);
314
+ background: var(--surface-input);
315
+ color: var(--ink);
316
+ }
317
+ .ui-field-box.has-affix .ui-input {
318
+ flex: 1 1 auto;
319
+ min-width: 0;
320
+ height: 100%;
321
+ padding: 0;
322
+ border: 0;
323
+ border-radius: 0;
324
+ background: transparent;
325
+ }
326
+ .ui-field-box.has-affix .ui-input:focus-visible {
327
+ outline: none;
328
+ }
329
+ .has-error .ui-field-box.has-affix {
330
+ box-shadow: inset 0 0 0 1.5px var(--danger);
331
+ }
332
+ .is-disabled .ui-field-box.has-affix {
333
+ box-shadow: none;
334
+ background: var(--surface-sub);
335
+ color: var(--ink-muted);
336
+ }
337
+ .ui-field-affix {
338
+ flex: none;
339
+ color: var(--ink-muted);
340
+ font-size: var(--text-control);
341
+ white-space: nowrap;
342
+ }
343
+ /* The unit after the typed text: an invisible copy of the text, on top of the input, pushes it along. */
344
+ .ui-field-unitwrap {
345
+ flex: 1 1 auto;
346
+ min-width: 0;
347
+ height: 100%;
348
+ display: grid;
349
+ }
350
+ .ui-field-unitwrap > * {
351
+ grid-area: 1 / 1;
352
+ }
353
+ .ui-field-unitline {
354
+ display: flex;
355
+ align-items: center;
356
+ overflow: hidden;
357
+ font-size: var(--text-control);
358
+ white-space: pre;
359
+ pointer-events: none;
360
+ }
361
+ .ui-field-mirror {
362
+ visibility: hidden;
363
+ min-width: 0;
364
+ overflow: hidden;
365
+ }
366
+ /* Forced colors drop shadows: the frame becomes a border. */
367
+ @media (forced-colors: active) {
368
+ .ui-field-box.has-affix {
369
+ border: 1px solid CanvasText;
370
+ }
371
+ }
289
372
  @keyframes ui-rise {
290
373
  from {
291
374
  opacity: 0;
package/dist/css/end.css CHANGED
@@ -173,7 +173,8 @@
173
173
  .ui-input,
174
174
  .ui-select-trigger,
175
175
  .ui-datefield,
176
- .ui-pwfield {
176
+ .ui-pwfield,
177
+ .ui-field-box.has-affix {
177
178
  height: var(--touch-target);
178
179
  }
179
180
  }
@@ -255,6 +256,7 @@
255
256
  .ui-cal-day:focus-visible,
256
257
  .ui-ms:focus-within,
257
258
  .ui-pwfield:focus-within,
259
+ .ui-field-box.has-affix:focus-within,
258
260
  .ui-dt-opt:focus-visible,
259
261
  .ui-code.is-link:focus-visible,
260
262
  .ui-code.is-link.is-name:focus-visible,