@kanso-labs/kanso-ui 0.44.1 → 0.45.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 (127) hide show
  1. package/README.md +59 -7
  2. package/dist/chip/index.js +24 -4
  3. package/dist/chip/index.js.map +1 -1
  4. package/dist/chip/styles.js +13 -5
  5. package/dist/chip/styles.js.map +1 -1
  6. package/dist/components/app-bar/index.d.ts +14 -2
  7. package/dist/components/app-bar/index.js +36 -7
  8. package/dist/components/app-bar/index.js.map +1 -1
  9. package/dist/components/autocomplete/index.d.ts +44 -0
  10. package/dist/components/autocomplete/index.js +44 -0
  11. package/dist/components/autocomplete/index.js.map +1 -1
  12. package/dist/components/button/index.d.ts +3 -2
  13. package/dist/components/button/index.js +53 -59
  14. package/dist/components/button/index.js.map +1 -1
  15. package/dist/components/card/index.d.ts +11 -3
  16. package/dist/components/card/index.js +23 -1
  17. package/dist/components/card/index.js.map +1 -1
  18. package/dist/components/checkbox/index.js +65 -58
  19. package/dist/components/checkbox/index.js.map +1 -1
  20. package/dist/components/chip/index.d.ts +46 -30
  21. package/dist/components/chip/index.js +38 -17
  22. package/dist/components/chip/index.js.map +1 -1
  23. package/dist/components/chip-group/index.d.ts +5 -2
  24. package/dist/components/chip-group/index.js +8 -2
  25. package/dist/components/chip-group/index.js.map +1 -1
  26. package/dist/components/dialog/index.d.ts +27 -0
  27. package/dist/components/dialog/index.js +81 -37
  28. package/dist/components/dialog/index.js.map +1 -1
  29. package/dist/components/fab/index.d.ts +1 -1
  30. package/dist/components/fab/index.js.map +1 -1
  31. package/dist/components/form/index.d.ts +14 -4
  32. package/dist/components/form/index.js +6 -3
  33. package/dist/components/form/index.js.map +1 -1
  34. package/dist/components/icon-button/index.d.ts +15 -1
  35. package/dist/components/icon-button/index.js +15 -1
  36. package/dist/components/icon-button/index.js.map +1 -1
  37. package/dist/components/link/index.d.ts +4 -0
  38. package/dist/components/link/index.js +4 -0
  39. package/dist/components/link/index.js.map +1 -1
  40. package/dist/components/list/index.d.ts +34 -0
  41. package/dist/components/list/index.js +47 -13
  42. package/dist/components/list/index.js.map +1 -1
  43. package/dist/components/list-detail/index.d.ts +34 -1
  44. package/dist/components/list-detail/index.js +34 -1
  45. package/dist/components/list-detail/index.js.map +1 -1
  46. package/dist/components/list-item/index.d.ts +21 -2
  47. package/dist/components/list-item/index.js +6 -0
  48. package/dist/components/list-item/index.js.map +1 -1
  49. package/dist/components/menu/index.d.ts +6 -3
  50. package/dist/components/menu/index.js +3 -1
  51. package/dist/components/menu/index.js.map +1 -1
  52. package/dist/components/meter/index.d.ts +4 -0
  53. package/dist/components/meter/index.js +4 -0
  54. package/dist/components/meter/index.js.map +1 -1
  55. package/dist/components/navigation-bar/index.d.ts +14 -2
  56. package/dist/components/navigation-bar/index.js +14 -2
  57. package/dist/components/navigation-bar/index.js.map +1 -1
  58. package/dist/components/navigation-tree/index.js +2 -9
  59. package/dist/components/navigation-tree/index.js.map +1 -1
  60. package/dist/components/number-field/index.d.ts +7 -1
  61. package/dist/components/number-field/index.js +7 -1
  62. package/dist/components/number-field/index.js.map +1 -1
  63. package/dist/components/popover/index.d.ts +15 -1
  64. package/dist/components/popover/index.js +15 -1
  65. package/dist/components/popover/index.js.map +1 -1
  66. package/dist/components/product-icon/index.d.ts +8 -1
  67. package/dist/components/product-icon/index.js +8 -1
  68. package/dist/components/product-icon/index.js.map +1 -1
  69. package/dist/components/progress-indicator/index.d.ts +12 -6
  70. package/dist/components/progress-indicator/index.js +57 -46
  71. package/dist/components/progress-indicator/index.js.map +1 -1
  72. package/dist/components/radio-group/index.d.ts +7 -0
  73. package/dist/components/radio-group/index.js +23 -14
  74. package/dist/components/radio-group/index.js.map +1 -1
  75. package/dist/components/search-field/index.d.ts +13 -4
  76. package/dist/components/search-field/index.js +10 -4
  77. package/dist/components/search-field/index.js.map +1 -1
  78. package/dist/components/search-view/index.d.ts +2 -0
  79. package/dist/components/search-view/index.js.map +1 -1
  80. package/dist/components/segmented-button/index.d.ts +1 -1
  81. package/dist/components/segmented-button/index.js.map +1 -1
  82. package/dist/components/separator/index.d.ts +31 -6
  83. package/dist/components/separator/index.js +30 -6
  84. package/dist/components/separator/index.js.map +1 -1
  85. package/dist/components/sheet/index.d.ts +96 -37
  86. package/dist/components/sheet/index.js +420 -136
  87. package/dist/components/sheet/index.js.map +1 -1
  88. package/dist/components/snackbar/index.d.ts +8 -1
  89. package/dist/components/snackbar/index.js +7 -0
  90. package/dist/components/snackbar/index.js.map +1 -1
  91. package/dist/components/stack/index.d.ts +21 -5
  92. package/dist/components/stack/index.js +10 -0
  93. package/dist/components/stack/index.js.map +1 -1
  94. package/dist/components/switch/index.d.ts +12 -0
  95. package/dist/components/switch/index.js +12 -0
  96. package/dist/components/switch/index.js.map +1 -1
  97. package/dist/components/text-field/index.d.ts +39 -9
  98. package/dist/components/text-field/index.js +29 -7
  99. package/dist/components/text-field/index.js.map +1 -1
  100. package/dist/components/tree/index.js +11 -15
  101. package/dist/components/tree/index.js.map +1 -1
  102. package/dist/hooks/useBottomEdge.js +6 -3
  103. package/dist/hooks/useBottomEdge.js.map +1 -1
  104. package/dist/hooks/useRipple.js +216 -192
  105. package/dist/hooks/useRipple.js.map +1 -1
  106. package/dist/i18n/index.js +1 -0
  107. package/dist/i18n/index.js.map +1 -1
  108. package/dist/i18n/messages.js +34 -0
  109. package/dist/i18n/messages.js.map +1 -1
  110. package/dist/index.d.ts +2 -2
  111. package/dist/indicator/styles.js +7 -4
  112. package/dist/indicator/styles.js.map +1 -1
  113. package/dist/mark/styles.js +11 -5
  114. package/dist/mark/styles.js.map +1 -1
  115. package/dist/react-aria.d.ts +2 -2
  116. package/dist/row/index.js +90 -62
  117. package/dist/row/index.js.map +1 -1
  118. package/dist/row/styles.js +6 -1
  119. package/dist/row/styles.js.map +1 -1
  120. package/dist/styles/focus.js.map +1 -1
  121. package/dist/styles/overlay.js +8 -0
  122. package/dist/styles/overlay.js.map +1 -1
  123. package/dist/styles.css +135 -114
  124. package/dist/theme-scope.d.ts +14 -2
  125. package/dist/theme-scope.js +12 -0
  126. package/dist/theme-scope.js.map +1 -1
  127. package/package.json +3 -3
package/README.md CHANGED
@@ -98,14 +98,28 @@ needs around them come from this package too: `I18nProvider` and
98
98
  the `useFilter`, `useListData`, `useTreeData` and `useAsyncList` hooks,
99
99
  `useDragAndDrop` with `useDrag`, `useDrop`, the drop item guards and
100
100
  `DIRECTORY_DRAG_TYPE`, `useLocale`, `parseColor` and `getColorChannels`,
101
- `TokenFieldValue`, and the `Key`, `Selection`, `SortDescriptor` and `PressEvent`
102
- types.
101
+ `TokenFieldValue`, and the `Key`, `Selection`, `SortDescriptor`, `PressEvent`,
102
+ `HoverEvent`, `KeyboardEvent` and `FocusableElement` types.
103
+
104
+ `KeyboardEvent` is React Aria's, which is React's with `continuePropagation()`
105
+ added. It is what `onKeyDown` and `onKeyUp` take on the fields and controls
106
+ React Aria handles the keyboard for: `TextField`, `Select`, `Checkbox`,
107
+ `Switch`, `Chip` and the rest. `Button`, `IconButton`, `Fab` and `Link` hand
108
+ those handlers React's own, as does a component that renders a plain element,
109
+ such as `Card`. `onHoverStart` and `onHoverEnd` take `HoverEvent` wherever a
110
+ component has them.
103
111
 
