@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
package/dist/button/_button.scss
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@use "sass:list";
|
|
6
6
|
@use "sass:map";
|
|
7
7
|
@use "../utils";
|
|
8
|
+
@use "../border-radius";
|
|
9
|
+
@use "../spacing";
|
|
8
10
|
@use "../theme/a11y";
|
|
9
11
|
@use "../theme/theme";
|
|
10
12
|
@use "../icon/icon";
|
|
@@ -69,15 +71,15 @@ $disable-unstyled-utility-class: false !default;
|
|
|
69
71
|
|
|
70
72
|
/// The default border radius to apply to text buttons
|
|
71
73
|
/// @type Number
|
|
72
|
-
$text-border-radius:
|
|
74
|
+
$text-border-radius: border-radius.get-var(sm) !default;
|
|
73
75
|
|
|
74
76
|
/// The default horizontal padding to apply to text buttons
|
|
75
77
|
/// @type Number
|
|
76
|
-
$text-horizontal-padding:
|
|
78
|
+
$text-horizontal-padding: spacing.get-var(md) !default;
|
|
77
79
|
|
|
78
80
|
/// The default vertical padding to apply to text buttons
|
|
79
81
|
/// @type Number
|
|
80
|
-
$text-vertical-padding:
|
|
82
|
+
$text-vertical-padding: spacing.get-var(none) !default;
|
|
81
83
|
|
|
82
84
|
/// The default min-height to apply to text buttons
|
|
83
85
|
/// @type Number
|
|
@@ -93,7 +95,7 @@ $text-icon-size: 1.125rem !default;
|
|
|
93
95
|
|
|
94
96
|
/// The default border radius to apply to icon buttons
|
|
95
97
|
/// @type Number
|
|
96
|
-
$icon-border-radius:
|
|
98
|
+
$icon-border-radius: border-radius.get-var(full) !default;
|
|
97
99
|
|
|
98
100
|
/// The default border radius to apply to square icon buttons
|
|
99
101
|
/// @type Number
|
|
@@ -151,7 +153,7 @@ $circular-progress-size: icon.get-var(size) !default;
|
|
|
151
153
|
|
|
152
154
|
/// The default viewport margin for a floating action button
|
|
153
155
|
/// @type Number
|
|
154
|
-
$floating-margin:
|
|
156
|
+
$floating-margin: spacing.get-var(lg) !default;
|
|
155
157
|
|
|
156
158
|
/// The default z-index for a floating action button
|
|
157
159
|
/// @type Number
|
|
@@ -196,9 +198,12 @@ $variables: (
|
|
|
196
198
|
text-vertical-padding,
|
|
197
199
|
text-min-height,
|
|
198
200
|
text-min-width,
|
|
201
|
+
text-border-radius,
|
|
199
202
|
icon-size,
|
|
203
|
+
icon-padding,
|
|
200
204
|
icon-font-size,
|
|
201
205
|
icon-border-radius,
|
|
206
|
+
icon-square-border-radius,
|
|
202
207
|
fab-offset
|
|
203
208
|
);
|
|
204
209
|
|
|
@@ -277,8 +282,8 @@ $variables: (
|
|
|
277
282
|
/// }
|
|
278
283
|
@mixin text-styles {
|
|
279
284
|
@include icon.set-var(size, $text-icon-size);
|
|
280
|
-
@include set-var(border-radius, $text-border-radius);
|
|
281
285
|
@include utils.map-to-styles(typography.$button-styles);
|
|
286
|
+
@include use-var(border-radius, text-border-radius, $text-border-radius);
|
|
282
287
|
@include use-var(min-height, text-min-height);
|
|
283
288
|
@include use-var(min-width, text-min-width);
|
|
284
289
|
|
|
@@ -308,7 +313,7 @@ $variables: (
|
|
|
308
313
|
@if not $disable-icon {
|
|
309
314
|
@include set-var(icon-size, $icon-size);
|
|
310
315
|
@include set-var(icon-font-size, $icon-font-size);
|
|
311
|
-
@include set-var(icon-
|
|
316
|
+
@include set-var(icon-padding, $icon-padding);
|
|
312
317
|
}
|
|
313
318
|
|
|
314
319
|
@if not $disable-floating {
|
|
@@ -350,17 +355,22 @@ $variables: (
|
|
|
350
355
|
@if not $disable-icon {
|
|
351
356
|
&--icon {
|
|
352
357
|
@include icon.set-var(size, 1em);
|
|
353
|
-
@include set-var(
|
|
358
|
+
@include set-var(
|
|
359
|
+
border-radius,
|
|
360
|
+
get-var(icon-border-radius, $icon-border-radius)
|
|
361
|
+
);
|
|
354
362
|
@include use-var(font-size, icon-font-size);
|
|
355
363
|
@include use-var(height, icon-size);
|
|
356
364
|
@include use-var(width, icon-size);
|
|
357
|
-
|
|
358
|
-
padding: $icon-padding;
|
|
365
|
+
@include use-var(padding, icon-padding);
|
|
359
366
|
}
|
|
360
367
|
|
|
361
368
|
@if not $disable-icon-square {
|
|
362
369
|
&--icon-square {
|
|
363
|
-
@include set-var(
|
|
370
|
+
@include set-var(
|
|
371
|
+
icon-border-radius,
|
|
372
|
+
get-var(icon-square-border-radius)
|
|
373
|
+
);
|
|
364
374
|
}
|
|
365
375
|
}
|
|
366
376
|
|
|
@@ -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
|
|
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
|
|
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"}
|
package/dist/card/_card.scss
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "../utils";
|
|
7
|
+
@use "../spacing";
|
|
8
|
+
@use "../border-radius";
|
|
7
9
|
@use "../theme/theme";
|
|
8
10
|
@use "../box-shadows";
|
|
9
11
|
@use "../typography/typography";
|
|
@@ -84,34 +86,34 @@ $border-width: divider.get-var(size) !default;
|
|
|
84
86
|
|
|
85
87
|
/// The default border-radius for bordered cards
|
|
86
88
|
/// @type Number
|
|
87
|
-
$border-radius:
|
|
89
|
+
$border-radius: border-radius.get-var(xs) !default;
|
|
88
90
|
|
|
89
91
|
/// The default padding to apply to `CardHeader`
|
|
90
92
|
/// @type Number
|
|
91
|
-
$header-padding:
|
|
93
|
+
$header-padding: spacing.get-var(md) !default;
|
|
92
94
|
|
|
93
95
|
/// The default padding-top to apply to `CardHeader`
|
|
94
96
|
/// @type Number
|
|
95
|
-
$header-padding-top:
|
|
97
|
+
$header-padding-top: spacing.get-var(lg) !default;
|
|
96
98
|
|
|
97
99
|
/// The default `column-gap` to apply to the `CardHeader`
|
|
98
100
|
/// @type Number
|
|
99
|
-
$header-spacing:
|
|
101
|
+
$header-spacing: spacing.get-var(md) !default;
|
|
100
102
|
|
|
101
103
|
/// The default padding to apply to the `CardContent`
|
|
102
104
|
/// @type Number
|
|
103
|
-
$content-padding:
|
|
105
|
+
$content-padding: spacing.get-var(md) !default;
|
|
104
106
|
|
|
105
107
|
/// The default padding-bottom to apply to the `CardContent` when it is the last
|
|
106
108
|
/// child and the `$disable-content-last-child-padding` feature flag has
|
|
107
109
|
/// not been disabled.
|
|
108
110
|
///
|
|
109
111
|
/// @type Number
|
|
110
|
-
$content-padding-bottom:
|
|
112
|
+
$content-padding-bottom: spacing.get-var(lg) !default;
|
|
111
113
|
|
|
112
114
|
/// The default padding to apply to the `CardFooter`
|
|
113
115
|
/// @type Number
|
|
114
|
-
$footer-padding:
|
|
116
|
+
$footer-padding: spacing.get-var(sm) !default;
|
|
115
117
|
|
|
116
118
|
/// The available configurable css variables and mostly used internally for the
|
|
117
119
|
/// `get-var`, `set-var`, and `use-var` utils.
|
package/dist/chip/Chip.d.ts
CHANGED
|
@@ -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
|
|
117
|
+
contentProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;
|
|
118
118
|
/**
|
|
119
119
|
* This will be ignored if {@link disableContentWrap} is `true`.
|
|
120
120
|
*/
|
package/dist/chip/Chip.js.map
CHANGED
|
@@ -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":"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"}
|
|
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":"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"}
|
package/dist/chip/_chip.scss
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
@use "sass:color";
|
|
6
6
|
@use "sass:map";
|
|
7
7
|
@use "../utils";
|
|
8
|
+
@use "../border-radius";
|
|
9
|
+
@use "../spacing";
|
|
8
10
|
@use "../box-shadows";
|
|
9
11
|
@use "../theme/a11y";
|
|
10
12
|
@use "../theme/colors";
|
|
@@ -85,7 +87,7 @@ $disable-selected-icon-transition: false !default;
|
|
|
85
87
|
/// The `gap` between items in the `Chip`.
|
|
86
88
|
///
|
|
87
89
|
/// @type Number
|
|
88
|
-
$gap:
|
|
90
|
+
$gap: spacing.get-var(md) !default;
|
|
89
91
|
|
|
90
92
|
/// The default `Chip` height.
|
|
91
93
|
/// @type Number
|
|
@@ -94,7 +96,7 @@ $height: 2rem !default;
|
|
|
94
96
|
/// The default `Chip` border radius.
|
|
95
97
|
///
|
|
96
98
|
/// @type Number
|
|
97
|
-
$border-radius:
|
|
99
|
+
$border-radius: border-radius.get-var(lg) !default;
|
|
98
100
|
|
|
99
101
|
/// The default size for icons that are rendered within a `Chip` normally as
|
|
100
102
|
/// the `leftAddon` or `rightAddon` props.
|
|
@@ -131,24 +133,24 @@ $typography: map.merge(
|
|
|
131
133
|
/// The default horizontal padding on `Chip`s.
|
|
132
134
|
///
|
|
133
135
|
/// @type Number
|
|
134
|
-
$horizontal-padding:
|
|
136
|
+
$horizontal-padding: calc(spacing.get-var(md) * 1.25) !default;
|
|
135
137
|
|
|
136
138
|
/// The default vertical padding on `Chip`s.
|
|
137
139
|
///
|
|
138
140
|
/// @type Number
|
|
139
|
-
$vertical-padding:
|
|
141
|
+
$vertical-padding: spacing.get-var(none) !default;
|
|
140
142
|
|
|
141
143
|
/// The amount of `padding-left` to apply to the `Chip` if a `leftAddon` prop
|
|
142
144
|
/// was provided.
|
|
143
145
|
///
|
|
144
146
|
/// @type Number
|
|
145
|
-
$addon-left-padding:
|
|
147
|
+
$addon-left-padding: spacing.get-var(xs) !default;
|
|
146
148
|
|
|
147
149
|
/// The amount of `padding-right` to apply to the `Chip` if a `rightAddon` prop
|
|
148
150
|
/// was provided.
|
|
149
151
|
///
|
|
150
152
|
/// @type Number
|
|
151
|
-
$addon-right-padding:
|
|
153
|
+
$addon-right-padding: spacing.get-var(sm) !default;
|
|
152
154
|
|
|
153
155
|
/// The background-color to apply when the `themed` prop is enabled.
|
|
154
156
|
///
|
|
@@ -231,7 +233,7 @@ $solid-raisable-transition-duration: transition.$linear-duration !default;
|
|
|
231
233
|
|
|
232
234
|
/// The outline width when a `theme="outline"`.
|
|
233
235
|
/// @type Number
|
|
234
|
-
$outline-width:
|
|
236
|
+
$outline-width: calc(interaction.get-var(focus-width) / 2) !default;
|
|
235
237
|
|
|
236
238
|
/// A number between 0-24 representing the box-shadow elevation when the user
|
|
237
239
|
/// is pressing the `Chip` with a `theme="outline"` and `raisable`.
|
package/dist/dialog/Dialog.d.ts
CHANGED
|
@@ -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
|
|
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":"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"}
|
|
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":"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"}
|
package/dist/dialog/_dialog.scss
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "../utils";
|
|
7
|
+
@use "../spacing";
|
|
7
8
|
@use "../box-shadows";
|
|
8
9
|
@use "../box/box";
|
|
9
10
|
@use "../transition/transition";
|
|
@@ -129,13 +130,13 @@ $extra-large-width: 80rem !default;
|
|
|
129
130
|
/// is centered.
|
|
130
131
|
///
|
|
131
132
|
/// @type Number
|
|
132
|
-
$horizontal-margin:
|
|
133
|
+
$horizontal-margin: calc(spacing.get-var(lg) * 1.25) !default;
|
|
133
134
|
|
|
134
135
|
/// The amount of spacing to apply to the top and bottom of the dialog when it
|
|
135
136
|
/// is centered.
|
|
136
137
|
///
|
|
137
138
|
/// @type Number
|
|
138
|
-
$vertical-margin:
|
|
139
|
+
$vertical-margin: spacing.get-var(lg) !default;
|
|
139
140
|
|
|
140
141
|
/// The distance to move while the dialog enters and exits.
|
|
141
142
|
/// @type Number
|
|
@@ -165,22 +166,22 @@ $leave-duration: transition.$leave-duration !default;
|
|
|
165
166
|
/// The amount of padding to apply to the `DialogHeader` component.
|
|
166
167
|
///
|
|
167
168
|
/// @type Number
|
|
168
|
-
$header-padding:
|
|
169
|
+
$header-padding: spacing.get-var(lg) !default;
|
|
169
170
|
|
|
170
171
|
/// The amount of padding-bottom to apply to the `DialogHeader` component.
|
|
171
172
|
///
|
|
172
173
|
/// @type Number
|
|
173
|
-
$header-padding-bottom: 1.
|
|
174
|
+
$header-padding-bottom: calc(spacing.get-var(md) * 1.25) !default;
|
|
174
175
|
|
|
175
176
|
/// The amount of padding-bottom to apply to the `DialogContent` component.
|
|
176
177
|
///
|
|
177
178
|
/// @type Number
|
|
178
|
-
$content-padding:
|
|
179
|
+
$content-padding: spacing.get-var(lg) !default;
|
|
179
180
|
|
|
180
181
|
/// The amount of padding-bottom to apply to the `DialogFooter` component.
|
|
181
182
|
///
|
|
182
183
|
/// @type Number
|
|
183
|
-
$footer-padding:
|
|
184
|
+
$footer-padding: spacing.get-var(sm) !default;
|
|
184
185
|
|
|
185
186
|
/// The available configurable css variables and mostly used internally for the
|
|
186
187
|
/// `get-var`, `set-var`, and `use-var` utils.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "../utils";
|
|
7
|
+
@use "../spacing";
|
|
7
8
|
@use "../theme/theme";
|
|
8
9
|
@use "../theme/colors";
|
|
9
10
|
|
|
@@ -46,12 +47,12 @@ $inset: 4rem !default;
|
|
|
46
47
|
/// The default margin to apply to the horizontal `Divider`.
|
|
47
48
|
///
|
|
48
49
|
/// @type Number
|
|
49
|
-
$spacing:
|
|
50
|
+
$spacing: spacing.get-var(xs) auto !default;
|
|
50
51
|
|
|
51
52
|
/// The default margin to apply to the vertical `Divider`.
|
|
52
53
|
///
|
|
53
54
|
/// @type Number
|
|
54
|
-
$vertical-spacing: auto
|
|
55
|
+
$vertical-spacing: auto spacing.get-var(xs) !default;
|
|
55
56
|
|
|
56
57
|
/// The `Divider` color in light themes.
|
|
57
58
|
/// @type Color
|
|
@@ -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"
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
|
|
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
|
|
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
|
|
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"}
|