@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.
Files changed (230) hide show
  1. package/dist/RootHtml.d.ts +1 -1
  2. package/dist/RootHtml.js.map +1 -1
  3. package/dist/_base.scss +6 -2
  4. package/dist/_border-radius.scss +92 -0
  5. package/dist/_core.scss +2 -0
  6. package/dist/_spacing.scss +86 -0
  7. package/dist/app-bar/_app-bar.scss +9 -7
  8. package/dist/app-bar/styles.js +1 -1
  9. package/dist/app-bar/styles.js.map +1 -1
  10. package/dist/autocomplete/defaults.d.ts +1 -0
  11. package/dist/autocomplete/defaults.js +2 -6
  12. package/dist/autocomplete/defaults.js.map +1 -1
  13. package/dist/autocomplete/types.d.ts +9 -9
  14. package/dist/autocomplete/types.js.map +1 -1
  15. package/dist/avatar/Avatar.d.ts +1 -1
  16. package/dist/avatar/Avatar.js +1 -1
  17. package/dist/avatar/Avatar.js.map +1 -1
  18. package/dist/avatar/_avatar.scss +3 -3
  19. package/dist/avatar/styles.d.ts +29 -1
  20. package/dist/avatar/styles.js.map +1 -1
  21. package/dist/badge/_badge.scss +10 -2
  22. package/dist/box/_box.scss +78 -11
  23. package/dist/box/styles.d.ts +26 -3
  24. package/dist/box/styles.js.map +1 -1
  25. package/dist/button/AsyncButton.d.ts +2 -2
  26. package/dist/button/AsyncButton.js.map +1 -1
  27. package/dist/button/Button.d.ts +1 -1
  28. package/dist/button/Button.js.map +1 -1
  29. package/dist/button/_button.scss +21 -11
  30. package/dist/card/CardHeader.d.ts +1 -1
  31. package/dist/card/CardHeader.js.map +1 -1
  32. package/dist/card/_card.scss +9 -7
  33. package/dist/chip/Chip.d.ts +1 -1
  34. package/dist/chip/Chip.js.map +1 -1
  35. package/dist/chip/_chip.scss +9 -7
  36. package/dist/dialog/Dialog.d.ts +1 -1
  37. package/dist/dialog/Dialog.js.map +1 -1
  38. package/dist/dialog/_dialog.scss +7 -6
  39. package/dist/divider/_divider.scss +3 -2
  40. package/dist/expansion-panel/ExpansionPanel.d.ts +1 -1
  41. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  42. package/dist/expansion-panel/ExpansionPanelHeader.d.ts +1 -1
  43. package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
  44. package/dist/expansion-panel/_expansion-panel.scss +4 -3
  45. package/dist/files/FileInput.d.ts +1 -1
  46. package/dist/files/FileInput.js.map +1 -1
  47. package/dist/form/FormMessageContainer.d.ts +1 -1
  48. package/dist/form/FormMessageContainer.js.map +1 -1
  49. package/dist/form/InputToggle.d.ts +2 -2
  50. package/dist/form/InputToggle.js.map +1 -1
  51. package/dist/form/NativeSelect.d.ts +1 -1
  52. package/dist/form/NativeSelect.js.map +1 -1
  53. package/dist/form/OptGroup.d.ts +1 -1
  54. package/dist/form/OptGroup.js.map +1 -1
  55. package/dist/form/Password.d.ts +1 -1
  56. package/dist/form/Password.js.map +1 -1
  57. package/dist/form/Select.d.ts +2 -2
  58. package/dist/form/Select.js.map +1 -1
  59. package/dist/form/Slider.d.ts +1 -1
  60. package/dist/form/Slider.js.map +1 -1
  61. package/dist/form/Switch.d.ts +3 -3
  62. package/dist/form/Switch.js.map +1 -1
  63. package/dist/form/SwitchTrack.d.ts +1 -1
  64. package/dist/form/SwitchTrack.js.map +1 -1
  65. package/dist/form/TextArea.d.ts +2 -2
  66. package/dist/form/TextArea.js +1 -1
  67. package/dist/form/TextArea.js.map +1 -1
  68. package/dist/form/TextField.d.ts +1 -1
  69. package/dist/form/TextField.js.map +1 -1
  70. package/dist/form/_form-message.scss +4 -3
  71. package/dist/form/_input-toggle.scss +2 -1
  72. package/dist/form/_label.scss +3 -2
  73. package/dist/form/_password.scss +2 -1
  74. package/dist/form/_select.scss +4 -4
  75. package/dist/form/_slider.scss +4 -3
  76. package/dist/form/_switch.scss +2 -1
  77. package/dist/form/_text-area.scss +3 -2
  78. package/dist/form/_text-field.scss +20 -16
  79. package/dist/form/types.d.ts +5 -5
  80. package/dist/form/types.js.map +1 -1
  81. package/dist/form/utils.js +1 -0
  82. package/dist/form/utils.js.map +1 -1
  83. package/dist/icon/_icon.scss +2 -1
  84. package/dist/interaction/useElementInteraction.js +1 -1
  85. package/dist/interaction/useElementInteraction.js.map +1 -1
  86. package/dist/layout/LayoutAppBar.d.ts +1 -1
  87. package/dist/layout/LayoutAppBar.js.map +1 -1
  88. package/dist/layout/LayoutNav.js +1 -1
  89. package/dist/layout/LayoutNav.js.map +1 -1
  90. package/dist/layout/useMainTabIndex.js +1 -0
  91. package/dist/layout/useMainTabIndex.js.map +1 -1
  92. package/dist/link/_link.scss +3 -2
  93. package/dist/list/ListItemLink.d.ts +1 -1
  94. package/dist/list/ListItemLink.js.map +1 -1
  95. package/dist/list/ListItemText.d.ts +1 -1
  96. package/dist/list/ListItemText.js.map +1 -1
  97. package/dist/list/ListSubheader.d.ts +1 -1
  98. package/dist/list/ListSubheader.js.map +1 -1
  99. package/dist/list/_list.scss +7 -6
  100. package/dist/list/types.d.ts +2 -2
  101. package/dist/list/types.js.map +1 -1
  102. package/dist/menu/Menu.d.ts +3 -3
  103. package/dist/menu/Menu.js.map +1 -1
  104. package/dist/menu/MenuItemInputToggle.d.ts +2 -2
  105. package/dist/menu/MenuItemInputToggle.js.map +1 -1
  106. package/dist/menu/MenuItemTextField.d.ts +1 -1
  107. package/dist/menu/MenuItemTextField.js.map +1 -1
  108. package/dist/menu/MenuSheet.d.ts +1 -1
  109. package/dist/menu/MenuSheet.js.map +1 -1
  110. package/dist/menu/_menu.scss +2 -1
  111. package/dist/navigation/CollapsibleNavGroup.d.ts +2 -2
  112. package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
  113. package/dist/navigation/NavItemLink.d.ts +1 -1
  114. package/dist/navigation/NavItemLink.js.map +1 -1
  115. package/dist/navigation/_navigation.scss +5 -3
  116. package/dist/progress/CircularProgress.d.ts +2 -17
  117. package/dist/progress/CircularProgress.js +19 -23
  118. package/dist/progress/CircularProgress.js.map +1 -1
  119. package/dist/progress/LinearProgress.d.ts +5 -1
  120. package/dist/progress/LinearProgress.js +13 -25
  121. package/dist/progress/LinearProgress.js.map +1 -1
  122. package/dist/progress/circularProgressStyles.d.ts +62 -0
  123. package/dist/progress/circularProgressStyles.js +38 -0
  124. package/dist/progress/circularProgressStyles.js.map +1 -0
  125. package/dist/progress/linearProgressStyles.d.ts +38 -0
  126. package/dist/progress/linearProgressStyles.js +38 -0
  127. package/dist/progress/linearProgressStyles.js.map +1 -0
  128. package/dist/responsive-item/_responsive-item.scss +2 -1
  129. package/dist/searching/caseInsensitive.d.ts +20 -4
  130. package/dist/searching/caseInsensitive.js +5 -1
  131. package/dist/searching/caseInsensitive.js.map +1 -1
  132. package/dist/searching/fuzzy.d.ts +3 -3
  133. package/dist/searching/fuzzy.js +5 -1
  134. package/dist/searching/fuzzy.js.map +1 -1
  135. package/dist/searching/utils.d.ts +2 -1
  136. package/dist/searching/utils.js +11 -2
  137. package/dist/searching/utils.js.map +1 -1
  138. package/dist/segmented-button/_segmented-button.scss +20 -13
  139. package/dist/sheet/_sheet.scss +2 -1
  140. package/dist/snackbar/Toast.d.ts +1 -1
  141. package/dist/snackbar/Toast.js.map +1 -1
  142. package/dist/snackbar/_snackbar.scss +12 -10
  143. package/dist/table/TableCell.d.ts +1 -1
  144. package/dist/table/TableCell.js.map +1 -1
  145. package/dist/table/TableCheckbox.d.ts +1 -1
  146. package/dist/table/TableCheckbox.js.map +1 -1
  147. package/dist/table/TableRadio.d.ts +1 -1
  148. package/dist/table/TableRadio.js.map +1 -1
  149. package/dist/table/_table.scss +5 -4
  150. package/dist/tabs/TabListScrollButton.d.ts +1 -1
  151. package/dist/tabs/TabListScrollButton.js.map +1 -1
  152. package/dist/tabs/_tabs.scss +7 -4
  153. package/dist/theme/utils.js +2 -2
  154. package/dist/theme/utils.js.map +1 -1
  155. package/dist/tooltip/_tooltip.scss +52 -25
  156. package/dist/transition/_transition.scss +2 -1
  157. package/dist/tree/TreeItem.d.ts +2 -2
  158. package/dist/tree/TreeItem.js.map +1 -1
  159. package/dist/tree/_tree.scss +1 -1
  160. package/dist/types.d.ts +29 -2
  161. package/dist/types.js +1 -1
  162. package/dist/types.js.map +1 -1
  163. package/dist/utils/alphaNumericSort.d.ts +9 -9
  164. package/dist/utils/alphaNumericSort.js +5 -1
  165. package/dist/utils/alphaNumericSort.js.map +1 -1
  166. package/dist/utils/bem.js +1 -1
  167. package/dist/utils/bem.js.map +1 -1
  168. package/dist/utils/parseCssLengthUnit.js +3 -0
  169. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  170. package/package.json +13 -13
  171. package/src/RootHtml.tsx +1 -1
  172. package/src/app-bar/styles.ts +1 -1
  173. package/src/autocomplete/defaults.ts +5 -12
  174. package/src/autocomplete/types.ts +9 -12
  175. package/src/avatar/Avatar.tsx +2 -2
  176. package/src/avatar/styles.ts +53 -1
  177. package/src/box/styles.ts +34 -13
  178. package/src/button/AsyncButton.tsx +2 -2
  179. package/src/button/Button.tsx +1 -1
  180. package/src/card/CardHeader.tsx +1 -1
  181. package/src/chip/Chip.tsx +1 -1
  182. package/src/dialog/Dialog.tsx +1 -4
  183. package/src/expansion-panel/ExpansionPanel.tsx +1 -1
  184. package/src/expansion-panel/ExpansionPanelHeader.tsx +1 -1
  185. package/src/files/FileInput.tsx +1 -4
  186. package/src/form/FormMessageContainer.tsx +1 -1
  187. package/src/form/InputToggle.tsx +2 -5
  188. package/src/form/NativeSelect.tsx +1 -1
  189. package/src/form/OptGroup.tsx +1 -4
  190. package/src/form/Password.tsx +1 -1
  191. package/src/form/Select.tsx +2 -3
  192. package/src/form/Slider.tsx +1 -1
  193. package/src/form/Switch.tsx +3 -3
  194. package/src/form/SwitchTrack.tsx +1 -1
  195. package/src/form/TextArea.tsx +3 -6
  196. package/src/form/TextField.tsx +1 -1
  197. package/src/form/types.ts +5 -15
  198. package/src/form/utils.ts +1 -0
  199. package/src/interaction/useElementInteraction.tsx +1 -1
  200. package/src/layout/LayoutAppBar.tsx +1 -1
  201. package/src/layout/LayoutNav.tsx +1 -1
  202. package/src/layout/useMainTabIndex.ts +1 -0
  203. package/src/list/ListItemLink.tsx +1 -1
  204. package/src/list/ListItemText.tsx +1 -4
  205. package/src/list/ListSubheader.tsx +1 -1
  206. package/src/list/types.ts +2 -5
  207. package/src/menu/Menu.tsx +3 -4
  208. package/src/menu/MenuItemInputToggle.tsx +2 -2
  209. package/src/menu/MenuItemTextField.tsx +1 -1
  210. package/src/menu/MenuSheet.tsx +1 -1
  211. package/src/navigation/CollapsibleNavGroup.tsx +2 -2
  212. package/src/navigation/NavItemLink.tsx +1 -1
  213. package/src/progress/CircularProgress.tsx +31 -53
  214. package/src/progress/LinearProgress.tsx +27 -40
  215. package/src/progress/circularProgressStyles.ts +114 -0
  216. package/src/progress/linearProgressStyles.ts +90 -0
  217. package/src/searching/caseInsensitive.ts +29 -7
  218. package/src/searching/fuzzy.ts +12 -6
  219. package/src/searching/utils.ts +13 -2
  220. package/src/snackbar/Toast.tsx +1 -1
  221. package/src/table/TableCell.tsx +1 -4
  222. package/src/table/TableCheckbox.tsx +1 -1
  223. package/src/table/TableRadio.tsx +1 -1
  224. package/src/tabs/TabListScrollButton.tsx +1 -1
  225. package/src/theme/utils.ts +2 -1
  226. package/src/tree/TreeItem.tsx +2 -2
  227. package/src/types.ts +44 -2
  228. package/src/utils/alphaNumericSort.ts +17 -11
  229. package/src/utils/bem.ts +1 -1
  230. package/src/utils/parseCssLengthUnit.ts +4 -0
