addon-ui 0.9.2 → 0.11.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 (71) hide show
  1. package/README.md +54 -12
  2. package/dist-types/components/Popover/Popover.d.ts +6 -0
  3. package/dist-types/components/Popover/PopoverAnchor.d.ts +6 -0
  4. package/dist-types/components/Popover/PopoverClose.d.ts +6 -0
  5. package/dist-types/components/Popover/PopoverContent.d.ts +15 -0
  6. package/dist-types/components/Popover/PopoverTrigger.d.ts +8 -0
  7. package/dist-types/components/Popover/index.d.ts +6 -0
  8. package/dist-types/components/Select/Select.d.ts +1 -1
  9. package/dist-types/components/Select/SelectIcon.d.ts +1 -1
  10. package/dist-types/components/Select/SelectItemIndicator.d.ts +6 -0
  11. package/dist-types/components/Select/SelectItemText.d.ts +6 -0
  12. package/dist-types/components/Select/SelectValue.d.ts +1 -1
  13. package/dist-types/components/Select/index.d.ts +2 -0
  14. package/dist-types/components/Shift/Shift.d.ts +10 -0
  15. package/dist-types/components/Shift/index.d.ts +2 -0
  16. package/dist-types/components/TextField/TextField.d.ts +2 -1
  17. package/dist-types/components/TextField/utils.d.ts +8 -0
  18. package/dist-types/components/ToggleGroup/ToggleGroup.d.ts +7 -0
  19. package/dist-types/components/ToggleGroup/ToggleGroupIndicator.d.ts +4 -0
  20. package/dist-types/components/ToggleGroup/ToggleGroupItem.d.ts +6 -0
  21. package/dist-types/components/ToggleGroup/index.d.ts +4 -0
  22. package/dist-types/components/Truncate/Truncate.d.ts +2 -2
  23. package/dist-types/components/Truncate/utils.d.ts +2 -0
  24. package/dist-types/components/index.d.ts +3 -0
  25. package/dist-types/components/types.d.ts +8 -1
  26. package/dist-types/plugin/index.d.ts +28 -2
  27. package/dist-types/providers/theme/ThemeProvider.d.ts +88 -0
  28. package/dist-types/providers/ui/UIProvider.d.ts +22 -1
  29. package/package.json +10 -21
  30. package/src/components/Button/button.module.scss +0 -1
  31. package/src/components/Popover/Popover.tsx +15 -0
  32. package/src/components/Popover/PopoverAnchor.tsx +23 -0
  33. package/src/components/Popover/PopoverClose.tsx +23 -0
  34. package/src/components/Popover/PopoverContent.tsx +73 -0
  35. package/src/components/Popover/PopoverTrigger.tsx +35 -0
  36. package/src/components/Popover/index.ts +5 -0
  37. package/src/components/Popover/popover.module.scss +77 -0
  38. package/src/components/Select/Select.tsx +1 -1
  39. package/src/components/Select/SelectContent.tsx +4 -2
  40. package/src/components/Select/SelectIcon.tsx +1 -1
  41. package/src/components/Select/SelectItem.tsx +8 -9
  42. package/src/components/Select/SelectItemIndicator.tsx +17 -0
  43. package/src/components/Select/SelectItemText.tsx +17 -0
  44. package/src/components/Select/SelectValue.tsx +1 -1
  45. package/src/components/Select/index.ts +2 -0
  46. package/src/components/Select/select.module.scss +7 -1
  47. package/src/components/Shift/Shift.tsx +98 -0
  48. package/src/components/Shift/index.ts +1 -0
  49. package/src/components/Shift/shift.module.scss +21 -0
  50. package/src/components/TextArea/text-area.module.scss +5 -0
  51. package/src/components/TextField/TextField.tsx +66 -13
  52. package/src/components/TextField/text-field.module.scss +4 -2
  53. package/src/components/TextField/utils.ts +56 -0
  54. package/src/components/ToggleGroup/ToggleGroup.tsx +25 -0
  55. package/src/components/ToggleGroup/ToggleGroupIndicator.tsx +17 -0
  56. package/src/components/ToggleGroup/ToggleGroupItem.tsx +28 -0
  57. package/src/components/ToggleGroup/index.ts +8 -0
  58. package/src/components/ToggleGroup/toggleGroup.module.scss +32 -0
  59. package/src/components/Tooltip/tooltip.module.scss +1 -0
  60. package/src/components/Truncate/Truncate.tsx +38 -56
  61. package/src/components/Truncate/truncate.module.scss +14 -15
  62. package/src/components/Truncate/utils.ts +62 -0
  63. package/src/components/index.ts +3 -0
  64. package/src/components/types.ts +23 -9
  65. package/src/plugin/index.ts +223 -9
  66. package/src/providers/theme/ThemeProvider.tsx +121 -15
  67. package/src/providers/ui/UIProvider.tsx +42 -15
  68. package/src/providers/ui/styles/default.scss +5 -1
  69. package/src/providers/ui/styles/reset.scss +1 -0
  70. package/src/styles/mixins.scss +19 -6
  71. /package/src/providers/theme/{ThemeStorage.tsx → ThemeStorage.ts} +0 -0
