@ufoui/core 0.0.4 → 0.0.12

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 (151) hide show
  1. package/README.md +9 -3
  2. package/assets/icons.d.ts +11 -0
  3. package/assets/index.d.ts +1 -0
  4. package/components/accordion/accordion.d.ts +52 -0
  5. package/components/accordion/accordionItem.d.ts +65 -0
  6. package/components/accordion/accordionItem.guards.d.ts +15 -0
  7. package/components/accordion/index.d.ts +2 -0
  8. package/components/avatar/avatar.d.ts +26 -29
  9. package/components/avatar/avatar.guards.d.ts +15 -0
  10. package/components/avatar/avatarGroup.d.ts +29 -0
  11. package/components/avatar/index.d.ts +2 -0
  12. package/components/badge/badge.d.ts +1 -1
  13. package/components/base/{boxBase/boxBase.d.ts → boxBase.d.ts} +18 -11
  14. package/components/base/{buttonBase/buttonBase.d.ts → buttonBase.d.ts} +2 -3
  15. package/components/base/{checkboxBase/checkboxBase.d.ts → checkboxBase.d.ts} +2 -3
  16. package/components/base/dialogBase.d.ts +34 -0
  17. package/components/base/{fieldBase/fieldBase.d.ts → fieldBase.d.ts} +2 -3
  18. package/components/base/index.d.ts +6 -0
  19. package/components/base/textBase.d.ts +44 -0
  20. package/components/breadcrumbs/breadcrumbs.d.ts +48 -0
  21. package/components/button/button.d.ts +1 -1
  22. package/components/calendar/calendar.d.ts +23 -0
  23. package/components/calendar/calendarUtils.d.ts +18 -0
  24. package/components/checkbox/checkbox.d.ts +1 -1
  25. package/components/chip/chip.d.ts +1 -1
  26. package/components/collapse/collapse.d.ts +33 -0
  27. package/components/dialogs/bottomSheet.d.ts +23 -0
  28. package/components/dialogs/dialog.d.ts +21 -0
  29. package/components/{dialog → dialogs}/dialogActions.d.ts +1 -2
  30. package/components/{dialog → dialogs}/dialogTitle.d.ts +2 -3
  31. package/components/dialogs/drawer.d.ts +23 -0
  32. package/components/dialogs/index.d.ts +6 -0
  33. package/components/divider/divider.d.ts +1 -1
  34. package/components/divider/divider.guards.d.ts +1 -1
  35. package/components/fab/fab.d.ts +1 -1
  36. package/components/fields/dateField.d.ts +24 -0
  37. package/components/fields/dateTimeField.d.ts +24 -0
  38. package/components/fields/emailField.d.ts +24 -0
  39. package/components/fields/index.d.ts +11 -0
  40. package/components/fields/monthField.d.ts +24 -0
  41. package/components/fields/numberField.d.ts +24 -0
  42. package/components/fields/passwordField.d.ts +24 -0
  43. package/components/fields/phoneField.d.ts +24 -0
  44. package/components/fields/textField.d.ts +24 -0
  45. package/components/fields/timeField.d.ts +24 -0
  46. package/components/fields/urlField.d.ts +24 -0
  47. package/components/fields/weekField.d.ts +24 -0
  48. package/components/fieldset/fieldset.d.ts +2 -1
  49. package/components/iconButton/iconButton.d.ts +1 -1
  50. package/components/{article → layout}/article.d.ts +1 -1
  51. package/components/{aside → layout}/aside.d.ts +1 -1
  52. package/components/{content → layout}/content.d.ts +1 -1
  53. package/components/{div → layout}/div.d.ts +1 -1
  54. package/components/{flex → layout}/flex.d.ts +1 -1
  55. package/components/{footer → layout}/footer.d.ts +1 -1
  56. package/components/{grid → layout}/grid.d.ts +1 -1
  57. package/components/{header → layout}/header.d.ts +1 -1
  58. package/components/layout/index.d.ts +11 -0
  59. package/components/{main → layout}/main.d.ts +1 -1
  60. package/components/{nav → layout}/nav.d.ts +1 -1
  61. package/components/{section → layout}/section.d.ts +1 -1
  62. package/components/link/link.d.ts +58 -0
  63. package/components/list/list.d.ts +8 -0
  64. package/components/{listItem → list}/listItem.d.ts +2 -3
  65. package/components/{listItem → list}/listItem.guards.d.ts +1 -1
  66. package/components/menu/menu.d.ts +2 -4
  67. package/components/menu/menu.guards.d.ts +1 -1
  68. package/components/menuItem/menuItem.d.ts +2 -3
  69. package/components/menuItem/menuItem.guards.d.ts +1 -1
  70. package/components/option/option.d.ts +1 -1
  71. package/components/option/option.guards.d.ts +1 -1
  72. package/components/progress/progress.d.ts +27 -0
  73. package/components/radio/radio.d.ts +1 -1
  74. package/components/radiogroup/radioGroup.d.ts +1 -1
  75. package/components/rating/rating.d.ts +68 -0
  76. package/components/select/select.d.ts +1 -1
  77. package/components/slider/slider.d.ts +11 -0
  78. package/components/switch/switch.d.ts +1 -10
  79. package/components/tabs/index.d.ts +2 -0
  80. package/components/tabs/tab.d.ts +37 -0
  81. package/components/tabs/tab.guards.d.ts +15 -0
  82. package/components/tabs/tabs.d.ts +7 -0
  83. package/components/toast/index.d.ts +2 -0
  84. package/components/toast/toast.d.ts +52 -0
  85. package/components/toast/toastViewport.d.ts +7 -0
  86. package/components/toggleButton/toggleButton.d.ts +1 -1
  87. package/components/toolbar/toolbar.d.ts +51 -0
  88. package/components/tooltip/tooltip.d.ts +1 -1
  89. package/components/typography/h1.d.ts +18 -0
  90. package/components/typography/h2.d.ts +18 -0
  91. package/components/typography/h3.d.ts +18 -0
  92. package/components/typography/h4.d.ts +18 -0
  93. package/components/typography/h5.d.ts +18 -0
  94. package/components/typography/h6.d.ts +18 -0
  95. package/components/typography/index.d.ts +9 -0
  96. package/components/typography/label.d.ts +18 -0
  97. package/components/typography/p.d.ts +18 -0
  98. package/components/typography/span.d.ts +18 -0
  99. package/context/index.d.ts +4 -0
  100. package/context/selectionContext.d.ts +32 -0
  101. package/context/themeContext.d.ts +2 -2
  102. package/hooks/index.d.ts +10 -0
  103. package/hooks/useAnimate.d.ts +38 -18
  104. package/hooks/useFocusTrap.d.ts +32 -0
  105. package/hooks/useFocusVisible.d.ts +16 -14
  106. package/hooks/useResizeObserver.d.ts +30 -0
  107. package/hooks/useRovingFocus.d.ts +30 -0
  108. package/hooks/useSelection.d.ts +16 -0
  109. package/hooks/useSelectionState.d.ts +29 -0
  110. package/hooks/useSliderKeys.d.ts +41 -0
  111. package/index.css +1 -1
  112. package/index.d.ts +22 -36
  113. package/index.js +4881 -0
  114. package/internal/controlGrid/controlGrid.d.ts +32 -0
  115. package/internal/controlLabel/controlLabel.d.ts +31 -0
  116. package/internal/description/description.d.ts +18 -0
  117. package/internal/index.d.ts +6 -0
  118. package/internal/inlineTooltip/index.d.ts +1 -0
  119. package/internal/inlineTooltip/inlineTooltipManager.d.ts +2 -2
  120. package/internal/slots/slot.d.ts +44 -0
  121. package/internal/stateLayer/stateLayer.d.ts +33 -0
  122. package/package.json +12 -3
  123. package/utils/calculateFloatingPosition.d.ts +1 -1
  124. package/utils/color.d.ts +2 -194
  125. package/utils/controlStyle.d.ts +67 -0
  126. package/utils/generateMaterialColors.d.ts +1 -1
  127. package/utils/generateSchemes.d.ts +1 -1
  128. package/utils/getWrapperStyle.d.ts +53 -0
  129. package/utils/index.d.ts +10 -0
  130. package/utils/{inputhMethod.d.ts → interactionMode.d.ts} +1 -1
  131. package/utils/toasts/ensureViewport.d.ts +7 -0
  132. package/utils/toasts/index.d.ts +1 -0
  133. package/utils/toasts/toast.d.ts +85 -0
  134. package/utils/toasts/toastStore.d.ts +65 -0
  135. package/utils/uniqueID.d.ts +14 -0
  136. package/utils/utils.d.ts +81 -81
  137. package/components/base/dialogBase/dialog.d.ts +0 -35
  138. package/components/base/inlineBase/inlineBase.d.ts +0 -62
  139. package/components/dateInput/dateInput.d.ts +0 -2
  140. package/components/dateTimeInput/dateTimeInput.d.ts +0 -2
  141. package/components/emailInput/emailInput.d.ts +0 -2
  142. package/components/numberInput/numberInput.d.ts +0 -2
  143. package/components/telInput/telInput.d.ts +0 -2
  144. package/components/textField/textField.d.ts +0 -9
  145. package/components/timeInput/timeInput.d.ts +0 -2
  146. package/components/urlInput/urlInput.d.ts +0 -2
  147. package/hooks/useFocusState.d.ts +0 -16
  148. package/index.mjs +0 -3832
  149. package/internal/inlineTooltip/inlineTooltip.d.ts +0 -11
  150. package/internal/inlineTooltip/inlineTooltip2.d.ts +0 -10
  151. /package/components/{dialog → dialogs}/dialogContent.d.ts +0 -0