@@ -45,7 +45,7 @@ export interface ListSubheaderProps
45
45
  /**
46
46
  * @since 6.0.0
47
47
  */
48
- textProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
48
+ textProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;
49
49
  }
50
50
 
51
51
  /**
package/src/list/types.ts CHANGED
@@ -160,7 +160,7 @@ export interface ListItemChildrenTextProps {
160
160
  *
161
161
  * @since 6.0.0
162
162
  */
163
- textProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
163
+ textProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;
164
164
 
165
165
  /**
166
166
  * An optional className to apply to the `<span>` that surrounds the
@@ -206,10 +206,7 @@ export interface ListItemChildrenTextProps {
206
206
  *
207
207
  * @since 6.0.0
208
208
  */
209
- secondaryTextProps?: PropsWithRef<
210
- HTMLAttributes<HTMLSpanElement>,
211
- HTMLSpanElement
212
- >;
209
+ secondaryTextProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;
213
210
 
214
211
  /**
215
212
  * Set this to `true` to allow the {@link secondaryText} to span multiple
package/src/menu/Menu.tsx CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  import { type FloatingActionButtonPosition } from "../button/FloatingActionButton.js";
13
13
  import { useFocusContainer } from "../focus/useFocusContainer.js";
14
14
  import { useUserInteractionMode } from "../interaction/UserInteractionModeProvider.js";
15
- import { type ListElement, type ListProps } from "../list/List.js";
15
+ import { type ListProps } from "../list/List.js";
16
16
  import { useAppSize } from "../media-queries/AppSizeProvider.js";
17
17
  import { type GetDefaultFocusedIndex } from "../movement/types.js";
18
18
  import { Portal } from "../portal/Portal.js";
@@ -149,7 +149,7 @@ export interface MenuListConvenienceProps {
149
149
  * Any additional props to pass to the `List` component that surrounds the
150
150
  * `Menu`'s `MenuItem`s.
151
151
  */