package/README.md CHANGED
@@ -67,23 +67,26 @@ This library now ships with dedicated documentation files for each component in
67
67
  - [IconButton](docs/IconButton.md)
68
68
  - [List](docs/List.md) (covers List and ListItem)
69
69
  - [Modal](docs/Modal.md)
70
- - [Odometer](docs/Odometer.md) (component + useOdometer hook)
70
+ - [Odometer](docs/Odometer.md) (component + `useOdometer` hook)
71
+ - [Popover](docs/Popover.md)
71
72
  - [ScrollArea](docs/ScrollArea.md)
72
73
  - [Select](docs/Select.md)
74
+ - [Shift](docs/Shift.md)
73
75
  - [SvgSprite](docs/SvgSprite.md)
74
76
  - [Switch](docs/Switch.md)
75
- - [Tabs](docs/Tabs.md) (includes Tabs, TabsList, TabsTrigger, TabsContent)
77
+ - [Tabs](docs/Tabs.md) (includes `Tabs`, `TabsList`, `TabsTrigger`, `TabsContent`)
76
78
  - [Tag](docs/Tag.md)
77
79
  - [TextArea](docs/TextArea.md)
78
80
  - [TextField](docs/TextField.md)
79
81
  - [Toast](docs/Toast.md)
82
+ - [ToggleGroup](docs/ToggleGroup.md)
80
83
  - [Tooltip](docs/Tooltip.md)
81
84
  - [Truncate](docs/Truncate.md)
82
85
  - [TruncateList](docs/TruncateList.md)
83
86
  - [View](docs/View.md)
84
87
  - [ViewDrawer](docs/ViewDrawer.md)
85
88
  - [ViewModal](docs/ViewModal.md)
86
- - [Viewport](docs/Viewport.md) (ViewportProvider + useViewport)
89
+ - [Viewport](docs/Viewport.md) (`ViewportProvider` + `useViewport`)
87
90
 
88
91
  Notes:
89
92
 
@@ -134,15 +137,40 @@ export default defineConfig({
134
137
  plugins: [
135
138
  ui({
136
139
  themeDir: "./theme", // Directory for theme files
137
- configFileName: "ui.config", // Name of config files
138
- styleFileName: "ui.style", // Name of style files
140
+ configName: "ui.config", // Name of config files
141
+ styleName: "ui.style", // Name of style files
139
142
  mergeConfig: true, // Merge configs from different directories
140
143
  mergeStyles: true, // Merge styles from different directories
144
+ splitChunks: true, // Enable automatic chunk splitting for components
141
145
  }),
142
146
  ],
143
147
  });
144
148
  ```
145
149
 
150
+ ### Plugin Options
151
+
152
+ | Option | Type | Default | Description |
153
+ | :------------ | :------------------------------------------------- | :------------ | :----------------------------------------------------------------------------------------------------- |
154
+ | `themeDir` | `string` | `"."` | Directory path where plugin configuration and style files are located. |
155
+ | `configName` | `string` | `"config.ui"` | Name of the configuration file. |
156
+ | `styleName` | `string` | `"style.ui"` | Name of the SCSS style file. |
157
+ | `mergeConfig` | `boolean` | `true` | Whether to merge configuration files from different directories. |
158
+ | `mergeStyles` | `boolean` | `true` | Whether to merge style files from different directories. |
159
+ | `splitChunks` | `boolean \| (name: string) => string \| undefined` | `true` | Enables automatic chunk splitting. If a function is provided, it can be used to customize chunk names. |
160
+
161
+ #### Customizing Chunk Names
162
+
163
+ You can pass a callback function to `splitChunks` to customize the generated chunk names:
164
+
165
+ ```ts
166
+ ui({
167
+ splitChunks: name => {
168
+ if (name === "button") return "ui-core-button";
169
+ return `ui-${name}`;
170
+ },
171
+ });
172
+ ```
173
+
146
174
  ### Configuration Files
147
175
 
148
176
  The `addon-ui` configuration is designed to retrieve configuration from each extension separately, allowing for
@@ -271,7 +299,7 @@ extensions with the same functionality but different visual appearances.
271
299
 
272
300
  ### Global Theme Customization
273
301
 
274
- You can customize the theme globally by passing props to the UIProvider:
302
+ You can customize the theme globally by passing props to the `UIProvider`:
275
303
 
276
304
  ```jsx
