reshaped 3.7.0-canary.9 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/bundle.css +1 -1
  3. package/dist/bundle.d.ts +1 -2
  4. package/dist/bundle.js +11 -11
  5. package/dist/cjs/themes/_generator/tokens/color/utilities/generateColors.js +1 -1
  6. package/dist/cjs/themes/_generator/tokens/css.js +2 -2
  7. package/dist/cjs/themes/figma/theme.css +1 -1
  8. package/dist/cjs/themes/fragments/twitter/theme.css +1 -1
  9. package/dist/cjs/themes/reshaped/theme.css +1 -1
  10. package/dist/cjs/themes/slate/theme.css +1 -1
  11. package/dist/components/Accordion/Accordion.types.d.ts +2 -0
  12. package/dist/components/ActionBar/ActionBar.js +12 -4
  13. package/dist/components/ActionBar/ActionBar.module.css +1 -1
  14. package/dist/components/ActionBar/ActionBar.types.d.ts +4 -1
  15. package/dist/components/ActionBar/tests/ActionBar.stories.d.ts +19 -1
  16. package/dist/components/ActionBar/tests/ActionBar.stories.js +161 -3
  17. package/dist/components/Actionable/Actionable.js +3 -3
  18. package/dist/components/Actionable/Actionable.module.css +1 -1
  19. package/dist/components/Actionable/Actionable.types.d.ts +1 -0
  20. package/dist/components/Autocomplete/Autocomplete.js +66 -25
  21. package/dist/components/Autocomplete/Autocomplete.types.d.ts +2 -0
  22. package/dist/components/Autocomplete/tests/Autocomplete.stories.js +8 -8
  23. package/dist/components/Avatar/Avatar.js +4 -4
  24. package/dist/components/Badge/Badge.js +3 -3
  25. package/dist/components/Badge/Badge.module.css +1 -1
  26. package/dist/components/Badge/Badge.types.d.ts +4 -4
  27. package/dist/components/Badge/tests/Badge.stories.js +11 -0
  28. package/dist/components/Button/Button.module.css +1 -1
  29. package/dist/components/Calendar/Calendar.types.d.ts +1 -0
  30. package/dist/components/Calendar/Calendar.utils.d.ts +11 -0
  31. package/dist/components/Calendar/Calendar.utils.js +25 -0
  32. package/dist/components/Calendar/CalendarDate.js +6 -2
  33. package/dist/components/Calendar/CalendarMonth.js +9 -23
  34. package/dist/components/Calendar/tests/Calendar.stories.js +9 -2
  35. package/dist/components/Card/Card.d.ts +1 -1
  36. package/dist/components/Card/Card.js +9 -12
  37. package/dist/components/Card/Card.module.css +1 -1
  38. package/dist/components/Card/tests/Card.stories.d.ts +1 -1
  39. package/dist/components/Card/tests/Card.test.stories.d.ts +1 -1
  40. package/dist/components/Carousel/Carousel.js +3 -1
  41. package/dist/components/Carousel/Carousel.types.d.ts +1 -0
  42. package/dist/components/Carousel/CarouselControl.d.ts +1 -2
  43. package/dist/components/Carousel/CarouselControl.js +8 -7
  44. package/dist/components/Checkbox/Checkbox.module.css +1 -1
  45. package/dist/components/DropdownMenu/DropdownMenu.js +9 -6
  46. package/dist/components/FileUpload/FileUpload.js +5 -3
  47. package/dist/components/FileUpload/FileUpload.module.css +1 -1
  48. package/dist/components/FileUpload/FileUpload.types.d.ts +5 -1
  49. package/dist/components/FileUpload/tests/FileUpload.stories.d.ts +18 -2
  50. package/dist/components/FileUpload/tests/FileUpload.stories.js +102 -23
  51. package/dist/components/Flyout/Flyout.module.css +1 -1
  52. package/dist/components/Flyout/Flyout.types.d.ts +2 -1
  53. package/dist/components/Flyout/FlyoutContent.js +3 -3
  54. package/dist/components/Flyout/FlyoutControlled.js +7 -3
  55. package/dist/components/Flyout/FlyoutTrigger.js +4 -3
  56. package/dist/components/FormControl/FormControl.module.css +1 -1
  57. package/dist/components/FormControl/tests/FormControl.stories.d.ts +4 -0
  58. package/dist/components/FormControl/tests/FormControl.stories.js +18 -0
  59. package/dist/components/Grid/Grid.js +5 -11
  60. package/dist/components/Grid/Grid.types.d.ts +2 -0
  61. package/dist/components/Grid/tests/Grid.stories.js +12 -1
  62. package/dist/components/HiddenVisually/HiddenVisually.module.css +1 -1
  63. package/dist/components/Icon/Icon.js +4 -4
  64. package/dist/components/Image/Image.js +4 -15
  65. package/dist/components/MenuItem/MenuItem.js +2 -2
  66. package/dist/components/MenuItem/MenuItem.module.css +1 -1
  67. package/dist/components/MenuItem/MenuItem.types.d.ts +1 -0
  68. package/dist/components/Modal/Modal.js +4 -4
  69. package/dist/components/Modal/Modal.module.css +1 -1
  70. package/dist/components/Modal/tests/Modal.test.stories.js +2 -2
  71. package/dist/components/Overlay/tests/Overlay.test.stories.js +4 -2
  72. package/dist/components/PinField/PinField.module.css +1 -1
  73. package/dist/components/Popover/Popover.js +5 -5
  74. package/dist/components/Popover/Popover.module.css +1 -1
  75. package/dist/components/Popover/Popover.types.d.ts +1 -1
  76. package/dist/components/Popover/tests/Popover.stories.d.ts +1 -0
  77. package/dist/components/Popover/tests/Popover.stories.js +24 -4
  78. package/dist/components/ProgressIndicator/ProgressIndicator.module.css +1 -1
  79. package/dist/components/Reshaped/Reshaped.css +1 -1
  80. package/dist/components/Resizable/Resizable.module.css +1 -1
  81. package/dist/components/ScrollArea/ScrollArea.js +5 -7
  82. package/dist/components/ScrollArea/ScrollArea.module.css +1 -1
  83. package/dist/components/Select/Select.module.css +1 -1
  84. package/dist/components/Slider/Slider.module.css +1 -1
  85. package/dist/components/Switch/Switch.js +1 -1
  86. package/dist/components/Switch/Switch.module.css +1 -1
  87. package/dist/components/Table/Table.js +4 -7
  88. package/dist/components/Tabs/TabsItem.js +2 -1
  89. package/dist/components/Tabs/TabsList.js +2 -2
  90. package/dist/components/Text/Text.js +4 -4
  91. package/dist/components/TextField/TextField.module.css +1 -1
  92. package/dist/components/TextField/tests/TextField.stories.js +3 -1
  93. package/dist/components/Theme/Theme.js +7 -2
  94. package/dist/components/Theme/Theme.types.d.ts +12 -13
  95. package/dist/components/Theme/index.d.ts +1 -1
  96. package/dist/components/Theme/tests/{Theme.test.stories.d.ts → Theme.stories.d.ts} +1 -0
  97. package/dist/components/Theme/tests/{Theme.test.stories.js → Theme.stories.js} +39 -1
  98. package/dist/components/Theme/useTheme.d.ts +6 -6
  99. package/dist/components/View/View.js +43 -60
  100. package/dist/components/View/View.module.css +1 -1
  101. package/dist/components/View/View.types.d.ts +7 -0
  102. package/dist/components/View/tests/View.stories.d.ts +4 -0
  103. package/dist/components/View/tests/View.stories.js +65 -1
  104. package/dist/components/_private/Portal/Portal.js +9 -1
  105. package/dist/config/tailwind.d.ts +1 -1
  106. package/dist/hooks/_private/useIsDismissible.js +11 -8
  107. package/dist/index.d.ts +1 -2
  108. package/dist/styles/mixin.d.ts +6 -0
  109. package/dist/styles/mixin.js +71 -0
  110. package/dist/styles/resolvers/align/align.css +1 -0
  111. package/dist/styles/resolvers/align/index.d.ts +4 -0
  112. package/dist/styles/resolvers/align/index.js +10 -0
  113. package/dist/styles/resolvers/aspectRatio/aspectRatio.css +1 -0
  114. package/dist/styles/resolvers/aspectRatio/index.d.ts +4 -0
  115. package/dist/styles/resolvers/aspectRatio/index.js +10 -0
  116. package/dist/styles/resolvers/bleed/bleed.module.css +1 -0
  117. package/dist/styles/resolvers/bleed/index.d.ts +3 -0
  118. package/dist/styles/{bleed → resolvers/bleed}/index.js +4 -4
  119. package/dist/styles/resolvers/border/border.module.css +1 -0
  120. package/dist/styles/resolvers/border/borderWidth.css +1 -0
  121. package/dist/styles/resolvers/border/index.d.ts +11 -0
  122. package/dist/styles/resolvers/border/index.js +74 -0
  123. package/dist/styles/resolvers/height/index.d.ts +3 -0
  124. package/dist/styles/{height → resolvers/height}/index.js +4 -4
  125. package/dist/styles/resolvers/inset/index.d.ts +10 -0
  126. package/dist/styles/resolvers/inset/index.js +38 -0
  127. package/dist/styles/resolvers/inset/inset.css +1 -0
  128. package/dist/styles/resolvers/justify/index.d.ts +4 -0
  129. package/dist/styles/resolvers/justify/index.js +10 -0
  130. package/dist/styles/resolvers/justify/justify.css +1 -0
  131. package/dist/styles/resolvers/margin/index.d.ts +10 -0
  132. package/dist/styles/resolvers/margin/index.js +38 -0
  133. package/dist/styles/resolvers/margin/margin.css +1 -0
  134. package/dist/styles/resolvers/maxHeight/index.d.ts +3 -0
  135. package/dist/styles/{maxHeight → resolvers/maxHeight}/index.js +4 -4
  136. package/dist/styles/resolvers/maxHeight/maxHeight.module.css +1 -0
  137. package/dist/styles/resolvers/maxWidth/index.d.ts +3 -0
  138. package/dist/styles/{maxWidth → resolvers/maxWidth}/index.js +4 -4
  139. package/dist/styles/resolvers/maxWidth/maxWidth.module.css +1 -0
  140. package/dist/styles/resolvers/minHeight/index.d.ts +3 -0
  141. package/dist/styles/{minHeight → resolvers/minHeight}/index.js +4 -4
  142. package/dist/styles/resolvers/minHeight/minHeight.module.css +1 -0
  143. package/dist/styles/resolvers/minWidth/index.d.ts +3 -0
  144. package/dist/styles/{minWidth → resolvers/minWidth}/index.js +4 -4
  145. package/dist/styles/resolvers/minWidth/minWidth.module.css +1 -0
  146. package/dist/styles/resolvers/padding/index.d.ts +10 -0
  147. package/dist/styles/resolvers/padding/index.js +38 -0
  148. package/dist/styles/resolvers/padding/padding.css +1 -0
  149. package/dist/styles/resolvers/position/index.d.ts +4 -0
  150. package/dist/styles/resolvers/position/index.js +9 -0
  151. package/dist/styles/resolvers/position/position.css +1 -0
  152. package/dist/styles/resolvers/radius/index.d.ts +3 -0
  153. package/dist/styles/resolvers/radius/index.js +10 -0
  154. package/dist/styles/resolvers/textAlign/index.d.ts +4 -0
  155. package/dist/styles/resolvers/textAlign/index.js +10 -0
  156. package/dist/styles/resolvers/textAlign/textAlign.css +1 -0
  157. package/dist/styles/resolvers/width/index.d.ts +3 -0
  158. package/dist/styles/{width → resolvers/width}/index.js +4 -4
  159. package/dist/styles/resolvers/width/width.module.css +1 -0
  160. package/dist/styles/types.d.ts +63 -16
  161. package/dist/themes/_generator/tokens/color/utilities/generateColors.js +1 -1
  162. package/dist/themes/_generator/tokens/css.js +2 -2
  163. package/dist/themes/figma/theme.css +1 -1
  164. package/dist/themes/fragments/twitter/theme.css +1 -1
  165. package/dist/themes/reshaped/theme.css +1 -1
  166. package/dist/themes/slate/theme.css +1 -1
  167. package/dist/types/global.d.ts +5 -0
  168. package/dist/utilities/a11y/tests/TrapFocus.stories.js +4 -4
  169. package/package.json +24 -24
  170. package/dist/components/ActionBar/tests/ActionBar.test.stories.d.ts +0 -15
  171. package/dist/components/ActionBar/tests/ActionBar.test.stories.js +0 -26
  172. package/dist/components/FileUpload/tests/FileUpload.test.stories.d.ts +0 -21
  173. package/dist/components/FileUpload/tests/FileUpload.test.stories.js +0 -52
  174. package/dist/styles/align/align.css +0 -1
  175. package/dist/styles/align/index.d.ts +0 -4
  176. package/dist/styles/align/index.js +0 -10
  177. package/dist/styles/aspectRatio/aspectRatio.css +0 -1
  178. package/dist/styles/aspectRatio/index.d.ts +0 -4
  179. package/dist/styles/aspectRatio/index.js +0 -9
  180. package/dist/styles/bleed/bleed.module.css +0 -1
  181. package/dist/styles/bleed/index.d.ts +0 -3
  182. package/dist/styles/border/border.module.css +0 -1
  183. package/dist/styles/border/index.d.ts +0 -3
  184. package/dist/styles/border/index.js +0 -10
  185. package/dist/styles/height/index.d.ts +0 -3
  186. package/dist/styles/inset/index.d.ts +0 -5
  187. package/dist/styles/inset/index.js +0 -11
  188. package/dist/styles/inset/inset.css +0 -1
  189. package/dist/styles/justify/index.d.ts +0 -4
  190. package/dist/styles/justify/index.js +0 -10
  191. package/dist/styles/justify/justify.css +0 -1
  192. package/dist/styles/maxHeight/index.d.ts +0 -3
  193. package/dist/styles/maxHeight/maxHeight.module.css +0 -1
  194. package/dist/styles/maxWidth/index.d.ts +0 -3
  195. package/dist/styles/maxWidth/maxWidth.module.css +0 -1
  196. package/dist/styles/minHeight/index.d.ts +0 -3
  197. package/dist/styles/minHeight/minHeight.module.css +0 -1
  198. package/dist/styles/minWidth/index.d.ts +0 -3
  199. package/dist/styles/minWidth/minWidth.module.css +0 -1
  200. package/dist/styles/padding/index.d.ts +0 -4
  201. package/dist/styles/padding/index.js +0 -9
  202. package/dist/styles/padding/padding.css +0 -1
  203. package/dist/styles/position/index.d.ts +0 -4
  204. package/dist/styles/position/index.js +0 -9
  205. package/dist/styles/position/position.css +0 -1
  206. package/dist/styles/radius/index.d.ts +0 -3
  207. package/dist/styles/radius/index.js +0 -10
  208. package/dist/styles/textAlign/index.d.ts +0 -4
  209. package/dist/styles/textAlign/index.js +0 -10
  210. package/dist/styles/textAlign/textAlign.css +0 -1
  211. package/dist/styles/width/index.d.ts +0 -3
  212. package/dist/styles/width/width.module.css +0 -1
  213. /package/dist/styles/{height → resolvers/height}/height.module.css +0 -0
  214. /package/dist/styles/{radius → resolvers/radius}/radius.module.css +0 -0