152
- listProps?: PropsWithRef<Omit<ListProps, "horizontal">, ListElement>;
152
+ listProps?: PropsWithRef<Omit<ListProps, "horizontal">>;
153
153
  }
154
154
 
155
155
  /**
@@ -186,8 +186,7 @@ export interface MenuConvenienceProps extends MenuConfigurationProps {
186
186
  | "visible"
187
187
  | "onRequestClose"
188
188
  | "getDefaultFocusedIndex"
189
- >,
190
- HTMLDivElement
189
+ >
191
190
  >;
192
191
 
193
192
  /**
@@ -108,10 +108,10 @@ export type MenuItemRadioProps = BaseMenuItemInputToggleProps;
108
108
  * @since 6.0.0 Added additional props for styling the track and ball.
109
109
  */
110
110
  export interface MenuItemSwitchProps extends BaseMenuItemInputToggleProps {
111
- trackProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
111
+ trackProps?: PropsWithRef<HTMLAttributes<HTMLDivElement>>;
112
112
  trackStyle?: CSSProperties;
113
113
  trackClassName?: string;
114
- ballProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;
114
+ ballProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;
115
115
  ballStyle?: CSSProperties;
116
116
  ballClassName?: string;
117
117
  }
@@ -13,7 +13,7 @@ export interface MenuItemTextFieldProps extends TextFieldProps {
13
13
  /**
14
14
  * Any additional props or a `ref` to apply to the surrounding `<li>` element.
15
15
  */
16
- liProps?: PropsWithRef<HTMLAttributes<HTMLLIElement>, HTMLLIElement>;
16
+ liProps?: PropsWithRef<HTMLAttributes<HTMLLIElement>>;
17
17
 
18
18
  /** @defaultValue `true` */
19
19
  stretch?: boolean;
@@ -43,7 +43,7 @@ export interface MenuSheetConvenienceProps {
43
43
  * />
44
44
  * ```
45
45
  */
46
- sheetProps?: PropsWithRef<MenuSheetConfigurableProps, HTMLDivElement>;
46
+ sheetProps?: PropsWithRef<MenuSheetConfigurableProps>;
47
47
 
48
48
  /**
49
49
  * Convenience prop to apply custom style to the `Sheet` component when the
@@ -25,8 +25,8 @@ const noop = (): void => {
25
25
  export interface CollapsibleNavGroupProps
26
26
  extends NavGroupProps,
27
27
  NavItemButtonRotatorProps {
28
- liProps?: PropsWithRef<LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
29
- buttonProps?: PropsWithRef<ButtonProps, HTMLButtonElement>;
28
+ liProps?: PropsWithRef<LiHTMLAttributes<HTMLLIElement>>;
29
+ buttonProps?: PropsWithRef<ButtonProps>;
30
30
  collapseOptions?: Omit<
31
31
  CollapseTransitionHookOptions<HTMLUListElement>,
32
32
  "nodeRef" | "className" | "transitionIn"
@@ -36,7 +36,7 @@ export interface NavItemLinkProps
36
36
  * Any additional props to provide the wrapping `<li>` element such as
37
37
  * `style`, `className`, and `ref`.
38
38
  */
39
- liProps?: PropsWithRef<LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>;
39
+ liProps?: PropsWithRef<LiHTMLAttributes<HTMLLIElement>>;
40
40
 
41
41
  /**
42
42
  * Set this to `true` if the link matches the current `pathname`. This will
@@ -1,4 +1,3 @@
1
- import { cnb } from "cnbuilder";
2
1
  import {
3
2
  type CSSProperties,
4
3
  type HTMLAttributes,
@@ -6,11 +5,15 @@ import {
6
5
  useMemo,
7
6
  } from "react";
8
7
 
9
- import { cssUtils } from "../cssUtils.js";
10
8
  import { type LabelRequiredForA11y } from "../types.js";
11
9
  import { useEnsuredId } from "../useEnsuredId.js";
12
- import { bem } from "../utils/bem.js";
13
10
  import { getPercentage } from "../utils/getPercentage.js";
11
+ import {
12
+ type CircularProgressClassNameOptions,
13
+ circularProgress,
14
+ circularProgressCircle,
15
+ circularProgressSvg,
16
+ } from "./circularProgressStyles.js";
14
17
  import { type ProgressProps } from "./types.js";
15
18
 
16
19
  /**
@@ -22,7 +25,8 @@ import { type ProgressProps } from "./types.js";
22
25
  */
23
26
  export interface CircularProgressProps
24
27
  extends Omit<HTMLAttributes<HTMLSpanElement>, "id">,
25
- ProgressProps {
28
+ ProgressProps,
29
+ CircularProgressClassNameOptions {
26
30
  /**
27
31
  * An optional style to apply to the svg within the circular progress. The
28
32
  * values of this style object will be merged with the current determinate
@@ -84,24 +88,6 @@ export interface CircularProgressProps
84
88
  */
85
89
  dashoffset?: number;
86
90
 
87
- /**
88
- * Boolean if the circular progress should be centered using left and right
89
- * margins.
90
- *
91
- * @defaultValue `false`
92
- * @since 6.0.0 Renamed from `centered`
93
- */
94
- disableCentered?: boolean;
95
-
96
- /**
97
- * Set to `true` to render as a smaller size.
98
- *
99
- * @defaultValue `false`
100
- * @since 2.3.0
101
- * @since 6.0.0 Renamed from `small`
102
- */
103
- dense?: boolean;
104
-
105
91
  /**
106
92
  * Set this to `true` to update the indeterminate behavior to only rotate
107
93
  * which will increase performance during CPU-intensive tasks or when many
@@ -113,8 +99,6 @@ export interface CircularProgressProps
113
99
  disableShrink?: boolean;
114
100
  }
115
101
 
116
- const styles = bem("rmd-circular-progress");
117
-
118
102
  /**
119
103
  * @example Indeterminate Example
120
104
  * ```tsx
@@ -160,12 +144,12 @@ export const CircularProgress = forwardRef<
160
144
  radius = 30,
161
145
  center = 33,
162
146
  viewBox = "0 0 66 66",
163
- theme = "primary",
164
- dense = false,
147
+ theme,
148
+ dense,
165
149
  dashoffset = 187,
166
- disableShrink = false,
167
- disableCentered = false,
168
- disableTransition = false,
150
+ disableShrink,
151
+ disableCentered,
152
+ disableTransition,
169
153
  ...remaining
170
154
  } = props;
171
155
 
@@ -186,8 +170,7 @@ export const CircularProgress = forwardRef<
186
170
  };