@@ -0,0 +1,32 @@
1
+ import { ReactNode } from 'react';
2
+ import { ElementTextPlacement } from '../../utils';
3
+ /**
4
+ * Props for the ControlGrid component.
5
+ *
6
+ * Layout container for form control, label and description.
7
+ *
8
+ * @category Slot
9
+ */
10
+ export interface ControlGridProps {
11
+ /** Main control element such as checkbox, switch or slider. */
12
+ control?: ReactNode;
13
+ /** Label displayed next to the control. */
14
+ label?: ReactNode;
15
+ /** Supporting text such as description or error message. */
16
+ description?: ReactNode;
17
+ /** Placement of label relative to the control. */
18
+ textPlacement: ElementTextPlacement;
19
+ /** Additional root class name. */
20
+ className?: string;
21
+ /** Spans description across all grid columns. */
22
+ spanDesc?: boolean;
23
+ }
24
+ /**
25
+ * Layout helper that arranges control, label and description.
26
+ *
27
+ * @function
28
+ * @param props Component properties.
29
+ *
30
+ * @category Slot
31
+ */
32
+ export declare const ControlGrid: import('react').ForwardRefExoticComponent<ControlGridProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,31 @@
1
+ import { ElementType, ReactNode, RefObject } from 'react';
2
+ import { ElementFont } from '../../utils';
3
+ export interface ControlLabelProps {
4
+ /** Label content. */
5
+ label?: ReactNode;
6
+ /** ID of the associated control element. Used when tag is 'label'. */
7
+ htmlFor?: string;
8
+ /** DOM id applied to the label element. */
9
+ id?: string;
10
+ /** Reference to a control element that should receive focus when the label is clicked. */
11
+ focusRef?: RefObject<HTMLElement>;
12
+ /** Displays a required indicator next to the label. */
13
+ required?: boolean;
14
+ /** Font applied to the label text. */
15
+ font?: ElementFont;
16
+ /** HTML tag used to render the label element. Default: 'label'. */
17
+ tag?: ElementType;
18
+ }
19
+ /**
20
+ * Renders a label for form controls.
21
+ *
22
+ * Supports both native label behaviour and ARIA labeling for custom controls.
23
+ * When tag is 'label', htmlFor associates the label with a form element.
24
+ * When focusRef is provided, clicking the label focuses the referenced control.
25
+ *
26
+ * @function
27
+ * @param props Component properties.
28
+ *
29
+ * @category Slot
30
+ */
31
+ export declare const ControlLabel: ({ label, htmlFor, id, required, font, focusRef, tag: Tag, }: ControlLabelProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,18 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export interface DescriptionProps extends HTMLAttributes<HTMLElement> {
3
+ /** Supporting description text. */
4
+ description?: ReactNode;
5
+ /** Error message text. Overrides description when present. */
6
+ error?: ReactNode;
7
+ }
8
+ /**
9
+ * Renders supporting text such as description or error message.
10
+ *
11
+ * Error message takes precedence over description.
12
+ *
13
+ * @function
14
+ * @param props Component properties.
15
+ *
16
+ * @category Slot
17
+ */
18
+ export declare const Description: ({ description, error, ...rest }: DescriptionProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ export * from './inlineTooltip';
2
+ export * from './slots/slot';
3
+ export * from './stateLayer/stateLayer';
4
+ export * from './controlGrid/controlGrid';
5
+ export * from './controlLabel/controlLabel';
6
+ export * from './description/description';
@@ -0,0 +1 @@
1
+ export * from './inlineTooltipManager';
@@ -1,12 +1,12 @@
1
1
  import { default as React, HTMLProps, ReactElement } from 'react';
2
- import { ElementAlign } from '../../index.ts';
2
+ import { ElementAlign } from '../../utils';
3
3
  interface InlineTooltipManagerProps extends HTMLProps<HTMLSpanElement> {
4
4
  triggerRef: React.RefObject<HTMLElement>;
5
5
  tooltip: ReactElement;
6
6
  align: ElementAlign;
7
7
  }
8
8
  export declare const InlineTooltipManager: {
9
- ({ tooltip, align, triggerRef, }: InlineTooltipManagerProps): React.ReactPortal;
9
+ ({ tooltip, align, triggerRef }: InlineTooltipManagerProps): React.ReactPortal;
10
10
  displayName: string;
11
11
  };
12
12
  export {};
@@ -0,0 +1,44 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * Props for the Slot component.
4
+ *
5
+ * @category Slot
6
+ */
7
+ interface SlotProps {
8
+ /** Element rendered before the content. */
9
+ start?: ReactNode;
10
+ /** Element rendered after the content. */
11
+ end?: ReactNode;
12
+ /** Main slot content. */
13
+ content: ReactNode;
14
+ /** Root class name. */
15
+ className?: string;
16
+ }
17
+ /**
18
+ * Layout helper that renders start, content, and end regions.
19
+ *
20
+ * @function
21
+ * @param props Component properties.
22
+ *
23
+ * @category Slot
24
+ */
25
+ export declare const Slot: ({ start, end, content, className }: SlotProps) => import("react/jsx-runtime").JSX.Element;
26
+ /**
27
+ * Slot wrapper for leading content.
28
+ *
29
+ * @function
30
+ * @param props Component properties.
31
+ *
32
+ * @category Slot
33
+ */
34
+ export declare const Leading: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
35
+ /**
36
+ * Slot wrapper for trailing content.
37
+ *
38
+ * @function
39
+ * @param props Component properties.
40
+ *
41
+ * @category Slot
42
+ */
43
+ export declare const Trailing: (props: SlotProps) => import("react/jsx-runtime").JSX.Element;
44
+ export {};
@@ -0,0 +1,33 @@
1
+ import { SurfaceColor } from '../../utils';
2
+ /**
3
+ * Props for StateLayer component.
4
+ *
5
+ * @category Internal components
6
+ */
7
+ export interface StateLayerProps {
8
+ /** Background color token. */
9
+ color?: SurfaceColor;
10
+ /** Additional class name. */
11
+ className?: string;
12
+ }
13
+ /**
14
+ * StateLayer component.
15
+ *
16
+ * Renders a visual state layer used for hover, focus, pressed and selected effects.
17
+ *
18
+ * @param color Background color token.
19
+ * @param className Additional class name.
20
+ *
21
+ * @function
22
+ *
23
+ * @example
24
+ * <Component>
25
+ * <StateLayer />
26
+ * </Component>
27
+ *
28
+ * @example
29
+ * <StateLayer color="primary" />
30
+ *
31
+ * @category Internal components
32
+ */
33
+ export declare const StateLayer: ({ color, className }: StateLayerProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ufoui/core",
3
- "version": "0.0.4",
3
+ "version": "0.0.12",
4
4
  "description": "Lightweight Material Design 3 UI components for React",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",
@@ -14,10 +14,19 @@
14
14
  },
15
15
  "keywords": [
16
16
  "react",
17
+ "react-components",
17
18
  "components",
19
+ "material-design",
20
+ "material-design-3",
21
+ "md3",
22
+ "material-you",
18
23
  "ui",
24
+ "ui-kit",
25
+ "component-library",
26
+ "typescript",
27
+ "esm",
19
28
  "ufoui",
20
- "core"
29
+ "ufo-ui"
21
30
  ],
22
31
  "peerDependencies": {
23
32
  "react": "^18.0.0",
@@ -35,4 +44,4 @@
35
44
  "./style.css": "./index.css",
36
45
  "./style": "./index.css"
37
46
  }
38
- }
47
+ }
@@ -1,5 +1,5 @@
1
1
  import { RefObject } from 'react';
