@react-md/core 6.1.0 → 6.2.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 (173) hide show
  1. package/dist/RootHtml.d.ts +1 -1
  2. package/dist/RootHtml.js.map +1 -1
  3. package/dist/_base.scss +1 -0
  4. package/dist/autocomplete/defaults.d.ts +1 -0
  5. package/dist/autocomplete/defaults.js +2 -6
  6. package/dist/autocomplete/defaults.js.map +1 -1
  7. package/dist/autocomplete/types.d.ts +9 -9
  8. package/dist/autocomplete/types.js.map +1 -1
  9. package/dist/avatar/Avatar.d.ts +1 -1
  10. package/dist/avatar/Avatar.js +1 -1
  11. package/dist/avatar/Avatar.js.map +1 -1
  12. package/dist/avatar/styles.d.ts +29 -1
  13. package/dist/avatar/styles.js.map +1 -1
  14. package/dist/box/styles.d.ts +26 -3
  15. package/dist/box/styles.js.map +1 -1
  16. package/dist/button/AsyncButton.d.ts +2 -2
  17. package/dist/button/AsyncButton.js.map +1 -1
  18. package/dist/button/Button.d.ts +1 -1
  19. package/dist/button/Button.js.map +1 -1
  20. package/dist/card/CardHeader.d.ts +1 -1
  21. package/dist/card/CardHeader.js.map +1 -1
  22. package/dist/chip/Chip.d.ts +1 -1
  23. package/dist/chip/Chip.js.map +1 -1
  24. package/dist/dialog/Dialog.d.ts +1 -1
  25. package/dist/dialog/Dialog.js.map +1 -1
  26. package/dist/expansion-panel/ExpansionPanel.d.ts +1 -1
  27. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  28. package/dist/expansion-panel/ExpansionPanelHeader.d.ts +1 -1
  29. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  30. package/dist/files/FileInput.d.ts +1 -1
  31. package/dist/files/FileInput.js.map +1 -1
  32. package/dist/form/FormMessageContainer.d.ts +1 -1
  33. package/dist/form/FormMessageContainer.js.map +1 -1
  34. package/dist/form/InputToggle.d.ts +2 -2
  35. package/dist/form/InputToggle.js.map +1 -1
  36. package/dist/form/NativeSelect.d.ts +1 -1
  37. package/dist/form/NativeSelect.js.map +1 -1
  38. package/dist/form/OptGroup.d.ts +1 -1
  39. package/dist/form/OptGroup.js.map +1 -1
  40. package/dist/form/Password.d.ts +1 -1
  41. package/dist/form/Password.js.map +1 -1
  42. package/dist/form/Select.d.ts +2 -2
  43. package/dist/form/Select.js.map +1 -1
  44. package/dist/form/Slider.d.ts +1 -1
  45. package/dist/form/Slider.js.map +1 -1
  46. package/dist/form/Switch.d.ts +3 -3
  47. package/dist/form/Switch.js.map +1 -1
  48. package/dist/form/SwitchTrack.d.ts +1 -1
  49. package/dist/form/SwitchTrack.js.map +1 -1
  50. package/dist/form/TextArea.d.ts +2 -2
  51. package/dist/form/TextArea.js.map +1 -1
  52. package/dist/form/TextField.d.ts +1 -1
  53. package/dist/form/TextField.js.map +1 -1
  54. package/dist/form/_select.scss +1 -1
  55. package/dist/form/_slider.scss +1 -1
  56. package/dist/form/types.d.ts +5 -5
  57. package/dist/form/types.js.map +1 -1
  58. package/dist/layout/LayoutAppBar.d.ts +1 -1
  59. package/dist/layout/LayoutAppBar.js.map +1 -1
  60. package/dist/list/ListItemLink.d.ts +1 -1
  61. package/dist/list/ListItemLink.js.map +1 -1
  62. package/dist/list/ListItemText.d.ts +1 -1
  63. package/dist/list/ListItemText.js.map +1 -1
  64. package/dist/list/ListSubheader.d.ts +1 -1
  65. package/dist/list/ListSubheader.js.map +1 -1
  66. package/dist/list/types.d.ts +2 -2
  67. package/dist/list/types.js.map +1 -1
  68. package/dist/menu/Menu.d.ts +3 -3
  69. package/dist/menu/Menu.js.map +1 -1
  70. package/dist/menu/MenuItemInputToggle.d.ts +2 -2
  71. package/dist/menu/MenuItemInputToggle.js.map +1 -1
  72. package/dist/menu/MenuItemTextField.d.ts +1 -1
  73. package/dist/menu/MenuItemTextField.js.map +1 -1
  74. package/dist/menu/MenuSheet.d.ts +1 -1
  75. package/dist/menu/MenuSheet.js.map +1 -1
  76. package/dist/navigation/CollapsibleNavGroup.d.ts +2 -2
  77. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  78. package/dist/navigation/NavItemLink.d.ts +1 -1
  79. package/dist/navigation/NavItemLink.js.map +1 -1
  80. package/dist/progress/CircularProgress.d.ts +2 -17
  81. package/dist/progress/CircularProgress.js +19 -23
  82. package/dist/progress/CircularProgress.js.map +1 -1
  83. package/dist/progress/LinearProgress.d.ts +5 -1
  84. package/dist/progress/LinearProgress.js +13 -25
  85. package/dist/progress/LinearProgress.js.map +1 -1
  86. package/dist/progress/circularProgressStyles.d.ts +62 -0
  87. package/dist/progress/circularProgressStyles.js +38 -0
  88. package/dist/progress/circularProgressStyles.js.map +1 -0
  89. package/dist/progress/linearProgressStyles.d.ts +38 -0
  90. package/dist/progress/linearProgressStyles.js +38 -0
  91. package/dist/progress/linearProgressStyles.js.map +1 -0
  92. package/dist/searching/caseInsensitive.d.ts +20 -4
  93. package/dist/searching/caseInsensitive.js +5 -1
  94. package/dist/searching/caseInsensitive.js.map +1 -1
  95. package/dist/searching/fuzzy.d.ts +3 -3
  96. package/dist/searching/fuzzy.js +5 -1
  97. package/dist/searching/fuzzy.js.map +1 -1
  98. package/dist/searching/utils.d.ts +2 -1
  99. package/dist/searching/utils.js +11 -2
  100. package/dist/searching/utils.js.map +1 -1
  101. package/dist/snackbar/Toast.d.ts +1 -1
  102. package/dist/snackbar/Toast.js.map +1 -1
  103. package/dist/table/TableCell.d.ts +1 -1
  104. package/dist/table/TableCell.js.map +1 -1
  105. package/dist/table/TableCheckbox.d.ts +1 -1
  106. package/dist/table/TableCheckbox.js.map +1 -1
  107. package/dist/table/TableRadio.d.ts +1 -1
  108. package/dist/table/TableRadio.js.map +1 -1
  109. package/dist/tabs/TabListScrollButton.d.ts +1 -1
  110. package/dist/tabs/TabListScrollButton.js.map +1 -1
  111. package/dist/tree/TreeItem.d.ts +2 -2
  112. package/dist/tree/TreeItem.js.map +1 -1
  113. package/dist/tree/_tree.scss +1 -1
  114. package/dist/types.d.ts +29 -2
  115. package/dist/types.js +1 -1
  116. package/dist/types.js.map +1 -1
  117. package/dist/utils/alphaNumericSort.d.ts +9 -9
  118. package/dist/utils/alphaNumericSort.js +5 -1
  119. package/dist/utils/alphaNumericSort.js.map +1 -1
  120. package/dist/window-splitter/_window-splitter.scss +1 -1
  121. package/package.json +6 -6
  122. package/src/RootHtml.tsx +1 -1
  123. package/src/autocomplete/defaults.ts +5 -12
  124. package/src/autocomplete/types.ts +9 -12
  125. package/src/avatar/Avatar.tsx +2 -2
  126. package/src/avatar/styles.ts +53 -1
  127. package/src/box/styles.ts +34 -13
  128. package/src/button/AsyncButton.tsx +2 -2
  129. package/src/button/Button.tsx +1 -1
  130. package/src/card/CardHeader.tsx +1 -1
  131. package/src/chip/Chip.tsx +1 -1
  132. package/src/dialog/Dialog.tsx +1 -4
  133. package/src/expansion-panel/ExpansionPanel.tsx +1 -1
  134. package/src/expansion-panel/ExpansionPanelHeader.tsx +1 -1
  135. package/src/files/FileInput.tsx +1 -4
  136. package/src/form/FormMessageContainer.tsx +1 -1
  137. package/src/form/InputToggle.tsx +2 -5
  138. package/src/form/NativeSelect.tsx +1 -1
  139. package/src/form/OptGroup.tsx +1 -4
  140. package/src/form/Password.tsx +1 -1
  141. package/src/form/Select.tsx +2 -3
  142. package/src/form/Slider.tsx +1 -1
  143. package/src/form/Switch.tsx +3 -3
  144. package/src/form/SwitchTrack.tsx +1 -1
  145. package/src/form/TextArea.tsx +2 -5
  146. package/src/form/TextField.tsx +1 -1
  147. package/src/form/types.ts +5 -15
  148. package/src/layout/LayoutAppBar.tsx +1 -1
  149. package/src/list/ListItemLink.tsx +1 -1
  150. package/src/list/ListItemText.tsx +1 -4
  151. package/src/list/ListSubheader.tsx +1 -1
  152. package/src/list/types.ts +2 -5
  153. package/src/menu/Menu.tsx +3 -4
  154. package/src/menu/MenuItemInputToggle.tsx +2 -2
  155. package/src/menu/MenuItemTextField.tsx +1 -1
  156. package/src/menu/MenuSheet.tsx +1 -1
  157. package/src/navigation/CollapsibleNavGroup.tsx +2 -2
  158. package/src/navigation/NavItemLink.tsx +1 -1
  159. package/src/progress/CircularProgress.tsx +31 -53
  160. package/src/progress/LinearProgress.tsx +27 -40
  161. package/src/progress/circularProgressStyles.ts +114 -0
  162. package/src/progress/linearProgressStyles.ts +90 -0
  163. package/src/searching/caseInsensitive.ts +29 -7
  164. package/src/searching/fuzzy.ts +12 -6
  165. package/src/searching/utils.ts +13 -2
  166. package/src/snackbar/Toast.tsx +1 -1
  167. package/src/table/TableCell.tsx +1 -4
  168. package/src/table/TableCheckbox.tsx +1 -1
  169. package/src/table/TableRadio.tsx +1 -1
  170. package/src/tabs/TabListScrollButton.tsx +1 -1
  171. package/src/tree/TreeItem.tsx +2 -2
  172. package/src/types.ts +44 -2
  173. package/src/utils/alphaNumericSort.ts +17 -11
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/button/AsyncButton.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { type MouseEvent, type ReactNode, forwardRef } from \"react\";\n\nimport { type BoxAlignItems } from \"../box/styles.js\";\nimport { overlay } from \"../overlay/styles.js\";\nimport {\n CircularProgress,\n type CircularProgressProps,\n} from \"../progress/CircularProgress.js\";\nimport {\n LinearProgress,\n type LinearProgressProps,\n} from \"../progress/LinearProgress.js\";\nimport { type ProgressTheme } from \"../progress/types.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useAsyncFunction } from \"../useAsyncFunction.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { Button, type ButtonProps } from \"./Button.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport type AsyncButtonLoadingType =\n | \"circular-before\"\n | \"circular-after\"\n | \"circular-overlay\"\n | \"linear-above\"\n | \"linear-below\";\n\n/**\n * @since 6.0.0\n */\nexport interface AsyncButtonProps extends ButtonProps {\n /**\n * @see {@link progressAriaLabelledBy}\n * @defaultValue `\"async-button\" + useId()`\n */\n id?: string;\n\n /**\n * When this is defined and returns a `Promise`, the loading indicator will\n * display until the promise has resolved.\n *\n * @defaultValue `() => {}`\n */\n onClick?: (event: MouseEvent<HTMLButtonElement>) => Promise<void> | void;\n\n /**\n * Set this to `true` to manually display a loading spinner.\n *\n * @defaultValue `false`\n */\n loading?: boolean;\n\n /**\n * - `\"circular-overlay\"` - Covers and hides the button content with a\n * centered circular progress\n * - `\"circular-before\"` - Renders a circular progress bar before the button\n * content which is useful when rendering an icon before the button text.\n * See {@link beforeAddon} as well.\n * - `\"circular-after\"` - Renders a circular progress bar before the button\n * content which is useful when rendering an icon after the button text.\n * See {@link afterAddon} as well.\n * - `\"linear-above\"` - Renders a linear progress bar at the top of the button\n * while still displaying the button contents. Usually looks good for\n * outlined buttons.\n * - `\"linear-below\"` - Renders a linear progress bar at the bottom of the\n * button while still displaying the button contents. Usually looks good for\n * outlined buttons.\n *\n * @defaultValue `\"circular-overlay\"`\n */\n loadingType?: AsyncButtonLoadingType;\n\n /**\n * Optional content to display instead of the default `children` while\n * loading.\n */\n loadingChildren?: ReactNode;\n\n /**\n * Set this to `true` to use the `disabled` theme while loading.\n *\n * @defaultValue `false`\n */\n loadingDisabledTheme?: boolean;\n\n /**\n * This should be used when the {@link loadingType} is set to\n * `\"circular-before\"`, an icon should appear before the other content in\n * the button, and the loading indicator should replace the icon.\n */\n beforeAddon?: ReactNode;\n\n /**\n * This should be used when the {@link loadingType} is set to\n * `\"circular-after\"`, an icon should appear before the other content in\n * the button, and the loading indicator should replace the icon.\n */\n afterAddon?: ReactNode;\n\n /**\n * An optional label to provide to the progressbar.\n *\n * @see {@link progressAriaLabelledBy}\n */\n progressAriaLabel?: string;\n\n /**\n * @see {@link id}\n * @defaultValue `id`\n */\n progressAriaLabelledBy?: string;\n\n /**\n * Any additional props to pass to the `CircularProgress` bar when the\n * {@link loadingType} is one of the circular types.\n */\n linearProgressProps?: PropsWithRef<LinearProgressProps, HTMLDivElement>;\n\n /**\n * Any additional props to pass to the `LinearProgress` bar when the\n * {@link loadingType} is one of the linear types.\n */\n circularProgressProps?: PropsWithRef<CircularProgressProps, HTMLSpanElement>;\n}\n\n/**\n * **Client Component**\n *\n * The async button can be used to render a loading indicator within a button\n * during an async task. The loading spinner can be shown either by enabling the\n * `loading` prop or returning a promise from the `onClick` event which will\n * continue to show the loading indicator until the promise has been resolved.\n *\n * @example Async onClick\n * ```tsx\n * import { AsyncButton } from \"@react-md/core/button/AsyncButton\";\n * import { useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const [data, setData] = useState(null);\n * return (\n * <AsyncButton\n * type=\"submit\"\n * onClick={async () => {\n * const response = await fetch(\"/my-api\");\n * const json = await response.json();\n * setData(json);\n * }}\n * >\n * Submit\n * </AsyncButton>\n * );\n * }\n * ```\n *\n * @example Manual Loading State\n * ```tsx\n * import { AsyncButton } from \"@react-md/core/button/AsyncButton\";\n * import { useMutation } from \"@tanstack/query\";\n * import { useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { isLoading, mutate } = useMutation({\n * mutationFn: (newTodo) => fetch('/todos', {\n * method: \"POST\",\n * body: JSON.stringify(newTodo),\n * }),\n * });\n *\n * return (\n * <AsyncButton\n * type=\"submit\"\n * loading={isLoading}\n * onClick={() => {\n * mutate({ id: Date.now(), title: \"Create example\" });\n * }}\n * >\n * Create Todo\n * </AsyncButton>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/button#async-button | AsyncButton Demos}\n * @since 6.0.0\n */\nexport const AsyncButton = forwardRef<HTMLButtonElement, AsyncButtonProps>(\n function AsyncButton(props, ref) {\n const {\n id: propId,\n onClick = noop,\n children,\n floating = null,\n theme = floating ? \"secondary\" : \"clear\",\n themeType = floating ? \"contained\" : \"flat\",\n buttonType = floating ? \"icon\" : \"text\",\n className,\n disabled,\n loading: propLoading = false,\n loadingType = \"circular-overlay\",\n loadingChildren,\n loadingDisabledTheme = false,\n afterAddon: propAfterAddon,\n beforeAddon: propBeforeAddon,\n linearProgressProps,\n circularProgressProps,\n progressAriaLabel,\n progressAriaLabelledBy: propProgressAriaLabelledBy,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"async-button\");\n const { handleAsync, pending } = useAsyncFunction({ disabled });\n const loading = pending || propLoading;\n\n let progressTheme: ProgressTheme = \"current-color\";\n if (theme === \"clear\" || theme === \"disabled\") {\n progressTheme = \"primary\";\n }\n\n let progressAriaLabelledBy = propProgressAriaLabelledBy;\n if (\n !progressAriaLabel &&\n !linearProgressProps?.[\"aria-label\"] &&\n !linearProgressProps?.[\"aria-labelledby\"] &&\n !circularProgressProps?.[\"aria-label\"] &&\n !circularProgressProps?.[\"aria-labelledby\"]\n ) {\n progressAriaLabelledBy = id;\n }\n\n const progress = loadingType.includes(\"linear\") ? (\n <LinearProgress\n aria-label={progressAriaLabel}\n aria-labelledby={progressAriaLabelledBy as string}\n {...linearProgressProps}\n theme={progressTheme}\n />\n ) : (\n <CircularProgress\n aria-label={progressAriaLabel}\n aria-labelledby={progressAriaLabelledBy as string}\n {...circularProgressProps}\n theme={progressTheme}\n />\n );\n\n let afterAddon = propAfterAddon;\n let beforeAddon = propBeforeAddon;\n let overlayElement: ReactNode;\n let isOverlayCover = false;\n switch (loadingType) {\n case \"circular-before\":\n beforeAddon = loading ? progress : propBeforeAddon;\n break;\n case \"circular-after\":\n afterAddon = loading ? progress : propAfterAddon;\n break;\n case \"circular-overlay\":\n case \"linear-above\":\n case \"linear-below\": {\n let alignItems: BoxAlignItems = \"center\";\n if (loadingType === \"linear-above\") {\n alignItems = \"start\";\n } else if (loadingType === \"linear-below\") {\n alignItems = \"end\";\n } else {\n isOverlayCover = true;\n }\n\n overlayElement = loading && (\n <span\n className={overlay({\n active: true,\n visible: true,\n absolute: true,\n align: alignItems,\n })}\n >\n {progress}\n </span>\n );\n break;\n }\n }\n\n return (\n <Button\n {...remaining}\n aria-disabled={loading || undefined}\n id={id}\n ref={ref}\n disabled={disabled}\n floating={floating}\n className={cnb(\n \"rmd-button--async\",\n loading && isOverlayCover && \"rmd-button--async-overlay\",\n className\n )}\n theme={loading && loadingDisabledTheme ? \"disabled\" : theme}\n themeType={themeType}\n buttonType={buttonType}\n onClick={handleAsync((event) => Promise.resolve(onClick(event)))}\n >\n {beforeAddon}\n {loading && typeof loadingChildren !== \"undefined\"\n ? loadingChildren\n : children}\n {afterAddon}\n {overlayElement}\n </Button>\n );\n }\n);\n"],"names":["cnb","forwardRef","overlay","CircularProgress","LinearProgress","useAsyncFunction","useEnsuredId","Button","noop","AsyncButton","props","ref","id","propId","onClick","children","floating","theme","themeType","buttonType","className","disabled","loading","propLoading","loadingType","loadingChildren","loadingDisabledTheme","afterAddon","propAfterAddon","beforeAddon","propBeforeAddon","linearProgressProps","circularProgressProps","progressAriaLabel","progressAriaLabelledBy","propProgressAriaLabelledBy","remaining","handleAsync","pending","progressTheme","progress","includes","aria-label","aria-labelledby","overlayElement","isOverlayCover","alignItems","span","active","visible","absolute","align","aria-disabled","undefined","event","Promise","resolve"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA0CC,UAAU,QAAQ,QAAQ;AAGpE,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SACEC,gBAAgB,QAEX,kCAAkC;AACzC,SACEC,cAAc,QAET,gCAAgC;AAGvC,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,MAAM,QAA0B,cAAc;AAEvD,MAAMC,OAAO;AACX,aAAa;AACf;AA8GA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DC,GACD,OAAO,MAAMC,4BAAcR,WACzB,SAASQ,YAAYC,KAAK,EAAEC,GAAG;IAC7B,MAAM,EACJC,IAAIC,MAAM,EACVC,UAAUN,IAAI,EACdO,QAAQ,EACRC,WAAW,IAAI,EACfC,QAAQD,WAAW,cAAc,OAAO,EACxCE,YAAYF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sB,aAAa;gBACf,OAAO,IAAItB,gBAAgB,gBAAgB;oBACzCsB,aAAa;gBACf,OAAO;oBACLD,iBAAiB;gBACnB;gBAEAD,iBAAiBtB,yBACf,KAACyB;oBACC3B,WAAWlB,QAAQ;wBACjB8C,QAAQ;wBACRC,SAAS;wBACTC,UAAU;wBACVC,OAAOL;oBACT;8BAECN;;gBAGL;YACF;IACF;IAEA,qBACE,MAACjC;QACE,GAAG6B,SAAS;QACbgB,iBAAe9B,WAAW+B;QAC1BzC,IAAIA;QACJD,KAAKA;QACLU,UAAUA;QACVL,UAAUA;QACVI,WAAWpB,IACT,qBACAsB,WAAWuB,kBAAkB,6BAC7BzB;QAEFH,OAAOK,WAAWI,uBAAuB,aAAaT;QACtDC,WAAWA;QACXC,YAAYA;QACZL,SAASuB,YAAY,CAACiB,QAAUC,QAAQC,OAAO,CAAC1C,QAAQwC;;YAEvDzB;YACAP,WAAW,OAAOG,oBAAoB,cACnCA,kBACAV;YACHY;YACAiB;;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/button/AsyncButton.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { type MouseEvent, type ReactNode, forwardRef } from \"react\";\n\nimport { type BoxAlignItems } from \"../box/styles.js\";\nimport { overlay } from \"../overlay/styles.js\";\nimport {\n CircularProgress,\n type CircularProgressProps,\n} from \"../progress/CircularProgress.js\";\nimport {\n LinearProgress,\n type LinearProgressProps,\n} from \"../progress/LinearProgress.js\";\nimport { type ProgressTheme } from \"../progress/types.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useAsyncFunction } from \"../useAsyncFunction.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { Button, type ButtonProps } from \"./Button.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * @since 6.0.0\n */\nexport type AsyncButtonLoadingType =\n | \"circular-before\"\n | \"circular-after\"\n | \"circular-overlay\"\n | \"linear-above\"\n | \"linear-below\";\n\n/**\n * @since 6.0.0\n */\nexport interface AsyncButtonProps extends ButtonProps {\n /**\n * @see {@link progressAriaLabelledBy}\n * @defaultValue `\"async-button\" + useId()`\n */\n id?: string;\n\n /**\n * When this is defined and returns a `Promise`, the loading indicator will\n * display until the promise has resolved.\n *\n * @defaultValue `() => {}`\n */\n onClick?: (event: MouseEvent<HTMLButtonElement>) => Promise<void> | void;\n\n /**\n * Set this to `true` to manually display a loading spinner.\n *\n * @defaultValue `false`\n */\n loading?: boolean;\n\n /**\n * - `\"circular-overlay\"` - Covers and hides the button content with a\n * centered circular progress\n * - `\"circular-before\"` - Renders a circular progress bar before the button\n * content which is useful when rendering an icon before the button text.\n * See {@link beforeAddon} as well.\n * - `\"circular-after\"` - Renders a circular progress bar before the button\n * content which is useful when rendering an icon after the button text.\n * See {@link afterAddon} as well.\n * - `\"linear-above\"` - Renders a linear progress bar at the top of the button\n * while still displaying the button contents. Usually looks good for\n * outlined buttons.\n * - `\"linear-below\"` - Renders a linear progress bar at the bottom of the\n * button while still displaying the button contents. Usually looks good for\n * outlined buttons.\n *\n * @defaultValue `\"circular-overlay\"`\n */\n loadingType?: AsyncButtonLoadingType;\n\n /**\n * Optional content to display instead of the default `children` while\n * loading.\n */\n loadingChildren?: ReactNode;\n\n /**\n * Set this to `true` to use the `disabled` theme while loading.\n *\n * @defaultValue `false`\n */\n loadingDisabledTheme?: boolean;\n\n /**\n * This should be used when the {@link loadingType} is set to\n * `\"circular-before\"`, an icon should appear before the other content in\n * the button, and the loading indicator should replace the icon.\n */\n beforeAddon?: ReactNode;\n\n /**\n * This should be used when the {@link loadingType} is set to\n * `\"circular-after\"`, an icon should appear before the other content in\n * the button, and the loading indicator should replace the icon.\n */\n afterAddon?: ReactNode;\n\n /**\n * An optional label to provide to the progressbar.\n *\n * @see {@link progressAriaLabelledBy}\n */\n progressAriaLabel?: string;\n\n /**\n * @see {@link id}\n * @defaultValue `id`\n */\n progressAriaLabelledBy?: string;\n\n /**\n * Any additional props to pass to the `CircularProgress` bar when the\n * {@link loadingType} is one of the circular types.\n */\n linearProgressProps?: PropsWithRef<LinearProgressProps>;\n\n /**\n * Any additional props to pass to the `LinearProgress` bar when the\n * {@link loadingType} is one of the linear types.\n */\n circularProgressProps?: PropsWithRef<CircularProgressProps>;\n}\n\n/**\n * **Client Component**\n *\n * The async button can be used to render a loading indicator within a button\n * during an async task. The loading spinner can be shown either by enabling the\n * `loading` prop or returning a promise from the `onClick` event which will\n * continue to show the loading indicator until the promise has been resolved.\n *\n * @example Async onClick\n * ```tsx\n * import { AsyncButton } from \"@react-md/core/button/AsyncButton\";\n * import { useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const [data, setData] = useState(null);\n * return (\n * <AsyncButton\n * type=\"submit\"\n * onClick={async () => {\n * const response = await fetch(\"/my-api\");\n * const json = await response.json();\n * setData(json);\n * }}\n * >\n * Submit\n * </AsyncButton>\n * );\n * }\n * ```\n *\n * @example Manual Loading State\n * ```tsx\n * import { AsyncButton } from \"@react-md/core/button/AsyncButton\";\n * import { useMutation } from \"@tanstack/query\";\n * import { useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { isLoading, mutate } = useMutation({\n * mutationFn: (newTodo) => fetch('/todos', {\n * method: \"POST\",\n * body: JSON.stringify(newTodo),\n * }),\n * });\n *\n * return (\n * <AsyncButton\n * type=\"submit\"\n * loading={isLoading}\n * onClick={() => {\n * mutate({ id: Date.now(), title: \"Create example\" });\n * }}\n * >\n * Create Todo\n * </AsyncButton>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/button#async-button | AsyncButton Demos}\n * @since 6.0.0\n */\nexport const AsyncButton = forwardRef<HTMLButtonElement, AsyncButtonProps>(\n function AsyncButton(props, ref) {\n const {\n id: propId,\n onClick = noop,\n children,\n floating = null,\n theme = floating ? \"secondary\" : \"clear\",\n themeType = floating ? \"contained\" : \"flat\",\n buttonType = floating ? \"icon\" : \"text\",\n className,\n disabled,\n loading: propLoading = false,\n loadingType = \"circular-overlay\",\n loadingChildren,\n loadingDisabledTheme = false,\n afterAddon: propAfterAddon,\n beforeAddon: propBeforeAddon,\n linearProgressProps,\n circularProgressProps,\n progressAriaLabel,\n progressAriaLabelledBy: propProgressAriaLabelledBy,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"async-button\");\n const { handleAsync, pending } = useAsyncFunction({ disabled });\n const loading = pending || propLoading;\n\n let progressTheme: ProgressTheme = \"current-color\";\n if (theme === \"clear\" || theme === \"disabled\") {\n progressTheme = \"primary\";\n }\n\n let progressAriaLabelledBy = propProgressAriaLabelledBy;\n if (\n !progressAriaLabel &&\n !linearProgressProps?.[\"aria-label\"] &&\n !linearProgressProps?.[\"aria-labelledby\"] &&\n !circularProgressProps?.[\"aria-label\"] &&\n !circularProgressProps?.[\"aria-labelledby\"]\n ) {\n progressAriaLabelledBy = id;\n }\n\n const progress = loadingType.includes(\"linear\") ? (\n <LinearProgress\n aria-label={progressAriaLabel}\n aria-labelledby={progressAriaLabelledBy as string}\n {...linearProgressProps}\n theme={progressTheme}\n />\n ) : (\n <CircularProgress\n aria-label={progressAriaLabel}\n aria-labelledby={progressAriaLabelledBy as string}\n {...circularProgressProps}\n theme={progressTheme}\n />\n );\n\n let afterAddon = propAfterAddon;\n let beforeAddon = propBeforeAddon;\n let overlayElement: ReactNode;\n let isOverlayCover = false;\n switch (loadingType) {\n case \"circular-before\":\n beforeAddon = loading ? progress : propBeforeAddon;\n break;\n case \"circular-after\":\n afterAddon = loading ? progress : propAfterAddon;\n break;\n case \"circular-overlay\":\n case \"linear-above\":\n case \"linear-below\": {\n let alignItems: BoxAlignItems = \"center\";\n if (loadingType === \"linear-above\") {\n alignItems = \"start\";\n } else if (loadingType === \"linear-below\") {\n alignItems = \"end\";\n } else {\n isOverlayCover = true;\n }\n\n overlayElement = loading && (\n <span\n className={overlay({\n active: true,\n visible: true,\n absolute: true,\n align: alignItems,\n })}\n >\n {progress}\n </span>\n );\n break;\n }\n }\n\n return (\n <Button\n {...remaining}\n aria-disabled={loading || undefined}\n id={id}\n ref={ref}\n disabled={disabled}\n floating={floating}\n className={cnb(\n \"rmd-button--async\",\n loading && isOverlayCover && \"rmd-button--async-overlay\",\n className\n )}\n theme={loading && loadingDisabledTheme ? \"disabled\" : theme}\n themeType={themeType}\n buttonType={buttonType}\n onClick={handleAsync((event) => Promise.resolve(onClick(event)))}\n >\n {beforeAddon}\n {loading && typeof loadingChildren !== \"undefined\"\n ? loadingChildren\n : children}\n {afterAddon}\n {overlayElement}\n </Button>\n );\n }\n);\n"],"names":["cnb","forwardRef","overlay","CircularProgress","LinearProgress","useAsyncFunction","useEnsuredId","Button","noop","AsyncButton","props","ref","id","propId","onClick","children","floating","theme","themeType","buttonType","className","disabled","loading","propLoading","loadingType","loadingChildren","loadingDisabledTheme","afterAddon","propAfterAddon","beforeAddon","propBeforeAddon","linearProgressProps","circularProgressProps","progressAriaLabel","progressAriaLabelledBy","propProgressAriaLabelledBy","remaining","handleAsync","pending","progressTheme","progress","includes","aria-label","aria-labelledby","overlayElement","isOverlayCover","alignItems","span","active","visible","absolute","align","aria-disabled","undefined","event","Promise","resolve"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA0CC,UAAU,QAAQ,QAAQ;AAGpE,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,SACEC,gBAAgB,QAEX,kCAAkC;AACzC,SACEC,cAAc,QAET,gCAAgC;AAGvC,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,MAAM,QAA0B,cAAc;AAEvD,MAAMC,OAAO;AACX,aAAa;AACf;AA8GA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DC,GACD,OAAO,MAAMC,4BAAcR,WACzB,SAASQ,YAAYC,KAAK,EAAEC,GAAG;IAC7B,MAAM,EACJC,IAAIC,MAAM,EACVC,UAAUN,IA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;QACL,KAAK;YAAgB;gBACnB,IAAIkB,aAA4B;gBAChC,IAAItB,gBAAgB,gBAAgB;oBAClCsB,aAAa;gBACf,OAAO,IAAItB,gBAAgB,gBAAgB;oBACzCsB,aAAa;gBACf,OAAO;oBACLD,iBAAiB;gBACnB;gBAEAD,iBAAiBtB,yBACf,KAACyB;oBACC3B,WAAWlB,QAAQ;wBACjB8C,QAAQ;wBACRC,SAAS;wBACTC,UAAU;wBACVC,OAAOL;oBACT;8BAECN;;gBAGL;YACF;IACF;IAEA,qBACE,MAACjC;QACE,GAAG6B,SAAS;QACbgB,iBAAe9B,WAAW+B;QAC1BzC,IAAIA;QACJD,KAAKA;QACLU,UAAUA;QACVL,UAAUA;QACVI,WAAWpB,IACT,qBACAsB,WAAWuB,kBAAkB,6BAC7BzB;QAEFH,OAAOK,WAAWI,uBAAuB,aAAaT;QACtDC,WAAWA;QACXC,YAAYA;QACZL,SAASuB,YAAY,CAACiB,QAAUC,QAAQC,OAAO,CAAC1C,QAAQwC;;YAEvDzB;YACAP,WAAW,OAAOG,oBAAoB,cACnCA,kBACAV;YACHY;YACAiB;;;AAGP,GACA"}
@@ -15,7 +15,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, Bu
15
15
  * Any additional props to provide the to `FAB` container element when the
16
16
  * `floating` prop is provided
17
17
  */
18
- floatingProps?: PropsWithRef<FloatingActionButtonProps, HTMLSpanElement>;
18
+ floatingProps?: PropsWithRef<FloatingActionButtonProps>;
19
19
  }