277
305
  import {UIProvider} from "addon-ui";
@@ -289,6 +317,8 @@ const customTheme = {
289
317
  icons: {
290
318
  // Custom icons
291
319
  },
320
+ // Specify the DOM element to set theme/view/browser attributes on
321
+ container: "#app-root",
292
322
  };
293
323
 
294
324
  function App() {
@@ -296,6 +326,17 @@ function App() {
296
326
  }
297
327
  ```
298
328
 
329
+ ### UIProvider Props
330
+
331
+ | Prop | Type | Default | Description |
332
+ | :----------- | :----------------------------- | :---------- | :-------------------------------------------------------- |
333
+ | `components` | `ComponentsProps` | `{}` | Component-specific configuration overrides. |
334
+ | `icons` | `Icons` | `{}` | Custom SVG icons registration. |
335
+ | `extra` | `ExtraProps` | `{}` | App-wide extra properties. |
336
+ | `storage` | `ThemeStorageContract \| true` | `undefined` | Persistence storage for theme settings. |
337
+ | `container` | `string \| Element \| false` | `"html"` | Target element for attributes. Set to `false` to disable. |
338
+ | `view` | `string` | `undefined` | Custom view identifier for specific styling. |
339
+
299
340
  ### Using Extra Props
300
341
 
301
342
  Extra Props is a powerful feature that allows you to extend component props with custom properties. This is particularly
@@ -438,12 +479,13 @@ function App() {
438
479
 
439
480
  ## Theming and style reuse
440
481
 
441
- - Global theme tokens (colors, typography, spacing, transitions) live in your ui.style.scss. Components consume them
442
- through fallbacks.
443
- - Each component also exposes its own `--component-*` variables. See the CSS variables tables in the docs to know
444
- exactly what you can override.
445
- - Light/dark modes: use `@import "addon-ui/theme";` and the provided `@include light { ... }` / `@include dark { ... }`
446
- mixins in your theme SCSS to scope tokens per color scheme.
482
+ - Global theme tokens (colors, typography, spacing, transitions) live in your `ui.style.scss`.
483
+ - Each component also exposes its own `--component-*` variables. See the CSS variables tables in the docs to know exactly what you can override.
484
+ - **Theme Mixins**: Use `@import "addon-ui/theme";` to access `@include light { ... }` and `@include dark { ... }` mixins.
485
+ - **Universal Targeting**: These mixins are container-agnostic. They work correctly whether the `theme` attribute is on a parent element or directly on the component itself.
486
+ - **Context-Aware**:
487
+ - When used at the top level, they generate global selectors: `[theme="dark"] { ... }`.
488
+ - When used inside a component, they generate scoped selectors: `[theme="dark"] .my-comp, .my-comp[theme="dark"] { ... }`.
447
489
 
448
490
  ## Radix UI and third-party integrations
449
491
 
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { PopoverProps } from "@radix-ui/react-popover";
3
+ export { type PopoverProps };
4
+ declare const _default: React.NamedExoticComponent<PopoverProps>;
5
+ export default _default;
6
+ //# sourceMappingURL=Popover.d.ts.map
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { PopoverAnchorProps } from "@radix-ui/react-popover";
3
+ export type { PopoverAnchorProps };
4
+ declare const _default: React.NamedExoticComponent<PopoverAnchorProps & React.RefAttributes<HTMLDivElement>>;
5
+ export default _default;
6
+ //# sourceMappingURL=PopoverAnchor.d.ts.map
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { PopoverCloseProps } from "@radix-ui/react-popover";
3
+ export type { PopoverCloseProps };
4
+ declare const _default: React.NamedExoticComponent<PopoverCloseProps & React.RefAttributes<HTMLButtonElement>>;
5
+ export default _default;
6
+ //# sourceMappingURL=PopoverClose.d.ts.map
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { PopoverContentProps as PopoverContentRadixProps, PopoverPortalProps } from "@radix-ui/react-popover";
3
+ export interface PopoverContentProps extends PopoverContentRadixProps, PopoverPortalProps {
4
+ maxWidth?: number;
5
+ minWidth?: number;
6
+ fullWidth?: boolean;
7
+ arrow?: boolean;
8
+ arrowWidth?: number;
9
+ arrowHeight?: number;
10
+ overlay?: boolean;
11
+ overlayClassname?: string;
12
+ }
13
+ declare const _default: React.NamedExoticComponent<PopoverContentProps & React.RefAttributes<HTMLDivElement>>;
14
+ export default _default;
15
+ //# sourceMappingURL=PopoverContent.d.ts.map
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { PopoverTriggerProps as PopoverTriggerRadixProps } from "@radix-ui/react-popover";
3
+ export interface PopoverTriggerProps extends PopoverTriggerRadixProps {
4
+ center?: boolean;
5
+ }
6
+ declare const _default: React.NamedExoticComponent<PopoverTriggerProps & React.RefAttributes<HTMLButtonElement>>;
7
+ export default _default;
8
+ //# sourceMappingURL=PopoverTrigger.d.ts.map
@@ -0,0 +1,6 @@
1
+ export { default as Popover, type PopoverProps } from "./Popover";
2
+ export { default as PopoverClose, type PopoverCloseProps } from "./PopoverClose";
3
+ export { default as PopoverAnchor, type PopoverAnchorProps } from "./PopoverAnchor";
4
+ export { default as PopoverTrigger, type PopoverTriggerProps } from "./PopoverTrigger";
5
+ export { default as PopoverContent, type PopoverContentProps } from "./PopoverContent";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { SelectProps } from "@radix-ui/react-select";
3
- export { SelectProps };
3
+ export { type SelectProps };
4
4
  declare const _default: React.NamedExoticComponent<SelectProps>;
5
5
  export default _default;
6
6
  //# sourceMappingURL=Select.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { SelectIconProps } from "@radix-ui/react-select";
3
- export { SelectIconProps };
3
+ export { type SelectIconProps };
4
4
  declare const _default: React.NamedExoticComponent<SelectIconProps & React.RefAttributes<HTMLSpanElement>>;
5
5
  export default _default;
6
6
  //# sourceMappingURL=SelectIcon.d.ts.map
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { SelectItemIndicatorProps } from "@radix-ui/react-select";
3
+ export { type SelectItemIndicatorProps };
4
+ declare const _default: React.NamedExoticComponent<SelectItemIndicatorProps & React.RefAttributes<HTMLSpanElement>>;
5
+ export default _default;
6
+ //# sourceMappingURL=SelectItemIndicator.d.ts.map
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { SelectItemTextProps } from "@radix-ui/react-select";
3
+ export { type SelectItemTextProps };
4
+ declare const _default: React.NamedExoticComponent<SelectItemTextProps & React.RefAttributes<HTMLSpanElement>>;
5
+ export default _default;
6
+ //# sourceMappingURL=SelectItemText.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { SelectValueProps } from "@radix-ui/react-select";
3
- export { SelectValueProps };
3
+ export { type SelectValueProps };
4
4
  declare const _default: React.NamedExoticComponent<SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
5
5
  export default _default;
6
6
  //# sourceMappingURL=SelectValue.d.ts.map
@@ -1,5 +1,7 @@
1
1
  export { default as Select, type SelectProps } from "./Select";
2
2
  export { default as SelectItem, type SelectItemProps } from "./SelectItem";
3
+ export { default as SelectItemText, type SelectItemTextProps } from "./SelectItemText";
4
+ export { default as SelectItemIndicator, type SelectItemIndicatorProps } from "./SelectItemIndicator";
3
5
  export { default as SelectIcon, type SelectIconProps } from "./SelectIcon";
4
6
  export { default as SelectValue, type SelectValueProps } from "./SelectValue";
5
7
  export { default as SelectTrigger, type SelectTriggerProps } from "./SelectTrigger";
@@ -0,0 +1,10 @@
1
+ import React, { ComponentProps } from "react";
2
+ export interface ShiftProps extends ComponentProps<"div"> {
3
+ active?: number;
4
+ height?: number;
5
+ adaptiveHeight?: boolean;
6
+ itemClassName?: string;
7
+ }
8
+ declare const _default: React.NamedExoticComponent<Omit<ShiftProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ export default _default;
10
+ //# sourceMappingURL=Shift.d.ts.map
@@ -0,0 +1,2 @@
1
+ export { default as Shift, type ShiftProps } from "./Shift";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import React, { ComponentProps, ReactNode } from "react";
2
- import { TextFieldVariant, TextFieldSize, TextFieldRadius, TextFieldAccent } from "./types";
2
+ import { TextFieldAccent, TextFieldRadius, TextFieldSize, TextFieldVariant } from "./types";
3
3
  export interface TextFieldActions {
4
4
  select(): void;
5
5
  focus(): void;
@@ -20,6 +20,7 @@ export interface TextFieldProps extends ComponentProps<"input"> {
20
20
  inputClassName?: string;
21
21
  afterClassName?: string;
22
22
  beforeClassName?: string;
23
+ strict?: boolean;
23
24
  }
24
25
  declare const _default: React.NamedExoticComponent<Omit<TextFieldProps, "ref"> & React.RefAttributes<TextFieldActions>>;
25
26
  export default _default;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Normalizes user-typed numeric input.
3
+ *
4
+ * - Allows partial values ("-", ".", "1e", "1e-")
5
+ * - Supports decimals and scientific notation
6
+ */
7
+ export declare const normalizeNumberInput: (raw: string) => string;
8
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { Root, ToggleGroupMultipleProps, ToggleGroupSingleProps } from "@radix-ui/react-toggle-group";
3
+ export type { ToggleGroupSingleProps, ToggleGroupMultipleProps };
4
+ export type ToggleGroupProps = React.ComponentProps<typeof Root>;
5
+ declare const _default: React.NamedExoticComponent<(Omit<ToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<ToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref">) & React.RefAttributes<HTMLDivElement>>;
6
+ export default _default;
7
+ //# sourceMappingURL=ToggleGroup.d.ts.map
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ declare const _default: React.NamedExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
3
+ export default _default;
4
+ //# sourceMappingURL=ToggleGroupIndicator.d.ts.map
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ import { ToggleGroupItemProps } from "@radix-ui/react-toggle-group";
3
+ export type { ToggleGroupItemProps };
4
+ declare const _default: React.NamedExoticComponent<ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>>;
5
+ export default _default;
6
+ //# sourceMappingURL=ToggleGroupItem.d.ts.map
@@ -0,0 +1,4 @@
1
+ export { default as ToggleGroup, type ToggleGroupProps, type ToggleGroupSingleProps, type ToggleGroupMultipleProps, } from "./ToggleGroup";
2
+ export { default as ToggleGroupItem, type ToggleGroupItemProps } from "./ToggleGroupItem";
3
+ export { default as ToggleGroupIndicator } from "./ToggleGroupIndicator";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -1,10 +1,10 @@
1
1
  import React, { ComponentProps } from "react";
2
- import { HighlightProps } from "../Highlight";
3
2
  export interface TruncateProps extends ComponentProps<"span"> {
4
3
  text?: string;
5
4
  middle?: boolean;
6
5
  separator?: string;
7
- highlight?: Omit<HighlightProps, "textToHighlight">;
6
+ contentClassname?: string;
7
+ render?: (text: string) => React.ReactNode;
8
8
  }
9
9
  declare const _default: React.NamedExoticComponent<Omit<TruncateProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
10
10
  export default _default;
@@ -0,0 +1,2 @@
1
+ export declare const calculateMiddleTruncate: (text: string, maxWidth: number, font: string, letterSpacing: string, separator: string) => string;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -14,8 +14,10 @@ export * from "./List";
14
14
  export * from "./ListItem";
15
15
  export * from "./Modal";
16
16
  export * from "./Odometer";
17
+ export * from "./Popover";
17
18
  export * from "./ScrollArea";
18
19
  export * from "./Select";
20
+ export * from "./Shift";
19
21
  export * from "./SvgSprite";
20
22
  export * from "./Switch";
21
23
  export * from "./Tabs";
@@ -23,6 +25,7 @@ export * from "./Tag";
23
25
  export * from "./TextArea";
24
26
  export * from "./TextField";
25
27
  export * from "./Toast";
28
+ export * from "./ToggleGroup";
26
29
  export * from "./Tooltip";
27
30
  export * from "./Truncate";
28
31
  export * from "./TruncateList";
@@ -1,4 +1,4 @@
1
- import type { AvatarProps, ButtonProps, CheckboxProps, DialogProps, DrawerProps, FooterProps, HeaderProps, HighlightProps, IconProps, IconButtonProps, ListProps, ListItemProps, ModalProps, OdometerProps, ScrollAreaProps, SelectProps, SelectItemProps, SelectIconProps, SelectValueProps, SelectContentProps, SelectTriggerProps, SwitchProps, TabsProps, TabsContentProps, TabsListProps, TabsTriggerProps, TagProps, TextAreaProps, TextFieldProps, ToastProps, TooltipProps, TruncateProps, TruncateListProps, ViewProps, ViewDrawerProps, ViewModalProps } from "../components";
1
+ import type { AvatarProps, ButtonProps, CheckboxProps, DialogProps, DrawerProps, FooterProps, HeaderProps, HighlightProps, IconButtonProps, IconProps, ListItemProps, ListProps, ModalProps, OdometerProps, PopoverAnchorProps, PopoverCloseProps, PopoverContentProps, PopoverProps, PopoverTriggerProps, ScrollAreaProps, SelectContentProps, SelectIconProps, SelectItemProps, SelectProps, SelectTriggerProps, SelectValueProps, SwitchProps, TabsContentProps, TabsListProps, TabsProps, TabsTriggerProps, TagProps, TextAreaProps, TextFieldProps, ToastProps, ToggleGroupItemProps, ToggleGroupProps, TooltipProps, TruncateListProps, TruncateProps, ViewDrawerProps, ViewModalProps, ViewProps } from "../components";
2
2
  export interface ComponentsProps {
3
3
  avatar?: Pick<AvatarProps, "size" | "radius" | "cursorPointer" | "delayMs">;
4
4
  button?: Pick<ButtonProps, "variant" | "color" | "size" | "radius">;
@@ -14,6 +14,11 @@ export interface ComponentsProps {
14
14
  listItem?: ListItemProps;
15
15
  modal?: ModalProps;
16
16
  odometer?: Pick<OdometerProps, "auto" | "format" | "duration">;
17
+ popover?: PopoverProps;
18
+ popoverClose?: PopoverCloseProps;
19
+ popoverAnchor?: PopoverAnchorProps;
20
+ popoverTrigger?: PopoverTriggerProps;
21
+ popoverContent?: PopoverContentProps;
17
22
  scrollArea?: ScrollAreaProps;
18
23
  select?: SelectProps;
19
24
  selectItem?: SelectItemProps;
@@ -30,6 +35,8 @@ export interface ComponentsProps {
30
35
  textArea?: TextAreaProps;
31
36
  textField?: TextFieldProps;
32
37
  toast?: Pick<ToastProps, "side" | "duration" | "swipeDirection" | "swipeThreshold" | "closeProps" | "closeIcon" | "fullWidth" | "sticky" | "radius" | "color">;
38
+ toggleGroup?: Omit<ToggleGroupProps, "type" | "value" | "defaultValue" | "onValueChange">;
39
+ toggleGroupItem?: Omit<ToggleGroupItemProps, "value">;
33
40
  tooltip?: Omit<TooltipProps, "content">;
34
41
  truncate?: TruncateProps;
35
42
  truncateList?: TruncateListProps;
@@ -1,9 +1,35 @@
1
1
  export interface PluginOptions {
2
+ /**
3
+ * Directory path where plugin configuration and style files are located, relative to the project root.
4
+ * @default "."
5
+ */
2
6
  themeDir?: string;
3
- configFileName?: string;
4
- styleFileName?: string;
7
+ /**
8
+ * Name of the configuration file.
9
+ * @default "config.ui"
10
+ */
11
+ configName?: string;
12
+ /**
13
+ * Name of the style file.
14
+ * @default "style.ui"
15
+ */
16
+ styleName?: string;
17
+ /**
18
+ * Whether to merge configuration files from different app directories.
19
+ * @default true
20
+ */
5
21
  mergeConfig?: boolean;
22
+ /**
23
+ * Whether to merge style files from different app directories.
24
+ * @default true
25
+ */
6
26
  mergeStyles?: boolean;
27
+ /**
28
+ * Configuration for splitting chunks.
29
+ * Can be a boolean to enable/disable or a callback to customize chunk names.
30
+ * @default true
31
+ */
32
+ splitChunks?: boolean | ((name: string) => string | undefined);
7
33
  }
8
34
  declare const _default: import("adnbn").PluginDefinition<[options?: PluginOptions | undefined]>;
9
35
  export default _default;
@@ -2,7 +2,95 @@ import { FC, PropsWithChildren } from "react";
2
2
  import { ThemeStorageContract } from "../../types/theme";
3
3
  import { Config } from "../../types/config";
4
4
  export interface ThemeProviderProps extends Pick<Config, "components"> {
5
+ /**
6
+ * Theme persistence storage configuration.
7
+ *
8
+ * @remarks
9
+ * - When `undefined`, theme changes are stored only in component state (memory) and reset on page reload.
10
+ * - When `true`, uses the default `ThemeStorage` implementation (typically localStorage).
11
+ * - When a custom `ThemeStorageContract` object is provided, uses that implementation for theme persistence.
12
+ *
13
+ * The storage is used to save, retrieve, and watch for theme changes across sessions or tabs.
14
+ *
15
+ * @default undefined
16
+ *
17
+ * @example
18
+ * ```tsx
19
+ * // No persistence (memory only)
20
+ * <ThemeProvider>
21
+ * <App />
22
+ * </ThemeProvider>
23
+ * ```
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * // Use default storage (localStorage)
28
+ * <ThemeProvider storage={true}>
29
+ * <App />
30
+ * </ThemeProvider>
31
+ * ```
32
+ *
33
+ * @example
34
+ * ```tsx
35
+ * // Use custom storage implementation
36
+ * const customStorage: ThemeStorageContract = {
37
+ * get: async () => { ... },
38
+ * change: async (theme) => { ... },
39
+ * toggle: async () => { ... },
40
+ * watch: (callback) => { ... }
41
+ * };
42
+ *
43
+ * <ThemeProvider storage={customStorage}>
44
+ * <App />
45
+ * </ThemeProvider>
46
+ * ```
47
+ */
5
48
  storage?: ThemeStorageContract | true;
49
+ /**
50
+ * The DOM element where the provider will set attributes "browser"
51
+ *
52
+ * @remarks
53
+ * - When a string is provided, it's used as a CSS selector to find the element via `document.querySelector`.
54
+ * - When an Element is provided, attributes are set directly on that element.
55
+ * - When `false`, no element attributes are set.
56
+ *
57
+ * Attributes are automatically cleaned up when the component unmounts.
58
+ *
59
+ * @default "html"
60
+ *
61
+ * @example
62
+ * ```tsx
63
+ * // Use default html element
64
+ * <ThemeProviderProps>
65
+ * <App />
66
+ * </ThemeProviderProps>
67
+ * ```
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * // Use custom selector
72
+ * <ThemeProviderProps container="#app-root">
73
+ * <App />
74
+ * </ThemeProviderProps>
75
+ * ```
76
+ *
77
+ * @example
78
+ * ```tsx
79
+ * // Use direct element reference
80
+ * <ThemeProviderProps container={document.body}>
81
+ * <App />
82
+ * </ThemeProviderProps>
83
+ * ```
84
+ *
85
+ * @example
86
+ * ```tsx
87
+ * // Disable container attributes
88
+ * <ThemeProviderProps container={false}>
89
+ * <App />
90
+ * </ThemeProviderProps>
91
+ * ```
92
+ */
93
+ container?: string | Element | false;
6
94
  }