2
- import { ElementAlign } from '../index.ts';
2
+ import { ElementAlign } from './utils';
3
3
  /**
4
4
  * Floating behavior presets used by `calculateFloatingPosition()`.
5
5
  *
package/utils/color.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { default as React } from 'react';
2
- import { ThemeExtendedColorKeys, ThemeSchemeKeys, ThemeSemanticColorKeys, ThemeSurfaceColorKeys } from '../types/index.ts';
1
+ import { ThemeExtendedColorKeys, ThemeSchemeKeys, ThemeSemanticColorKeys, ThemeSurfaceColorKeys } from '../types';
3
2
  /**
4
3
  * Represents a high-level semantic color token (e.g. `primary`, `error`, `success`).
5
4
  * Derived from {@link ThemeSemanticColorKeys}.
@@ -81,7 +80,6 @@ export declare const getSemanticColorClasses: (color: SemanticColor) => {
81
80
  * for all semantic, extended, and surface tokens defined in {@link ThemeColor}.
82
81
  * Enables consistent inverse lookups for text/background pairings.
83
82
  *
84
- * Commonly used by {@link getSurfaceColorClasses}.
85
83
  *
86
84
  * @category Color
87
85
  */
@@ -149,104 +147,12 @@ export declare const inverseColorMap: {
149
147
  readonly onSuccessContainer: "successContainer";
150
148
  readonly onErrorContainer: "errorContainer";
151
149
  };
