@kumix/ui 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -8
- package/dist/hooks.d.ts +78 -52
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.d.ts +546 -1871
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +848 -147
- package/dist/index.js.map +1 -1
- package/dist/source.css +1 -0
- package/dist/source.css.d.ts +3 -0
- package/dist/style.css +247 -0
- package/package.json +19 -5
package/README.md
CHANGED
|
@@ -4,7 +4,10 @@ Headless, accessible React component library for Kumix products. Built on Radix
|
|
|
4
4
|
|
|
5
5
|
## What's Inside
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 90+ UI components: form controls, overlays, navigation, data display, DataGrid, Kanban, Sortable, and more.
|
|
8
|
+
- Charts: `Chart` components built on Recharts, with theme-aware colors, tooltips, and legends.
|
|
9
|
+
- Messaging: `Message`, `Bubble`, `Attachment`, and `MessageScroller` primitives for chat and AI interfaces.
|
|
10
|
+
- Input building blocks: `Combobox`, `InputGroup`, `NativeSelect`, and `Marker`, plus a `DirectionProvider` for RTL/LTR support.
|
|
8
11
|
- Hooks entry: viewport, media query, copy-to-clipboard, file upload, intersection observer, mutation observer, and related utilities.
|
|
9
12
|
- Animation components: marquee, text effects, counting/sliding numbers, animated backgrounds, avatar groups, and more.
|
|
10
13
|
- Tailwind-friendly styling via utility classes, semantic CSS variables, and `data-slot` attributes.
|
|
@@ -22,7 +25,7 @@ Install peer dependencies required by the components you use. Common peers inclu
|
|
|
22
25
|
bun add @kumix/utils class-variance-authority lucide-react radix-ui react
|
|
23
26
|
```
|
|
24
27
|
|
|
25
|
-
Feature-specific components may also require `@tanstack/react-table`, `@dnd-kit/*`, `cmdk`, `motion`, `react-day-picker`, `react-aria-components`, `react-hook-form`, `react-resizable-panels`, `sonner`, `vaul`, `input-otp`, `embla-carousel-react`, `next-themes`, or `@headless-tree/core`.
|
|
28
|
+
Feature-specific components may also require `@base-ui/react`, `recharts`, `@tanstack/react-table`, `@dnd-kit/*`, `cmdk`, `motion`, `react-day-picker`, `react-aria-components`, `react-hook-form`, `react-resizable-panels`, `sonner`, `vaul`, `input-otp`, `embla-carousel-react`, `next-themes`, or `@headless-tree/core`.
|
|
26
29
|
|
|
27
30
|
See `package.json` for exact peer dependency ranges.
|
|
28
31
|
|
|
@@ -54,17 +57,27 @@ import { useMediaQuery, useViewport } from "@kumix/ui/hooks";
|
|
|
54
57
|
|
|
55
58
|
## Package Entries
|
|
56
59
|
|
|
57
|
-
| Entry
|
|
58
|
-
|
|
|
59
|
-
| `@kumix/ui`
|
|
60
|
-
| `@kumix/ui/hooks`
|
|
61
|
-
| `@kumix/ui/css`
|
|
60
|
+
| Entry | Description |
|
|
61
|
+
| ---------------------- | --------------------------------------------------------------- |
|
|
62
|
+
| `@kumix/ui` | React components |
|
|
63
|
+
| `@kumix/ui/hooks` | Standalone hooks |
|
|
64
|
+
| `@kumix/ui/css` | Full stylesheet (theme + tokens), emitted as `dist/style.css` |
|
|
65
|
+
| `@kumix/ui/css/source` | Tailwind `@source` directive only, emitted as `dist/source.css` |
|
|
62
66
|
|
|
63
67
|
## Styling
|
|
64
68
|
|
|
65
69
|
Components use Tailwind utility classes and semantic CSS variables, such as `--color-background`, `--color-foreground`, `--color-primary`, `--color-border`, and related tokens.
|
|
66
70
|
|
|
67
|
-
|
|
71
|
+
There are two CSS entries depending on your setup:
|
|
72
|
+
|
|
73
|
+
- `@kumix/ui/css` emits the full package stylesheet from `src/style.css`. It bundles the theme tokens (`:root`/`.dark` variables), the `@theme inline` mappings, animations, and base styles. Import it once in your app if you want the complete Kumix theme out of the box.
|
|
74
|
+
- `@kumix/ui/css/source` emits `src/source.css`, which contains only the Tailwind `@source "."` directive. Import it in your own Tailwind v4 stylesheet when you already define your own theme and just need Tailwind to scan the compiled component classes shipped in `dist`.
|
|
75
|
+
|
|
76
|
+
```css
|
|
77
|
+
/* Your app stylesheet, Tailwind v4 */
|
|
78
|
+
@import "tailwindcss";
|
|
79
|
+
@import "@kumix/ui/css/source";
|
|
80
|
+
```
|
|
68
81
|
|
|
69
82
|
Every component exposes `data-slot` attributes for targeted styling, for example `data-slot="button"` and `data-slot="card"`.
|
|
70
83
|
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
2
|
import React, { ChangeEvent, ComponentType, DragEvent, InputHTMLAttributes, RefObject, SVGProps } from "react";
|
|
3
3
|
import { META_THEME_COLORS } from "@kumix/utils";
|
|
4
|
-
|
|
5
4
|
//#region src/hooks/use-body-classes.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Body class management hook for React components.
|
|
@@ -61,11 +60,10 @@ interface UseCopyToClipboardOptions {
|
|
|
61
60
|
* );
|
|
62
61
|
* ```
|
|
63
62
|
*/
|
|
64
|
-
declare function useCopyToClipboard({
|
|
65
|
-
timeout
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/** Whether text was recently copied (true for timeout duration) */copied: boolean; /** Function to copy text to clipboard */
|
|
63
|
+
declare function useCopyToClipboard({ timeout, onCopy }?: UseCopyToClipboardOptions): {
|
|
64
|
+
/** Whether text was recently copied (true for timeout duration) */
|
|
65
|
+
copied: boolean;
|
|
66
|
+
/** Function to copy text to clipboard */
|
|
69
67
|
copy: (value: string) => Promise<boolean>;
|
|
70
68
|
};
|
|
71
69
|
//#endregion
|
|
@@ -74,55 +72,85 @@ declare function useCopyToClipboard({
|
|
|
74
72
|
* Metadata structure for uploaded files
|
|
75
73
|
*/
|
|
76
74
|
type FileMetadata = {
|
|
77
|
-
/** The name of the file */
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
/** The name of the file */
|
|
76
|
+
name: string;
|
|
77
|
+
/** The size of the file in bytes */
|
|
78
|
+
size: number;
|
|
79
|
+
/** The MIME type of the file */
|
|
80
|
+
type: string;
|
|
81
|
+
/** The URL where the file can be accessed */
|
|
82
|
+
url: string;
|
|
83
|
+
/** Unique identifier for the file */
|
|
81
84
|
id: string;
|
|
82
85
|
};
|
|
83
86
|
/**
|
|
84
87
|
* File object with preview capabilities
|
|
85
88
|
*/
|
|
86
89
|
type FileWithPreview = {
|
|
87
|
-
/** The actual file object or metadata */
|
|
88
|
-
|
|
90
|
+
/** The actual file object or metadata */
|
|
91
|
+
file: File | FileMetadata;
|
|
92
|
+
/** Unique identifier for the file */
|
|
93
|
+
id: string;
|
|
94
|
+
/** Optional preview URL for the file (typically for images) */
|
|
89
95
|
preview?: string;
|
|
90
96
|
};
|
|
91
97
|
/**
|
|
92
98
|
* Configuration options for the file upload hook
|
|
93
99
|
*/
|
|
94
100
|
type FileUploadOptions = {
|
|
95
|
-
/** Maximum number of files allowed (only used when multiple is true, defaults to Infinity) */
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
/** Maximum number of files allowed (only used when multiple is true, defaults to Infinity) */
|
|
102
|
+
maxFiles?: number;
|
|
103
|
+
/** Maximum file size in bytes (defaults to Infinity) */
|
|
104
|
+
maxSize?: number;
|
|
105
|
+
/** Accepted file types (MIME types or extensions, defaults to '*') */
|
|
106
|
+
accept?: string;
|
|
107
|
+
/** Whether multiple files can be selected (defaults to false) */
|
|
108
|
+
multiple?: boolean;
|
|
109
|
+
/** Initial files to populate the upload state */
|
|
110
|
+
initialFiles?: FileMetadata[];
|
|
111
|
+
/** Callback function executed when files change */
|
|
112
|
+
onFilesChange?: (files: FileWithPreview[]) => void;
|
|
113
|
+
/** Callback function executed when new files are added */
|
|
114
|
+
onFilesAdded?: (addedFiles: FileWithPreview[]) => void;
|
|
115
|
+
/** Callback function executed when validation errors occur */
|
|
102
116
|
onError?: (errors: string[]) => void;
|
|
103
117
|
};
|
|
104
118
|
/**
|
|
105
119
|
* Current state of the file upload component
|
|
106
120
|
*/
|
|
107
121
|
type FileUploadState = {
|
|
108
|
-
/** Array of files currently selected/uploaded */
|
|
109
|
-
|
|
122
|
+
/** Array of files currently selected/uploaded */
|
|
123
|
+
files: FileWithPreview[];
|
|
124
|
+
/** Whether the user is currently dragging files over the drop zone */
|
|
125
|
+
isDragging: boolean;
|
|
126
|
+
/** Array of validation error messages */
|
|
110
127
|
errors: string[];
|
|
111
128
|
};
|
|
112
129
|
/**
|
|
113
130
|
* Actions available for file upload management
|
|
114
131
|
*/
|
|
115
132
|
type FileUploadActions = {
|
|
116
|
-
/** Add new files to the upload state */
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
133
|
+
/** Add new files to the upload state */
|
|
134
|
+
addFiles: (files: FileList | File[]) => void;
|
|
135
|
+
/** Remove a specific file by its ID */
|
|
136
|
+
removeFile: (id: string) => void;
|
|
137
|
+
/** Clear all files from the upload state */
|
|
138
|
+
clearFiles: () => void;
|
|
139
|
+
/** Clear all error messages */
|
|
140
|
+
clearErrors: () => void;
|
|
141
|
+
/** Handle drag enter event for drop zone */
|
|
142
|
+
handleDragEnter: (e: DragEvent<HTMLElement>) => void;
|
|
143
|
+
/** Handle drag leave event for drop zone */
|
|
144
|
+
handleDragLeave: (e: DragEvent<HTMLElement>) => void;
|
|
145
|
+
/** Handle drag over event for drop zone */
|
|
146
|
+
handleDragOver: (e: DragEvent<HTMLElement>) => void;
|
|
147
|
+
/** Handle drop event for drop zone */
|
|
148
|
+
handleDrop: (e: DragEvent<HTMLElement>) => void;
|
|
149
|
+
/** Handle file input change event */
|
|
150
|
+
handleFileChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
151
|
+
/** Programmatically open the file dialog */
|
|
152
|
+
openFileDialog: () => void;
|
|
153
|
+
/** Get props for the file input element */
|
|
126
154
|
getInputProps: (props?: InputHTMLAttributes<HTMLInputElement>) => InputHTMLAttributes<HTMLInputElement> & {
|
|
127
155
|
ref: React.Ref<HTMLInputElement>;
|
|
128
156
|
};
|
|
@@ -268,12 +296,7 @@ interface IntersectionObserverOptions extends IntersectionObserverInit {
|
|
|
268
296
|
* );
|
|
269
297
|
* ```
|
|
270
298
|
*/
|
|
271
|
-
declare function useIntersectionObserver(elementRef: React$1.RefObject<Element | null>, {
|
|
272
|
-
threshold,
|
|
273
|
-
root,
|
|
274
|
-
rootMargin,
|
|
275
|
-
freezeOnceVisible
|
|
276
|
-
}?: IntersectionObserverOptions): boolean;
|
|
299
|
+
declare function useIntersectionObserver(elementRef: React$1.RefObject<Element | null>, { threshold, root, rootMargin, freezeOnceVisible }?: IntersectionObserverOptions): boolean;
|
|
277
300
|
//#endregion
|
|
278
301
|
//#region src/hooks/use-is-mac.d.ts
|
|
279
302
|
/**
|
|
@@ -601,7 +624,9 @@ declare const useMenu: (pathname: string) => UseMenuReturn;
|
|
|
601
624
|
* ```
|
|
602
625
|
*/
|
|
603
626
|
declare function useMetaColor(defaultColors?: typeof META_THEME_COLORS): {
|
|
604
|
-
/** Current meta theme color based on resolved theme */
|
|
627
|
+
/** Current meta theme color based on resolved theme */
|
|
628
|
+
metaColor: "#09090b" | "#ffffff";
|
|
629
|
+
/** Function to manually set meta theme color */
|
|
605
630
|
setMetaColor: (color: string) => void;
|
|
606
631
|
};
|
|
607
632
|
//#endregion
|
|
@@ -765,9 +790,7 @@ interface UseScrollPositionProps {
|
|
|
765
790
|
* }
|
|
766
791
|
* ```
|
|
767
792
|
*/
|
|
768
|
-
declare const useScrollPosition: ({
|
|
769
|
-
targetRef
|
|
770
|
-
}?: UseScrollPositionProps) => number;
|
|
793
|
+
declare const useScrollPosition: ({ targetRef }?: UseScrollPositionProps) => number;
|
|
771
794
|
//#endregion
|
|
772
795
|
//#region src/hooks/use-slider-input.d.ts
|
|
773
796
|
/**
|
|
@@ -843,17 +866,20 @@ interface UseSliderInputProps {
|
|
|
843
866
|
* }
|
|
844
867
|
* ```
|
|
845
868
|
*/
|
|
846
|
-
declare function useSliderInput({
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
/**
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
inputValues: [number, number];
|
|
855
|
-
|
|
856
|
-
|
|
869
|
+
declare function useSliderInput({ minValue, maxValue, initialValue }: UseSliderInputProps): {
|
|
870
|
+
/** Function to manually set slider values */
|
|
871
|
+
setSliderValues: React$1.Dispatch<React$1.SetStateAction<[number, number]>>;
|
|
872
|
+
/** Function to manually set input values */
|
|
873
|
+
setInputValues: React$1.Dispatch<React$1.SetStateAction<[number, number]>>;
|
|
874
|
+
/** Current slider values [min, max] */
|
|
875
|
+
sliderValues: [number, number];
|
|
876
|
+
/** Current input values [min, max] */
|
|
877
|
+
inputValues: [number, number];
|
|
878
|
+
/** Handler for slider value changes */
|
|
879
|
+
handleSliderChange: (values: [number, number]) => void;
|
|
880
|
+
/** Handler for input field changes */
|
|
881
|
+
handleInputChange: (e: React$1.ChangeEvent<HTMLInputElement>, index: 0 | 1) => void;
|
|
882
|
+
/** Function to validate and update values from inputs */
|
|
857
883
|
validateAndUpdateValue: (value: number, index: 0 | 1) => void;
|
|
858
884
|
};
|
|
859
885
|
//#endregion
|
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","names":[],"sources":["../src/hooks/use-body-classes.ts","../src/hooks/use-copy-to-clipboard.ts","../src/hooks/use-file-upload.ts","../src/hooks/use-hydrated.ts","../src/hooks/use-intersection-observer.ts","../src/hooks/use-is-mac.ts","../src/hooks/use-is-mobile.ts","../src/hooks/use-media-query.ts","../src/hooks/use-menu.ts","../src/hooks/use-meta-color.ts","../src/hooks/use-mutation-observer.ts","../src/hooks/use-remove-ga-params.ts","../src/hooks/use-scroll-position.ts","../src/hooks/use-slider-input.ts","../src/hooks/use-viewport.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","names":[],"sources":["../src/hooks/use-body-classes.ts","../src/hooks/use-copy-to-clipboard.ts","../src/hooks/use-file-upload.ts","../src/hooks/use-hydrated.ts","../src/hooks/use-intersection-observer.ts","../src/hooks/use-is-mac.ts","../src/hooks/use-is-mobile.ts","../src/hooks/use-media-query.ts","../src/hooks/use-menu.ts","../src/hooks/use-meta-color.ts","../src/hooks/use-mutation-observer.ts","../src/hooks/use-remove-ga-params.ts","../src/hooks/use-scroll-position.ts","../src/hooks/use-slider-input.ts","../src/hooks/use-viewport.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;cA2Ba,iBAAkB;;;;;;;;;UCdrB;;EAER;;EAEA;;;;;;;;;;;;;;;;;;;;;;;iBAwBc,qBAAqB,SAAgB,WAAU;;;;2BAWvC;;;;;;;KC9BZ;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;;;;KAMU;;EAEV,MAAM,OAAO;;EAEb;;EAEA;;;;;KAMU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA,eAAe;;EAEf,iBAAiB,OAAO;;EAExB,gBAAgB,YAAY;;EAE5B,WAAW;;;;;KAMD;;EAEV,OAAO;;EAEP;;EAEA;;;;;KAMU;;EAEV,WAAW,OAAO,WAAW;;EAE7B,aAAa;;EAEb;;EAEA;;EAEA,kBAAkB,GAAG,UAAU;;EAE/B,kBAAkB,GAAG,UAAU;;EAE/B,iBAAiB,GAAG,UAAU;;EAE9B,aAAa,GAAG,UAAU;;EAE1B,mBAAmB,GAAG,YAAY;;EAElC;;EAEA,gBACE,QAAQ,oBAAoB,sBACzB,oBAAoB;IACvB,KAAK,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAuDN,gBACX,UAAS,uBACP,iBAAiB;;;;;;;;;;;;;;;cA6aR,cAAe,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;iBC/iB3B;;;;;;;;;UCpBN,oCAAoC;;;;;;;;EAQ5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;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