20
20
  /**
21
21
  * **Client Component**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/button/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ButtonHTMLAttributes, forwardRef } from \"react\";\n\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport {\n FloatingActionButton,\n type FloatingActionButtonPosition,\n type FloatingActionButtonProps,\n} from \"./FloatingActionButton.js\";\nimport { type ButtonClassNameThemeOptions, button } from \"./styles.js\";\n\nexport interface ButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ButtonClassNameThemeOptions,\n ComponentWithRippleProps {\n /** @defaultValue `\"button\"` */\n type?: \"button\" | \"reset\" | \"submit\";\n\n /**\n * The position within the viewport to display the button as a floating action\n * button.\n */\n floating?: FloatingActionButtonPosition;\n\n /**\n * Any additional props to provide the to `FAB` container element when the\n * `floating` prop is provided\n */\n floatingProps?: PropsWithRef<FloatingActionButtonProps, HTMLSpanElement>;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Button\n * onClick={(event) => {\n * // do something\n * }}\n * >\n * Content\n * </Button>\n * );\n * }\n * ```\n *\n * @example Theme Example\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Button\n * theme=\"primary\"\n * themeType=\"contained\"\n * onClick={(event) => {\n * // do something\n * }}\n * >\n * Content\n * </Button>\n * );\n * }\n * ```\n *\n * @example Icon Button Example\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Button\n * theme=\"secondary\"\n * themeType=\"outline\"\n * buttonType=\"icon\"\n * onClick={(event) => {\n * // do something\n * }}\n * >\n * <FavoriteIcon />\n * </Button>\n * );\n * }\n * ```\n *\n * @example Text Button with icons\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Button\n * onClick={(event) => {\n * // do something\n * }}\n * >\n * <FavoriteIcon />\n * Content\n * </Button>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/button | Button Demos}\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(props, ref) {\n const {\n type = \"button\",\n disabled = false,\n floating = null,\n floatingProps,\n theme = floating ? \"secondary\" : \"clear\",\n themeType = floating ? \"contained\" : \"flat\",\n iconSize,\n buttonType = floating || iconSize ? \"icon\" : \"text\",\n className,\n responsive,\n children: propChildren,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disableRipple,\n ...remaining\n } = props;\n const isThemeDisabled = theme === \"disabled\";\n const ariaDisabled = props[\"aria-disabled\"];\n const { pressed, pressedClassName, ripples, handlers } =\n useElementInteraction({\n mode: disableRipple ? \"press\" : undefined,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled:\n disabled ||\n isThemeDisabled ||\n (ariaDisabled && ariaDisabled !== \"false\"),\n });\n\n const children = useHigherContrastChildren(propChildren);\n\n return (\n <FloatingActionButton position={floating} {...floatingProps}>\n <button\n {...remaining}\n // when the theme is set to `\"disabled\"`, the event handlers should be\n // removed so that it behaves like a disabled button. you do not want to\n // actually set the `disabled` attribute since it will lose keyboard\n // focus. this is mostly for supporting circular progress bars within\n // buttons\n {...(isThemeDisabled ? {} : handlers)}\n aria-disabled={isThemeDisabled || remaining[\"aria-disabled\"]}\n disabled={disabled}\n ref={ref}\n type={type}\n className={button({\n theme,\n themeType,\n buttonType,\n disabled,\n responsive,\n iconSize,\n pressed,\n pressedClassName,\n className,\n })}\n >\n {children}\n {ripples}\n </button>\n </FloatingActionButton>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","FloatingActionButton","button","Button","props","ref","type","disabled","floating","floatingProps","theme","themeType","iconSize","buttonType","className","responsive","children","propChildren","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","disableRipple","remaining","isThemeDisabled","ariaDisabled","pressed","pressedClassName","ripples","handlers","mode","undefined","position","aria-disabled"],"mappings":"AAAA;;AAEA,SAAoCA,UAAU,QAAQ,QAAQ;AAG9D,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AAExF,SACEC,oBAAoB,QAGf,4BAA4B;AACnC,SAA2CC,MAAM,QAAQ,cAAc;AAsBvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoFC,GACD,OAAO,MAAMC,uBAASL,WACpB,SAASK,OAAOC,KAAK,EAAEC,GAAG;IACxB,MAAM,EACJC,OAAO,QAAQ,EACfC,WAAW,KAAK,EAChBC,WAAW,IAAI,EACfC,aAAa,EACbC,QAAQF,WAAW,cAAc,OAAO,EACxCG,YAAYH,WAAW,cAAc,MAAM,EAC3CI,QAAQ,EACRC,aAAaL,YAAYI,WAAW,SAAS,MAAM,EACnDE,SAAS,EACTC,UAAU,EACVC,UAAUC,YAAY,EACtBC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,aAAa,EACb,GAAGC,WACJ,GAAG1B;IACJ,MAAM2B,kBAAkBrB,UAAU;IAClC,MAAMsB,eAAe5B,KAAK,CAAC,gBAAgB;IAC3C,MAAM,EAAE6B,OAAO,EAAEC,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GACpDrC,sBAAsB;QACpBsC,MAAMR,gBAAgB,UAAUS;QAChCpB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACArB,UACEA,YACAwB,mBACCC,gBAAgBA,iBAAiB;IACtC;IAEF,MAAMhB,WAAWhB,0BAA0BiB;IAE3C,qBACE,KAAChB;QAAqBsC,UAAU/B;QAAW,GAAGC,aAAa;kBACzD,cAAA,MAACP;YACE,GAAG4B,SAAS;YAMZ,GAAIC,kBAAkB,CAAC,IAAIK,QAAQ;YACpCI,iBAAeT,mBAAmBD,SAAS,CAAC,gBAAgB;YAC5DvB,UAAUA;YACVF,KAAKA;YACLC,MAAMA;YACNQ,WAAWZ,OAAO;gBAChBQ;gBACAC;gBACAE;gBACAN;gBACAQ;gBACAH;gBACAqB;gBACAC;gBACApB;YACF;;gBAECE;gBACAmB;;;;AAIT,GACA"}