152
- /**
153
- * Returns utility class names (`uui-*`) for a given surface color and its mapped “on” color.
154
- *
155
- * @remarks
156
- * Uses the {@link inverseColorMap} to find the related “on” color
157
- * (e.g. `'surfaceContainer'` → `'onSurface'`).
158
- * Produces `text`, `border`, and `background` variants for both.
159
- * All names are kebab-cased (e.g. `'surfaceContainerHigh'` → `'surface-container-high'`).
160
- *
161
- * @param color - Surface color key (e.g. `'surfaceContainerHigh'`).
162
- * @returns Object with `uui-text-*`, `uui-border-*`, and `uui-bg-*` class names for base and on-color.
163
- *
164
- * @example
165
- * ```ts
166
- * getSurfaceColorClasses('surfaceContainer');
167
- * // → { textColor: 'uui-text-surface-container', textOnColor: 'uui-text-on-surface', ... }
168
- * ```
169
- * @category Color
170
- */
171
- export declare const getSurfaceColorClasses: (color: SurfaceColor) => {
172
- readonly textColor: `uui-text-${string}`;
173
- readonly textOnColor: `uui-text-${string}`;
174
- readonly borderColor: `uui-border-${string}`;
175
- readonly borderOnColor: `uui-border-${string}`;
176
- readonly bgColor: `uui-bg-${string}`;
177
- readonly bgOnColor: `uui-bg-${string}`;
178
- };
179
- /**
180
- * Returns utility class names (`uui-*`) for any theme color token.
181
- *
182
- * @remarks
183
- * Generates `text`, `border`, and `background` class names based on the provided
184
- * {@link ThemeColor}. If the color key is invalid, `'primary'` is used as fallback.
185
- *
186
- * @param color - Theme color token (e.g. `'primary'`, `'surfaceContainerHigh'`, `'error'`).
187
- * @returns An object with `uui-text-*`, `uui-border-*`, and `uui-bg-*` class names.
188
- *
189
- * @example
190
- * ```ts
191
- * getColorClasses('error');
192
- * // → { textColor: 'uui-text-error', borderColor: 'uui-border-error', bgColor: 'uui-bg-error' }
193
- * ```
194
- * @category Color
195
- */
196
- export declare const getColorClasses: (color: ThemeColor) => {
197
- readonly textColor: `uui-text-${string}`;
198
- readonly borderColor: `uui-border-${string}`;
199
- readonly bgColor: `uui-bg-${string}`;
200
- };
201
150
  /**
202
151
  * Represents the available border color options.
203
152
  *
204
153
  * @category Color
205
154
  */
