@mistriwork/ui 1.0.0-rc.57 → 1.0.0-rc.59

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 (122) hide show
  1. package/README.md +46 -12
  2. package/dist/Avatar.js +3 -3
  3. package/dist/Button.d.ts +4 -14
  4. package/dist/Button.js +26 -13
  5. package/dist/Carousel.d.ts +6 -5
  6. package/dist/Carousel.js +58 -67
  7. package/dist/Choices.d.ts +2 -9
  8. package/dist/Choices.js +127 -64
  9. package/dist/DateField.d.ts +9 -4
  10. package/dist/DateField.js +102 -119
  11. package/dist/Drawer.d.ts +1 -19
  12. package/dist/Drawer.js +8 -9
  13. package/dist/DropMenu.d.ts +8 -21
  14. package/dist/DropMenu.js +84 -30
  15. package/dist/Dropdown.d.ts +9 -8
  16. package/dist/Dropdown.js +69 -65
  17. package/dist/Field.d.ts +2 -1
  18. package/dist/Field.js +12 -18
  19. package/dist/FileField.d.ts +3 -10
  20. package/dist/FileField.js +12 -9
  21. package/dist/FormParts.d.ts +17 -10
  22. package/dist/FormParts.js +26 -41
  23. package/dist/HeroBlocks.d.ts +7 -3
  24. package/dist/HeroBlocks.js +11 -6
  25. package/dist/Modal.d.ts +6 -17
  26. package/dist/Modal.js +90 -21
  27. package/dist/Pagination.d.ts +1 -12
  28. package/dist/Pagination.js +17 -3
  29. package/dist/Popover.d.ts +1 -15
  30. package/dist/Popover.js +10 -15
  31. package/dist/Resizable.d.ts +3 -21
  32. package/dist/Resizable.js +14 -91
  33. package/dist/ScrollArea.d.ts +4 -2
  34. package/dist/ScrollArea.js +11 -11
  35. package/dist/Select.d.ts +1 -6
  36. package/dist/Select.js +16 -7
  37. package/dist/SensitiveField.d.ts +1 -8
  38. package/dist/SensitiveField.js +6 -4
  39. package/dist/Slider.d.ts +1 -5
  40. package/dist/Slider.js +13 -5
  41. package/dist/Switch.d.ts +1 -11
  42. package/dist/Switch.js +10 -9
  43. package/dist/Tabs.d.ts +3 -3
  44. package/dist/Tabs.js +3 -3
  45. package/dist/TextArea.d.ts +4 -6
  46. package/dist/TextArea.js +14 -5
  47. package/dist/TextField.d.ts +5 -9
  48. package/dist/TextField.js +67 -9
  49. package/dist/Tooltip.d.ts +1 -21
  50. package/dist/Tooltip.js +13 -31
  51. package/dist/Typeahead.d.ts +15 -18
  52. package/dist/Typeahead.js +151 -86
  53. package/dist/UiKit.d.ts +63 -4
  54. package/dist/UiKit.js +46 -5
  55. package/dist/behaviors/DaysParts.js +28 -0
  56. package/dist/behaviors/EditableParts.js +21 -0
  57. package/dist/behaviors/PickParts.js +30 -0
  58. package/dist/behaviors/ScrubParts.js +21 -0
  59. package/dist/behaviors/SortableParts.js +32 -0
  60. package/dist/behaviors/SpansParts.js +12 -0
  61. package/dist/behaviors/TransferParts.js +37 -0
  62. package/dist/behaviors/TurnsParts.js +31 -0
  63. package/dist/behaviors/WidthsParts.js +27 -0
  64. package/dist/behaviors/days.js +216 -0
  65. package/dist/behaviors/dress.js +86 -0
  66. package/dist/behaviors/editable.js +104 -0
  67. package/dist/behaviors/heard.js +22 -0
  68. package/dist/behaviors/index.d.ts +310 -0
  69. package/dist/behaviors/index.js +44 -0
  70. package/dist/behaviors/pick.js +158 -0
  71. package/dist/behaviors/scrub.js +152 -0
  72. package/dist/behaviors/sortable.js +170 -0
  73. package/dist/behaviors/spans.js +240 -0
  74. package/dist/behaviors/testing.js +48 -0
  75. package/dist/behaviors/transfer.js +202 -0
  76. package/dist/behaviors/turns.js +106 -0
  77. package/dist/behaviors/widths.js +150 -0
  78. package/dist/behaviors.css +309 -0
  79. package/dist/changeDetails.d.ts +4 -8
  80. package/dist/changeDetails.js +0 -6
  81. package/dist/conformance.js +107 -1
  82. package/dist/controls.css +36 -0
  83. package/dist/fieldFrame.d.ts +2 -15
  84. package/dist/fieldFrame.js +1 -17
  85. package/dist/index.d.ts +6 -5
  86. package/dist/index.js +6 -5
  87. package/dist/internal/Frame.d.ts +6 -0
  88. package/dist/internal/Frame.js +25 -0
  89. package/dist/internal/HelpTip.d.ts +5 -0
  90. package/dist/internal/HelpTip.js +37 -0
  91. package/dist/internal/layers.d.ts +21 -0
  92. package/dist/internal/layers.js +66 -0
  93. package/dist/internal/popups.d.ts +12 -10
  94. package/dist/internal/popups.js +18 -14
  95. package/dist/internal/told.d.ts +14 -0
  96. package/dist/internal/told.js +20 -0
  97. package/dist/internal/uiKitContext.js +6 -4
  98. package/dist/preferences.css +2 -3
  99. package/dist/style.css +5 -16
  100. package/dist/styles/extras.css +461 -0
  101. package/dist/styles/forms.css +346 -0
  102. package/dist/styles/guard.css +114 -0
  103. package/dist/styles/kit-fields.css +181 -0
  104. package/dist/styles/kit-parts.css +130 -0
  105. package/dist/styles/kit.css +558 -0
  106. package/dist/styles/layers.css +4 -0
  107. package/dist/styles/looks.css +374 -0
  108. package/dist/styles/m-tokens.css +173 -0
  109. package/dist/styles/overlays.css +107 -0
  110. package/dist/styles/parts.css +456 -0
  111. package/dist/styles/screens.css +76 -0
  112. package/dist/styles/ui-sdk.css +1635 -0
  113. package/dist/tokens.css +15 -4
  114. package/dist/uiKitSlots.d.ts +1 -1
  115. package/dist/uiKitSlots.js +18 -2
  116. package/package.json +13 -11
  117. package/dist/forms.css +0 -225
  118. package/dist/hero.css +0 -23
  119. package/dist/internal/anchor.d.ts +0 -19
  120. package/dist/internal/anchor.js +0 -52
  121. package/dist/primitives.css +0 -200
  122. package/dist/standalone.css +0 -478
