@kanso-labs/kanso-ui 0.44.1 → 0.45.1

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 (135) hide show
  1. package/README.md +69 -18
  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/field/styles.js.map +1 -1
  103. package/dist/glyphs/index.js +19 -18
  104. package/dist/glyphs/index.js.map +1 -1
  105. package/dist/hooks/useBottomEdge.js +6 -3
  106. package/dist/hooks/useBottomEdge.js.map +1 -1
  107. package/dist/hooks/useRipple.js +216 -192
  108. package/dist/hooks/useRipple.js.map +1 -1
  109. package/dist/i18n/index.js +1 -0
  110. package/dist/i18n/index.js.map +1 -1
  111. package/dist/i18n/messages.js +34 -0
  112. package/dist/i18n/messages.js.map +1 -1
  113. package/dist/index.d.ts +3 -3
  114. package/dist/indicator/styles.js +7 -4
  115. package/dist/indicator/styles.js.map +1 -1
  116. package/dist/{tokens/theme.d.ts → kanso-ui-core/defaults-DMH0HWCw.d.ts} +3 -3
  117. package/dist/kanso-ui-core/glyphs.js +48 -0
  118. package/dist/kanso-ui-core/glyphs.js.map +1 -0
  119. package/dist/mark/styles.js +11 -5
  120. package/dist/mark/styles.js.map +1 -1
  121. package/dist/react-aria.d.ts +2 -2
  122. package/dist/row/index.js +90 -62
  123. package/dist/row/index.js.map +1 -1
  124. package/dist/row/styles.js +6 -1
  125. package/dist/row/styles.js.map +1 -1
  126. package/dist/styles/focus.js.map +1 -1
  127. package/dist/styles/overlay.js +8 -0
  128. package/dist/styles/overlay.js.map +1 -1
  129. package/dist/styles.css +135 -114
  130. package/dist/theme-scope.d.ts +15 -3
  131. package/dist/theme-scope.js +86 -98
  132. package/dist/theme-scope.js.map +1 -1
  133. package/dist/tokens/design.tokens.stylex.js.map +1 -1
  134. package/dist/tokens/values.js.map +1 -1
  135. package/package.json +12 -10
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","ClassNameOrFunction","DOMRenderFunction","StyleOrFunction","stylex","useContext","ToggleGroupStateContext","ButtonClassesState","ButtonDOMProps","ButtonForm","ButtonState","ButtonGroupItem","ButtonBase","ToggleButtonBase","ButtonGroupItemContext","groupPressHandlers","useSelection","pressThen","focus","colors","motion","radii","sizing","stateLayerOpacity","FORCED_COLORS","TARGET_SIZE","styles","base","kGNEyG","kVAM5u","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kmuXW","kjj79g","kmVPX3","kVAEAm","kybGjl","kIyJzY","k1ekBW","kAMwcw","$$css","disabled","filled","kWkggS","kMwMTN","filledDisabled","filledToggle","filledToggleSelected","lg","kZKoxP","kGuDYH","kzqmXN","md","kgeoSG","kFcpXp","kEoFBp","outlined","outlinedDisabled","outlinedToggleSelected","outlinedToggleSelectedDisabled","pending","standard","standardDisabled","standardToggleSelected","standardToggleSelectedDisabled","tonal","tonalDisabled","tonalToggleSelected","xl","xs","xxl","hovered","focused","pressed","outlineWidths","EDGES","controlLg","controlSm","controlXl","controlXs","controlXxl","_temp","shifted","width","value","val","undefined","roundShapes","kaIpWk","selectedShapes","toggleStyles","selected","unselected","toggleContainers","const","disabledStyles","selectedDisabledStyles","IconButtonProps","children","className","IconButtonState","disableRipple","pendingLabel","render","size","IconButtonSize","style","variant","IconButtonVariant","Omit","groupStyles","group","state","shift","IconButton","t0","$","defaultSelected","href","isPending","isSelected","onChange","rel","ownSize","target","t1","props","inSelectingGroup","press","onPressStart","onPressEnd","t2","selection","t3","toggleStyleProps","isToggle","T0","iconButtonClasses","t4","t5","onPress","toggle","t6","ring","isHovered","isFocusVisible","isPressed","isDisabled","container","_c","stylex.props"],"sources":["../../../src/components/icon-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, DOMRenderFunction, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { ToggleGroupStateContext } from 'react-aria-components';\nimport type { ButtonClassesState, ButtonDOMProps, ButtonForm, ButtonState } from '../../button';\nimport type { ButtonGroupItem } from '../../button/context';\nimport { ButtonBase, ToggleButtonBase } from '../../button';\nimport { ButtonGroupItemContext } from '../../button/context';\nimport { groupPressHandlers } from '../../button/group';\nimport { useSelection } from '../../button/hooks';\nimport { pressThen } from '../../button/toggle';\nimport { focus } from '../../styles/focus';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// Each variant composites an 'on-color' over its own container at the\n// interaction state's opacity, rather than swapping in a separate hover\n// color. The pairs are the icon buttons spec page's: filled on primary,\n// tonal on secondary container, outlined with an outline variant border and\n// an on-surface-variant icon, standard on surface variant over nothing.\n// calc(<opacity> * 100%) turns the token's unitless 0-1 ratio into the\n// percentage color-mix() takes. Inlined at each property rather than factored\n// into a helper: @stylexjs/babel-plugin only statically recognizes\n// expressions written directly as property values.\n//\n// **The outlined rule is faint on purpose.** Outline variant sits at about\n// 1.6:1 against the surface in the light theme and 2:1 in the dark, under the\n// 3:1 WCAG asks of a boundary that identifies a control. The rule is not that\n// boundary: the icon identifies the button, in on-surface-variant at about\n// 9:1, and the rule only shows how far the button reaches. Button's outlined\n// variant draws its rule in the same role for the same reason.\n//\n// Disabled is a style of its own per variant rather than a `:disabled`\n// branch inside each property, for the reason Button's comment gives: given\n// `href` this renders as a link, which React Aria turns into a <span> while\n// disabled, and neither matches the pseudo-class. Applied last from the\n// render state, the disabled styles replace each property whole, hover and\n// pressed branches included.\n//\n// **The outlined border thickens with the size, and the widths are Button's\n// rather than this page's.** The icon buttons page keeps them in a size token\n// set its widget will not open to a script, and the two components already\n// share their five heights on purpose — a 96dp icon button beside a 96dp\n// outlined button with a different border weight would read as a mistake.\n//\n// **A toggle is the same button reporting a state.** Given `isSelected`,\n// `defaultSelected` or `onChange` it is React Aria's `ToggleButton` instead\n// of its `Button`, which announces the state through `aria-pressed` rather\n// than a role of its own — every variant and size still applies. The page\n// gives each style a second pair of colour roles for it, and they are not\n// the plain button's: a filled toggle rests on surface container with an\n// on-surface-variant icon and takes primary once chosen, a tonal one rests\n// on secondary container and takes secondary, and a standard one is\n// transparent throughout with the icon going from on-surface-variant to\n// primary, and an outlined one swaps its border for the inverse surface\n// pair. So a chosen filled toggle looks like a plain filled button, and an\n// unchosen one does not.\n//\n// A toggle is never a link and never pending. React Aria's `ToggleButton`\n// takes neither, and neither means anything for a control whose whole job is\n// to report which of two states it is in.\n//\n// The corner softens from a circle to a rounded square while pressed, which\n// is the shape morph the icon buttons spec page gives this control, at the\n// pressed corner its size token set names: 8 for the two small sizes, 12 at\n// medium, 16 at the two large. Each size carries its own pressed radius, since\n// StyleX replaces the property whole. The transitioned properties take two\n// curves — the container, icon and rule colours the standard one, the corner\n// and a group's change of width the emphasized one — so the timing functions\n// are a matching comma list rather than one value. All of them move at once\n// for a reader who asks for reduced motion.\n//\n// A chosen toggle rests at that same pressed corner, which is the page's\n// shape morph: a toggle icon button moves from round while unchosen to\n// square once chosen. The square shape's own corner sits in a token set the\n// page keeps behind its size menu, but the page also says both shapes press\n// to the same radius — so the size's pressed corner is the value it already\n// assigns to that size, used here at rest rather than invented.\n//\n// The circle is half the button's edge as a length, not the pill token's\n// 9999px. The browser draws a corner no larger than half the box but eases\n// the value as written, so from 9999px a press spent all but the last frame\n// or two of its 150ms above the 20dp a medium button can show: the corner\n// held round and then jumped. Nor is it 50%, which a standard ButtonGroup\n// would stretch into an ellipse as it narrows the buttons beside a pressed\n// one, where a length still draws their ends round.\n//\n// **Under forced colours a container is drawn as a rule, and a chosen toggle\n// as the mode's own chosen pair.** That mode paints author backgrounds in a\n// system colour and forces the icon's, which left a filled or tonal icon\n// button as an icon with nothing round it and a chosen toggle the same as an\n// unchosen one. `base` draws a 1px `ButtonText` border there, as Button's\n// does. Outlined keeps its own rule, and standard stays without one, as the\n// page draws it. A chosen toggle of any style is filled `Highlight` with its\n// icon in `HighlightText`. A disabled button's icon and edge are `GrayText`,\n// for the reason Button's comment gives: the browser greys a disabled\n// `<button>` there, but not the `<span>` a disabled link is.\n//\n// **A disabled toggle keeps an edge for its corner to show on.** Disabled,\n// every variant takes one grey, so the corner it rests at is what tells a\n// chosen toggle from an unchosen one, and a corner shows only where\n// something is drawn round it. Filled and tonal keep their disabled\n// container, and an unchosen outlined toggle its disabled rule. A chosen\n// outlined toggle trades its rule for a container, which the disabled style\n// cleared, so it takes on-surface at the disabled-container opacity, where\n// Material Design's own tokens give that state a faint on-surface container\n// too. A chosen standard\n// toggle takes the same faint container over nothing. That departs from the\n// page, which draws a standard toggle with no container in any state, and\n// it is the one way the two states of a disabled standard toggle differ at\n// all. Under forced colours, which paint both containers over, the chosen\n// outlined toggle keeps its `GrayText` rule and the chosen standard one\n// draws one, in place of the rule its variant otherwise goes without.\n//\n// What every button does past its own styles — the ripple, the link and\n// toggle forms, the pending ring, a parent's disabled state — is\n// `src/button`'s, shared with Button.\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)';\n\n/**\n * The press area the page requires of its two smallest sizes. A literal\n * rather than `sizing.controlMd`, which holds the same number: that is a step\n * of the control scale, and a consumer resizing their medium controls should\n * not shrink a target the page states as a floor.\n */\nconst TARGET_SIZE = '48px';\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kVAM5u: \"x1ylmb6m\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n kIyJzY: \"x1pvxwa0 x12w9bfk\",\n k1ekBW: \"x1ss3tkz\",\n kAMwcw: \"xcviomn\",\n $$css: true\n },\n disabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n filled: {\n kWkggS: \"xnety89\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n filledDisabled: {\n kWkggS: \"xepofeg\",\n kVAM5u: \"xmnqt3w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1mjdul6\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xnety89 x1jzqe4\",\n kMwMTN: \"xwjo7ld x1k5gbb1\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xs1ryiz\",\n kGuDYH: \"x1pvqxga\",\n kzqmXN: \"x1fh0d6s\",\n $$css: true\n },\n md: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"x1q69gdh\",\n kEoFBp: \"x1hmns74\",\n kZKoxP: \"x1rv7mn0\",\n kGuDYH: \"x1pvqxga\",\n kzqmXN: \"x1eujcsb\",\n $$css: true\n },\n outlined: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"x133yhug\",\n ksu8eU: \"x1y0btm7\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n outlinedDisabled: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"xrh88j3 xmnqt3w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x1c5gpgi x1jzqe4\",\n kVAM5u: \"x9r1u3d x1n2ykn\",\n kMwMTN: \"x1girmi0 x1k5gbb1\",\n $$css: true\n },\n outlinedToggleSelectedDisabled: {\n kWkggS: \"xepofeg\",\n $$css: true\n },\n pending: {\n kkrTdU: \"x19v85br\",\n $$css: true\n },\n standard: {\n kWkggS: \"xjbqb8w\",\n kMzoRj: \"xc342km\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n standardDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n standardToggleSelected: {\n kWkggS: \"xjbqb8w x1jzqe4\",\n kMzoRj: \"xc342km\",\n kMwMTN: \"x1mxwv8y x1k5gbb1\",\n $$css: true\n },\n standardToggleSelectedDisabled: {\n kWkggS: \"x19v6zzp\",\n kVAM5u: \"xmnqt3w\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n tonalDisabled: {\n kWkggS: \"xepofeg\",\n kVAM5u: \"xmnqt3w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x167r6xl x1jzqe4\",\n kMwMTN: \"x1lba3jz x1k5gbb1\",\n $$css: true\n },\n xl: {\n kZKoxP: \"x1xaimp3\",\n kGuDYH: \"x1s3cmhv\",\n kzqmXN: \"xszbqgh\",\n $$css: true\n },\n xs: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"x1n6cgzf\",\n kEoFBp: \"x1hmns74\",\n kZKoxP: \"xig8zya\",\n kGuDYH: \"xwsyq91\",\n kzqmXN: \"x11ts1a5\",\n $$css: true\n },\n xxl: {\n kZKoxP: \"x173yhrv\",\n kGuDYH: \"x1tgwohi\",\n kzqmXN: \"xz1kjiq\",\n $$css: true\n }\n};\n\n// The hover, focus and pressed layers, one style per container, applied from\n// React Aria's render state rather than from `:hover`, `:focus-visible` and\n// `:active`, for Button's reasons — see its header: a hover layer stayed on\n// after a tap, and no pressed layer or corner showed for a press made from\n// the keyboard. In the order they are applied, so where two hold the later\n// wins, as the page draws one layer at a time: focus over hover, and a press\n// over both. A chosen toggle's layer keeps its forced-colours `Highlight`,\n// since a later style replaces the property whole.\nconst hovered = {\n filled: {\n kWkggS: \"xo1ct44\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"xtxe0ya\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xo1ct44 x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x14noynh\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x1hxzsxp x1jzqe4\",\n $$css: true\n },\n standard: {\n kWkggS: \"x14noynh\",\n $$css: true\n },\n standardToggleSelected: {\n kWkggS: \"x659ado x1jzqe4\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x1fctxn6\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x12r95rf x1jzqe4\",\n $$css: true\n }\n};\nconst focused = {\n filled: {\n kWkggS: \"xhodiby\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1ppcb1\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xhodiby x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x19p5drm\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"xn4e5mw x1jzqe4\",\n $$css: true\n },\n standard: {\n kWkggS: \"x19p5drm\",\n $$css: true\n },\n standardToggleSelected: {\n kWkggS: \"x1sog3nf x1jzqe4\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x1s5x49g\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x16tkg7c x1jzqe4\",\n $$css: true\n }\n};\nconst pressed = {\n filled: {\n kWkggS: \"x7b25lv\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1qdfkg1\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"x7b25lv x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x123fei2\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x167cdfs x1jzqe4\",\n $$css: true\n },\n standard: {\n kWkggS: \"x123fei2\",\n $$css: true\n },\n standardToggleSelected: {\n kWkggS: \"x1dvjsmr x1jzqe4\",\n $$css: true\n },\n tonal: {\n kWkggS: \"xzpauq9\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x12o6fnv x1jzqe4\",\n $$css: true\n }\n};\n\n// The outlined border thickens with the size, as Button's does: 1dp up to M,\n// 2dp at XL, 3dp at XXL. A style per size rather than a value in the size\n// style, since a border on a filled button would draw in the icon's colour.\nconst outlineWidths = {\n lg: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n md: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n xl: {\n kMzoRj: \"xdh2fpr\",\n $$css: true\n },\n xs: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n xxl: {\n kMzoRj: \"x9r2w2z\",\n $$css: true\n }\n};\n\n// Each size's edge again, for the one place it is read at runtime: a standard\n// ButtonGroup widening a pressed button by adding to it. The size styles\n// above write the same values.\nconst EDGES = {\n lg: sizing.controlLg,\n md: sizing.controlSm,\n xl: sizing.controlXl,\n xs: sizing.controlXs,\n xxl: sizing.controlXxl\n};\n\n// The width a standard group sets while it widens or narrows the button.\nconst _temp = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nconst shifted = {\n width: (value: string) => [_temp, {\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(value)\n }]\n};\n\n// The circle each size rests at: half its edge, written as a length rather\n// than as the pill token's 9999px or as 50% — see the header. `min()` leaves\n// the pill token in charge below that, so a scheme that sets\n// `--kui-radius-pill` small still draws its icon buttons at that corner.\n// Applied after the size's style, and again for a disabled button, which\n// keeps its circle whether or not a press is still held.\nconst roundShapes = {\n lg: {\n kaIpWk: \"x1j5kmnq\",\n $$css: true\n },\n md: {\n kaIpWk: \"x1y5wlyh\",\n $$css: true\n },\n xl: {\n kaIpWk: \"x39tcx0\",\n $$css: true\n },\n xs: {\n kaIpWk: \"xcslhsm\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"xjy9rn5\",\n $$css: true\n }\n};\n\n// The corner each size presses to, which is the page's round-to-square\n// morph, and the corner a chosen toggle rests at. A style per size rather than\n// a value inside each size style, since StyleX replaces the property whole:\n// it comes after the size's circle while pressed, and after a disabled\n// button's circle too for a chosen toggle, which keeps its corner disabled.\nconst selectedShapes = {\n lg: {\n kaIpWk: \"x62ce2h\",\n $$css: true\n },\n md: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n xl: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n },\n xs: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n }\n};\n\n// Which container a toggle draws, chosen and not. Two of the six are the\n// plain button's own styles: an unchosen tonal or standard toggle is the\n// tonal or standard button. A chosen filled toggle takes the filled button's\n// colours from a style of its own, which adds the forced-colours pair.\nconst toggleStyles = {\n filled: {\n selected: styles.filledToggleSelected,\n unselected: styles.filledToggle\n },\n outlined: {\n selected: styles.outlinedToggleSelected,\n unselected: styles.outlined\n },\n standard: {\n selected: styles.standardToggleSelected,\n unselected: styles.standard\n },\n tonal: {\n selected: styles.tonalToggleSelected,\n unselected: styles.tonal\n }\n};\n\n// The same containers by name, for the layers above.\nconst toggleContainers = {\n filled: {\n selected: 'filledToggleSelected',\n unselected: 'filledToggle'\n },\n outlined: {\n selected: 'outlinedToggleSelected',\n unselected: 'outlined'\n },\n standard: {\n selected: 'standardToggleSelected',\n unselected: 'standard'\n },\n tonal: {\n selected: 'tonalToggleSelected',\n unselected: 'tonal'\n }\n} as const;\nconst disabledStyles = {\n filled: styles.filledDisabled,\n outlined: styles.outlinedDisabled,\n standard: styles.standardDisabled,\n tonal: styles.tonalDisabled\n};\n\n// What a chosen toggle adds once disabled, over its variant's disabled style,\n// so its corner keeps an edge to show on — see the header. Filled and tonal\n// add nothing, since their disabled container already is one.\nconst selectedDisabledStyles = {\n filled: null,\n outlined: styles.outlinedToggleSelectedDisabled,\n standard: styles.standardToggleSelectedDisabled,\n tonal: null\n};\ntype IconButtonProps = {\n /**\n * What the button does, in words. Required rather than optional: an icon\n * on its own has no accessible name, so without this the control announces\n * nothing at all.\n *\n * `undefined` is for a button inside a React Aria component that names it\n * itself — a search field's clear button, a number field's steppers. React\n * Aria takes a prop over its context, so a name written here would replace\n * the one it gives in the reader's locale, and undefined leaves that stand.\n */\n 'aria-label': string | undefined;\n children?: ReactNode;\n /** A function may compute the class from the button's render state. */\n className?: ClassNameOrFunction<IconButtonState>;\n /**\n * Disables the press ripple. The hover and pressed state layers are\n * unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * The name of the ring shown while the button is pending, for a screen\n * reader. The label it replaces is hidden while it shows. Left out, it is\n * the word for it in the I18nProvider's locale — \"Loading\" in English.\n */\n pendingLabel?: string;\n /**\n * The element to render, given the props it would have carried. React\n * Aria's own form: it has to return the element the component would have\n * rendered itself.\n */\n render?: DOMRenderFunction<'button', IconButtonState>;\n /**\n * Control size: `xs` 32px, `md` 40px, `lg` 56px, `xl` 96px, `xxl` 136px —\n * the icon buttons spec page's XS to XL, and the same heights `Button`\n * uses, so the two line up beside each other in a row. The icon is 20px,\n * 24px, 24px, 32px and 40px in turn.\n * @default 'md'\n */\n size?: IconButtonSize;\n /** A function may compute the style from the button's render state. */\n style?: StyleOrFunction<IconButtonState>;\n /**\n * `standard` is transparent and tints what it sits on; `outlined` is\n * transparent with a rule around it; `filled` and `tonal` carry a container\n * of their own.\n * @default 'standard'\n */\n variant?: IconButtonVariant;\n} & ButtonForm & Omit<ButtonDOMProps, 'render'>;\ntype IconButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl';\n\n// The render state a call site's `className`, `style` or `render` function is\n// handed: the one every button shares, whose `isSelected` only the toggle\n// form fills in — see `ButtonState` in src/button.\ntype IconButtonState = ButtonState;\ntype IconButtonVariant = 'filled' | 'outlined' | 'standard' | 'tonal';\n\n// What a group lays over the button: its own styles for the button's state,\n// last so a connected group's corners hold whatever the button's own shape\n// would be, and the standard group's widening or narrowing as extra width.\nfunction groupStyles(group: ButtonGroupItem | null, size: IconButtonSize, state: ButtonState) {\n if (group === null) {\n return null;\n }\n return [group.styles?.(state), group.shift !== 0 && shifted.width(`calc(${EDGES[size]} + ${group.shift}px)`)];\n}\n\n/**\n * A button that is an icon, at five control heights. Given `href` it is a\n * link with the same appearance. Every `aria-*` prop is forwarded to the\n * element; React Aria alone would keep only the labelling ones.\n *\n * Given `isSelected`, `defaultSelected` or `onChange` it is a toggle, which\n * reports its state through `aria-pressed` and draws the page's second pair\n * of colour roles for its variant. The three forms are exclusive, so a toggle\n * given `href` does not compile. A toggle may be pending, for a state saved\n * somewhere slow: the ring replaces its icon and a press changes nothing\n * until it clears.\n *\n * ```tsx\n * <IconButton aria-label=\"Label\" defaultSelected variant=\"tonal\">\n * <StarIcon />\n * </IconButton>\n * ```\n */\nfunction IconButton({\n defaultSelected,\n href,\n isPending,\n isSelected,\n onChange,\n pendingLabel,\n rel,\n size: ownSize,\n target,\n variant = 'standard',\n ...props\n}: IconButtonProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>) {\n // A ButtonGroup around the button hands it a size, its shape at the\n // group's inner edges and the press interaction, as it does Button's; see\n // src/button/context.ts. A size named here still wins.\n const group = useContext(ButtonGroupItemContext);\n const size = ownSize ?? group?.size ?? 'md';\n const inSelectingGroup = useContext(ToggleGroupStateContext) !== null;\n const press = groupPressHandlers(group, props.onPressStart, props.onPressEnd);\n const selection = useSelection({\n defaultSelected,\n isSelected,\n onChange\n });\n\n // A selecting ButtonGroup around it makes it React Aria's ToggleButton, to\n // take part in the group's selection. Whether a button sits in one does\n // not change from one render to the next.\n if (inSelectingGroup) {\n return <ToggleButtonBase {...props} {...press} classes={toggleStyleProps(size, variant, group)} isPending={isPending} />;\n }\n\n // The three props that make this a toggle on its own. Read together rather\n // than behind a `toggle` word of its own, the way `href` already turns the\n // button into a link: a button given none of them has no state to report,\n // and one given any of them has nothing else it could mean. Either way it\n // is the same component underneath, so a toggle whose `isSelected` is\n // still loading stays the same element when the value arrives, and keeps\n // focus.\n const isToggle = defaultSelected !== undefined || isSelected !== undefined || onChange !== undefined;\n return <ButtonBase {...props} {...press} classes={isToggle ? toggleStyleProps(size, variant, group) : iconButtonClasses(size, variant, group)} href={href} isPending={isPending} isSelected={isToggle ? selection.selected : undefined} onPress={isToggle ? pressThen(props.onPress, selection.toggle) : props.onPress} pendingLabel={pendingLabel} rel={rel} target={target} />;\n}\n\n// The plain button's classes, from React Aria's render state — see the hover\n// and pressed layers above for why that and not the pseudo-classes. Built by\n// a call rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\nfunction iconButtonClasses(size: IconButtonSize, variant: IconButtonVariant, group: ButtonGroupItem | null) {\n return (state: ButtonClassesState) => stylex.props(styles.base, focus.ring, styles[variant], styles[size], roundShapes[size], variant === 'outlined' && outlineWidths[size], state.isHovered && hovered[variant], state.isFocusVisible && focused[variant], state.isPressed && pressed[variant], state.isPressed && selectedShapes[size], state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && roundShapes[size], state.isDisabled && disabledStyles[variant], groupStyles(group, size, state));\n}\n\n// A toggle's styles, from React Aria's render state. The chosen shape is\n// applied after the disabled styles so it survives them: which of the two\n// states a disabled toggle is in should still be readable, and the disabled\n// style otherwise forces the circle back. A chosen toggle's disabled edge\n// comes after them for the same reason.\nfunction toggleStyleProps(size: IconButtonSize, variant: IconButtonVariant, group: ButtonGroupItem | null) {\n return (state: ButtonClassesState) => {\n const container = toggleContainers[variant][state.isSelected === true ? 'selected' : 'unselected'];\n return stylex.props(styles.base, focus.ring, state.isSelected === true ? toggleStyles[variant].selected : toggleStyles[variant].unselected, styles[size], roundShapes[size],\n // A chosen outlined toggle has a container rather than a rule, so the\n // width goes on only while it is unchosen.\n variant === 'outlined' && state.isSelected !== true && outlineWidths[size], state.isHovered && hovered[container], state.isFocusVisible && focused[container], state.isPressed && pressed[container], state.isPressed && selectedShapes[size], state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && roundShapes[size], state.isDisabled && disabledStyles[variant], state.isDisabled && state.isSelected === true && selectedDisabledStyles[variant], state.isSelected === true && selectedShapes[size], groupStyles(group, size, state));\n };\n}\nexport type { IconButtonProps, IconButtonSize, IconButtonState, IconButtonVariant };\nexport default IconButton;"],"mappings":";;;;;;;;;;;;;;AAsIA,MAAM6B,SAAS;CACbC,MAAM;EACJC,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,OAAO;CACT;CACAC,UAAU;EACRX,QAAQ;EACRU,OAAO;CACT;CACAE,QAAQ;EACNC,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAK,gBAAgB;EACdF,QAAQ;EACRjB,QAAQ;EACRkB,QAAQ;EACRJ,OAAO;CACT;CACAM,cAAc;EACZH,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAO,sBAAsB;EACpBJ,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAQ,IAAI;EACFC,QAAQ;EACRC,QAAQ;EACRC,QAA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kB,UAAUuE,MAAMmC,cAAc5D,YAAYiB,OAAOQ,MAAMmC,cAAcpD,eAAeY,UAAUG,YAAYC,OAAOP,MAAMQ,KAAK,CAAC;AAChhB;AAOA,SAASsB,iBAAiB9B,MAAsBG,SAA4BI,OAA+B;CACzG,QAAQC,UAA8B;EACpC,MAAMoC,YAAYvD,iBAAiBc,QAAQ,CAACK,MAAMQ,eAAe,OAAO,aAAa;EACrF,OAAOvH,MAAasB,OAAOC,MAAMT,MAAMgI,MAAM/B,MAAMQ,eAAe,OAAO9B,aAAaiB,QAAQ,CAAChB,WAAWD,aAAaiB,QAAQ,CAACf,YAAYrE,OAAOiF,OAAOjB,YAAYiB,OAGtKG,YAAY,cAAcK,MAAMQ,eAAe,QAAQ9C,cAAc8B,OAAOQ,MAAMgC,aAAazE,QAAQ6E,YAAYpC,MAAMiC,kBAAkBzE,QAAQ4E,YAAYpC,MAAMkC,aAAazE,QAAQ2E,YAAYpC,MAAMkC,aAAazD,eAAee,OAAOQ,MAAMO,cAAc,QAAQhG,OAAOqC,SAASoD,MAAMmC,cAAc5H,OAAOkB,UAAUuE,MAAMmC,cAAc5D,YAAYiB,OAAOQ,MAAMmC,cAAcpD,eAAeY,UAAUK,MAAMmC,cAAcnC,MAAMQ,eAAe,QAAQxB,uBAAuBW,UAAUK,MAAMQ,eAAe,QAAQ/B,eAAee,OAAOM,YAAYC,OAAOP,MAAMQ,KAAK,CAAC;CAC1jB;AACF"}
1
+ {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","ClassNameOrFunction","DOMRenderFunction","StyleOrFunction","stylex","useContext","ToggleGroupStateContext","ButtonClassesState","ButtonDOMProps","ButtonForm","ButtonState","ButtonGroupItem","ButtonBase","ToggleButtonBase","ButtonGroupItemContext","groupPressHandlers","useSelection","pressThen","focus","colors","motion","radii","sizing","stateLayerOpacity","FORCED_COLORS","TARGET_SIZE","styles","base","kGNEyG","kVAM5u","ksu8eU","kMzoRj","kB7OPa","kkrTdU","k1xSpc","kmuXW","kjj79g","kmVPX3","kVAEAm","kybGjl","kIyJzY","k1ekBW","kAMwcw","$$css","disabled","filled","kWkggS","kMwMTN","filledDisabled","filledToggle","filledToggleSelected","lg","kZKoxP","kGuDYH","kzqmXN","md","kgeoSG","kFcpXp","kEoFBp","outlined","outlinedDisabled","outlinedToggleSelected","outlinedToggleSelectedDisabled","pending","standard","standardDisabled","standardToggleSelected","standardToggleSelectedDisabled","tonal","tonalDisabled","tonalToggleSelected","xl","xs","xxl","hovered","focused","pressed","outlineWidths","EDGES","controlLg","controlSm","controlXl","controlXs","controlXxl","_temp","shifted","width","value","val","undefined","roundShapes","kaIpWk","selectedShapes","toggleStyles","selected","unselected","toggleContainers","const","disabledStyles","selectedDisabledStyles","IconButtonProps","children","className","IconButtonState","disableRipple","pendingLabel","render","size","IconButtonSize","style","variant","IconButtonVariant","Omit","groupStyles","group","state","shift","IconButton","t0","$","defaultSelected","href","isPending","isSelected","onChange","rel","ownSize","target","t1","props","inSelectingGroup","press","onPressStart","onPressEnd","t2","selection","t3","toggleStyleProps","isToggle","T0","iconButtonClasses","t4","t5","onPress","toggle","t6","ring","isHovered","isFocusVisible","isPressed","isDisabled","container","_c","stylex.props"],"sources":["../../../src/components/icon-button/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, DOMRenderFunction, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { ToggleGroupStateContext } from 'react-aria-components';\nimport type { ButtonClassesState, ButtonDOMProps, ButtonForm, ButtonState } from '../../button';\nimport type { ButtonGroupItem } from '../../button/context';\nimport { ButtonBase, ToggleButtonBase } from '../../button';\nimport { ButtonGroupItemContext } from '../../button/context';\nimport { groupPressHandlers } from '../../button/group';\nimport { useSelection } from '../../button/hooks';\nimport { pressThen } from '../../button/toggle';\nimport { focus } from '../../styles/focus';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, sizing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// Each variant composites an 'on-color' over its own container at the\n// interaction state's opacity, rather than swapping in a separate hover\n// color. The pairs are the icon buttons spec page's: filled on primary,\n// tonal on secondary container, outlined with an outline variant border and\n// an on-surface-variant icon, standard on surface variant over nothing.\n// calc(<opacity> * 100%) turns the token's unitless 0-1 ratio into the\n// percentage color-mix() takes. Inlined at each property rather than factored\n// into a helper: @stylexjs/babel-plugin only statically recognizes\n// expressions written directly as property values.\n//\n// **The outlined rule is faint on purpose.** Outline variant sits at about\n// 1.6:1 against the surface in the light theme and 2:1 in the dark, under the\n// 3:1 WCAG asks of a boundary that identifies a control. The rule is not that\n// boundary: the icon identifies the button, in on-surface-variant at about\n// 9:1, and the rule only shows how far the button reaches. Button's outlined\n// variant draws its rule in the same role for the same reason.\n//\n// Disabled is a style of its own per variant rather than a `:disabled`\n// branch inside each property, for the reason Button's comment gives: given\n// `href` this renders as a link, which React Aria turns into a <span> while\n// disabled, and neither matches the pseudo-class. Applied last from the\n// render state, the disabled styles replace each property whole, hover and\n// pressed branches included.\n//\n// **The outlined border thickens with the size, and the widths are Button's\n// rather than this page's.** The icon buttons page keeps them in a size token\n// set its widget will not open to a script, and the two components already\n// share their five heights on purpose — a 96dp icon button beside a 96dp\n// outlined button with a different border weight would read as a mistake.\n//\n// **A toggle is the same button reporting a state.** Given `isSelected`,\n// `defaultSelected` or `onChange` it is React Aria's `ToggleButton` instead\n// of its `Button`, which announces the state through `aria-pressed` rather\n// than a role of its own — every variant and size still applies. The page\n// gives each style a second pair of colour roles for it, and they are not\n// the plain button's: a filled toggle rests on surface container with an\n// on-surface-variant icon and takes primary once chosen, a tonal one rests\n// on secondary container and takes secondary, and a standard one is\n// transparent throughout with the icon going from on-surface-variant to\n// primary, and an outlined one swaps its border for the inverse surface\n// pair. So a chosen filled toggle looks like a plain filled button, and an\n// unchosen one does not.\n//\n// A toggle is never a link and never pending. React Aria's `ToggleButton`\n// takes neither, and neither means anything for a control whose whole job is\n// to report which of two states it is in.\n//\n// The corner softens from a circle to a rounded square while pressed, which\n// is the shape morph the icon buttons spec page gives this control, at the\n// pressed corner its size token set names: 8 for the two small sizes, 12 at\n// medium, 16 at the two large. Each size carries its own pressed radius, since\n// StyleX replaces the property whole. The transitioned properties take two\n// curves — the container, icon and rule colours the standard one, the corner\n// and a group's change of width the emphasized one — so the timing functions\n// are a matching comma list rather than one value. All of them move at once\n// for a reader who asks for reduced motion.\n//\n// A chosen toggle rests at that same pressed corner, which is the page's\n// shape morph: a toggle icon button moves from round while unchosen to\n// square once chosen. The square shape's own corner sits in a token set the\n// page keeps behind its size menu, but the page also says both shapes press\n// to the same radius — so the size's pressed corner is the value it already\n// assigns to that size, used here at rest rather than invented.\n//\n// The circle is half the button's edge as a length, not the pill token's\n// 9999px. The browser draws a corner no larger than half the box but eases\n// the value as written, so from 9999px a press spent all but the last frame\n// or two of its 150ms above the 20dp a medium button can show: the corner\n// held round and then jumped. Nor is it 50%, which a standard ButtonGroup\n// would stretch into an ellipse as it narrows the buttons beside a pressed\n// one, where a length still draws their ends round.\n//\n// **Under forced colours a container is drawn as a rule, and a chosen toggle\n// as the mode's own chosen pair.** That mode paints author backgrounds in a\n// system colour and forces the icon's, which left a filled or tonal icon\n// button as an icon with nothing round it and a chosen toggle the same as an\n// unchosen one. `base` draws a 1px `ButtonText` border there, as Button's\n// does. Outlined keeps its own rule, and standard stays without one, as the\n// page draws it. A chosen toggle of any style is filled `Highlight` with its\n// icon in `HighlightText`. A disabled button's icon and edge are `GrayText`,\n// for the reason Button's comment gives: the browser greys a disabled\n// `<button>` there, but not the `<span>` a disabled link is.\n//\n// **A disabled toggle keeps an edge for its corner to show on.** Disabled,\n// every variant takes one grey, so the corner it rests at is what tells a\n// chosen toggle from an unchosen one, and a corner shows only where\n// something is drawn round it. Filled and tonal keep their disabled\n// container, and an unchosen outlined toggle its disabled rule. A chosen\n// outlined toggle trades its rule for a container, which the disabled style\n// cleared, so it takes on-surface at the disabled-container opacity, where\n// Material Design's own tokens give that state a faint on-surface container\n// too. A chosen standard\n// toggle takes the same faint container over nothing. That departs from the\n// page, which draws a standard toggle with no container in any state, and\n// it is the one way the two states of a disabled standard toggle differ at\n// all. Under forced colours, which paint both containers over, the chosen\n// outlined toggle keeps its `GrayText` rule and the chosen standard one\n// draws one, in place of the rule its variant otherwise goes without.\n//\n// What every button does past its own styles — the ripple, the link and\n// toggle forms, the pending ring, a parent's disabled state — is\n// `src/button`'s, shared with Button.\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)';\n\n/**\n * The press area the page requires of its two smallest sizes. A literal\n * rather than `sizing.controlMd`, which holds the same number: that is a step\n * of the control scale, and a consumer resizing their medium controls should\n * not shrink a target the page states as a floor.\n */\nconst TARGET_SIZE = '48px';\nconst styles = {\n base: {\n kGNEyG: \"x6s0dn4\",\n kVAM5u: \"x1ylmb6m\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n kmuXW: \"x2lah0s\",\n kjj79g: \"xl56j7k\",\n kmVPX3: \"x1717udv\",\n kVAEAm: \"x1n2onr6\",\n kybGjl: \"x1hl2dhg\",\n kIyJzY: \"x1pvxwa0 x12w9bfk\",\n k1ekBW: \"x1ss3tkz\",\n kAMwcw: \"xcviomn\",\n $$css: true\n },\n disabled: {\n kkrTdU: \"x1h6gzvc\",\n $$css: true\n },\n filled: {\n kWkggS: \"xnety89\",\n kMwMTN: \"xwjo7ld\",\n $$css: true\n },\n filledDisabled: {\n kWkggS: \"xepofeg\",\n kVAM5u: \"xmnqt3w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1mjdul6\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xnety89 x1jzqe4\",\n kMwMTN: \"xwjo7ld x1k5gbb1\",\n $$css: true\n },\n lg: {\n kZKoxP: \"xs1ryiz\",\n kGuDYH: \"x1pvqxga\",\n kzqmXN: \"x1fh0d6s\",\n $$css: true\n },\n md: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"x1q69gdh\",\n kEoFBp: \"x1hmns74\",\n kZKoxP: \"x1rv7mn0\",\n kGuDYH: \"x1pvqxga\",\n kzqmXN: \"x1eujcsb\",\n $$css: true\n },\n outlined: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"x133yhug\",\n ksu8eU: \"x1y0btm7\",\n kMwMTN: \"x1w5n3ug\",\n $$css: true\n },\n outlinedDisabled: {\n kWkggS: \"xjbqb8w\",\n kVAM5u: \"xrh88j3 xmnqt3w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x1c5gpgi x1jzqe4\",\n kVAM5u: \"x9r1u3d x1n2ykn\",\n kMwMTN: \"x1girmi0 x1k5gbb1\",\n $$css: true\n },\n outlinedToggleSelectedDisabled: {\n kWkggS: \"xepofeg\",\n $$css: true\n },\n pending: {\n kkrTdU: \"x19v85br\",\n $$css: true\n },\n standard: {\n kWkggS: \"xjbqb8w\",\n kMzoRj: \"xc342km\",\n kMwMTN: \"x11wi6qo\",\n $$css: true\n },\n standardDisabled: {\n kWkggS: \"xjbqb8w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n standardToggleSelected: {\n kWkggS: \"xjbqb8w x1jzqe4\",\n kMzoRj: \"xc342km\",\n kMwMTN: \"x1mxwv8y x1k5gbb1\",\n $$css: true\n },\n standardToggleSelectedDisabled: {\n kWkggS: \"x19v6zzp\",\n kVAM5u: \"xmnqt3w\",\n ksu8eU: \"xx61lck\",\n kMzoRj: \"xc342km x13rsnn2\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x15dekr4\",\n kMwMTN: \"x1sawysd\",\n $$css: true\n },\n tonalDisabled: {\n kWkggS: \"xepofeg\",\n kVAM5u: \"xmnqt3w\",\n kMwMTN: \"x1xj74d8 x1bhcspo\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x167r6xl x1jzqe4\",\n kMwMTN: \"x1lba3jz x1k5gbb1\",\n $$css: true\n },\n xl: {\n kZKoxP: \"x1xaimp3\",\n kGuDYH: \"x1s3cmhv\",\n kzqmXN: \"xszbqgh\",\n $$css: true\n },\n xs: {\n kgeoSG: \"x1cpjm7i\",\n kFcpXp: \"x1n6cgzf\",\n kEoFBp: \"x1hmns74\",\n kZKoxP: \"xig8zya\",\n kGuDYH: \"xwsyq91\",\n kzqmXN: \"x11ts1a5\",\n $$css: true\n },\n xxl: {\n kZKoxP: \"x173yhrv\",\n kGuDYH: \"x1tgwohi\",\n kzqmXN: \"xz1kjiq\",\n $$css: true\n }\n};\n\n// The hover, focus and pressed layers, one style per container, applied from\n// React Aria's render state rather than from `:hover`, `:focus-visible` and\n// `:active`, for Button's reasons — see its header: a hover layer stayed on\n// after a tap, and no pressed layer or corner showed for a press made from\n// the keyboard. In the order they are applied, so where two hold the later\n// wins, as the page draws one layer at a time: focus over hover, and a press\n// over both. A chosen toggle's layer keeps its forced-colours `Highlight`,\n// since a later style replaces the property whole.\nconst hovered = {\n filled: {\n kWkggS: \"xo1ct44\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"xtxe0ya\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xo1ct44 x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x14noynh\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x1hxzsxp x1jzqe4\",\n $$css: true\n },\n standard: {\n kWkggS: \"x14noynh\",\n $$css: true\n },\n standardToggleSelected: {\n kWkggS: \"x659ado x1jzqe4\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x1fctxn6\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x12r95rf x1jzqe4\",\n $$css: true\n }\n};\nconst focused = {\n filled: {\n kWkggS: \"xhodiby\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1ppcb1\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"xhodiby x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x19p5drm\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"xn4e5mw x1jzqe4\",\n $$css: true\n },\n standard: {\n kWkggS: \"x19p5drm\",\n $$css: true\n },\n standardToggleSelected: {\n kWkggS: \"x1sog3nf x1jzqe4\",\n $$css: true\n },\n tonal: {\n kWkggS: \"x1s5x49g\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x16tkg7c x1jzqe4\",\n $$css: true\n }\n};\nconst pressed = {\n filled: {\n kWkggS: \"x7b25lv\",\n $$css: true\n },\n filledToggle: {\n kWkggS: \"x1qdfkg1\",\n $$css: true\n },\n filledToggleSelected: {\n kWkggS: \"x7b25lv x1jzqe4\",\n $$css: true\n },\n outlined: {\n kWkggS: \"x123fei2\",\n $$css: true\n },\n outlinedToggleSelected: {\n kWkggS: \"x167cdfs x1jzqe4\",\n $$css: true\n },\n standard: {\n kWkggS: \"x123fei2\",\n $$css: true\n },\n standardToggleSelected: {\n kWkggS: \"x1dvjsmr x1jzqe4\",\n $$css: true\n },\n tonal: {\n kWkggS: \"xzpauq9\",\n $$css: true\n },\n tonalToggleSelected: {\n kWkggS: \"x12o6fnv x1jzqe4\",\n $$css: true\n }\n};\n\n// The outlined border thickens with the size, as Button's does: 1dp up to M,\n// 2dp at XL, 3dp at XXL. A style per size rather than a value in the size\n// style, since a border on a filled button would draw in the icon's colour.\nconst outlineWidths = {\n lg: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n md: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n xl: {\n kMzoRj: \"xdh2fpr\",\n $$css: true\n },\n xs: {\n kMzoRj: \"xmkeg23\",\n $$css: true\n },\n xxl: {\n kMzoRj: \"x9r2w2z\",\n $$css: true\n }\n};\n\n// Each size's edge again, for the one place it is read at runtime: a standard\n// ButtonGroup widening a pressed button by adding to it. The size styles\n// above write the same values.\nconst EDGES = {\n lg: sizing.controlLg,\n md: sizing.controlSm,\n xl: sizing.controlXl,\n xs: sizing.controlXs,\n xxl: sizing.controlXxl\n};\n\n// The width a standard group sets while it widens or narrows the button.\nconst _temp = {\n kzqmXN: \"x1uyokj7\",\n \"$$css\": true\n};\nconst shifted = {\n width: (value: string) => [_temp, {\n \"--x-inlineSize\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(value)\n }]\n};\n\n// The circle each size rests at: half its edge, written as a length rather\n// than as the pill token's 9999px or as 50% — see the header. `min()` leaves\n// the pill token in charge below that, so a scheme that sets\n// `--kui-radius-pill` small still draws its icon buttons at that corner.\n// Applied after the size's style, and again for a disabled button, which\n// keeps its circle whether or not a press is still held.\nconst roundShapes = {\n lg: {\n kaIpWk: \"x1j5kmnq\",\n $$css: true\n },\n md: {\n kaIpWk: \"x1y5wlyh\",\n $$css: true\n },\n xl: {\n kaIpWk: \"x39tcx0\",\n $$css: true\n },\n xs: {\n kaIpWk: \"xcslhsm\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"xjy9rn5\",\n $$css: true\n }\n};\n\n// The corner each size presses to, which is the page's round-to-square\n// morph, and the corner a chosen toggle rests at. A style per size rather than\n// a value inside each size style, since StyleX replaces the property whole:\n// it comes after the size's circle while pressed, and after a disabled\n// button's circle too for a chosen toggle, which keeps its corner disabled.\nconst selectedShapes = {\n lg: {\n kaIpWk: \"x62ce2h\",\n $$css: true\n },\n md: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n xl: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n },\n xs: {\n kaIpWk: \"x1xdvaa9\",\n $$css: true\n },\n xxl: {\n kaIpWk: \"xhpdng0\",\n $$css: true\n }\n};\n\n// Which container a toggle draws, chosen and not. Two of the six are the\n// plain button's own styles: an unchosen tonal or standard toggle is the\n// tonal or standard button. A chosen filled toggle takes the filled button's\n// colours from a style of its own, which adds the forced-colours pair.\nconst toggleStyles = {\n filled: {\n selected: styles.filledToggleSelected,\n unselected: styles.filledToggle\n },\n outlined: {\n selected: styles.outlinedToggleSelected,\n unselected: styles.outlined\n },\n standard: {\n selected: styles.standardToggleSelected,\n unselected: styles.standard\n },\n tonal: {\n selected: styles.tonalToggleSelected,\n unselected: styles.tonal\n }\n};\n\n// The same containers by name, for the layers above.\nconst toggleContainers = {\n filled: {\n selected: 'filledToggleSelected',\n unselected: 'filledToggle'\n },\n outlined: {\n selected: 'outlinedToggleSelected',\n unselected: 'outlined'\n },\n standard: {\n selected: 'standardToggleSelected',\n unselected: 'standard'\n },\n tonal: {\n selected: 'tonalToggleSelected',\n unselected: 'tonal'\n }\n} as const;\nconst disabledStyles = {\n filled: styles.filledDisabled,\n outlined: styles.outlinedDisabled,\n standard: styles.standardDisabled,\n tonal: styles.tonalDisabled\n};\n\n// What a chosen toggle adds once disabled, over its variant's disabled style,\n// so its corner keeps an edge to show on — see the header. Filled and tonal\n// add nothing, since their disabled container already is one.\nconst selectedDisabledStyles = {\n filled: null,\n outlined: styles.outlinedToggleSelectedDisabled,\n standard: styles.standardToggleSelectedDisabled,\n tonal: null\n};\ntype IconButtonProps = {\n /**\n * What the button does, in words. Required rather than optional: an icon\n * on its own has no accessible name, so without this the control announces\n * nothing at all.\n *\n * `undefined` is for a button inside a React Aria component that names it\n * itself — a search field's clear button, a number field's steppers. React\n * Aria takes a prop over its context, so a name written here would replace\n * the one it gives in the reader's locale, and undefined leaves that stand.\n */\n 'aria-label': string | undefined;\n children?: ReactNode;\n /** A function may compute the class from the button's render state. */\n className?: ClassNameOrFunction<IconButtonState>;\n /**\n * Disables the press ripple. The hover and pressed state layers are\n * unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * The name of the ring shown while the button is pending, for a screen\n * reader. The label it replaces is hidden while it shows. Left out, it is\n * the word for it in the I18nProvider's locale — \"Loading\" in English.\n */\n pendingLabel?: string;\n /**\n * The element to render, given the props it would have carried. React\n * Aria's own form: it has to return the element the component would have\n * rendered itself.\n */\n render?: DOMRenderFunction<'button', IconButtonState>;\n /**\n * Control size: `xs` 32px, `md` 40px, `lg` 56px, `xl` 96px, `xxl` 136px —\n * the icon buttons spec page's XS to XL, and the same heights `Button`\n * uses, so the two line up beside each other in a row. The icon is 20px,\n * 24px, 24px, 32px and 40px in turn.\n * @default 'md'\n */\n size?: IconButtonSize;\n /** A function may compute the style from the button's render state. */\n style?: StyleOrFunction<IconButtonState>;\n /**\n * `standard` is transparent and tints what it sits on; `outlined` is\n * transparent with a rule around it; `filled` and `tonal` carry a container\n * of their own.\n * @default 'standard'\n */\n variant?: IconButtonVariant;\n} & ButtonForm & Omit<ButtonDOMProps, 'aria-label' | 'render'>;\ntype IconButtonSize = 'lg' | 'md' | 'xl' | 'xs' | 'xxl';\n\n// The render state a call site's `className`, `style` or `render` function is\n// handed: the one every button shares, whose `isSelected` only the toggle\n// form fills in — see `ButtonState` in src/button.\ntype IconButtonState = ButtonState;\ntype IconButtonVariant = 'filled' | 'outlined' | 'standard' | 'tonal';\n\n// What a group lays over the button: its own styles for the button's state,\n// last so a connected group's corners hold whatever the button's own shape\n// would be, and the standard group's widening or narrowing as extra width.\nfunction groupStyles(group: ButtonGroupItem | null, size: IconButtonSize, state: ButtonState) {\n if (group === null) {\n return null;\n }\n return [group.styles?.(state), group.shift !== 0 && shifted.width(`calc(${EDGES[size]} + ${group.shift}px)`)];\n}\n\n/**\n * A button that is an icon, at five control heights. Given `href` it is a\n * link with the same appearance. Every `aria-*` prop is forwarded to the\n * element; React Aria alone would keep only the labelling ones.\n *\n * Given `isSelected`, `defaultSelected` or `onChange` it is a toggle, which\n * reports its state through `aria-pressed` and draws the page's second pair\n * of colour roles for its variant. The three forms are exclusive, so a toggle\n * given `href` does not compile. A toggle may be pending, for a state saved\n * somewhere slow: the ring replaces its icon and a press changes nothing\n * until it clears.\n *\n * ```tsx\n * <IconButton aria-label=\"Label\" defaultSelected variant=\"tonal\">\n * <StarIcon />\n * </IconButton>\n * ```\n *\n * An icon shows a sighted reader no words, so one whose meaning is not plain\n * from its shape goes inside a `Tooltip` that repeats its `aria-label`,\n * shown while a pointer rests on it or it holds focus. The tooltip repeats\n * the name rather than giving it: touch never shows one, so `aria-label` is\n * still what names the button.\n *\n * ```tsx\n * <Tooltip label=\"Search\">\n * <IconButton aria-label=\"Search\">\n * <SearchIcon />\n * </IconButton>\n * </Tooltip>\n * ```\n */\nfunction IconButton({\n defaultSelected,\n href,\n isPending,\n isSelected,\n onChange,\n pendingLabel,\n rel,\n size: ownSize,\n target,\n variant = 'standard',\n ...props\n}: IconButtonProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>) {\n // A ButtonGroup around the button hands it a size, its shape at the\n // group's inner edges and the press interaction, as it does Button's; see\n // src/button/context.ts. A size named here still wins.\n const group = useContext(ButtonGroupItemContext);\n const size = ownSize ?? group?.size ?? 'md';\n const inSelectingGroup = useContext(ToggleGroupStateContext) !== null;\n const press = groupPressHandlers(group, props.onPressStart, props.onPressEnd);\n const selection = useSelection({\n defaultSelected,\n isSelected,\n onChange\n });\n\n // A selecting ButtonGroup around it makes it React Aria's ToggleButton, to\n // take part in the group's selection. Whether a button sits in one does\n // not change from one render to the next.\n if (inSelectingGroup) {\n return <ToggleButtonBase {...props} {...press} classes={toggleStyleProps(size, variant, group)} isPending={isPending} />;\n }\n\n // The three props that make this a toggle on its own. Read together rather\n // than behind a `toggle` word of its own, the way `href` already turns the\n // button into a link: a button given none of them has no state to report,\n // and one given any of them has nothing else it could mean. Either way it\n // is the same component underneath, so a toggle whose `isSelected` is\n // still loading stays the same element when the value arrives, and keeps\n // focus.\n const isToggle = defaultSelected !== undefined || isSelected !== undefined || onChange !== undefined;\n return <ButtonBase {...props} {...press} classes={isToggle ? toggleStyleProps(size, variant, group) : iconButtonClasses(size, variant, group)} href={href} isPending={isPending} isSelected={isToggle ? selection.selected : undefined} onPress={isToggle ? pressThen(props.onPress, selection.toggle) : props.onPress} pendingLabel={pendingLabel} rel={rel} target={target} />;\n}\n\n// The plain button's classes, from React Aria's render state — see the hover\n// and pressed layers above for why that and not the pseudo-classes. Built by\n// a call rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\nfunction iconButtonClasses(size: IconButtonSize, variant: IconButtonVariant, group: ButtonGroupItem | null) {\n return (state: ButtonClassesState) => stylex.props(styles.base, focus.ring, styles[variant], styles[size], roundShapes[size], variant === 'outlined' && outlineWidths[size], state.isHovered && hovered[variant], state.isFocusVisible && focused[variant], state.isPressed && pressed[variant], state.isPressed && selectedShapes[size], state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && roundShapes[size], state.isDisabled && disabledStyles[variant], groupStyles(group, size, state));\n}\n\n// A toggle's styles, from React Aria's render state. The chosen shape is\n// applied after the disabled styles so it survives them: which of the two\n// states a disabled toggle is in should still be readable, and the disabled\n// style otherwise forces the circle back. A chosen toggle's disabled edge\n// comes after them for the same reason.\nfunction toggleStyleProps(size: IconButtonSize, variant: IconButtonVariant, group: ButtonGroupItem | null) {\n return (state: ButtonClassesState) => {\n const container = toggleContainers[variant][state.isSelected === true ? 'selected' : 'unselected'];\n return stylex.props(styles.base, focus.ring, state.isSelected === true ? toggleStyles[variant].selected : toggleStyles[variant].unselected, styles[size], roundShapes[size],\n // A chosen outlined toggle has a container rather than a rule, so the\n // width goes on only while it is unchosen.\n variant === 'outlined' && state.isSelected !== true && outlineWidths[size], state.isHovered && hovered[container], state.isFocusVisible && focused[container], state.isPressed && pressed[container], state.isPressed && selectedShapes[size], state.isPending === true && styles.pending, state.isDisabled && styles.disabled, state.isDisabled && roundShapes[size], state.isDisabled && disabledStyles[variant], state.isDisabled && state.isSelected === true && selectedDisabledStyles[variant], state.isSelected === true && selectedShapes[size], groupStyles(group, size, state));\n };\n}\nexport type { IconButtonProps, IconButtonSize, IconButtonState, IconButtonVariant };\nexport default IconButton;"],"mappings":";;;;;;;;;;;;;;AAsIA,MAAM6B,SAAS;CACbC,MAAM;EACJC,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,OAAO;CACT;CACAC,UAAU;EACRX,QAAQ;EACRU,OAAO;CACT;CACAE,QAAQ;EACNC,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAK,gBAAgB;EACdF,QAAQ;EACRjB,QAAQ;EACRkB,QAAQ;EACRJ,OAAO;CACT;CACAM,cAAc;EACZH,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAO,sBAAsB;EACpBJ,QAAQ;EACRC,QAAQ;EACRJ,OAAO;CACT;CACAQ,IAAI;EACFC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRX,OAAO;CACT;CACAY,IAAI;EACFC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRN,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRX,OAAO;CACT;CACAgB,UAAU;EACRb,QAAQ;EACRjB,QAAQ;EACRC,QAAQ;EACRiB,QAAQ;EACRJ,OAAO;CACT;CACAiB,kBAAkB;EAChBd,QAAQ;EACRjB,QAAQ;EACRkB,QAAQ;EACRJ,OAAO;CACT;CACAkB,wBAAwB;EACtBf,QAAQ;EACRjB,QAAQ;EACRkB,QAAQ;EACRJ,OAAO;CACT;CACAmB,gCAAgC;EAC9BhB,QAAQ;EACRH,OAAO;CACT;CACAoB,SAAS;EACP9B,QAAQ;EACRU,OAAO;CACT;CACAqB,UAAU;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AQ9C,cAAc8B,OAAOQ,MAAMgC,aAAazE,QAAQ6E,YAAYpC,MAAMiC,kBAAkBzE,QAAQ4E,YAAYpC,MAAMkC,aAAazE,QAAQ2E,YAAYpC,MAAMkC,aAAazD,eAAee,OAAOQ,MAAMO,cAAc,QAAQhG,OAAOqC,SAASoD,MAAMmC,cAAc5H,OAAOkB,UAAUuE,MAAMmC,cAAc5D,YAAYiB,OAAOQ,MAAMmC,cAAcpD,eAAeY,UAAUK,MAAMmC,cAAcnC,MAAMQ,eAAe,QAAQxB,uBAAuBW,UAAUK,MAAMQ,eAAe,QAAQ/B,eAAee,OAAOM,YAAYC,OAAOP,MAAMQ,KAAK,CAAC;CAC1jB;AACF"}
@@ -34,6 +34,10 @@ type LinkUnderline = 'always' | 'hover' | 'none';
34
34
  * disabled, it is a span announced as a link instead, since a disabled
35
35
  * anchor is no link at all.
36
36
  *
37
+ * ```tsx
38
+ * <Link href="#first">Label</Link>
39
+ * ```
40
+ *
37
41
  * Behaviour is React Aria's: `onPress` fires for pointer, touch and keyboard
38
42
  * alike, a `RouterProvider` above it turns a navigation into a client-side
39
43
  * one, and a `Breadcrumbs` or `Menu` around it reaches it through context.
@@ -71,6 +71,10 @@ const hovered = {
71
71
  * disabled, it is a span announced as a link instead, since a disabled
72
72
  * anchor is no link at all.
73
73
  *
74
+ * ```tsx
75
+ * <Link href="#first">Label</Link>
76
+ * ```
77
+ *
74
78
  * Behaviour is React Aria's: `onPress` fires for pointer, touch and keyboard
75
79
  * alike, a `RouterProvider` above it turns a navigation into a client-side
76
80
  * one, and a `Breadcrumbs` or `Menu` around it reaches it through context.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","AriaAttributes","DOMAttributes","ReactNode","RefAttributes","ClassNameOrFunction","LinkRenderProps","LinkProps","RACLinkProps","StyleOrFunction","stylex","Link","RACLink","ariaAttributesOf","linkRenderer","focus","mergeStatefulStyles","colors","motion","radii","stateLayerOpacity","styles","base","k6CgDc","kaIpWk","kB7OPa","kkrTdU","kHjlTd","kNySMw","kcSHmL","kIyJzY","k1ekBW","kAMwcw","$$css","disabled","kMwMTN","k1TLXF","tones","inherit","primary","underlines","always","kMnn75","hover","none","hovered","tone","underline","GlobalEventKey","Exclude","HTMLElement","LinkDOMProps","Omit","Pick","children","className","style","LinkTone","LinkUnderline","t0","$","T0","t1","t2","t3","onKeyDown","onKeyUp","render","t4","t5","props","undefined","element","aria","t6","state","ring","isHovered","isDisabled","Link","_c","props","RACLink","stylex.props"],"sources":["../../../src/components/link/index.tsx"],"sourcesContent":["'use client';\n\nimport type { AriaAttributes, DOMAttributes, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, LinkRenderProps, LinkProps as RACLinkProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Link as RACLink } from 'react-aria-components';\nimport { ariaAttributesOf, linkRenderer } from '../../render/aria';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// No Material Design page draws an inline link. The nearest component is the\n// text button, whose label is the same primary role on no container, and this\n// takes that, with the disabled treatment every page gives content: on\n// surface at the disabled-content opacity. What belongs to a control standing\n// on its own is left out — the button's height, padding, type and state\n// layer. A link takes its size and face from the sentence it sits in, and\n// says it can be followed with its underline instead, which is this\n// component's own: a 1px rule in 70% of the primary role, or in the outline\n// role under `inherit`, turning fully primary on hover.\n//\n// 70% is the least that keeps the rule at 3:1 against the surface in every\n// scheme the library is shown in — Nordic, the closest, comes to 3.15:1. The\n// rule is what separates a link from its sentence, since the primary role\n// sits as close as 1.3:1 to body text in the dark theme, and at the 45% it\n// was drawn in before it measured 2:1 on the light surface.\n//\n// Hover is React Aria's render state rather than `:hover`, as Button's and\n// Tabs' are. A tap leaves a touch screen's emulated pointer over what was\n// tapped, so `:hover` kept a tapped link lit until the next tap, and React\n// Aria ignores that pointer; it also never reports a disabled link hovered.\n\nconst styles = {\n base: {\n k6CgDc: \"x12w9bfk\",\n kaIpWk: \"x1tfhd1\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n kHjlTd: \"xj0a0fe\",\n kNySMw: \"xyi4chj\",\n kcSHmL: \"x1ohr1zr\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xz1df8t\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n disabled: {\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n k1TLXF: \"x1g6epwz\",\n $$css: true\n }\n};\nconst tones = {\n inherit: {\n kMwMTN: \"x1heor9g\",\n k1TLXF: \"x1dbr5dg\",\n $$css: true\n },\n primary: {\n kMwMTN: \"x1mxwv8y\",\n k1TLXF: \"x1q3xnwu\",\n $$css: true\n }\n};\nconst underlines = {\n always: {\n kMnn75: \"xujl8zx\",\n $$css: true\n },\n hover: {\n kMnn75: \"xkrqix3\",\n $$css: true\n },\n none: {\n kMnn75: \"xkrqix3\",\n $$css: true\n }\n};\n\n// Under a pointer, from the render state — see the comment at the top. Either\n// tone turns its text and its rule fully primary, and a rule held back until\n// hover is drawn.\nconst hovered = {\n tone: {\n kMwMTN: \"x1mxwv8y\",\n k1TLXF: \"xv4vikv\",\n $$css: true\n },\n underline: {\n kMnn75: \"xujl8zx\",\n $$css: true\n }\n};\n\n// React Aria types the global DOM events against the element it renders, and\n// a handler written for an <a> does not type-check against the <span> it\n// renders while disabled. The keys are retyped against HTMLElement here, as\n// Button's are, so one set of props serves both forms; the events React Aria\n// defines itself (press, hover, focus) keep its types, since it hands those\n// its own event objects.\ntype GlobalEventKey = Exclude<keyof DOMAttributes<HTMLElement> & keyof RACLinkProps, 'onBlur' | 'onClick' | 'onFocus'>;\ntype LinkDOMProps = Omit<RACLinkProps, 'children' | 'className' | 'style' | GlobalEventKey> & Pick<DOMAttributes<HTMLElement>, GlobalEventKey>;\ntype LinkProps = {\n children?: ReactNode;\n /** A function may compute the class from the link's render state. */\n className?: ClassNameOrFunction<LinkRenderProps>;\n /** A function may compute the style from the link's render state. */\n style?: StyleOrFunction<LinkRenderProps>;\n /**\n * Which colour role to render in. `primary` marks the link out from the\n * text around it; `inherit` takes the surrounding colour and leans on the\n * underline alone, for a link in a place already understood to be links —\n * a footer, a breadcrumb, a nav.\n * @default 'primary'\n */\n tone?: LinkTone;\n /**\n * When to draw the rule. Leave it at `always` in prose: without it, colour\n * is the only thing separating the link from the sentence, which some\n * readers cannot see. `hover` and `none` are for links whose position\n * already announces them, such as a row of footer links.\n * @default 'always'\n */\n underline?: LinkUnderline;\n} & AriaAttributes & LinkDOMProps;\ntype LinkTone = 'inherit' | 'primary';\ntype LinkUnderline = 'always' | 'hover' | 'none';\n\n/**\n * A navigational link. It renders an `<a>` and sets no type of its own, so it\n * takes the size and face of the text it sits in. Without `href`, or while\n * disabled, it is a span announced as a link instead, since a disabled\n * anchor is no link at all.\n *\n * Behaviour is React Aria's: `onPress` fires for pointer, touch and keyboard\n * alike, a `RouterProvider` above it turns a navigation into a client-side\n * one, and a `Breadcrumbs` or `Menu` around it reaches it through context.\n * `render` is React Aria's function form, handed the anchor's props to spread\n * onto an element of its own. Every `aria-*` prop is forwarded to the element;\n * React Aria alone would keep only the labelling ones.\n */\nfunction Link({\n onKeyDown,\n onKeyUp,\n render,\n tone = 'primary',\n underline = 'always',\n ...props\n}: LinkProps & RefAttributes<HTMLAnchorElement>) {\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n return <RACLink render={linkRenderer(element, render)} {...props} {...mergeStatefulStyles((state: LinkRenderProps) => stylex.props(styles.base, focus.ring, tones[tone], underlines[underline], state.isHovered && hovered.tone, state.isHovered && underline === 'hover' && hovered.underline, state.isDisabled && styles.disabled), props)} />;\n}\nexport type { LinkDOMProps, LinkProps, LinkTone, LinkUnderline };\nexport default Link;"],"mappings":";;;;;;;;;AAiCA,MAAMsB,SAAS;CACb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AMC,MAAOP,MAAK6D,MAAOvC,MAAMS,OAAON,WAAWO,YAAY4B,MAAKE,aAAchC,QAAOC,MAAO6B,MAAKE,aAAc9B,cAAc,WAAWF,QAAOE,WAAY4B,MAAKG,cAAezD,OAAMa,QAAS;GAAC0B,EAAA,KAAAd;GAAAc,EAAA,KAAAb;GAAAa,EAAA,KAAAc;EAAA,OAAAA,KAAAd,EAAA;EAA9PI,KAAAhD,oBAAoB0D,IAA4OJ,OAAK;EAACV,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAA;EAAAH,KAAAD,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;CAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAC,MAAAD,EAAA,OAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAI,IAAA;EAArUI,KAAA,oBAAC,IAAD;GAAiB,QAAAN;GAA6B,GAAMQ;GAAK,GAAMN;EAAsQ,CAAA;EAAIJ,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAAzUQ;AAAyU"}
1
+ {"version":3,"file":"index.js","names":["c","_c","AriaAttributes","DOMAttributes","ReactNode","RefAttributes","ClassNameOrFunction","LinkRenderProps","LinkProps","RACLinkProps","StyleOrFunction","stylex","Link","RACLink","ariaAttributesOf","linkRenderer","focus","mergeStatefulStyles","colors","motion","radii","stateLayerOpacity","styles","base","k6CgDc","kaIpWk","kB7OPa","kkrTdU","kHjlTd","kNySMw","kcSHmL","kIyJzY","k1ekBW","kAMwcw","$$css","disabled","kMwMTN","k1TLXF","tones","inherit","primary","underlines","always","kMnn75","hover","none","hovered","tone","underline","GlobalEventKey","Exclude","HTMLElement","LinkDOMProps","Omit","Pick","children","className","style","LinkTone","LinkUnderline","t0","$","T0","t1","t2","t3","onKeyDown","onKeyUp","render","t4","t5","props","undefined","element","aria","t6","state","ring","isHovered","isDisabled","Link","_c","props","RACLink","stylex.props"],"sources":["../../../src/components/link/index.tsx"],"sourcesContent":["'use client';\n\nimport type { AriaAttributes, DOMAttributes, ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, LinkRenderProps, LinkProps as RACLinkProps, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Link as RACLink } from 'react-aria-components';\nimport { ariaAttributesOf, linkRenderer } from '../../render/aria';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, radii, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// No Material Design page draws an inline link. The nearest component is the\n// text button, whose label is the same primary role on no container, and this\n// takes that, with the disabled treatment every page gives content: on\n// surface at the disabled-content opacity. What belongs to a control standing\n// on its own is left out — the button's height, padding, type and state\n// layer. A link takes its size and face from the sentence it sits in, and\n// says it can be followed with its underline instead, which is this\n// component's own: a 1px rule in 70% of the primary role, or in the outline\n// role under `inherit`, turning fully primary on hover.\n//\n// 70% is the least that keeps the rule at 3:1 against the surface in every\n// scheme the library is shown in — Nordic, the closest, comes to 3.15:1. The\n// rule is what separates a link from its sentence, since the primary role\n// sits as close as 1.3:1 to body text in the dark theme, and at the 45% it\n// was drawn in before it measured 2:1 on the light surface.\n//\n// Hover is React Aria's render state rather than `:hover`, as Button's and\n// Tabs' are. A tap leaves a touch screen's emulated pointer over what was\n// tapped, so `:hover` kept a tapped link lit until the next tap, and React\n// Aria ignores that pointer; it also never reports a disabled link hovered.\n\nconst styles = {\n base: {\n k6CgDc: \"x12w9bfk\",\n kaIpWk: \"x1tfhd1\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n kHjlTd: \"xj0a0fe\",\n kNySMw: \"xyi4chj\",\n kcSHmL: \"x1ohr1zr\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xz1df8t\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n disabled: {\n kMwMTN: \"x1xj74d8\",\n kkrTdU: \"x1h6gzvc\",\n k1TLXF: \"x1g6epwz\",\n $$css: true\n }\n};\nconst tones = {\n inherit: {\n kMwMTN: \"x1heor9g\",\n k1TLXF: \"x1dbr5dg\",\n $$css: true\n },\n primary: {\n kMwMTN: \"x1mxwv8y\",\n k1TLXF: \"x1q3xnwu\",\n $$css: true\n }\n};\nconst underlines = {\n always: {\n kMnn75: \"xujl8zx\",\n $$css: true\n },\n hover: {\n kMnn75: \"xkrqix3\",\n $$css: true\n },\n none: {\n kMnn75: \"xkrqix3\",\n $$css: true\n }\n};\n\n// Under a pointer, from the render state — see the comment at the top. Either\n// tone turns its text and its rule fully primary, and a rule held back until\n// hover is drawn.\nconst hovered = {\n tone: {\n kMwMTN: \"x1mxwv8y\",\n k1TLXF: \"xv4vikv\",\n $$css: true\n },\n underline: {\n kMnn75: \"xujl8zx\",\n $$css: true\n }\n};\n\n// React Aria types the global DOM events against the element it renders, and\n// a handler written for an <a> does not type-check against the <span> it\n// renders while disabled. The keys are retyped against HTMLElement here, as\n// Button's are, so one set of props serves both forms; the events React Aria\n// defines itself (press, hover, focus) keep its types, since it hands those\n// its own event objects.\ntype GlobalEventKey = Exclude<keyof DOMAttributes<HTMLElement> & keyof RACLinkProps, 'onBlur' | 'onClick' | 'onFocus'>;\ntype LinkDOMProps = Omit<RACLinkProps, 'children' | 'className' | 'style' | GlobalEventKey> & Pick<DOMAttributes<HTMLElement>, GlobalEventKey>;\ntype LinkProps = {\n children?: ReactNode;\n /** A function may compute the class from the link's render state. */\n className?: ClassNameOrFunction<LinkRenderProps>;\n /** A function may compute the style from the link's render state. */\n style?: StyleOrFunction<LinkRenderProps>;\n /**\n * Which colour role to render in. `primary` marks the link out from the\n * text around it; `inherit` takes the surrounding colour and leans on the\n * underline alone, for a link in a place already understood to be links —\n * a footer, a breadcrumb, a nav.\n * @default 'primary'\n */\n tone?: LinkTone;\n /**\n * When to draw the rule. Leave it at `always` in prose: without it, colour\n * is the only thing separating the link from the sentence, which some\n * readers cannot see. `hover` and `none` are for links whose position\n * already announces them, such as a row of footer links.\n * @default 'always'\n */\n underline?: LinkUnderline;\n} & AriaAttributes & LinkDOMProps;\ntype LinkTone = 'inherit' | 'primary';\ntype LinkUnderline = 'always' | 'hover' | 'none';\n\n/**\n * A navigational link. It renders an `<a>` and sets no type of its own, so it\n * takes the size and face of the text it sits in. Without `href`, or while\n * disabled, it is a span announced as a link instead, since a disabled\n * anchor is no link at all.\n *\n * ```tsx\n * <Link href=\"#first\">Label</Link>\n * ```\n *\n * Behaviour is React Aria's: `onPress` fires for pointer, touch and keyboard\n * alike, a `RouterProvider` above it turns a navigation into a client-side\n * one, and a `Breadcrumbs` or `Menu` around it reaches it through context.\n * `render` is React Aria's function form, handed the anchor's props to spread\n * onto an element of its own. Every `aria-*` prop is forwarded to the element;\n * React Aria alone would keep only the labelling ones.\n */\nfunction Link({\n onKeyDown,\n onKeyUp,\n render,\n tone = 'primary',\n underline = 'always',\n ...props\n}: LinkProps & RefAttributes<HTMLAnchorElement>) {\n const element = {\n aria: ariaAttributesOf(props),\n onKeyDown,\n onKeyUp\n };\n return <RACLink render={linkRenderer(element, render)} {...props} {...mergeStatefulStyles((state: LinkRenderProps) => stylex.props(styles.base, focus.ring, tones[tone], underlines[underline], state.isHovered && hovered.tone, state.isHovered && underline === 'hover' && hovered.underline, state.isDisabled && styles.disabled), props)} />;\n}\nexport type { LinkDOMProps, LinkProps, LinkTone, LinkUnderline };\nexport default Link;"],"mappings":";;;;;;;;;AAiCA,MAAMsB,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;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,WAAY4B,MAAKG,cAAezD,OAAMa,QAAS;GAAC0B,EAAA,KAAAd;GAAAc,EAAA,KAAAb;GAAAa,EAAA,KAAAc;EAAA,OAAAA,KAAAd,EAAA;EAA9PI,KAAAhD,oBAAoB0D,IAA4OJ,OAAK;EAACV,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAA;EAAAH,KAAAD,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;CAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAC,MAAAD,EAAA,OAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAI,IAAA;EAArUI,KAAA,oBAAC,IAAD;GAAiB,QAAAN;GAA6B,GAAMQ;GAAK,GAAMN;EAAsQ,CAAA;EAAIJ,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAAzUQ;AAAyU"}
@@ -85,8 +85,42 @@ type ListSectionProps<T extends object = object> = Omit<GridListSectionProps<T>,
85
85
  * `List.Item`, `List.Section` and `List.LoadMore`. Name the list with
86
86
  * `aria-label` or `aria-labelledby` — nothing here labels it for you.
87
87
  *
88
+ * ```tsx
89
+ * const [selected, setSelected] = useState<Selection>(new Set(['first']))
90
+ *
91
+ * <List
92
+ * aria-label="Label"
93
+ * onSelectionChange={setSelected}
94
+ * selectedKeys={selected}
95
+ * selectionMode="multiple"
96
+ * >
97
+ * <List.Item
98
+ * id="first"
99
+ * leading={<Avatar name="Ada Lovelace" size="sm" />}
100
+ * supporting="Supporting line"
101
+ * trailing={<Currency value={1250} />}
102
+ * >
103
+ * First item
104
+ * </List.Item>
105
+ * <List.Item id="second" textValue="Second item">
106
+ * <Text variant="bodyLarge">Second item</Text>
107
+ * </List.Item>
108
+ * </List>
109
+ * ```
110
+ *
111
+ * A row's `id` is what `selectedKeys` holds. A row whose children are not a
112
+ * plain string takes a `textValue`, which is what typing a row's first
113
+ * letters matches against.
114
+ *
88
115
  * The call site's `className` and `style` land on the container, which is
89
116
  * the element a layout positions.
117
+ *
118
+ * Inside a `Virtualizer` the list is its own scroll container, so its height
119
+ * and `overflow-y: auto` go on the list, through `className` or `style`, and
120
+ * not on an element around it. React Aria sizes a page of Page Up and Page
121
+ * Down from the list's own box, so a list left to grow to its full height
122
+ * inside a scrolling wrapper is one page long, and the keys jump from one
123
+ * end of it to the other.
90
124
  */
91
125
  declare function List<T extends object>({ selectionBehavior, selectLabel, ...props }: ListProps<T> & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
92
126
  declare namespace List {
@@ -19,8 +19,9 @@ function itemContent(children, leading, overline, supporting, trailing, selectLa
19
19
  return (state) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RowContent, {
20
20
  isDisabled: state.isDisabled,
21
21
  isSelected: state.isSelected,
22
- leading: leadingFor(state, leading, selectLabel),
22
+ leading,
23
23
  overline,
24
+ selection: selectionFor(state, selectLabel),
24
25
  supporting,
25
26
  trailing,
26
27
  children
@@ -31,18 +32,6 @@ function landsOnControl(event) {
31
32
  return event.currentTarget.contains(control) && control !== event.currentTarget;
32
33
  }
33
34
  /**
34
- * The selection checkbox, then whatever the row was given. Its return type is
35
- * written out rather than inferred: `ReactNode` is a union that includes a
36
- * promise, and a function inferred as returning one has to be `async`.
37
- */
38
- function leadingFor(state, leading, selectLabel) {
39
- if (state.selectionBehavior !== "toggle" || state.selectionMode === "none") return leading;
40
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Checkbox, {
41
- "aria-label": selectLabel,
42
- slot: "selection"
43
- }), leading] });
44
- }
45
- /**
46
35
  * A list of rows one or more of which can be selected. Selection is React
47
36
  * Aria's: set `selectionMode` to `single` or `multiple`, and pass
48
37
  * `selectedKeys` with `onSelectionChange` to control it or
@@ -61,8 +50,42 @@ function leadingFor(state, leading, selectLabel) {
61
50
  * `List.Item`, `List.Section` and `List.LoadMore`. Name the list with
62
51
  * `aria-label` or `aria-labelledby` — nothing here labels it for you.
63
52
  *
53
+ * ```tsx
54
+ * const [selected, setSelected] = useState<Selection>(new Set(['first']))
55
+ *
56
+ * <List
57
+ * aria-label="Label"
58
+ * onSelectionChange={setSelected}
59
+ * selectedKeys={selected}
60
+ * selectionMode="multiple"
61
+ * >
62
+ * <List.Item
63
+ * id="first"
64
+ * leading={<Avatar name="Ada Lovelace" size="sm" />}
65
+ * supporting="Supporting line"
66
+ * trailing={<Currency value={1250} />}
67
+ * >
68
+ * First item
69
+ * </List.Item>
70
+ * <List.Item id="second" textValue="Second item">
71
+ * <Text variant="bodyLarge">Second item</Text>
72
+ * </List.Item>
73
+ * </List>
74
+ * ```
75
+ *
76
+ * A row's `id` is what `selectedKeys` holds. A row whose children are not a
77
+ * plain string takes a `textValue`, which is what typing a row's first
78
+ * letters matches against.
79
+ *
64
80
  * The call site's `className` and `style` land on the container, which is
65
81
  * the element a layout positions.
82
+ *
83
+ * Inside a `Virtualizer` the list is its own scroll container, so its height
84
+ * and `overflow-y: auto` go on the list, through `className` or `style`, and
85
+ * not on an element around it. React Aria sizes a page of Page Up and Page
86
+ * Down from the list's own box, so a list left to grow to its full height
87
+ * inside a scrolling wrapper is one page long, and the keys jump from one
88
+ * end of it to the other.
66
89
  */
67
90
  function List(t0) {
68
91
  const $ = c(23);
@@ -332,6 +355,17 @@ function ListSection(t0) {
332
355
  } else t4 = $[13];
333
356
  return t4;
334
357
  }
358
+ /**
359
+ * The selection checkbox, while the list toggles. The row draws it ahead of
360
+ * whatever `leading` holds.
361
+ */
362
+ function selectionFor(state, selectLabel) {
363
+ if (state.selectionBehavior !== "toggle" || state.selectionMode === "none") return null;
364
+ return /* @__PURE__ */ jsx(Checkbox, {
365
+ "aria-label": selectLabel,
366
+ slot: "selection"
367
+ });
368
+ }
335
369
  function startsRipple(ripple, own) {
336
370
  return (event) => {
337
371
  if (!landsOnControl(event)) ripple?.(event);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","PointerEvent","PointerEventHandler","ReactNode","RefAttributes","GridListItemRenderProps","GridListItemProps","RACGridListItemProps","GridListLoadMoreItemProps","RACGridListLoadMoreItemProps","GridListProps","RACGridListProps","GridListSectionProps","RACGridListSectionProps","stylex","createContext","useContext","GridList","RACGridList","GridListHeader","RACGridListHeader","GridListItem","RACGridListItem","GridListLoadMoreItem","RACGridListLoadMoreItem","GridListSection","RACGridListSection","CollectionLoadMore","collectionStyles","containerClasses","rowItemStyles","textOf","useRipple","RowContent","mergeStatefulStyles","mergeStyles","Checkbox","SelectLabelContext","undefined","RowsActContext","NESTED_CONTROL","ListLoadMoreProps","Omit","label","ListProps","className","T","selectionBehavior","selectLabel","style","ListRowProps","children","leading","overline","supporting","trailing","ListSectionProps","header","itemContent","ripple","state","isDisabled","isSelected","leadingFor","landsOnControl","event","HTMLDivElement","control","target","Element","closest","currentTarget","contains","selectionMode","List","t0","$","T0","T1","T2","props","t1","t2","t3","t4","t5","t6","rowsAct","onAction","dragAndDropHooks","useDraggableCollectionState","t7","t8","ListLoadMore","loading","ListRow","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","textValue","acts","href","handlers","startsRipple","surface","ListSection","section","own","Item","LoadMore","Section","_c","RACGridList","props","RACGridListLoadMoreItem","stylex.props","RACGridListItem","RACGridListSection","RACGridListHeader"],"sources":["../../../src/components/list/index.tsx"],"sourcesContent":["'use client';\n\nimport type { PointerEvent, PointerEventHandler, ReactNode, RefAttributes } from 'react';\nimport type { GridListItemRenderProps, GridListItemProps as RACGridListItemProps, GridListLoadMoreItemProps as RACGridListLoadMoreItemProps, GridListProps as RACGridListProps, GridListSectionProps as RACGridListSectionProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { GridList as RACGridList, GridListHeader as RACGridListHeader, GridListItem as RACGridListItem, GridListLoadMoreItem as RACGridListLoadMoreItem, GridListSection as RACGridListSection } from 'react-aria-components';\nimport { CollectionLoadMore } from '../../collection';\nimport { collectionStyles, containerClasses, rowItemStyles } from '../../collection/styles';\nimport { textOf } from '../../collection/text';\nimport { useRipple } from '../../hooks/useRipple';\nimport { RowContent } from '../../row';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport Checkbox from '../checkbox';\n\n// The lists page's interactive list. Each row is the row every list here\n// draws — `src/row`, shared with ListItem and ListBox — so the 56dp floor,\n// the body-large headline, the body-medium supporting line, the state layers\n// and the disabled treatment are all that module's.\n//\n// ListItem is the static row: one row, on its own, presenting. This is the\n// collection that draws the same row and adds selection, keyboard navigation\n// between rows, sections and a load-more sentinel. A page with one row uses\n// ListItem; a page with a list of them uses this.\n//\n// It is ListBox's shape over a different React Aria primitive, and the\n// difference is what the primitive allows inside a row. A listbox option is\n// a leaf: a screen reader reads its text and nothing inside it can be\n// focused, so a row with a checkbox or a button in it is not an option. A\n// grid list's row is a row of cells, and its contents can be reached and\n// operated. That is what a list with a checkbox on every row needs, and it\n// is why this exists beside ListBox rather than instead of it.\n//\n// Three things are this component's own.\n//\n// **A selecting list draws a checkbox.** React Aria reports the selection\n// mode and behaviour on each row, so a list that toggles draws one without\n// the call site saying so on every item — and it is the library's Checkbox\n// rather than a glyph, so it looks like every other checkbox on the page.\n//\n// **The checkbox is drawn first, before whatever the row was given.** The\n// page draws it leading on a plain row and trailing beside an avatar; one\n// place, always the same, is what keeps a column of rows reading down.\n//\n// **Drag and drop passes straight through.** `dragAndDropHooks` is React\n// Aria's and is not wrapped, since what a list can be dropped on is the\n// page's business rather than the row's.\n\n// What each row's selection checkbox is called. A context rather than a prop\n// on the row, since it is the list's decision and repeating it on every row\n// is how the two drift. Undefined unless the list is given one, which\n// leaves the name React Aria gives in the reader's locale.\nconst SelectLabelContext = createContext<string | undefined>(undefined);\n\n// Whether the list makes every row act on a press: it selects, it has an\n// `onAction` of its own, or its rows drag. A row given an `onAction` or an\n// `href` acts whatever this says. A context for the reason SelectLabelContext\n// is one: it is the list's to decide, and a row reads it rather than taking\n// it again as a prop.\nconst RowsActContext = createContext(false);\n\n// What a press inside a row leaves to the element it lands on: a control of\n// the row's own content, which answers the press itself. A label is in the\n// list because a native checkbox or radio is pressed through the label\n// around it. React Aria's own controls, this library's Switch and Checkbox\n// among them, stop the pointerdown of a press they take, so the row never\n// hears one.\nconst NESTED_CONTROL = 'a[href], button, input, label, select, textarea, [role=\"button\"], [role=\"checkbox\"], [role=\"link\"], [role=\"switch\"]';\ntype ListLoadMoreProps = Omit<RACGridListLoadMoreItemProps, 'children'> & {\n /**\n * What the row says while it is loading. Read by a screen reader; the ring\n * itself carries no text.\n * Left out, it is the word for it in the I18nProvider's locale — \"Loading\n * more\" in English.\n */\n label?: string;\n};\ntype ListProps<T extends object = object> = {\n /** A function may compute the class from the list's render state. */\n className?: RACGridListProps<T>['className'];\n /**\n * How a press selects. `toggle` draws a checkbox on every row, and a press\n * adds that row to the selection or takes it out. `replace` draws none, a\n * press makes that row the selection, and the arrow keys carry the\n * selection with the focus; where rows also take an action, a click\n * selects and a double click acts. Left out, a `single` list replaces and\n * any other toggles, since a single choice drawn as checkboxes unticks one\n * box whenever another is ticked.\n */\n selectionBehavior?: RACGridListProps<T>['selectionBehavior'];\n /**\n * What each row's selection checkbox is called, for a screen reader. The\n * row's own text is what names the row; this names the box inside it.\n * Left out, React Aria names it in the reader's locale — \"Select\" in\n * English.\n */\n selectLabel?: string;\n /** A function may compute the style from the list's render state. */\n style?: RACGridListProps<T>['style'];\n} & Omit<RACGridListProps<T>, 'className' | 'selectionBehavior' | 'style'>;\n\n// `Row` rather than `Item`, though the component is `List.Item`, because\n// `ListItemProps` is the standalone `ListItem` component's and both are\n// exported from the package. The two overlap on four props, so a call site\n// reaching for the obvious name got something that typechecked until it\n// passed `textValue`, and an error pointing at `onClick` rather than at the\n// name. `row` is what this file and `src/row` call the thing anyway.\ntype ListRowProps<T extends object = object> = {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /** A function may compute the class from the row's render state. */\n className?: RACGridListItemProps<T>['className'];\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes — a category, a date, a status. Given\n * alongside `supporting` it makes the row the page's three-line item.\n */\n overline?: ReactNode;\n /** A function may compute the style from the row's render state. */\n style?: RACGridListItemProps<T>['style'];\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as an amount or a control. */\n trailing?: ReactNode;\n} & Omit<RACGridListItemProps<T>, 'children' | 'className' | 'style'>;\ntype ListSectionProps<T extends object = object> = Omit<RACGridListSectionProps<T>, 'children'> & {\n /**\n * The rows in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\n\n// What the row draws, from React Aria's render state. Built by a call rather\n// than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\n//\n// The state decides two things: whether a selection checkbox is drawn, and\n// which colour the supporting line takes — the muted role holds only while\n// the row is drawn on the surface.\nfunction itemContent(children: ReactNode, leading: ReactNode, overline: ReactNode, supporting: ReactNode, trailing: ReactNode, selectLabel: string | undefined, ripple: ReactNode) {\n return (state: GridListItemRenderProps) => <>\n <RowContent isDisabled={state.isDisabled} isSelected={state.isSelected} leading={leadingFor(state, leading, selectLabel)} overline={overline} supporting={supporting} trailing={trailing}>\n {children}\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n}\n\n// Whether a press on the row began on a control inside it rather than on the\n// row itself. `contains` answers false for no control at all, and true for\n// the row itself, which the second half rules out.\nfunction landsOnControl(event: PointerEvent<HTMLDivElement>) {\n const control = event.target instanceof Element ? event.target.closest(NESTED_CONTROL) : null;\n return event.currentTarget.contains(control) && control !== event.currentTarget;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// row's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so its ground and colour\n// win over the selected container's. The state layers come from the render\n// state as well — see `focusVisible` in src/row/styles.ts — and React Aria\n// reports none of them on a disabled row, so nothing has to outrank them.\n//\n// A supporting line moves the row from the page's one-line container height\n// to its two-line one, which is a floor rather than something the row's own\n// box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as an\n// argument rather than read from the render state, since React Aria reports\n// what a row is doing and not what it holds; the row is built by a call for\n// the same reason `itemContent` is.\n/**\n * The selection checkbox, then whatever the row was given. Its return type is\n * written out rather than inferred: `ReactNode` is a union that includes a\n * promise, and a function inferred as returning one has to be `async`.\n */\nfunction leadingFor(state: GridListItemRenderProps, leading: ReactNode, selectLabel: string | undefined): ReactNode {\n if (state.selectionBehavior !== 'toggle' || state.selectionMode === 'none') {\n return leading;\n }\n return <>\n <Checkbox aria-label={selectLabel} slot=\"selection\" />\n {leading}\n </>;\n}\n\n/**\n * A list of rows one or more of which can be selected. Selection is React\n * Aria's: set `selectionMode` to `single` or `multiple`, and pass\n * `selectedKeys` with `onSelectionChange` to control it or\n * `defaultSelectedKeys` to let it keep its own. A list that only responds to\n * a press takes `onAction` on the row instead.\n *\n * A `multiple` list draws a checkbox on every row. A `single` one draws none\n * and marks the chosen row alone, since a checkbox promises a choice that\n * leaves the others standing; `selectionBehavior` overrides either.\n *\n * ListItem is the static row — one row, presenting, on its own. This is the\n * collection that draws the same row and adds selection, keyboard navigation\n * between rows, sections and a load-more sentinel.\n *\n * Composed from parts, since a row's slots take arbitrary content:\n * `List.Item`, `List.Section` and `List.LoadMore`. Name the list with\n * `aria-label` or `aria-labelledby` — nothing here labels it for you.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction List<T extends object>({\n selectionBehavior,\n selectLabel,\n ...props\n}: ListProps<T> & RefAttributes<HTMLDivElement>) {\n // React Aria's own reading of a draggable collection: hooks that can build\n // the drag state.\n const rowsAct = (props.selectionMode ?? 'none') !== 'none' || props.onAction !== undefined || props.dragAndDropHooks?.useDraggableCollectionState !== undefined;\n return <SelectLabelContext value={selectLabel}>\n <RowsActContext value={rowsAct}>\n <RACGridList {...props} {...mergeStatefulStyles(containerClasses, props)}\n // React Aria's own default is `toggle` in every mode. Read with `??`\n // rather than placed before the spread, so a wrapper forwarding an\n // unset prop still gets the default.\n selectionBehavior={selectionBehavior ?? (props.selectionMode === 'single' ? 'replace' : 'toggle')} />\n </RowsActContext>\n </SelectLabelContext>;\n}\n\n/**\n * The row the list shows while it is fetching more. React Aria calls\n * `onLoadMore` when this comes into view, and draws it only while\n * `isLoading`.\n */\nfunction ListLoadMore({\n label,\n ...props\n}: ListLoadMoreProps & RefAttributes<HTMLDivElement>) {\n return <RACGridListLoadMoreItem {...props} {...mergeStyles(stylex.props(collectionStyles.loading), props)}>\n <CollectionLoadMore diameter=\"24px\" label={label} />\n </RACGridListLoadMoreItem>;\n}\n\n/**\n * One row. Its slots are the row's: `leading`, the headline as children,\n * `supporting` under it, and `trailing`. Give every row an `id` — that is\n * the key selection is reported by.\n *\n * A list that selects with checkboxes draws one before whatever `leading`\n * holds, from the state React Aria reports rather than from a prop here.\n */\nfunction ListRow<T extends object = object>({\n children,\n leading,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n overline,\n supporting,\n textValue,\n trailing,\n ...props\n}: ListRowProps<T> & RefAttributes<HTMLDivElement>) {\n const selectLabel = useContext(SelectLabelContext);\n const acts = useContext(RowsActContext) || props.onAction !== undefined || props.href !== undefined;\n // The press ripple ListItem draws, so a row looks the same pressed in a\n // list as on its own, and only on a row a press acts on, as ListItem draws\n // it only on an interactive one: a row that does nothing on a press should\n // not look as though it did. The call site's pointer handlers are handed to\n // the hook to merge, for the reason ListItem gives, apart from the press\n // itself, which `startsRipple` hands on. React Aria keeps a row's clicks\n // for its own press handling, so the press ends on the release.\n const ripple = useRipple<HTMLDivElement>(acts, {\n onContextMenu,\n onPointerCancel,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACGridListItem textValue={textValue ?? textOf(children)} {...ripple.handlers} onPointerDown={startsRipple(ripple.handlers.onPointerDown, onPointerDown)} {...props} {...mergeStatefulStyles(rowItemStyles(supporting, overline), props)}>\n {itemContent(children, leading, overline, supporting, trailing, selectLabel, ripple.surface)}\n </RACGridListItem>;\n}\n\n/**\n * A named group of rows. `header` names it, and is what a screen reader\n * reads before the rows inside.\n */\nfunction ListSection<T extends object = object>({\n children,\n header,\n ...props\n}: ListSectionProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACGridListSection {...props} {...mergeStyles(stylex.props(collectionStyles.section), props)}>\n {header === undefined ? null : <RACGridListHeader {...stylex.props(collectionStyles.header)}>\n {header}\n </RACGridListHeader>}\n {children}\n </RACGridListSection>;\n}\n\n// The row's press: the ripple's, unless it lands on a control inside the\n// row, which answers it itself — a trailing button pressed spread the row's\n// ripple across the whole row. The call site's own handler runs either way,\n// after the ripple's, as the hook orders the two. Built by a call rather than\n// written at the prop, for the reason `itemContent` gives.\nfunction startsRipple(ripple: PointerEventHandler<HTMLDivElement> | undefined, own: PointerEventHandler<HTMLDivElement> | undefined) {\n return (event: PointerEvent<HTMLDivElement>) => {\n if (!landsOnControl(event)) {\n ripple?.(event);\n }\n own?.(event);\n };\n}\nList.Item = ListRow;\nList.LoadMore = ListLoadMore;\nList.Section = ListSection;\nexport type { ListLoadMoreProps, ListProps, ListRowProps, ListSectionProps };\nexport { ListLoadMore, ListRow, ListSection };\nexport default List;"],"mappings":";;;;;;;;;;;;;;AAoDA,MAAMsC,qBAAqBtB,cAAkCuB,KAAAA,CAAS;AAOtE,MAAMC,iBAAiBxB,cAAc,KAAK;AAQ1C,MAAMyB,iBAAiB;AAkFvB,SAASkB,YAAYP,UAAqBC,SAAo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MAAM5C,KAAK;CACb;AACF;AACAS,KAAKoC,OAAOf;AACZrB,KAAKqC,WAAWlB;AAChBnB,KAAKsC,UAAUL"}
1
+ {"version":3,"file":"index.js","names":["c","_c","PointerEvent","PointerEventHandler","ReactNode","RefAttributes","GridListItemRenderProps","GridListItemProps","RACGridListItemProps","GridListLoadMoreItemProps","RACGridListLoadMoreItemProps","GridListProps","RACGridListProps","GridListSectionProps","RACGridListSectionProps","stylex","createContext","useContext","GridList","RACGridList","GridListHeader","RACGridListHeader","GridListItem","RACGridListItem","GridListLoadMoreItem","RACGridListLoadMoreItem","GridListSection","RACGridListSection","CollectionLoadMore","collectionStyles","containerClasses","rowItemStyles","textOf","useRipple","RowContent","mergeStatefulStyles","mergeStyles","Checkbox","SelectLabelContext","undefined","RowsActContext","NESTED_CONTROL","ListLoadMoreProps","Omit","label","ListProps","className","T","selectionBehavior","selectLabel","style","ListRowProps","children","leading","overline","supporting","trailing","ListSectionProps","header","itemContent","ripple","state","isDisabled","isSelected","selectionFor","landsOnControl","event","HTMLDivElement","control","target","Element","closest","currentTarget","contains","List","t0","$","T0","T1","T2","props","t1","t2","t3","t4","t5","t6","rowsAct","selectionMode","onAction","dragAndDropHooks","useDraggableCollectionState","t7","t8","ListLoadMore","loading","ListRow","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","textValue","acts","href","handlers","startsRipple","surface","ListSection","section","own","Item","LoadMore","Section","_c","RACGridList","props","RACGridListLoadMoreItem","stylex.props","RACGridListItem","RACGridListSection","RACGridListHeader"],"sources":["../../../src/components/list/index.tsx"],"sourcesContent":["'use client';\n\nimport type { PointerEvent, PointerEventHandler, ReactNode, RefAttributes } from 'react';\nimport type { GridListItemRenderProps, GridListItemProps as RACGridListItemProps, GridListLoadMoreItemProps as RACGridListLoadMoreItemProps, GridListProps as RACGridListProps, GridListSectionProps as RACGridListSectionProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { GridList as RACGridList, GridListHeader as RACGridListHeader, GridListItem as RACGridListItem, GridListLoadMoreItem as RACGridListLoadMoreItem, GridListSection as RACGridListSection } from 'react-aria-components';\nimport { CollectionLoadMore } from '../../collection';\nimport { collectionStyles, containerClasses, rowItemStyles } from '../../collection/styles';\nimport { textOf } from '../../collection/text';\nimport { useRipple } from '../../hooks/useRipple';\nimport { RowContent } from '../../row';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport Checkbox from '../checkbox';\n\n// The lists page's interactive list. Each row is the row every list here\n// draws — `src/row`, shared with ListItem and ListBox — so the 56dp floor,\n// the body-large headline, the body-medium supporting line, the state layers\n// and the disabled treatment are all that module's.\n//\n// ListItem is the static row: one row, on its own, presenting. This is the\n// collection that draws the same row and adds selection, keyboard navigation\n// between rows, sections and a load-more sentinel. A page with one row uses\n// ListItem; a page with a list of them uses this.\n//\n// It is ListBox's shape over a different React Aria primitive, and the\n// difference is what the primitive allows inside a row. A listbox option is\n// a leaf: a screen reader reads its text and nothing inside it can be\n// focused, so a row with a checkbox or a button in it is not an option. A\n// grid list's row is a row of cells, and its contents can be reached and\n// operated. That is what a list with a checkbox on every row needs, and it\n// is why this exists beside ListBox rather than instead of it.\n//\n// Three things are this component's own.\n//\n// **A selecting list draws a checkbox.** React Aria reports the selection\n// mode and behaviour on each row, so a list that toggles draws one without\n// the call site saying so on every item — and it is the library's Checkbox\n// rather than a glyph, so it looks like every other checkbox on the page.\n//\n// **The checkbox is drawn first, before whatever the row was given.** The\n// page draws it leading on a plain row and trailing beside an avatar; one\n// place, always the same, is what keeps a column of rows reading down.\n//\n// **Drag and drop passes straight through.** `dragAndDropHooks` is React\n// Aria's and is not wrapped, since what a list can be dropped on is the\n// page's business rather than the row's.\n\n// What each row's selection checkbox is called. A context rather than a prop\n// on the row, since it is the list's decision and repeating it on every row\n// is how the two drift. Undefined unless the list is given one, which\n// leaves the name React Aria gives in the reader's locale.\nconst SelectLabelContext = createContext<string | undefined>(undefined);\n\n// Whether the list makes every row act on a press: it selects, it has an\n// `onAction` of its own, or its rows drag. A row given an `onAction` or an\n// `href` acts whatever this says. A context for the reason SelectLabelContext\n// is one: it is the list's to decide, and a row reads it rather than taking\n// it again as a prop.\nconst RowsActContext = createContext(false);\n\n// What a press inside a row leaves to the element it lands on: a control of\n// the row's own content, which answers the press itself. A label is in the\n// list because a native checkbox or radio is pressed through the label\n// around it. React Aria's own controls, this library's Switch and Checkbox\n// among them, stop the pointerdown of a press they take, so the row never\n// hears one.\nconst NESTED_CONTROL = 'a[href], button, input, label, select, textarea, [role=\"button\"], [role=\"checkbox\"], [role=\"link\"], [role=\"switch\"]';\ntype ListLoadMoreProps = Omit<RACGridListLoadMoreItemProps, 'children'> & {\n /**\n * What the row says while it is loading. Read by a screen reader; the ring\n * itself carries no text.\n * Left out, it is the word for it in the I18nProvider's locale — \"Loading\n * more\" in English.\n */\n label?: string;\n};\ntype ListProps<T extends object = object> = {\n /** A function may compute the class from the list's render state. */\n className?: RACGridListProps<T>['className'];\n /**\n * How a press selects. `toggle` draws a checkbox on every row, and a press\n * adds that row to the selection or takes it out. `replace` draws none, a\n * press makes that row the selection, and the arrow keys carry the\n * selection with the focus; where rows also take an action, a click\n * selects and a double click acts. Left out, a `single` list replaces and\n * any other toggles, since a single choice drawn as checkboxes unticks one\n * box whenever another is ticked.\n */\n selectionBehavior?: RACGridListProps<T>['selectionBehavior'];\n /**\n * What each row's selection checkbox is called, for a screen reader. The\n * row's own text is what names the row; this names the box inside it.\n * Left out, React Aria names it in the reader's locale — \"Select\" in\n * English.\n */\n selectLabel?: string;\n /** A function may compute the style from the list's render state. */\n style?: RACGridListProps<T>['style'];\n} & Omit<RACGridListProps<T>, 'className' | 'selectionBehavior' | 'style'>;\n\n// `Row` rather than `Item`, though the component is `List.Item`, because\n// `ListItemProps` is the standalone `ListItem` component's and both are\n// exported from the package. The two overlap on four props, so a call site\n// reaching for the obvious name got something that typechecked until it\n// passed `textValue`, and an error pointing at `onClick` rather than at the\n// name. `row` is what this file and `src/row` call the thing anyway.\ntype ListRowProps<T extends object = object> = {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /** A function may compute the class from the row's render state. */\n className?: RACGridListItemProps<T>['className'];\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes — a category, a date, a status. Given\n * alongside `supporting` it makes the row the page's three-line item.\n */\n overline?: ReactNode;\n /** A function may compute the style from the row's render state. */\n style?: RACGridListItemProps<T>['style'];\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as an amount or a control. */\n trailing?: ReactNode;\n} & Omit<RACGridListItemProps<T>, 'children' | 'className' | 'style'>;\ntype ListSectionProps<T extends object = object> = Omit<RACGridListSectionProps<T>, 'children'> & {\n /**\n * The rows in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\n\n// What the row draws, from React Aria's render state. Built by a call rather\n// than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\n//\n// The state decides two things: whether a selection checkbox is drawn, and\n// which colour the supporting line takes — the muted role holds only while\n// the row is drawn on the surface.\nfunction itemContent(children: ReactNode, leading: ReactNode, overline: ReactNode, supporting: ReactNode, trailing: ReactNode, selectLabel: string | undefined, ripple: ReactNode) {\n return (state: GridListItemRenderProps) => <>\n <RowContent isDisabled={state.isDisabled} isSelected={state.isSelected} leading={leading} overline={overline} selection={selectionFor(state, selectLabel)} supporting={supporting} trailing={trailing}>\n {children}\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n}\n\n// Whether a press on the row began on a control inside it rather than on the\n// row itself. `contains` answers false for no control at all, and true for\n// the row itself, which the second half rules out.\nfunction landsOnControl(event: PointerEvent<HTMLDivElement>) {\n const control = event.target instanceof Element ? event.target.closest(NESTED_CONTROL) : null;\n return event.currentTarget.contains(control) && control !== event.currentTarget;\n}\n\n/**\n * A list of rows one or more of which can be selected. Selection is React\n * Aria's: set `selectionMode` to `single` or `multiple`, and pass\n * `selectedKeys` with `onSelectionChange` to control it or\n * `defaultSelectedKeys` to let it keep its own. A list that only responds to\n * a press takes `onAction` on the row instead.\n *\n * A `multiple` list draws a checkbox on every row. A `single` one draws none\n * and marks the chosen row alone, since a checkbox promises a choice that\n * leaves the others standing; `selectionBehavior` overrides either.\n *\n * ListItem is the static row — one row, presenting, on its own. This is the\n * collection that draws the same row and adds selection, keyboard navigation\n * between rows, sections and a load-more sentinel.\n *\n * Composed from parts, since a row's slots take arbitrary content:\n * `List.Item`, `List.Section` and `List.LoadMore`. Name the list with\n * `aria-label` or `aria-labelledby` — nothing here labels it for you.\n *\n * ```tsx\n * const [selected, setSelected] = useState<Selection>(new Set(['first']))\n *\n * <List\n * aria-label=\"Label\"\n * onSelectionChange={setSelected}\n * selectedKeys={selected}\n * selectionMode=\"multiple\"\n * >\n * <List.Item\n * id=\"first\"\n * leading={<Avatar name=\"Ada Lovelace\" size=\"sm\" />}\n * supporting=\"Supporting line\"\n * trailing={<Currency value={1250} />}\n * >\n * First item\n * </List.Item>\n * <List.Item id=\"second\" textValue=\"Second item\">\n * <Text variant=\"bodyLarge\">Second item</Text>\n * </List.Item>\n * </List>\n * ```\n *\n * A row's `id` is what `selectedKeys` holds. A row whose children are not a\n * plain string takes a `textValue`, which is what typing a row's first\n * letters matches against.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n *\n * Inside a `Virtualizer` the list is its own scroll container, so its height\n * and `overflow-y: auto` go on the list, through `className` or `style`, and\n * not on an element around it. React Aria sizes a page of Page Up and Page\n * Down from the list's own box, so a list left to grow to its full height\n * inside a scrolling wrapper is one page long, and the keys jump from one\n * end of it to the other.\n */\nfunction List<T extends object>({\n selectionBehavior,\n selectLabel,\n ...props\n}: ListProps<T> & RefAttributes<HTMLDivElement>) {\n // React Aria's own reading of a draggable collection: hooks that can build\n // the drag state.\n const rowsAct = (props.selectionMode ?? 'none') !== 'none' || props.onAction !== undefined || props.dragAndDropHooks?.useDraggableCollectionState !== undefined;\n return <SelectLabelContext value={selectLabel}>\n <RowsActContext value={rowsAct}>\n <RACGridList {...props} {...mergeStatefulStyles(containerClasses, props)}\n // React Aria's own default is `toggle` in every mode. Read with `??`\n // rather than placed before the spread, so a wrapper forwarding an\n // unset prop still gets the default.\n selectionBehavior={selectionBehavior ?? (props.selectionMode === 'single' ? 'replace' : 'toggle')} />\n </RowsActContext>\n </SelectLabelContext>;\n}\n\n/**\n * The row the list shows while it is fetching more. React Aria calls\n * `onLoadMore` when this comes into view, and draws it only while\n * `isLoading`.\n */\nfunction ListLoadMore({\n label,\n ...props\n}: ListLoadMoreProps & RefAttributes<HTMLDivElement>) {\n return <RACGridListLoadMoreItem {...props} {...mergeStyles(stylex.props(collectionStyles.loading), props)}>\n <CollectionLoadMore diameter=\"24px\" label={label} />\n </RACGridListLoadMoreItem>;\n}\n\n/**\n * One row. Its slots are the row's: `leading`, the headline as children,\n * `supporting` under it, and `trailing`. Give every row an `id` — that is\n * the key selection is reported by.\n *\n * A list that selects with checkboxes draws one before whatever `leading`\n * holds, from the state React Aria reports rather than from a prop here.\n */\nfunction ListRow<T extends object = object>({\n children,\n leading,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n overline,\n supporting,\n textValue,\n trailing,\n ...props\n}: ListRowProps<T> & RefAttributes<HTMLDivElement>) {\n const selectLabel = useContext(SelectLabelContext);\n const acts = useContext(RowsActContext) || props.onAction !== undefined || props.href !== undefined;\n // The press ripple ListItem draws, so a row looks the same pressed in a\n // list as on its own, and only on a row a press acts on, as ListItem draws\n // it only on an interactive one: a row that does nothing on a press should\n // not look as though it did. The call site's pointer handlers are handed to\n // the hook to merge, for the reason ListItem gives, apart from the press\n // itself, which `startsRipple` hands on. React Aria keeps a row's clicks\n // for its own press handling, so the press ends on the release.\n const ripple = useRipple<HTMLDivElement>(acts, {\n onContextMenu,\n onPointerCancel,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACGridListItem textValue={textValue ?? textOf(children)} {...ripple.handlers} onPointerDown={startsRipple(ripple.handlers.onPointerDown, onPointerDown)} {...props} {...mergeStatefulStyles(rowItemStyles(supporting, overline), props)}>\n {itemContent(children, leading, overline, supporting, trailing, selectLabel, ripple.surface)}\n </RACGridListItem>;\n}\n\n/**\n * A named group of rows. `header` names it, and is what a screen reader\n * reads before the rows inside.\n */\nfunction ListSection<T extends object = object>({\n children,\n header,\n ...props\n}: ListSectionProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACGridListSection {...props} {...mergeStyles(stylex.props(collectionStyles.section), props)}>\n {header === undefined ? null : <RACGridListHeader {...stylex.props(collectionStyles.header)}>\n {header}\n </RACGridListHeader>}\n {children}\n </RACGridListSection>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// row's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so its ground and colour\n// win over the selected container's. The state layers come from the render\n// state as well — see `focusVisible` in src/row/styles.ts — and React Aria\n// reports none of them on a disabled row, so nothing has to outrank them.\n//\n// A supporting line moves the row from the page's one-line container height\n// to its two-line one, which is a floor rather than something the row's own\n// box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as an\n// argument rather than read from the render state, since React Aria reports\n// what a row is doing and not what it holds; the row is built by a call for\n// the same reason `itemContent` is.\n/**\n * The selection checkbox, while the list toggles. The row draws it ahead of\n * whatever `leading` holds.\n */\nfunction selectionFor(state: GridListItemRenderProps, selectLabel: string | undefined) {\n if (state.selectionBehavior !== 'toggle' || state.selectionMode === 'none') {\n return null;\n }\n return <Checkbox aria-label={selectLabel} slot=\"selection\" />;\n}\n\n// The row's press: the ripple's, unless it lands on a control inside the\n// row, which answers it itself — a trailing button pressed spread the row's\n// ripple across the whole row. The call site's own handler runs either way,\n// after the ripple's, as the hook orders the two. Built by a call rather than\n// written at the prop, for the reason `itemContent` gives.\nfunction startsRipple(ripple: PointerEventHandler<HTMLDivElement> | undefined, own: PointerEventHandler<HTMLDivElement> | undefined) {\n return (event: PointerEvent<HTMLDivElement>) => {\n if (!landsOnControl(event)) {\n ripple?.(event);\n }\n own?.(event);\n };\n}\nList.Item = ListRow;\nList.LoadMore = ListLoadMore;\nList.Section = ListSection;\nexport type { ListLoadMoreProps, ListProps, ListRowProps, ListSectionProps };\nexport { ListLoadMore, ListRow, ListSection };\nexport default List;"],"mappings":";;;;;;;;;;;;;;AAoDA,MAAMsC,qBAAqBtB,cAAkCuB,KAAAA,CAAS;AAOtE,MAAMC,iBAAiBxB,cAAc,KAAK;AAQ1C,MAAMyB,iBAAiB;AAkFvB,SAASkB,YAAYP,UAAqBC,SAAoBC,UAAqBC,YAAuBC,UAAqBP,aAAiCW,QAAmB;CACjL,QAAQC,UAAmC,qBAAA,YAAA,EAAA,UAAA,CACvC,oBAAC,YAAD;EAAY,YAAYA,MAAMC;EAAY,YAAYD,MAAME;EAAqBV;EAAmBC;EAAU,WAAWU,aAAaH,OAAOZ,WAAW;EAAeM;EAAsBC;EAC1LJ;CACS,CAAA,GACXS,MAAMC,aAAa,OAAOF,MAC7B,EAAA,CAAA;AACJ;AAKA,SAASK,eAAeC,OAAqC;CAC3D,MAAME,UAAUF,MAAMG,kBAAkBC,UAAUJ,MAAMG,OAAOE,QAAQ9B,cAAc,IAAI;CACzF,OAAOyB,MAAMM,cAAcC,SAASL,OAAO,KAAKA,YAAYF,MAAMM;AACpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,SAAAE,KAAAC,IAAA;CAAA,MAAAC,IAAA3E,EAAA,EAAA;CAAA,IAAA4E;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAhC;CAAA,IAAAiC;CAAA,IAAAC;CAAA,IAAAC;CAAA,I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GAAnC,UAAA,CACFC,IAGA/B,QAJqB;;EAKHwB,EAAA,KAAAC;EAAAD,EAAA,KAAAxB;EAAAwB,EAAA,MAAAK;EAAAL,EAAA,MAAAM;EAAAN,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OALhBQ;AAKgB;;;;;AAoBzB,SAASpB,aAAaH,OAAgCZ,aAAiC;CACrF,IAAIY,MAAMb,sBAAsB,YAAYa,MAAM2B,kBAAkB,QAClE,OAAO;CAET,OAAO,oBAAC,UAAD;EAAU,cAAYvC;EAAa,MAAK;CAAW,CAAA;AAC5D;AAOA,SAASyD,aAAa9C,QAAyDkD,KAAsD;CACnI,QAAQ5C,UAAwC;EAC9C,IAAI,CAACD,eAAeC,KAAK,GACvBN,SAASM,KAAK;EAEhB4C,MAAM5C,KAAK;CACb;AACF;AACAQ,KAAKqC,OAAOf;AACZtB,KAAKsC,WAAWlB;AAChBpB,KAAKuC,UAAUL"}
@@ -55,7 +55,40 @@ type ListDetailProps = {
55
55
  * While only one pane fits, the pane that is not showing is hidden
56
56
  * outright, so focus inside it is dropped when `showing` changes. The call
57
57
  * site that changed it is what puts focus in the pane it revealed — see the
58
- * prop.
58
+ * prop. `flushSync` commits the swap before focus moves, since a pane that is
59
+ * still hidden cannot take it:
60
+ *
61
+ * ```tsx
62
+ * const [showing, setShowing] = useState<'detail' | 'list'>('list')
63
+ * const heading = useRef<HTMLHeadingElement>(null)
64
+ * const opener = useRef<HTMLElement>(null)
65
+ *
66
+ * function open(event: MouseEvent<HTMLElement>) {
67
+ * opener.current = event.currentTarget
68
+ * flushSync(() => setShowing('detail'))
69
+ * heading.current?.focus()
70
+ * }
71
+ *
72
+ * function back() {
73
+ * flushSync(() => setShowing('list'))
74
+ * opener.current?.focus()
75
+ * }
76
+ *
77
+ * <ListDetail
78
+ * detail={
79
+ * <>
80
+ * <Button onPress={back} variant="text">Back</Button>
81
+ * <h2 ref={heading} tabIndex={-1}>Headline</h2>
82
+ * </>
83
+ * }
84
+ * list={
85
+ * <ListItem interactive onClick={open}>
86
+ * First item
87
+ * </ListItem>
88
+ * }
89
+ * showing={showing}
90
+ * />
91
+ * ```
59
92
  */
60
93
  declare function ListDetail({ detail, list, render, showing, ...props }: ListDetailProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
61
94
  //#endregion