206
155
  export type BorderColor = SurfaceColor;
207
- /**
208
- * Returns the appropriate border color class for a given configuration.
209
- *
210
- * @remarks
211
- * Typical border colors are `'outline'` and `'outlineVariant'`, matching MD3 tokens.
212
- * @param borderColor - Border color keyword or surface color token.
213
- * @returns The resolved border color class (e.g. `'uui-border-surface-container-high'`).
214
- *
215
- * @example
216
- * ```ts
217
- * getBorderColorClass('surfaceContainer'); // → 'uui-border-surface-container'
218
- * ```
219
- * @category Color
220
- */
221
- export declare function getBorderColorClass(borderColor: BorderColor): `uui-border-${string}`;
222
- /**
223
- * Returns all CSS variable references for a **semantic color**.
224
- *
225
- * @remarks
226
- * Generates `var(--uui-color-*)` tokens only for semantic colors
227
- * defined in {@link SemanticColor} (e.g. `primary`, `error`, `success`).
228
- * Useful for dynamic component theming and inline styles.
229
- *
230
- * @param color - Semantic color key (e.g. `'primary'`, `'error'`, `'info'`).
231
- * @returns Object containing `var(--uui-color-...)` references for all variants.
232
- *
233
- * @example
234
- * ```ts
235
- * const vars = getSemanticColorVar('primary');
236
- * // → "var(--uui-color-primary)", "var(--uui-color-on-primary)"
237
- * ```
238
- * @category Color
239
- */
240
- export declare const getSemanticColorVar: (color: SemanticColor) => {
241
- color: string;
242
- onColor: string;
243
- container: string;
244
- onContainer: string;
245
- fixed: string;
246
- fixedDim: string;
247
- onFixed: string;
248
- onFixedVariant: string;
249
- };
250
156
  /**
251
157
  * Returns basic CSS variable references for a **surface color**.
252
158
  *
@@ -313,103 +219,5 @@ export declare const hexToRgb: (colorValue: string) => string;
313
219
  * @category Color
314
220
  */