1
+ {"version":3,"sources":["../../src/button/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ButtonHTMLAttributes, forwardRef } from \"react\";\n\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport {\n FloatingActionButton,\n type FloatingActionButtonPosition,\n type FloatingActionButtonProps,\n} from \"./FloatingActionButton.js\";\nimport { type ButtonClassNameThemeOptions, button } from \"./styles.js\";\n\nexport interface ButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ButtonClassNameThemeOptions,\n ComponentWithRippleProps {\n /** @defaultValue `\"button\"` */\n type?: \"button\" | \"reset\" | \"submit\";\n\n /**\n * The position within the viewport to display the button as a floating action\n * button.\n */\n floating?: FloatingActionButtonPosition;\n\n /**\n * Any additional props to provide the to `FAB` container element when the\n * `floating` prop is provided\n */\n floatingProps?: PropsWithRef<FloatingActionButtonProps>;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Button\n * onClick={(event) => {\n * // do something\n * }}\n * >\n * Content\n * </Button>\n * );\n * }\n * ```\n *\n * @example Theme Example\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Button\n * theme=\"primary\"\n * themeType=\"contained\"\n * onClick={(event) => {\n * // do something\n * }}\n * >\n * Content\n * </Button>\n * );\n * }\n * ```\n *\n * @example Icon Button Example\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Button\n * theme=\"secondary\"\n * themeType=\"outline\"\n * buttonType=\"icon\"\n * onClick={(event) => {\n * // do something\n * }}\n * >\n * <FavoriteIcon />\n * </Button>\n * );\n * }\n * ```\n *\n * @example Text Button with icons\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Button\n * onClick={(event) => {\n * // do something\n * }}\n * >\n * <FavoriteIcon />\n * Content\n * </Button>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/button | Button Demos}\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(props, ref) {\n const {\n type = \"button\",\n disabled = false,\n floating = null,\n floatingProps,\n theme = floating ? \"secondary\" : \"clear\",\n themeType = floating ? \"contained\" : \"flat\",\n iconSize,\n buttonType = floating || iconSize ? \"icon\" : \"text\",\n className,\n responsive,\n children: propChildren,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disableRipple,\n ...remaining\n } = props;\n const isThemeDisabled = theme === \"disabled\";\n const ariaDisabled = props[\"aria-disabled\"];\n const { pressed, pressedClassName, ripples, handlers } =\n useElementInteraction({\n mode: disableRipple ? \"press\" : undefined,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled:\n disabled ||\n isThemeDisabled ||\n (ariaDisabled && ariaDisabled !== \"false\"),\n });\n\n const children = useHigherContrastChildren(propChildren);\n\n return (\n <FloatingActionButton position={floating} {...floatingProps}>\n <button\n {...remaining}\n // when the theme is set to `\"disabled\"`, the event handlers should be\n // removed so that it behaves like a disabled button. you do not want to\n // actually set the `disabled` attribute since it will lose keyboard\n // focus. this is mostly for supporting circular progress bars within\n // buttons\n {...(isThemeDisabled ? {} : handlers)}\n aria-disabled={isThemeDisabled || remaining[\"aria-disabled\"]}\n disabled={disabled}\n ref={ref}\n type={type}\n className={button({\n theme,\n themeType,\n buttonType,\n disabled,\n responsive,\n iconSize,\n pressed,\n pressedClassName,\n className,\n })}\n >\n {children}\n {ripples}\n </button>\n </FloatingActionButton>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","FloatingActionButton","button","Button","props","ref","type","disabled","floating","floatingProps","theme","themeType","iconSize","buttonType","className","responsive","children","propChildren","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","disableRipple","remaining","isThemeDisabled","ariaDisabled","pressed","pressedClassName","ripples","handlers","mode","undefined","position","aria-disabled"],"mappings":"AAAA;;AAEA,SAAoCA,UAAU,QAAQ,QAAQ;AAG9D,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AAExF,SACEC,oBAAoB,QAGf,4BAA4B;AACnC,SAA2CC,MAAM,QAAQ,cAAc;AAsBvE;;;;;;;;;;;;;;;;;;;;;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B;YACF;;gBAECE;gBACAmB;;;;AAIT,GACA"}
@@ -22,7 +22,7 @@ export interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {
22
22
  * Any props to pass to the `<div>` that surrounds the `children`. This is
23
23
  * generally used to apply custom `style` or `className`.
24
24
  */
25
- contentProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
25
+ contentProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;
26
26
  }
27
27
  /**
28
28
  * @see {@link https://react-md.dev/components/card | Card Demos}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/card/CardHeader.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, forwardRef } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { cardHeader, cardHeaderContent } from \"./styles.js\";\n\n/**\n * @since 6.0.0 Removed the `align` prop.\n * @since 6.0.0 Renamed the `beforeChildren` and `afterChildren` props to\n * `beforeAddon` and `afterAddon`.\n * @since 6.0.0 Removed the `contentClassName` prop in favor of the\n * `contentProps`.\n */\nexport interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Any content to display after the children in the header. This could be an\n * expander icon button, visual media like an image or video, etc.\n */\n afterAddon?: ReactNode;\n\n /**\n * Any content to display before the children in the header. This could be an\n * expander icon button, visual media like an image or video, etc.\n */\n beforeAddon?: ReactNode;\n\n /**\n * Any props to pass to the `<div>` that surrounds the `children`. This is\n * generally used to apply custom `style` or `className`.\n */\n contentProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n}\n\n/**\n * @see {@link https://react-md.dev/components/card | Card Demos}\n * @since 6.0.0 Removed the `align` prop.\n * @since 6.0.0 Renamed the `beforeChildren` and `afterChildren` props to\n * `beforeAddon` and `afterAddon`.\n * @since 6.0.0 Removed the `contentClassName` prop in favor of the\n * `contentProps`.\n * @since 6.0.0 No longer uses the `TextIconSpacing` component and instead\n * relies on the CSS `gap` for spacing.\n * @since 6.0.0 Renders as a `<div>` instead of a `<header>`\n */\nexport const CardHeader = forwardRef<HTMLDivElement, CardHeaderProps>(\n function CardHeader(props, ref) {\n const {\n className,\n children,\n beforeAddon,\n afterAddon,\n contentProps,\n ...remaining\n } = props;\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={cardHeader({\n className,\n addonBefore: !!beforeAddon,\n addonAfter: !!afterAddon,\n })}\n >\n {beforeAddon}\n <div\n {...contentProps}\n className={cardHeaderContent({ className: contentProps?.className })}\n >\n {children}\n </div>\n {afterAddon}\n </div>\n );\n }\n);\n"],"names":["forwardRef","cardHeader","cardHeaderContent","CardHeader","props","ref","className","children","beforeAddon","afterAddon","contentProps","remaining","div","addonBefore","addonAfter"],"mappings":";AAAA,SAA8CA,UAAU,QAAQ,QAAQ;AAGxE,SAASC,UAAU,EAAEC,iBAAiB,QAAQ,cAAc;AA6B5D;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,2BAAaH,WACxB,SAASG,WAAWC,KAAK,EAAEC,GAAG;IAC5B,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZ,GAAGC,WACJ,GAAGP;IAEJ,qBACE,MAACQ;QACE,GAAGD,SAAS;QACbN,KAAKA;QACLC,WAAWL,WAAW;YACpBK;YACAO,aAAa,CAAC,CAACL;YACfM,YAAY,CAAC,CAACL;QAChB;;YAECD;0BACD,KAACI;gBACE,GAAGF,YAAY;gBAChBJ,WAAWJ,kBAAkB;oBAAEI,WAAWI,cAAcJ;gBAAU;0BAEjEC;;YAEFE;;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/card/CardHeader.tsx"],"sourcesContent":["import { type HTMLAttributes, type ReactNode, forwardRef } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { cardHeader, cardHeaderContent } from \"./styles.js\";\n\n/**\n * @since 6.0.0 Removed the `align` prop.\n * @since 6.0.0 Renamed the `beforeChildren` and `afterChildren` props to\n * `beforeAddon` and `afterAddon`.\n * @since 6.0.0 Removed the `contentClassName` prop in favor of the\n * `contentProps`.\n */\nexport interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Any content to display after the children in the header. This could be an\n * expander icon button, visual media like an image or video, etc.\n */\n afterAddon?: ReactNode;\n\n /**\n * Any content to display before the children in the header. This could be an\n * expander icon button, visual media like an image or video, etc.\n */\n beforeAddon?: ReactNode;\n\n /**\n * Any props to pass to the `<div>` that surrounds the `children`. This is\n * generally used to apply custom `style` or `className`.\n */\n contentProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;\n}\n\n/**\n * @see {@link https://react-md.dev/components/card | Card Demos}\n * @since 6.0.0 Removed the `align` prop.\n * @since 6.0.0 Renamed the `beforeChildren` and `afterChildren` props to\n * `beforeAddon` and `afterAddon`.\n * @since 6.0.0 Removed the `contentClassName` prop in favor of the\n * `contentProps`.\n * @since 6.0.0 No longer uses the `TextIconSpacing` component and instead\n * relies on the CSS `gap` for spacing.\n * @since 6.0.0 Renders as a `<div>` instead of a `<header>`\n */\nexport const CardHeader = forwardRef<HTMLDivElement, CardHeaderProps>(\n function CardHeader(props, ref) {\n const {\n className,\n children,\n beforeAddon,\n afterAddon,\n contentProps,\n ...remaining\n } = props;\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={cardHeader({\n className,\n addonBefore: !!beforeAddon,\n addonAfter: !!afterAddon,\n })}\n >\n {beforeAddon}\n <div\n {...contentProps}\n className={cardHeaderContent({ className: contentProps?.className })}\n >\n {children}\n </div>\n {afterAddon}\n </div>\n );\n }\n);\n"],"names":["forwardRef","cardHeader","cardHeaderContent","CardHeader","props","ref","className","children","beforeAddon","afterAddon","contentProps","remaining","div","addonBefore","addonAfter"],"mappings":";AAAA,SAA8CA,UAAU,QAAQ,QAAQ;AAGxE,SAASC,UAAU,EAAEC,iBAAiB,QAAQ,cAAc;AA6B5D;;;;;;;;;;CAUC,GACD,OAAO,MAAMC,2BAAaH,WACxB,SAASG,WAAWC,KAAK,EAAEC,GAAG;IAC5B,MAAM,EACJC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXC,UAAU,EACVC,YAAY,EACZ,GAAGC,WACJ,GAAGP;IAEJ,qBACE,MAACQ;QACE,GAAGD,SAAS;QACbN,KAAKA;QACLC,WAAWL,WAAW;YACpBK;YACAO,aAAa,CAAC,CAACL;YACfM,YAAY,CAAC,CAACL;QAChB;;YAECD;0BACD,KAACI;gBACE,GAAGF,YAAY;gBAChBJ,WAAWJ,kBAAkB;oBAAEI,WAAWI,cAAcJ;gBAAU;0BAEjEC;;YAEFE;;;AAGP,GACA"}
@@ -114,7 +114,7 @@ export interface ChipProps extends ButtonHTMLAttributes<HTMLButtonElement>, Comp
114
114
  *
115
115
  * @since 6.0.0
116
116
  */