104
112
  A virtualized collection needs to be told how tall its rows are, and
105
113
  `collectionSizes` is what the collections here measure — `listRow`, `menuRow`,
106
114
  `tableRow` and the rest — so a `Virtualizer`'s `layoutOptions` take a number the
107
115
  components agree with rather than one guessed at the call site.
108
116
 
117
+ The collection inside a `Virtualizer` is its own scroll container, so give the
118
+ `List` itself its height and `overflow-y: auto`, through `className` or `style`.
119
+ React Aria sizes a page of Page Up and Page Down from the collection's own box,
120
+ so one left to grow to its full height inside a scrolling wrapper is one page
121
+ long, and the keys jump from one end of it to the other.
122
+
109
123
  ```tsx
110
124
  import { I18nProvider, useListData } from '@kanso-labs/kanso-ui'
111
125
  ```
@@ -162,11 +176,42 @@ names React Aria gives sit behind `clearLabel`, `closeLabel` and the rest.
162
176
  Numbers follow the provider too: `Currency` writes its amount, and a field its
163
177
  character count, in the locale's digits and grouping.
164
178
 
165
- A bundler includes every language unless told which ones the app supports. React
166
- Aria's
179
+ A bundler includes every language React Aria ships unless told which ones the
180
+ app supports.
167
181
  [`@react-aria/optimize-locales-plugin`](https://www.npmjs.com/package/@react-aria/optimize-locales-plugin)
168
- is how an app says so for React Aria's own tables. This package's table is one
169
- small module, included whole.
182
+ is how an app says so. Install it as a development dependency and give it the
183
+ locales the app hands `I18nProvider`. Under Next.js with Turbopack, which needs
184
+ Next.js 15.4 or newer, its rules spread into `turbopack.rules`:
185
+
186
+ ```ts
187
+ // next.config.ts
188
+ import optimizeLocales from '@react-aria/optimize-locales-plugin'
189
+
190
+ const locales = optimizeLocales.turbopack({ locales: ['en-US', 'de-DE'] })
191
+
192
+ export default {
193
+ turbopack: { rules: { ...locales.rules } },
194
+ }
195
+ ```
196
+
197
+ The object is left untyped because the plugin types `locales` as a read-only
198
+ array, which `NextConfig` does not accept, so `const config: NextConfig` fails
199
+ Next.js's type check over the same rules. Under Vite it is a plugin:
200
+
201
+ ```ts
202
+ // vite.config.ts
203
+ import optimizeLocales from '@react-aria/optimize-locales-plugin'
204
+ import { defineConfig } from 'vite'
205
+
206
+ export default defineConfig({
207
+ plugins: [optimizeLocales.vite({ locales: ['en-US', 'de-DE'] })],
208
+ })
209
+ ```
210
+
211
+ React Aria's strings for every other locale then build to nothing. The plugin's
212
+ own README covers webpack, Rollup and esbuild. It reaches React Aria's tables
213
+ alone: this package's strings are one module holding every locale, included
214
+ whole wherever a component uses it.
170
215
 
171
216
  ### Layout
172
217
 
@@ -178,7 +223,7 @@ otherwise be bespoke CSS in every consuming app:
178
223
  ```tsx
179
224
  <Container>
180
225
  <Stack gap="xl">
181
- <Stack align="center" direction="row" justify="between">
226
+ <Stack align="center" direction="row" gap="sm" justify="between" wrap>
182
227
  <Text variant="titleLarge">Headline</Text>
183
228
  <Button>Save changes</Button>
184
229
  </Stack>
@@ -608,6 +653,13 @@ a `transform` or a `filter` makes a sheet's scrim cover that ancestor rather
608
653
  than the viewport, and `overflow: hidden` clips a popover — so put the scope
609
654
  around such an element rather than inside it.
610
655
 
656
+ The overlays' container is one more child of the scope's element, after
657
+ everything the scope renders. It takes up no room, but selectors that count
658
+ children count it: inside the scope, the last element you render is not
659
+ `:last-child` and is counted wrong by `:nth-last-child()`, a lone child is not
660
+ `:only-child`, and an empty scope is not `:empty`. Key a rule like that on a
661
+ class of your own, or put the scope around the element whose children it counts.
662
+
611
663
  `themeScope` is the same thing as a class name, for an element you render
612
664
  yourself. Overlays opened under it still portal to the body and keep the page's
613
665
  tokens, since nothing tells them otherwise.
@@ -51,6 +51,21 @@ function chipGlyph(state, icon, selectable = true) {
51
51
  function chipLabel(children) {
52
52
  return /* @__PURE__ */ jsx(ChipLabel, { children });
53
53
  }
54
+ /**
55
+ * What a chip draws after its label: its trailing icon, in the 18dp slot the
56
+ * leading one takes, trimming the chip's padding at its own end instead. It
57
+ * keeps the chip's content colour, which is the page's trailing icon role in
58
+ * every state, and it stays while the chip is selected, since the check
59
+ * takes the leading slot alone. Nothing at all for a chip with none. Beside
60
+ * `chipGlyph` so the two slots are drawn from one box.
61
+ */
62
+ function chipTrailingIcon(icon) {
63
+ if (icon === void 0 || icon === null) return null;
64
+ return /* @__PURE__ */ jsx("span", {
65
+ ...props(chipStyles.glyph, chipStyles.trailing),
66
+ children: icon
67
+ });
68
+ }
54
69
  const CONTAINERS = {
55
70
  elevated: {
56
71
  disabled: chipStyles.elevatedDisabled,
@@ -85,13 +100,18 @@ const CONTAINERS = {
85
100
  *
86
101
  * `elevated` raises the chip off the page on a container of its own, and
87
102
  * `kind` names which of the page's chips it is, which decides the label's
88
- * role. `inert` marks a chip a press does nothing to, which draws the arrow
89
- * rather than the pointer.
103
+ * role and whether a flat selected chip lifts under a hovering pointer: a
104
+ * filter chip does and an input chip, a group's removable one, does not. A
105
+ * hover's lift gives way while the chip is pressed, since a mouse press does
106
+ * not end the hover.
107
+ * `inert` marks a chip a press does nothing to, which draws the arrow rather
108
+ * than the pointer.
90
109
  */
91
110
  function chipPropsFor(state, { elevated = false, inert = false, kind = "filter" } = {}) {
92
111
  const roles = CONTAINERS[containerOf(state.isSelected, elevated)];
93
112
  const raised = elevated && !state.isDisabled;
94
- return props(chipStyles.base, inert && chipStyles.inert, chipStyles.target, focus.ring, state.isSelected ? chipStyles.selected : chipStyles.unselected, elevated && !state.isSelected && chipStyles.elevated, kind === "assist" && chipStyles.assist, raised && chipStyles.raised, state.isHovered && roles.hovered, raised && state.isHovered && chipStyles.raisedHovered, state.isFocusVisible && roles.focused, state.isPressed && roles.pressed, state.isDisabled && chipStyles.disabled, state.isDisabled && roles.disabled);
113
+ const lifted = state.isHovered && !state.isPressed;
114
+ return props(chipStyles.base, inert && chipStyles.inert, chipStyles.target, focus.ring, state.isSelected ? chipStyles.selected : chipStyles.unselected, elevated && !state.isSelected && chipStyles.elevated, kind === "assist" && chipStyles.assist, raised && chipStyles.raised, state.isHovered && roles.hovered, raised && lifted && chipStyles.raisedHovered, kind === "filter" && !elevated && state.isSelected && lifted && chipStyles.selectedHovered, state.isFocusVisible && roles.focused, state.isPressed && roles.pressed, state.isDisabled && chipStyles.disabled, state.isDisabled && roles.disabled);
95
115
  }
96
116
  /**
97
117
  * The close target's class, from its button's own render state, so its
@@ -108,6 +128,6 @@ function containerOf(isSelected, elevated) {
108
128
  return elevated ? "elevated" : "unselected";
109
129
  }
110
130
  //#endregion
111
- export { chipGlyph, chipLabel, chipPropsFor, chipRemoveClassName };
131
+ export { chipGlyph, chipLabel, chipPropsFor, chipRemoveClassName, chipTrailingIcon };
112
132
 
113
133
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ReactNode","stylex","CheckGlyph","focus","ChipLabel","chipLayers","chipStyles","chipGlyph","state","isDisabled","isSelected","icon","selectable","hasIcon","undefined","props","glyph","glyphOpening","glyphFolded","glyphSvg","chipLabel","children","CONTAINERS","elevated","disabled","elevatedDisabled","focused","elevatedFocused","hovered","elevatedHovered","pressed","elevatedPressed","selected","disabledSelected","selectedFocused","selectedHovered","selectedPressed","unselected","disabledUnselected","unselectedFocused","unselectedHovered","unselectedPressed","ChipKind","chipPropsFor","isFocusVisible","isHovered","isPressed","inert","kind","roles","containerOf","raised","base","target","ring","assist","raisedHovered","chipRemoveClassName","remove","removeHovered","removePressed","removeDisabled","className","stylex.props"],"sources":["../../src/chip/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckGlyph } from '../glyphs';\nimport { focus } from '../styles/focus';\nimport { ChipLabel } from './label';\nimport { chipLayers, chipStyles } from './styles';\n\n/**\n * What a chip draws before its label: the check while it is selected, its own\n * icon while it is not, and for an unselected chip with no icon, a slot folded\n * to nothing that opens when it is selected. A chip that can never be selected\n * passes `selectable` as false and draws nothing there. Returns a node rather\n * than letting the type be inferred, since `ReactNode` is a union that\n * includes a promise and an inferred one has to be `async`.\n *\n * The check takes the icon's place rather than joining it, as the chips page\n * draws a filter chip and as a segmented button's segments do. So a chip with\n * an icon keeps its width when it is chosen, where one without grows by the\n * slot, and the slot is kept mounted while folded so that growth has a width\n * to transition from; see the header of `./styles`.\n *\n * Shared rather than written at each of the two call sites: Chip and\n * ChipGroup's chip draw the same pill from `./styles`, and a check written\n * twice is the drift that module exists to stop. Not a component of the\n * library's own and not exported from the package; see `src/row` for the\n * same arrangement around a list's row.\n */\nfunction chipGlyph(state: {\n isDisabled: boolean;\n isSelected: boolean;\n}, icon?: ReactNode, selectable = true): ReactNode {\n const hasIcon = icon !== undefined && icon !== null;\n if (!hasIcon && (selectable || state.isSelected)) {\n return <span {...stylex.props(chipStyles.glyph, chipStyles.glyphOpening, !state.isSelected && chipStyles.glyphFolded)}>\n <CheckGlyph {...stylex.props(chipStyles.glyphSvg)} />\n </span>;\n }\n if (state.isSelected) {\n return <span {...stylex.props(chipStyles.glyph)}>\n <CheckGlyph {...stylex.props(chipStyles.glyphSvg)} />\n </span>;\n }\n if (!hasIcon) {\n return null;\n }\n return <span {...stylex.props(chipStyles.glyph, !state.isDisabled && chipStyles.icon)}>\n {icon}\n </span>;\n}\n\n/**\n * The label a chip draws, in a span of its own so it can be cut short with an\n * ellipsis rather than wrapped out of the pill; see the header of `./styles`.\n * A label cut short shows its full text in the browser's tooltip on hover —\n * see `useClippedTitle`. Shared for the reason `chipGlyph` is, by all three\n * components that draw the pill.\n */\nfunction chipLabel(children: ReactNode): ReactNode {\n return <ChipLabel>{children}</ChipLabel>;\n}\n\n// The three containers a chip can be on, with the layers and the disabled\n// treatment each takes. A table rather than a branch per state, so the\n// containers cannot differ in which states they answer.\nconst CONTAINERS = {\n elevated: {\n disabled: chipStyles.elevatedDisabled,\n focused: chipLayers.elevatedFocused,\n hovered: chipLayers.elevatedHovered,\n pressed: chipLayers.elevatedPressed\n },\n selected: {\n disabled: chipStyles.disabledSelected,\n focused: chipLayers.selectedFocused,\n hovered: chipLayers.selectedHovered,\n pressed: chipLayers.selectedPressed\n },\n unselected: {\n disabled: chipStyles.disabledUnselected,\n focused: chipLayers.unselectedFocused,\n hovered: chipLayers.unselectedHovered,\n pressed: chipLayers.unselectedPressed\n }\n};\n\n/** Which of the page's chips a pill is drawn as. */\ntype ChipKind = 'assist' | 'filter' | 'suggestion';\n\n/**\n * The pill's styles in the render state React Aria hands a chip's\n * `className`, for Chip's two buttons and ChipGroup's tag alike. StyleX\n * cannot target `[data-selected]` on the element it is styling, so the\n * container is chosen here rather than in CSS — which is also why an\n * uncontrolled chip styles itself without keeping a copy of its state.\n *\n * Shared for the reason `chipGlyph` is: the order is the precedence. The\n * hover, focus and pressed layers come from the render state over the\n * container — focus over hover, and a press over both — and disabled comes\n * last so it wins over all of them, since StyleX replaces a property whole.\n *\n * `elevated` raises the chip off the page on a container of its own, and\n * `kind` names which of the page's chips it is, which decides the label's\n * role. `inert` marks a chip a press does nothing to, which draws the arrow\n * rather than the pointer.\n */\nfunction chipPropsFor(state: {\n isDisabled: boolean;\n isFocusVisible: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n}, {\n elevated = false,\n inert = false,\n kind = 'filter'\n}: {\n elevated?: boolean;\n inert?: boolean;\n kind?: ChipKind;\n} = {}) {\n const roles = CONTAINERS[containerOf(state.isSelected, elevated)];\n const raised = elevated && !state.isDisabled;\n return stylex.props(chipStyles.base, inert && chipStyles.inert, chipStyles.target, focus.ring, state.isSelected ? chipStyles.selected : chipStyles.unselected, elevated && !state.isSelected && chipStyles.elevated, kind === 'assist' && chipStyles.assist, raised && chipStyles.raised, state.isHovered && roles.hovered, raised && state.isHovered && chipStyles.raisedHovered, state.isFocusVisible && roles.focused, state.isPressed && roles.pressed, state.isDisabled && chipStyles.disabled, state.isDisabled && roles.disabled);\n}\n\n/**\n * The close target's class, from its button's own render state, so its\n * hover and pressed layers follow React Aria's report rather than `:hover`\n * and `:active` — see `chipLayers` — and a disabled chip's close target\n * takes the chip's cursor. A function, which React Aria's `className` takes\n * alongside a string.\n */\nfunction chipRemoveClassName(state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n}) {\n return stylex.props(chipStyles.remove, state.isHovered && chipLayers.removeHovered, state.isPressed && chipLayers.removePressed, state.isDisabled && chipStyles.removeDisabled).className ?? '';\n}\n\n// Which container a chip is on: the secondary container while selected,\n// elevated or not, and otherwise the elevated one or the outline.\nfunction containerOf(isSelected: boolean, elevated: boolean) {\n if (isSelected) {\n return 'selected';\n }\n return elevated ? 'elevated' : 'unselected';\n}\nexport type { ChipKind };\nexport { chipGlyph, chipLabel, chipPropsFor, chipRemoveClassName };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAASO,UAAUC,OAGhBG,MAAkBC,aAAa,MAAiB;CACjD,MAAMC,UAAUF,SAASG,KAAAA,KAAaH,SAAS;CAC/C,IAAI,CAACE,YAAYD,cAAcJ,MAAME,aACnC,OAAO,oBAAC,QAAD;EA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aJ,WAAW0B,WAAW1B,WAAW+B,YAAYd,YAAY,CAACf,MAAME,cAAcJ,WAAWiB,UAAUyB,SAAS,YAAY1C,WAAWiD,QAAQJ,UAAU7C,WAAW6C,QAAQ3C,MAAMqC,aAAaI,MAAMrB,SAASuB,UAAU3C,MAAMqC,aAAavC,WAAWkD,eAAehD,MAAMoC,kBAAkBK,MAAMvB,SAASlB,MAAMsC,aAAaG,MAAMnB,SAAStB,MAAMC,cAAcH,WAAWkB,UAAUhB,MAAMC,cAAcwC,MAAMzB,QAAQ;AACzgB;;;;;;;;AASA,SAASiC,oBAAoBjD,OAI1B;CACD,OAAOP,MAAaK,WAAWoD,QAAQlD,MAAMqC,aAAaxC,WAAWsD,eAAenD,MAAMsC,aAAazC,WAAWuD,eAAepD,MAAMC,cAAcH,WAAWuD,cAAc,CAAC,CAACC,aAAa;AAC/L;AAIA,SAASZ,YAAYxC,YAAqBa,UAAmB;CAC3D,IAAIb,YACF,OAAO;CAET,OAAOa,WAAW,aAAa;AACjC"}
1
+ {"version":3,"file":"index.js","names":["ReactNode","stylex","CheckGlyph","focus","ChipLabel","chipLayers","chipStyles","chipGlyph","state","isDisabled","isSelected","icon","selectable","hasIcon","undefined","props","glyph","glyphOpening","glyphFolded","glyphSvg","chipLabel","children","chipTrailingIcon","trailing","CONTAINERS","elevated","disabled","elevatedDisabled","focused","elevatedFocused","hovered","elevatedHovered","pressed","elevatedPressed","selected","disabledSelected","selectedFocused","selectedHovered","selectedPressed","unselected","disabledUnselected","unselectedFocused","unselectedHovered","unselectedPressed","ChipKind","chipPropsFor","isFocusVisible","isHovered","isPressed","inert","kind","roles","containerOf","raised","lifted","base","target","ring","assist","raisedHovered","chipRemoveClassName","remove","removeHovered","removePressed","removeDisabled","className","stylex.props"],"sources":["../../src/chip/index.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckGlyph } from '../glyphs';\nimport { focus } from '../styles/focus';\nimport { ChipLabel } from './label';\nimport { chipLayers, chipStyles } from './styles';\n\n/**\n * What a chip draws before its label: the check while it is selected, its own\n * icon while it is not, and for an unselected chip with no icon, a slot folded\n * to nothing that opens when it is selected. A chip that can never be selected\n * passes `selectable` as false and draws nothing there. Returns a node rather\n * than letting the type be inferred, since `ReactNode` is a union that\n * includes a promise and an inferred one has to be `async`.\n *\n * The check takes the icon's place rather than joining it, as the chips page\n * draws a filter chip and as a segmented button's segments do. So a chip with\n * an icon keeps its width when it is chosen, where one without grows by the\n * slot, and the slot is kept mounted while folded so that growth has a width\n * to transition from; see the header of `./styles`.\n *\n * Shared rather than written at each of the two call sites: Chip and\n * ChipGroup's chip draw the same pill from `./styles`, and a check written\n * twice is the drift that module exists to stop. Not a component of the\n * library's own and not exported from the package; see `src/row` for the\n * same arrangement around a list's row.\n */\nfunction chipGlyph(state: {\n isDisabled: boolean;\n isSelected: boolean;\n}, icon?: ReactNode, selectable = true): ReactNode {\n const hasIcon = icon !== undefined && icon !== null;\n if (!hasIcon && (selectable || state.isSelected)) {\n return <span {...stylex.props(chipStyles.glyph, chipStyles.glyphOpening, !state.isSelected && chipStyles.glyphFolded)}>\n <CheckGlyph {...stylex.props(chipStyles.glyphSvg)} />\n </span>;\n }\n if (state.isSelected) {\n return <span {...stylex.props(chipStyles.glyph)}>\n <CheckGlyph {...stylex.props(chipStyles.glyphSvg)} />\n </span>;\n }\n if (!hasIcon) {\n return null;\n }\n return <span {...stylex.props(chipStyles.glyph, !state.isDisabled && chipStyles.icon)}>\n {icon}\n </span>;\n}\n\n/**\n * The label a chip draws, in a span of its own so it can be cut short with an\n * ellipsis rather than wrapped out of the pill; see the header of `./styles`.\n * A label cut short shows its full text in the browser's tooltip on hover —\n * see `useClippedTitle`. Shared for the reason `chipGlyph` is, by all three\n * components that draw the pill.\n */\nfunction chipLabel(children: ReactNode): ReactNode {\n return <ChipLabel>{children}</ChipLabel>;\n}\n\n/**\n * What a chip draws after its label: its trailing icon, in the 18dp slot the\n * leading one takes, trimming the chip's padding at its own end instead. It\n * keeps the chip's content colour, which is the page's trailing icon role in\n * every state, and it stays while the chip is selected, since the check\n * takes the leading slot alone. Nothing at all for a chip with none. Beside\n * `chipGlyph` so the two slots are drawn from one box.\n */\nfunction chipTrailingIcon(icon?: ReactNode): ReactNode {\n if (icon === undefined || icon === null) {\n return null;\n }\n return <span {...stylex.props(chipStyles.glyph, chipStyles.trailing)}>{icon}</span>;\n}\n\n// The three containers a chip can be on, with the layers and the disabled\n// treatment each takes. A table rather than a branch per state, so the\n// containers cannot differ in which states they answer.\nconst CONTAINERS = {\n elevated: {\n disabled: chipStyles.elevatedDisabled,\n focused: chipLayers.elevatedFocused,\n hovered: chipLayers.elevatedHovered,\n pressed: chipLayers.elevatedPressed\n },\n selected: {\n disabled: chipStyles.disabledSelected,\n focused: chipLayers.selectedFocused,\n hovered: chipLayers.selectedHovered,\n pressed: chipLayers.selectedPressed\n },\n unselected: {\n disabled: chipStyles.disabledUnselected,\n focused: chipLayers.unselectedFocused,\n hovered: chipLayers.unselectedHovered,\n pressed: chipLayers.unselectedPressed\n }\n};\n\n/** Which of the page's chips a pill is drawn as. */\ntype ChipKind = 'assist' | 'filter' | 'input' | 'suggestion';\n\n/**\n * The pill's styles in the render state React Aria hands a chip's\n * `className`, for Chip's two buttons and ChipGroup's tag alike. StyleX\n * cannot target `[data-selected]` on the element it is styling, so the\n * container is chosen here rather than in CSS — which is also why an\n * uncontrolled chip styles itself without keeping a copy of its state.\n *\n * Shared for the reason `chipGlyph` is: the order is the precedence. The\n * hover, focus and pressed layers come from the render state over the\n * container — focus over hover, and a press over both — and disabled comes\n * last so it wins over all of them, since StyleX replaces a property whole.\n *\n * `elevated` raises the chip off the page on a container of its own, and\n * `kind` names which of the page's chips it is, which decides the label's\n * role and whether a flat selected chip lifts under a hovering pointer: a\n * filter chip does and an input chip, a group's removable one, does not. A\n * hover's lift gives way while the chip is pressed, since a mouse press does\n * not end the hover.\n * `inert` marks a chip a press does nothing to, which draws the arrow rather\n * than the pointer.\n */\nfunction chipPropsFor(state: {\n isDisabled: boolean;\n isFocusVisible: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n}, {\n elevated = false,\n inert = false,\n kind = 'filter'\n}: {\n elevated?: boolean;\n inert?: boolean;\n kind?: ChipKind;\n} = {}) {\n const roles = CONTAINERS[containerOf(state.isSelected, elevated)];\n const raised = elevated && !state.isDisabled;\n const lifted = state.isHovered && !state.isPressed;\n return stylex.props(chipStyles.base, inert && chipStyles.inert, chipStyles.target, focus.ring, state.isSelected ? chipStyles.selected : chipStyles.unselected, elevated && !state.isSelected && chipStyles.elevated, kind === 'assist' && chipStyles.assist, raised && chipStyles.raised, state.isHovered && roles.hovered, raised && lifted && chipStyles.raisedHovered, kind === 'filter' && !elevated && state.isSelected && lifted && chipStyles.selectedHovered, state.isFocusVisible && roles.focused, state.isPressed && roles.pressed, state.isDisabled && chipStyles.disabled, state.isDisabled && roles.disabled);\n}\n\n/**\n * The close target's class, from its button's own render state, so its\n * hover and pressed layers follow React Aria's report rather than `:hover`\n * and `:active` — see `chipLayers` — and a disabled chip's close target\n * takes the chip's cursor. A function, which React Aria's `className` takes\n * alongside a string.\n */\nfunction chipRemoveClassName(state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n}) {\n return stylex.props(chipStyles.remove, state.isHovered && chipLayers.removeHovered, state.isPressed && chipLayers.removePressed, state.isDisabled && chipStyles.removeDisabled).className ?? '';\n}\n\n// Which container a chip is on: the secondary container while selected,\n// elevated or not, and otherwise the elevated one or the outline.\nfunction containerOf(isSelected: boolean, elevated: boolean) {\n if (isSelected) {\n return 'selected';\n }\n return elevated ? 'elevated' : 'unselected';\n}\nexport type { ChipKind };\nexport { chipGlyph, chipLabel, chipPropsFor, chipRemoveClassName, chipTrailingIcon };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAASO,UAAUC,OAGhBG,MAAkBC,aAAa,MAAiB;CACjD,MAAMC,UAA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ca7",
30
30
  $$css: true
31
31
  },
32
32
  disabled: {
33
- kMwMTN: "x1xj74d8 x1bhcspo",
33
+ kMwMTN: "x1gpw424 x1bhcspo",
34
34
  kkrTdU: "x1h6gzvc",
35
35
  $$css: true
36
36
  },
37
37
  disabledSelected: {
38
- kWkggS: "xepofeg",
38
+ kWkggS: "x19v6zzp",
39
39
  $$css: true
40
40
  },
41
41
  disabledUnselected: {
@@ -49,7 +49,7 @@ const chipStyles = {
49
49
  $$css: true
50
50
  },
51
51
  elevatedDisabled: {
52
- kWkggS: "xepofeg",
52
+ kWkggS: "x19v6zzp",
53
53
  kVAM5u: "x9r1u3d",
54
54
  kGVxlE: "x1gnnqk1",
55
55
  $$css: true
@@ -103,7 +103,6 @@ const chipStyles = {
103
103
  },
104
104
  raised: {
105
105
  kGVxlE: "x19efjv6",
106
- k1ekBW: "xu8237s",
107
106
  $$css: true
108
107
  },
109
108
  raisedHovered: {
@@ -150,6 +149,10 @@ const chipStyles = {
150
149
  kMwMTN: "x1sawysd",
151
150
  $$css: true
152
151
  },
152
+ selectedHovered: {
153
+ kGVxlE: "x19efjv6",
154
+ $$css: true
155
+ },
153
156
  surfaceCorners: {
154
157
  kaIpWk: "x5a2xki",
155
158
  kB7OPa: "x9f619",
@@ -164,6 +167,11 @@ const chipStyles = {
164
167
  kVAEAm: "x1n2onr6",
165
168
  $$css: true
166
169
  },
170
+ trailing: {
171
+ k71WvV: "x1kfc2zf",
172
+ keTefX: "x1lziwak",
173
+ $$css: true
174
+ },
167
175
  unselected: {
168
176
  kWkggS: "xjbqb8w",
169
177
  kVAM5u: "x133yhug",
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","names":["stylex","colors","motion","radii","shadows","sizing","spacing","stateLayerOpacity","typography","TARGET_SIZE","FORCED_COLORS","chipStyles","assist","kMwMTN","$$css","base","k6CgDc","kGNEyG","kZKoxP","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kmuXW","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","ks0D6T","k8WAf4","kg3NbH","kIyJzY","k1ekBW","kAMwcw","disabled","disabledSelected","kWkggS","disabledUnselected","kVAM5u","elevated","elevatedDisabled","kGVxlE","glyph","kzqmXN","kjj79g","keTefX","glyphFolded","k71WvV","kSiTet","glyphOpening","kVQacm","glyphSvg","icon","inert","label","kg5iWk","khDVqt","raised","raisedHovered","remove","kgeoSG","kFcpXp","kEoFBp","kjBf7l","kInvED","k3XXqK","kMeerF","kmVPX3","kVAEAm","removeDisabled","removeGlyph","selected","surfaceCorners","target","kGOzcv","kpsdNU","unselected","chipLayers","elevatedFocused","elevatedHovered","elevatedPressed","removeHovered","removePressed","selectedFocused","selectedHovered","selectedPressed","unselectedFocused","unselectedHovered","unselectedPressed"],"sources":["../../src/chip/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, motion, radii, shadows, sizing, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The pill the chips page draws, shared by the three components that draw\n// one: Chip, which is a toggle on its own or one of the page's two action\n// chips; ChipGroup's chip, which is one of a set that can also be removed;\n// and TokenField's token, which takes `base` and `unselected` alone — a token\n// is not selectable, so it reaches for neither the selected container nor\n// the check below. The measurements and roles are the page's filter chip — a\n// 32dp container with an 8dp corner and 16dp of inline padding, an outline\n// variant border while unselected, the secondary container pair once\n// selected.\n//\n// The assist and suggestion chips are that unselected pill, never selected.\n// The page's only difference between them is the label: on surface on an\n// assist chip, on surface variant on a suggestion chip as on a filter one.\n//\n// **An elevated chip trades the outline for a container**, surface container\n// low at the page's elevation 1, raised to 2 under a hovering pointer. A\n// selected one keeps the secondary container and takes the shadow with it.\n// Its 1px border stays, transparent, as every chip's does: a forced-colours\n// mode paints a transparent border in its text colour and drops the shadow\n// and the fill, so the border is the boundary left there.\n//\n// **A label with no room on one line is cut short, never wrapped.** The\n// container is a fixed 32dp, so a second line has nowhere to go but out of\n// the pill: a chip or a token in a room narrower than its label drew the\n// rest below its own edge, and a chip in a group's row ran past the row's\n// end instead. The pill is held to the room it is in, and the label sits in\n// a span of its own that ends in an ellipsis where the pill does — a span,\n// because a flex container ignores `text-overflow`, which is also why\n// Material's own chips carry one. The whole label stays in the DOM, so a\n// screen reader still reads all of it.\n//\n// Each state composites an on-colour over its own container at the\n// interaction state's opacity rather than swapping in a separate hover\n// colour. `calc(<opacity> * 100%)` turns the token's unitless 0-1 ratio into\n// the percentage `color-mix()` takes, and it is inlined at each property\n// because @stylexjs/babel-plugin only statically recognises expressions\n// written directly as property values.\n//\n// The selected chip drops its border rather than recolouring it: it has a\n// container of its own to define its edge, and a border on top of that reads\n// as a second, competing outline.\n//\n// Disabled is applied from render state rather than from `:disabled`. Chip is\n// a button and would match the pseudo-class; a chip in a group is React\n// Aria's `Tag`, which is a div and never will. One mechanism serves both, and\n// StyleX replaces a property whole, so the disabled styles take the hover and\n// pressed branches of whichever state they are applied over.\n//\n// A selected chip carries the page's check before its label, which is what\n// makes the selection legible without colour. The two containers differ in\n// colour alone, and under a scheme whose secondary container sits close to\n// the surface — or for a reader who does not see colour — that is no\n// difference at all.\n//\n// The chip widens when the check appears, and that is the page's behaviour\n// rather than a cost of drawing it: a chip is flow content, laid out in a\n// row that wraps, so nothing around it has a width to hold. A segmented\n// button's segments are equal columns of one track, which is a different\n// geometry answering a different question, and the two should not be read\n// across. A chip given an icon does not widen, since the check takes the\n// icon's place in the same slot.\n//\n// **The widening is animated rather than taken in one frame.** A chip with\n// no icon keeps its slot mounted while unselected, folded to nothing, and\n// selecting it opens the slot over the chip's own short duration while the\n// check fades in, so the chips after it in a wrapped row glide rather than\n// jump 18dp. Reduced motion takes the change at once, as it does the\n// colours. A chip that can never be selected, an assist or suggestion chip\n// or one in a group that does not select, has no slot to open.\n//\n// **The press ripple takes the chip's corner from here** wherever the chip\n// is a ChipGroup's. The ripple clips itself to its host's corner by\n// inheriting it, and React Aria puts a cell between a group's chip and its\n// content, so what the ripple would inherit is the cell's square corner.\n// `surfaceCorners` restates the chip's own corner on a box the ripple sits\n// in, less the 1px border every chip keeps, since the ripple fills the\n// inside of that border.\n//\n// Apart from any component so a chip in a group and a chip on its own cannot\n// drift; see `src/row` for the same arrangement around a list's row.\n\n// The press area the chips page requires around its 32dp chip. A literal for\n// the reason IconButton's `TARGET_SIZE` gives.\nconst TARGET_SIZE = '48px';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst chipStyles = {\n assist: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n base: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xig8zya\",\n kaIpWk: \"x1xdvaa9\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n ks0D6T: \"x193iq5w\",\n k8WAf4: \"xt970qd\",\n kg3NbH: \"x790zyz\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x1eaenvl\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n disabled: {\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n disabledSelected: {\n kWkggS: \"xepofeg\",\n $$css: true\n },\n disabledUnselected: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"xrh88j3 xmnqt3w\",\n $$css: true\n },\n elevated: {\n kWkggS: \"x1vnz5z6\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n elevatedDisabled: {\n kWkggS: \"xepofeg\",\n kVAM5u: \"x9r1u3d\",\n kGVxlE: \"x1gnnqk1\",\n $$css: true\n },\n glyph: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xmix8c7\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kGuDYH: \"xosj86m\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n keTefX: \"xxuhe3a\",\n $$css: true\n },\n glyphFolded: {\n kzqmXN: \"xnalus7\",\n k71WvV: \"x1kfc2zf\",\n keTefX: \"x1lziwak\",\n kSiTet: \"xg01cxk\",\n $$css: true\n },\n glyphOpening: {\n k6CgDc: \"x12w9bfk\",\n kVQacm: \"xb3r6kr\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x17vvy08\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n glyphSvg: {\n kZKoxP: \"xmix8c7\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n icon: {\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n inert: {\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n label: {\n kB7OPa: \"x9f619\",\n kVQacm: \"xb3r6kr\",\n kg5iWk: \"xlyipyv\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n },\n raised: {\n kGVxlE: \"x19efjv6\",\n k1ekBW: \"xu8237s\",\n $$css: true\n },\n raisedHovered: {\n kGVxlE: \"x1os83gw\",\n $$css: true\n },\n remove: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"xtu493u\",\n kEoFBp: \"x1hmns74\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n k71WvV: \"x1kfc2zf\",\n kjBf7l: \"x14ytart\",\n kInvED: \"x1y3gkto\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n kmVPX3: \"x1717udv\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n removeDisabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n removeGlyph: {\n kZKoxP: \"xmix8c7\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n selected: {\n kWkggS: \"x15dekr4\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n surfaceCorners: {\n kaIpWk: \"x5a2xki\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"xjp7ctv\",\n $$css: true\n },\n target: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1xkszu9\",\n kpsdNU: \"x1ecwmwu\",\n kEoFBp: \"x1hmns74\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n unselected: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"x133yhug\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n }\n};\n\n// The hover and pressed layers, applied from React Aria's render state rather\n// than from `:hover` and `:active`, for Button's reasons — see its header: a\n// hover layer stayed on after a tap, and no pressed layer showed for a press\n// made from the keyboard. One pair per container, the pressed after the\n// hovered so a press wins, and one for the close target, whose own render\n// state is its button's. A token in a TokenField draws none of them: React\n// Aria reports neither state for one, since it is text the caret moves\n// through rather than a control a press acts on.\nconst chipLayers = {\n elevatedFocused: {\n kWkggS: \"x1drsm1c\",\n $$css: true\n },\n elevatedHovered: {\n kWkggS: \"x1ei6177\",\n $$css: true\n },\n elevatedPressed: {\n kWkggS: \"x1vt8e7r\",\n $$css: true\n },\n removeHovered: {\n kWkggS: \"x930l3l\",\n $$css: true\n },\n removePressed: {\n kWkggS: \"xsykwg8\",\n $$css: true\n },\n selectedFocused: {\n kWkggS: \"x1s5x49g\",\n $$css: true\n },\n selectedHovered: {\n kWkggS: \"x1fctxn6\",\n $$css: true\n },\n selectedPressed: {\n kWkggS: \"xzpauq9\",\n $$css: true\n },\n unselectedFocused: {\n kWkggS: \"xwqhyid\",\n $$css: true\n },\n unselectedHovered: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n },\n unselectedPressed: {\n kWkggS: \"xjeeohs\",\n $$css: true\n }\n};\nexport { chipLayers, chipStyles };"],"mappings":";AA8FA,MAAMW,aAAa;CACjBC,QAAQ;EACNC,QAAQ;EACRC,OAAO;CACT;CACAC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRvB,OAAO;CACT;CACAwB,UAAU;EACRzB,QAAQ;EACRU,QAAQ;EACRT,OAAO;CACT;CACAyB,kBAAkB;EAChBC,QAAQ;EACR1B,OAAO;CACT;CACA2B,oBAAoB;EAClBD,QAAQ;EACRE,QAAQ;EACR5B,OAAO;CACT;CACA6B,UAAU;EACRH,QAAQ;EACRE,QAAQ;EACR5B,OAAO;CACT;CACA8B,kBAAkB;EAChBJ,QAAQ;EACRE,QAAQ;EACRG,QAAQ;EACR/B,OAAO;CACT;CACAgC,OAAO;EACL7B,QAAQ;EACRC,QAAQ;EACRM,QAAQ;EACRC,OAAO;EACPE,QAAQ;EACRoB,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRnC,OAAO;CACT;CACAoC,aAAa;EACXH,QAAQ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AQ;EACR7B,QAAQ;EACRC,OAAO;CACT;AACF;AAUA,MAAMmE,aAAa;CACjBC,iBAAiB;EACf1C,QAAQ;EACR1B,OAAO;CACT;CACAqE,iBAAiB;EACf3C,QAAQ;EACR1B,OAAO;CACT;CACAsE,iBAAiB;EACf5C,QAAQ;EACR1B,OAAO;CACT;CACAuE,eAAe;EACb7C,QAAQ;EACR1B,OAAO;CACT;CACAwE,eAAe;EACb9C,QAAQ;EACR1B,OAAO;CACT;CACAyE,iBAAiB;EACf/C,QAAQ;EACR1B,OAAO;CACT;CACA0E,iBAAiB;EACfhD,QAAQ;EACR1B,OAAO;CACT;CACA2E,iBAAiB;EACfjD,QAAQ;EACR1B,OAAO;CACT;CACA4E,mBAAmB;EACjBlD,QAAQ;EACR1B,OAAO;CACT;CACA6E,mBAAmB;EACjBnD,QAAQ;EACR1B,OAAO;CACT;CACA8E,mBAAmB;EACjBpD,QAAQ;EACR1B,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"styles.js","names":["stylex","colors","motion","radii","shadows","sizing","spacing","stateLayerOpacity","typography","TARGET_SIZE","FORCED_COLORS","chipStyles","assist","kMwMTN","$$css","base","k6CgDc","kGNEyG","kZKoxP","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kmuXW","kMv6JI","kGuDYH","k63SB2","kOIVth","kb6lSQ","kLWn49","ks0D6T","k8WAf4","kg3NbH","kIyJzY","k1ekBW","kAMwcw","disabled","disabledSelected","kWkggS","disabledUnselected","kVAM5u","elevated","elevatedDisabled","kGVxlE","glyph","kzqmXN","kjj79g","keTefX","glyphFolded","k71WvV","kSiTet","glyphOpening","kVQacm","glyphSvg","icon","inert","label","kg5iWk","khDVqt","raised","raisedHovered","remove","kgeoSG","kFcpXp","kEoFBp","kjBf7l","kInvED","k3XXqK","kMeerF","kmVPX3","kVAEAm","removeDisabled","removeGlyph","selected","selectedHovered","surfaceCorners","target","kGOzcv","kpsdNU","trailing","unselected","chipLayers","elevatedFocused","elevatedHovered","elevatedPressed","removeHovered","removePressed","selectedFocused","selectedPressed","unselectedFocused","unselectedHovered","unselectedPressed"],"sources":["../../src/chip/styles.ts"],"sourcesContent":["import * as stylex from '@stylexjs/stylex';\nimport '../tokens/design.tokens.stylex';\nimport { colors, motion, radii, shadows, sizing, spacing, stateLayerOpacity, typography } from '../tokens/design.tokens.stylex';\n\n// The pill the chips page draws, shared by the three components that draw\n// one: Chip, which is a toggle on its own or one of the page's two action\n// chips; ChipGroup's chip, which is one of a set that can also be removed;\n// and TokenField's token, which takes `base` and `unselected` alone — a token\n// is not selectable, so it reaches for neither the selected container nor\n// the check below. The measurements and roles are the page's filter chip — a\n// 32dp container with an 8dp corner and 16dp of inline padding, an outline\n// variant border while unselected, the secondary container pair once\n// selected.\n//\n// The assist and suggestion chips are that unselected pill, never selected.\n// The page's only difference between them is the label: on surface on an\n// assist chip, on surface variant on a suggestion chip as on a filter one.\n//\n// **An elevated chip trades the outline for a container**, surface container\n// low at the page's elevation 1, raised to 2 under a hovering pointer and\n// back to 1 while pressed, since a mouse press does not end the hover. A\n// selected one keeps the secondary container and takes the shadow with it.\n// Its 1px border stays, transparent, as every chip's does: a forced-colours\n// mode paints a transparent border in its text colour and drops the shadow\n// and the fill, so the border is the boundary left there.\n//\n// **A flat chip lies on the page, apart from one state.** A selected filter\n// chip under a hovering pointer rises to elevation 1, and comes back down\n// while pressed, as the page's filter chip tokens give it; every other flat\n// state, and every state of an input chip, stays at 0.\n//\n// **A disabled chip is translucent**, its content at 38% and its container at\n// 12% of on surface over whatever is behind it, as the page gives them,\n// rather than mixed into the surface. Mixed into the surface, a disabled chip\n// on a coloured container drew an opaque pale patch with grey text on it.\n//\n// **A label with no room on one line is cut short, never wrapped.** The\n// container is a fixed 32dp, so a second line has nowhere to go but out of\n// the pill: a chip or a token in a room narrower than its label drew the\n// rest below its own edge, and a chip in a group's row ran past the row's\n// end instead. The pill is held to the room it is in, and the label sits in\n// a span of its own that ends in an ellipsis where the pill does — a span,\n// because a flex container ignores `text-overflow`, which is also why\n// Material's own chips carry one. The whole label stays in the DOM, so a\n// screen reader still reads all of it.\n//\n// Each state composites an on-colour over its own container at the\n// interaction state's opacity rather than swapping in a separate hover\n// colour. `calc(<opacity> * 100%)` turns the token's unitless 0-1 ratio into\n// the percentage `color-mix()` takes, and it is inlined at each property\n// because @stylexjs/babel-plugin only statically recognises expressions\n// written directly as property values.\n//\n// The selected chip drops its border rather than recolouring it: it has a\n// container of its own to define its edge, and a border on top of that reads\n// as a second, competing outline.\n//\n// Disabled is applied from render state rather than from `:disabled`. Chip is\n// a button and would match the pseudo-class; a chip in a group is React\n// Aria's `Tag`, which is a div and never will. One mechanism serves both, and\n// StyleX replaces a property whole, so the disabled styles take the hover and\n// pressed branches of whichever state they are applied over.\n//\n// A selected chip carries the page's check before its label, which is what\n// makes the selection legible without colour. The two containers differ in\n// colour alone, and under a scheme whose secondary container sits close to\n// the surface — or for a reader who does not see colour — that is no\n// difference at all.\n//\n// The chip widens when the check appears, and that is the page's behaviour\n// rather than a cost of drawing it: a chip is flow content, laid out in a\n// row that wraps, so nothing around it has a width to hold. A segmented\n// button's segments are equal columns of one track, which is a different\n// geometry answering a different question, and the two should not be read\n// across. A chip given an icon does not widen, since the check takes the\n// icon's place in the same slot.\n//\n// **A filter chip can carry an icon after its label as well**, the page's\n// trailing icon, which is what draws its dropdown filter chip: an arrow\n// saying the chip opens a menu. It takes the same 18dp slot at the other\n// end, and the chip's content role rather than the primary one the leading\n// icon takes — on surface variant, then on secondary container once\n// selected, then the disabled 38% — so it is drawn in the chip's own colour\n// rather than a role of its own. The check never displaces it.\n//\n// **The widening is animated rather than taken in one frame.** A chip with\n// no icon keeps its slot mounted while unselected, folded to nothing, and\n// selecting it opens the slot over the chip's own short duration while the\n// check fades in, so the chips after it in a wrapped row glide rather than\n// jump 18dp. Reduced motion takes the change at once, as it does the\n// colours. A chip that can never be selected, an assist or suggestion chip\n// or one in a group that does not select, has no slot to open.\n//\n// **The press ripple takes the chip's corner from here** wherever the chip\n// is a ChipGroup's. The ripple clips itself to its host's corner by\n// inheriting it, and React Aria puts a cell between a group's chip and its\n// content, so what the ripple would inherit is the cell's square corner.\n// `surfaceCorners` restates the chip's own corner on a box the ripple sits\n// in, less the 1px border every chip keeps, since the ripple fills the\n// inside of that border.\n//\n// Apart from any component so a chip in a group and a chip on its own cannot\n// drift; see `src/row` for the same arrangement around a list's row.\n\n// The press area the chips page requires around its 32dp chip. A literal for\n// the reason IconButton's `TARGET_SIZE` gives.\nconst TARGET_SIZE = '48px';\n\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst chipStyles = {\n assist: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n },\n base: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xig8zya\",\n kaIpWk: \"x1xdvaa9\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xmkeg23\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kMv6JI: \"xkknnkr\",\n kGuDYH: \"x14zspaw\",\n k63SB2: \"x1v9cpvo\",\n kOIVth: \"x126z3so\",\n kb6lSQ: \"x155f00i\",\n kLWn49: \"x1lz68p4\",\n ks0D6T: \"x193iq5w\",\n k8WAf4: \"xt970qd\",\n kg3NbH: \"x790zyz\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xu8237s\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n disabled: {\n kMwMTN: \"x1gpw424 x1bhcspo\",\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n disabledSelected: {\n kWkggS: \"x19v6zzp\",\n $$css: true\n },\n disabledUnselected: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"xrh88j3 xmnqt3w\",\n $$css: true\n },\n elevated: {\n kWkggS: \"x1vnz5z6\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n elevatedDisabled: {\n kWkggS: \"x19v6zzp\",\n kVAM5u: \"x9r1u3d\",\n kGVxlE: \"x1gnnqk1\",\n $$css: true\n },\n glyph: {\n kGNEyG: \"x6s0dn4\",\n kZKoxP: \"xmix8c7\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kGuDYH: \"xosj86m\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n keTefX: \"xxuhe3a\",\n $$css: true\n },\n glyphFolded: {\n kzqmXN: \"xnalus7\",\n k71WvV: \"x1kfc2zf\",\n keTefX: \"x1lziwak\",\n kSiTet: \"xg01cxk\",\n $$css: true\n },\n glyphOpening: {\n k6CgDc: \"x12w9bfk\",\n kVQacm: \"xb3r6kr\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"x17vvy08\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n glyphSvg: {\n kZKoxP: \"xmix8c7\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n icon: {\n kMwMTN: \"x1mxwv8y\",\n $$css: true\n },\n inert: {\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n label: {\n kB7OPa: \"x9f619\",\n kVQacm: \"xb3r6kr\",\n kg5iWk: \"xlyipyv\",\n khDVqt: \"xuxw1ft\",\n $$css: true\n },\n raised: {\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n raisedHovered: {\n kGVxlE: \"x1os83gw\",\n $$css: true\n },\n remove: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"xtu493u\",\n kEoFBp: \"x1hmns74\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kaIpWk: \"x1dkaolv\",\n kMzoRj: \"xc342km\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"x1heor9g\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n k71WvV: \"x1kfc2zf\",\n kjBf7l: \"x14ytart\",\n kInvED: \"x1y3gkto\",\n k3XXqK: \"x9v5kkp x1t137rt\",\n kMeerF: \"x1de99jn\",\n kmVPX3: \"x1717udv\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n removeDisabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n removeGlyph: {\n kZKoxP: \"xmix8c7\",\n kzqmXN: \"x1xp8n7a\",\n $$css: true\n },\n selected: {\n kWkggS: \"x15dekr4\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n selectedHovered: {\n kGVxlE: \"x19efjv6\",\n $$css: true\n },\n surfaceCorners: {\n kaIpWk: \"x5a2xki\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"xjp7ctv\",\n $$css: true\n },\n target: {\n kgeoSG: \"x1cpjm7i\",\n kGOzcv: \"x1xkszu9\",\n kpsdNU: \"x1ecwmwu\",\n kEoFBp: \"x1hmns74\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n trailing: {\n k71WvV: \"x1kfc2zf\",\n keTefX: \"x1lziwak\",\n $$css: true\n },\n unselected: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"x133yhug\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n }\n};\n\n// The hover and pressed layers, applied from React Aria's render state rather\n// than from `:hover` and `:active`, for Button's reasons — see its header: a\n// hover layer stayed on after a tap, and no pressed layer showed for a press\n// made from the keyboard. One pair per container, the pressed after the\n// hovered so a press wins, and one for the close target, whose own render\n// state is its button's. A token in a TokenField draws none of them: React\n// Aria reports neither state for one, since it is text the caret moves\n// through rather than a control a press acts on.\nconst chipLayers = {\n elevatedFocused: {\n kWkggS: \"x1drsm1c\",\n $$css: true\n },\n elevatedHovered: {\n kWkggS: \"x1ei6177\",\n $$css: true\n },\n elevatedPressed: {\n kWkggS: \"x1vt8e7r\",\n $$css: true\n },\n removeHovered: {\n kWkggS: \"x930l3l\",\n $$css: true\n },\n removePressed: {\n kWkggS: \"xsykwg8\",\n $$css: true\n },\n selectedFocused: {\n kWkggS: \"x1s5x49g\",\n $$css: true\n },\n selectedHovered: {\n kWkggS: \"x1fctxn6\",\n $$css: true\n },\n selectedPressed: {\n kWkggS: \"xzpauq9\",\n $$css: true\n },\n unselectedFocused: {\n kWkggS: \"xwqhyid\",\n $$css: true\n },\n unselectedHovered: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n },\n unselectedPressed: {\n kWkggS: \"xjeeohs\",\n $$css: true\n }\n};\nexport { chipLayers, chipStyles };"],"mappings":";AAiHA,MAAMW,aAAa;CACjBC,QAAQ;EACNC,QAAQ;EACRC,OAAO;CACT;CACAC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRvB,OAAO;CACT;CACAwB,UAAU;EACRzB,QAAQ;EACRU,QAAQ;EACRT,OAAO;CACT;CACAyB,kBAAkB;EAChBC,QAAQ;EACR1B,OAAO;CACT;CACA2B,oBAAoB;EAClBD,QAAQ;EACRE,QAAQ;EACR5B,OAAO;CACT;CACA6B,UAAU;EACRH,QAAQ;EACRE,QAAQ;EACR5B,OAAO;CACT;CACA8B,kBAAkB;EAChBJ,QAAQ;EACRE,QAAQ;EACRG,QAAQ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AO;CACT;CACA+D,gBAAgB;EACd1D,QAAQ;EACRG,QAAQ;EACRE,QAAQ;EACRV,OAAO;CACT;CACAgE,QAAQ;EACNd,QAAQ;EACRe,QAAQ;EACRC,QAAQ;EACRd,QAAQ;EACRM,QAAQ;EACR1D,OAAO;CACT;CACAmE,UAAU;EACR9B,QAAQ;EACRF,QAAQ;EACRnC,OAAO;CACT;CACAoE,YAAY;EACV1C,QAAQ;EACRE,QAAQ;EACR7B,QAAQ;EACRC,OAAO;CACT;AACF;AAUA,MAAMqE,aAAa;CACjBC,iBAAiB;EACf5C,QAAQ;EACR1B,OAAO;CACT;CACAuE,iBAAiB;EACf7C,QAAQ;EACR1B,OAAO;CACT;CACAwE,iBAAiB;EACf9C,QAAQ;EACR1B,OAAO;CACT;CACAyE,eAAe;EACb/C,QAAQ;EACR1B,OAAO;CACT;CACA0E,eAAe;EACbhD,QAAQ;EACR1B,OAAO;CACT;CACA2E,iBAAiB;EACfjD,QAAQ;EACR1B,OAAO;CACT;CACA8D,iBAAiB;EACfpC,QAAQ;EACR1B,OAAO;CACT;CACA4E,iBAAiB;EACflD,QAAQ;EACR1B,OAAO;CACT;CACA6E,mBAAmB;EACjBnD,QAAQ;EACR1B,OAAO;CACT;CACA8E,mBAAmB;EACjBpD,QAAQ;EACR1B,OAAO;CACT;CACA+E,mBAAmB;EACjBrD,QAAQ;EACR1B,OAAO;CACT;AACF"}
@@ -4,7 +4,11 @@ import { ReactNode } from "react";
4
4
  type AppBarProps = Omit<RenderComponentProps<'header'>, 'children'> & {
5
5
  /**
6
6
  * Which of Material Design's alignments the text takes. `center` is the
7
- * configuration that replaced the old center-aligned variant.
7
+ * configuration that replaced the old center-aligned variant, and centres
8
+ * the text on the bar rather than between the slots, so a bar with a
9
+ * leading icon and no actions still has its headline in the middle. The
10
+ * text moves off the middle only as far as a slot wider than the other
11
+ * needs, rather than running under it.
8
12
  * @default 'start'
9
13
  */
10
14
  align?: 'center' | 'start';
@@ -77,7 +81,11 @@ type AppBarProps = Omit<RenderComponentProps<'header'>, 'children'> & {
77
81
  headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;
78
82
  /** The page's title. Wraps rather than truncating, and grows the bar with it. */
79
83
  headline?: ReactNode;
80
- /** Usually a back or menu icon button. Sits before the text. */
84
+ /**
85
+ * Usually a back or menu icon button. Sits before the text, and a standard
86
+ * icon button here draws its icon in on surface, the colour the page gives
87
+ * a bar's leading icon, rather than its own on surface variant.
88
+ */
81
89
  leading?: ReactNode;
82
90
  /**
83
91
  * Holds the bar at the top of its scroll container while the content
@@ -116,6 +124,10 @@ type AppBarProps = Omit<RenderComponentProps<'header'>, 'children'> & {
116
124
  * Material Design's app bar: the container at the top of a page carrying its
117
125
  * title, one or two actions, and the way back out.
118
126
  *
127
+ * ```tsx
128
+ * <AppBar headline="Headline" leading={back} size="md" trailing={actions} />
129
+ * ```
130
+ *
119
131
  * Three sizes. `sm` is a fixed 64px bar for a page whose title is a label;
120
132
  * `md` and `lg` are the flexible bars, which give the headline a larger
121
133
  * type role in a row of its own under the slots, and grow to fit a subtitle
@@ -51,7 +51,6 @@ const styles = {
51
51
  kB7OPa: "x9f619",
52
52
  k1xSpc: "xrvj5dj",
53
53
  kC13JO: "x97ohe",
54
- kumcoG: "xx9t13c",
55
54
  kzqmXN: "xh8yej3",
56
55
  kUOVxO: "xvueqy4",
57
56
  $$css: true
@@ -152,11 +151,16 @@ const rowStyles = {
152
151
  "--x-paddingInlineStart": ((val) => typeof val === "number" ? val + "px" : val != null ? val : void 0)(start)
153
152
  }
154
153
  ],
155
- tracks: (gridTemplateRows) => [{
154
+ tracks: (gridTemplateColumns, gridTemplateRows) => [{
155
+ kumcoG: gridTemplateColumns != null ? "xqketvx" : gridTemplateColumns,
156
156
  k9llMU: gridTemplateRows != null ? "x1xxtoay" : gridTemplateRows,
157
157
  $$css: true
158
- }, { "--x-gridTemplateRows": gridTemplateRows != null ? gridTemplateRows : void 0 }]
158
+ }, {
159
+ "--x-gridTemplateColumns": gridTemplateColumns != null ? gridTemplateColumns : void 0,
160
+ "--x-gridTemplateRows": gridTemplateRows != null ? gridTemplateRows : void 0
161
+ }]
159
162
  };
163
+ const START_COLUMNS = "auto minmax(0, 1fr) auto";
160
164
  const _temp3 = {
161
165
  keoZOQ: "x1vhfslr",
162
166
  "$$css": true
@@ -178,6 +182,10 @@ const LINES = [":scope > :is(h1, h2, h3, h4, h5, h6)", ":scope > p"];
178
182
  * Material Design's app bar: the container at the top of a page carrying its
179
183
  * title, one or two actions, and the way back out.
180
184
  *
185
+ * ```tsx
186
+ * <AppBar headline="Headline" leading={back} size="md" trailing={actions} />
187
+ * ```
188
+ *
181
189
  * Three sizes. `sm` is a fixed 64px bar for a page whose title is a label;
182
190
  * `md` and `lg` are the flexible bars, which give the headline a larger
183
191
  * type role in a row of its own under the slots, and grow to fit a subtitle
@@ -205,14 +213,18 @@ function AppBar(t0) {
205
213
  const height = collapse ? COLLAPSED_HEIGHT : expandedHeight;
206
214
  const hasLeading = hasContent(leading);
207
215
  const hasTrailing = hasContent(trailing);
216
+ const centred = align === "center";
217
+ const hasSlot = hasLeading || hasTrailing;
218
+ const padsForStart = centred ? hasSlot : hasLeading;
219
+ const padsForEnd = centred ? hasSlot : hasTrailing;
208
220
  const textRef = useCollapseMotion(collapse, align);
209
221
  const t9 = "header";
210
- const t10 = props(styles.row, rowStyles.root(edgePadding(contentInset, hasLeading), edgePadding(contentInset, hasTrailing), contentMaxInlineSize), rowStyles.tracks(below ? `minmax(${COLLAPSED_HEIGHT}, auto) 1fr` : `minmax(${COLLAPSED_HEIGHT}, auto)`), heightStyles.root(height), below && twoRows[size]);
222
+ const t10 = props(styles.row, rowStyles.root(edgePadding(contentInset, padsForStart), edgePadding(contentInset, padsForEnd), contentMaxInlineSize), rowStyles.tracks(centred ? centredColumns(contentInset, hasLeading, hasTrailing) : START_COLUMNS, below ? `minmax(${COLLAPSED_HEIGHT}, auto) 1fr` : `minmax(${COLLAPSED_HEIGHT}, auto)`), heightStyles.root(height), below && twoRows[size]);
211
223
  const t11 = !hasLeading ? null : /* @__PURE__ */ jsx("div", {
212
- className: "x6s0dn4 xamitd3 x9f619 x78zum5 x1r8zjiw x1let9r4 x1kxrqrs x15ir4sr",
224
+ className: "x6s0dn4 xamitd3 x9f619 x78zum5 x1r8zjiw x1let9r4 x155k8fu x139gbkf x1kxrqrs x1lqcxt8 x15ir4sr",
213
225
  children: leading
214
226
  });
215
- const t12 = props(styles.text, below && styles.textBelow, below && textStyles.inset(glyphRoom(contentInset, hasLeading), glyphRoom(contentInset, hasTrailing)), below && textStyles.reach(`calc(-1 * ${UNDER_TARGETS})`), align === "center" && styles.textCenter);
227
+ const t12 = props(styles.text, below && styles.textBelow, below && textStyles.inset(glyphRoom(contentInset, padsForStart), glyphRoom(contentInset, padsForEnd)), below && textStyles.reach(`calc(-1 * ${UNDER_TARGETS})`), align === "center" && styles.textCenter);
216
228
  let t13;
217
229
  if ($[0] !== collapse || $[1] !== headingLevel || $[2] !== headline || $[3] !== size) {
218
230
  t13 = !hasContent(headline) ? null : /* @__PURE__ */ jsx(Text, {
@@ -255,7 +267,7 @@ function AppBar(t0) {
255
267
  let t16;
256
268
  if ($[14] !== hasTrailing || $[15] !== trailing) {
257
269
  t16 = !hasTrailing ? null : /* @__PURE__ */ jsx("div", {
258
- className: "x6s0dn4 xamitd3 x9f619 x78zum5 x1r8zjiw x1let9r4 x1txd71x x6aqprb",
270
+ className: "x6s0dn4 xamitd3 x9f619 x78zum5 x1r8zjiw x1let9r4 x1w5n3ug x1txd71x x1qab1bc x6aqprb",
259
271
  children: trailing
260
272
  });
261
273
  $[14] = hasTrailing;
@@ -305,6 +317,23 @@ function AppBar(t0) {
305
317
  return useRender(t20);
306
318
  }
307
319
  /**
320
+ * A centred bar's columns: the text in the middle at its own width, and a
321
+ * column either side sharing what it leaves equally, so the text is centred
322
+ * on the row. A side column is never narrower than its slot, which is what
323
+ * moves the text off the middle when a slot is wider than the other side's
324
+ * share, and never as far as overlapping it.
325
+ *
326
+ * The row pads both edges for a slot, so the two sides match, and an edge
327
+ * with no slot puts back what that padding held off for a glyph as its
328
+ * column's least width. A headline long enough to reach that edge stops on
329
+ * the inset, as it does at the start.
330
+ */
331
+ function centredColumns(contentInset, hasLeading, hasTrailing) {
332
+ const room = glyphRoom(contentInset, hasLeading || hasTrailing);
333
+ const side = (hasSlot) => hasSlot ? "minmax(auto, 1fr)" : `minmax(${room}, 1fr)`;
334
+ return `${side(hasLeading)} auto ${side(hasTrailing)}`;
335
+ }
336
+ /**
308
337
  * Where an animation still under way has the bar and the text drawn: the
309
338
  * height it holds the bar at, and each line where its transform has taken it
310
339
  * and at the size its scale has reached. A line scales about the point it