315
221
  export declare function getTintOverlayColor(elevation: number, tintColor: string): string;
316
- /**
317
- * Returns a set of predefined utility class names for fixed theme colors.
318
- *
319
- * Each entry maps text, border, outline, and background variants like:
320
- * `textSurface`, `bgOnSurface`, `borderOutlineVariant`, etc.
321
- *
322
- * @returns Object with fixed color class mappings.
323
- */
324
- export declare const getFixedColorClasses: () => Record<string, string>;
325
- /**
326
- * Returns a map of `uui-current-*` classes for the given element color.
327
- *
328
- * @param color - The base color name (e.g. 'primary', 'error', etc.)
329
- * @returns An object with `uui-current-*` class names for various variants.
330
- */
331
- export declare const getCurrentColorClasses: (color: SemanticColor) => {
332
- [k: string]: `uui-current-${string}` | `uui-current-on-${string}` | `uui-current-${string}-container` | `uui-current-on-${string}-container` | `uui-current-${string}-fixed` | `uui-current-on-${string}-fixed` | `uui-current-${string}-fixed-dim` | `uui-current-on-${string}-fixed-variant`;
333
- };
334
- /**
335
- * Creates a style builder for MD3 color tokens.
336
- *
337
- * @remarks
338
- * The builder provides typed functions for applying theme color tokens
339
- * to background, text, border, and outline properties using CSS variables.
340
- *
341
- * - `bg(color)` — sets background from any ThemeColor
342
- * - `bg.on(surfaceColor)` — sets background from corresponding `on-*` surface color
343
- * - `bg.container(semanticColor)` — sets semantic `*-container` background
344
- * - `bg.onContainer(semanticColor)` — sets semantic `on-*-container` background
345
- * - `bg.fixed(semanticColor)` — semantic `*-fixed` background
346
- * - `bg.fixedDim(semanticColor)` — semantic `*-fixed-dim` background
347
- *
348
- * - `text(color)` — sets text color from any ThemeColor
349
- * - `text.on(surfaceColor)` — sets text from `on-*` surface colors
350
- * - `text.onContainer(semanticColor)` — sets text from semantic `on-*-container`
351
- *
352
- * - `border(color)` — sets border-color from any ThemeColor
353
- * - `outline(color)` — sets outline-color from any ThemeColor
354
- *
355
- * The builder accumulates all style operations internally
356
- * and exposes them via `.get()` as a final React.CSSProperties object.
357
- *
358
- * @example
359
- * const style = ColorStyle();
360
- * style.bg('surfaceContainerLow');
361
- * style.text.on('surface');
362
- * return <button style={style.get()}>Press</button>;
363
- */
364
- /**
365
- * Creates a strictly typed style builder for MD3 color tokens.
366
- *
367
- * @category Color
368
- */
369
- type CSSPropertyKey = Extract<keyof React.CSSProperties, string>;
370
- type CSSVar = `--${string}`;
371
- export declare function ControlStyle(initial?: React.CSSProperties): {
372
- bg: ((color?: ThemeColor) => void) & {
373
- on(color?: SurfaceColor): void;
374
- container(color?: SemanticColor): void;
375
- onContainer(color?: SemanticColor): void;
376
- fixed(color?: SemanticColor): void;
377
- fixedDim(color?: SemanticColor): void;
378
- };
379
- text: ((color?: ThemeColor) => void) & {
380
- on(color?: SurfaceColor): void;
381
- container(color?: SemanticColor): void;
382
- onContainer(color?: SemanticColor): void;
383
- fixed(color?: SemanticColor): void;
384
- fixedDim(color?: SemanticColor): void;
385
- };
386
- border: ((color?: ThemeColor) => void) & {
387
- on(color?: SurfaceColor): void;
388
- container(color?: SemanticColor): void;
389
- onContainer(color?: SemanticColor): void;
390
- fixed(color?: SemanticColor): void;
391
- fixedDim(color?: SemanticColor): void;
392
- };
393
- outline: ((color?: ThemeColor) => void) & {
394
- on(color?: SurfaceColor): void;
395
- container(color?: SemanticColor): void;
396
- onContainer(color?: SemanticColor): void;
397
- fixed(color?: SemanticColor): void;
398
- fixedDim(color?: SemanticColor): void;
399
- };
400
- current: ((color?: ThemeColor) => void) & {
401
- on(color?: SurfaceColor): void;
402
- container(color?: SemanticColor): void;
403
- onContainer(color?: SemanticColor): void;
404
- fixed(color?: SemanticColor): void;
405
- fixedDim(color?: SemanticColor): void;
406
- };
407
- set: {
408
- <K extends CSSPropertyKey>(key: K, value: React.CSSProperties[K]): void;
409
- (key: CSSVar, value: string): void;
410
- };
411
- get(): React.CSSProperties;
412
- merge(styles?: React.CSSProperties): void;
413
- };
222
+ export declare function capitalize(s: string): string;
414
223
  export declare function getBorderColor(borderColor?: BorderColor): BorderColor;