package/dist/tokens.css CHANGED
@@ -69,6 +69,14 @@
69
69
  defaults are the look they have always had. The corner is --field-radius, read where it is used, --radius unsaid. */
70
70
  --field-fill: var(--surface);
71
71
  --control-h: 34px;
72
+ /* The compact size: a control that stands in a bar or a toolbar (a list's search and filters, a record's actions in
73
+ the crumb bar, a dashboard's windows) and not in a form or a dialog. One step under the control's own, so a theme
74
+ that makes its fields taller makes its toolbars taller with them, and a row of mixed controls is one height. */
75
+ --control-h-sm: calc(var(--control-h) - 4px);
76
+ /* A form's controls: its text is a size up from a list's, so its field is two pixels taller, and what stands in the
77
+ form with the field (a choice's picks, the buttons under it) is that height too. Said here, where a theme writes
78
+ --control-h, because a scope cannot say a token from its own value. */
79
+ --form-control-h: max(var(--control-h), 36px);
72
80
  --control-border-w: 1px;
73
81
  /* A room's one content edge inside the pane's gutter: the crumb bar's
74
82
  words, a list's controls and rows, a board's first lane, a calendar and a
@@ -104,11 +112,14 @@
104
112
  from space (docs/design.md, the refusal list). Named where it was a literal, it stands where the literal stood:
105
113
  a theme's rhythm does not move it. */
106
114
  --field-gap: 20px;
107
- /* A list's row, drawn: 32px at compact, 40px at comfortable and 44px at
115
+ /* A list's row, drawn: 40px at compact and at comfortable, 44px at
108
116
  spacious or under a finger, whatever the density's zoom (density.js
109
- sets data-density beside the zoom, before the first paint). A cell
110
- taller than its row (two lines, an avatar) grows it. */
111
- --row-h: 32px;
117
+ sets data-density beside the zoom, before the first paint). Compact
118
+ was 32px, a ledger's row: at the text's 13px that is a line and nine
119
+ pixels of air, and a list read across ten columns lost its rows. A
120
+ view that is a ledger says so (`density: 'compact'`, structure.css).
121
+ A cell taller than its row (two lines, an avatar) grows it. */
122
+ --row-h: 40px;
112
123
  /* The text scale, each step over the theme's base like every size. */
113
124
  --text-xs: calc(11px * var(--type-k));
114
125
  --text-sm: calc(12px * var(--type-k));
@@ -4,7 +4,7 @@
4
4
  * an App's own typecheck follows the import and has no JSX to read a primitive's module with.
5
5
  */
6
6
  /** Every slot a kit may fill, in the order the docs list them. */