117
- contentProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
117
+ contentProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;
118
118
  /**
119
119
  * This will be ignored if {@link disableContentWrap} is `true`.
120
120
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/chip/Chip.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport {\n type ButtonHTMLAttributes,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { type BackgroundColor } from \"../cssUtils.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { useMaxWidthTransition } from \"../transition/useMaxWidthTransition.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { chip, chipContent } from \"./styles.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-chip-solid-background-color\"?: string;\n \"--rmd-chip-solid-disabled-background-color\"?: string;\n \"--rmd-chip-solid-color\"?: string;\n \"--rmd-chip-theme-background-color\"?: string;\n \"--rmd-chip-theme-color\"?: string;\n \"--rmd-chip-outline-background-color\"?: string;\n \"--rmd-chip-outline-color\"?: string;\n }\n}\n\n/**\n * @since 6.0.0 Renamed the `noninteractive` prop to\n * `noninteractable`.\n */\nexport interface ChipProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ComponentWithRippleProps {\n /**\n * @defaultValue `\"solid\"`\n */\n theme?: \"outline\" | \"solid\";\n\n /**\n * Set this to `true` if the chip should gain additional box shadow while the\n * user is pressing down on the chip.\n *\n * @defaultValue `false`\n */\n raisable?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * When this is a boolean, a selected icon will be displayed before the\n * `children` and appear/disappear when `true`/`false`.\n *\n * @see {@link selectedIcon}\n * @see {@link selectedIconAfter}\n * @see {@link selectedThemed}\n */\n selected?: boolean;\n\n /**\n * Set this to `true` if the chip should change background color while\n * {@link selected} instead of displaying an icon. The default background\n * color is a lighter swatch of the theme primary color.\n *\n * @defaultValue `false`\n */\n selectedThemed?: boolean;\n\n /**\n * An optional className to provide only while {@link selected} is `true`.\n */\n selectedClassName?: string;\n\n /**\n * This will be ignored if {@link selected} is `undefined`.\n *\n * @defaultValue `getIcon(\"selected\")`\n */\n selectedIcon?: ReactNode;\n\n /**\n * Set this to `true` if the {@link selectedIcon} should display as the\n * {@link rightAddon} instead of the {@link leftAddon}.\n *\n * @defaultValue `false`\n * @since 6.0.0\n */\n selectedIconAfter?: boolean;\n\n /**\n * Set this to `true` if the {@link selectedIcon} should not animate and\n * instead apply `display: none`\n *\n * @defaultValue `false`\n */\n disableIconTransition?: boolean;\n\n /**\n * Set this to `true` to render the chip as a `<span>` instead of a button.\n *\n * @since 2.6.0\n * @since 6.0.0 Renamed from `noninteractable`\n * @defaultValue `false`\n */\n noninteractive?: boolean;\n\n /**\n * An optional background color theme to use.\n *\n * @since 6.0.0\n */\n backgroundColor?: BackgroundColor;\n\n /**\n * An optional icon, avatar, circular progress, or custom component to render\n * before the `children`. This will remove some of the leading horizontal\n * padding on the chip as well.\n */\n leftAddon?: ReactNode;\n\n /**\n * An optional icon, avatar, circular progress, or custom component to render\n * after the `children`. This will remove some of the trailing horizontal\n * padding on the chip as well.\n */\n rightAddon?: ReactNode;\n\n /**\n * Set this to true if the `children` should not be wrapped in a span to apply\n * the {@link chipContent} styles which allow for shrinking text and\n * truncating text with ellipsis.\n *\n * @defaultValue `false`\n */\n disableContentWrap?: boolean;\n\n /**\n * This will be ignored if {@link disableContentWrap} is `true`.\n *\n * @since 6.0.0\n */\n contentProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;\n\n /**\n * This will be ignored if {@link disableContentWrap} is `true`.\n */\n contentStyle?: CSSProperties;\n\n /**\n * This will be ignored if {@link disableContentWrap} is `true`.\n */\n contentClassName?: string;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { Chip } from \"@react-md/core/chip/Chip\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <Chip>Content</Chip>;\n * }\n * ```\n *\n * @example Outlined Example\n * ```tsx\n * import { Chip } from \"@react-md/core/chip/Chip\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <Chip theme=\"outline\">Content</Chip>;\n * }\n * ```\n *\n * @example Addons Example\n * ```tsx\n * import { Avatar } from \"@react-md/core/avatar/Avatar\";\n * import { Chip } from \"@react-md/core/chip/Chip\";\n * import AddCircleIcon from \"@react-md/material-icons/AddCircleIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Chip\n * leftAddon={\n * <Avatar>\n * <img src=\"https://i.pravatar.cc/40?img=3\" alt=\"\" />\n * </Avatar>\n * }\n * rightAddon={<AddCircleIcon />}\n * >\n * Chip\n * </Chip>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/chip | Chip Demos}\n * @since 6.0.0 Renamed the `noninteractable` prop to\n * `noninteractive`.\n */\nexport const Chip = forwardRef<HTMLButtonElement, ChipProps>(\n function Chip(props, ref) {\n const {\n \"aria-pressed\": ariaPressed,\n theme = \"solid\",\n className,\n raisable = false,\n disabled = false,\n selected,\n selectedThemed = false,\n selectedClassName,\n selectedIcon: propSelectedIcon,\n selectedIconAfter = false,\n backgroundColor,\n noninteractive = false,\n disableRipple,\n disableIconTransition = false,\n children: propChildren,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n leftAddon: propLeftAddon,\n rightAddon: propRightAddon,\n contentProps,\n contentStyle,\n contentClassName,\n disableContentWrap = false,\n ...remaining\n } = props;\n\n let buttonProps: ButtonHTMLAttributes<HTMLButtonElement> | undefined;\n if (!noninteractive) {\n buttonProps = {\n \"aria-pressed\": ariaPressed ?? (!!selected || undefined),\n type: \"button\",\n disabled,\n };\n }\n\n let content = propChildren;\n if (!disableContentWrap) {\n content = (\n <span\n style={contentStyle}\n {...contentProps}\n className={cnb(\n chipContent({ className: contentClassName }),\n contentProps?.className\n )}\n >\n {propChildren}\n </span>\n );\n }\n\n let leftAddon = propLeftAddon;\n let rightAddon = propRightAddon;\n const selectedIconNode = getIcon(\"selected\", propSelectedIcon);\n const isTransitionable =\n !selectedThemed &&\n typeof selected === \"boolean\" &&\n typeof (selectedIconAfter ? propRightAddon : propLeftAddon) ===\n \"undefined\";\n const selectedIcon = useMaxWidthTransition({\n element: selectedIconNode,\n transitionIn: !!selected,\n disabled: !isTransitionable,\n disableTransition: disableIconTransition,\n });\n if (isTransitionable) {\n if (selectedIconAfter) {\n rightAddon = selectedIcon;\n } else {\n leftAddon = selectedIcon;\n }\n }\n\n const { pressed, pressedClassName, ripples, handlers } =\n useElementInteraction({\n mode: disableRipple ? \"none\" : undefined,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled: disabled || noninteractive,\n });\n const children = useHigherContrastChildren(content);\n const Component = noninteractive ? \"span\" : \"button\";\n\n return (\n <Component\n {...remaining}\n {...buttonProps}\n {...handlers}\n className={chip({\n className,\n theme,\n pressed: raisable && pressed,\n disabled,\n selected,\n selectedThemed,\n selectedClassName,\n noninteractive,\n backgroundColor,\n pressedClassName,\n leftAddon: !!leftAddon && (selectedIconAfter || selected !== false),\n rightAddon:\n !!rightAddon && (!selectedIconAfter || selected !== false),\n })}\n ref={ref}\n >\n {leftAddon}\n {children}\n {rightAddon}\n {ripples}\n </Component>\n );\n }\n);\n"],"names":["cnb","forwardRef","getIcon","useElementInteraction","useHigherContrastChildren","useMaxWidthTransition","chip","chipContent","Chip","props","ref","ariaPressed","theme","className","raisable","disabled","selected","selectedThemed","selectedClassName","selectedIcon","propSelectedIcon","selectedIconAfter","backgroundColor","noninteractive","disableRipple","disableIconTransition","children","propChildren","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","leftAddon","propLeftAddon","rightAddon","propRightAddon","contentProps","contentStyle","contentClassName","disableContentWrap","remaining","buttonProps","undefined","type","content","span","style","selectedIconNode","isTransitionable","element","transitionIn","disableTransition","pressed","pressedClassName","ripples","handlers","mode","Component"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAKEC,UAAU,QACL,QAAQ;AAGf,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AACxF,SAASC,qBAAqB,QAAQ,yCAAyC;AAE/E,SAASC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AAgJhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CC,GACD,OAAO,MAAMC,qBAAOP,WAClB,SAASO,KAAKC,KAAK,EAAEC,GAAG;IACtB,MAAM,EACJ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YnB;QACd;IACF;IAEA,MAAM,EAAEuC,OAAO,EAAEC,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GACpD1D,sBAAsB;QACpB2D,MAAMtC,gBAAgB,SAASwB;QAC/BpB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAtB,UAAUA,YAAYQ;IACxB;IACF,MAAMG,WAAWtB,0BAA0B8C;IAC3C,MAAMa,YAAYxC,iBAAiB,SAAS;IAE5C,qBACE,MAACwC;QACE,GAAGjB,SAAS;QACZ,GAAGC,WAAW;QACd,GAAGc,QAAQ;QACZhD,WAAWP,KAAK;YACdO;YACAD;YACA8C,SAAS5C,YAAY4C;YACrB3C;YACAC;YACAC;YACAC;YACAK;YACAD;YACAqC;YACArB,WAAW,CAAC,CAACA,aAAcjB,CAAAA,qBAAqBL,aAAa,KAAI;YACjEwB,YACE,CAAC,CAACA,cAAe,CAAA,CAACnB,qBAAqBL,aAAa,KAAI;QAC5D;QACAN,KAAKA;;YAEJ4B;YACAZ;YACAc;YACAoB;;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/chip/Chip.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport {\n type ButtonHTMLAttributes,\n type CSSProperties,\n type HTMLAttributes,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { type BackgroundColor } from \"../cssUtils.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { useMaxWidthTransition } from \"../transition/useMaxWidthTransition.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { chip, chipContent } from \"./styles.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-chip-solid-background-color\"?: string;\n \"--rmd-chip-solid-disabled-background-color\"?: string;\n \"--rmd-chip-solid-color\"?: string;\n \"--rmd-chip-theme-background-color\"?: string;\n \"--rmd-chip-theme-color\"?: string;\n \"--rmd-chip-outline-background-color\"?: string;\n \"--rmd-chip-outline-color\"?: string;\n }\n}\n\n/**\n * @since 6.0.0 Renamed the `noninteractive` prop to\n * `noninteractable`.\n */\nexport interface ChipProps\n extends ButtonHTMLAttributes<HTMLButtonElement>,\n ComponentWithRippleProps {\n /**\n * @defaultValue `\"solid\"`\n */\n theme?: \"outline\" | \"solid\";\n\n /**\n * Set this to `true` if the chip should gain additional box shadow while the\n * user is pressing down on the chip.\n *\n * @defaultValue `false`\n */\n raisable?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * When this is a boolean, a selected icon will be displayed before the\n * `children` and appear/disappear when `true`/`false`.\n *\n * @see {@link selectedIcon}\n * @see {@link selectedIconAfter}\n * @see {@link selectedThemed}\n */\n selected?: boolean;\n\n /**\n * Set this to `true` if the chip should change background color while\n * {@link selected} instead of displaying an icon. The default background\n * color is a lighter swatch of the theme primary color.\n *\n * @defaultValue `false`\n */\n selectedThemed?: boolean;\n\n /**\n * An optional className to provide only while {@link selected} is `true`.\n */\n selectedClassName?: string;\n\n /**\n * This will be ignored if {@link selected} is `undefined`.\n *\n * @defaultValue `getIcon(\"selected\")`\n */\n selectedIcon?: ReactNode;\n\n /**\n * Set this to `true` if the {@link selectedIcon} should display as the\n * {@link rightAddon} instead of the {@link leftAddon}.\n *\n * @defaultValue `false`\n * @since 6.0.0\n */\n selectedIconAfter?: boolean;\n\n /**\n * Set this to `true` if the {@link selectedIcon} should not animate and\n * instead apply `display: none`\n *\n * @defaultValue `false`\n */\n disableIconTransition?: boolean;\n\n /**\n * Set this to `true` to render the chip as a `<span>` instead of a button.\n *\n * @since 2.6.0\n * @since 6.0.0 Renamed from `noninteractable`\n * @defaultValue `false`\n */\n noninteractive?: boolean;\n\n /**\n * An optional background color theme to use.\n *\n * @since 6.0.0\n */\n backgroundColor?: BackgroundColor;\n\n /**\n * An optional icon, avatar, circular progress, or custom component to render\n * before the `children`. This will remove some of the leading horizontal\n * padding on the chip as well.\n */\n leftAddon?: ReactNode;\n\n /**\n * An optional icon, avatar, circular progress, or custom component to render\n * after the `children`. This will remove some of the trailing horizontal\n * padding on the chip as well.\n */\n rightAddon?: ReactNode;\n\n /**\n * Set this to true if the `children` should not be wrapped in a span to apply\n * the {@link chipContent} styles which allow for shrinking text and\n * truncating text with ellipsis.\n *\n * @defaultValue `false`\n */\n disableContentWrap?: boolean;\n\n /**\n * This will be ignored if {@link disableContentWrap} is `true`.\n *\n * @since 6.0.0\n */\n contentProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;\n\n /**\n * This will be ignored if {@link disableContentWrap} is `true`.\n */\n contentStyle?: CSSProperties;\n\n /**\n * This will be ignored if {@link disableContentWrap} is `true`.\n */\n contentClassName?: string;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { Chip } from \"@react-md/core/chip/Chip\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <Chip>Content</Chip>;\n * }\n * ```\n *\n * @example Outlined Example\n * ```tsx\n * import { Chip } from \"@react-md/core/chip/Chip\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return <Chip theme=\"outline\">Content</Chip>;\n * }\n * ```\n *\n * @example Addons Example\n * ```tsx\n * import { Avatar } from \"@react-md/core/avatar/Avatar\";\n * import { Chip } from \"@react-md/core/chip/Chip\";\n * import AddCircleIcon from \"@react-md/material-icons/AddCircleIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Chip\n * leftAddon={\n * <Avatar>\n * <img src=\"https://i.pravatar.cc/40?img=3\" alt=\"\" />\n * </Avatar>\n * }\n * rightAddon={<AddCircleIcon />}\n * >\n * Chip\n * </Chip>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/chip | Chip Demos}\n * @since 6.0.0 Renamed the `noninteractable` prop to\n * `noninteractive`.\n */\nexport const Chip = forwardRef<HTMLButtonElement, ChipProps>(\n function Chip(props, ref) {\n const {\n \"aria-pressed\": ariaPressed,\n theme = \"solid\",\n className,\n raisable = false,\n disabled = false,\n selected,\n selectedThemed = false,\n selectedClassName,\n selectedIcon: propSelectedIcon,\n selectedIconAfter = false,\n backgroundColor,\n noninteractive = false,\n disableRipple,\n disableIconTransition = false,\n children: propChildren,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n leftAddon: propLeftAddon,\n rightAddon: propRightAddon,\n contentProps,\n contentStyle,\n contentClassName,\n disableContentWrap = false,\n ...remaining\n } = props;\n\n let buttonProps: ButtonHTMLAttributes<HTMLButtonElement> | undefined;\n if (!noninteractive) {\n buttonProps = {\n \"aria-pressed\": ariaPressed ?? (!!selected || undefined),\n type: \"button\",\n disabled,\n };\n }\n\n let content = propChildren;\n if (!disableContentWrap) {\n content = (\n <span\n style={contentStyle}\n {...contentProps}\n className={cnb(\n chipContent({ className: contentClassName }),\n contentProps?.className\n )}\n >\n {propChildren}\n </span>\n );\n }\n\n let leftAddon = propLeftAddon;\n let rightAddon = propRightAddon;\n const selectedIconNode = getIcon(\"selected\", propSelectedIcon);\n const isTransitionable =\n !selectedThemed &&\n typeof selected === \"boolean\" &&\n typeof (selectedIconAfter ? propRightAddon : propLeftAddon) ===\n \"undefined\";\n const selectedIcon = useMaxWidthTransition({\n element: selectedIconNode,\n transitionIn: !!selected,\n disabled: !isTransitionable,\n disableTransition: disableIconTransition,\n });\n if (isTransitionable) {\n if (selectedIconAfter) {\n rightAddon = selectedIcon;\n } else {\n leftAddon = selectedIcon;\n }\n }\n\n const { pressed, pressedClassName, ripples, handlers } =\n useElementInteraction({\n mode: disableRipple ? \"none\" : undefined,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled: disabled || noninteractive,\n });\n const children = useHigherContrastChildren(content);\n const Component = noninteractive ? \"span\" : \"button\";\n\n return (\n <Component\n {...remaining}\n {...buttonProps}\n {...handlers}\n className={chip({\n className,\n theme,\n pressed: raisable && pressed,\n disabled,\n selected,\n selectedThemed,\n selectedClassName,\n noninteractive,\n backgroundColor,\n pressedClassName,\n leftAddon: !!leftAddon && (selectedIconAfter || selected !== false),\n rightAddon:\n !!rightAddon && (!selectedIconAfter || selected !== false),\n })}\n ref={ref}\n >\n {leftAddon}\n {children}\n {rightAddon}\n {ripples}\n </Component>\n );\n }\n);\n"],"names":["cnb","forwardRef","getIcon","useElementInteraction","useHigherContrastChildren","useMaxWidthTransition","chip","chipContent","Chip","props","ref","ariaPressed","theme","className","raisable","disabled","selected","selectedThemed","selectedClassName","selectedIcon","propSelectedIcon","selectedIconAfter","backgroundColor","noninteractive","disableRipple","disableIconTransition","children","propChildren","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","leftAddon","propLeftAddon","rightAddon","propRightAddon","contentProps","contentStyle","contentClassName","disableContentWrap","remaining","buttonProps","undefined","type","content","span","style","selectedIconNode","isTransitionable","element","transitionIn","disableTransition","pressed","pressedClassName","ripples","handlers","mode","Component"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAKEC,UAAU,QACL,QAAQ;AAGf,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AACxF,SAASC,qBAAqB,QAAQ,yCAAyC;AAE/E,SAASC,IAAI,EAAEC,WAAW,QAAQ,cAAc;AAgJhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CC,GACD,OAAO,MAAMC,qBAAOP,WAClB,SAASO,KAAKC,KAAK,EAAEC,GAA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,OAAO;YACLmB,YAAYnB;QACd;IACF;IAEA,MAAM,EAAEuC,OAAO,EAAEC,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GACpD1D,sBAAsB;QACpB2D,MAAMtC,gBAAgB,SAASwB;QAC/BpB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAtB,UAAUA,YAAYQ;IACxB;IACF,MAAMG,WAAWtB,0BAA0B8C;IAC3C,MAAMa,YAAYxC,iBAAiB,SAAS;IAE5C,qBACE,MAACwC;QACE,GAAGjB,SAAS;QACZ,GAAGC,WAAW;QACd,GAAGc,QAAQ;QACZhD,WAAWP,KAAK;YACdO;YACAD;YACA8C,SAAS5C,YAAY4C;YACrB3C;YACAC;YACAC;YACAC;YACAK;YACAD;YACAqC;YACArB,WAAW,CAAC,CAACA,aAAcjB,CAAAA,qBAAqBL,aAAa,KAAI;YACjEwB,YACE,CAAC,CAACA,cAAe,CAAA,CAACnB,qBAAqBL,aAAa,KAAI;QAC5D;QACAN,KAAKA;;YAEJ4B;YACAZ;YACAc;YACAoB;;;AAGP,GACA"}
@@ -100,7 +100,7 @@ export interface BaseDialogProps extends HTMLAttributes<HTMLDivElement>, CSSTran
100
100
  * Any additional props that should be passed to the container element when
101
101
  * the `type !== "custom"`.
102
102
  */
103
- containerProps?: PropsWithRef<ConfigurableDialogContainerProps, HTMLDivElement>;
103
+ containerProps?: PropsWithRef<ConfigurableDialogContainerProps>;
104
104
  /**
105
105
  * @see {@link DEFAULT_DIALOG_TIMEOUT}
106
106
  * @defaultValue `DEFAULT_DIALOG_TIMEOUT`
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/dialog/Dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef, useState } from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\nimport {\n type FocusContainerComponentProps,\n useFocusContainer,\n} from \"../focus/useFocusContainer.js\";\nimport { Overlay } from \"../overlay/Overlay.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport {\n type CSSTransitionClassNames,\n type CSSTransitionComponentProps,\n type TransitionActions,\n type TransitionTimeout,\n} from \"../transition/types.js\";\nimport { useCSSTransition } from \"../transition/useCSSTransition.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport {\n type ConfigurableDialogContainerProps,\n DialogContainer,\n} from \"./DialogContainer.js\";\nimport {\n NestedDialogProvider,\n useNestedDialogContext,\n} from \"./NestedDialogProvider.js\";\nimport {\n DEFAULT_DIALOG_CLASSNAMES,\n DEFAULT_DIALOG_TIMEOUT,\n type DialogType,\n type DialogWidth,\n dialog,\n} from \"./styles.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst noopBool = (): boolean => false;\n\nexport interface BaseDialogProps\n extends HTMLAttributes<HTMLDivElement>,\n CSSTransitionComponentProps,\n TransitionActions,\n FocusContainerComponentProps {\n /**\n * @defaultValue `\"dialog-\" + useId()`\n */\n id?: string;\n\n /**\n * @defaultValue `\"centered\"`\n */\n type?: DialogType;\n\n /**\n * @see {@link DialogWidth}\n * @defaultValue `\"auto\"`\n */\n width?: DialogWidth;\n\n /**\n * @defaultValue `\"dialog\"`\n */\n role?: \"dialog\" | \"alertdialog\" | \"menu\" | \"none\";\n\n /**\n * This value controls the visibility of the dialog.\n */\n visible: boolean;\n\n /**\n * This function should set the {@link visible} prop to false to hide the\n * modal when:\n * - the {@link modal} and {@link disableEscapeClose} props are `false` and\n * the user presses the `\"Escape\"` key.\n * - The overlay element is clicked\n */\n onRequestClose: () => void;\n\n /** @defaultValue `false` */\n disableTransition?: boolean;\n\n /** @defaultValue `-1` */\n tabIndex?: number;\n\n /**\n * Set this value to `true` if the dialog should behave as a modal which\n * prevents the modal from being closed by pressing the `\"Escape\"` key or\n * clicking the overlay. The user **must** click one of the actions within the\n * dialog instead.\n *\n * @defaultValue `false`\n */\n modal?: boolean;\n\n /**\n * Set this to `true` if the dialog should no longer use the `Portal`\n * behavior.\n *\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * Set this to `true` if you want the page to still be scrollable while the\n * dialog is visible. This should normally be `true` for popovers/fixed\n * dialogs.\n *\n * @defaultValue `type === \"custom\"`\n */\n disableScrollLock?: boolean;\n\n /**\n * Set this to `true` to prevent the dialog from being closed when the\n * `\"Escape\"` key is pressed. This is `true` by default when the {@link modal}\n * prop is `true`\n *\n * @defaultValue `modal`\n */\n disableEscapeClose?: boolean;\n\n /**\n * Set this to `true` if an overlay should not appear behind the dialog.\n *\n * Note: this was changed from `type === \"full-page\"` to `false` so that you\n * can change between full-page and centered based on media queries. If the\n * type changes the overlay would end up rendering above the dialog instead of\n * behind.\n *\n * @see {@link overlayHidden}\n * @defaultValue `false`\n */\n disableOverlay?: boolean;\n\n /**\n * Set this to `true` if an overlay should be appear behind the dialog but\n * have an `opacity: 0`. This is useful if you want to prevent other elements\n * on the page from being clicked while the dialog is visible, but don't want\n * a dark background. i.e. popovers/fixed dialogs.\n *\n * @defaultValue `false`\n */\n overlayHidden?: boolean;\n\n /**\n * Any additional props that should be passed to the overlay element if it is\n * rendered.\n */\n overlayProps?: HTMLAttributes<HTMLSpanElement>;\n\n /**\n * Any additional props that should be passed to the container element when\n * the `type !== \"custom\"`.\n */\n containerProps?: PropsWithRef<\n ConfigurableDialogContainerProps,\n HTMLDivElement\n >;\n\n /**\n * @see {@link DEFAULT_DIALOG_TIMEOUT}\n * @defaultValue `DEFAULT_DIALOG_TIMEOUT`\n */\n timeout?: TransitionTimeout;\n\n /**\n * @see {@link DEFAULT_DIALOG_CLASSNAMES}\n * @defaultValue `DEFAULT_DIALOG_CLASSNAMES`\n */\n classNames?: CSSTransitionClassNames;\n\n /**\n * Set this to `true` if the `Dialog` should not gain the normal focus box\n * shadow while it is focused. The `Dialog` should normally only gain focus\n * when it becomes visible and no child elements have `autoFocus` enabled.\n *\n * @since 6.0.0\n * @defaultValue `type === \"full-page\"`\n */\n disableFocusOutline?: boolean;\n}\n\nexport type DialogProps = LabelRequiredForA11y<BaseDialogProps>;\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import { Dialog } from \"@react-md/core/dialog/Dialog\";\n * import { DialogContent } from \"@react-md/core/dialog/DialogContent\";\n * import { DialogFooter } from \"@react-md/core/dialog/DialogFooter\";\n * import { DialogHeader } from \"@react-md/core/dialog/DialogHeader\";\n * import { DialogTitle } from \"@react-md/core/dialog/DialogTitle\";\n * import { Typography } from \"@react-md/core/typography/Typography\";\n * import { useToggle } from \"@react-md/core/useToggle\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const {\n * toggle,\n * disable: onRequestClose,\n * toggled: visible,\n * } = useToggle(false);\n *\n * return (\n * <>\n * <Button onClick={toggle}>Toggle</Button>\n * <Dialog\n * aria-labelledby=\"dialog-title\"\n * visible={visible}\n * onRequestClose={onRequestClose}\n * >\n * <DialogHeader>\n * <DialogTitle id=\"dialog-title\">Simple Dialog</DialogTitle>\n * </DialogHeader>\n * <DialogContent>\n * <Typography margin=\"none\">This is some text in a dialog.</Typography>\n * </DialogContent>\n * <DialogFooter>\n * <Button onClick={onRequestClose}>\n * Close\n * </Button>\n * </DialogFooter>\n * </Dialog>\n * </>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/dialog | Dialog Demos}\n * @since 6.0.0 The `Dialog` no longer supports focusing elements\n * within once it becomes visible. You must manually add `autoFocus` to a\n * element instead.\n */\nexport const Dialog = forwardRef<HTMLDivElement, DialogProps>(\n function Dialog(props, ref) {\n const {\n id: propId,\n modal = false,\n role = modal ? \"alertdialog\" : \"dialog\",\n type = \"centered\",\n width,\n tabIndex = -1,\n visible,\n onRequestClose,\n containerProps,\n temporary = true,\n className,\n timeout = DEFAULT_DIALOG_TIMEOUT,\n classNames = DEFAULT_DIALOG_CLASSNAMES,\n disableTransition = false,\n appear = false,\n enter = true,\n exit = true,\n onEnter = noop,\n onEntering = noop,\n onEntered = noop,\n onExit = noop,\n onExiting = noop,\n onExited = noop,\n exitedHidden = true,\n disableOverlay = false,\n overlayProps,\n overlayHidden,\n onKeyDown = noop,\n isFocusTypeDisabled = noopBool,\n disablePortal: propDisablePortal,\n disableScrollLock = false,\n disableEscapeClose = modal,\n disableFocusOutline = type === \"full-page\",\n children,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"dialog\");\n\n const ssr = useSsr();\n const setChildVisible = useNestedDialogContext();\n\n // this makes it so that as more non-full page dialogs become visible, the\n // overlay does not become darker as more and more overlays are stacked upon\n // each other. only the top-most overlay will have and active background\n // color.\n const [isChildVisible, setIsChildVisible] = useState(false);\n const { eventHandlers, transitionOptions } = useFocusContainer({\n nodeRef: ref,\n activate: visible,\n onEntered(appear) {\n onEntered(appear);\n // this needs to be called onEnter and onEntered just in case the\n // transition is disabled\n setChildVisible(type !== \"full-page\");\n },\n onEntering,\n onExiting,\n onExited() {\n onExited();\n // this needs to be called onExit and onExited just in case the\n // transition is disabled\n setChildVisible(false);\n },\n disableTransition,\n onKeyDown(event) {\n onKeyDown(event);\n if (\n event.isPropagationStopped() ||\n modal ||\n disableEscapeClose ||\n event.key !== \"Escape\"\n ) {\n return;\n }\n\n // prevent parent dialogs from closing as well\n event.stopPropagation();\n onRequestClose();\n },\n isFocusTypeDisabled,\n });\n const { elementProps, stage, rendered, disablePortal } = useCSSTransition({\n transitionIn: visible,\n timeout,\n classNames,\n className: dialog({\n type,\n width,\n fixed: type === \"custom\",\n outline: !disableFocusOutline,\n disableBoxShadow: isChildVisible,\n className,\n }),\n appear: appear && !disableTransition && !ssr,\n enter: enter && !disableTransition,\n exit: exit && !disableTransition,\n onEnter(appearing) {\n onEnter(appearing);\n setChildVisible(type !== \"full-page\");\n },\n onExit() {\n onExit();\n setChildVisible(false);\n },\n temporary,\n exitedHidden,\n disablePortal: propDisablePortal,\n ...transitionOptions,\n });\n useScrollLock(!disableScrollLock && visible);\n\n return (\n <NestedDialogProvider value={setIsChildVisible}>\n {!disableOverlay && (\n <Overlay\n visible={visible}\n disableTransition={disableTransition}\n temporary={temporary}\n disablePortal={disablePortal}\n {...overlayProps}\n onClick={modal ? noop : onRequestClose}\n clickable={!modal}\n noOpacity={overlayHidden || isChildVisible}\n />\n )}\n <Portal disabled={disablePortal}>\n {rendered && (\n <DialogContainer\n enabled={type !== \"custom\"}\n {...containerProps}\n centered={type === \"centered\"}\n displayNone={!temporary && exitedHidden && stage === \"exited\"}\n >\n <div\n aria-modal={modal || undefined}\n {...remaining}\n {...elementProps}\n {...eventHandlers}\n id={id}\n role={role}\n tabIndex={tabIndex}\n >\n {children}\n </div>\n </DialogContainer>\n )}\n </Portal>\n </NestedDialogProvider>\n );\n }\n);\n"],"names":["forwardRef","useState","useSsr","useFocusContainer","Overlay","Portal","useScrollLock","useCSSTransition","useEnsuredId","DialogContainer","NestedDialogProvider","useNestedDialogContext","DEFAULT_DIALOG_CLASSNAMES","DEFAULT_DIALOG_TIMEOUT","dialog","noop","noopBool","Dialog","props","ref","id","propId","modal","role","type","width","tabIndex","visible","onRequestClose","containerProps","temporary","className","timeout","classNames","disableTransition","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","exitedHidden","disableOverlay","overlayProps","overlayHidden","onKeyDown","isFocusTypeDisabled","disablePortal","propDisablePortal","disableScrollLock","disableEscapeClose","disableFocusOutline","children","remaining","ssr","setChildVisible","isChildVisible","setIsChildVisible","eventHandlers","transitionOptions","nodeRef","activate","event","isPropagationStopped","key","stopPropagation","elementProps","stage","rendered","transitionIn","fixed","outline","disableBoxShadow","appearing","value","onClick","clickable","noOpacity","disabled","enabled","centered","displayNone","div","aria-modal","undefined"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAElE,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAEEC,iBAAiB,QACZ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AACf,gCACA,KAACzC;gBACCuB,SAASA;gBACTO,mBAAmBA;gBACnBJ,WAAWA;gBACXoB,eAAeA;gBACd,GAAGJ,YAAY;gBAChBgC,SAASxD,QAAQP,OAAOa;gBACxBmD,WAAW,CAACzD;gBACZ0D,WAAWjC,iBAAiBY;;0BAGhC,KAACtD;gBAAO4E,UAAU/B;0BACfqB,0BACC,KAAC9D;oBACCyE,SAAS1D,SAAS;oBACjB,GAAGK,cAAc;oBAClBsD,UAAU3D,SAAS;oBACnB4D,aAAa,CAACtD,aAAac,gBAAgB0B,UAAU;8BAErD,cAAA,KAACe;wBACCC,cAAYhE,SAASiE;wBACpB,GAAG/B,SAAS;wBACZ,GAAGa,YAAY;wBACf,GAAGR,aAAa;wBACjBzC,IAAIA;wBACJG,MAAMA;wBACNG,UAAUA;kCAET6B;;;;;;AAOf,GACA"}
1
+ {"version":3,"sources":["../../src/dialog/Dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, forwardRef, useState } from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\nimport {\n type FocusContainerComponentProps,\n useFocusContainer,\n} from \"../focus/useFocusContainer.js\";\nimport { Overlay } from \"../overlay/Overlay.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport {\n type CSSTransitionClassNames,\n type CSSTransitionComponentProps,\n type TransitionActions,\n type TransitionTimeout,\n} from \"../transition/types.js\";\nimport { useCSSTransition } from \"../transition/useCSSTransition.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport {\n type ConfigurableDialogContainerProps,\n DialogContainer,\n} from \"./DialogContainer.js\";\nimport {\n NestedDialogProvider,\n useNestedDialogContext,\n} from \"./NestedDialogProvider.js\";\nimport {\n DEFAULT_DIALOG_CLASSNAMES,\n DEFAULT_DIALOG_TIMEOUT,\n type DialogType,\n type DialogWidth,\n dialog,\n} from \"./styles.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst noopBool = (): boolean => false;\n\nexport interface BaseDialogProps\n extends HTMLAttributes<HTMLDivElement>,\n CSSTransitionComponentProps,\n TransitionActions,\n FocusContainerComponentProps {\n /**\n * @defaultValue `\"dialog-\" + useId()`\n */\n id?: string;\n\n /**\n * @defaultValue `\"centered\"`\n */\n type?: DialogType;\n\n /**\n * @see {@link DialogWidth}\n * @defaultValue `\"auto\"`\n */\n width?: DialogWidth;\n\n /**\n * @defaultValue `\"dialog\"`\n */\n role?: \"dialog\" | \"alertdialog\" | \"menu\" | \"none\";\n\n /**\n * This value controls the visibility of the dialog.\n */\n visible: boolean;\n\n /**\n * This function should set the {@link visible} prop to false to hide the\n * modal when:\n * - the {@link modal} and {@link disableEscapeClose} props are `false` and\n * the user presses the `\"Escape\"` key.\n * - The overlay element is clicked\n */\n onRequestClose: () => void;\n\n /** @defaultValue `false` */\n disableTransition?: boolean;\n\n /** @defaultValue `-1` */\n tabIndex?: number;\n\n /**\n * Set this value to `true` if the dialog should behave as a modal which\n * prevents the modal from being closed by pressing the `\"Escape\"` key or\n * clicking the overlay. The user **must** click one of the actions within the\n * dialog instead.\n *\n * @defaultValue `false`\n */\n modal?: boolean;\n\n /**\n * Set this to `true` if the dialog should no longer use the `Portal`\n * behavior.\n *\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * Set this to `true` if you want the page to still be scrollable while the\n * dialog is visible. This should normally be `true` for popovers/fixed\n * dialogs.\n *\n * @defaultValue `type === \"custom\"`\n */\n disableScrollLock?: boolean;\n\n /**\n * Set this to `true` to prevent the dialog from being closed when the\n * `\"Escape\"` key is pressed. This is `true` by default when the {@link modal}\n * prop is `true`\n *\n * @defaultValue `modal`\n */\n disableEscapeClose?: boolean;\n\n /**\n * Set this to `true` if an overlay should not appear behind the dialog.\n *\n * Note: this was changed from `type === \"full-page\"` to `false` so that you\n * can change between full-page and centered based on media queries. If the\n * type changes the overlay would end up rendering above the dialog instead of\n * behind.\n *\n * @see {@link overlayHidden}\n * @defaultValue `false`\n */\n disableOverlay?: boolean;\n\n /**\n * Set this to `true` if an overlay should be appear behind the dialog but\n * have an `opacity: 0`. This is useful if you want to prevent other elements\n * on the page from being clicked while the dialog is visible, but don't want\n * a dark background. i.e. popovers/fixed dialogs.\n *\n * @defaultValue `false`\n */\n overlayHidden?: boolean;\n\n /**\n * Any additional props that should be passed to the overlay element if it is\n * rendered.\n */\n overlayProps?: HTMLAttributes<HTMLSpanElement>;\n\n /**\n * Any additional props that should be passed to the container element when\n * the `type !== \"custom\"`.\n */\n containerProps?: PropsWithRef<ConfigurableDialogContainerProps>;\n\n /**\n * @see {@link DEFAULT_DIALOG_TIMEOUT}\n * @defaultValue `DEFAULT_DIALOG_TIMEOUT`\n */\n timeout?: TransitionTimeout;\n\n /**\n * @see {@link DEFAULT_DIALOG_CLASSNAMES}\n * @defaultValue `DEFAULT_DIALOG_CLASSNAMES`\n */\n classNames?: CSSTransitionClassNames;\n\n /**\n * Set this to `true` if the `Dialog` should not gain the normal focus box\n * shadow while it is focused. The `Dialog` should normally only gain focus\n * when it becomes visible and no child elements have `autoFocus` enabled.\n *\n * @since 6.0.0\n * @defaultValue `type === \"full-page\"`\n */\n disableFocusOutline?: boolean;\n}\n\nexport type DialogProps = LabelRequiredForA11y<BaseDialogProps>;\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import { Dialog } from \"@react-md/core/dialog/Dialog\";\n * import { DialogContent } from \"@react-md/core/dialog/DialogContent\";\n * import { DialogFooter } from \"@react-md/core/dialog/DialogFooter\";\n * import { DialogHeader } from \"@react-md/core/dialog/DialogHeader\";\n * import { DialogTitle } from \"@react-md/core/dialog/DialogTitle\";\n * import { Typography } from \"@react-md/core/typography/Typography\";\n * import { useToggle } from \"@react-md/core/useToggle\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const {\n * toggle,\n * disable: onRequestClose,\n * toggled: visible,\n * } = useToggle(false);\n *\n * return (\n * <>\n * <Button onClick={toggle}>Toggle</Button>\n * <Dialog\n * aria-labelledby=\"dialog-title\"\n * visible={visible}\n * onRequestClose={onRequestClose}\n * >\n * <DialogHeader>\n * <DialogTitle id=\"dialog-title\">Simple Dialog</DialogTitle>\n * </DialogHeader>\n * <DialogContent>\n * <Typography margin=\"none\">This is some text in a dialog.</Typography>\n * </DialogContent>\n * <DialogFooter>\n * <Button onClick={onRequestClose}>\n * Close\n * </Button>\n * </DialogFooter>\n * </Dialog>\n * </>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/dialog | Dialog Demos}\n * @since 6.0.0 The `Dialog` no longer supports focusing elements\n * within once it becomes visible. You must manually add `autoFocus` to a\n * element instead.\n */\nexport const Dialog = forwardRef<HTMLDivElement, DialogProps>(\n function Dialog(props, ref) {\n const {\n id: propId,\n modal = false,\n role = modal ? \"alertdialog\" : \"dialog\",\n type = \"centered\",\n width,\n tabIndex = -1,\n visible,\n onRequestClose,\n containerProps,\n temporary = true,\n className,\n timeout = DEFAULT_DIALOG_TIMEOUT,\n classNames = DEFAULT_DIALOG_CLASSNAMES,\n disableTransition = false,\n appear = false,\n enter = true,\n exit = true,\n onEnter = noop,\n onEntering = noop,\n onEntered = noop,\n onExit = noop,\n onExiting = noop,\n onExited = noop,\n exitedHidden = true,\n disableOverlay = false,\n overlayProps,\n overlayHidden,\n onKeyDown = noop,\n isFocusTypeDisabled = noopBool,\n disablePortal: propDisablePortal,\n disableScrollLock = false,\n disableEscapeClose = modal,\n disableFocusOutline = type === \"full-page\",\n children,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"dialog\");\n\n const ssr = useSsr();\n const setChildVisible = useNestedDialogContext();\n\n // this makes it so that as more non-full page dialogs become visible, the\n // overlay does not become darker as more and more overlays are stacked upon\n // each other. only the top-most overlay will have and active background\n // color.\n const [isChildVisible, setIsChildVisible] = useState(false);\n const { eventHandlers, transitionOptions } = useFocusContainer({\n nodeRef: ref,\n activate: visible,\n onEntered(appear) {\n onEntered(appear);\n // this needs to be called onEnter and onEntered just in case the\n // transition is disabled\n setChildVisible(type !== \"full-page\");\n },\n onEntering,\n onExiting,\n onExited() {\n onExited();\n // this needs to be called onExit and onExited just in case the\n // transition is disabled\n setChildVisible(false);\n },\n disableTransition,\n onKeyDown(event) {\n onKeyDown(event);\n if (\n event.isPropagationStopped() ||\n modal ||\n disableEscapeClose ||\n event.key !== \"Escape\"\n ) {\n return;\n }\n\n // prevent parent dialogs from closing as well\n event.stopPropagation();\n onRequestClose();\n },\n isFocusTypeDisabled,\n });\n const { elementProps, stage, rendered, disablePortal } = useCSSTransition({\n transitionIn: visible,\n timeout,\n classNames,\n className: dialog({\n type,\n width,\n fixed: type === \"custom\",\n outline: !disableFocusOutline,\n disableBoxShadow: isChildVisible,\n className,\n }),\n appear: appear && !disableTransition && !ssr,\n enter: enter && !disableTransition,\n exit: exit && !disableTransition,\n onEnter(appearing) {\n onEnter(appearing);\n setChildVisible(type !== \"full-page\");\n },\n onExit() {\n onExit();\n setChildVisible(false);\n },\n temporary,\n exitedHidden,\n disablePortal: propDisablePortal,\n ...transitionOptions,\n });\n useScrollLock(!disableScrollLock && visible);\n\n return (\n <NestedDialogProvider value={setIsChildVisible}>\n {!disableOverlay && (\n <Overlay\n visible={visible}\n disableTransition={disableTransition}\n temporary={temporary}\n disablePortal={disablePortal}\n {...overlayProps}\n onClick={modal ? noop : onRequestClose}\n clickable={!modal}\n noOpacity={overlayHidden || isChildVisible}\n />\n )}\n <Portal disabled={disablePortal}>\n {rendered && (\n <DialogContainer\n enabled={type !== \"custom\"}\n {...containerProps}\n centered={type === \"centered\"}\n displayNone={!temporary && exitedHidden && stage === \"exited\"}\n >\n <div\n aria-modal={modal || undefined}\n {...remaining}\n {...elementProps}\n {...eventHandlers}\n id={id}\n role={role}\n tabIndex={tabIndex}\n >\n {children}\n </div>\n </DialogContainer>\n )}\n </Portal>\n </NestedDialogProvider>\n );\n }\n);\n"],"names":["forwardRef","useState","useSsr","useFocusContainer","Overlay","Portal","useScrollLock","useCSSTransition","useEnsuredId","DialogContainer","NestedDialogProvider","useNestedDialogContext","DEFAULT_DIALOG_CLASSNAMES","DEFAULT_DIALOG_TIMEOUT","dialog","noop","noopBool","Dialog","props","ref","id","propId","modal","role","type","width","tabIndex","visible","onRequestClose","containerProps","temporary","className","timeout","classNames","disableTransition","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","exitedHidden","disableOverlay","overlayProps","overlayHidden","onKeyDown","isFocusTypeDisabled","disablePortal","propDisablePortal","disableScrollLock","disableEscapeClose","disableFocusOutline","children","remaining","ssr","setChildVisible","isChildVisible","setIsChildVisible","eventHandlers","transitionOptions","nodeRef","activate","event","isPropagationStopped","key","stopPropagation","elementProps","stage","rendered","transitionIn","fixed","outline","disableBoxShadow","appearing","value","onClick","clickable","noOpacity","disabled","enabled","centered","displayNone","div","aria-modal","undefined"],"mappings":"AAAA;;AAEA,SAA8BA,UAAU,EAAEC,QAAQ,QAAQ,QAAQ;AAElE,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAEEC,iBAAiB,QACZ,gCAAgC;AACvC,SAASC,OAAO,QAAQ,wBAAwB;AAChD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,aAAa,QAAQ,6BAA6B;AAO3D,SAASC,gBAAgB,QAAQ,oCAAoC;AAErE,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAEEC,eAAe,QACV,uBAAuB;AAC9B,SACEC,oBAAoB,EACpBC,sBAAsB,QACjB,4BAA4B;AACnC,SACEC,yBAAyB,EACzBC,sBAAsB,EAGtBC,MAAM,QACD,cAAc;AAErB,MAAMC,OAAO;AACX,aAAa;AACf;AAEA,MAAMC,WAAW,IAAe;AAgJhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDC,GACD,OAAO,MAAMC,uBAASjB,WACpB,SA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UA;kCAET6B;;;;;;AAOf,GACA"}
@@ -106,7 +106,7 @@ export interface ExpansionPanelProps extends CardProps {
106
106
  * @see {@link contentClassName}
107
107
  * @see {@link disableContentPadding}
108
108
  */
109
- contentProps?: PropsWithRef<Omit<CardContentProps, "role">, HTMLDivElement>;
109
+ contentProps?: PropsWithRef<Omit<CardContentProps, "role">>;
110
110
  /**
111
111
  * Convenience prop to apply custom style to the `CardContent` component.
112
112
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/expansion-panel/ExpansionPanel.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, type ReactNode, forwardRef } from \"react\";\n\nimport { Card, type CardProps } from \"../card/Card.js\";\nimport { CardContent, type CardContentProps } from \"../card/CardContent.js\";\nimport { useCollapseTransition } from \"../transition/useCollapseTransition.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport {\n ExpansionPanelHeader,\n type ExpansionPanelHeaderProps,\n} from \"./ExpansionPanelHeader.js\";\nimport { expansionPanel } from \"./styles.js\";\n\n/**\n * @since 6.0.0 The `disableSecondaryColor` convenience prop was removed in\n * favor of the new `contentProps` object.\n * @since 6.0.0 The `disableParagraphMargin` prop was removed since it no longer\n * exists on the `CardContent` component.\n * @since 6.0.0 Removed the `marginTop` prop since it is no longer needed.\n */\nexport interface ExpansionPanelProps extends CardProps {\n /**\n * Set this to `true` if the {@link children} should be visible. This should\n * generally be provided by the `useExpansionPanels` hook.\n */\n expanded: boolean;\n\n /**\n * A function that should toggle the {@link expanded} state. This should\n * generally be provided by the `useExpansionPanels` hook.\n */\n onExpandClick: () => void;\n\n /**\n * Set this to `true` to prevent the panel from toggling the {@link expanded}\n * state. This should generally be provided by the `useExpansionPanels` hook.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * @defaultValue `true`\n * @see {@link CardProps.fullWidth}\n */\n fullWidth?: boolean;\n\n /**\n * This can be used to implement a custom header implementation, but it\n * probably shouldn't be needed.\n *\n * @since 6.0.0 This was renamed from `customHeader`\n * @see {@link headerProps}\n */\n header?: ReactNode;\n\n /**\n * This can be used to apply additional props to the header element.\n *\n * Note: You can override the `style` and `className` using\n * {@link headerStyle} and {@link headerClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <ExpansionPanel\n * {...props}\n * headerProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * icon: <MyCustomIcon />,\n * iconRotatorProps: {\n * className: \"another-custom-class-name\",\n * },\n * }}\n * />\n * ```\n */\n headerProps?: Omit<\n ExpansionPanelHeaderProps,\n \"id\" | \"aria-disabled\" | \"onClick\" | \"expanded\"\n >;\n\n /**\n * Convenience prop to apply custom style to the `ExpansionPanelHeader`\n * component.\n */\n headerStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `ExpansionPanelHeader`\n * component.\n */\n headerClassName?: string;\n\n /**\n * Content to display within the header of the expansion panel that toggles\n * the expanded state. This should generally contain some accessible text\n * describing the expansion panel's content.\n *\n * @since 6.0.0 This was renamed from `header`\n */\n headerChildren?: ReactNode;\n\n /**\n * This can be used to apply additional props to the `CardContent` component\n * if needed.\n *\n * Note: `disableSecondaryColor` and `disableLastChildPadding` default to\n * `true` in this implementation.\n *\n * @example\n * ```tsx\n * contentProps={{\n * style: {},\n * className: \"some-class-name\",\n * disablePadding: true,\n * disableSecondaryColor: false,\n * disableLastChildPadding: false,\n * // whatever else\n * }}\n * ```\n *\n * @see {@link contentStyle}\n * @see {@link contentClassName}\n * @see {@link disableContentPadding}\n */\n contentProps?: PropsWithRef<Omit<CardContentProps, \"role\">, HTMLDivElement>;\n\n /**\n * Convenience prop to apply custom style to the `CardContent` component.\n */\n contentStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `CardContent` component.\n */\n contentClassName?: string;\n\n /**\n * Set to `true` to disable the collapse transition for the card content\n * whenever the {@link expanded} state changes.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @defaultValue `false`\n * @see {@link CardContentProps.disablePadding}\n */\n disableContentPadding?: boolean;\n\n /**\n * Set this to `true` to unmount the {@link children} when the\n * {@link expanded} state is `false`.\n *\n * @defaultValue `false`\n * @since 6.0.0 Renamed from `persistent` to match the\n * `useCollapseTransition` naming convention.\n */\n temporary?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * An expansion panel enables content to be either collapsed (hidden) or\n * expanded (visible) following the disclosure pattern.\n *\n * @example Simple Example\n * ```tsx\n * \"use client\";\n *\n * import { ExpansionList } from \"@react-md/core/expansion-panel/ExpansionList\";\n * import { ExpansionPanel } from \"@react-md/core/expansion-panel/ExpansionPanel\";\n * import { useExpansionPanels } from \"@react-md/core/expansion-panel/useExpansionPanels\";\n * import { type ReactElement } from \"react\";\n *\n * export default function ExpansionPanelGroupExample(): ReactElement {\n * const { getPanelProps } = useExpansionPanels();\n *\n * return (\n * <ExpansionList style={{ width: \"100%\" }}>\n * <ExpansionPanel {...getPanelProps(0)} headerChildren=\"Panel 1\">\n * Panel 1 Contents\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(1)} headerChildren=\"Panel 2\">\n * Panel 2 Contents\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(2)} headerChildren=\"Panel 3\">\n * Panel 3 Contents\n * </ExpansionPanel>\n * </ExpansionList>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/expansion-panel | ExpansionPanel Demos}\n * @see `useExpansionPanels` for examples.\n * @since 6.0.0 The content will be persistent and invisible using `display: none`\n * instead of unmounting and also animate the `margin-top` style.\n */\nexport const ExpansionPanel = forwardRef<\n HTMLHeadingElement,\n ExpansionPanelProps\n>(function ExpansionPanel(props, ref) {\n const {\n id: propId,\n className,\n contentProps,\n contentStyle,\n contentClassName,\n header: propHeader,\n headerProps,\n headerStyle,\n headerClassName,\n headerChildren,\n children,\n expanded,\n onExpandClick,\n disabled = false,\n fullWidth = true,\n temporary = false,\n disableTransition = false,\n disableContentPadding = false,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"expansion-panel\");\n const { elementProps, rendered } = useCollapseTransition({\n nodeRef: contentProps?.ref,\n style: contentStyle,\n className: contentClassName,\n timeout: disableTransition ? 0 : undefined,\n temporary,\n transitionIn: expanded,\n });\n\n let header = propHeader;\n if (typeof header === \"undefined\") {\n header = (\n <ExpansionPanelHeader\n style={headerStyle}\n className={headerClassName}\n disableTransition={disableTransition}\n {...headerProps}\n aria-disabled={disabled || undefined}\n id={id}\n onClick={onExpandClick}\n expanded={expanded}\n >\n {headerChildren}\n </ExpansionPanelHeader>\n );\n }\n\n return (\n <Card\n {...remaining}\n id={`${id}-container`}\n ref={ref}\n fullWidth={fullWidth}\n className={expansionPanel({\n expanded,\n disableTransition,\n className,\n })}\n >\n {header}\n {rendered && (\n <CardContent\n id={`${id}-content`}\n aria-labelledby={id}\n disablePadding={disableContentPadding}\n disableSecondaryColor\n disableLastChildPadding\n {...contentProps}\n {...elementProps}\n role=\"region\"\n >\n {children}\n </CardContent>\n )}\n </Card>\n );\n});\n"],"names":["forwardRef","Card","CardContent","useCollapseTransition","useEnsuredId","ExpansionPanelHeader","expansionPanel","ExpansionPanel","props","ref","id","propId","className","contentProps","contentStyle","contentClassName","header","propHeader","headerProps","headerStyle","headerClassName","headerChildren","children","expanded","onExpandClick","disabled","fullWidth","temporary","disableTransition","disableContentPadding","remaining","elementProps","rendered","nodeRef","style","timeout","undefined","transitionIn","aria-disabled","onClick","aria-labelledby","disablePadding","disableSecondaryColor","disableLastChildPadding","role"],"mappings":"AAAA;;AAEA,SAA6CA,UAAU,QAAQ,QAAQ;AAEvE,SAASC,IAAI,QAAwB,kBAAkB;AACvD,SAASC,WAAW,QAA+B,yBAAyB;AAC5E,SAASC,qBAAqB,QAAQ,yCAAyC;AAE/E,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SACEC,oBAAoB,QAEf,4BAA4B;AACnC,SAASC,cAAc,QAAQ,cAAc;AA0J7C;;;;;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G"}
1
+ {"version":3,"sources":["../../src/expansion-panel/ExpansionPanel.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, type ReactNode, forwardRef } from \"react\";\n\nimport { Card, type CardProps } from \"../card/Card.js\";\nimport { CardContent, type CardContentProps } from \"../card/CardContent.js\";\nimport { useCollapseTransition } from \"../transition/useCollapseTransition.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport {\n ExpansionPanelHeader,\n type ExpansionPanelHeaderProps,\n} from \"./ExpansionPanelHeader.js\";\nimport { expansionPanel } from \"./styles.js\";\n\n/**\n * @since 6.0.0 The `disableSecondaryColor` convenience prop was removed in\n * favor of the new `contentProps` object.\n * @since 6.0.0 The `disableParagraphMargin` prop was removed since it no longer\n * exists on the `CardContent` component.\n * @since 6.0.0 Removed the `marginTop` prop since it is no longer needed.\n */\nexport interface ExpansionPanelProps extends CardProps {\n /**\n * Set this to `true` if the {@link children} should be visible. This should\n * generally be provided by the `useExpansionPanels` hook.\n */\n expanded: boolean;\n\n /**\n * A function that should toggle the {@link expanded} state. This should\n * generally be provided by the `useExpansionPanels` hook.\n */\n onExpandClick: () => void;\n\n /**\n * Set this to `true` to prevent the panel from toggling the {@link expanded}\n * state. This should generally be provided by the `useExpansionPanels` hook.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * @defaultValue `true`\n * @see {@link CardProps.fullWidth}\n */\n fullWidth?: boolean;\n\n /**\n * This can be used to implement a custom header implementation, but it\n * probably shouldn't be needed.\n *\n * @since 6.0.0 This was renamed from `customHeader`\n * @see {@link headerProps}\n */\n header?: ReactNode;\n\n /**\n * This can be used to apply additional props to the header element.\n *\n * Note: You can override the `style` and `className` using\n * {@link headerStyle} and {@link headerClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <ExpansionPanel\n * {...props}\n * headerProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * icon: <MyCustomIcon />,\n * iconRotatorProps: {\n * className: \"another-custom-class-name\",\n * },\n * }}\n * />\n * ```\n */\n headerProps?: Omit<\n ExpansionPanelHeaderProps,\n \"id\" | \"aria-disabled\" | \"onClick\" | \"expanded\"\n >;\n\n /**\n * Convenience prop to apply custom style to the `ExpansionPanelHeader`\n * component.\n */\n headerStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `ExpansionPanelHeader`\n * component.\n */\n headerClassName?: string;\n\n /**\n * Content to display within the header of the expansion panel that toggles\n * the expanded state. This should generally contain some accessible text\n * describing the expansion panel's content.\n *\n * @since 6.0.0 This was renamed from `header`\n */\n headerChildren?: ReactNode;\n\n /**\n * This can be used to apply additional props to the `CardContent` component\n * if needed.\n *\n * Note: `disableSecondaryColor` and `disableLastChildPadding` default to\n * `true` in this implementation.\n *\n * @example\n * ```tsx\n * contentProps={{\n * style: {},\n * className: \"some-class-name\",\n * disablePadding: true,\n * disableSecondaryColor: false,\n * disableLastChildPadding: false,\n * // whatever else\n * }}\n * ```\n *\n * @see {@link contentStyle}\n * @see {@link contentClassName}\n * @see {@link disableContentPadding}\n */\n contentProps?: PropsWithRef<Omit<CardContentProps, \"role\">>;\n\n /**\n * Convenience prop to apply custom style to the `CardContent` component.\n */\n contentStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `CardContent` component.\n */\n contentClassName?: string;\n\n /**\n * Set to `true` to disable the collapse transition for the card content\n * whenever the {@link expanded} state changes.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @defaultValue `false`\n * @see {@link CardContentProps.disablePadding}\n */\n disableContentPadding?: boolean;\n\n /**\n * Set this to `true` to unmount the {@link children} when the\n * {@link expanded} state is `false`.\n *\n * @defaultValue `false`\n * @since 6.0.0 Renamed from `persistent` to match the\n * `useCollapseTransition` naming convention.\n */\n temporary?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * An expansion panel enables content to be either collapsed (hidden) or\n * expanded (visible) following the disclosure pattern.\n *\n * @example Simple Example\n * ```tsx\n * \"use client\";\n *\n * import { ExpansionList } from \"@react-md/core/expansion-panel/ExpansionList\";\n * import { ExpansionPanel } from \"@react-md/core/expansion-panel/ExpansionPanel\";\n * import { useExpansionPanels } from \"@react-md/core/expansion-panel/useExpansionPanels\";\n * import { type ReactElement } from \"react\";\n *\n * export default function ExpansionPanelGroupExample(): ReactElement {\n * const { getPanelProps } = useExpansionPanels();\n *\n * return (\n * <ExpansionList style={{ width: \"100%\" }}>\n * <ExpansionPanel {...getPanelProps(0)} headerChildren=\"Panel 1\">\n * Panel 1 Contents\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(1)} headerChildren=\"Panel 2\">\n * Panel 2 Contents\n * </ExpansionPanel>\n * <ExpansionPanel {...getPanelProps(2)} headerChildren=\"Panel 3\">\n * Panel 3 Contents\n * </ExpansionPanel>\n * </ExpansionList>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/expansion-panel | ExpansionPanel Demos}\n * @see `useExpansionPanels` for examples.\n * @since 6.0.0 The content will be persistent and invisible using `display: none`\n * instead of unmounting and also animate the `margin-top` style.\n */\nexport const ExpansionPanel = forwardRef<\n HTMLHeadingElement,\n ExpansionPanelProps\n>(function ExpansionPanel(props, ref) {\n const {\n id: propId,\n className,\n contentProps,\n contentStyle,\n contentClassName,\n header: propHeader,\n headerProps,\n headerStyle,\n headerClassName,\n headerChildren,\n children,\n expanded,\n onExpandClick,\n disabled = false,\n fullWidth = true,\n temporary = false,\n disableTransition = false,\n disableContentPadding = false,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"expansion-panel\");\n const { elementProps, rendered } = useCollapseTransition({\n nodeRef: contentProps?.ref,\n style: contentStyle,\n className: contentClassName,\n timeout: disableTransition ? 0 : undefined,\n temporary,\n transitionIn: expanded,\n });\n\n let header = propHeader;\n if (typeof header === \"undefined\") {\n header = (\n <ExpansionPanelHeader\n style={headerStyle}\n className={headerClassName}\n disableTransition={disableTransition}\n {...headerProps}\n aria-disabled={disabled || undefined}\n id={id}\n onClick={onExpandClick}\n expanded={expanded}\n >\n {headerChildren}\n </ExpansionPanelHeader>\n );\n }\n\n return (\n <Card\n {...remaining}\n id={`${id}-container`}\n ref={ref}\n fullWidth={fullWidth}\n className={expansionPanel({\n expanded,\n disableTransition,\n className,\n })}\n >\n {header}\n {rendered && (\n <CardContent\n id={`${id}-content`}\n aria-labelledby={id}\n disablePadding={disableContentPadding}\n disableSecondaryColor\n disableLastChildPadding\n {...contentProps}\n {...elementProps}\n role=\"region\"\n >\n {children}\n </CardContent>\n )}\n </Card>\n );\n});\n"],"names":["forwardRef","Card","CardContent","useCollapseTransition","useEnsuredId","ExpansionPanelHeader","expansionPanel","ExpansionPanel","props","ref","id","propId","className","contentProps","contentStyle","contentClassName","header","propHeader","headerProps","headerStyle","headerClassName","headerChildren","children","expanded","onExpandClick","disabled","fullWidth","temporary","disableTransition","disableContentPadding","remaining","elementProps","rendered","nodeRef","style","timeout","undefined","transitionIn","aria-disabled","onClick","aria-labelledby","disablePadding","disableSecondaryColor","disableLastChildPadding","role"],"mappings":"AAAA;;AAEA,SAA6CA,UAAU,QAAQ,QAAQ;AAEvE,SAASC,IAAI,QAAwB,kBAAkB;AACvD,SAASC,WAAW,QAA+B,yBAAyB;AAC5E,SAASC,qBAAqB,QAAQ,yCAAyC;AAE/E,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SACEC,oBAAoB,QAEf,4BAA4B;AACnC,SAASC,cAAc,QAAQ,cAAc;AA0J7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCC,GACD,OAAO,MAAMC,+BAAiBP,WAG5B,SAASO,eAAeC,KAAK,EAAEC,GAAG;IAClC,MAAM,EACJC,IAAIC,MAAM,EACVC,SAAS,EACTC,YAAY,EACZC,YAAY,EACZC,gBAAgB,EAChBC,QAAQC,UAAU,EAClBC,WAAW,EACXC,WAAW,EACXC,eAAe,EACfC,cAAc,EACdC,QAAQ,EACRC,QAAQ,EACRC,aAAa,EACbC,WAAW,KAAK,EAChBC,YAAY,IAAI,EAChBC,YAAY,KAAK,EACjBC,oBAAoB,KAAK,EACzBC,wBAAwB,KAAK,EAC7B,GAAGC,WACJ,GAAGtB;IAEJ,MAAME,KAAKN,aAAaO,QAAQ;IAChC,MAAM,EAAEoB,YAAY,EAAEC,QAAQ,EAAE,GAAG7B,sBAAsB;QACvD8B,SAASpB,cAAcJ;QACvByB,OAAOpB;QACPF,WAAWG;QACXoB,SAASP,oBAAoB,IAAIQ;QACjCT;QACAU,cAAcd;IAChB;IAEA,IAAIP,SAASC;IACb,IAAI,OAAOD,WAAW,aAAa;QACjCA,uBACE,KAACX;YACC6B,OAAOf;YACPP,WAAWQ;YACXQ,mBAAmBA;YAClB,GAAGV,WAAW;YACfoB,iBAAeb,YAAYW;YAC3B1B,IAAIA;YACJ6B,SAASf;YACTD,UAAUA;sBAETF;;IAGP;IAEA,qBACE,MAACpB;QACE,GAAG6B,SAAS;QACbpB,IAAI,GAAGA,GAAG,UAAU,CAAC;QACrBD,KAAKA;QACLiB,WAAWA;QACXd,WAAWN,eAAe;YACxBiB;YACAK;YACAhB;QACF;;YAECI;YACAgB,0BACC,KAAC9B;gBACCQ,IAAI,GAAGA,GAAG,QAAQ,CAAC;gBACnB8B,mBAAiB9B;gBACjB+B,gBAAgBZ;gBAChBa,qBAAqB;gBACrBC,uBAAuB;gBACtB,GAAG9B,YAAY;gBACf,GAAGkB,YAAY;gBAChBa,MAAK;0BAEJtB;;;;AAKX,GAAG"}
@@ -31,7 +31,7 @@ export interface ExpansionPanelHeaderProps extends ButtonHTMLAttributes<HTMLButt
31
31
  * Any additional props to provide to the heading element that wraps the
32
32
  * expansion panel button.
33
33
  */
34
- headingProps?: PropsWithRef<TypographyProps, HTMLHeadingElement>;
34
+ headingProps?: PropsWithRef<TypographyProps>;
35
35
  iconRotatorProps?: Omit<IconRotatorProps, "rotated" | "disableTransition">;
36
36
  /**
37
37
  * Any children to display **before** the button in the heading element. This
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/expansion-panel/ExpansionPanelHeader.tsx"],"sourcesContent":["import {\n type ButtonHTMLAttributes,\n type MouseEventHandler,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { ButtonUnstyled } from \"../button/ButtonUnstyled.js\";\nimport { IconRotator, type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { Typography, type TypographyProps } from \"../typography/Typography.js\";\nimport { type TypographyType } from \"../typography/typographyStyles.js\";\nimport { expansionPanelButton, expansionPanelHeading } from \"./styles.js\";\n\n/**\n * @since 6.0.0 Updated to include additional heading/Typography\n * props.\n */\nexport interface ExpansionPanelHeaderProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n id: string;\n\n /**\n * This should be a function that toggles the expansion state for the parent\n * `ExpansionPanel`.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n expanded: boolean;\n\n /**\n * @defaultValue `\"h3\"`\n */\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\n /**\n * @defaultValue `getIcon(\"expander\")`\n */\n icon?: ReactNode;\n\n /**\n * @defaultValue `\"subtitle-1\"`\n */\n headingType?: TypographyType;\n\n /**\n * Any additional props to provide to the heading element that wraps the\n * expansion panel button.\n */\n headingProps?: PropsWithRef<TypographyProps, HTMLHeadingElement>;\n iconRotatorProps?: Omit<IconRotatorProps, \"rotated\" | \"disableTransition\">;\n\n /**\n * Any children to display **before** the button in the heading element. This\n * should really only be used if you need to add additional clickable elements\n * within the header.\n */\n beforeChildren?: ReactNode;\n\n /**\n * Any children to display **after** the button in the heading element.This\n * should really only be used if you need to add additional clickable elements\n * within the header.\n *\n * @example\n * ```tsx\n * afterChildren={\n * <DropdownMenu buttonType=\"icon\" ButtonChildren={<MoreVertSVGIcon />}>\n * <MenuItem>Item 1</MenuItem>\n * <MenuItem>Item 2</MenuItem>\n * <MenuItem>Item 3</MenuItem>\n * </DropdownMenu>\n * }\n * ```\n */\n afterChildren?: ReactNode;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/**\n * This is mostly an internal component, but can also be used to implement a\n * custom header implementation if needed. This might really be a client\n * component in practice since the `onClick` prop must be provided.\n *\n * @example Custom Header\n * ```tsx\n * import { ExpansionPanel, type ExpansionPanelProps } from \"@react-md/core/expansion-panel/ExpansionPanel\";\n * import { ExpansionPanelHeader } from \"@react-md/core/expansion-panel/ExpansionPanelHeader\";\n * import { type ReactElement, useId } from \"react\";\n *\n * export type CustomExpansionPanelProps = ExpansionPanelProps & { id: string; };\n *\n * export function CustomExpansionPanel(props: CustomExpansionPanelProps): ReactElement {\n * const {\n * id,\n * disabled,\n * onExpandClick,\n * expanded,\n * disableTransition,\n * headerChildren,\n * } = props;\n *\n * return (\n * <ExpansionPanel\n * {...props}\n * header={(\n * <ExpansionPanelHeader\n * aria-disabled={disabled || undefined}\n * id={id}\n * onClick={onExpandClick}\n * expanded={expanded}\n * disableTransition={disableTransition}\n * // whatever props and any custom implementation\n * >\n * {headerChildren}\n * </ExpansionPanelHeader>\n * )}\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/expansion-panel | ExpansionPanel Demos}\n * @since 6.0.0 Updated to be wrapped by the {@link Typography}\n * component and rendered as an `<h6>`.\n */\nexport const ExpansionPanelHeader = forwardRef<\n HTMLHeadingElement,\n ExpansionPanelHeaderProps\n>(function ExpansionPanelHeader(props, ref) {\n const {\n id,\n headingType = \"subtitle-1\",\n headingProps,\n iconRotatorProps,\n icon: propIcon,\n expanded,\n className,\n children,\n beforeChildren,\n afterChildren,\n disableTransition = false,\n ...remaining\n } = props;\n\n const icon = getIcon(\"expander\", propIcon);\n\n return (\n <Typography\n ref={ref}\n type={headingType}\n margin=\"none\"\n {...headingProps}\n className={expansionPanelHeading(headingProps)}\n >\n {beforeChildren}\n <ButtonUnstyled\n {...remaining}\n aria-expanded={expanded}\n id={id}\n className={expansionPanelButton({ className })}\n >\n {children}\n {icon && (\n <IconRotator\n {...iconRotatorProps}\n rotated={expanded}\n disableTransition={disableTransition}\n >\n {icon}\n </IconRotator>\n )}\n </ButtonUnstyled>\n {afterChildren}\n </Typography>\n );\n});\n"],"names":["forwardRef","ButtonUnstyled","IconRotator","getIcon","Typography","expansionPanelButton","expansionPanelHeading","ExpansionPanelHeader","props","ref","id","headingType","headingProps","iconRotatorProps","icon","propIcon","expanded","className","children","beforeChildren","afterChildren","disableTransition","remaining","type","margin","aria-expanded","rotated"],"mappings":";AAAA,SAIEA,UAAU,QACL,QAAQ;AAEf,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,WAAW,QAA+B,yBAAyB;AAC5E,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,SAASC,UAAU,QAA8B,8BAA8B;AAE/E,SAASC,oBAAoB,EAAEC,qBAAqB,QAAQ,cAAc;AAsE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CC,GACD,OAAO,MAAMC,qCAAuBP,WAGlC,SAASO,qBAAqBC,KAAK,EAAEC,GAAG;IACxC,MAAM,EACJC,EAAE,EACFC,cAAc,YAAY,EAC1BC,YAAY,EACZC,gBAAgB,EAChBC,MAAMC,QAAQ,EACdC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,cAAc,EACdC,aAAa,EACbC,oBAAoB,KAAK,EACzB,GAAGC,WACJ,GAAGd;IAEJ,MAAMM,OAAOX,QAAQ,YAAYY;IAEjC,qBACE,MAACX;QACCK,KAAKA;QACLc,MAAMZ;QACNa,QAAO;QACN,GAAGZ,YAAY;QAChBK,WAAWX,sBAAsBM;;YAEhCO;0BACD,MAAClB;gBACE,GAAGqB,SAAS;gBACbG,iBAAeT;gBACfN,IAAIA;gBACJO,WAAWZ,qBAAqB;oBAAEY;gBAAU;;oBAE3CC;oBACAJ,sBACC,KAACZ;wBACE,GAAGW,gBAAgB;wBACpBa,SAASV;wBACTK,mBAAmBA;kCAElBP;;;;YAINM;;;AAGP,GAAG"}
1
+ {"version":3,"sources":["../../src/expansion-panel/ExpansionPanelHeader.tsx"],"sourcesContent":["import {\n type ButtonHTMLAttributes,\n type MouseEventHandler,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { ButtonUnstyled } from \"../button/ButtonUnstyled.js\";\nimport { IconRotator, type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { Typography, type TypographyProps } from \"../typography/Typography.js\";\nimport { type TypographyType } from \"../typography/typographyStyles.js\";\nimport { expansionPanelButton, expansionPanelHeading } from \"./styles.js\";\n\n/**\n * @since 6.0.0 Updated to include additional heading/Typography\n * props.\n */\nexport interface ExpansionPanelHeaderProps\n extends ButtonHTMLAttributes<HTMLButtonElement> {\n id: string;\n\n /**\n * This should be a function that toggles the expansion state for the parent\n * `ExpansionPanel`.\n */\n onClick: MouseEventHandler<HTMLButtonElement>;\n expanded: boolean;\n\n /**\n * @defaultValue `\"h3\"`\n */\n as?: \"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\";\n\n /**\n * @defaultValue `getIcon(\"expander\")`\n */\n icon?: ReactNode;\n\n /**\n * @defaultValue `\"subtitle-1\"`\n */\n headingType?: TypographyType;\n\n /**\n * Any additional props to provide to the heading element that wraps the\n * expansion panel button.\n */\n headingProps?: PropsWithRef<TypographyProps>;\n iconRotatorProps?: Omit<IconRotatorProps, \"rotated\" | \"disableTransition\">;\n\n /**\n * Any children to display **before** the button in the heading element. This\n * should really only be used if you need to add additional clickable elements\n * within the header.\n */\n beforeChildren?: ReactNode;\n\n /**\n * Any children to display **after** the button in the heading element.This\n * should really only be used if you need to add additional clickable elements\n * within the header.\n *\n * @example\n * ```tsx\n * afterChildren={\n * <DropdownMenu buttonType=\"icon\" ButtonChildren={<MoreVertSVGIcon />}>\n * <MenuItem>Item 1</MenuItem>\n * <MenuItem>Item 2</MenuItem>\n * <MenuItem>Item 3</MenuItem>\n * </DropdownMenu>\n * }\n * ```\n */\n afterChildren?: ReactNode;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n}\n\n/**\n * This is mostly an internal component, but can also be used to implement a\n * custom header implementation if needed. This might really be a client\n * component in practice since the `onClick` prop must be provided.\n *\n * @example Custom Header\n * ```tsx\n * import { ExpansionPanel, type ExpansionPanelProps } from \"@react-md/core/expansion-panel/ExpansionPanel\";\n * import { ExpansionPanelHeader } from \"@react-md/core/expansion-panel/ExpansionPanelHeader\";\n * import { type ReactElement, useId } from \"react\";\n *\n * export type CustomExpansionPanelProps = ExpansionPanelProps & { id: string; };\n *\n * export function CustomExpansionPanel(props: CustomExpansionPanelProps): ReactElement {\n * const {\n * id,\n * disabled,\n * onExpandClick,\n * expanded,\n * disableTransition,\n * headerChildren,\n * } = props;\n *\n * return (\n * <ExpansionPanel\n * {...props}\n * header={(\n * <ExpansionPanelHeader\n * aria-disabled={disabled || undefined}\n * id={id}\n * onClick={onExpandClick}\n * expanded={expanded}\n * disableTransition={disableTransition}\n * // whatever props and any custom implementation\n * >\n * {headerChildren}\n * </ExpansionPanelHeader>\n * )}\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/expansion-panel | ExpansionPanel Demos}\n * @since 6.0.0 Updated to be wrapped by the {@link Typography}\n * component and rendered as an `<h6>`.\n */\nexport const ExpansionPanelHeader = forwardRef<\n HTMLHeadingElement,\n ExpansionPanelHeaderProps\n>(function ExpansionPanelHeader(props, ref) {\n const {\n id,\n headingType = \"subtitle-1\",\n headingProps,\n iconRotatorProps,\n icon: propIcon,\n expanded,\n className,\n children,\n beforeChildren,\n afterChildren,\n disableTransition = false,\n ...remaining\n } = props;\n\n const icon = getIcon(\"expander\", propIcon);\n\n return (\n <Typography\n ref={ref}\n type={headingType}\n margin=\"none\"\n {...headingProps}\n className={expansionPanelHeading(headingProps)}\n >\n {beforeChildren}\n <ButtonUnstyled\n {...remaining}\n aria-expanded={expanded}\n id={id}\n className={expansionPanelButton({ className })}\n >\n {children}\n {icon && (\n <IconRotator\n {...iconRotatorProps}\n rotated={expanded}\n disableTransition={disableTransition}\n >\n {icon}\n </IconRotator>\n )}\n </ButtonUnstyled>\n {afterChildren}\n </Typography>\n );\n});\n"],"names":["forwardRef","ButtonUnstyled","IconRotator","getIcon","Typography","expansionPanelButton","expansionPanelHeading","ExpansionPanelHeader","props","ref","id","headingType","headingProps","iconRotatorProps","icon","propIcon","expanded","className","children","beforeChildren","afterChildren","disableTransition","remaining","type","margin","aria-expanded","rotated"],"mappings":";AAAA,SAIEA,UAAU,QACL,QAAQ;AAEf,SAASC,cAAc,QAAQ,8BAA8B;AAC7D,SAASC,WAAW,QAA+B,yBAAyB;AAC5E,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,SAASC,UAAU,QAA8B,8BAA8B;AAE/E,SAASC,oBAAoB,EAAEC,qBAAqB,QAAQ,cAAc;AAsE1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CC,GACD,OAAO,MAAMC,qCAAuBP,WAGlC,SAASO,qBAAqBC,KAAK,EAAEC,GAAG;IACxC,MAAM,EACJC,EAAE,EACFC,cAAc,YAAY,EAC1BC,YAAY,EACZC,gBAAgB,EAChBC,MAAMC,QAAQ,EACdC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,cAAc,EACdC,aAAa,EACbC,oBAAoB,KAAK,EACzB,GAAGC,WACJ,GAAGd;IAEJ,MAAMM,OAAOX,QAAQ,YAAYY;IAEjC,qBACE,MAACX;QACCK,KAAKA;QACLc,MAAMZ;QACNa,QAAO;QACN,GAAGZ,YAAY;QAChBK,WAAWX,sBAAsBM;;YAEhCO;0BACD,MAAClB;gBACE,GAAGqB,SAAS;gBACbG,iBAAeT;gBACfN,IAAIA;gBACJO,WAAWZ,qBAAqB;oBAAEY;gBAAU;;oBAE3CC;oBACAJ,sBACC,KAACZ;wBACE,GAAGW,gBAAgB;wBACpBa,SAASV;wBACTK,mBAAmBA;kCAElBP;;;;YAINM;;;AAGP,GAAG"}
@@ -20,7 +20,7 @@ export interface FileInputProps extends ButtonClassNameThemeOptions, FileInputHT
20
20
  * most props get passed to the `<input type="file">`. So this would be useful