7
95
  declare const ThemeProvider: FC<PropsWithChildren<ThemeProviderProps>>;
8
96
  export default ThemeProvider;
@@ -4,7 +4,28 @@ import { Config } from "../../types/config";
4
4
  import "./styles/default.scss";
5
5
  import "./styles/reset.scss";
6
6
  import "addon-ui-style.scss";
7
- export interface UIProviderProps extends Partial<Config>, Pick<ThemeProviderProps, "storage"> {
7
+ export interface UIProviderProps extends Partial<Config>, Pick<ThemeProviderProps, "storage" | "container"> {
8
+ /**
9
+ * A custom view identifier that allows developers to specify a unique name for styling customization.
10
+ * This value is set as a "view" attribute on the container element and can be targeted through SCSS mixins
11
+ * to apply view-specific styles and behavior.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * <UIProvider view="dashboard">
16
+ * <App />
17
+ * </UIProvider>
18
+ * ```
19
+ *
20
+ * @example
21
+ * ```scss
22
+ * @include view("dashboard") {
23
+ * .some-class {
24
+ * // Custom styles for dashboard view
25
+ * }
26
+ * }
27
+ * ```
28
+ */
8
29
  view?: string;
9
30
  }
10
31
  declare const UIProvider: FC<PropsWithChildren<UIProviderProps>>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "addon-ui",
3
3
  "type": "module",
4
- "version": "0.9.2",
4
+ "version": "0.11.0",
5
5
  "description": "A comprehensive React UI component library designed exclusively for the AddonBone browser extension framework with customizable theming and consistent design patterns",
6
6
  "keywords": [
7
7
  "react",
@@ -15,10 +15,7 @@
15
15
  "typescript",
16
16
  "design-system"
17
17
  ],
18
- "author": "Addon Stack <addonbonedev@gmail.com>",
19
- "contributors": [
20
- "Anjey Tsibylskij (https://github.com/atldays)"
21
- ],
18
+ "author": "Anjey Tsibylskij (https://github.com/atldays)",
22
19
  "license": "MIT",
23
20
  "repository": {
24
21
  "type": "git",
@@ -98,19 +95,21 @@
98
95
  "@commitlint/config-conventional": "^20.0.0",
99
96
  "@eslint/js": "^9.21.0",
100
97
  "@release-it/conventional-changelog": "^10.0.4",
101
- "@rsbuild/plugin-sass": "^1.4.0",
102
- "@storybook/react": "^9.1.3",
98
+ "@rsbuild/core": "^1.7.3",
99
+ "@rsbuild/plugin-sass": "^1.5.1",
100
+ "@storybook/react": "^10.2.18",
103
101
  "@types/chrome": "^0.1.12",
104
102
  "@types/jest": "^30.0.0",
105
103
  "@types/lodash": "^4.17.20",
106
104
  "@types/node": "^22.13.10",
107
105
  "@types/react": "^19.0.10",
108
106
  "@types/react-dom": "^19.0.4",
109
- "adnbn": "^0.5.4",
107
+ "adnbn": "^0.5.7",
110
108
  "depcheck": "^1.4.7",
111
109
  "eslint": "^9.21.0",
112
110
  "eslint-plugin-react-hooks": "^5.1.0",
113
111
  "eslint-plugin-react-refresh": "^0.4.19",
112
+ "eslint-plugin-storybook": "10.2.18",
114
113
  "globals": "^15.15.0",
115
114
  "husky": "^9.1.7",
116
115
  "jest": "^30.1.3",
@@ -119,8 +118,8 @@
119
118
  "react-dom": "^19.1.0",
120
119
  "release-it": "^19.2.3",
121
120
  "rspack-plugin-virtual-module": "^1.0.0",
122
- "storybook": "^9.1.3",
123
- "storybook-react-rsbuild": "^2.1.0",
121
+ "storybook": "^10.2.18",
122
+ "storybook-react-rsbuild": "^3.3.2",
124
123
  "typescript": "~5.7.2",
125
124
  "typescript-eslint": "^8.24.1"
126
125
  },
@@ -141,16 +140,6 @@
141
140
  },
