@react-md/core 6.0.2 → 6.1.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/_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/avatar/_avatar.scss +3 -3
- package/dist/badge/_badge.scss +10 -2
- package/dist/box/_box.scss +78 -11
- package/dist/button/_button.scss +21 -11
- package/dist/card/_card.scss +9 -7
- package/dist/chip/_chip.scss +9 -7
- package/dist/dialog/_dialog.scss +7 -6
- package/dist/divider/_divider.scss +3 -2
- package/dist/expansion-panel/_expansion-panel.scss +4 -3
- package/dist/form/TextArea.js +1 -1
- package/dist/form/TextArea.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/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/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/_list.scss +7 -6
- package/dist/menu/_menu.scss +2 -1
- package/dist/navigation/_navigation.scss +5 -3
- package/dist/responsive-item/_responsive-item.scss +2 -1
- package/dist/segmented-button/_segmented-button.scss +20 -13
- package/dist/sheet/_sheet.scss +2 -1
- package/dist/snackbar/_snackbar.scss +12 -10
- package/dist/table/_table.scss +5 -4
- 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/_tree.scss +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 +10 -10
- package/src/app-bar/styles.ts +1 -1
- package/src/form/TextArea.tsx +1 -1
- package/src/form/utils.ts +1 -0
- package/src/interaction/useElementInteraction.tsx +1 -1
- package/src/layout/LayoutNav.tsx +1 -1
- package/src/layout/useMainTabIndex.ts +1 -0
- package/src/theme/utils.ts +2 -1
- package/src/utils/bem.ts +1 -1
- package/src/utils/parseCssLengthUnit.ts +4 -0
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.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.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
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
////
|
|
4
4
|
|
|
5
5
|
@use "../utils";
|
|
6
|
+
@use "../spacing";
|
|
6
7
|
@use "../transition/transition";
|
|
7
8
|
@use "../icon/icon";
|
|
8
9
|
@use "../button/button";
|
|
@@ -22,18 +23,18 @@ $disable-margin-top-transition: false !default;
|
|
|
22
23
|
/// `ExpansionPanel`.
|
|
23
24
|
///
|
|
24
25
|
/// @type Number
|
|
25
|
-
$padding:
|
|
26
|
+
$padding: spacing.get-var(md) !default;
|
|
26
27
|
|
|
27
28
|
/// The `margin-top` to apply between expanded expansion panels
|
|
28
29
|
///
|
|
29
30
|
/// @type Number
|
|
30
|
-
$spacing:
|
|
31
|
+
$spacing: spacing.get-var(md) !default;
|
|
31
32
|
|
|
32
33
|
/// The `gap` to apply between elements in the clickable area in the
|
|
33
34
|
/// `ExpansionPanel`.
|
|
34
35
|
///
|
|
35
36
|
/// @type Number
|
|
36
|
-
$button-spacing:
|
|
37
|
+
$button-spacing: spacing.get-var(sm) !default;
|
|
37
38
|
|
|
38
39
|
/// The degrees to start the rotation animation for the expansion panel icon.
|
|
39
40
|
///
|
package/dist/form/TextArea.js
CHANGED
|
@@ -109,7 +109,7 @@ import { useResizingTextArea } from "./useResizingTextArea.js";
|
|
|
109
109
|
"--rmd-text-area-height": height
|
|
110
110
|
},
|
|
111
111
|
className: textAreaContainer({
|
|
112
|
-
animate: !disableTransition && resize
|
|
112
|
+
animate: !disableTransition && resize === "auto",
|
|
113
113
|
disabled,
|
|
114
114
|
height: !!height,
|
|
115
115
|
underlineLabelled: !!label && (theme === "underline" || theme === "filled"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/TextArea.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n type HTMLAttributes,\n type TextareaHTMLAttributes,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { Label } from \"./Label.js\";\nimport { ResizingTextAreaWrapper } from \"./ResizingTextAreaWrapper.js\";\nimport { TextFieldContainer } from \"./TextFieldContainer.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { textArea, textAreaContainer } from \"./textAreaStyles.js\";\nimport { type FormFieldOptions } from \"./types.js\";\nimport {\n type TextAreaResize,\n useResizingTextArea,\n} from \"./useResizingTextArea.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-text-area-height\"?: string | number;\n \"--rmd-text-area-padding\"?: string | number;\n }\n}\n\n/**\n * @since 6.0.0 Added `containerProps`.\n */\nexport interface TextAreaProps\n extends FormFieldOptions,\n TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** @defaultValue `\"text-area-\" + useId()` */\n id?: string;\n\n /**\n * Optional placeholder text to display in the text field.\n *\n * @defaultValue `label ? \" \" : \"\"`\n */\n placeholder?: string;\n\n /**\n * Set this to `true` if the auto resizing textarea should not animate for new\n * height changes.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * An optional style to apply to the textarea element. The base `style` prop\n * is applied to the surrounding `div` instead.\n */\n areaStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the textarea element. The base `style`\n * prop is applied to the surrounding `div` instead.\n */\n areaClassName?: string;\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n * @defaultValue `2`\n */\n rows?: number;\n\n /**\n * The maximum number of rows a textarea can expand to before showing a\n * scrollbar. When this is set to `-1`, there will be no limit.\n *\n * @defaultValue `-1`\n */\n maxRows?: number;\n\n /**\n * @see {@link TextAreaResize}\n * @defaultValue `\"auto\"`\n */\n resize?: TextAreaResize;\n\n /**\n * When the {@link resize} prop is set to `\"auto\"`, an additional `<div>` is\n * added along with a hidden `<textarea>` mask. This prop can be used to add\n * any additional styling or props to that div.\n *\n * This will only be applied when {@link resize} is set to `\"auto\"`.\n */\n resizeContainerProps?: PropsWithRef<\n HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n >;\n\n /**\n * Optional props to provide to the {@link TextFieldContainer} component.\n * There probably isn't any real use for this prop other than if you need to\n * add a `ref` for some DOM behavior.\n */\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { TextArea } from \"@react-md/core/form/TextArea\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <TextArea\n * label=\"Label\"\n * placeholder=\"Placeholder\"\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/text-field#simple-textarea | TextArea Demos}\n */\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(props, ref) {\n const {\n id: propId,\n style,\n className,\n label,\n labelProps,\n labelStyle,\n labelClassName,\n areaStyle,\n areaClassName,\n resizeContainerProps,\n resize = \"auto\",\n dense,\n error,\n active,\n inline: propInline,\n leftAddon,\n rightAddon,\n disableLeftAddonStyles,\n disableRightAddonStyles,\n theme: propTheme,\n underlineDirection: propUnderlineDirection,\n messageProps,\n messageContainerProps,\n containerProps,\n rows = 2,\n maxRows = -1,\n onChange: propOnChange,\n disableTransition: propDisableTransition,\n ...remaining\n } = props;\n const { disabled = false, readOnly = false, value, defaultValue } = props;\n const id = useEnsuredId(propId, \"text-area\");\n const theme = getFormConfig(\"theme\", propTheme);\n const underlineDirection = getFormConfig(\n \"underlineDirection\",\n propUnderlineDirection\n );\n const [areaRef, areaRefCallback] = useEnsuredRef(ref);\n\n const {\n maskRef,\n containerRef,\n height,\n onChange,\n scrollable,\n disableTransition,\n } = useResizingTextArea({\n maxRows,\n resize,\n onChange: propOnChange,\n containerRef: containerProps?.ref,\n disableTransition: propDisableTransition,\n });\n\n let { placeholder = \"\" } = props;\n if (label && !placeholder) {\n // See the placeholder type definition comments for information\n placeholder = \" \";\n }\n\n // have to force it inline or else you won't be able to resize\n // it horizontally.\n const inline = resize === \"horizontal\" || resize === \"both\" || propInline;\n\n const area = (\n <textarea\n {...remaining}\n id={id}\n ref={areaRefCallback}\n rows={rows}\n disabled={disabled}\n onChange={onChange}\n placeholder={placeholder}\n style={areaStyle}\n className={textArea({\n resize,\n scrollable,\n className: areaClassName,\n placeholderHidden: !!label && !active,\n })}\n />\n );\n\n const labelNode = label && (\n <Label\n {...labelProps}\n htmlFor={id}\n style={labelProps?.style ?? labelStyle}\n className={labelProps?.className ?? labelClassName}\n floating\n dense={dense}\n error={error}\n active={active}\n disabled={disabled}\n >\n {label}\n </Label>\n );\n\n let children = (\n <>\n {area}\n {labelNode}\n </>\n );\n\n if (resize === \"auto\") {\n children = (\n <ResizingTextAreaWrapper\n {...resizeContainerProps}\n maskId={`${id}-mask`}\n maskRef={maskRef}\n rows={rows}\n areaStyle={areaStyle}\n areaClassName={areaClassName}\n defaultValue={value ?? defaultValue}\n disableTransition={disableTransition}\n >\n {children}\n </ResizingTextAreaWrapper>\n );\n }\n\n return (\n <FormMessageContainer\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <TextFieldContainer\n {...containerProps}\n ref={containerRef}\n style={{\n ...style,\n \"--rmd-text-area-height\": height,\n }}\n className={textAreaContainer({\n animate: !disableTransition && resize == \"auto\",\n disabled,\n height: !!height,\n underlineLabelled:\n !!label && (theme === \"underline\" || theme === \"filled\"),\n className,\n })}\n theme={theme}\n label={!!label}\n error={error}\n dense={dense}\n inline={inline}\n active={active}\n readOnly={readOnly}\n disabled={disabled}\n leftAddon={leftAddon}\n rightAddon={rightAddon}\n underlineDirection={underlineDirection}\n disableLeftAddonStyles={disableLeftAddonStyles}\n disableRightAddonStyles={disableRightAddonStyles}\n onClick={(event) => {\n // The textarea container adds padding-top when there is a label so\n // that the label does not cover the text so this makes it so you\n // can still click anywhere in the \"box\" to focus the textarea.\n if (!disabled && event.target === event.currentTarget) {\n areaRef.current?.focus();\n }\n }}\n >\n {children}\n </TextFieldContainer>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["forwardRef","useEnsuredId","useEnsuredRef","FormMessageContainer","Label","ResizingTextAreaWrapper","TextFieldContainer","getFormConfig","textArea","textAreaContainer","useResizingTextArea","TextArea","props","ref","id","propId","style","className","label","labelProps","labelStyle","labelClassName","areaStyle","areaClassName","resizeContainerProps","resize","dense","error","active","inline","propInline","leftAddon","rightAddon","disableLeftAddonStyles","disableRightAddonStyles","theme","propTheme","underlineDirection","propUnderlineDirection","messageProps","messageContainerProps","containerProps","rows","maxRows","onChange","propOnChange","disableTransition","propDisableTransition","remaining","disabled","readOnly","value","defaultValue","areaRef","areaRefCallback","maskRef","containerRef","height","scrollable","placeholder","area","textarea","placeholderHidden","labelNode","htmlFor","floating","children","maskId","animate","underlineLabelled","onClick","event","target","currentTarget","current","focus"],"mappings":"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"}
|
|
1
|
+
{"version":3,"sources":["../../src/form/TextArea.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n type HTMLAttributes,\n type TextareaHTMLAttributes,\n forwardRef,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { FormMessageContainer } from \"./FormMessageContainer.js\";\nimport { Label } from \"./Label.js\";\nimport { ResizingTextAreaWrapper } from \"./ResizingTextAreaWrapper.js\";\nimport { TextFieldContainer } from \"./TextFieldContainer.js\";\nimport { getFormConfig } from \"./formConfig.js\";\nimport { textArea, textAreaContainer } from \"./textAreaStyles.js\";\nimport { type FormFieldOptions } from \"./types.js\";\nimport {\n type TextAreaResize,\n useResizingTextArea,\n} from \"./useResizingTextArea.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-text-area-height\"?: string | number;\n \"--rmd-text-area-padding\"?: string | number;\n }\n}\n\n/**\n * @since 6.0.0 Added `containerProps`.\n */\nexport interface TextAreaProps\n extends FormFieldOptions,\n TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** @defaultValue `\"text-area-\" + useId()` */\n id?: string;\n\n /**\n * Optional placeholder text to display in the text field.\n *\n * @defaultValue `label ? \" \" : \"\"`\n */\n placeholder?: string;\n\n /**\n * Set this to `true` if the auto resizing textarea should not animate for new\n * height changes.\n *\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * An optional style to apply to the textarea element. The base `style` prop\n * is applied to the surrounding `div` instead.\n */\n areaStyle?: CSSProperties;\n\n /**\n * An optional className to apply to the textarea element. The base `style`\n * prop is applied to the surrounding `div` instead.\n */\n areaClassName?: string;\n\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n * @defaultValue `2`\n */\n rows?: number;\n\n /**\n * The maximum number of rows a textarea can expand to before showing a\n * scrollbar. When this is set to `-1`, there will be no limit.\n *\n * @defaultValue `-1`\n */\n maxRows?: number;\n\n /**\n * @see {@link TextAreaResize}\n * @defaultValue `\"auto\"`\n */\n resize?: TextAreaResize;\n\n /**\n * When the {@link resize} prop is set to `\"auto\"`, an additional `<div>` is\n * added along with a hidden `<textarea>` mask. This prop can be used to add\n * any additional styling or props to that div.\n *\n * This will only be applied when {@link resize} is set to `\"auto\"`.\n */\n resizeContainerProps?: PropsWithRef<\n HTMLAttributes<HTMLDivElement>,\n HTMLDivElement\n >;\n\n /**\n * Optional props to provide to the {@link TextFieldContainer} component.\n * There probably isn't any real use for this prop other than if you need to\n * add a `ref` for some DOM behavior.\n */\n containerProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { TextArea } from \"@react-md/core/form/TextArea\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <TextArea\n * label=\"Label\"\n * placeholder=\"Placeholder\"\n * />\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/text-field#simple-textarea | TextArea Demos}\n */\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n function TextArea(props, ref) {\n const {\n id: propId,\n style,\n className,\n label,\n labelProps,\n labelStyle,\n labelClassName,\n areaStyle,\n areaClassName,\n resizeContainerProps,\n resize = \"auto\",\n dense,\n error,\n active,\n inline: propInline,\n leftAddon,\n rightAddon,\n disableLeftAddonStyles,\n disableRightAddonStyles,\n theme: propTheme,\n underlineDirection: propUnderlineDirection,\n messageProps,\n messageContainerProps,\n containerProps,\n rows = 2,\n maxRows = -1,\n onChange: propOnChange,\n disableTransition: propDisableTransition,\n ...remaining\n } = props;\n const { disabled = false, readOnly = false, value, defaultValue } = props;\n const id = useEnsuredId(propId, \"text-area\");\n const theme = getFormConfig(\"theme\", propTheme);\n const underlineDirection = getFormConfig(\n \"underlineDirection\",\n propUnderlineDirection\n );\n const [areaRef, areaRefCallback] = useEnsuredRef(ref);\n\n const {\n maskRef,\n containerRef,\n height,\n onChange,\n scrollable,\n disableTransition,\n } = useResizingTextArea({\n maxRows,\n resize,\n onChange: propOnChange,\n containerRef: containerProps?.ref,\n disableTransition: propDisableTransition,\n });\n\n let { placeholder = \"\" } = props;\n if (label && !placeholder) {\n // See the placeholder type definition comments for information\n placeholder = \" \";\n }\n\n // have to force it inline or else you won't be able to resize\n // it horizontally.\n const inline = resize === \"horizontal\" || resize === \"both\" || propInline;\n\n const area = (\n <textarea\n {...remaining}\n id={id}\n ref={areaRefCallback}\n rows={rows}\n disabled={disabled}\n onChange={onChange}\n placeholder={placeholder}\n style={areaStyle}\n className={textArea({\n resize,\n scrollable,\n className: areaClassName,\n placeholderHidden: !!label && !active,\n })}\n />\n );\n\n const labelNode = label && (\n <Label\n {...labelProps}\n htmlFor={id}\n style={labelProps?.style ?? labelStyle}\n className={labelProps?.className ?? labelClassName}\n floating\n dense={dense}\n error={error}\n active={active}\n disabled={disabled}\n >\n {label}\n </Label>\n );\n\n let children = (\n <>\n {area}\n {labelNode}\n </>\n );\n\n if (resize === \"auto\") {\n children = (\n <ResizingTextAreaWrapper\n {...resizeContainerProps}\n maskId={`${id}-mask`}\n maskRef={maskRef}\n rows={rows}\n areaStyle={areaStyle}\n areaClassName={areaClassName}\n defaultValue={value ?? defaultValue}\n disableTransition={disableTransition}\n >\n {children}\n </ResizingTextAreaWrapper>\n );\n }\n\n return (\n <FormMessageContainer\n {...messageContainerProps}\n messageProps={messageProps}\n >\n <TextFieldContainer\n {...containerProps}\n ref={containerRef}\n style={{\n ...style,\n \"--rmd-text-area-height\": height,\n }}\n className={textAreaContainer({\n animate: !disableTransition && resize === \"auto\",\n disabled,\n height: !!height,\n underlineLabelled:\n !!label && (theme === \"underline\" || theme === \"filled\"),\n className,\n })}\n theme={theme}\n label={!!label}\n error={error}\n dense={dense}\n inline={inline}\n active={active}\n readOnly={readOnly}\n disabled={disabled}\n leftAddon={leftAddon}\n rightAddon={rightAddon}\n underlineDirection={underlineDirection}\n disableLeftAddonStyles={disableLeftAddonStyles}\n disableRightAddonStyles={disableRightAddonStyles}\n onClick={(event) => {\n // The textarea container adds padding-top when there is a label so\n // that the label does not cover the text so this makes it so you\n // can still click anywhere in the \"box\" to focus the textarea.\n if (!disabled && event.target === event.currentTarget) {\n areaRef.current?.focus();\n }\n }}\n >\n {children}\n </TextFieldContainer>\n </FormMessageContainer>\n );\n }\n);\n"],"names":["forwardRef","useEnsuredId","useEnsuredRef","FormMessageContainer","Label","ResizingTextAreaWrapper","TextFieldContainer","getFormConfig","textArea","textAreaContainer","useResizingTextArea","TextArea","props","ref","id","propId","style","className","label","labelProps","labelStyle","labelClassName","areaStyle","areaClassName","resizeContainerProps","resize","dense","error","active","inline","propInline","leftAddon","rightAddon","disableLeftAddonStyles","disableRightAddonStyles","theme","propTheme","underlineDirection","propUnderlineDirection","messageProps","messageContainerProps","containerProps","rows","maxRows","onChange","propOnChange","disableTransition","propDisableTransition","remaining","disabled","readOnly","value","defaultValue","areaRef","areaRefCallback","maskRef","containerRef","height","scrollable","placeholder","area","textarea","placeholderHidden","labelNode","htmlFor","floating","children","maskId","animate","underlineLabelled","onClick","event","target","currentTarget","current","focus"],"mappings":"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"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "../utils";
|
|
7
|
+
@use "../spacing";
|
|
7
8
|
@use "../icon/icon";
|
|
8
9
|
@use "../typography/typography";
|
|
9
10
|
@use "base";
|
|
@@ -37,16 +38,16 @@ $typography-styles: map.merge(
|
|
|
37
38
|
/// The `gap` between elements in the `FormMessageCounter` component .
|
|
38
39
|
///
|
|
39
40
|
/// @type Number
|
|
40
|
-
$counter-spacing:
|
|
41
|
+
$counter-spacing: spacing.get-var(sm) !default;
|
|
41
42
|
|
|
42
43
|
/// The `margin-top` for the `FormMessage` component.
|
|
43
44
|
/// @type Number
|
|
44
|
-
$margin-top:
|
|
45
|
+
$margin-top: spacing.get-var(sm) !default;
|
|
45
46
|
|
|
46
47
|
/// The `margin-bottom` for the `FormMessage` component.
|
|
47
48
|
///
|
|
48
49
|
/// @type Number
|
|
49
|
-
$margin-bottom:
|
|
50
|
+
$margin-bottom: spacing.get-var(md) !default;
|
|
50
51
|
|
|
51
52
|
/// The `min-height` for the `FormMessage` component.
|
|
52
53
|
/// @type Number
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@use "sass:color";
|
|
6
6
|
@use "sass:map";
|
|
7
7
|
@use "../utils";
|
|
8
|
+
@use "../border-radius";
|
|
8
9
|
@use "../theme/theme";
|
|
9
10
|
@use "../icon/icon";
|
|
10
11
|
@use "../interaction/interaction";
|
|
@@ -32,7 +33,7 @@ $disable-uncontrolled: false !default;
|
|
|
32
33
|
|
|
33
34
|
/// The default border-radius for `Checkbox` and `Radio` components.
|
|
34
35
|
/// @type Number
|
|
35
|
-
$border-radius:
|
|
36
|
+
$border-radius: border-radius.get-var(full) !default;
|
|
36
37
|
|
|
37
38
|
/// The amount of padding to apply around the `Checkbox` and `Radio` icons
|
|
38
39
|
/// @type Number
|
package/dist/form/_label.scss
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "../utils";
|
|
7
|
+
@use "../spacing";
|
|
7
8
|
@use "../icon/icon";
|
|
8
9
|
@use "../transition/transition";
|
|
9
10
|
@use "../typography/typography";
|
|
@@ -58,7 +59,7 @@ $disable-stacked-reversed: $disable-everything !default;
|
|
|
58
59
|
///
|
|
59
60
|
/// @see $disable-gap
|
|
60
61
|
/// @type Number
|
|
61
|
-
$gap:
|
|
62
|
+
$gap: spacing.get-var(sm) !default;
|
|
62
63
|
|
|
63
64
|
/// The default `Label` font size.
|
|
64
65
|
///
|
|
@@ -95,7 +96,7 @@ $floating-scale: 0.75 !default;
|
|
|
95
96
|
/// the outline and add some general spacing.
|
|
96
97
|
///
|
|
97
98
|
/// @type Number
|
|
98
|
-
$floating-padding:
|
|
99
|
+
$floating-padding: spacing.get-var(xs) !default;
|
|
99
100
|
|
|
100
101
|
/// The available configurable css variables and mostly used internally for the
|
|
101
102
|
/// `get-var`, `set-var`, and `use-var` utils.
|
package/dist/form/_password.scss
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "../utils";
|
|
7
|
+
@use "../spacing";
|
|
7
8
|
@use "../button/button";
|
|
8
9
|
@use "base";
|
|
9
10
|
@use "text-field";
|
|
@@ -15,7 +16,7 @@ $disable-everything: text-field.$disable-everything !default;
|
|
|
15
16
|
/// The `padding-left` to apply to a `Password` when there is a visibility
|
|
16
17
|
/// icon.
|
|
17
18
|
/// @type Number
|
|
18
|
-
$visibility-toggle-spacing:
|
|
19
|
+
$visibility-toggle-spacing: spacing.get-var(xs) !default;
|
|
19
20
|
|
|
20
21
|
/// Generates all the styles based on feature flags.
|
|
21
22
|
///
|
package/dist/form/_select.scss
CHANGED
|
@@ -60,10 +60,10 @@ $option-selected-styles: (
|
|
|
60
60
|
/// prop has not been enabled.
|
|
61
61
|
///
|
|
62
62
|
/// @type Number
|
|
63
|
-
$option-padding-left:
|
|
64
|
-
|
|
65
|
-
2
|
|
66
|
-
|
|
63
|
+
$option-padding-left: calc(
|
|
64
|
+
list.$item-horizontal-padding -
|
|
65
|
+
#{math.div(icon.$size - $option-selected-icon-size, 2)}
|
|
66
|
+
) !default;
|
|
67
67
|
|
|
68
68
|
/// The spacing between the selected icon and the `Option` content.
|
|
69
69
|
/// @type Number
|
package/dist/form/_slider.scss
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
////
|
|
4
4
|
|
|
5
5
|
@use "../utils";
|
|
6
|
+
@use "../border-radius";
|
|
6
7
|
@use "../theme/colors";
|
|
7
8
|
@use "../theme/theme";
|
|
8
9
|
@use "../icon/icon";
|
|
@@ -136,7 +137,7 @@ $mark-width: $track-inactive-size !default;
|
|
|
136
137
|
|
|
137
138
|
/// The default border-radius for a discrete `Slider` tick mark.
|
|
138
139
|
/// @type Number
|
|
139
|
-
$mark-border-radius:
|
|
140
|
+
$mark-border-radius: border-radius.get-var(full) !default;
|
|
140
141
|
|
|
141
142
|
/// The light theme `Slider` tick mark color.
|
|
142
143
|
/// @type Color
|
|
@@ -216,7 +217,7 @@ $thumb-size: 1.25rem !default;
|
|
|
216
217
|
|
|
217
218
|
/// The `border-radius` for the `Slider` thumb.
|
|
218
219
|
/// @type Number
|
|
219
|
-
$thumb-border-radius:
|
|
220
|
+
$thumb-border-radius: border-radius.get-var(full) !default;
|
|
220
221
|
|
|
221
222
|
/// The amount of opacity to apply to the focused/active state of the `Slider`
|
|
222
223
|
/// thumb.
|
|
@@ -266,7 +267,7 @@ $tooltip-caret-size: 0.3rem !default;
|
|
|
266
267
|
|
|
267
268
|
/// The top/left for the discrete `Slider` tooltip.
|
|
268
269
|
/// @type Number
|
|
269
|
-
$tooltip-offset: -($thumb-size + icon.$spacing) !default;
|
|
270
|
+
$tooltip-offset: calc(-1 * ($thumb-size + icon.$spacing)) !default;
|
|
270
271
|
|
|
271
272
|
/// The `z-index` for the discrete `Slider` tooltip.
|
|
272
273
|
/// @type Number
|
package/dist/form/_switch.scss
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@use "sass:color";
|
|
6
6
|
@use "sass:map";
|
|
7
7
|
@use "../utils";
|
|
8
|
+
@use "../border-radius";
|
|
8
9
|
@use "../box-shadows";
|
|
9
10
|
@use "../theme/colors";
|
|
10
11
|
@use "../theme/theme";
|
|
@@ -41,7 +42,7 @@ $ball-size: 1.25em !default;
|
|
|
41
42
|
|
|
42
43
|
/// The `Switch` border radius.
|
|
43
44
|
/// @type Number
|
|
44
|
-
$ball-border-radius:
|
|
45
|
+
$ball-border-radius: border-radius.get-var(full) !default;
|
|
45
46
|
|
|
46
47
|
/// The distance from the `left` and `right` of the `Switch` track to display
|
|
47
48
|
/// the ball.
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
@use "base";
|
|
9
9
|
@use "label";
|
|
10
10
|
@use "text-field";
|
|
11
|
+
@use "../spacing";
|
|
11
12
|
|
|
12
13
|
/// Set to `true` to disable the `TextArea` styles
|
|
13
14
|
/// @type Boolean
|
|
@@ -31,14 +32,14 @@ $disable-resize-vertical: $disable-everything !default;
|
|
|
31
32
|
|
|
32
33
|
/// The default position for addons within a `TextArea`.
|
|
33
34
|
/// @type Number
|
|
34
|
-
$addon-top:
|
|
35
|
+
$addon-top: spacing.get-var(lg) !default;
|
|
35
36
|
|
|
36
37
|
/// The default vertical padding to apply to `TextArea` which is useful when
|
|
37
38
|
/// there is a scrollbar visible. This should normally be enough so that the
|
|
38
39
|
/// floating label does not cover the content.
|
|
39
40
|
///
|
|
40
41
|
/// @type Number
|
|
41
|
-
$vertical-padding:
|
|
42
|
+
$vertical-padding: calc(spacing.get-var(sm) * 1.5) !default;
|
|
42
43
|
|
|
43
44
|
/// The available configurable css variables and mostly used internally for the
|
|
44
45
|
/// `get-var`, `set-var`, and `use-var` utils.
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
@use "sass:map";
|
|
6
6
|
@use "../utils";
|
|
7
|
+
@use "../border-radius";
|
|
8
|
+
@use "../spacing";
|
|
7
9
|
@use "../box/box";
|
|
8
10
|
@use "../theme/colors";
|
|
9
11
|
@use "../theme/theme";
|
|
@@ -81,7 +83,7 @@ $label-dense-height: 3.25rem !default;
|
|
|
81
83
|
|
|
82
84
|
/// The `border-radius` for a `TextField`.
|
|
83
85
|
/// @type Number
|
|
84
|
-
$border-radius:
|
|
86
|
+
$border-radius: border-radius.get-var(xs) !default;
|
|
85
87
|
|
|
86
88
|
/// The `border-width` for a `TextField`.
|
|
87
89
|
/// @type Number
|
|
@@ -94,12 +96,12 @@ $border-width-active: 2px !default;
|
|
|
94
96
|
/// The amount of horizontal padding to apply to a `TextField` with the
|
|
95
97
|
/// `theme="filled"`.
|
|
96
98
|
/// @type Number
|
|
97
|
-
$filled-padding:
|
|
99
|
+
$filled-padding: calc(spacing.get-var(sm) * 1.5) !default;
|
|
98
100
|
|
|
99
101
|
/// The amount of horizontal padding to apply to a `TextField` with the
|
|
100
102
|
/// `theme="outline"`.
|
|
101
103
|
/// @type Number
|
|
102
|
-
$outlined-padding:
|
|
104
|
+
$outlined-padding: spacing.get-var(md) !default;
|
|
103
105
|
|
|
104
106
|
/// The amount of horizontal padding to apply to a `TextField` with the
|
|
105
107
|
/// `theme="underline"`.
|
|
@@ -122,7 +124,7 @@ $underlined-placeholder-height: 2.5rem !default;
|
|
|
122
124
|
/// `null`.
|
|
123
125
|
///
|
|
124
126
|
/// @type Number
|
|
125
|
-
$underlined-placeholder-padding-top:
|
|
127
|
+
$underlined-placeholder-padding-top: spacing.get-var(sm) !default;
|
|
126
128
|
|
|
127
129
|
/// The amount of padding-top to apply to addons in a `TextField` while the
|
|
128
130
|
/// `theme="underline"`.
|
|
@@ -131,7 +133,7 @@ $underlined-placeholder-padding-top: 0.5rem !default;
|
|
|
131
133
|
/// `null`.
|
|
132
134
|
///
|
|
133
135
|
/// @type Number
|
|
134
|
-
$underlined-placeholder-addon-padding-top:
|
|
136
|
+
$underlined-placeholder-addon-padding-top: spacing.get-var(xs) !default;
|
|
135
137
|
|
|
136
138
|
/// The amount of padding-top to apply to the `TextFieldContainer` while the
|
|
137
139
|
/// `theme="underline"` and a `label` was provided.
|
|
@@ -139,13 +141,13 @@ $underlined-placeholder-addon-padding-top: 0.25rem !default;
|
|
|
139
141
|
/// NOTE: This is the default height of the label with line-height
|
|
140
142
|
///
|
|
141
143
|
/// @type Number
|
|
142
|
-
$underlined-label-padding-top:
|
|
144
|
+
$underlined-label-padding-top: spacing.get-var(lg) !default;
|
|
143
145
|
|
|
144
146
|
/// The position in the `TextFieldContainer` for a `Label` while the
|
|
145
147
|
/// `theme="underline"`.
|
|
146
148
|
///
|
|
147
149
|
/// @type Number
|
|
148
|
-
$underlined-label-left-offset:
|
|
150
|
+
$underlined-label-left-offset: spacing.get-var(sm) !default;
|
|
149
151
|
|
|
150
152
|
/// Set this to `null` if not using `<TextField type="color" />` since this is
|
|
151
153
|
/// used to apply a `min-width` to color inputs.
|
|
@@ -157,18 +159,18 @@ $color-min-width: 5rem !default;
|
|
|
157
159
|
/// i.e. `leftAddon={<><FavoriteIcon /><CloseIcon /></>}`
|
|
158
160
|
///
|
|
159
161
|
/// @type Number
|
|
160
|
-
$addon-gap:
|
|
162
|
+
$addon-gap: spacing.get-var(xs) !default;
|
|
161
163
|
|
|
162
164
|
/// The amount of margin to apply to addons when the `TextField`
|
|
163
165
|
/// `theme="underline"`.
|
|
164
166
|
/// @type Number
|
|
165
|
-
$addon-margin:
|
|
167
|
+
$addon-margin: spacing.get-var(sm) !default;
|
|
166
168
|
|
|
167
169
|
/// The amount of spacing between a `TextField` addon and the `<input>`
|
|
168
170
|
/// element.
|
|
169
171
|
///
|
|
170
172
|
/// @type Number
|
|
171
|
-
$addon-spacing:
|
|
173
|
+
$addon-spacing: spacing.get-var(sm) !default;
|
|
172
174
|
|
|
173
175
|
/// The border-color for a `theme="outline"` `TextField` in the light theme.
|
|
174
176
|
/// @type Color
|
|
@@ -547,17 +549,19 @@ $variables: (
|
|
|
547
549
|
}
|
|
548
550
|
|
|
549
551
|
@if not $disable-addon {
|
|
550
|
-
$addon-offset:
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
552
|
+
$addon-offset: calc(
|
|
553
|
+
#{icon.get-var(size) +
|
|
554
|
+
if($underlined-padding, "#{$underlined-padding} + ", "")} +
|
|
555
|
+
$underlined-label-left-offset *
|
|
556
|
+
2
|
|
557
|
+
);
|
|
554
558
|
|
|
555
559
|
&--underline-left-addon {
|
|
556
|
-
@include set-var(padding-left,
|
|
560
|
+
@include set-var(padding-left, $addon-offset);
|
|
557
561
|
}
|
|
558
562
|
|
|
559
563
|
&--underline-right-addon {
|
|
560
|
-
@include set-var(padding-right,
|
|
564
|
+
@include set-var(padding-right, $addon-offset);
|
|
561
565
|
}
|
|
562
566
|
}
|
|
563
567
|
}
|
package/dist/form/utils.js
CHANGED
package/dist/form/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/form/utils.ts"],"sourcesContent":["import { type KeyboardEvent } from \"react\";\n\n/**\n * This util should be used to implement the native \"Enter\" keypress behavior\n * for \"fake\" form components to submit the form if exists.\n *\n * The way this will work will be:\n * - attempt to find a form by querying for a parent form element. if no parent\n * form element can be found, try to use the `formId` in a\n * `document.getElementById`\n * - if a form element is found, find the submit button within the form. If\n * there are no submit buttons within the form, try to find a submit button in\n * the document that is linked to this form by `form={formId}`\n * - if the submit button was found, click it to trigger the form submit\n * behavior\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n * @internal\n * @since 2.7.0\n * @since 6.0.0 No longer returns a boolean, added the `formId` parameter, and\n * moved into the form package.\n * @since 6.0.0 Uses `form.requestSubmit` instead of clicking the submit button\n */\nexport function tryToSubmitRelatedForm<E extends HTMLElement>(\n event: KeyboardEvent<E>,\n formId: string | undefined\n): void {\n const { currentTarget } = event;\n let form: HTMLElement | null = null;\n if (formId) {\n form = document.getElementById(formId);\n } else {\n form = currentTarget.closest(\"form\");\n }\n\n if (!form || !(form instanceof HTMLFormElement)) {\n return;\n }\n\n formId = formId || form.id;\n let submit = form.querySelector<HTMLButtonElement>('[type=\"submit\"]');\n if (!submit && formId) {\n submit = document.querySelector<HTMLButtonElement>(\n `[type=\"submit\"][form=\"${formId}\"]`\n );\n }\n\n form.requestSubmit(submit);\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport type EditableHTMLElement = HTMLInputElement | HTMLTextAreaElement;\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport type ChangeableHTMLElement = EditableHTMLElement | HTMLSelectElement;\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport function isChangeableHTMLElement(\n element: Element | null\n): element is ChangeableHTMLElement {\n return !!element && \"value\" in element;\n}\n\n/**\n * This is used to trigger a change event for a form element.\n *\n * @internal\n * @see https://stackoverflow.com/a/46012210\n * @since 6.0.0\n */\nexport function triggerManualChangeEvent(\n element: ChangeableHTMLElement | null,\n value: string | number\n): void {\n if (!element) {\n return;\n }\n\n const prototype = Object.getPrototypeOf(element);\n const setter = Object.getOwnPropertyDescriptor(prototype, \"value\")?.set;\n if (!setter) {\n return;\n }\n\n setter.call(element, value);\n const event = new Event(\"input\", { bubbles: true });\n element.dispatchEvent(event);\n}\n"],"names":["tryToSubmitRelatedForm","event","formId","currentTarget","form","document","getElementById","closest","HTMLFormElement","id","submit","querySelector","requestSubmit","isChangeableHTMLElement","element","triggerManualChangeEvent","value","prototype","Object","getPrototypeOf","setter","getOwnPropertyDescriptor","set","call","Event","bubbles","dispatchEvent"],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,SAASA,uBACdC,KAAuB,EACvBC,MAA0B;IAE1B,MAAM,EAAEC,aAAa,EAAE,GAAGF;IAC1B,IAAIG,OAA2B;IAC/B,IAAIF,QAAQ;QACVE,OAAOC,SAASC,cAAc,CAACJ;IACjC,OAAO;QACLE,OAAOD,cAAcI,OAAO,CAAC;IAC/B;IAEA,IAAI,CAACH,QAAQ,CAAEA,CAAAA,gBAAgBI,eAAc,GAAI;QAC/C;IACF;
|
|
1
|
+
{"version":3,"sources":["../../src/form/utils.ts"],"sourcesContent":["import { type KeyboardEvent } from \"react\";\n\n/**\n * This util should be used to implement the native \"Enter\" keypress behavior\n * for \"fake\" form components to submit the form if exists.\n *\n * The way this will work will be:\n * - attempt to find a form by querying for a parent form element. if no parent\n * form element can be found, try to use the `formId` in a\n * `document.getElementById`\n * - if a form element is found, find the submit button within the form. If\n * there are no submit buttons within the form, try to find a submit button in\n * the document that is linked to this form by `form={formId}`\n * - if the submit button was found, click it to trigger the form submit\n * behavior\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/requestSubmit\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit\n * @internal\n * @since 2.7.0\n * @since 6.0.0 No longer returns a boolean, added the `formId` parameter, and\n * moved into the form package.\n * @since 6.0.0 Uses `form.requestSubmit` instead of clicking the submit button\n */\nexport function tryToSubmitRelatedForm<E extends HTMLElement>(\n event: KeyboardEvent<E>,\n formId: string | undefined\n): void {\n const { currentTarget } = event;\n let form: HTMLElement | null = null;\n if (formId) {\n form = document.getElementById(formId);\n } else {\n form = currentTarget.closest(\"form\");\n }\n\n if (!form || !(form instanceof HTMLFormElement)) {\n return;\n }\n\n // eslint-disable-next-line no-param-reassign\n formId = formId || form.id;\n let submit = form.querySelector<HTMLButtonElement>('[type=\"submit\"]');\n if (!submit && formId) {\n submit = document.querySelector<HTMLButtonElement>(\n `[type=\"submit\"][form=\"${formId}\"]`\n );\n }\n\n form.requestSubmit(submit);\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport type EditableHTMLElement = HTMLInputElement | HTMLTextAreaElement;\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport type ChangeableHTMLElement = EditableHTMLElement | HTMLSelectElement;\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport function isChangeableHTMLElement(\n element: Element | null\n): element is ChangeableHTMLElement {\n return !!element && \"value\" in element;\n}\n\n/**\n * This is used to trigger a change event for a form element.\n *\n * @internal\n * @see https://stackoverflow.com/a/46012210\n * @since 6.0.0\n */\nexport function triggerManualChangeEvent(\n element: ChangeableHTMLElement | null,\n value: string | number\n): void {\n if (!element) {\n return;\n }\n\n const prototype = Object.getPrototypeOf(element);\n const setter = Object.getOwnPropertyDescriptor(prototype, \"value\")?.set;\n if (!setter) {\n return;\n }\n\n setter.call(element, value);\n const event = new Event(\"input\", { bubbles: true });\n element.dispatchEvent(event);\n}\n"],"names":["tryToSubmitRelatedForm","event","formId","currentTarget","form","document","getElementById","closest","HTMLFormElement","id","submit","querySelector","requestSubmit","isChangeableHTMLElement","element","triggerManualChangeEvent","value","prototype","Object","getPrototypeOf","setter","getOwnPropertyDescriptor","set","call","Event","bubbles","dispatchEvent"],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;CAqBC,GACD,OAAO,SAASA,uBACdC,KAAuB,EACvBC,MAA0B;IAE1B,MAAM,EAAEC,aAAa,EAAE,GAAGF;IAC1B,IAAIG,OAA2B;IAC/B,IAAIF,QAAQ;QACVE,OAAOC,SAASC,cAAc,CAACJ;IACjC,OAAO;QACLE,OAAOD,cAAcI,OAAO,CAAC;IAC/B;IAEA,IAAI,CAACH,QAAQ,CAAEA,CAAAA,gBAAgBI,eAAc,GAAI;QAC/C;IACF;IAEA,6CAA6C;IAC7CN,SAASA,UAAUE,KAAKK,EAAE;IAC1B,IAAIC,SAASN,KAAKO,aAAa,CAAoB;IACnD,IAAI,CAACD,UAAUR,QAAQ;QACrBQ,SAASL,SAASM,aAAa,CAC7B,CAAC,sBAAsB,EAAET,OAAO,EAAE,CAAC;IAEvC;IAEAE,KAAKQ,aAAa,CAACF;AACrB;AAcA;;;CAGC,GACD,OAAO,SAASG,wBACdC,OAAuB;IAEvB,OAAO,CAAC,CAACA,WAAW,WAAWA;AACjC;AAEA;;;;;;CAMC,GACD,OAAO,SAASC,yBACdD,OAAqC,EACrCE,KAAsB;IAEtB,IAAI,CAACF,SAAS;QACZ;IACF;IAEA,MAAMG,YAAYC,OAAOC,cAAc,CAACL;IACxC,MAAMM,SAASF,OAAOG,wBAAwB,CAACJ,WAAW,UAAUK;IACpE,IAAI,CAACF,QAAQ;QACX;IACF;IAEAA,OAAOG,IAAI,CAACT,SAASE;IACrB,MAAMf,QAAQ,IAAIuB,MAAM,SAAS;QAAEC,SAAS;IAAK;IACjDX,QAAQY,aAAa,CAACzB;AACxB"}
|
package/dist/icon/_icon.scss
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
////
|
|
4
4
|
|
|
5
5
|
@use "sass:color";
|
|
6
|
+
@use "../spacing";
|
|
6
7
|
@use "../theme/theme";
|
|
7
8
|
@use "../transition/transition";
|
|
8
9
|
@use "../utils";
|
|
@@ -162,7 +163,7 @@ $_validated_optical-size: utils.validate(
|
|
|
162
163
|
/// should be separated from other content.
|
|
163
164
|
///
|
|
164
165
|
/// @type Number
|
|
165
|
-
$spacing:
|
|
166
|
+
$spacing: spacing.get-var(sm) !default;
|
|
166
167
|
|
|
167
168
|
/// The default `IconRotator` starting position
|
|
168
169
|
/// @type String
|