21
21
  * for inline style or click handlers.
22
22
  */
23
- labelProps?: PropsWithRef<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
23
+ labelProps?: PropsWithRef<LabelHTMLAttributes<HTMLLabelElement>>;
24
24
  /**
25
25
  * An optional icon to display for the file input.
26
26
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/files/FileInput.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type InputHTMLAttributes,\n type LabelHTMLAttributes,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { type ButtonClassNameThemeOptions } from \"../button/styles.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { SrOnly } from \"../typography/SrOnly.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { fileInput } from \"./styles.js\";\n\n/** @since 6.0.0 */\nexport type FileInputHTMLAttributes = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\"\n>;\n\n/**\n * @since 6.0.0 Removed the `disableIconSpacing` prop since it is no\n * longer required.\n */\nexport interface FileInputProps\n extends ButtonClassNameThemeOptions,\n FileInputHTMLAttributes,\n ComponentWithRippleProps {\n /**\n * This is the label text for icon-only file inputs.\n *\n * @defaultValue `\"Upload\"`\n */\n srOnlyLabel?: ReactNode;\n\n /**\n * Any additional props to provide to the container `<label>` element since\n * most props get passed to the `<input type=\"file\">`. So this would be useful\n * for inline style or click handlers.\n */\n labelProps?: PropsWithRef<\n LabelHTMLAttributes<HTMLLabelElement>,\n HTMLLabelElement\n >;\n\n /**\n * An optional icon to display for the file input.\n *\n * @defaultValue `getIcon(\"upload\")`\n */\n icon?: ReactNode;\n\n /**\n * Boolean if the icon should appear after the children in the label.\n *\n * @defaultValue `false`\n */\n iconAfter?: boolean;\n\n /**\n * Boolean if the file input should no longer allow the same file to be\n * selected multiple times and trigger the `onChange` each time it is\n * selected.\n *\n * @defaultValue `false`\n */\n disableRepeatableFiles?: boolean;\n\n /**\n * Children should generally be provided when the {@link buttonType} is\n * set to `\"text\"`. This defaults to a screen-reader only accessible text.\n *\n * @defaultValue `<SrOnly phoneOnly={responsive}>Upload</SrOnly>`\n */\n children?: ReactNode;\n}\n\n/**\n * **Client Component**\n * This might be able to become a server component if I remove the getIcon hook\n *\n * @example Simple Example\n * ```tsx\n * import { FileInput } from \"@react-md/core/files/FileInput\";\n * import { Form } from \"@react-md/core/form/Form\";\n * import type { ReactElement } from \"react\";\n *\n * const extensions = [\n * \"svg\",\n * \"jpeg\",\n * \"jpg\",\n * \"png\",\n * \"apng\",\n * \"mkv\",\n * \"mp4\",\n * \"mpeg\",\n * \"mpg\",\n * \"webm\",\n * \"mov\",\n * ] as const;\n *\n * const FOUR_HUNDRED_MB = 400 * 1024 * 1024;\n * const maxFiles = 10;\n *\n * function Example(): ReactElement {\n * const { stats, errors, onChange, clearErrors, reset, remove, accept } =\n * useFileUpload({\n * maxFiles,\n * maxFileSize: FOUR_HUNDRED_MB,\n * extensions,\n * });\n *\n * return (\n * <Form>\n * <FileInput accept={accept} multiple={maxFiles > 1} onChange={onChange} />\n * <Button onClick={reset} disabled={!stats.length}>\n * Remove all files\n * </Button>\n * </Form>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/file-input | FileInput Demos}\n * @since 6.0.0 Added additional support for `iconSize` and\n * `responsive`. Also removed the `disableIconSpacing` prop since it is no\n * longer required.\n */\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n function FileInput(props, ref) {\n const {\n id: propId,\n className,\n children: propChildren,\n icon: propIcon,\n iconAfter = false,\n srOnlyLabel = \"Upload\",\n disableRepeatableFiles = false,\n labelProps,\n theme = \"primary\",\n themeType = \"contained\",\n buttonType = propChildren ? \"text\" : \"icon\",\n disabled = false,\n iconSize,\n responsive,\n multiple = false,\n disableRipple,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"file-input\");\n const { pressed, pressedClassName, ripples, handlers } =\n useElementInteraction({\n ...labelProps,\n mode: disableRipple ? \"none\" : undefined,\n onClick(event) {\n labelProps?.onClick?.(event);\n\n // stop propagation so 2 ripples are not created\n event.stopPropagation();\n },\n disabled,\n });\n\n const icon = getIcon(\"upload\", propIcon);\n let children = propChildren;\n if (\n typeof propChildren === \"undefined\" &&\n !props[\"aria-label\"] &&\n !props[\"aria-labelledby\"]\n ) {\n children = <SrOnly phoneOnly={responsive}>{srOnlyLabel}</SrOnly>;\n }\n\n return (\n <label\n {...labelProps}\n {...handlers}\n className={fileInput({\n theme,\n themeType,\n buttonType,\n disabled,\n iconSize,\n pressed,\n responsive,\n pressedClassName,\n className: className || labelProps?.className,\n })}\n >\n {!iconAfter && icon}\n {children}\n {iconAfter && icon}\n <input\n {...remaining}\n id={id}\n ref={ref}\n value={\n disableRepeatableFiles || !props.onChange ? remaining.value : \"\"\n }\n type=\"file\"\n className=\"rmd-hidden-input\"\n disabled={disabled}\n multiple={multiple}\n />\n {ripples}\n </label>\n );\n }\n);\n"],"names":["forwardRef","getIcon","useElementInteraction","SrOnly","useEnsuredId","fileInput","FileInput","props","ref","id","propId","className","children","propChildren","icon","propIcon","iconAfter","srOnlyLabel","disableRepeatableFiles","labelProps","theme","themeType","buttonType","disabled","iconSize","responsive","multiple","disableRipple","remaining","pressed","pressedClassName","ripples","handlers","mode","undefined","onClick","event","stopPropagation","phoneOnly","label","input","value","onChange","type"],"mappings":"AAAA;;AAEA,SAIEA,UAAU,QACL,QAAQ;AAGf,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,SAASC,qBAAqB,QAAQ,0CAA0C;AAEhF,SAASC,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aAAaF;0BACd,KAAC0B;gBACE,GAAGZ,SAAS;gBACbnB,IAAIA;gBACJD,KAAKA;gBACLiC,OACEvB,0BAA0B,CAACX,MAAMmC,QAAQ,GAAGd,UAAUa,KAAK,GAAG;gBAEhEE,MAAK;gBACLhC,WAAU;gBACVY,UAAUA;gBACVG,UAAUA;;YAEXK;;;AAGP,GACA"}
1
+ {"version":3,"sources":["../../src/files/FileInput.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type InputHTMLAttributes,\n type LabelHTMLAttributes,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { type ButtonClassNameThemeOptions } from \"../button/styles.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { SrOnly } from \"../typography/SrOnly.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { fileInput } from \"./styles.js\";\n\n/** @since 6.0.0 */\nexport type FileInputHTMLAttributes = Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"type\"\n>;\n\n/**\n * @since 6.0.0 Removed the `disableIconSpacing` prop since it is no\n * longer required.\n */\nexport interface FileInputProps\n extends ButtonClassNameThemeOptions,\n FileInputHTMLAttributes,\n ComponentWithRippleProps {\n /**\n * This is the label text for icon-only file inputs.\n *\n * @defaultValue `\"Upload\"`\n */\n srOnlyLabel?: ReactNode;\n\n /**\n * Any additional props to provide to the container `<label>` element since\n * most props get passed to the `<input type=\"file\">`. So this would be useful\n * for inline style or click handlers.\n */\n labelProps?: PropsWithRef<LabelHTMLAttributes<HTMLLabelElement>>;\n\n /**\n * An optional icon to display for the file input.\n *\n * @defaultValue `getIcon(\"upload\")`\n */\n icon?: ReactNode;\n\n /**\n * Boolean if the icon should appear after the children in the label.\n *\n * @defaultValue `false`\n */\n iconAfter?: boolean;\n\n /**\n * Boolean if the file input should no longer allow the same file to be\n * selected multiple times and trigger the `onChange` each time it is\n * selected.\n *\n * @defaultValue `false`\n */\n disableRepeatableFiles?: boolean;\n\n /**\n * Children should generally be provided when the {@link buttonType} is\n * set to `\"text\"`. This defaults to a screen-reader only accessible text.\n *\n * @defaultValue `<SrOnly phoneOnly={responsive}>Upload</SrOnly>`\n */\n children?: ReactNode;\n}\n\n/**\n * **Client Component**\n * This might be able to become a server component if I remove the getIcon hook\n *\n * @example Simple Example\n * ```tsx\n * import { FileInput } from \"@react-md/core/files/FileInput\";\n * import { Form } from \"@react-md/core/form/Form\";\n * import type { ReactElement } from \"react\";\n *\n * const extensions = [\n * \"svg\",\n * \"jpeg\",\n * \"jpg\",\n * \"png\",\n * \"apng\",\n * \"mkv\",\n * \"mp4\",\n * \"mpeg\",\n * \"mpg\",\n * \"webm\",\n * \"mov\",\n * ] as const;\n *\n * const FOUR_HUNDRED_MB = 400 * 1024 * 1024;\n * const maxFiles = 10;\n *\n * function Example(): ReactElement {\n * const { stats, errors, onChange, clearErrors, reset, remove, accept } =\n * useFileUpload({\n * maxFiles,\n * maxFileSize: FOUR_HUNDRED_MB,\n * extensions,\n * });\n *\n * return (\n * <Form>\n * <FileInput accept={accept} multiple={maxFiles > 1} onChange={onChange} />\n * <Button onClick={reset} disabled={!stats.length}>\n * Remove all files\n * </Button>\n * </Form>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/file-input | FileInput Demos}\n * @since 6.0.0 Added additional support for `iconSize` and\n * `responsive`. Also removed the `disableIconSpacing` prop since it is no\n * longer required.\n */\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n function FileInput(props, ref) {\n const {\n id: propId,\n className,\n children: propChildren,\n icon: propIcon,\n iconAfter = false,\n srOnlyLabel = \"Upload\",\n disableRepeatableFiles = false,\n labelProps,\n theme = \"primary\",\n themeType = \"contained\",\n buttonType = propChildren ? \"text\" : \"icon\",\n disabled = false,\n iconSize,\n responsive,\n multiple = false,\n disableRipple,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"file-input\");\n const { pressed, pressedClassName, ripples, handlers } =\n useElementInteraction({\n ...labelProps,\n mode: disableRipple ? \"none\" : undefined,\n onClick(event) {\n labelProps?.onClick?.(event);\n\n // stop propagation so 2 ripples are not created\n event.stopPropagation();\n },\n disabled,\n });\n\n const icon = getIcon(\"upload\", propIcon);\n let children = propChildren;\n if (\n typeof propChildren === \"undefined\" &&\n !props[\"aria-label\"] &&\n !props[\"aria-labelledby\"]\n ) {\n children = <SrOnly phoneOnly={responsive}>{srOnlyLabel}</SrOnly>;\n }\n\n return (\n <label\n {...labelProps}\n {...handlers}\n className={fileInput({\n theme,\n themeType,\n buttonType,\n disabled,\n iconSize,\n pressed,\n responsive,\n pressedClassName,\n className: className || labelProps?.className,\n })}\n >\n {!iconAfter && icon}\n {children}\n {iconAfter && icon}\n <input\n {...remaining}\n id={id}\n ref={ref}\n value={\n disableRepeatableFiles || !props.onChange ? remaining.value : \"\"\n }\n type=\"file\"\n className=\"rmd-hidden-input\"\n disabled={disabled}\n multiple={multiple}\n />\n {ripples}\n </label>\n );\n }\n);\n"],"names":["forwardRef","getIcon","useElementInteraction","SrOnly","useEnsuredId","fileInput","FileInput","props","ref","id","propId","className","children","propChildren","icon","propIcon","iconAfter","srOnlyLabel","disableRepeatableFiles","labelProps","theme","themeType","buttonType","disabled","iconSize","responsive","multiple","disableRipple","remaining","pressed","pressedClassName","ripples","handlers","mode","undefined","onClick","event","stopPropagation","phoneOnly","label","input","value","onChange","type"],"mappings":"AAAA;;AAEA,SAIEA,UAAU,QACL,QAAQ;AAGf,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,SAASC,qBAAqB,QAAQ,0CAA0C;AAEhF,SAASC,MAAM,QAAQ,0BAA0B;AACjD,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,SAAS,QAAQ,cAAc;AA8DxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDC,GACD,OAAO,MAAM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BACVY,UAAUA;gBACVG,UAAUA;;YAEXK;;;AAGP,GACA"}
@@ -10,7 +10,7 @@ export interface FormMessageContainerProps extends HTMLAttributes<HTMLDivElement
10
10
  * component, these props are optional. It kind of eliminates the whole