7
- export declare const SLOT_NAMES: readonly ['Button', 'ButtonLink', 'TextField', 'MaskedField', 'MoneyField', 'SensitiveField', 'Select', 'MultiSelect', 'Dropdown', 'MultiDropdown', 'Typeahead', 'DateField', 'Checkbox', 'YesNo', 'ChoiceCards', 'CheckCards', 'Consent', 'Switch', 'Slider', 'Modal', 'Drawer', 'Popover', 'Tooltip', 'DropMenu', 'DropGroup', 'DropItem', 'DropSeparator', 'Tabs', 'Pagination', 'Avatar'];
7
+ export declare const SLOT_NAMES: readonly ['Button', 'ButtonLink', 'TextField', 'MaskedField', 'MoneyField', 'SensitiveField', 'Select', 'MultiSelect', 'Dropdown', 'MultiDropdown', 'Typeahead', 'DateField', 'Checkbox', 'YesNo', 'ChoiceCards', 'CheckCards', 'Consent', 'Switch', 'Slider', 'Modal', 'Drawer', 'Popover', 'Tooltip', 'DropMenu', 'DropGroup', 'DropItem', 'DropSeparator', 'Tabs', 'Pagination', 'Avatar', 'Field', 'TextArea', 'FileField', 'ValidMark', 'HelpTip', 'ProgressBar', 'StepHeader', 'ActionBar', 'Columns', 'ReviewList', 'Badge', 'PhotoTiles', 'IconRows', 'Carousel', 'Resizable', 'ScrollArea'];
8
8
  export type SlotName = (typeof SLOT_NAMES)[number];
9
9
  /**
10
10
  * What is wrong with a value offered as a kit, each as the rest of a sentence that begins with the kit's name ("the
@@ -35,9 +35,25 @@ export const SLOT_NAMES = [
35
35
  'Tabs',
36
36
  'Pagination',
37
37
  'Avatar',
38
+ 'Field',
39
+ 'TextArea',
40
+ 'FileField',
41
+ 'ValidMark',
42
+ 'HelpTip',
43
+ 'ProgressBar',
44
+ 'StepHeader',
45
+ 'ActionBar',
46
+ 'Columns',
47
+ 'ReviewList',
48
+ 'Badge',
49
+ 'PhotoTiles',
50
+ 'IconRows',
51
+ 'Carousel',
52
+ 'Resizable',
53
+ 'ScrollArea',
38
54
  ];
39
- /* The parts that share one state of their own: a kit that drew a menu's items but not its menu would hand Base UI's
40
- items a menu they cannot find. */
55
+ /* The parts that share one state of their own: a kit that drew a menu's items but not its menu would hand the
56
+ platform's items a menu they cannot find. */
41
57
  const FAMILIES = [['DropMenu', 'DropGroup', 'DropItem', 'DropSeparator']];
42
58
  const isSlot = (name) => SLOT_NAMES.includes(name);