142
141
  "overrides": {
143
142
  "flat-cache": "^6.1.18",
144
- "html-rspack-tags-plugin": {
145
- "glob": "^10.4.5"
146
- },
147
- "test-exclude": {
148
- "glob": "^10.4.5"
149
- }
150
- },
151
- "eslintConfig": {
152
- "extends": [
153
- "plugin:storybook/recommended"
154
- ]
143
+ "glob": "^13.0.0"
155
144
  }
156
145
  }
@@ -9,7 +9,6 @@ $root: button;
9
9
  height: var(--button-height, 34px);
10
10
  border-radius: var(--button-border-radius, 10px);
11
11
  padding: var(--button-padding, 0 16px);
12
- will-change: background, color, transform;
13
12
  transition:
14
13
  color var(--button-speed-color, var(--speed-color)),
15
14
  background var(--button-speed-bg, var(--speed-color)),
@@ -0,0 +1,15 @@
1
+ import React, {FC, memo} from "react";
2
+
3
+ import {PopoverProps, Root} from "@radix-ui/react-popover";
4
+
5
+ import {useComponentProps} from "../../providers";
6
+
7
+ export {type PopoverProps};
8
+
9
+ const Popover: FC<PopoverProps> = props => {
10
+ const mergedProps = {...useComponentProps("popover"), ...props};
11
+
12
+ return <Root {...mergedProps} />;
13
+ };
14
+
15
+ export default memo(Popover);