11
11
  * purpose of this component though.
12
12
  */
13
- messageProps?: PropsWithRef<FormMessageProps, HTMLDivElement>;
13
+ messageProps?: PropsWithRef<FormMessageProps>;
14
14
  }
15
15
  /**
16
16
  * Conditionally wraps the `children` in a `.rmd-form-message-container` wrapper
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/form/FormMessageContainer.tsx"],"sourcesContent":["import { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { FormMessage } from \"./FormMessage.js\";\nimport { formMessageContainer } from \"./formMessageContainerStyles.js\";\nimport { type FormMessageProps } from \"./types.js\";\n\n/**\n * @since 2.5.0\n */\nexport interface FormMessageContainerProps\n extends HTMLAttributes<HTMLDivElement> {\n /**\n * If the extension doesn't actually want to render the `FormMessage`\n * component, these props are optional. It kind of eliminates the whole\n * purpose of this component though.\n */\n messageProps?: PropsWithRef<FormMessageProps, HTMLDivElement>;\n}\n\n/**\n * Conditionally wraps the `children` in a `.rmd-form-message-container` wrapper\n * and renders the {@link FormMessage} component.\n *\n * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}\n * @since 2.5.0\n */\nexport const FormMessageContainer = forwardRef<\n HTMLDivElement,\n FormMessageContainerProps\n>(function FormMessageContainer(props, ref) {\n const { className, children, messageProps, ...remaining } = props;\n if (!messageProps) {\n return <>{children}</>;\n }\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={formMessageContainer({ className })}\n >\n {children}\n <FormMessage {...messageProps} />\n </div>\n );\n});\n"],"names":["forwardRef","FormMessage","formMessageContainer","FormMessageContainer","props","ref","className","children","messageProps","remaining","div"],"mappings":";AAAA,SAA8BA,UAAU,QAAQ,QAAQ;AAGxD,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,oBAAoB,QAAQ,kCAAkC;AAgBvE;;;;;;CAMC,GACD,OAAO,MAAMC,qCAAuBH,WAGlC,SAASG,qBAAqBC,KAAK,EAAEC,GAAG;IACxC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGC,WAAW,GAAGL;IAC5D,IAAI,CAACI,cAAc;QACjB,qBAAO;sBAAGD;;IACZ;IAEA,qBACE,MAACG;QACE,GAAGD,SAAS;QACbJ,KAAKA;QACLC,WAAWJ,qBAAqB;YAAEI;QAAU;;YAE3CC;0BACD,KAACN;gBAAa,GAAGO,YAAY;;;;AAGnC,GAAG"}
1
+ {"version":3,"sources":["../../src/form/FormMessageContainer.tsx"],"sourcesContent":["import { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { FormMessage } from \"./FormMessage.js\";\nimport { formMessageContainer } from \"./formMessageContainerStyles.js\";\nimport { type FormMessageProps } from \"./types.js\";\n\n/**\n * @since 2.5.0\n */\nexport interface FormMessageContainerProps\n extends HTMLAttributes<HTMLDivElement> {\n /**\n * If the extension doesn't actually want to render the `FormMessage`\n * component, these props are optional. It kind of eliminates the whole\n * purpose of this component though.\n */\n messageProps?: PropsWithRef<FormMessageProps>;\n}\n\n/**\n * Conditionally wraps the `children` in a `.rmd-form-message-container` wrapper\n * and renders the {@link FormMessage} component.\n *\n * @see {@link https://react-md.dev/components/form-message | FormMessage Demos}\n * @since 2.5.0\n */\nexport const FormMessageContainer = forwardRef<\n HTMLDivElement,\n FormMessageContainerProps\n>(function FormMessageContainer(props, ref) {\n const { className, children, messageProps, ...remaining } = props;\n if (!messageProps) {\n return <>{children}</>;\n }\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={formMessageContainer({ className })}\n >\n {children}\n <FormMessage {...messageProps} />\n </div>\n );\n});\n"],"names":["forwardRef","FormMessage","formMessageContainer","FormMessageContainer","props","ref","className","children","messageProps","remaining","div"],"mappings":";AAAA,SAA8BA,UAAU,QAAQ,QAAQ;AAGxD,SAASC,WAAW,QAAQ,mBAAmB;AAC/C,SAASC,oBAAoB,QAAQ,kCAAkC;AAgBvE;;;;;;CAMC,GACD,OAAO,MAAMC,qCAAuBH,WAGlC,SAASG,qBAAqBC,KAAK,EAAEC,GAAG;IACxC,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGC,WAAW,GAAGL;IAC5D,IAAI,CAACI,cAAc;QACjB,qBAAO;sBAAGD;;IACZ;IAEA,qBACE,MAACG;QACE,GAAGD,SAAS;QACbJ,KAAKA;QACLC,WAAWJ,qBAAqB;YAAEI;QAAU;;YAE3CC;0BACD,KAACN;gBAAa,GAAGO,YAAY;;;;AAGnC,GAAG"}
@@ -30,7 +30,7 @@ export interface ConfigurableInputToggleIconProps {
30
30
  * Any props that should be passed to the `<span>` that surrounds the current
31
31
  * icon element.
32
32
  */
33
- iconProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
33
+ iconProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;
34
34
  /**
35
35
  * Optional style to set on the `<span>` that surrounds the current icon
36
36
  * element.
@@ -74,7 +74,7 @@ export interface InputToggleLabelProps {
74
74
  * }}
75
75
  * ```
76
76
  */
77
- labelProps?: PropsWithRef<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>;
77
+ labelProps?: PropsWithRef<LabelHTMLAttributes<HTMLLabelElement>>;
78
78
  /**
79
79
  * @see {@link LabelClassNameOptions.gap}
80
80
  * @defaultValue `false`