43
59
  /* The slot a misspelled name was meant to be: one letter's case, or two edits, away. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mistriwork/ui",
3
- "version": "1.0.0-rc.57",
4
- "description": "The standalone React primitives both shells are drawn with: Modal, DropMenu, Dropdown, Typeahead, Button, Field, Icon and DateField over Base UI, Switch, Tabs, Drawer, Popover, Avatar, Pagination, Carousel, Resizable, ScrollArea and Tooltip, the form controls built on them (text, masked, money and sensitive boxes, listboxes, choices, slider, progress and action bar; Preview), the landing hero's blocks (badge, photo tiles, icon rows; Preview), their tokens and stylesheet, and the zoom-aware ruler their popups are placed by.",
3
+ "version": "1.0.0-rc.59",
4
+ "description": "The standalone React primitives both shells are drawn with: Modal, DropMenu, Dropdown, Typeahead, Button, Field, Icon and DateField over UI SDK, Switch, Tabs, Drawer, Popover, Avatar, Pagination, Carousel, Resizable, ScrollArea and Tooltip, the form controls built on them (text, masked, money and sensitive boxes, listboxes, choices, slider, progress and action bar; Preview), the landing hero's blocks (badge, photo tiles, icon rows; Preview), their tokens and stylesheet, and the zoom-aware ruler their popups are placed by.",
5
5
  "homepage": "https://mistriwork.dev",
6
6
  "bugs": {
7
7
  "url": "https://github.com/rbaljinder/mistri/issues"
@@ -26,6 +26,7 @@
26
26
  "default": "./dist/index.js"
27
27
  },
28
28
  "./Avatar.js": "./dist/Avatar.js",
29
+ "./behaviors/index.js": "./dist/behaviors/index.js",
29
30
  "./Button.js": "./dist/Button.js",
30
31
  "./Carousel.js": "./dist/Carousel.js",
31
32
  "./Choices.js": "./dist/Choices.js",
@@ -53,14 +54,11 @@
53
54
  "./Tabs.js": "./dist/Tabs.js",
54
55
  "./Typeahead.js": "./dist/Typeahead.js",
55
56
  "./Tooltip.js": "./dist/Tooltip.js",
56
- "./internal/anchor.js": "./dist/internal/anchor.js",
57
57
  "./internal/datePickerModel.js": "./dist/internal/datePickerModel.js",
58
- "./forms.css": "./dist/forms.css",
59
- "./hero.css": "./dist/hero.css",
58
+ "./controls.css": "./dist/controls.css",
59
+ "./behaviors.css": "./dist/behaviors.css",
60
60
  "./preferences.css": "./dist/preferences.css",
61
61
  "./internal/popups.js": "./dist/internal/popups.js",
62
- "./primitives.css": "./dist/primitives.css",
63
- "./standalone.css": "./dist/standalone.css",
64
62
  "./internal/ruler.js": "./dist/internal/ruler.js",
65
63
  "./style.css": "./dist/style.css",
66
64
  "./tokens.css": "./dist/tokens.css",
@@ -70,19 +68,23 @@
70
68
  "./package.json": "./package.json"
71
69
  },
72
70
  "peerDependencies": {
73
- "@base-ui/react": "^1.8.0",
71
+ "@ui-sdk/core": "0.1.0-beta.2",
72
+ "@ui-sdk/react": "0.1.0-beta.2",
74
73
  "react": "^19.2.0",
75
74
  "react-dom": "^19.2.0"
76
75
  },
77
76
  "peerDependenciesMeta": {
78
- "@base-ui/react": {
79
- "optional": true
80
- },
81
77
  "react": {
82
78
  "optional": true
83
79
  },
84
80
  "react-dom": {
85
81
  "optional": true
82
+ },
83
+ "@ui-sdk/core": {
84
+ "optional": true
85
+ },
86
+ "@ui-sdk/react": {
87
+ "optional": true
86
88
  }
87
89
  },
88
90
  "engines": {
package/dist/forms.css DELETED
@@ -1,225 +0,0 @@
1
- /* @mistriwork/ui's form controls (TextField, MaskedField, SensitiveField, Select, Choices, Slider, FormParts), apart
2
- from primitives.css: a page that draws none of them does not pay for their rules at its first paint. style.css
3
- takes this file with the rest; a shell that layers primitives.css itself (the kit's) loads this one beside the
4
- first control it draws. */
5
-
6
- /* The form controls (TextField, MaskedField, SensitiveField, Select, Choices, Slider, FormParts). They wear the
7
- field's own box above (`field-control`), so a theme that sets --field-fill, --control-h, --control-border-w or
8
- --field-radius restyles every one of them together, and the label above is the Field's. */
9
- /* Read, not drawn: a group whose question is the heading above it. */
10
- .form-field-label-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
11
- /* The problem's line stays in the flow while empty, so a problem that arrives moves nothing below it. */
12
- .form-field-reserve > .form-field-problem { min-height: calc(var(--text-sm) * 1.45); }
13
- /* A consent: a paragraph beside its box, in the body's weight. */
14
- .form-field-consent .form-field-label { font-size: var(--text-sm); font-weight: 400; line-height: 1.45; }
15
- .field-check { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
16
- .field-check:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
17
-
18
- /* A text box and the mark at its inline end. The room for the mark is the box's from the start (has-mark), so the
19
- check arriving moves no text. Decorative: validity is aria-invalid's to say. */
20
- .field-box { position: relative; display: flex; align-items: center; min-width: 0; }
21
- .field-box.has-mark > .field-control { padding-inline-end: calc(var(--space-3h) + 16px + var(--space-3)); }
22
- .field-mark { position: absolute; inset-inline-end: var(--space-3h); display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--status-good); color: var(--surface); pointer-events: none; }
23
- .field-mark:empty::after { content: ""; width: 4px; height: 8px; margin-top: calc(-1 * var(--space-1)); border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); }
24
- .field-mark > svg { width: 100%; height: 100%; }
25
- .field-control::placeholder { color: var(--ink-subtle); }
26
- .field-hidden { letter-spacing: 0.08em; }
27
- /* Show beside the box, never inside it. */
28
- .field-with-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-3); }
29
- .field-note { display: flex; align-items: center; gap: var(--space-3); margin: 0; font-size: var(--text-sm); line-height: 1.45; color: var(--ink-muted); }
30
- .field-note > svg { flex: none; width: 14px; height: 14px; }
31
-
32
- /* The file field (FileField.tsx): the kit's button and the chosen names, over the browser's input, which is clipped, not
33
- removed, so the label names it and Tab and Enter reach it. Its focus is drawn on the button, the control a sighted
34
- reader sees. A field's control is one control tall, whatever the button inside it. */
35
- .field-file { position: relative; display: flex; align-items: center; gap: var(--space-3); min-width: 0; min-height: var(--control-h); }
36
- .field-file-input { position: absolute; inset-block-start: 0; inset-inline-start: 0; width: 1px; height: 1px; margin: 0; opacity: 0; overflow: hidden; clip-path: inset(50%); }
37
- .field-file-input:focus-visible ~ .field-file-button { outline: var(--focus-width, 2px) solid var(--focus); outline-offset: 2px; }
38
- .field-file-button { flex: none; }
39
- .field-file-names { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-base); color: var(--ink); }
40
- .field-file-names.is-none { color: var(--ink-muted); }
41
-
42
- /* The form's listbox is the Dropdown dressed as a field box. */
43
- .dd-button.field-select { min-height: var(--control-h); border-width: var(--control-border-w); padding: var(--space-2h) var(--space-3h); font: inherit; font-size: var(--text-base); background: var(--field-fill); border-radius: var(--field-radius, var(--radius)); text-align: start; }
44
- .dd-button.field-select[aria-invalid="true"] { border-color: var(--status-critical); }
45
- .dd-button.field-select:is([disabled], [aria-disabled="true"]) { background: var(--raised); color: var(--ink-muted); cursor: not-allowed; }
46
- .dd-value.is-empty { color: var(--ink-muted); }
47
- .dd-list.field-list .dd-label { font: var(--text-base) var(--sans); }
48
- .dd-list-multi .dd-option.selected .dd-label { color: var(--ink); font-weight: inherit; }
49
- .dd-box { position: relative; flex: none; width: 16px; height: 16px; margin-top: var(--space-1); box-sizing: border-box; border: 1px solid var(--line-control); border-radius: 3px; background: var(--surface); }
50
- .dd-option.selected .dd-box { border-color: var(--accent); background: var(--accent); }
51
- .dd-option.selected .dd-box::after { content: ""; position: absolute; inset: 1px 0 0; margin: auto; width: 4px; height: 8px; border: solid var(--on-accent); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
52
-
53
- /* Choices: one answer is native radios, hidden, with their faces drawn, and the ring shows on the face when the
54
- keyboard is on the input; several cards are each a face that takes the focus itself (CheckCards). A host may dress
55
- them through the --choice-* roles — a quiet form draws a card at rest as its well, with an edge only once chosen
56
- or in focus (formDress.css) — and each falls back to the field's own box here. */
57
- .choice-input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
58
- .choice-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
59
- .choice-pick, .choice-card {
60
- position: relative; box-sizing: border-box; display: flex; align-items: center; min-height: var(--control-h);
61
- border: var(--control-border-w) solid var(--choice-edge, var(--line-control)); border-radius: var(--field-radius, var(--radius));
62
- background: var(--choice-well, var(--field-fill)); color: var(--ink); font-size: var(--text-base); cursor: pointer;
63
- transition: border-color var(--t-hover) var(--ease-out), background-color var(--t-hover) var(--ease-out), box-shadow var(--t-hover) var(--ease-out);
64
- }
65
- .choice-pick { justify-content: center; padding: 0 var(--space-4); }
66
- .choice-card { gap: var(--space-3h); padding: var(--space-3) var(--space-4); min-height: max(var(--control-h), 48px); }
67
- @media (hover: hover) {
68
- .choice-pick:hover, .choice-card:hover { border-color: var(--choice-edge-hover, color-mix(in srgb, var(--line-control) 60%, var(--ink))); background-color: var(--choice-well-hover, var(--field-fill)); }
69
- }
70
- /* On is a thicker edge drawn outside the box, not a wider border, so choosing moves nothing. */
71
- .choice-pick.is-on, .choice-card.is-on { border-color: var(--choice-on, var(--accent)); box-shadow: 0 0 0 1px var(--choice-on, var(--accent)); background: var(--choice-on-well, var(--accent-soft)); }
72
- /* A button that is picked has no square to say so, so its face carries it: the host's picked well where it names one
73
- (--choice-pick-on-well: a quiet form, whose --choice-on-well is its field's own fill), and heavier words. */
74
- .choice-pick.is-on { background: var(--choice-pick-on-well, var(--choice-on-well, var(--accent-soft))); font-weight: 600; }
75
- .choice-pick:has(.choice-input:focus-visible), .choice-card:has(.choice-input:focus-visible), .choice-card:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
76
- .choice-card[aria-disabled="true"] { cursor: not-allowed; opacity: 0.6; }
77
- .choice-cards { display: flex; flex-direction: column; gap: var(--space-3); }
78
- .choice-card-icon { display: inline-flex; flex: none; color: var(--accent-ink); }
79
- .choice-card-icon > svg { width: 22px; height: 22px; }
80
- .choice-card-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
81
- .choice-card-help { display: block; color: var(--ink-muted); font-size: var(--text-sm); }
82
- .choice-box { position: relative; flex: none; box-sizing: border-box; width: 18px; height: 18px; border: 1.5px solid var(--line-control); border-radius: 3px; background: var(--surface); }
83
- .choice-card.is-on .choice-box { border-color: var(--choice-check, var(--accent)); background: var(--choice-check, var(--accent)); }
84
- .choice-card.is-on .choice-box::after { content: ""; position: absolute; inset: 1px 0 0; margin: auto; width: 4px; height: 8px; border: solid var(--choice-on-check, var(--on-accent)); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
85
- /* One answer's card says so with a radio's round mark and its dot; several answers' keep the square and its tick, as
86
- a native radio and checkbox would. Read off the input the card holds, so every host's cards agree. */
87
- .choice-card:has(> .choice-input[type="radio"]) > .choice-box { border-radius: 50%; }
88
- .choice-card.is-on:has(> .choice-input[type="radio"]) > .choice-box::after { inset: 0; width: 6px; height: 6px; border: 0; border-radius: 50%; background: var(--choice-on-check, var(--on-accent)); transform: none; }
89
-
90
- /* The slider: the readout in a field box, the native range under it. */
91
- .field-readout { display: flex; align-items: center; }
92
- .field-range { --range-share: 0%; width: 100%; height: 22px; margin: var(--space-3) 0 0; padding: 0; background: transparent; appearance: none; -webkit-appearance: none; cursor: pointer; }
93
- .field-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) 0 var(--range-share), var(--line) var(--range-share) 100%); }
94
- .field-range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; /* off-scale: centres the 18px thumb on the 4px track, (4 - 18) / 2 */ border: 0; border-radius: 50%; background: var(--accent); }
95
- .field-range::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line); }
96
- .field-range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
97
- .field-range::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); }
98
- .field-range:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
99
- .field-range:disabled { cursor: not-allowed; opacity: 0.5; }
100
- .field-range-ends { display: flex; justify-content: space-between; font-size: var(--text-xs); line-height: 1.45; color: var(--ink-muted); }
101
-
102
- /* The help tip. */
103
- .help-tip { position: relative; display: inline-flex; }
104
- .help-tip-button { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; padding: 0; border: 1px solid var(--ink-muted); border-radius: 50%; background: transparent; color: var(--ink-muted); font: italic 700 10px/1 var(--sans); cursor: pointer; box-shadow: none; }
105
- .help-tip-button::after { content: ""; position: absolute; inset: -8px; }
106
- .help-tip-button > svg { width: 100%; height: 100%; }
107
- .help-tip-button:focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
108
- .help-tip-text {
109
- position: absolute; inset-inline-start: 0; top: calc(100% + var(--space-3)); z-index: 30; width: min(240px, 80vw);
110
- padding: var(--space-3) var(--space-3h); border: 1px solid var(--line-strong); border-radius: var(--radius-pop);
111
- background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop);
112
- font-size: var(--text-sm); font-weight: 400; line-height: 1.45; text-transform: none; letter-spacing: normal;
113
- }
114
- @media (prefers-reduced-motion: no-preference) {
115
- .help-tip-text { transform-origin: top left; transition: opacity var(--t-popover) var(--ease-out), transform var(--t-popover) var(--ease-out); @starting-style { opacity: 0; transform: scale(0.96) translateY(-4px); } }
116
- }
117
-
118
- /* The progress bar: a track and its fill. The fill is not animated: it is information that changes often. */
119
- .progress-bar { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
120
- .progress-bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
121
-
122
- /* A step's heading and lead. */
123
- .step-header { display: grid; gap: var(--space-3); }
124
- .step-title { margin: 0; font-size: var(--type-record-title); font-weight: var(--heading-weight); line-height: 1.15; letter-spacing: var(--track-title); color: var(--ink); }
125
- .step-mark { display: inline-block; margin-inline-end: var(--space-4); }
126
- .step-lead { margin: 0; font-size: var(--text-md); line-height: 1.45; color: var(--ink-muted); }
127
-
128
- /* The bar at the foot of its container: sticky, so it stays in the container it belongs to and the page keeps its sidebar. */
129
- .action-bar { position: sticky; bottom: 0; z-index: 2; display: flex; gap: var(--space-4); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); background: var(--surface); }
130
- .action-bar-back { flex: 0 0 33%; }
131
- .action-bar-primary { flex: 1; min-width: 0; }
132
-
133
- /* Fields side by side; a row stacks where its fields no longer fit. */
134
- .form-columns { display: grid; grid-template-columns: var(--form-columns, repeat(auto-fit, minmax(min(100%, 9rem), 1fr))); gap: var(--space-4); align-items: start; }
135
- @media (max-width: 22rem) { .form-columns { grid-template-columns: minmax(0, 1fr); } }
136
- .review-list { display: grid; gap: var(--field-gap); }
137
-
138
- /* A short choice (up to five words, none with a description) is a row of buttons that wraps, not a stack of cards:
139
- five 48px cards took 270px to say five words. Each is a pick, so it wears the field's own box; the row never
140
- scrolls sideways, it wraps whole picks onto the next line. */
141
- .choice-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }
142
- .choice-row > .choice-pick { gap: var(--space-3); }
143
- .choice-pick-icon { display: inline-flex; flex: none; color: var(--accent-ink); }
144
- .choice-pick-icon > svg { width: 16px; height: 16px; }
145
-
146
- /* A theme's recipes for a form (themeRecipes.ts: required, checkbox, formStep, actionBar). Their rules are here, not
147
- in a first stylesheet: they draw nothing a page without a control has. */
148
-
149
- /* required: the star is primitives.css's; this one says the other word instead. The word stands beside the label
150
- (Field's optionalWord), so the label's name is the same under either recipe, and it is drawn only here. */
151
- .form-field-label-row > .form-field-label { min-width: 0; overflow-wrap: anywhere; }
152
- .form-field-optional-word { display: none; font-size: var(--text-sm); font-weight: 400; line-height: 1.35; color: var(--ink-muted); }
153
- [data-look-required="optional-word"] .form-field-optional-word { display: inline; }
154
- [data-look-required="optional-word"] .form-field.is-required > .form-field-label::after { content: none; }
155
-
156
- /* checkbox: drawn. The native input stays (the keyboard, the name, the ring), with its own face taken off and
157
- the field's drawn on: its fill, the control's edge, and a corner no rounder than a third of the box, since a
158
- 10px field corner on an 18px box is a circle. On is the accent with a check in its ink. */
159
- [data-look-checkbox="drawn"] :is(.field-check, .form-field-check-row > input[type="checkbox"]) {
160
- appearance: none; -webkit-appearance: none; display: inline-grid; place-content: center; box-sizing: border-box;
161
- background: var(--field-fill); border: var(--control-border-w) solid var(--line-control);
162
- border-radius: min(var(--field-radius, var(--radius)), 6px); cursor: pointer;
163
- transition: background-color var(--t-hover) var(--ease-out), border-color var(--t-hover) var(--ease-out);
164
- }
165
- [data-look-checkbox="drawn"] :is(.field-check, .form-field-check-row > input[type="checkbox"])::after {
166
- content: ""; width: 4px; height: 8px; border: solid var(--on-accent); border-width: 0 2px 2px 0;
167
- transform: translateY(-1px) rotate(45deg); opacity: 0;
168
- }
169
- [data-look-checkbox="drawn"] :is(.field-check, .form-field-check-row > input[type="checkbox"]):checked { background: var(--accent); border-color: var(--accent); }
170
- [data-look-checkbox="drawn"] :is(.field-check, .form-field-check-row > input[type="checkbox"]):checked::after { opacity: 1; }
171
- [data-look-checkbox="drawn"] :is(.field-check, .form-field-check-row > input[type="checkbox"]):focus-visible { outline: var(--focus-width) solid var(--focus); outline-offset: var(--focus-offset); }
172
- [data-look-checkbox="drawn"] :is(.field-check, .form-field-check-row > input[type="checkbox"]):disabled { background: var(--raised); border-color: var(--line); cursor: not-allowed; }
173
- @media (forced-colors: active) {
174
- [data-look-checkbox="drawn"] :is(.field-check, .form-field-check-row > input[type="checkbox"]) { border: 1px solid ButtonText; }
175
- [data-look-checkbox="drawn"] :is(.field-check, .form-field-check-row > input[type="checkbox"]):checked { background: Highlight; border-color: Highlight; }
176
- [data-look-checkbox="drawn"] :is(.field-check, .form-field-check-row > input[type="checkbox"]):checked::after { border-color: HighlightText; }
177
- }
178
-
179
- /* formStep: ruled puts a hairline under a step's header. actionBar: raised stands the sticky bar on the surface with a
180
- soft lift (the theme's own shadow colour, upward since the bar is at the foot) in place of the hairline over it. */
181
- [data-look-form-step="ruled"] .intake-head { padding-bottom: var(--space-4); border-bottom: 1px solid var(--line); }
182
- [data-look-action-bar="raised"] :is(.intake-actions, .action-bar) {
183
- background: var(--surface); border-top-color: transparent;
184
- box-shadow: 0 -6px 18px color-mix(in srgb, var(--shadow-ink, black) 12%, transparent);
185
- }
186
-
187
- /* A control stands level at the theme's height (--control-h): the date field's input and the Button primitive with the
188
- rest (the field box and the listbox read it above). */
189
- .date-field .date-field-input { box-sizing: border-box; min-height: var(--control-h); border-width: var(--control-border-w); background: var(--field-fill); border-radius: var(--field-radius, var(--radius)); }
190
-
191
- /* Mobile. */
192
- /* No double-tap-to-zoom delay on what is tapped, and no grey flash over it: the browser's highlight is replaced by
193
- the house press (--t-press, the button gives a little and a link dims), so a tap is still answered. */
194
- :is(button, a, input, select, textarea, summary, [role="button"], [role="switch"], [role="tab"], [role="option"], [role="menuitem"]) {
195
- touch-action: manipulation; -webkit-tap-highlight-color: transparent;
196
- }
197
- a:active { opacity: 0.7; }
198
- @media (prefers-reduced-motion: no-preference) {
199
- .btn { transition: transform var(--t-press) var(--ease-out); }
200
- .btn:not(:disabled, [aria-disabled="true"]):active, .choice-pick:active, .choice-card:active { transform: scale(0.97); }
201
- }
202
- /* A finger needs 44px (WCAG 2.5.5) whatever height the theme draws, through the density's zoom (--row-h does the same):
203
- under any coarse pointer, and at a phone's width, where a narrow window on a desk is read as a phone is (grade measures
204
- the targets at 390px with no touch). A compact button stays compact: it is the one a toolbar asks for. */
205
- @media (pointer: coarse), (max-width: 40rem) {
206
- /* A form's listbox may be the shell's (.form-field .dd-button) rather than @mistriwork/ui's Select: the same field, so the
207
- same height as the box beside it in a row. */
208
- .field-control, .dd-button.field-select, .form-field .dd-button, .choice-pick, .choice-card, .date-field .date-field-input, .btn:not(.btn-compact) {
209
- min-height: max(var(--control-h), calc(44px / var(--density-zoom, 1)));
210
- }
211
- /* The calendar's button is the input's own height, not two pixels short of it on each side, and wide enough to be hit. */
212
- .date-field .date-field-input {
213
- padding-inline-end: calc(44px / var(--density-zoom, 1));
214
- }
215
- .date-field .date-field-trigger {
216
- inset: 0 0 0 auto;
217
- width: calc(44px / var(--density-zoom, 1));
218
- }
219
- }
220
- @media (pointer: coarse) {
221
- /* iOS Safari zooms the page when a field under 16px is focused, and does not zoom back. The density zoom only
222
- enlarges (1, 1.12, 1.24), so a flat 16px is at least 16px drawn. Not verified on WebKit: it is not installed
223
- where this was written, so a real iPhone is the test of this rule. */
224
- input, select, textarea, .field-control, .dd-button.field-select, .form-field .dd-button, .date-field .date-field-input { font-size: max(16px, var(--text-base)); }
225
- }
package/dist/hero.css DELETED
@@ -1,23 +0,0 @@
1
- /* @mistriwork/ui's hero blocks (Badge, PhotoTiles, IconRows), apart from primitives.css and forms.css: a page that draws
2
- none of them does not pay for their rules. style.css takes this file with the rest; a shell that layers its own
3
- sheets (the kit's landing, mistri's landingHero.css) imports it into the layer it wants. */
4
-
5
- /* The badge: the author's few words in a chip over the heading (the look's corner), in the accent's
6
- quiet tint so it reads as a note on the page, never as a button. */
7
- .front-badge {
8
- justify-self: start; display: inline-flex; align-items: center; gap: var(--space-2h); margin: 0; padding: var(--space-2) var(--space-4);
9
- border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink);
10
- font: 500 var(--text-sm) var(--sans);
11
- }
12
- .front-badge svg { color: var(--accent-ink); flex: none; }
13
- /* Icon rows: each an icon in the accent and a line in the muted ink, stacked with air between. */
14
- .front-points { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); color: var(--ink-muted); font: 400 var(--text-base) var(--sans); }
15
- .front-points li { display: flex; align-items: flex-start; gap: var(--space-3); }
16
- .front-points svg { color: var(--accent-ink); flex: none; margin-top: var(--space-1); }
17
- /* Tiles: the one photo's 4:3 box cut into a mosaic, so it is sized before any photo arrives. Two side by side; three
18
- with the first tall on the left; four in a square grid. */
19
- .front-hero-tiles { display: grid; gap: var(--space-2); background: none; border-radius: 0; grid-template-columns: 1fr 1fr; }
20
- .front-hero-tiles img { border-radius: var(--radius); background: var(--raised); min-height: 0; }
21
- .front-hero-tiles-3 { grid-template-rows: 1fr 1fr; }
22
- .front-hero-tiles-3 img:first-child { grid-row: 1 / span 2; }
23
- .front-hero-tiles-4 { grid-template-rows: 1fr 1fr; }
@@ -1,19 +0,0 @@
1
- interface VirtualAnchor {
2
- getBoundingClientRect: () => DOMRect;
3
- contextElement: Element;
4
- }
5
- export declare function zoomAnchor(element: Element): VirtualAnchor;
6
- /**
7
- * The viewport, in the same layout pixels the anchor reports, for the
8
- * positioner's collision boundary — so "is there room below" is answered
9
- * on the ruler the anchor was measured with. Positioners retain this object
10
- * across viewport resizes without re-rendering their owning control, so read
11
- * its dimensions when collision detection runs, not when JSX was rendered.
12
- */
13
- export declare function layoutViewport(): {
14
- x: number;
15
- y: number;
16
- width: number;
17
- height: number;
18
- };
19
- export {};
@@ -1,52 +0,0 @@
1
- /**
2
- * An anchor for Base UI's positioners, measured with the house ruler.
3
- *
4
- * The density preference puts a `zoom` on the root, so a box measured with
5
- * getBoundingClientRect comes back in screen pixels while a `top` set on a
6
- * positioned element inside the root is scaled on its way back — measured
7
- * with one ruler, placed with the other, a list landed a room away from
8
- * its trigger. Floating UI corrects for transforms on an offset parent but
9
- * not for a zoom on the root, so the anchor it is handed is a virtual
10
- * element that reports the trigger's box already divided by the zoom
11
- * (ruler.ts `viewportBox`), and every coordinate it derives is a layout
12
- * pixel the browser scales back exactly once.
13
- */
14
- import { viewportBox, viewportSize } from './ruler.js';
15
- export function zoomAnchor(element) {
16
- return {
17
- contextElement: element,
18
- getBoundingClientRect: () => {
19
- const b = viewportBox(element);
20
- return {
21
- x: b.left,
22
- y: b.top,
23
- top: b.top,
24
- left: b.left,
25
- right: b.right,
26
- bottom: b.bottom,
27
- width: b.width,
28
- height: b.height,
29
- toJSON: () => b,
30
- };
31
- },
32
- };
33
- }
34
- /**
35
- * The viewport, in the same layout pixels the anchor reports, for the
36
- * positioner's collision boundary — so "is there room below" is answered
37
- * on the ruler the anchor was measured with. Positioners retain this object
38
- * across viewport resizes without re-rendering their owning control, so read
39
- * its dimensions when collision detection runs, not when JSX was rendered.
40
- */
41
- export function layoutViewport() {
42
- return {
43
- x: 0,
44
- y: 0,
45
- get width() {
46
- return viewportSize().width;
47
- },
48
- get height() {
49
- return viewportSize().height;
50
- },
51
- };
52
- }