415
- export {};
@@ -0,0 +1,67 @@
1
+ import { default as React } from 'react';
2
+ import { SemanticColor, SurfaceColor, ThemeColor } from './color';
3
+ /**
4
+ * Creates a strictly typed style builder for MD3 color tokens.
5
+ *
6
+ * @category Color
7
+ */
8
+ type CSSPropertyKey = Extract<keyof React.CSSProperties, string>;
9
+ type CSSVar = `--${string}`;
10
+ export declare function ControlStyle(initial?: React.CSSProperties): {
11
+ bg: ((color?: ThemeColor) => void) & {
12
+ on(color?: SurfaceColor): void;
13
+ container(color?: SemanticColor): void;
14
+ onContainer(color?: SemanticColor): void;
15
+ fixed(color?: SemanticColor): void;
16
+ fixedDim(color?: SemanticColor): void;
17
+ };
18
+ text: ((color?: ThemeColor) => void) & {
19
+ on(color?: SurfaceColor): void;
20
+ container(color?: SemanticColor): void;
21
+ onContainer(color?: SemanticColor): void;
22
+ fixed(color?: SemanticColor): void;
23
+ fixedDim(color?: SemanticColor): void;
24
+ };
25
+ border: ((color?: ThemeColor) => void) & {
26
+ on(color?: SurfaceColor): void;
27
+ container(color?: SemanticColor): void;
28
+ onContainer(color?: SemanticColor): void;
29
+ fixed(color?: SemanticColor): void;
30
+ fixedDim(color?: SemanticColor): void;
31
+ };
32
+ outline: ((color?: ThemeColor) => void) & {
33
+ on(color?: SurfaceColor): void;
34
+ container(color?: SemanticColor): void;
35
+ onContainer(color?: SemanticColor): void;
36
+ fixed(color?: SemanticColor): void;
37
+ fixedDim(color?: SemanticColor): void;
38
+ };
39
+ current: ((color?: ThemeColor) => void) & {
40
+ on(color?: SurfaceColor): void;
41
+ container(color?: SemanticColor): void;
42
+ onContainer(color?: SemanticColor): void;
43
+ fixed(color?: SemanticColor): void;
44
+ fixedDim(color?: SemanticColor): void;
45
+ };
46
+ stroke: ((color?: ThemeColor) => void) & {
47
+ on(color?: SurfaceColor): void;
48
+ container(color?: SemanticColor): void;
49
+ onContainer(color?: SemanticColor): void;
50
+ fixed(color?: SemanticColor): void;
51
+ fixedDim(color?: SemanticColor): void;
52
+ };
53
+ fill: ((color?: ThemeColor) => void) & {
54
+ on(color?: SurfaceColor): void;
55
+ container(color?: SemanticColor): void;
56
+ onContainer(color?: SemanticColor): void;
57
+ fixed(color?: SemanticColor): void;
58
+ fixedDim(color?: SemanticColor): void;
59
+ };
60
+ set: {
61
+ <K extends CSSPropertyKey>(key: K, value: React.CSSProperties[K]): void;
62
+ (key: CSSVar, value: string): void;
63
+ };
64
+ get(): React.CSSProperties;
65
+ merge(styles?: React.CSSProperties): void;
66
+ };
67
+ export {};
@@ -1,4 +1,4 @@
1
- import { PartialThemeSchemes, ThemeSchemes } from '../types/index.ts';
1
+ import { PartialThemeSchemes, ThemeSchemes } from '../types';
2
2
  export type ExtraColorOverrides = Partial<Record<'info' | 'warning' | 'success', string>>;