187
171
  }, [progress, propCircleStyle, dashoffset]);
188
172
 
189
- const determinate = typeof progress === "number";
190
- const indeterminate = !determinate;
173
+ const indeterminate = typeof progress !== "number";
191
174
  return (
192
175
  <span
193
176
  {...remaining}
@@ -197,35 +180,30 @@ export const CircularProgress = forwardRef<
197
180
  aria-valuemin={min}
198
181
  aria-valuemax={max}
199
182
  aria-valuenow={value}
200
- className={cnb(
201
- styles({ dense, centered: !disableCentered }),
202
- theme !== "current-color" && cssUtils({ textColor: theme }),
203
- className
204
- )}
183
+ className={circularProgress({
184
+ theme,
185
+ dense,
186
+ disableCentered,
187
+ className,
188
+ })}
205
189
  >
206
190
  <svg
207
191
  style={svgStyle}
208
- className={cnb(
209
- styles("svg", {
210
- determinate,
211
- indeterminate: indeterminate && !disableShrink,
212
- "rotate-only": indeterminate && disableShrink,
213
- }),
214
- svgClassName
215
- )}
192
+ className={circularProgressSvg({
193
+ className: svgClassName,
194
+ indeterminate,
195
+ disableShrink,
196
+ })}
216
197
  viewBox={viewBox}
217
198
  >
218
199
  <circle
219
200
  style={circleStyle}
220
- className={cnb(
221
- styles("circle", {
222
- animate: !disableTransition && determinate,
223
- determinate,
224
- indeterminate: indeterminate && !disableShrink,
225
- "rotate-only": indeterminate && disableShrink,
226
- }),
227
- circleClassName
228
- )}
201
+ className={circularProgressCircle({
202
+ className: circleClassName,
203
+ indeterminate,
204
+ disableShrink,
205
+ disableTransition,
206
+ })}
229
207
  r={radius}
230
208
  cx={center}
231
209
  cy={center}
@@ -1,4 +1,3 @@
1
- import { cnb } from "cnbuilder";
2
1
  import {
3
2
  type CSSProperties,
4
3
  type HTMLAttributes,
@@ -6,11 +5,10 @@ import {
6
5
  useMemo,
7
6
  } from "react";
8
7
 
9
- import { cssUtils } from "../cssUtils.js";
10
- import { type LabelRequiredForA11y } from "../types.js";
8
+ import { type LabelRequiredForA11y, type PropsWithRef } from "../types.js";
11
9
  import { useEnsuredId } from "../useEnsuredId.js";
12
- import { bem } from "../utils/bem.js";
13
10
  import { getPercentage } from "../utils/getPercentage.js";
11
+ import { linearProgress, linearProgressBar } from "./linearProgressStyles.js";
14
12
  import { type ProgressProps } from "./types.js";
15
13
 
16
14
  /**
@@ -31,6 +29,11 @@ export interface LinearProgressProps
31
29
  */
32
30
  barClassName?: string;
33
31
 
32
+ /**
33
+ * @since 6.1.0
34
+ */
35
+ barProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>>;
36
+
34
37
  /**
35
38
  * Boolean if the progress should be reversed. This will change the progress
36
39
  * direction from `left-to-right` to be `right-to-left`. If the current
@@ -61,8 +64,6 @@ export interface LinearProgressProps
61
64
  verticalHeight?: number | null;
62
65
  }
63
66
 
64
- const styles = bem("rmd-linear-progress");
65
-
66
67
  /**
67
68
  * @example Indeterminate Example
68
69
  * ```tsx
@@ -101,13 +102,14 @@ export const LinearProgress = forwardRef<
101
102
  className,
102
103
  barStyle: propBarStyle,
103
104
  barClassName,
105
+ barProps,
104
106
  min = 0,
105
107
  max = 100,
106
108
  value,
107
- reverse = false,
108
- theme = "primary",
109
- disableTransition = false,
110
- vertical = false,
109
+ reverse,
110
+ theme,
111
+ disableTransition,
112
+ vertical,
111
113
  verticalHeight = 240,
112
114
  ...remaining
113
115
  } = props;
@@ -140,8 +142,7 @@ export const LinearProgress = forwardRef<
140
142
  };
141
143
  }, [progress, propBarStyle, vertical]);
142
144
 
143
- const determinate = typeof progress === "number";
144
- const indeterminate = !determinate;
145
+ const indeterminate = typeof progress !== "number";
145
146
  return (
146
147
  <span
147
148
  {...remaining}
@@ -152,37 +153,23 @@ export const LinearProgress = forwardRef<
152
153
  aria-valuemin={min}
153
154
  aria-valuemax={max}
154
155
  aria-valuenow={value}
155
- className={cnb(
156
- styles({
157
- vertical,
158
- horizontal: !vertical,
159
- determinate,
160
- indeterminate,
161
- }),
162
- theme !== "current-color" && cssUtils({ textColor: theme }),
163
- className
164
- )}
156
+ className={linearProgress({
157
+ className,
158
+ theme,
159
+ vertical,
160
+ indeterminate,
161
+ })}
165
162
  >
166
163
  <span
164
+ {...barProps}
167
165
  style={barStyle}
168
- className={cnb(
169
- styles("bar", {
170
- vertical,
171
- "vertical-reverse": vertical && reverse,
172
- horizontal: !vertical,
173
- "horizontal-reverse": !vertical && reverse,
174
- animate: !disableTransition && determinate,
175
- determinate,
176
- indeterminate,
177
- "determinate-reverse": determinate && reverse && !vertical,
178
- "determinate-vertical-reverse": determinate && reverse && vertical,
179
- "indeterminate-reverse": indeterminate && reverse && !vertical,
180
- "indeterminate-vertical": indeterminate && vertical,
181
- "indeterminate-vertical-reverse":
182
- indeterminate && reverse && vertical,
183
- }),
184
- barClassName
185
- )}
166
+ className={linearProgressBar({
167
+ className: barClassName,
168
+ reverse,
169
+ vertical,
170
+ indeterminate,
171
+ disableTransition,
172
+ })}
186
173
  />
187
174
  </span>
188
175
  );
@@ -0,0 +1,114 @@
1
+ import { cnb } from "cnbuilder";
2
+
3
+ import { cssUtils } from "../cssUtils.js";
4
+ import { bem } from "../utils/bem.js";
5
+ import { type ProgressTheme } from "./types.js";
6
+
7
+ const styles = bem("rmd-circular-progress");
8
+
9
+ /**
10
+ * @since 6.2.0
11
+ */
12
+ export interface CircularProgressClassNameOptions {
13
+ className?: string;
14
+
15
+ /**
16
+ * @defaultValue `"primary"`
17
+ * @since 6.0.0
18
+ */
19
+ theme?: ProgressTheme;
20
+
21
+ /**
22
+ * Set to `true` to render as a smaller size.
23
+ *
24
+ * @defaultValue `false`
25
+ * @since 2.3.0
26
+ * @since 6.0.0 Renamed from `small`
27
+ */
28
+ dense?: boolean;
29
+
30
+ /**
31
+ * Boolean if the circular progress should be centered using left and right
32
+ * margins.
33
+ *
34
+ * @defaultValue `false`
35
+ * @since 6.0.0 Renamed from `centered`
36
+ */
37
+ disableCentered?: boolean;
38
+ }
39
+
40
+ /**
41
+ * @since 6.2.0
42
+ */
43
+ export function circularProgress(
44
+ options: CircularProgressClassNameOptions = {}
45
+ ): string {
46
+ const { className, theme = "primary", dense, disableCentered } = options;
47
+
48
+ return cnb(
49
+ styles({ dense, centered: !disableCentered }),
50
+ theme !== "current-color" && cssUtils({ textColor: theme }),
51
+ className
52
+ );
53
+ }
54
+
55
+ /**
56
+ * @since 6.2.0
57
+ */
58
+ export interface CircularProgressSvgClassNameOptions {
59
+ className?: string;
60
+ /** @defaultValue `false` */
61
+ indeterminate?: boolean;
62
+ /** @defaultValue `false` */
63
+ disableShrink?: boolean;
64
+ }
65
+
66
+ /**
67
+ * @since 6.2.0
68
+ */
69
+ export function circularProgressSvg(
70
+ options: CircularProgressSvgClassNameOptions = {}
71
+ ): string {
72
+ const { className, indeterminate, disableShrink } = options;
73
+
74
+ return cnb(
75
+ styles("svg", {
76
+ determinate: !indeterminate,
77
+ indeterminate: indeterminate && !disableShrink,
78
+ "rotate-only": indeterminate && disableShrink,
79
+ }),
80
+ className
81
+ );
82
+ }
83
+ /**
84
+ * @since 6.2.0
85
+ */
86
+ export interface CircularProgressCircleClassNameOptions {
87
+ className?: string;
88
+ /** @defaultValue `false` */
89
+ indeterminate?: boolean;
90
+ /** @defaultValue `false` */
91
+ disableShrink?: boolean;
92
+ /** @defaultValue `false` */
93
+ disableTransition?: boolean;
94
+ }
95
+
96
+ /**
97
+ * @since 6.2.0
98
+ */
99
+ export function circularProgressCircle(
100
+ options: CircularProgressCircleClassNameOptions = {}
101
+ ): string {
102
+ const { className, indeterminate, disableShrink, disableTransition } =
103
+ options;
104
+
105
+ return cnb(
106
+ styles("circle", {
107
+ animate: !disableTransition && !indeterminate,
108
+ determinate: !indeterminate,
109
+ indeterminate: indeterminate && !disableShrink,
110
+ "rotate-only": indeterminate && disableShrink,
111
+ }),
112
+ className
113
+ );
114
+ }
@@ -0,0 +1,90 @@
1
+ import { cnb } from "cnbuilder";
2
+
3
+ import { cssUtils } from "../cssUtils.js";
4
+ import { bem } from "../utils/bem.js";
5
+ import { type ProgressTheme } from "./types.js";
6
+
7
+ const styles = bem("rmd-linear-progress");
8
+
9
+ /**
10
+ * @since 6.2.0
11
+ */
12
+ export interface LinearProgressClassNameOptions {
13
+ className?: string;
14
+
15
+ /**
16
+ * @defaultValue `"primary"`
17
+ * @since 6.0.0
18
+ */
19
+ theme?: ProgressTheme;
20
+
21
+ /** @defaultValue `false` */
22
+ vertical?: boolean;
23
+
24
+ /** @defaultValue `false` */
25
+ indeterminate?: boolean;
26
+ }
27
+
28
+ /**
29
+ * @since 6.2.0
30
+ */
31
+ export function linearProgress(
32
+ options: LinearProgressClassNameOptions = {}
33
+ ): string {
34
+ const { className, theme = "primary", vertical, indeterminate } = options;
35
+
36
+ return cnb(
37
+ styles({
38
+ vertical,
39
+ horizontal: !vertical,
40
+ determinate: !indeterminate,
41
+ indeterminate,
42
+ }),
43
+ theme !== "current-color" && cssUtils({ textColor: theme }),
44
+ className
45
+ );
46
+ }
47
+
48
+ /**
49
+ * @since 6.2.0
50
+ */
51
+ export interface LinearProgressBarClassNameOptions {
52
+ className?: string;
53
+
54
+ /** @defaultValue `false` */
55
+ reverse?: boolean;
56
+ /** @defaultValue `false` */
57
+ vertical?: boolean;
58
+ /** @defaultValue `false` */
59
+ indeterminate?: boolean;
60
+ /** @defaultValue `false` */
61
+ disableTransition?: boolean;
62
+ }
63
+
64
+ /**
65
+ * @since 6.2.0
66
+ */
67
+ export function linearProgressBar(
68
+ options: LinearProgressBarClassNameOptions = {}
69
+ ): string {
70
+ const { className, reverse, vertical, indeterminate, disableTransition } =
71
+ options;
72
+
73
+ return cnb(
74
+ styles("bar", {
75
+ vertical,
76
+ "vertical-reverse": vertical && reverse,
77
+ horizontal: !vertical,
78
+ "horizontal-reverse": !vertical && reverse,
79
+ animate: !disableTransition && !indeterminate,
80
+ determinate: !indeterminate,
81
+ indeterminate,
82
+ "determinate-reverse": !indeterminate && reverse && !vertical,
83
+ "determinate-vertical-reverse": !indeterminate && reverse && vertical,
84
+ "indeterminate-reverse": indeterminate && reverse && !vertical,
85
+ "indeterminate-vertical": indeterminate && vertical,
86
+ "indeterminate-vertical-reverse": indeterminate && reverse && vertical,
87
+ }),
88
+ className
89
+ );
90
+ }
@@ -1,7 +1,13 @@
1
- import { type TextExtractor } from "../types.js";
1
+ import { type AutomaticTextExtraction, type TextExtractor } from "../types.js";
2
2
  import { type BaseSearchOptions } from "./types.js";
3
3
  import { defaultExtractor, search } from "./utils.js";
4
4
 
5
+ /**
6
+ * @since 6.2.0
7
+ * @internal
8
+ */
9
+ const DEFAULT_EXTRACTOR = defaultExtractor("caseInsensitiveSearch");
10
+
5
11
  /**
6
12
  * @since 6.0.0
7
13
  */
@@ -142,18 +148,34 @@ export interface CaseInsensitiveOptions<T>
142
148
  * caseInsensitiveSearch({
143
149
  * list: fruits,
144
150
  * query: "ap",
145
- * extractor: (item) => item.name,
146
151
  * });
147
152
  * // [{ name: "Apple", value: 0 }, { name: "Grape", value: 2 }]
148
153
  * ```
149
154
  *
155
+ * @example Objects With Custom Names
156
+ * ```ts
157
+ * const fruits = [
158
+ * { nameField: "Apple", value: 0 },
159
+ * { nameField: "Banana", value: 1 },
160
+ * { nameField: "Grape", value: 2 },
161
+ * { nameField: "Orange", value: 3 },
162
+ * ];
163
+ *
164
+ * caseInsensitiveSearch({
165
+ * list: fruits,
166
+ * query: "ap",
167
+ * extractor: (item) => item.nameField,
168
+ * });
169
+ * // [{ nameField: "Apple", value: 0 }, { nameField: "Grape", value: 2 }]
170
+ * ```
171
+ *
150
172
  * @since 6.0.0
151
173
  */
152
- export function caseInsensitiveSearch<T extends string>(
153
- options: Omit<CaseInsensitiveOptions<T>, "extractor"> & { type?: "filter" }
174
+ export function caseInsensitiveSearch<T extends AutomaticTextExtraction>(
175
+ options: CaseInsensitiveOptions<T> & { type?: "filter" }
154
176
  ): readonly T[];
155
- export function caseInsensitiveSearch<T extends string>(
156
- options: Omit<CaseInsensitiveOptions<T>, "extractor"> & { type: "search" }
177
+ export function caseInsensitiveSearch<T extends AutomaticTextExtraction>(
178
+ options: CaseInsensitiveOptions<T> & { type: "search" }
157
179
  ): T | undefined;
158
180
  export function caseInsensitiveSearch<T>(
159
181
  options: CaseInsensitiveOptions<T> & {
@@ -174,7 +196,7 @@ export function caseInsensitiveSearch<T>(
174
196
  list,
175
197
  type = "filter",
176
198
  query,
177
- extractor = defaultExtractor("caseInsensitiveSearch"),
199
+ extractor = DEFAULT_EXTRACTOR,
178
200
  startsWith,
179
201
  whitespace,
180
202
  } = options;
@@ -1,7 +1,13 @@
1
- import { type TextExtractor } from "../types.js";
1
+ import { type AutomaticTextExtraction, type TextExtractor } from "../types.js";
2
2
  import { type BaseSearchOptions } from "./types.js";
3
3
  import { defaultExtractor, search } from "./utils.js";
4
4
 
5
+ /**
6
+ * @since 6.2.0
7
+ * @internal
8
+ */
9
+ const DEFAULT_EXTRACTOR = defaultExtractor("fuzzySearch");
10
+
5
11
  /**
6
12
  * @example
7
13
  * ```tsx
@@ -126,11 +132,11 @@ export type FuzzySearchOptions<T> = BaseSearchOptions<T>;
126
132
  *
127
133
  * @since 6.0.0
128
134
  */
129
- export function fuzzySearch<T extends string>(
130
- options: Omit<FuzzySearchOptions<T>, "extractor"> & { type?: "filter" }
135
+ export function fuzzySearch<T extends AutomaticTextExtraction>(
136
+ options: FuzzySearchOptions<T> & { type?: "filter" }
131
137
  ): readonly T[];
132
- export function fuzzySearch<T extends string>(
133
- options: Omit<FuzzySearchOptions<T>, "extractor"> & { type?: "search" }
138
+ export function fuzzySearch<T extends AutomaticTextExtraction>(
139
+ options: FuzzySearchOptions<T> & { type?: "search" }
134
140
  ): T | undefined;
135
141
  export function fuzzySearch<T>(
136
142
  option: FuzzySearchOptions<T> & {
@@ -151,7 +157,7 @@ export function fuzzySearch<T>(
151
157
  list,
152
158
  type = "filter",
153
159
  query,
154
- extractor = defaultExtractor("fuzzySearch"),
160
+ extractor = DEFAULT_EXTRACTOR,
155
161
  whitespace,
156
162
  } = options;
157
163