@@ -9,7 +9,7 @@ declare const Card: React.ForwardRefExoticComponent<{
9
9
  href?: string;
10
10
  as?: keyof React.JSX.IntrinsicElements | undefined;
11
11
  className?: import("../../types/global").ClassName;
12
- attributes?: (import("../..").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../..").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "form" | "slot" | "style" | "title" | "disabled" | "color" | "children" | "className" | "hidden" | "content" | "ref" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "dir" | "name" | "key" | "type" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
12
+ attributes?: (import("../..").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../..").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "form" | "slot" | "style" | "title" | "disabled" | "key" | "value" | "hidden" | "color" | "content" | "children" | "className" | "ref" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dir" | "name" | "type" | "translate" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
13
13
  ref?: React.RefObject<HTMLButtonElement | HTMLAnchorElement | null>;
14
14
  }) | undefined)) | undefined;
15
15
  } & Pick<import("../View").ViewProps, "height"> & React.RefAttributes<HTMLElement>>;
@@ -3,10 +3,7 @@ import { forwardRef } from "react";
3
3
  import { classNames } from "../../utilities/props.js";
4
4
  import Actionable from "../Actionable/index.js";
5
5
  import s from "./Card.module.css";
6
- import getRadiusStyles from "../../styles/radius/index.js";
7
- import getBleedStyles from "../../styles/bleed/index.js";
8
- import getPaddingStyles from "../../styles/padding/index.js";
9
- import getHeightStyles from "../../styles/height/index.js";
6
+ import { resolveMixin } from "../../styles/mixin.js";
10
7
  const Card = forwardRef((props, ref) => {
11
8
  const { padding = 4 } = props;
12
9
  const { selected, elevated, bleed, height, onClick, href, children, className, attributes,
@@ -14,16 +11,16 @@ const Card = forwardRef((props, ref) => {
14
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
12
  as: TagName = "div", } = props;
16
13
  const isActionable = !!href || !!onClick;
17
- const radiusStyles = getRadiusStyles("medium");
18
- const bleedStyles = getBleedStyles(bleed);
19
- const paddingStyles = getPaddingStyles(padding);
20
- const heightStyles = getHeightStyles(height);
21
- const rootClassNames = classNames(s.root, radiusStyles?.classNames, bleedStyles?.classNames, heightStyles?.classNames, isActionable && s["--actionable"], elevated && s["--elevated"], selected && s["--selected"], className);
14
+ const mixinStyles = resolveMixin({
15
+ radius: "medium",
16
+ bleed,
17
+ height,
18
+ padding,
19
+ });
20
+ const rootClassNames = classNames(s.root, mixinStyles.classNames, isActionable && s["--actionable"], elevated && s["--elevated"], selected && s["--selected"], className);
22
21
  const style = {
23
22
  ...attributes?.style,
24
- ...bleedStyles?.variables,
25
- ...paddingStyles?.variables,
26
- ...heightStyles?.variables,
23
+ ...mixinStyles.variables,
27
24
  };
28
25
  if (isActionable) {
29
26
  return (_jsx(Actionable, { className: rootClassNames, attributes: { ...attributes, style }, href: href, as: TagName, onClick: onClick,
@@ -1 +1 @@
1
- .root{--rs-border-width:1px;background:var(--rs-color-background-elevation-base);border:var(--rs-border-width) solid var(--rs-color-border-neutral-faded);color:var(--rs-color-foreground-neutral);display:block;overflow:hidden;position:relative;text-align:initial;transition:var(--rs-duration-fast) var(--rs-easing-accelerate);transition-property:box-shadow,border-color}.--selected{border-color:transparent;box-shadow:0 0 0 2px var(--rs-color-border-primary);transition-timing-function:var(--rs-easing-decelerate)}.--elevated{background:var(--rs-color-background-elevation-raised);box-shadow:var(--rs-shadow-raised)}.--actionable:not(.--selected){color:inherit;cursor:pointer;outline:none;text-decoration:none}[data-rs-keyboard] .--actionable:not(.--selected):focus{box-shadow:var(--rs-focus-shadow)}.--actionable:not(.--selected):before{background:rgba(var(--rs-color-rgb-background-neutral-faded),32%);content:"";inset:0;opacity:0;pointer-events:none;position:absolute;transition:opacity var(--rs-duration-fast) var(--rs-easing-standard)}@media (hover:hover) and (pointer:fine){.--actionable:not(.--selected):hover:before{opacity:1}}
1
+ .root{--rs-border-w:1px;background:var(--rs-color-background-elevation-base);border:var(--rs-border-w) solid var(--rs-color-border-neutral-faded);color:var(--rs-color-foreground-neutral);display:block;overflow:hidden;position:relative;text-align:initial;transition:var(--rs-duration-fast) var(--rs-easing-accelerate);transition-property:box-shadow,border-color}.--selected{border-color:transparent;box-shadow:0 0 0 2px var(--rs-color-border-primary);transition-timing-function:var(--rs-easing-decelerate)}.--elevated{background:var(--rs-color-background-elevation-raised);box-shadow:var(--rs-shadow-raised)}.--actionable:not(.--selected){color:inherit;cursor:pointer;outline:none;text-decoration:none}[data-rs-keyboard] .--actionable:not(.--selected):focus{box-shadow:var(--rs-focus-shadow)}.--actionable:not(.--selected):before{background:rgba(var(--rs-color-rgb-background-neutral-faded),32%);content:"";inset:0;opacity:0;pointer-events:none;position:absolute;transition:opacity var(--rs-duration-fast) var(--rs-easing-standard)}@media (hover:hover) and (pointer:fine){.--actionable:not(.--selected):hover:before{opacity:1}}
@@ -11,7 +11,7 @@ declare const _default: {
11
11
  href?: string;
12
12
  as?: keyof React.JSX.IntrinsicElements | undefined;
13
13
  className?: import("../../../types/global").ClassName;
14
- attributes?: (import("../../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children" | "ref" | "style" | "form" | "slot" | "title" | "disabled" | "color" | "className" | "hidden" | "content" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "dir" | "name" | "key" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "onToggle" | "type" | "id" | "lang" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
14
+ attributes?: (import("../../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children" | "ref" | "style" | "form" | "slot" | "title" | "disabled" | "key" | "value" | "hidden" | "color" | "content" | "className" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dir" | "name" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "onToggle" | "type" | "id" | "lang" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
15
15
  ref?: React.RefObject<HTMLButtonElement | HTMLAnchorElement | null>;
16
16
  }) | undefined)) | undefined;
17
17
  } & Pick<import("../../View").ViewProps, "height"> & React.RefAttributes<HTMLElement>>;
@@ -13,7 +13,7 @@ declare const _default: {
13
13
  href?: string;
14
14
  as?: keyof React.JSX.IntrinsicElements | undefined;
15
15
  className?: import("../../../types/global").ClassName;
16
- attributes?: (import("../../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children" | "ref" | "style" | "form" | "slot" | "title" | "disabled" | "color" | "className" | "hidden" | "content" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "value" | "dir" | "name" | "key" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "onToggle" | "type" | "id" | "lang" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
16
+ attributes?: (import("../../../types/global").Attributes<keyof React.JSX.IntrinsicElements> & ((import("../../../types/global").Attributes<"button"> & Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "children" | "ref" | "style" | "form" | "slot" | "title" | "disabled" | "key" | "value" | "hidden" | "color" | "content" | "className" | "aria-orientation" | "role" | "suppressHydrationWarning" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "dir" | "name" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "draggable" | "enterKeyHint" | "nonce" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "onToggle" | "type" | "id" | "lang" | "tabIndex" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture"> & {
17
17
  ref?: React.RefObject<HTMLButtonElement | HTMLAnchorElement | null>;
18
18
  }) | undefined)) | undefined;
19
19
  } & Pick<import("../../View").ViewProps, "height"> & React.RefAttributes<HTMLElement>>;
@@ -16,6 +16,8 @@ const Carousel = (props) => {
16
16
  const [scrollPosition, setScrollPosition] = React.useState(0);
17
17
  const [isRTL] = useRTL();
18
18
  const scrollElRef = React.useRef(null);
19
+ const prevControlElRef = React.useRef(null);
20
+ const nextControlElRef = React.useRef(null);
19
21
  const bleedClassNames = {};
20
22
  if (typeof bleed === "object") {
21
23
  Object.entries(bleed).forEach(([key, value]) => {
@@ -112,7 +114,7 @@ const Carousel = (props) => {
112
114
  ...responsiveVariables("--rs-carousel-items", visibleItems),
113
115
  ...responsiveVariables("--rs-carousel-bleed", bleed),
114
116
  ...attributes?.style,
115
- }, children: [navigationDisplay !== "hidden" && (_jsxs(_Fragment, { children: [_jsx(CarouselControl, { isRTL: isRTL, type: "back", scrollElRef: scrollElRef, scrollPosition: scrollPosition, onClick: navigateBack, mounted: mounted }), _jsx(CarouselControl, { isRTL: isRTL, type: "forward", scrollElRef: scrollElRef, scrollPosition: scrollPosition, onClick: navigateForward, mounted: mounted })] })), _jsx(View, { as: "ul", direction: "row", wrap: false, gap: gap, className: s.scroll, attributes: { ref: scrollElRef, onScroll: handleScroll }, children: React.Children.map(children, (child, index) => (_jsx(View.Item, { className: s.item, as: "li", attributes: { ref: (el) => handleItemRef(el, index) }, children: child }))) })] }));
117
+ }, children: [navigationDisplay !== "hidden" && (_jsxs(_Fragment, { children: [_jsx(CarouselControl, { isRTL: isRTL, type: "back", ref: prevControlElRef, oppositeControlElRef: nextControlElRef, scrollElRef: scrollElRef, scrollPosition: scrollPosition, onClick: navigateBack, mounted: mounted }), _jsx(CarouselControl, { isRTL: isRTL, type: "forward", ref: nextControlElRef, oppositeControlElRef: prevControlElRef, scrollElRef: scrollElRef, scrollPosition: scrollPosition, onClick: navigateForward, mounted: mounted })] })), _jsx(View, { as: "ul", direction: "row", wrap: false, gap: gap, className: s.scroll, attributes: { ref: scrollElRef, onScroll: handleScroll }, children: React.Children.map(children, (child, index) => (_jsx(View.Item, { className: s.item, as: "li", attributes: { ref: (el) => handleItemRef(el, index) }, children: child }))) })] }));
116
118
  };
117
119
  Carousel.displayName = "Carousel";
118
120
  export default Carousel;
@@ -7,6 +7,7 @@ export type Instance = {
7
7
  } | undefined;
8
8
  export type ControlProps = {
9
9
  type: "back" | "forward";
10
+ oppositeControlElRef: React.RefObject<HTMLButtonElement | null>;
10
11
  scrollElRef: React.RefObject<HTMLElement | null>;
11
12
  scrollPosition: number;
12
13
  onClick: () => void;
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import * as T from "./Carousel.types";
3
- declare const CarouselControl: React.FC<T.ControlProps>;
2
+ declare const CarouselControl: import("react").ForwardRefExoticComponent<T.ControlProps & import("react").RefAttributes<HTMLButtonElement>>;
4
3
  export default CarouselControl;
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import React from "react";
3
+ import { forwardRef, useState } from "react";
4
4
  import { classNames } from "../../utilities/props.js";
5
5
  import Button from "../Button/index.js";
6
6
  import IconChevronRight from "../../icons/ChevronRight.js";
7
7
  import IconChevronLeft from "../../icons/ChevronLeft.js";
8
8
  import useIsomorphicLayoutEffect from "../../hooks/useIsomorphicLayoutEffect.js";
9
9
  import s from "./Carousel.module.css";
10
- const CarouselControl = (props) => {
11
- const { type, scrollElRef, scrollPosition, onClick, isRTL, mounted } = props;
12
- const [visible, setVisible] = React.useState(false);
13
- const [rendered, setRendered] = React.useState(false);
10
+ const CarouselControl = forwardRef((props, ref) => {
11
+ const { type, scrollElRef, oppositeControlElRef, scrollPosition, onClick, isRTL, mounted } = props;
12
+ const [visible, setVisible] = useState(false);
13
+ const [rendered, setRendered] = useState(false);
14
14
  const isNext = type === "forward";
15
15
  const isDisplayedAsNext = type === (isRTL ? "back" : "forward");
16
16
  const controlClassNames = classNames(s.control, isDisplayedAsNext ? s["--control-next"] : s["--control-prev"], visible && s["--control-visible"], rendered && s["--control-rendered"]);
@@ -26,6 +26,7 @@ const CarouselControl = (props) => {
26
26
  if (hideControl) {
27
27
  setVisible(false);
28
28
  timer = setTimeout(() => setRendered(false), 1500);
29
+ oppositeControlElRef.current?.focus();
29
30
  }
30
31
  else {
31
32
  setRendered(true);
@@ -36,7 +37,7 @@ const CarouselControl = (props) => {
36
37
  clearTimeout(timer);
37
38
  };
38
39
  }, [scrollPosition, scrollElRef, mounted, isNext]);
39
- return (_jsx("div", { className: controlClassNames, children: _jsx(Button, { onClick: onClick, icon: isDisplayedAsNext ? IconChevronRight : IconChevronLeft, rounded: true, variant: "outline", elevated: true, attributes: { "aria-disabled": !visible, "aria-hidden": true } }) }));
40
- };
40
+ return (_jsx("div", { className: controlClassNames, children: _jsx(Button, { size: "small", onClick: onClick, icon: isDisplayedAsNext ? IconChevronRight : IconChevronLeft, rounded: true, variant: "outline", elevated: true, attributes: { "aria-disabled": !visible, "aria-hidden": true }, ref: ref }) }));
41
+ });
41
42
  CarouselControl.displayName = "CarouselControl";
42
43
  export default CarouselControl;
@@ -1 +1 @@
1
- .root{align-items:center;cursor:pointer;display:inline-flex;gap:var(--rs-checkbox-gap);user-select:none;vertical-align:top;-webkit-tap-highlight-color:transparent}@media (hover:hover) and (pointer:fine){.root:hover .decorator{background:var(--rs-color-background-neutral-faded)}}.field{position:relative}.decorator{background:var(--rs-color-background-elevation-base);border:1px solid var(--rs-color-border-neutral);border-radius:var(--rs-radius-small);color:var(--rs-color-on-background-primary);height:var(--rs-checkbox-line-height);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:background-color,border-color;width:var(--rs-checkbox-line-height)}.decorator:before{background:var(--rs-color-on-background-primary);border-radius:999px;content:"";height:1.5px;left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%) scale(0);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity,transform;width:calc(var(--rs-checkbox-line-height) * .5)}.--size-small{--rs-checkbox-line-height:var(--rs-line-height-caption-1);--rs-checkbox-gap:var(--rs-unit-x1)}.--size-medium{--rs-checkbox-line-height:var(--rs-line-height-body-3);--rs-checkbox-gap:var(--rs-unit-x2)}.--size-large{--rs-checkbox-line-height:var(--rs-line-height-body-2);--rs-checkbox-gap:var(--rs-unit-x2)}.icon{left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%) scale(0);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity,transform}[data-rs-keyboard] .input:focus-visible+.decorator{box-shadow:var(--rs-focus-shadow)}.root.--error .decorator{border-color:var(--rs-color-border-critical)}.input:checked+.decorator,.input:indeterminate+.decorator{background:var(--rs-color-background-primary);border-color:var(--rs-color-background-primary)}.input:checked+.decorator .icon,.input:indeterminate+.decorator:before{opacity:1;transform:translate(-50%,-50%) scale(1)}.root.--disabled{color:var(--rs-color-foreground-disabled);cursor:not-allowed}.root.--disabled .decorator{background:var(--rs-color-background-disabled-faded);border-color:var(--rs-color-border-disabled);color:var(--rs-color-foreground-disabled)}.root.--disabled .input:checked+.decorator,.root.--disabled .input:indeterminate+.decorator{background:var(--rs-color-background-disabled);border-color:transparent}.root.--disabled .input:checked+.decorator:before,.root.--disabled .input:indeterminate+.decorator:before{background-color:var(--rs-color-foreground-disabled)}@media (--rs-viewport-m ){.--size-small--m{--rs-checkbox-line-height:var(--rs-line-height-caption-1);--rs-checkbox-gap:var(--rs-unit-x1)}.--size-medium--m{--rs-checkbox-line-height:var(--rs-line-height-body-3);--rs-checkbox-gap:var(--rs-unit-x2)}.--size-large--m{--rs-checkbox-line-height:var(--rs-line-height-body-2);--rs-checkbox-gap:var(--rs-unit-x2)}}@media (--rs-viewport-l ){.--size-small--l{--rs-checkbox-line-height:var(--rs-line-height-caption-1);--rs-checkbox-gap:var(--rs-unit-x1)}.--size-medium--l{--rs-checkbox-line-height:var(--rs-line-height-body-3);--rs-checkbox-gap:var(--rs-unit-x2)}.--size-large--l{--rs-checkbox-line-height:var(--rs-line-height-body-2);--rs-checkbox-gap:var(--rs-unit-x2)}}@media (--rs-viewport-xl ){.--size-small--xl{--rs-checkbox-line-height:var(--rs-line-height-caption-1);--rs-checkbox-gap:var(--rs-unit-x1)}.--size-medium--xl{--rs-checkbox-line-height:var(--rs-line-height-body-3);--rs-checkbox-gap:var(--rs-unit-x2)}.--size-large--xl{--rs-checkbox-line-height:var(--rs-line-height-body-2);--rs-checkbox-gap:var(--rs-unit-x2)}}
1
+ .root{align-items:center;cursor:pointer;display:inline-flex;gap:var(--rs-checkbox-gap);user-select:none;vertical-align:top;-webkit-tap-highlight-color:transparent}@media (hover:hover) and (pointer:fine){.root:hover .decorator{background:var(--rs-color-background-neutral-faded)}}.field{position:relative}.decorator{background:var(--rs-color-background-elevation-base);border:1px solid var(--rs-color-border-neutral);border-radius:var(--rs-radius-small);color:var(--rs-color-on-background-primary);height:var(--rs-checkbox-line-height);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:background-color,border-color;width:var(--rs-checkbox-line-height)}.decorator:before{background:var(--rs-color-on-background-primary);border-radius:var(--rs-radius-circular);content:"";height:1.5px;left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%) scale(0);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity,transform;width:calc(var(--rs-checkbox-line-height) * .5)}.--size-small{--rs-checkbox-line-height:var(--rs-line-height-caption-1);--rs-checkbox-gap:var(--rs-unit-x1)}.--size-medium{--rs-checkbox-line-height:var(--rs-line-height-body-3);--rs-checkbox-gap:var(--rs-unit-x2)}.--size-large{--rs-checkbox-line-height:var(--rs-line-height-body-2);--rs-checkbox-gap:var(--rs-unit-x2)}.icon{left:50%;opacity:0;position:absolute;top:50%;transform:translate(-50%,-50%) scale(0);transition:var(--rs-duration-fast) var(--rs-easing-standard);transition-property:opacity,transform}[data-rs-keyboard] .input:focus-visible+.decorator{box-shadow:var(--rs-focus-shadow)}.root.--error .decorator{border-color:var(--rs-color-border-critical)}.input:checked+.decorator,.input:indeterminate+.decorator{background:var(--rs-color-background-primary);border-color:var(--rs-color-background-primary)}.input:checked+.decorator .icon,.input:indeterminate+.decorator:before{opacity:1;transform:translate(-50%,-50%) scale(1)}.root.--disabled{color:var(--rs-color-foreground-disabled);cursor:not-allowed}.root.--disabled .decorator{background:var(--rs-color-background-disabled-faded);border-color:var(--rs-color-border-disabled);color:var(--rs-color-foreground-disabled)}.root.--disabled .input:checked+.decorator,.root.--disabled .input:indeterminate+.decorator{background:var(--rs-color-background-disabled);border-color:transparent}.root.--disabled .input:checked+.decorator:before,.root.--disabled .input:indeterminate+.decorator:before{background-color:var(--rs-color-foreground-disabled)}@media (--rs-viewport-m ){.--size-small--m{--rs-checkbox-line-height:var(--rs-line-height-caption-1);--rs-checkbox-gap:var(--rs-unit-x1)}.--size-medium--m{--rs-checkbox-line-height:var(--rs-line-height-body-3);--rs-checkbox-gap:var(--rs-unit-x2)}.--size-large--m{--rs-checkbox-line-height:var(--rs-line-height-body-2);--rs-checkbox-gap:var(--rs-unit-x2)}}@media (--rs-viewport-l ){.--size-small--l{--rs-checkbox-line-height:var(--rs-line-height-caption-1);--rs-checkbox-gap:var(--rs-unit-x1)}.--size-medium--l{--rs-checkbox-line-height:var(--rs-line-height-body-3);--rs-checkbox-gap:var(--rs-unit-x2)}.--size-large--l{--rs-checkbox-line-height:var(--rs-line-height-body-2);--rs-checkbox-gap:var(--rs-unit-x2)}}@media (--rs-viewport-xl ){.--size-small--xl{--rs-checkbox-line-height:var(--rs-line-height-caption-1);--rs-checkbox-gap:var(--rs-unit-x1)}.--size-medium--xl{--rs-checkbox-line-height:var(--rs-line-height-body-3);--rs-checkbox-gap:var(--rs-unit-x2)}.--size-large--xl{--rs-checkbox-line-height:var(--rs-line-height-body-2);--rs-checkbox-gap:var(--rs-unit-x2)}}
@@ -31,7 +31,15 @@ const DropdownMenuContent = (props) => {
31
31
  ref: attributes?.ref,
32
32
  });
33
33
  const contentClassName = classNames(s.menu, className);
34
- return (_jsx(Popover.Content, { className: contentClassName, attributes: { ...attributes, ref }, children: children }));
34
+ const handleClick = (e) => {
35
+ /**
36
+ * Stop event propagation to make sure outside click doesn't get triggered
37
+ * after the content is closed
38
+ */
39
+ e.stopPropagation();
40
+ attributes?.onClick?.(e);
41
+ };
42
+ return (_jsx(Popover.Content, { className: contentClassName, attributes: { ...attributes, ref, onClick: handleClick }, children: children }));
35
43
  };
36
44
  const DropdownMenuSection = (props) => {
37
45
  const { children } = props;
@@ -42,11 +50,6 @@ const DropdownMenuItem = (props) => {
42
50
  const { handleClose } = useFlyoutContext();
43
51
  const subTriggerContext = React.useContext(DropdownMenuSubTriggerContext);
44
52
  const handleClick = (e) => {
45
- /**
46
- * Stop event propagation to make sure outside click doesn't get triggered
47
- * after the content is closed
48
- */
49
- e.stopPropagation();
50
53
  /**
51
54
  * Don't close the menu when clicking on a trigger of a submenu
52
55
  */
@@ -10,9 +10,9 @@ const FileUploadTrigger = (props) => {
10
10
  return _jsx("span", { className: s.trigger, children: children });
11
11
  };
12
12
  const FileUpload = (props) => {
13
- const { name, children, height, className, attributes, inputAttributes, onChange } = props;
13
+ const { name, children, height, variant = "outline", inline, className, attributes, inputAttributes, onChange, } = props;
14
14
  const highlightToggle = useToggle();
15
- const rootClassNames = classNames(s.root, highlightToggle.active && s["--highlighted"], className);
15
+ const rootClassNames = classNames(s.root, variant && s[`--variant-${variant}`], inline && s[`--inline`], highlightToggle.active && s["--highlighted"], className);
16
16
  const handleDragOver = (event) => {
17
17
  event.preventDefault();
18
18
  attributes?.onDragOver?.(event);
@@ -41,13 +41,15 @@ const FileUpload = (props) => {
41
41
  onChange?.({ name, event, value: Array.from(nextValue) });
42
42
  inputAttributes?.onChange?.(event);
43
43
  };
44
+ const inputNode = (_jsx(HiddenVisually, { children: _jsx("input", { ...inputAttributes, type: "file", className: s.field, name: name, onChange: handleChange }) }));
45
+ const childrenNode = typeof children === "function" ? children({ highlighted: highlightToggle.active }) : children;
44
46
  return (_jsx(View, { className: rootClassNames, height: height, attributes: {
45
47
  ...attributes,
46
48
  onDragOver: handleDragOver,
47
49
  onDragEnter: handleDragEnter,
48
50
  onDragLeave: handleDragLeave,
49
51
  onDrop: handleDrop,
50
- }, children: _jsxs(View, { as: "label", className: s.triggerLayer, padding: 6, borderRadius: "medium", gap: 2, align: "center", justify: "center", textAlign: "center", animated: true, height: "100%", children: [_jsx(View.Item, { children: children }), _jsx(HiddenVisually, { children: _jsx("input", { ...inputAttributes, type: "file", className: s.field, name: name, onChange: handleChange }) })] }) }));
52
+ }, children: variant === "outline" && !inline ? (_jsxs(View, { as: "label", className: s.triggerLayer, padding: 6, borderRadius: "medium", gap: 2, align: "center", justify: "center", textAlign: "center", animated: true, height: "100%", children: [inputNode, _jsx(View.Item, { children: childrenNode })] })) : (_jsxs("label", { className: s.triggerLayer, children: [inputNode, childrenNode] })) }));
51
53
  };
52
54
  FileUpload.Trigger = FileUploadTrigger;
53
55
  FileUpload.displayName = "FileUpload";
@@ -1 +1 @@
1
- .root.--highlighted .triggerLayer{background:rgba(var(--rs-color-rgb-background-primary),8%);border-color:var(--rs-color-border-primary)}.triggerLayer{border:1px dashed var(--rs-color-border-neutral)}[data-rs-keyboard] .triggerLayer:focus-within{box-shadow:var(--rs-focus-shadow)}@media (hover:hover) and (pointer:fine){.triggerLayer:hover:not(:has(.trigger)){background:rgba(var(--rs-color-rgb-background-neutral),16%)}}.triggerLayer:has(.trigger){pointer-events:none}.triggerLayer:has(.trigger) .trigger{pointer-events:all}.trigger{display:contents}
1
+ .root{--rs-file-upload-radius:var(--rs-radius-medium);display:block}[data-rs-keyboard] .root:focus-within{box-shadow:var(--rs-focus-shadow)}.--inline{--rs-file-upload-radius:var(--rs-radius-small)}.--inline,.--inline .triggerLayer{display:inline-block;vertical-align:top}[data-rs-keyboard] .--inline:focus-within{box-shadow:none}[data-rs-keyboard] .--inline:focus-within .triggerLayer>*{box-shadow:var(--rs-focus-shadow)}.--variant-outline .triggerLayer{border:1px dashed var(--rs-color-border-neutral);border-radius:var(--rs-file-upload-radius)}.--highlighted.--variant-outline .triggerLayer{background:rgba(var(--rs-color-rgb-background-primary),.08);border-color:var(--rs-color-border-primary)}@media (hover:hover) and (pointer:fine){.--variant-outline .triggerLayer:hover:not(:has(.trigger)){background:rgba(var(--rs-color-rgb-background-neutral),.16)}}.triggerLayer:has(.trigger){pointer-events:none}.triggerLayer:has(.trigger) .trigger{pointer-events:all}.trigger{display:contents}
@@ -3,9 +3,13 @@ import type { ViewProps } from "../View";
3
3
  import type * as G from "../../types/global";
4
4
  export type Props = {
5
5
  name: string;
6
- children?: React.ReactNode;
6
+ children?: React.ReactNode | ((props: {
7
+ highlighted?: boolean;
8
+ }) => React.ReactNode);
7
9
  onChange?: G.ChangeHandler<File[], React.DragEvent<HTMLDivElement> | React.ChangeEvent<HTMLInputElement>>;
8
10
  height?: ViewProps["height"];
11
+ variant?: "outline" | "headless";
12
+ inline?: boolean;
9
13
  className?: G.ClassName;
10
14
  attributes?: G.Attributes<"div">;
11
15
  inputAttributes?: G.Attributes<"input">;
@@ -1,4 +1,6 @@
1
1
  import React from "react";
2
+ import { StoryObj } from "@storybook/react-vite";
3
+ import { fn } from "storybook/test";
2
4
  declare const _default: {
3
5
  title: string;
4
6
  component: React.FC<import("./..").FileUploadProps> & {
@@ -11,5 +13,19 @@ declare const _default: {
11
13
  };
12
14
  };
13
15
  export default _default;
14
- export declare const base: () => React.JSX.Element;
15
- export declare const height: () => React.JSX.Element;
16
+ export declare const base: {
17
+ name: string;
18
+ render: () => React.JSX.Element;
19
+ };
20
+ export declare const inline: {
21
+ name: string;
22
+ render: () => React.JSX.Element;
23
+ };
24
+ export declare const height: {
25
+ name: string;
26
+ render: () => React.JSX.Element;
27
+ };
28
+ export declare const onChange: StoryObj<{
29
+ handleChange: ReturnType<typeof fn>;
30
+ }>;
31
+ export declare const className: StoryObj;
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { expect, userEvent, fn } from "storybook/test";
2
3
  import { Example } from "../../../utilities/storybook/index.js";
3
4
  import FileUpload from "../index.js";
4
5
  import View from "../../View/index.js";
@@ -6,6 +7,7 @@ import Image from "../../Image/index.js";
6
7
  import Link from "../../Link/index.js";
7
8
  import Icon from "../../Icon/index.js";
8
9
  import IconMic from "../../../icons/Mic.js";
10
+ import Button from "../../Button/index.js";
9
11
  export default {
10
12
  title: "Components/FileUpload",
11
13
  component: FileUpload,
@@ -34,28 +36,105 @@ const Demo = () => {
34
36
  </View>
35
37
  </View>);
36
38
  };
37
- export const base = () => (<Example>
38
- <Example.Item title="Base upload with previews">
39
- <Demo />
40
- </Example.Item>
41
- <Example.Item title="With trigger">
42
- <FileUpload name="file">
43
- <div>
44
- Drop files to attach, or{" "}
45
- <FileUpload.Trigger>
46
- <Link variant="plain">browse</Link>
47
- </FileUpload.Trigger>
48
- </div>
39
+ export const base = {
40
+ name: "base",
41
+ render: () => (<Example>
42
+ <Example.Item title="Base upload with previews">
43
+ <Demo />
44
+ </Example.Item>
45
+ <Example.Item title="With trigger">
46
+ <FileUpload name="file">
47
+ <div>
48
+ Drop files to attach, or{" "}
49
+ <FileUpload.Trigger>
50
+ <Link variant="plain">browse</Link>
51
+ </FileUpload.Trigger>
52
+ </div>
53
+ </FileUpload>
54
+ </Example.Item>
55
+ </Example>),
56
+ };
57
+ export const inline = {
58
+ name: "inline, variant, render props",
59
+ render: () => {
60
+ return (<Example>
61
+ <Example.Item title="inline">
62
+ <FileUpload name="file" inline onChange={console.log}>
63
+ <View padding={2} paddingInline={3}>
64
+ Upload
65
+ </View>
66
+ </FileUpload>
67
+ </Example.Item>
68
+ <Example.Item title="variant headless">
69
+ <FileUpload name="file2" variant="headless" onChange={console.log}>
70
+ <Button variant="outline" fullWidth>
71
+ Upload
72
+ </Button>
73
+ </FileUpload>
74
+ </Example.Item>
75
+ <Example.Item title="variant headless, inline">
76
+ <FileUpload name="file2" variant="headless" inline onChange={console.log}>
77
+ <Button>Upload</Button>
78
+ </FileUpload>
79
+ </Example.Item>
80
+ <Example.Item title="inline, render props">
81
+ <FileUpload name="file3" variant="headless" inline onChange={console.log}>
82
+ {(props) => <Button highlighted={props.highlighted}>Upload</Button>}
83
+ </FileUpload>
84
+ </Example.Item>
85
+ </Example>);
86
+ },
87
+ };
88
+ export const height = {
89
+ name: "height",
90
+ render: () => (<Example>
91
+ <Example.Item title="Custom height">
92
+ <FileUpload name="file" height="300px">
93
+ <View gap={3}>
94
+ <Icon svg={IconMic} size={8}/>
95
+ Drop files to attach
96
+ </View>
97
+ </FileUpload>
98
+ </Example.Item>
99
+ </Example>),
100
+ };
101
+ export const onChange = {
102
+ name: "name, onChange",
103
+ args: {
104
+ handleChange: fn(),
105
+ },
106
+ render: (args) => (<div data-testid="root">
107
+ <FileUpload name="test-name" onChange={args.handleChange}>
108
+ Content
49
109
  </FileUpload>
50
- </Example.Item>
51
- </Example>);
52
- export const height = () => (<Example>
53
- <Example.Item title="Custom height">
54
- <FileUpload name="file" height="300px">
55
- <View gap={3}>
56
- <Icon svg={IconMic} size={8}/>
57
- Drop files to attach
58
- </View>
110
+ </div>),
111
+ play: async ({ canvas, args }) => {
112
+ const file = new File(["hello"], "hello.png", { type: "image/png" });
113
+ const input = canvas.getByTestId("root").querySelector("input");
114
+ await userEvent.upload(input, file);
115
+ expect(input).toHaveAttribute("name", "test-name");
116
+ expect(input.files?.[0]).toBe(file);
117
+ expect(input.files).toHaveLength(1);
118
+ expect(args.handleChange).toHaveBeenCalledTimes(1);
119
+ expect(args.handleChange).toHaveBeenCalledWith({
120
+ name: "test-name",
121
+ value: [file],
122
+ event: expect.objectContaining({ target: input }),
123
+ });
124
+ },
125
+ };
126
+ export const className = {
127
+ name: "className, attributes",
128
+ render: () => (<div data-testid="root">
129
+ <FileUpload name="name" className="test-classname" attributes={{ id: "test-id" }} inputAttributes={{ id: "test-input-id" }}>
130
+ Content
59
131
  </FileUpload>
60
- </Example.Item>
61
- </Example>);
132
+ </div>),
133
+ play: async ({ canvas }) => {
134
+ const root = canvas.getByTestId("root").firstChild;
135
+ const input = canvas.getByTestId("root").querySelector("input");
136
+ expect(root).toHaveClass("test-classname");
137
+ expect(root).toHaveAttribute("id", "test-id");
138
+ expect(input).toHaveAttribute("id", "test-input-id");
139
+ },
140
+ };
@@ -1 +1 @@
1
- .content{--rs-flyout-gap:0;--rs-flyout-origin-x:50%;--rs-flyout-origin-y:50%;isolation:isolate;pointer-events:none;position:absolute}.content.--hover{pointer-events:all}.content.--hover-disabled,.content.--hover-disabled .inner{pointer-events:none}.inner{opacity:0;pointer-events:all;transform:scale(.9) translateY(0);transform-origin:var(--rs-flyout-origin-x) var(--rs-flyout-origin-y);transition:1ms var(--rs-easing-accelerate)}.content.--width-trigger .inner{transform:scale(1) translateY(var(--rs-unit-x2))}.content.--position-top,.content.--position-top-end,.content.--position-top-start{--rs-flyout-origin-y:100%;padding-bottom:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-bottom,.content.--position-bottom-end,.content.--position-bottom-start{--rs-flyout-origin-y:0%;padding-top:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-bottom-start,.content.--position-top-start{--rs-flyout-origin-x:0%}.content.--position-bottom-end,.content.--position-top-end{--rs-flyout-origin-x:100%}.content.--position-start,.content.--position-start-bottom,.content.--position-start-top{--rs-flyout-origin-x:100%;padding-right:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-end,.content.--position-end-bottom,.content.--position-end-top{--rs-flyout-origin-x:0%;padding-left:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-end-top,.content.--position-start-top{--rs-flyout-origin-y:0%}.content.--position-end-bottom,.content.--position-start-bottom{--rs-flyout-origin-y:100%}.content.--visible .inner{opacity:1;transform:scale(1) translateY(0)}.content.--animated .inner{transition-duration:var(--rs-duration-rapid);transition-property:opacity,transform}.content.--animated.--visible .inner{transition-duration:var(--rs-duration-fast);transition-timing-function:var(--rs-easing-decelerate)}
1
+ .content{--rs-flyout-gap:0;--rs-flyout-origin-x:50%;--rs-flyout-origin-y:50%;isolation:isolate;pointer-events:none;position:absolute}.content.--hover{pointer-events:all}.content.--hover-disabled,.content.--hover-disabled .inner{pointer-events:none}.inner{opacity:0;outline:none;pointer-events:all;transform:scale(.9) translateY(0);transform-origin:var(--rs-flyout-origin-x) var(--rs-flyout-origin-y);transition:1ms var(--rs-easing-accelerate)}[data-rs-keyboard] .inner:focus{box-shadow:var(--rs-focus-shadow)}.content.--width-trigger .inner{transform:scale(1) translateY(var(--rs-unit-x2))}.content.--position-top,.content.--position-top-end,.content.--position-top-start{--rs-flyout-origin-y:100%;padding-bottom:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-bottom,.content.--position-bottom-end,.content.--position-bottom-start{--rs-flyout-origin-y:0%;padding-top:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-bottom-start,.content.--position-top-start{--rs-flyout-origin-x:0%}.content.--position-bottom-end,.content.--position-top-end{--rs-flyout-origin-x:100%}.content.--position-start,.content.--position-start-bottom,.content.--position-start-top{--rs-flyout-origin-x:100%;padding-right:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-end,.content.--position-end-bottom,.content.--position-end-top{--rs-flyout-origin-x:0%;padding-left:calc(var(--rs-unit-x1) * var(--rs-flyout-gap))}.content.--position-end-top,.content.--position-start-top{--rs-flyout-origin-y:0%}.content.--position-end-bottom,.content.--position-start-bottom{--rs-flyout-origin-y:100%}.content.--visible .inner{opacity:1;transform:scale(1) translateY(0)}.content.--animated .inner{transition-duration:var(--rs-duration-rapid);transition-property:opacity,transform}.content.--animated.--visible .inner{transition-duration:var(--rs-duration-fast);transition-timing-function:var(--rs-easing-decelerate)}
@@ -92,6 +92,7 @@ type BaseProps = {
92
92
  disableHideAnimation?: boolean;
93
93
  disableContentHover?: boolean;
94
94
  disableCloseOnOutsideClick?: boolean;
95
+ autoFocus?: boolean;
95
96
  originCoordinates?: G.Coordinates;
96
97
  children?: React.ReactNode;
97
98
  onOpen?: () => void;
@@ -145,7 +146,7 @@ export type ContextProps = {
145
146
  handleContentMouseDown: () => void;
146
147
  handleContentMouseUp: () => void;
147
148
  isSubmenu: boolean;
148
- } & Pick<Props, "triggerType" | "contentClassName" | "contentAttributes" | "trapFocusMode" | "contentGap" | "contentShift" | "containerRef" | "disableContentHover">;
149
+ } & Pick<Props, "triggerType" | "contentClassName" | "contentAttributes" | "trapFocusMode" | "contentGap" | "contentShift" | "containerRef" | "disableContentHover" | "autoFocus">;
149
150
  export type TriggerContextProps = {
150
151
  elRef?: ContextProps["triggerElRef"];
151
152
  };
@@ -11,7 +11,7 @@ import { useFlyoutContext, ContentProvider } from "./Flyout.context.js";
11
11
  import s from "./Flyout.module.css";
12
12
  const FlyoutContent = (props) => {
13
13
  const { children, className, attributes } = props;
14
- const { flyout, id, flyoutElRef, triggerElRef, handleClose, handleTransitionEnd, handleTransitionStart, triggerType, handleMouseEnter, handleMouseLeave, handleContentMouseDown, handleContentMouseUp, contentGap, contentClassName, contentAttributes, trapFocusMode, disableContentHover, width, containerRef: passedContainerRef, isSubmenu, } = useFlyoutContext();
14
+ const { flyout, id, flyoutElRef, triggerElRef, handleClose, handleTransitionEnd, handleTransitionStart, triggerType, handleMouseEnter, handleMouseLeave, handleContentMouseDown, handleContentMouseUp, contentGap, contentClassName, contentAttributes, trapFocusMode, disableContentHover, autoFocus, width, containerRef: passedContainerRef, isSubmenu, } = useFlyoutContext();
15
15
  const { styles, status, position } = flyout;
16
16
  const [mounted, setMounted] = React.useState(false);
17
17
  const closestFixedContainer = React.useMemo(() => {
@@ -75,7 +75,7 @@ const FlyoutContent = (props) => {
75
75
  s["--animated"], position && s[`--position-${position}`], width === "trigger" && s["--width-trigger"], triggerType === "hover" && disableContentHover && s["--hover-disabled"]);
76
76
  // className is applied to inner element because it has the transform and is treated like a real root element
77
77
  const innerClassNames = classNames(s.inner, className, contentClassName);
78
- let role;
78
+ let role = attributes?.role;
79
79
  if (triggerType === "hover") {
80
80
  role = "tooltip";
81
81
  }
@@ -94,7 +94,7 @@ const FlyoutContent = (props) => {
94
94
  const content = (_jsx(ContentProvider, { value: { elRef: flyoutElRef }, children: _jsx("div", { className: rootClassNames, style: {
95
95
  ...styles,
96
96
  "--rs-flyout-gap": contentGap,
97
- }, ref: flyoutElRef, onTransitionEnd: handleTransitionEnd, onMouseEnter: triggerType === "hover" ? handleMouseEnter : undefined, onMouseLeave: triggerType === "hover" ? handleMouseLeave : undefined, onMouseDown: handleContentMouseDown, onTouchStart: handleContentMouseDown, onMouseUp: handleContentMouseUp, onTouchEnd: handleContentMouseUp, children: _jsx("div", { role: role, ...attributes, id: id, "aria-modal": role === "dialog" ? true : undefined, style: contentAttributes?.style, className: innerClassNames, children: children }) }) }));
97
+ }, ref: flyoutElRef, onTransitionEnd: handleTransitionEnd, onMouseEnter: triggerType === "hover" ? handleMouseEnter : undefined, onMouseLeave: triggerType === "hover" ? handleMouseLeave : undefined, onMouseDown: handleContentMouseDown, onTouchStart: handleContentMouseDown, onMouseUp: handleContentMouseUp, onTouchEnd: handleContentMouseUp, children: _jsx("div", { role: role, ...attributes, id: id, tabIndex: !autoFocus ? -1 : undefined, "aria-modal": role === "dialog" ? true : undefined, style: contentAttributes?.style, className: innerClassNames, children: children }) }) }));
98
98
  return _jsx(Portal, { targetRef: containerRef, children: content });
99
99
  };
100
100
  FlyoutContent.displayName = "Flyout.Content";