3
3
  /**
4
4
  * Generates a full ThemeSchemes object (light and dark modes) based on a seed color,
@@ -1,5 +1,5 @@
1
- import { PartialThemeSchemes, ThemeSchemes } from '../types/index.ts';
2
1
  import { ExtraColorOverrides } from './generateMaterialColors';
2
+ import { PartialThemeSchemes, ThemeSchemes } from '../types';
3
3
  /**
4
4
  * Generates and injects CSS custom properties for Material Design 3 theme colors.
5
5
  *
@@ -0,0 +1,53 @@
1
+ import { CSSProperties } from 'react';
2
+ /**
3
+ * Props for wrapper-level behavior.
4
+ *
5
+ * Applies outer layout such as margin, positioning and stacking.
6
+ * Does not affect internal layout or content.
7
+ *
8
+ * @category Utils
9
+ */
10
+ export type WrapperProps = {
11
+ /** Margin on all sides. */
12
+ m?: number | string;
13
+ /** Horizontal margin (left + right). */
14
+ mx?: number | string;
15
+ /** Vertical margin (top + bottom). */
16
+ my?: number | string;
17
+ /** Margin top. */
18
+ mt?: number | string;
19
+ /** Margin bottom. */
20
+ mb?: number | string;
21
+ /** Margin left. */
22
+ ml?: number | string;
23
+ /** Margin right. */
24
+ mr?: number | string;
25
+ /** Top offset. */
26
+ top?: number | string;
27
+ /** Right offset. */
28
+ right?: number | string;
29
+ /** Bottom offset. */
30
+ bottom?: number | string;
31
+ /** Left offset. */
32
+ left?: number | string;
33
+ /** Stacking order. */
34
+ zIndex?: number;
35
+ /** CSS position value. */
36
+ position?: CSSProperties['position'];
37
+ };
38
+ /**
39
+ * Resolves wrapper props into style and remaining props.
40
+ *
41
+ * Margin shorthands priority:
42
+ * mt/ml/... overrides mx/my, which overrides m.
43
+ *
44
+ * @function
45
+ * @param props Wrapper configuration.
46
+ * @returns Object containing wrapperStyle and otherProps.
47
+ *
48
+ * @category Utils
49
+ */
50
+ export declare function getWrapperStyle(props: WrapperProps): {
51
+ wrapperStyle: CSSProperties;
52
+ otherProps: {};
53
+ };
@@ -0,0 +1,10 @@
1
+ export * from './color';
2
+ export * from './utils';
3
+ export * from './calculateFloatingPosition';
4
+ export * from './interactionMode';
5
+ export * from './generateMaterialColors';
6
+ export * from './generateSchemes';
7
+ export * from './toasts';
8
+ export * from './uniqueID';
9
+ export * from './controlStyle';
10
+ export * from './getWrapperStyle';
@@ -14,4 +14,4 @@ export declare function ensureInputMethod(): void;
14
14
  *
15
15
  * @internal
16
16
  */
17
- export declare function getInputMethod(): "pointer" | "keyboard";
17
+ export declare function getInputMethod(): "keyboard" | "pointer";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Ensures that a global toast viewport exists.
3
+ *
4
+ * If the user already rendered ToastViewport manually,
5
+ * no additional viewport is created.
6
+ */
7
+ export declare function ensureViewport(): void;
@@ -0,0 +1 @@
1
+ export * from './toast';