@react-md/core 6.0.2 → 6.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RootHtml.d.ts +1 -1
- package/dist/RootHtml.js.map +1 -1
- package/dist/_base.scss +6 -2
- package/dist/_border-radius.scss +92 -0
- package/dist/_core.scss +2 -0
- package/dist/_spacing.scss +86 -0
- package/dist/app-bar/_app-bar.scss +9 -7
- package/dist/app-bar/styles.js +1 -1
- package/dist/app-bar/styles.js.map +1 -1
- package/dist/autocomplete/defaults.d.ts +1 -0
- package/dist/autocomplete/defaults.js +2 -6
- package/dist/autocomplete/defaults.js.map +1 -1
- package/dist/autocomplete/types.d.ts +9 -9
- package/dist/autocomplete/types.js.map +1 -1
- package/dist/avatar/Avatar.d.ts +1 -1
- package/dist/avatar/Avatar.js +1 -1
- package/dist/avatar/Avatar.js.map +1 -1
- package/dist/avatar/_avatar.scss +3 -3
- package/dist/avatar/styles.d.ts +29 -1
- package/dist/avatar/styles.js.map +1 -1
- package/dist/badge/_badge.scss +10 -2
- package/dist/box/_box.scss +78 -11
- package/dist/box/styles.d.ts +26 -3
- package/dist/box/styles.js.map +1 -1
- package/dist/button/AsyncButton.d.ts +2 -2
- package/dist/button/AsyncButton.js.map +1 -1
- package/dist/button/Button.d.ts +1 -1
- package/dist/button/Button.js.map +1 -1
- package/dist/button/_button.scss +21 -11
- package/dist/card/CardHeader.d.ts +1 -1
- package/dist/card/CardHeader.js.map +1 -1
- package/dist/card/_card.scss +9 -7
- package/dist/chip/Chip.d.ts +1 -1
- package/dist/chip/Chip.js.map +1 -1
- package/dist/chip/_chip.scss +9 -7
- package/dist/dialog/Dialog.d.ts +1 -1
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/_dialog.scss +7 -6
- package/dist/divider/_divider.scss +3 -2
- package/dist/expansion-panel/ExpansionPanel.d.ts +1 -1
- package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanelHeader.d.ts +1 -1
- package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
- package/dist/expansion-panel/_expansion-panel.scss +4 -3
- package/dist/files/FileInput.d.ts +1 -1
- package/dist/files/FileInput.js.map +1 -1
- package/dist/form/FormMessageContainer.d.ts +1 -1
- package/dist/form/FormMessageContainer.js.map +1 -1
- package/dist/form/InputToggle.d.ts +2 -2
- package/dist/form/InputToggle.js.map +1 -1
- package/dist/form/NativeSelect.d.ts +1 -1
- package/dist/form/NativeSelect.js.map +1 -1
- package/dist/form/OptGroup.d.ts +1 -1
- package/dist/form/OptGroup.js.map +1 -1
- package/dist/form/Password.d.ts +1 -1
- package/dist/form/Password.js.map +1 -1
- package/dist/form/Select.d.ts +2 -2
- package/dist/form/Select.js.map +1 -1
- package/dist/form/Slider.d.ts +1 -1
- package/dist/form/Slider.js.map +1 -1
- package/dist/form/Switch.d.ts +3 -3
- package/dist/form/Switch.js.map +1 -1
- package/dist/form/SwitchTrack.d.ts +1 -1
- package/dist/form/SwitchTrack.js.map +1 -1
- package/dist/form/TextArea.d.ts +2 -2
- package/dist/form/TextArea.js +1 -1
- package/dist/form/TextArea.js.map +1 -1
- package/dist/form/TextField.d.ts +1 -1
- package/dist/form/TextField.js.map +1 -1
- package/dist/form/_form-message.scss +4 -3
- package/dist/form/_input-toggle.scss +2 -1
- package/dist/form/_label.scss +3 -2
- package/dist/form/_password.scss +2 -1
- package/dist/form/_select.scss +4 -4
- package/dist/form/_slider.scss +4 -3
- package/dist/form/_switch.scss +2 -1
- package/dist/form/_text-area.scss +3 -2
- package/dist/form/_text-field.scss +20 -16
- package/dist/form/types.d.ts +5 -5
- package/dist/form/types.js.map +1 -1
- package/dist/form/utils.js +1 -0
- package/dist/form/utils.js.map +1 -1
- package/dist/icon/_icon.scss +2 -1
- package/dist/interaction/useElementInteraction.js +1 -1
- package/dist/interaction/useElementInteraction.js.map +1 -1
- package/dist/layout/LayoutAppBar.d.ts +1 -1
- package/dist/layout/LayoutAppBar.js.map +1 -1
- package/dist/layout/LayoutNav.js +1 -1
- package/dist/layout/LayoutNav.js.map +1 -1
- package/dist/layout/useMainTabIndex.js +1 -0
- package/dist/layout/useMainTabIndex.js.map +1 -1
- package/dist/link/_link.scss +3 -2
- package/dist/list/ListItemLink.d.ts +1 -1
- package/dist/list/ListItemLink.js.map +1 -1
- package/dist/list/ListItemText.d.ts +1 -1
- package/dist/list/ListItemText.js.map +1 -1
- package/dist/list/ListSubheader.d.ts +1 -1
- package/dist/list/ListSubheader.js.map +1 -1
- package/dist/list/_list.scss +7 -6
- package/dist/list/types.d.ts +2 -2
- package/dist/list/types.js.map +1 -1
- package/dist/menu/Menu.d.ts +3 -3
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/MenuItemInputToggle.d.ts +2 -2
- package/dist/menu/MenuItemInputToggle.js.map +1 -1
- package/dist/menu/MenuItemTextField.d.ts +1 -1
- package/dist/menu/MenuItemTextField.js.map +1 -1
- package/dist/menu/MenuSheet.d.ts +1 -1
- package/dist/menu/MenuSheet.js.map +1 -1
- package/dist/menu/_menu.scss +2 -1
- package/dist/navigation/CollapsibleNavGroup.d.ts +2 -2
- package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
- package/dist/navigation/NavItemLink.d.ts +1 -1
- package/dist/navigation/NavItemLink.js.map +1 -1
- package/dist/navigation/_navigation.scss +5 -3
- package/dist/progress/CircularProgress.d.ts +2 -17
- package/dist/progress/CircularProgress.js +19 -23
- package/dist/progress/CircularProgress.js.map +1 -1
- package/dist/progress/LinearProgress.d.ts +5 -1
- package/dist/progress/LinearProgress.js +13 -25
- package/dist/progress/LinearProgress.js.map +1 -1
- package/dist/progress/circularProgressStyles.d.ts +62 -0
- package/dist/progress/circularProgressStyles.js +38 -0
- package/dist/progress/circularProgressStyles.js.map +1 -0
- package/dist/progress/linearProgressStyles.d.ts +38 -0
- package/dist/progress/linearProgressStyles.js +38 -0
- package/dist/progress/linearProgressStyles.js.map +1 -0
- package/dist/responsive-item/_responsive-item.scss +2 -1
- package/dist/searching/caseInsensitive.d.ts +20 -4
- package/dist/searching/caseInsensitive.js +5 -1
- package/dist/searching/caseInsensitive.js.map +1 -1
- package/dist/searching/fuzzy.d.ts +3 -3
- package/dist/searching/fuzzy.js +5 -1
- package/dist/searching/fuzzy.js.map +1 -1
- package/dist/searching/utils.d.ts +2 -1
- package/dist/searching/utils.js +11 -2
- package/dist/searching/utils.js.map +1 -1
- package/dist/segmented-button/_segmented-button.scss +20 -13
- package/dist/sheet/_sheet.scss +2 -1
- package/dist/snackbar/Toast.d.ts +1 -1
- package/dist/snackbar/Toast.js.map +1 -1
- package/dist/snackbar/_snackbar.scss +12 -10
- package/dist/table/TableCell.d.ts +1 -1
- package/dist/table/TableCell.js.map +1 -1
- package/dist/table/TableCheckbox.d.ts +1 -1
- package/dist/table/TableCheckbox.js.map +1 -1
- package/dist/table/TableRadio.d.ts +1 -1
- package/dist/table/TableRadio.js.map +1 -1
- package/dist/table/_table.scss +5 -4
- package/dist/tabs/TabListScrollButton.d.ts +1 -1
- package/dist/tabs/TabListScrollButton.js.map +1 -1
- package/dist/tabs/_tabs.scss +7 -4
- package/dist/theme/utils.js +2 -2
- package/dist/theme/utils.js.map +1 -1
- package/dist/tooltip/_tooltip.scss +52 -25
- package/dist/transition/_transition.scss +2 -1
- package/dist/tree/TreeItem.d.ts +2 -2
- package/dist/tree/TreeItem.js.map +1 -1
- package/dist/tree/_tree.scss +1 -1
- package/dist/types.d.ts +29 -2
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/alphaNumericSort.d.ts +9 -9
- package/dist/utils/alphaNumericSort.js +5 -1
- package/dist/utils/alphaNumericSort.js.map +1 -1
- package/dist/utils/bem.js +1 -1
- package/dist/utils/bem.js.map +1 -1
- package/dist/utils/parseCssLengthUnit.js +3 -0
- package/dist/utils/parseCssLengthUnit.js.map +1 -1
- package/package.json +13 -13
- package/src/RootHtml.tsx +1 -1
- package/src/app-bar/styles.ts +1 -1
- package/src/autocomplete/defaults.ts +5 -12
- package/src/autocomplete/types.ts +9 -12
- package/src/avatar/Avatar.tsx +2 -2
- package/src/avatar/styles.ts +53 -1
- package/src/box/styles.ts +34 -13
- package/src/button/AsyncButton.tsx +2 -2
- package/src/button/Button.tsx +1 -1
- package/src/card/CardHeader.tsx +1 -1
- package/src/chip/Chip.tsx +1 -1
- package/src/dialog/Dialog.tsx +1 -4
- package/src/expansion-panel/ExpansionPanel.tsx +1 -1
- package/src/expansion-panel/ExpansionPanelHeader.tsx +1 -1
- package/src/files/FileInput.tsx +1 -4
- package/src/form/FormMessageContainer.tsx +1 -1
- package/src/form/InputToggle.tsx +2 -5
- package/src/form/NativeSelect.tsx +1 -1
- package/src/form/OptGroup.tsx +1 -4
- package/src/form/Password.tsx +1 -1
- package/src/form/Select.tsx +2 -3
- package/src/form/Slider.tsx +1 -1
- package/src/form/Switch.tsx +3 -3
- package/src/form/SwitchTrack.tsx +1 -1
- package/src/form/TextArea.tsx +3 -6
- package/src/form/TextField.tsx +1 -1
- package/src/form/types.ts +5 -15
- package/src/form/utils.ts +1 -0
- package/src/interaction/useElementInteraction.tsx +1 -1
- package/src/layout/LayoutAppBar.tsx +1 -1
- package/src/layout/LayoutNav.tsx +1 -1
- package/src/layout/useMainTabIndex.ts +1 -0
- package/src/list/ListItemLink.tsx +1 -1
- package/src/list/ListItemText.tsx +1 -4
- package/src/list/ListSubheader.tsx +1 -1
- package/src/list/types.ts +2 -5
- package/src/menu/Menu.tsx +3 -4
- package/src/menu/MenuItemInputToggle.tsx +2 -2
- package/src/menu/MenuItemTextField.tsx +1 -1
- package/src/menu/MenuSheet.tsx +1 -1
- package/src/navigation/CollapsibleNavGroup.tsx +2 -2
- package/src/navigation/NavItemLink.tsx +1 -1
- package/src/progress/CircularProgress.tsx +31 -53
- package/src/progress/LinearProgress.tsx +27 -40
- package/src/progress/circularProgressStyles.ts +114 -0
- package/src/progress/linearProgressStyles.ts +90 -0
- package/src/searching/caseInsensitive.ts +29 -7
- package/src/searching/fuzzy.ts +12 -6
- package/src/searching/utils.ts +13 -2
- package/src/snackbar/Toast.tsx +1 -1
- package/src/table/TableCell.tsx +1 -4
- package/src/table/TableCheckbox.tsx +1 -1
- package/src/table/TableRadio.tsx +1 -1
- package/src/tabs/TabListScrollButton.tsx +1 -1
- package/src/theme/utils.ts +2 -1
- package/src/tree/TreeItem.tsx +2 -2
- package/src/types.ts +44 -2
- package/src/utils/alphaNumericSort.ts +17 -11
- package/src/utils/bem.ts +1 -1
- package/src/utils/parseCssLengthUnit.ts +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import {\n type HTMLAttributes,\n type ImgHTMLAttributes,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { type AvatarClassNameOptions, avatar, avatarImage } from \"./styles.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-avatar-background-color\"?: string;\n \"--rmd-avatar-color\"?: string;\n \"--rmd-avatar-border-color\"?: string;\n \"--rmd-avatar-border-radius\"?: string | number;\n \"--rmd-avatar-size\"?: string | number;\n \"--rmd-avatar-font-size\"?: string | number;\n }\n}\n\nexport type AvatarImgAttributes = ImgHTMLAttributes<HTMLImageElement>;\n\n/**\n * @since 6.0.0 `aria-hidden` is set to `true` by default and removed\n * the `role=\"presentation\"`.\n */\nexport interface AvatarProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"color\">,\n AvatarClassNameOptions {\n /**\n * Since avatars are normally presentational data, they are hidden from screen\n * readers by default.\n *\n * @defaultValue `true`\n */\n \"aria-hidden\"?: HTMLAttributes<HTMLSpanElement>[\"aria-hidden\"];\n\n /**\n * This should be an image `src` attribute to create an avatar from. When this\n * prop is defined, you should not add any children to the avatar as the\n * positioning will break.\n */\n src?: string;\n\n /**\n * An optional alt tag to display on the `<img>` when the `src` prop is also\n * applied.\n *\n * For accessibility and screen readers, you normally do not want to actually\n * provide this prop. This should only be used if the `Avatar` is not\n * accompanied by some other component or main content as it will be extra\n * noise for screen readers.\n *\n * @defaultValue `\"\"`\n */\n alt?: string;\n\n /**\n * An optional `referrerPolicy` to provide to the `<img>` element if the `src`\n * or `imgProps` props are provided.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-referrerpolicy|Referrer Policy}\n *\n * @since 2.2.0\n */\n referrerPolicy?: AvatarImgAttributes[\"referrerPolicy\"];\n\n /**\n * An optional object of image props and ref that can be used to create an\n * image within the `Avatar`. This can be useful to add a custom `style`\n * or`className` to the `<img>` element if that additional customization is\n * needed.\n *\n * Note: The values in this object will override the `src`, `alt`, and\n * `referrerPolicy` root level avatar props if they exist on this object.\n *\n * @since 2.2.0\n */\n imgProps?: PropsWithRef<AvatarImgAttributes
|
|
1
|
+
{"version":3,"sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import {\n type HTMLAttributes,\n type ImgHTMLAttributes,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { type AvatarClassNameOptions, avatar, avatarImage } from \"./styles.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-avatar-background-color\"?: string;\n \"--rmd-avatar-color\"?: string;\n \"--rmd-avatar-border-color\"?: string;\n \"--rmd-avatar-border-radius\"?: string | number;\n \"--rmd-avatar-size\"?: string | number;\n \"--rmd-avatar-font-size\"?: string | number;\n }\n}\n\nexport type AvatarImgAttributes = ImgHTMLAttributes<HTMLImageElement>;\n\n/**\n * @since 6.0.0 `aria-hidden` is set to `true` by default and removed\n * the `role=\"presentation\"`.\n */\nexport interface AvatarProps\n extends Omit<HTMLAttributes<HTMLSpanElement>, \"color\">,\n AvatarClassNameOptions {\n /**\n * Since avatars are normally presentational data, they are hidden from screen\n * readers by default.\n *\n * @defaultValue `true`\n */\n \"aria-hidden\"?: HTMLAttributes<HTMLSpanElement>[\"aria-hidden\"];\n\n /**\n * This should be an image `src` attribute to create an avatar from. When this\n * prop is defined, you should not add any children to the avatar as the\n * positioning will break.\n */\n src?: string;\n\n /**\n * An optional alt tag to display on the `<img>` when the `src` prop is also\n * applied.\n *\n * For accessibility and screen readers, you normally do not want to actually\n * provide this prop. This should only be used if the `Avatar` is not\n * accompanied by some other component or main content as it will be extra\n * noise for screen readers.\n *\n * @defaultValue `\"\"`\n */\n alt?: string;\n\n /**\n * An optional `referrerPolicy` to provide to the `<img>` element if the `src`\n * or `imgProps` props are provided.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-referrerpolicy|Referrer Policy}\n *\n * @since 2.2.0\n */\n referrerPolicy?: AvatarImgAttributes[\"referrerPolicy\"];\n\n /**\n * An optional object of image props and ref that can be used to create an\n * image within the `Avatar`. This can be useful to add a custom `style`\n * or`className` to the `<img>` element if that additional customization is\n * needed.\n *\n * Note: The values in this object will override the `src`, `alt`, and\n * `referrerPolicy` root level avatar props if they exist on this object.\n *\n * @since 2.2.0\n */\n imgProps?: PropsWithRef<AvatarImgAttributes>;\n}\n\n/**\n * An `Avatar` is generally used to represent objects or people within your app.\n * The avatar can consist of an image, an icon, or some text to display. When\n * the avatar is not an image, different themes can be applied to make the\n * avatar more unique.\n *\n * @example Simple Example\n * ```tsx\n * import { Avatar } from \"@react-md/core/avatar/Avatar\";\n * import { type ReactElement } from \"react\";\n *\n * export function Example(): ReactElement {\n * return <Avatar src=\"/path-to-img.png\" />;\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/avatar | Avatar Demos}\n * @since 6.0.0 `aria-hidden` is set to `true` by default.\n */\nexport const Avatar = forwardRef<HTMLSpanElement, AvatarProps>(\n function Avatar(props, ref) {\n const {\n \"aria-hidden\": ariaHidden = true,\n className,\n children,\n src,\n alt = \"\",\n size = \"avatar\",\n color,\n theme,\n imgProps,\n referrerPolicy,\n ...remaining\n } = props;\n\n let img: ReactNode;\n if (src || imgProps) {\n img = (\n <img\n src={src}\n alt={alt}\n referrerPolicy={referrerPolicy}\n {...imgProps}\n className={avatarImage({ className: imgProps?.className })}\n />\n );\n }\n\n return (\n <span\n {...remaining}\n aria-hidden={ariaHidden}\n ref={ref}\n className={avatar({\n size,\n color,\n theme,\n className,\n })}\n >\n {img}\n {children}\n </span>\n );\n }\n);\n"],"names":["forwardRef","avatar","avatarImage","Avatar","props","ref","ariaHidden","className","children","src","alt","size","color","theme","imgProps","referrerPolicy","remaining","img","span","aria-hidden"],"mappings":";AAAA,SAIEA,UAAU,QACL,QAAQ;AAGf,SAAsCC,MAAM,EAAEC,WAAW,QAAQ,cAAc;AA0E/E;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,MAAMC,uBAASH,WACpB,SAASG,OAAOC,KAAK,EAAEC,GAAG;IACxB,MAAM,EACJ,eAAeC,aAAa,IAAI,EAChCC,SAAS,EACTC,QAAQ,EACRC,GAAG,EACHC,MAAM,EAAE,EACRC,OAAO,QAAQ,EACfC,KAAK,EACLC,KAAK,EACLC,QAAQ,EACRC,cAAc,EACd,GAAGC,WACJ,GAAGZ;IAEJ,IAAIa;IACJ,IAAIR,OAAOK,UAAU;QACnBG,oBACE,KAACA;YACCR,KAAKA;YACLC,KAAKA;YACLK,gBAAgBA;YACf,GAAGD,QAAQ;YACZP,WAAWL,YAAY;gBAAEK,WAAWO,UAAUP;YAAU;;IAG9D;IAEA,qBACE,MAACW;QACE,GAAGF,SAAS;QACbG,eAAab;QACbD,KAAKA;QACLE,WAAWN,OAAO;YAChBU;YACAC;YACAC;YACAN;QACF;;YAECU;YACAT;;;AAGP,GACA"}
|
package/dist/avatar/_avatar.scss
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
@use "sass:map";
|
|
7
7
|
@use "sass:math";
|
|
8
8
|
@use "../utils";
|
|
9
|
+
@use "../border-radius";
|
|
9
10
|
@use "../theme/colors";
|
|
10
11
|
@use "../typography/typography";
|
|
11
12
|
@use "../icon/icon";
|
|
@@ -53,7 +54,7 @@ $border-color: transparent !default;
|
|
|
53
54
|
/// set this to something like 0.25rem.
|
|
54
55
|
///
|
|
55
56
|
/// @type Number
|
|
56
|
-
$border-radius:
|
|
57
|
+
$border-radius: border-radius.get-var(full) !default;
|
|
57
58
|
|
|
58
59
|
/// The default height and width
|
|
59
60
|
/// @type Number
|
|
@@ -178,7 +179,6 @@ $variables: (
|
|
|
178
179
|
@include set-var(background-color, $background-color);
|
|
179
180
|
@include set-var(color, $color);
|
|
180
181
|
@include set-var(border-color, $border-color);
|
|
181
|
-
@include set-var(border-radius, $border-radius);
|
|
182
182
|
@include set-var(size, $size);
|
|
183
183
|
@include set-var(font-size, $font-size);
|
|
184
184
|
}
|
|
@@ -198,7 +198,7 @@ $variables: (
|
|
|
198
198
|
}
|
|
199
199
|
@include utils.map-to-styles(typography.$base-font-styles);
|
|
200
200
|
@include use-var(background-color);
|
|
201
|
-
@include use-var(border-radius);
|
|
201
|
+
@include use-var(border-radius, $fallback: $border-radius);
|
|
202
202
|
@include use-var(color);
|
|
203
203
|
@include use-var(font-size);
|
|
204
204
|
@include use-var(height, size);
|
package/dist/avatar/styles.d.ts
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
import { type ThemeColor } from "../cssUtils.js";
|
|
2
|
+
import { type OverridableStringUnion } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* @since 6.2.0
|
|
5
|
+
*/
|
|
6
|
+
export interface AvatarColorOverrides {
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @since 6.2.0
|
|
10
|
+
*/
|
|
11
|
+
export type DefaultAvatarColors = "red" | "pink" | "purple" | "deep-purple" | "indigo" | "blue" | "light-blue" | "cyan" | "teal" | "green" | "light-green" | "lime" | "yellow" | "amber" | "orange" | "deep-orange" | "brown" | "grey" | "blue-grey";
|
|
12
|
+
/**
|
|
13
|
+
* The avatar available colors can be configured using module augmentation:
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* declare module "@react-md/core/avatar/styles" {
|
|
17
|
+
* interface AvatarColorOverrides {
|
|
18
|
+
* "light-blue": false;
|
|
19
|
+
* brandColor: true;
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* This would remove the support for the `light-blue` color and enable
|
|
25
|
+
* `brandColor`.
|
|
26
|
+
*
|
|
27
|
+
* @since 6.2.0
|
|
28
|
+
*/
|
|
29
|
+
export type AvatarColor = OverridableStringUnion<DefaultAvatarColors, AvatarColorOverrides>;
|
|
2
30
|
/** @since 6.0.0 */
|
|
3
31
|
export interface AvatarClassNameOptions {
|
|
4
32
|
className?: string;
|
|
@@ -12,7 +40,7 @@ export interface AvatarClassNameOptions {
|
|
|
12
40
|
* @see {@link theme}
|
|
13
41
|
* @defaultValue `""`
|
|
14
42
|
*/
|
|
15
|
-
color?:
|
|
43
|
+
color?: AvatarColor;
|
|
16
44
|
/**
|
|
17
45
|
* @defaultValue `"avatar"`
|
|
18
46
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/avatar/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { type ThemeColor, cssUtils } from \"../cssUtils.js\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-avatar\");\n\n/** @since 6.0.0 */\nexport interface AvatarClassNameOptions {\n className?: string;\n\n /**\n * An optional color to apply to the avatar. This will apply a className of\n * `rmd-avatar--${color}`, so only the keys from the `$rmd-avatar-colors` Map\n * are supported by default. It is recommended to create custom colors using\n * the `rmd-avatar-theme-update-var` mixin with custom class names if the\n * default colors aren't extensive enough.\n *\n * @see {@link theme}\n * @defaultValue `\"\"`\n */\n color?:
|
|
1
|
+
{"version":3,"sources":["../../src/avatar/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { type ThemeColor, cssUtils } from \"../cssUtils.js\";\nimport { type OverridableStringUnion } from \"../types.js\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-avatar\");\n\n/**\n * @since 6.2.0\n */\nexport interface AvatarColorOverrides {}\n\n/**\n * @since 6.2.0\n */\nexport type DefaultAvatarColors =\n | \"red\"\n | \"pink\"\n | \"purple\"\n | \"deep-purple\"\n | \"indigo\"\n | \"blue\"\n | \"light-blue\"\n | \"cyan\"\n | \"teal\"\n | \"green\"\n | \"light-green\"\n | \"lime\"\n | \"yellow\"\n | \"amber\"\n | \"orange\"\n | \"deep-orange\"\n | \"brown\"\n | \"grey\"\n | \"blue-grey\";\n\n/**\n * The avatar available colors can be configured using module augmentation:\n *\n * ```ts\n * declare module \"@react-md/core/avatar/styles\" {\n * interface AvatarColorOverrides {\n * \"light-blue\": false;\n * brandColor: true;\n * }\n * }\n * ```\n *\n * This would remove the support for the `light-blue` color and enable\n * `brandColor`.\n *\n * @since 6.2.0\n */\nexport type AvatarColor = OverridableStringUnion<\n DefaultAvatarColors,\n AvatarColorOverrides\n>;\n\n/** @since 6.0.0 */\nexport interface AvatarClassNameOptions {\n className?: string;\n\n /**\n * An optional color to apply to the avatar. This will apply a className of\n * `rmd-avatar--${color}`, so only the keys from the `$rmd-avatar-colors` Map\n * are supported by default. It is recommended to create custom colors using\n * the `rmd-avatar-theme-update-var` mixin with custom class names if the\n * default colors aren't extensive enough.\n *\n * @see {@link theme}\n * @defaultValue `\"\"`\n */\n color?: AvatarColor;\n\n /**\n * @defaultValue `\"avatar\"`\n */\n size?: \"avatar\" | \"icon\";\n\n /**\n * This can be used instead of {@link color} to set the background color to one of\n * the theme colors. This will also set the text color to either be `#000` or\n * `#fff` automatically to enforce the correct aspect ratio.\n */\n theme?: ThemeColor;\n}\n\n/**\n * @since 6.0.0\n */\nexport function avatar(options: AvatarClassNameOptions): string {\n const { className, color = \"\", size, theme } = options;\n\n return cnb(\n styles({ [color]: color, icon: size === \"icon\" }),\n cssUtils({ backgroundColor: theme }),\n className\n );\n}\n\n/** @since 6.0.0 */\nexport interface AvatarImageClassNameOptions {\n className?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport function avatarImage(options: AvatarImageClassNameOptions = {}): string {\n const { className } = options;\n\n return cnb(styles(\"image\"), className);\n}\n"],"names":["cnb","cssUtils","bem","styles","avatar","options","className","color","size","theme","icon","backgroundColor","avatarImage"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAA0BC,QAAQ,QAAQ,iBAAiB;AAE3D,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAkFnB;;CAEC,GACD,OAAO,SAASE,OAAOC,OAA+B;IACpD,MAAM,EAAEC,SAAS,EAAEC,QAAQ,EAAE,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGJ;IAE/C,OAAOL,IACLG,OAAO;QAAE,CAACI,MAAM,EAAEA;QAAOG,MAAMF,SAAS;IAAO,IAC/CP,SAAS;QAAEU,iBAAiBF;IAAM,IAClCH;AAEJ;AAOA;;CAEC,GACD,OAAO,SAASM,YAAYP,UAAuC,CAAC,CAAC;IACnE,MAAM,EAAEC,SAAS,EAAE,GAAGD;IAEtB,OAAOL,IAAIG,OAAO,UAAUG;AAC9B"}
|
package/dist/badge/_badge.scss
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "../utils";
|
|
7
|
+
@use "../border-radius";
|
|
7
8
|
@use "../theme/a11y";
|
|
8
9
|
@use "../theme/colors";
|
|
9
10
|
@use "../theme/theme";
|
|
@@ -60,7 +61,7 @@ $offset-right: $offset !default;
|
|
|
60
61
|
|
|
61
62
|
/// The default border radius
|
|
62
63
|
/// @type Number
|
|
63
|
-
$border-radius:
|
|
64
|
+
$border-radius: border-radius.get-var(full) !default;
|
|
64
65
|
|
|
65
66
|
/// The default typography to use
|
|
66
67
|
/// @type Map
|
|
@@ -110,6 +111,7 @@ $greyscale-color: theme.get-default-color(
|
|
|
110
111
|
/// `get-var`, `set-var`, and `use-var` utils.
|
|
111
112
|
/// @type List
|
|
112
113
|
$variables: (
|
|
114
|
+
border-radius,
|
|
113
115
|
greyscale-background-color,
|
|
114
116
|
greyscale-color,
|
|
115
117
|
size,
|
|
@@ -144,6 +146,12 @@ $variables: (
|
|
|
144
146
|
/// @param {any} fallback [null] - An optional fallback value if the variable
|
|
145
147
|
/// has not been set
|
|
146
148
|
@mixin use-var($property, $name: $property, $fallback: null) {
|
|
149
|
+
@if not $fallback {
|
|
150
|
+
@if $name == border-radius {
|
|
151
|
+
$fallback: $border-radius;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
147
155
|
#{$property}: get-var($name, $fallback);
|
|
148
156
|
}
|
|
149
157
|
|
|
@@ -207,12 +215,12 @@ $variables: (
|
|
|
207
215
|
@include utils.optional-layer(badge, $disable-layer) {
|
|
208
216
|
.rmd-badge {
|
|
209
217
|
@include utils.map-to-styles($typography);
|
|
218
|
+
@include use-var(border-radius);
|
|
210
219
|
@include use-var(height, size);
|
|
211
220
|
@include use-var(width, size);
|
|
212
221
|
@include use-var(top, offset-top, get-var(offset));
|
|
213
222
|
|
|
214
223
|
align-items: center;
|
|
215
|
-
border-radius: $border-radius;
|
|
216
224
|
display: inline-flex;
|
|
217
225
|
justify-content: center;
|
|
218
226
|
pointer-events: none; // badges are _kind_ of presentational and shouldn't trigger mouse events
|
package/dist/box/_box.scss
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "../utils";
|
|
7
|
+
@use "../spacing";
|
|
7
8
|
@use "../media-queries/media-queries";
|
|
8
9
|
|
|
9
10
|
/// Set to `true` to disable all the styles
|
|
@@ -101,7 +102,7 @@ $justify-content: (
|
|
|
101
102
|
|
|
102
103
|
/// The default flex and grid gap to apply between each item
|
|
103
104
|
/// @type Number
|
|
104
|
-
$gap:
|
|
105
|
+
$gap: spacing.get-var(md) !default;
|
|
105
106
|
|
|
106
107
|
/// The default padding to apply to the container.
|
|
107
108
|
/// @type Number
|
|
@@ -157,7 +158,11 @@ $_breakpoints: (
|
|
|
157
158
|
/// @type List
|
|
158
159
|
$variables: (
|
|
159
160
|
gap,
|
|
161
|
+
column-gap,
|
|
162
|
+
row-gap,
|
|
160
163
|
padding,
|
|
164
|
+
padding-v,
|
|
165
|
+
padding-h,
|
|
161
166
|
item-min-size,
|
|
162
167
|
item-min-height,
|
|
163
168
|
columns,
|
|
@@ -182,6 +187,7 @@ $variables: (
|
|
|
182
187
|
/// @returns {String} a `var()` statement
|
|
183
188
|
@function get-var($name, $fallback: null) {
|
|
184
189
|
$var: utils.get-var-name($variables, $name, "box");
|
|
190
|
+
|
|
185
191
|
@if $fallback {
|
|
186
192
|
@return var(#{$var}, #{$fallback});
|
|
187
193
|
}
|
|
@@ -203,6 +209,72 @@ $variables: (
|
|
|
203
209
|
/// @param {any} fallback [null] - An optional fallback value if the variable
|
|
204
210
|
/// has not been set
|
|
205
211
|
@mixin use-var($property, $name: $property, $fallback: null) {
|
|
212
|
+
// these variables define another fallback and are not set at the root so
|
|
213
|
+
// they can easily be overridden. if they have a default value at the root,
|
|
214
|
+
// that root value will be used instead of the lowest defined override.
|
|
215
|
+
//
|
|
216
|
+
// i.e.
|
|
217
|
+
// ```scss
|
|
218
|
+
//
|
|
219
|
+
// :root {
|
|
220
|
+
// --rmd-box-padding: 3rem;
|
|
221
|
+
// --rmd-box-padding-v: var(--rmd-box-padding);
|
|
222
|
+
// --rmd-box-padding-h: var(--rmd-box-padding);
|
|
223
|
+
// }
|
|
224
|
+
//
|
|
225
|
+
// .some-child {
|
|
226
|
+
// --rmd-box-padding: 1rem;
|
|
227
|
+
//
|
|
228
|
+
// }
|
|
229
|
+
// ```
|
|
230
|
+
//
|
|
231
|
+
// `--rmd-box-padding-v` and `--rmd-box-padding-h` would still have a value
|
|
232
|
+
// of `1rem`
|
|
233
|
+
@if not $fallback {
|
|
234
|
+
@if $name == padding-v or $name == padding-h {
|
|
235
|
+
$fallback: get-var(padding);
|
|
236
|
+
} @else if $name == column-gap or $name == row-gap {
|
|
237
|
+
$fallback: get-var(gap);
|
|
238
|
+
} @else if
|
|
239
|
+
$name ==
|
|
240
|
+
phone-columns or
|
|
241
|
+
$name ==
|
|
242
|
+
tablet-columns or
|
|
243
|
+
$name ==
|
|
244
|
+
desktop-columns or
|
|
245
|
+
$name ==
|
|
246
|
+
large-desktop-columns
|
|
247
|
+
{
|
|
248
|
+
$fallback: get-var(columns);
|
|
249
|
+
} @else if
|
|
250
|
+
$name ==
|
|
251
|
+
phone-item-min-height or
|
|
252
|
+
$name ==
|
|
253
|
+
tablet-item-min-height or
|
|
254
|
+
$name ==
|
|
255
|
+
desktop-item-min-height or
|
|
256
|
+
$name ==
|
|
257
|
+
large-desktop-item-min-height
|
|
258
|
+
{
|
|
259
|
+
$fallback: get-var(item-min-height);
|
|
260
|
+
} @else if
|
|
261
|
+
$name ==
|
|
262
|
+
phone-size or
|
|
263
|
+
$name ==
|
|
264
|
+
tablet-size or
|
|
265
|
+
$name ==
|
|
266
|
+
desktop-size or
|
|
267
|
+
$name ==
|
|
268
|
+
large-desktop-size
|
|
269
|
+
{
|
|
270
|
+
$fallback: get-var(size);
|
|
271
|
+
} @else if $name == gap {
|
|
272
|
+
$fallback: $gap;
|
|
273
|
+
} @else if $name == padding {
|
|
274
|
+
$fallback: $padding;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
206
278
|
#{$property}: get-var($name, $fallback);
|
|
207
279
|
}
|
|
208
280
|
|
|
@@ -259,14 +331,8 @@ $variables: (
|
|
|
259
331
|
/// Conditionally applies the css variables based on feature flags
|
|
260
332
|
@mixin variables {
|
|
261
333
|
@if not $disable-everything {
|
|
262
|
-
@include set-var(gap, $gap);
|
|
263
|
-
@include set-var(padding, $padding);
|
|
264
334
|
@include set-var(item-min-size, $item-min-size);
|
|
265
335
|
@include set-var(columns, auto-fit);
|
|
266
|
-
@include set-var(phone-columns, auto-fit);
|
|
267
|
-
@include set-var(tablet-columns, auto-fit);
|
|
268
|
-
@include set-var(desktop-columns, auto-fit);
|
|
269
|
-
@include set-var(large-desktop-columns, auto-fit);
|
|
270
336
|
}
|
|
271
337
|
}
|
|
272
338
|
|
|
@@ -282,19 +348,20 @@ $variables: (
|
|
|
282
348
|
display: flex;
|
|
283
349
|
|
|
284
350
|
&--gap {
|
|
285
|
-
@include use-var(gap
|
|
351
|
+
@include use-var(gap);
|
|
286
352
|
}
|
|
287
353
|
|
|
288
354
|
&--gap-h {
|
|
289
|
-
@include use-var(column-gap
|
|
355
|
+
@include use-var(column-gap);
|
|
290
356
|
}
|
|
291
357
|
|
|
292
358
|
&--gap-v {
|
|
293
|
-
@include use-var(row-gap
|
|
359
|
+
@include use-var(row-gap);
|
|
294
360
|
}
|
|
295
361
|
|
|
296
362
|
&--padded {
|
|
297
|
-
|
|
363
|
+
padding: get-var(padding-v, get-var(padding, $padding))
|
|
364
|
+
get-var(padding-h, get-var(padding, $padding));
|
|
298
365
|
}
|
|
299
366
|
|
|
300
367
|
&--wrap {
|
package/dist/box/styles.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties } from "react";
|
|
2
|
+
import { type IsEmptyObject, type OverridableStringUnion } from "../types.js";
|
|
2
3
|
declare module "react" {
|
|
3
4
|
interface CSSProperties {
|
|
4
5
|
"--rmd-box-gap"?: string | number;
|
|
@@ -15,14 +16,23 @@ declare module "react" {
|
|
|
15
16
|
"--rmd-box-large-desktop-item-min-size"?: number | string;
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
/** @since 6.2.0 */
|
|
20
|
+
export interface BoxAlignItemsOverrides {
|
|
21
|
+
}
|
|
22
|
+
/** @since 6.2.0 */
|
|
23
|
+
export interface BoxJustifyContentOverrides {
|
|
24
|
+
}
|
|
25
|
+
/** @since 6.2.0 */
|
|
26
|
+
export interface BoxGridNameOverrides {
|
|
27
|
+
}
|
|
18
28
|
/**
|
|
19
29
|
* @since 6.0.0
|
|
20
30
|
*/
|
|
21
|
-
export type BoxAlignItems = "start" | "flex-start" | "center" | "end" | "flex-end" | "stretch"
|
|
31
|
+
export type BoxAlignItems = OverridableStringUnion<"start" | "flex-start" | "center" | "end" | "flex-end" | "stretch", BoxAlignItemsOverrides>;
|
|
22
32
|
/**
|
|
23
33
|
* @since 6.0.0
|
|
24
34
|
*/
|
|
25
|
-
export type BoxJustifyContent = BoxAlignItems | "space-around" | "space-between" | "space-evenly"
|
|
35
|
+
export type BoxJustifyContent = OverridableStringUnion<BoxAlignItems | "space-around" | "space-between" | "space-evenly", BoxJustifyContentOverrides>;
|
|
26
36
|
/**
|
|
27
37
|
* @since 6.0.0
|
|
28
38
|
*/
|
|
@@ -31,6 +41,10 @@ export type BoxFlexDirection = "row" | "column";
|
|
|
31
41
|
* @since 6.0.0
|
|
32
42
|
*/
|
|
33
43
|
export type BoxGridColumns = "fit" | "fill" | number;
|
|
44
|
+
/**
|
|
45
|
+
* @since 6.2.0
|
|
46
|
+
*/
|
|
47
|
+
export type BoxGridName = IsEmptyObject<BoxGridNameOverrides> extends true ? string : OverridableStringUnion<never, BoxGridNameOverrides>;
|
|
34
48
|
/**
|
|
35
49
|
* @since 6.0.0
|
|
36
50
|
*/
|
|
@@ -101,11 +115,20 @@ export interface BoxOptions {
|
|
|
101
115
|
* );
|
|
102
116
|
* ```
|
|
103
117
|
*
|
|
118
|
+
* ```ts
|
|
119
|
+
* declare module "@react-md/core/box/styles" {
|
|
120
|
+
* interface BoxGridNameOverrides {
|
|
121
|
+
* small: true;
|
|
122
|
+
* medium: true;
|
|
123
|
+
* }
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
104
127
|
* The `gridName` should be `"small" | "medium"`.
|
|
105
128
|
*
|
|
106
129
|
* @defaultValue `""`
|
|
107
130
|
*/
|
|
108
|
-
gridName?:
|
|
131
|
+
gridName?: BoxGridName;
|
|
109
132
|
/**
|
|
110
133
|
* The default behavior for a grid is to automatically determine the number
|
|
111
134
|
* of columns to render by placing as many items as possible with a specific
|
package/dist/box/styles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/box/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type CSSProperties } from \"react\";\n\nimport { type DefinedCSSVariableName } from \"../theme/types.js\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-box\");\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-box-gap\"?: string | number;\n \"--rmd-box-padding\"?: string | number;\n \"--rmd-box-item-min-size\"?: string | number;\n \"--rmd-box-columns\"?: string | number;\n \"--rmd-box-phone-columns\"?: number | string;\n \"--rmd-box-phone-item-min-size\"?: number | string;\n \"--rmd-box-tablet-columns\"?: number | string;\n \"--rmd-box-tablet-item-min-size\"?: number | string;\n \"--rmd-box-desktop-columns\"?: number | string;\n \"--rmd-box-desktop-item-min-size\"?: number | string;\n \"--rmd-box-large-desktop-columns\"?: number | string;\n \"--rmd-box-large-desktop-item-min-size\"?: number | string;\n }\n}\n\n/**\n * @since 6.0.0\n */\nexport type BoxAlignItems =\n | \"start\"\n | \"flex-start\"\n | \"center\"\n | \"end\"\n | \"flex-end\"\n | \"stretch\";\n\n/**\n * @since 6.0.0\n */\nexport type BoxJustifyContent =\n | BoxAlignItems\n | \"space-around\"\n | \"space-between\"\n | \"space-evenly\";\n\n/**\n * @since 6.0.0\n */\nexport type BoxFlexDirection = \"row\" | \"column\";\n\n/**\n * @since 6.0.0\n */\nexport type BoxGridColumns = \"fit\" | \"fill\" | number;\n\n/**\n * @since 6.0.0\n */\nexport type BoxBreakpoints = \"phone\" | \"tablet\" | \"desktop\" | \"largeDesktop\";\n\n/**\n * @since 6.0.0\n */\nexport type BoxGridBreakpointColumns = {\n [key in BoxBreakpoints]?: BoxGridColumns;\n};\n\n/**\n * @since 6.0.0\n */\nexport type BoxGridBreakpointItemSize = {\n [key in BoxBreakpoints]?: string;\n};\n\n/**\n * @since 6.0.0\n */\nexport interface BoxOptions {\n className?: string;\n\n /**\n * Set this to `true` to use `display: grid` instead of `display: flex`.\n *\n * @defaultValue `false`\n */\n grid?: boolean;\n\n /**\n * Set this to `true` to apply `width: 100%`. This can be useful when using\n * nested box layouts.\n *\n * @defaultValue `false`\n */\n fullWidth?: boolean;\n\n /**\n * Set this to `true` to prevent gap between items.\n *\n * @defaultValue `false`\n */\n disableGap?: boolean | \"row\" | \"column\";\n\n /**\n * Set this to `true` to set `flex-wrap: nowrap`.\n *\n * @defaultValue `false`\n */\n disableWrap?: boolean;\n\n /**\n * Set this to `true` to disable the default padding.\n *\n * @defaultValue `false`\n */\n disablePadding?: boolean;\n\n /**\n * This should match one of the names in the `$box-grids` map. So for example:\n *\n * ```scss\n * @use \"react-md\" with (\n * $box-grids: (\n * small: (\n * min: 5rem\n * ),\n * medium: (\n * min: 7rem,\n * gap: 0.5rem,\n * padding: 2rem,\n * ),\n * ),\n * );\n * ```\n *\n * The `gridName` should be `\"small\" | \"medium\"`.\n *\n * @defaultValue `\"\"`\n */\n gridName?: string;\n\n /**\n * The default behavior for a grid is to automatically determine the number\n * of columns to render by placing as many items as possible with a specific\n * item min-width and the defined gap between items. Once the number of\n * columns has been determined, place the items in the grid and expand to the\n * full column width.\n *\n * This prop is a convenience prop to control how to display items when there\n * are not enough to span all columns without a separate SCSS file.\n *\n * i.e. 3 items were provided but 4 can be rendered.\n *\n * - `\"fit\"` - fill the entire width with columns and stretch columns to fill\n * the remaining space\n * - `\"fill\"` - fill the entire width with columns and add empty columns to\n * fill the remaining space\n * - `number` - ignore the auto layout behavior and specify the number of\n * columns to use instead.\n *\n * If additional responsive behavior is required, an object can be provided\n * to define the column behavior for: phone, tablet, desktop, or\n * largeDesktop.\n *\n * @see {@link gridItemSize} for how the number of columns are determined.\n * @defaultValue `\"fit\"`\n */\n gridColumns?: BoxGridColumns | BoxGridBreakpointColumns;\n\n /**\n * This prop can be used to override the default `--rmd-box-item-min-size`\n * for the grid without a separate SCSS file. Since this is set as a CSS variable,\n * the value must be a number with a unit to work correctly. i.e. `10rem`\n * instead of `160`.\n *\n * If additional responsive behavior is required, an object can be provided\n * to define the column behavior for: phone, tablet, desktop, or\n * largeDesktop.\n *\n * @see {@link https://react-md.dev/sassdoc/box#variables-box-item-min-size}\n */\n gridItemSize?: string | BoxGridBreakpointItemSize;\n\n /**\n * Set this to `true` to enable equal height rows within the grid based\n * on the current `max-height`. This requires the `max-height` to be set\n * on the `Box` either by:\n *\n * - a custom class name that sets `max-height`\n * - `core.box-set-var(auto-rows-height, VALUE)` on the box or a parent element\n *\n * @defaultValue `false`\n */\n gridAutoRows?: boolean;\n\n /**\n * @defaultValue `\"\"`\n */\n align?: BoxAlignItems;\n\n /**\n * The default value is really `center` or whatever the\n * `$box-default-align-items` is set to.\n *\n * @defaultValue `\"\"`\n */\n justify?: BoxJustifyContent;\n\n /**\n * Set this to `true` to set `flex-direction: column` which will stack all\n * items in the box.\n *\n * @defaultValue `false`\n */\n stacked?: boolean;\n\n /**\n * Set this to `true` to reverse the `flex-direction`. i.e.\n * - `flex-direction: row-reverse`\n * - `flex-direction: column-reverse`\n *\n * @defaultValue `false`\n */\n reversed?: boolean;\n}\n\n/**\n * @see {@link boxStyles}\n * @since 6.0.0\n */\nexport function box(options: BoxOptions = {}): string {\n const {\n className,\n align = \"\",\n grid,\n gridName = \"\",\n gridColumns = \"fit\",\n gridItemSize,\n gridAutoRows,\n justify = \"\",\n stacked,\n reversed,\n fullWidth,\n disableGap,\n disableWrap,\n disablePadding,\n } = options;\n let phoneColumns: BoxGridColumns | undefined;\n let phoneItemSize: string | number | undefined;\n let tabletColumns: BoxGridColumns | undefined;\n let tabletItemSize: string | number | undefined;\n let desktopColumns: BoxGridColumns | undefined;\n let desktopItemSize: string | number | undefined;\n let largeDesktopColumns: BoxGridColumns | undefined;\n let largeDesktopItemSize: string | number | undefined;\n if (gridColumns && typeof gridColumns === \"object\") {\n ({\n phone: phoneColumns,\n tablet: tabletColumns,\n desktop: desktopColumns,\n largeDesktop: largeDesktopColumns,\n } = gridColumns);\n }\n if (gridItemSize && typeof gridItemSize === \"object\") {\n ({\n phone: phoneItemSize,\n tablet: tabletItemSize,\n desktop: desktopItemSize,\n largeDesktop: largeDesktopItemSize,\n } = gridItemSize);\n }\n\n const isItemSizeEnabled = (\n value: string | number | undefined\n ): boolean | undefined => grid && (!!value || value === 0);\n const isColumnsEnabled = (\n value: BoxGridColumns | BoxGridBreakpointColumns | undefined\n ): boolean | undefined => grid && typeof value === \"number\";\n\n return cnb(\n styles({\n gap: !disableGap,\n \"gap-h\": disableGap === \"row\",\n \"gap-v\": disableGap === \"column\",\n wrap: !disableWrap,\n padded: !disablePadding,\n column: stacked && !reversed,\n reverse: !stacked && reversed,\n \"column-reverse\": stacked && reversed,\n \"full-width\": fullWidth,\n grid,\n \"grid-fill\": grid && gridColumns === \"fill\",\n \"grid-size\": isColumnsEnabled(gridColumns),\n \"grid-phone\": grid && (phoneColumns || phoneItemSize),\n \"grid-phone-size\":\n isColumnsEnabled(phoneColumns) || isItemSizeEnabled(phoneItemSize),\n \"grid-tablet\": grid && (tabletColumns || tabletItemSize),\n \"grid-tablet-size\":\n isColumnsEnabled(tabletColumns) || isItemSizeEnabled(tabletItemSize),\n \"grid-desktop\": grid && (desktopColumns || desktopItemSize),\n \"grid-desktop-size\":\n isColumnsEnabled(desktopColumns) || isItemSizeEnabled(desktopItemSize),\n \"grid-large-desktop\":\n grid && (largeDesktopColumns || largeDesktopItemSize),\n \"grid-large-desktop-size\":\n isColumnsEnabled(largeDesktopColumns) ||\n isItemSizeEnabled(largeDesktopItemSize),\n \"grid-auto-rows\": grid && gridAutoRows,\n [gridName]: grid && gridName,\n \"align-start\": align === \"start\" || align === \"flex-start\",\n \"align-center\": align === \"center\",\n \"align-end\": align === \"end\" || align === \"flex-end\",\n \"align-stretch\": align === \"stretch\",\n \"justify-center\": justify === \"center\",\n \"justify-start\": justify === \"start\" || justify === \"flex-start\",\n \"justify-end\": justify === \"end\" || justify === \"flex-end\",\n \"justify-stretch\": justify === \"stretch\",\n \"justify-around\": justify === \"space-around\",\n \"justify-between\": justify === \"space-between\",\n \"justify-evenly\": justify === \"space-evenly\",\n }),\n className\n );\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\ninterface ApplyOptions {\n media: keyof BoxGridBreakpointColumns | \"\";\n style: CSSProperties | undefined;\n type: \"columns\" | \"size\";\n value:\n | BoxGridColumns\n | BoxGridBreakpointColumns\n | string\n | BoxGridBreakpointItemSize\n | undefined;\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nfunction applyBoxVar(options: ApplyOptions): CSSProperties | undefined {\n const { type, media, style, value } = options;\n const expectedType = type === \"columns\" ? \"number\" : \"string\";\n if (typeof value !== expectedType) {\n return style;\n }\n\n const suffix = type === \"columns\" ? type : \"item-min-size\";\n let varName: DefinedCSSVariableName = `--rmd-box-${suffix}`;\n if (media === \"largeDesktop\") {\n varName = `--rmd-box-large-desktop-${suffix}`;\n } else if (media) {\n varName = `--rmd-box-${media}-${suffix}`;\n }\n\n return {\n ...style,\n [varName]: value,\n };\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nconst BREAKPOINTS = [\"phone\", \"tablet\", \"desktop\", \"largeDesktop\"] as const;\n\n/**\n * @since 6.0.0\n * @internal\n */\nfunction applyBoxVarGroup(\n options: Pick<ApplyOptions, \"value\" | \"style\" | \"type\">\n): CSSProperties | undefined {\n const { style: propStyle, value, type } = options;\n let style = applyBoxVar({\n type,\n style: propStyle,\n media: \"\",\n value,\n });\n if (value && typeof value === \"object\") {\n BREAKPOINTS.forEach((media) => {\n style = applyBoxVar({\n type,\n style,\n media,\n value: value[media],\n });\n });\n }\n return style;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface BoxStyles {\n style?: CSSProperties;\n className: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface BoxStylesOptions extends BoxOptions {\n style?: CSSProperties;\n}\n\n/**\n * @see {@link box}\n * @since 6.0.0\n */\nexport function boxStyles(options: BoxStylesOptions): BoxStyles {\n const { style: propStyle, gridColumns, gridItemSize } = options;\n let style = applyBoxVarGroup({\n type: \"columns\",\n style: propStyle,\n value: gridColumns,\n });\n style = applyBoxVarGroup({\n type: \"size\",\n style,\n value: gridItemSize,\n });\n\n return {\n style,\n className: box(options),\n };\n}\n"],"names":["cnb","bem","styles","box","options","className","align","grid","gridName","gridColumns","gridItemSize","gridAutoRows","justify","stacked","reversed","fullWidth","disableGap","disableWrap","disablePadding","phoneColumns","phoneItemSize","tabletColumns","tabletItemSize","desktopColumns","desktopItemSize","largeDesktopColumns","largeDesktopItemSize","phone","tablet","desktop","largeDesktop","isItemSizeEnabled","value","isColumnsEnabled","gap","wrap","padded","column","reverse","applyBoxVar","type","media","style","expectedType","suffix","varName","BREAKPOINTS","applyBoxVarGroup","propStyle","forEach","boxStyles"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAIhC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AA2NnB;;;CAGC,GACD,OAAO,SAASE,IAAIC,UAAsB,CAAC,CAAC;IAC1C,MAAM,EACJC,SAAS,EACTC,QAAQ,EAAE,EACVC,IAAI,EACJC,WAAW,EAAE,EACbC,cAAc,KAAK,EACnBC,YAAY,EACZC,YAAY,EACZC,UAAU,EAAE,EACZC,OAAO,EACPC,QAAQ,EACRC,SAAS,EACTC,UAAU,EACVC,WAAW,EACXC,cAAc,EACf,GAAGd;IACJ,IAAIe;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIC;IACJ,IAAIjB,eAAe,OAAOA,gBAAgB,UAAU;QACjD,CAAA,EACCkB,OAAOR,YAAY,EACnBS,QAAQP,aAAa,EACrBQ,SAASN,cAAc,EACvBO,cAAcL,mBAAmB,EAClC,GAAGhB,WAAU;IAChB;IACA,IAAIC,gBAAgB,O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ACvBP,MAAM;QACNE;QACAV,OAAOtB;IACT;IAEA,OAAO;QACLgC;QACArC,WAAWF,IAAIC;IACjB;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../src/box/styles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type CSSProperties } from \"react\";\n\nimport { type DefinedCSSVariableName } from \"../theme/types.js\";\nimport { type IsEmptyObject, type OverridableStringUnion } from \"../types.js\";\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-box\");\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-box-gap\"?: string | number;\n \"--rmd-box-padding\"?: string | number;\n \"--rmd-box-item-min-size\"?: string | number;\n \"--rmd-box-columns\"?: string | number;\n \"--rmd-box-phone-columns\"?: number | string;\n \"--rmd-box-phone-item-min-size\"?: number | string;\n \"--rmd-box-tablet-columns\"?: number | string;\n \"--rmd-box-tablet-item-min-size\"?: number | string;\n \"--rmd-box-desktop-columns\"?: number | string;\n \"--rmd-box-desktop-item-min-size\"?: number | string;\n \"--rmd-box-large-desktop-columns\"?: number | string;\n \"--rmd-box-large-desktop-item-min-size\"?: number | string;\n }\n}\n\n/** @since 6.2.0 */\nexport interface BoxAlignItemsOverrides {}\n/** @since 6.2.0 */\nexport interface BoxJustifyContentOverrides {}\n/** @since 6.2.0 */\nexport interface BoxGridNameOverrides {}\n\n/**\n * @since 6.0.0\n */\nexport type BoxAlignItems = OverridableStringUnion<\n \"start\" | \"flex-start\" | \"center\" | \"end\" | \"flex-end\" | \"stretch\",\n BoxAlignItemsOverrides\n>;\n\n/**\n * @since 6.0.0\n */\nexport type BoxJustifyContent = OverridableStringUnion<\n BoxAlignItems | \"space-around\" | \"space-between\" | \"space-evenly\",\n BoxJustifyContentOverrides\n>;\n\n/**\n * @since 6.0.0\n */\nexport type BoxFlexDirection = \"row\" | \"column\";\n\n/**\n * @since 6.0.0\n */\nexport type BoxGridColumns = \"fit\" | \"fill\" | number;\n\n/**\n * @since 6.2.0\n */\nexport type BoxGridName =\n IsEmptyObject<BoxGridNameOverrides> extends true\n ? string\n : OverridableStringUnion<never, BoxGridNameOverrides>;\n\n/**\n * @since 6.0.0\n */\nexport type BoxBreakpoints = \"phone\" | \"tablet\" | \"desktop\" | \"largeDesktop\";\n\n/**\n * @since 6.0.0\n */\nexport type BoxGridBreakpointColumns = {\n [key in BoxBreakpoints]?: BoxGridColumns;\n};\n\n/**\n * @since 6.0.0\n */\nexport type BoxGridBreakpointItemSize = {\n [key in BoxBreakpoints]?: string;\n};\n\n/**\n * @since 6.0.0\n */\nexport interface BoxOptions {\n className?: string;\n\n /**\n * Set this to `true` to use `display: grid` instead of `display: flex`.\n *\n * @defaultValue `false`\n */\n grid?: boolean;\n\n /**\n * Set this to `true` to apply `width: 100%`. This can be useful when using\n * nested box layouts.\n *\n * @defaultValue `false`\n */\n fullWidth?: boolean;\n\n /**\n * Set this to `true` to prevent gap between items.\n *\n * @defaultValue `false`\n */\n disableGap?: boolean | \"row\" | \"column\";\n\n /**\n * Set this to `true` to set `flex-wrap: nowrap`.\n *\n * @defaultValue `false`\n */\n disableWrap?: boolean;\n\n /**\n * Set this to `true` to disable the default padding.\n *\n * @defaultValue `false`\n */\n disablePadding?: boolean;\n\n /**\n * This should match one of the names in the `$box-grids` map. So for example:\n *\n * ```scss\n * @use \"react-md\" with (\n * $box-grids: (\n * small: (\n * min: 5rem\n * ),\n * medium: (\n * min: 7rem,\n * gap: 0.5rem,\n * padding: 2rem,\n * ),\n * ),\n * );\n * ```\n *\n * ```ts\n * declare module \"@react-md/core/box/styles\" {\n * interface BoxGridNameOverrides {\n * small: true;\n * medium: true;\n * }\n * }\n * ```\n *\n * The `gridName` should be `\"small\" | \"medium\"`.\n *\n * @defaultValue `\"\"`\n */\n gridName?: BoxGridName;\n\n /**\n * The default behavior for a grid is to automatically determine the number\n * of columns to render by placing as many items as possible with a specific\n * item min-width and the defined gap between items. Once the number of\n * columns has been determined, place the items in the grid and expand to the\n * full column width.\n *\n * This prop is a convenience prop to control how to display items when there\n * are not enough to span all columns without a separate SCSS file.\n *\n * i.e. 3 items were provided but 4 can be rendered.\n *\n * - `\"fit\"` - fill the entire width with columns and stretch columns to fill\n * the remaining space\n * - `\"fill\"` - fill the entire width with columns and add empty columns to\n * fill the remaining space\n * - `number` - ignore the auto layout behavior and specify the number of\n * columns to use instead.\n *\n * If additional responsive behavior is required, an object can be provided\n * to define the column behavior for: phone, tablet, desktop, or\n * largeDesktop.\n *\n * @see {@link gridItemSize} for how the number of columns are determined.\n * @defaultValue `\"fit\"`\n */\n gridColumns?: BoxGridColumns | BoxGridBreakpointColumns;\n\n /**\n * This prop can be used to override the default `--rmd-box-item-min-size`\n * for the grid without a separate SCSS file. Since this is set as a CSS variable,\n * the value must be a number with a unit to work correctly. i.e. `10rem`\n * instead of `160`.\n *\n * If additional responsive behavior is required, an object can be provided\n * to define the column behavior for: phone, tablet, desktop, or\n * largeDesktop.\n *\n * @see {@link https://react-md.dev/sassdoc/box#variables-box-item-min-size}\n */\n gridItemSize?: string | BoxGridBreakpointItemSize;\n\n /**\n * Set this to `true` to enable equal height rows within the grid based\n * on the current `max-height`. This requires the `max-height` to be set\n * on the `Box` either by:\n *\n * - a custom class name that sets `max-height`\n * - `core.box-set-var(auto-rows-height, VALUE)` on the box or a parent element\n *\n * @defaultValue `false`\n */\n gridAutoRows?: boolean;\n\n /**\n * @defaultValue `\"\"`\n */\n align?: BoxAlignItems;\n\n /**\n * The default value is really `center` or whatever the\n * `$box-default-align-items` is set to.\n *\n * @defaultValue `\"\"`\n */\n justify?: BoxJustifyContent;\n\n /**\n * Set this to `true` to set `flex-direction: column` which will stack all\n * items in the box.\n *\n * @defaultValue `false`\n */\n stacked?: boolean;\n\n /**\n * Set this to `true` to reverse the `flex-direction`. i.e.\n * - `flex-direction: row-reverse`\n * - `flex-direction: column-reverse`\n *\n * @defaultValue `false`\n */\n reversed?: boolean;\n}\n\n/**\n * @see {@link boxStyles}\n * @since 6.0.0\n */\nexport function box(options: BoxOptions = {}): string {\n const {\n className,\n align = \"\",\n grid,\n gridName = \"\",\n gridColumns = \"fit\",\n gridItemSize,\n gridAutoRows,\n justify = \"\",\n stacked,\n reversed,\n fullWidth,\n disableGap,\n disableWrap,\n disablePadding,\n } = options;\n let phoneColumns: BoxGridColumns | undefined;\n let phoneItemSize: string | number | undefined;\n let tabletColumns: BoxGridColumns | undefined;\n let tabletItemSize: string | number | undefined;\n let desktopColumns: BoxGridColumns | undefined;\n let desktopItemSize: string | number | undefined;\n let largeDesktopColumns: BoxGridColumns | undefined;\n let largeDesktopItemSize: string | number | undefined;\n if (gridColumns && typeof gridColumns === \"object\") {\n ({\n phone: phoneColumns,\n tablet: tabletColumns,\n desktop: desktopColumns,\n largeDesktop: largeDesktopColumns,\n } = gridColumns);\n }\n if (gridItemSize && typeof gridItemSize === \"object\") {\n ({\n phone: phoneItemSize,\n tablet: tabletItemSize,\n desktop: desktopItemSize,\n largeDesktop: largeDesktopItemSize,\n } = gridItemSize);\n }\n\n const isItemSizeEnabled = (\n value: string | number | undefined\n ): boolean | undefined => grid && (!!value || value === 0);\n const isColumnsEnabled = (\n value: BoxGridColumns | BoxGridBreakpointColumns | undefined\n ): boolean | undefined => grid && typeof value === \"number\";\n\n return cnb(\n styles({\n gap: !disableGap,\n \"gap-h\": disableGap === \"row\",\n \"gap-v\": disableGap === \"column\",\n wrap: !disableWrap,\n padded: !disablePadding,\n column: stacked && !reversed,\n reverse: !stacked && reversed,\n \"column-reverse\": stacked && reversed,\n \"full-width\": fullWidth,\n grid,\n \"grid-fill\": grid && gridColumns === \"fill\",\n \"grid-size\": isColumnsEnabled(gridColumns),\n \"grid-phone\": grid && (phoneColumns || phoneItemSize),\n \"grid-phone-size\":\n isColumnsEnabled(phoneColumns) || isItemSizeEnabled(phoneItemSize),\n \"grid-tablet\": grid && (tabletColumns || tabletItemSize),\n \"grid-tablet-size\":\n isColumnsEnabled(tabletColumns) || isItemSizeEnabled(tabletItemSize),\n \"grid-desktop\": grid && (desktopColumns || desktopItemSize),\n \"grid-desktop-size\":\n isColumnsEnabled(desktopColumns) || isItemSizeEnabled(desktopItemSize),\n \"grid-large-desktop\":\n grid && (largeDesktopColumns || largeDesktopItemSize),\n \"grid-large-desktop-size\":\n isColumnsEnabled(largeDesktopColumns) ||\n isItemSizeEnabled(largeDesktopItemSize),\n \"grid-auto-rows\": grid && gridAutoRows,\n [gridName]: grid && gridName,\n \"align-start\": align === \"start\" || align === \"flex-start\",\n \"align-center\": align === \"center\",\n \"align-end\": align === \"end\" || align === \"flex-end\",\n \"align-stretch\": align === \"stretch\",\n \"justify-center\": justify === \"center\",\n \"justify-start\": justify === \"start\" || justify === \"flex-start\",\n \"justify-end\": justify === \"end\" || justify === \"flex-end\",\n \"justify-stretch\": justify === \"stretch\",\n \"justify-around\": justify === \"space-around\",\n \"justify-between\": justify === \"space-between\",\n \"justify-evenly\": justify === \"space-evenly\",\n }),\n className\n );\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\ninterface ApplyOptions {\n media: keyof BoxGridBreakpointColumns | \"\";\n style: CSSProperties | undefined;\n type: \"columns\" | \"size\";\n value:\n | BoxGridColumns\n | BoxGridBreakpointColumns\n | string\n | BoxGridBreakpointItemSize\n | undefined;\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nfunction applyBoxVar(options: ApplyOptions): CSSProperties | undefined {\n const { type, media, style, value } = options;\n const expectedType = type === \"columns\" ? \"number\" : \"string\";\n if (typeof value !== expectedType) {\n return style;\n }\n\n const suffix = type === \"columns\" ? type : \"item-min-size\";\n let varName: DefinedCSSVariableName = `--rmd-box-${suffix}`;\n if (media === \"largeDesktop\") {\n varName = `--rmd-box-large-desktop-${suffix}`;\n } else if (media) {\n varName = `--rmd-box-${media}-${suffix}`;\n }\n\n return {\n ...style,\n [varName]: value,\n };\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nconst BREAKPOINTS = [\"phone\", \"tablet\", \"desktop\", \"largeDesktop\"] as const;\n\n/**\n * @since 6.0.0\n * @internal\n */\nfunction applyBoxVarGroup(\n options: Pick<ApplyOptions, \"value\" | \"style\" | \"type\">\n): CSSProperties | undefined {\n const { style: propStyle, value, type } = options;\n let style = applyBoxVar({\n type,\n style: propStyle,\n media: \"\",\n value,\n });\n if (value && typeof value === \"object\") {\n BREAKPOINTS.forEach((media) => {\n style = applyBoxVar({\n type,\n style,\n media,\n value: value[media],\n });\n });\n }\n return style;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface BoxStyles {\n style?: CSSProperties;\n className: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface BoxStylesOptions extends BoxOptions {\n style?: CSSProperties;\n}\n\n/**\n * @see {@link box}\n * @since 6.0.0\n */\nexport function boxStyles(options: BoxStylesOptions): BoxStyles {\n const { style: propStyle, gridColumns, gridItemSize } = options;\n let style = applyBoxVarGroup({\n type: \"columns\",\n style: propStyle,\n value: gridColumns,\n });\n style = applyBoxVarGroup({\n type: \"size\",\n style,\n value: gridItemSize,\n });\n\n return {\n style,\n className: box(options),\n };\n}\n"],"names":["cnb","bem","styles","box","options","className","align","grid","gridName","gridColumns","gridItemSize","gridAutoRows","justify","stacked","reversed","fullWidth","disableGap","disableWrap","disablePadding","phoneColumns","phoneItemSize","tabletColumns","tabletItemSize","desktopColumns","desktopItemSize","largeDesktopColumns","largeDesktopItemSize","phone","tablet","desktop","largeDesktop","isItemSizeEnabled","value","isColumnsEnabled","gap","wrap","padded","column","reverse","applyBoxVar","type","media","style","expectedType","suffix","varName","BREAKPOINTS","applyBoxVarGroup","propStyle","forEach","boxStyles"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAKhC,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AA+OnB;;;CAGC,GACD,OAAO,SAASE,IAAIC,UAAsB,CAAC,CAAC;IAC1C,MAAM,EACJC,SAAS,EACTC,QAAQ,EAAE,EACVC,IAAI,EACJC,WAAW,EAAE,EACbC,cAAc,KAAK,EAC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AO;QACPT;IACF;IACA,IAAIA,SAAS,OAAOA,UAAU,UAAU;QACtCc,YAAYG,OAAO,CAAC,CAACR;YACnBC,QAAQH,YAAY;gBAClBC;gBACAE;gBACAD;gBACAT,OAAOA,KAAK,CAACS,MAAM;YACrB;QACF;IACF;IACA,OAAOC;AACT;AAiBA;;;CAGC,GACD,OAAO,SAASQ,UAAU9C,OAAyB;IACjD,MAAM,EAAEsC,OAAOM,SAAS,EAAEvC,WAAW,EAAEC,YAAY,EAAE,GAAGN;IACxD,IAAIsC,QAAQK,iBAAiB;QAC3BP,MAAM;QACNE,OAAOM;QACPhB,OAAOvB;IACT;IACAiC,QAAQK,iBAAiB;QACvBP,MAAM;QACNE;QACAV,OAAOtB;IACT;IAEA,OAAO;QACLgC;QACArC,WAAWF,IAAIC;IACjB;AACF"}
|
|
@@ -86,12 +86,12 @@ export interface AsyncButtonProps extends ButtonProps {
|
|
|
86
86
|
* Any additional props to pass to the `CircularProgress` bar when the
|
|
87
87
|
* {@link loadingType} is one of the circular types.
|
|
88
88
|
*/
|
|
89
|
-
linearProgressProps?: PropsWithRef<LinearProgressProps
|
|
89
|
+
linearProgressProps?: PropsWithRef<LinearProgressProps>;
|
|
90
90
|
/**
|
|
91
91
|
* Any additional props to pass to the `LinearProgress` bar when the
|
|
92
92
|
* {@link loadingType} is one of the linear types.
|
|
93
93
|
*/
|
|
94
|
-
circularProgressProps?: PropsWithRef<CircularProgressProps
|
|
94
|
+
circularProgressProps?: PropsWithRef<CircularProgressProps>;
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
* **Client Component**
|
|
@@ -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,uBA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EA,MAAM4B,WAAWhB,YAAYiB,QAAQ,CAAC,0BACpC,KAACrC;QACCsC,cAAYT;QACZU,mBAAiBT;QAChB,GAAGH,mBAAmB;QACvBd,OAAOsB;uBAGT,KAACpC;QACCuC,cAAYT;QACZU,mBAAiBT;QAChB,GAAGF,qBAAqB;QACzBf,OAAOsB;;IAIX,IAAIZ,aAAaC;IACjB,IAAIC,cAAcC;IAClB,IAAIc;IACJ,IAAIC,iBAAiB;IACrB,OAAQrB;QACN,KAAK;YACHK,cAAcP,UAAUkB,WAAWV;YACnC;QACF,KAAK;YACHH,aAAaL,UAAUkB,WAAWZ;YAClC;QACF,KAAK;QACL,KAAK;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"}
|
|
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,SAAS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
|
@@ -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
|
|
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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;Q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