@mbao01/common 0.2.2 → 0.2.4

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 (137) hide show
  1. package/dist/types/components/Dock/Dock.d.ts +8 -0
  2. package/dist/types/components/Dock/constants.d.ts +12 -0
  3. package/dist/types/components/Dock/index.d.ts +1 -0
  4. package/dist/types/components/Dock/types.d.ts +12 -0
  5. package/dist/types/components/Form/DatetimeInput/constants.d.ts +0 -7
  6. package/dist/types/components/Form/DatetimeInput/types.d.ts +2 -2
  7. package/dist/types/components/Form/Input/Input.d.ts +5 -2
  8. package/dist/types/components/Form/Input/constants.d.ts +11 -0
  9. package/dist/types/components/Form/Input/types.d.ts +9 -2
  10. package/dist/types/components/Form/MultiSelect/constants.d.ts +1 -7
  11. package/dist/types/components/Form/MultiSelect/types.d.ts +3 -2
  12. package/dist/types/components/Form/Radio/Radio.d.ts +1 -1
  13. package/dist/types/components/Form/Radio/types.d.ts +1 -1
  14. package/dist/types/components/Form/Range/Range.d.ts +1 -1
  15. package/dist/types/components/Form/Range/types.d.ts +1 -1
  16. package/dist/types/components/Form/Select/Select.d.ts +5 -2
  17. package/dist/types/components/Form/Select/constants.d.ts +6 -2
  18. package/dist/types/components/Form/Select/types.d.ts +10 -2
  19. package/dist/types/components/Form/Switch/Switch.d.ts +1 -1
  20. package/dist/types/components/Form/Switch/types.d.ts +1 -1
  21. package/dist/types/components/Form/TagsInput/TagsInput.d.ts +2 -0
  22. package/dist/types/components/Form/TagsInput/constants.d.ts +0 -4
  23. package/dist/types/components/Form/TagsInput/types.d.ts +2 -1
  24. package/dist/types/components/Form/TextField/TextField.d.ts +5 -1
  25. package/dist/types/components/Form/TextField/types.d.ts +1 -0
  26. package/dist/types/components/Form/Textarea/Textarea.d.ts +2 -0
  27. package/dist/types/components/Form/Textarea/constants.d.ts +1 -0
  28. package/dist/types/components/Form/Textarea/types.d.ts +7 -1
  29. package/dist/types/components/Form/Validator/Validator.d.ts +6 -0
  30. package/dist/types/components/Form/Validator/constants.d.ts +4 -0
  31. package/dist/types/components/Form/Validator/index.d.ts +1 -0
  32. package/dist/types/components/Form/Validator/types.d.ts +14 -0
  33. package/dist/types/components/Form/components/Fieldset/types.d.ts +1 -1
  34. package/dist/types/components/Form/index.d.ts +1 -0
  35. package/dist/types/components/Indicator/Indicator.d.ts +6 -0
  36. package/dist/types/components/Indicator/constants.d.ts +15 -0
  37. package/dist/types/components/Indicator/index.d.ts +1 -0
  38. package/dist/types/components/Indicator/types.d.ts +14 -0
  39. package/dist/types/components/Join/Join.d.ts +6 -0
  40. package/dist/types/components/Join/constants.d.ts +2 -0
  41. package/dist/types/components/Join/index.d.ts +1 -0
  42. package/dist/types/components/Join/types.d.ts +13 -0
  43. package/dist/types/components/Kbd/Kbd.d.ts +2 -0
  44. package/dist/types/components/Kbd/constants.d.ts +5 -0
  45. package/dist/types/components/Kbd/index.d.ts +1 -0
  46. package/dist/types/components/Kbd/types.d.ts +3 -0
  47. package/dist/types/components/List/List.d.ts +7 -0
  48. package/dist/types/components/List/constants.d.ts +5 -0
  49. package/dist/types/components/List/index.d.ts +1 -0
  50. package/dist/types/components/List/types.d.ts +6 -0
  51. package/dist/types/components/Resizable/Resizable.d.ts +24 -0
  52. package/dist/types/components/Resizable/constants.d.ts +6 -0
  53. package/dist/types/components/Resizable/index.d.ts +1 -0
  54. package/dist/types/components/Resizable/types.d.ts +7 -0
  55. package/dist/types/components/Sidebar/Sidebar.d.ts +5 -2
  56. package/dist/types/components/Stack/Stack.d.ts +2 -0
  57. package/dist/types/components/Stack/constants.d.ts +3 -0
  58. package/dist/types/components/Stack/index.d.ts +1 -0
  59. package/dist/types/components/Stack/types.d.ts +3 -0
  60. package/dist/types/components/Stat/Stat.d.ts +11 -0
  61. package/dist/types/components/Stat/constants.d.ts +11 -0
  62. package/dist/types/components/Stat/index.d.ts +1 -0
  63. package/dist/types/components/Stat/types.d.ts +10 -0
  64. package/dist/types/components/Status/Status.d.ts +2 -0
  65. package/dist/types/components/Status/constants.d.ts +5 -0
  66. package/dist/types/components/Status/index.d.ts +1 -0
  67. package/dist/types/components/Status/types.d.ts +3 -0
  68. package/dist/types/components/Text/types.d.ts +1 -1
  69. package/dist/types/index.d.ts +9 -0
  70. package/package.json +44 -42
  71. package/src/components/Dock/Dock.tsx +41 -0
  72. package/src/components/Dock/constants.ts +62 -0
  73. package/src/components/Dock/index.ts +1 -0
  74. package/src/components/Dock/types.ts +23 -0
  75. package/src/components/Form/Checkbox/constants.ts +9 -8
  76. package/src/components/Form/DatetimeInput/DatetimeInput.tsx +2 -2
  77. package/src/components/Form/DatetimeInput/constants.ts +0 -53
  78. package/src/components/Form/DatetimeInput/types.ts +2 -2
  79. package/src/components/Form/Input/Input.tsx +71 -10
  80. package/src/components/Form/Input/constants.ts +78 -5
  81. package/src/components/Form/Input/types.ts +12 -4
  82. package/src/components/Form/MultiSelect/MultiSelect.tsx +3 -1
  83. package/src/components/Form/MultiSelect/constants.ts +8 -49
  84. package/src/components/Form/MultiSelect/types.ts +2 -2
  85. package/src/components/Form/Radio/types.ts +4 -1
  86. package/src/components/Form/Range/types.ts +4 -1
  87. package/src/components/Form/Select/Select.tsx +71 -10
  88. package/src/components/Form/Select/constants.ts +22 -12
  89. package/src/components/Form/Select/types.ts +11 -1
  90. package/src/components/Form/Switch/types.ts +4 -1
  91. package/src/components/Form/TagsInput/TagsInput.tsx +7 -2
  92. package/src/components/Form/TagsInput/constants.ts +15 -48
  93. package/src/components/Form/TagsInput/types.ts +3 -1
  94. package/src/components/Form/TextField/types.ts +1 -0
  95. package/src/components/Form/Textarea/Textarea.tsx +29 -3
  96. package/src/components/Form/Textarea/constants.ts +2 -15
  97. package/src/components/Form/Textarea/types.ts +9 -2
  98. package/src/components/Form/Validator/Validator.tsx +27 -0
  99. package/src/components/Form/Validator/constants.ts +18 -0
  100. package/src/components/Form/Validator/index.ts +1 -0
  101. package/src/components/Form/Validator/types.ts +30 -0
  102. package/src/components/Form/components/Fieldset/types.ts +1 -1
  103. package/src/components/Form/index.ts +1 -0
  104. package/src/components/Indicator/Indicator.tsx +46 -0
  105. package/src/components/Indicator/constants.ts +26 -0
  106. package/src/components/Indicator/index.ts +1 -0
  107. package/src/components/Indicator/types.ts +34 -0
  108. package/src/components/Join/Join.tsx +28 -0
  109. package/src/components/Join/constants.ts +5 -0
  110. package/src/components/Join/index.ts +1 -0
  111. package/src/components/Join/types.ts +29 -0
  112. package/src/components/Kbd/Kbd.tsx +7 -0
  113. package/src/components/Kbd/constants.ts +40 -0
  114. package/src/components/Kbd/index.ts +1 -0
  115. package/src/components/Kbd/types.ts +4 -0
  116. package/src/components/List/List.tsx +35 -0
  117. package/src/components/List/constants.ts +14 -0
  118. package/src/components/List/index.ts +1 -0
  119. package/src/components/List/types.ts +12 -0
  120. package/src/components/Resizable/Resizable.tsx +36 -0
  121. package/src/components/Resizable/constants.ts +22 -0
  122. package/src/components/Resizable/index.ts +1 -0
  123. package/src/components/Resizable/types.ts +13 -0
  124. package/src/components/Stack/Stack.tsx +11 -0
  125. package/src/components/Stack/constants.ts +12 -0
  126. package/src/components/Stack/index.ts +1 -0
  127. package/src/components/Stack/types.ts +5 -0
  128. package/src/components/Stat/Stat.tsx +55 -0
  129. package/src/components/Stat/constants.ts +33 -0
  130. package/src/components/Stat/index.ts +1 -0
  131. package/src/components/Stat/types.ts +31 -0
  132. package/src/components/Status/Status.tsx +7 -0
  133. package/src/components/Status/constants.ts +31 -0
  134. package/src/components/Status/index.ts +1 -0
  135. package/src/components/Status/types.ts +5 -0
  136. package/src/components/Text/types.ts +1 -1
  137. package/src/index.ts +9 -0
@@ -0,0 +1,2 @@
1
+ import { StackProps } from './types';
2
+ export declare const Stack: ({ className, children, direction, ...props }: StackProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export declare const getStackClasses: (props?: ({
2
+ direction?: "end" | "top" | "bottom" | "start" | null | undefined;
3
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
@@ -0,0 +1 @@
1
+ export { Stack } from './Stack';
@@ -0,0 +1,3 @@
1
+ import { VariantProps } from '../../libs';
2
+ import { getStackClasses } from './constants';
3
+ export type StackProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getStackClasses>;
@@ -0,0 +1,11 @@
1
+ import { StatActionsProps, StatDescriptionProps, StatFigureProps, StatProps, StatsProps, StatTitleProps, StatValueProps } from './types';
2
+ declare const Stats: ({ direction, className, ...props }: StatsProps) => import("react/jsx-runtime").JSX.Element;
3
+ declare const Stat: {
4
+ ({ className, position, ...props }: StatProps): import("react/jsx-runtime").JSX.Element;
5
+ Actions: ({ className, ...props }: StatActionsProps) => import("react/jsx-runtime").JSX.Element;
6
+ Description: ({ className, ...props }: StatDescriptionProps) => import("react/jsx-runtime").JSX.Element;
7
+ Figure: ({ className, ...props }: StatFigureProps) => import("react/jsx-runtime").JSX.Element;
8
+ Title: ({ className, ...props }: StatTitleProps) => import("react/jsx-runtime").JSX.Element;
9
+ Value: ({ className, ...props }: StatValueProps) => import("react/jsx-runtime").JSX.Element;
10
+ };
11
+ export { Stats, Stat };
@@ -0,0 +1,11 @@
1
+ export declare const getStatsClasses: (props?: ({
2
+ direction?: "horizontal" | "vertical" | null | undefined;
3
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
4
+ export declare const getStatClasses: (props?: ({
5
+ position?: "end" | "center" | "start" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ export declare const getStatTitleClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
8
+ export declare const getStatValueClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
9
+ export declare const getStatDescriptionClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
10
+ export declare const getStatFigureClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
11
+ export declare const getStatActionsClasses: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
@@ -0,0 +1 @@
1
+ export { Stat, Stats } from './Stat';
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { VariantProps } from '../../libs';
3
+ import { getStatActionsClasses, getStatClasses, getStatDescriptionClasses, getStatFigureClasses, getStatsClasses, getStatTitleClasses, getStatValueClasses } from './constants';
4
+ export type StatsProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getStatsClasses>;
5
+ export type StatProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getStatClasses>;
6
+ export type StatActionsProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getStatActionsClasses>;
7
+ export type StatDescriptionProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getStatDescriptionClasses>;
8
+ export type StatFigureProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getStatFigureClasses>;
9
+ export type StatTitleProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getStatTitleClasses>;
10
+ export type StatValueProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getStatValueClasses>;
@@ -0,0 +1,2 @@
1
+ import { StatusProps } from './types';
2
+ export declare const Status: ({ animate, variant, size, className, ...props }: StatusProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export declare const getStatusClasses: (props?: ({
2
+ variant?: "accent" | "default" | "error" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | "ghost" | null | undefined;
3
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
4
+ animate?: "ping" | "bounce" | "pulse" | "spin" | null | undefined;
5
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
@@ -0,0 +1 @@
1
+ export { Status } from './Status';
@@ -0,0 +1,3 @@
1
+ import { VariantProps } from '../../libs';
2
+ import { getStatusClasses } from './constants';
3
+ export type StatusProps = Omit<React.HTMLAttributes<HTMLSpanElement>, "children"> & VariantProps<typeof getStatusClasses>;
@@ -2,7 +2,7 @@ import { VariantProps } from '../../libs';
2
2
  import { getTextClasses } from './constants';
3
3
  export type As = "h1" | "h2" | "h3" | "h4" | "h5" | "p" | "span";
4
4
  type AllowedElements = Pick<React.JSX.IntrinsicElements, As>;
5
- export type TextProps<T extends As> = React.HTMLAttributes<HTMLElement & AllowedElements[T]> & VariantProps<typeof getTextClasses> & {
5
+ export type TextProps<T extends As> = AllowedElements[T] & VariantProps<typeof getTextClasses> & {
6
6
  as?: As;
7
7
  };
8
8
  export {};
@@ -16,10 +16,19 @@ export * from './components/Card';
16
16
  export * from './components/Calendar';
17
17
  export * from './components/Collapsible';
18
18
  export * from './components/Description';
19
+ export * from './components/Dock';
20
+ export * from './components/Indicator';
21
+ export * from './components/Join';
22
+ export * from './components/Kbd';
23
+ export * from './components/List';
19
24
  export * from './components/Progress';
25
+ export * from './components/Resizable';
20
26
  export * from './components/ScrollArea';
21
27
  export * from './components/Separator';
22
28
  export * from './components/Sonner';
29
+ export * from './components/Stack';
30
+ export * from './components/Stat';
31
+ export * from './components/Status';
23
32
  export * from './components/Table';
24
33
  export * from './components/Tabs';
25
34
  export * from './components/Text';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mbao01/common",
3
3
  "private": false,
4
- "version": "0.2.2",
4
+ "version": "0.2.4",
5
5
  "type": "module",
6
6
  "author": "Ayomide Bakare",
7
7
  "license": "MIT",
@@ -93,58 +93,59 @@
93
93
  "@radix-ui/react-toggle-group": "^1.1.2",
94
94
  "@radix-ui/react-tooltip": "^1.1.8",
95
95
  "@tailwindcss/typography": "^0.5.16",
96
- "chrono-node": "^2.7.9",
96
+ "chrono-node": "^2.8.0",
97
97
  "class-variance-authority": "^0.7.1",
98
98
  "clsx": "^2.1.1",
99
99
  "cmdk": "^1.1.1",
100
- "daisyui": "^5.0.9",
101
100
  "date-fns": "^4.1.0",
102
- "embla-carousel-react": "^8.5.2",
103
- "lucide-react": "^0.486.0",
104
- "react-day-picker": "^9.6.4",
101
+ "embla-carousel-react": "^8.6.0",
102
+ "lucide-react": "^0.487.0",
103
+ "react-day-picker": "^9.6.5",
105
104
  "react-dropzone": "^14.3.8",
106
105
  "react-international-phone": "^4.5.0",
107
106
  "react-otp-input": "^3.1.1",
107
+ "react-resizable-panels": "^2.1.7",
108
108
  "sonner": "^2.0.3",
109
- "tailwind-merge": "^3.1.0",
109
+ "tailwind-merge": "^3.2.0",
110
110
  "timescape": "^0.7.1",
111
111
  "universal-cookie": "^8.0.1",
112
112
  "vaul": "^1.1.2"
113
113
  },
114
114
  "devDependencies": {
115
- "@eslint/js": "^9.23.0",
115
+ "@eslint/js": "^9.24.0",
116
116
  "@ianvs/prettier-plugin-sort-imports": "^4.4.1",
117
- "@storybook/addon-a11y": "^8.6.11",
117
+ "@storybook/addon-a11y": "^8.6.12",
118
118
  "@storybook/addon-coverage": "^1.0.5",
119
- "@storybook/addon-essentials": "^8.6.11",
120
- "@storybook/addon-interactions": "^8.6.11",
121
- "@storybook/addon-links": "^8.6.11",
122
- "@storybook/addon-onboarding": "^8.6.11",
123
- "@storybook/addon-storysource": "^8.6.11",
124
- "@storybook/addon-themes": "^8.6.11",
125
- "@storybook/addon-viewport": "^8.6.11",
126
- "@storybook/blocks": "^8.6.11",
127
- "@storybook/react": "^8.6.11",
128
- "@storybook/react-vite": "^8.6.11",
129
- "@storybook/test": "^8.6.11",
119
+ "@storybook/addon-essentials": "^8.6.12",
120
+ "@storybook/addon-interactions": "^8.6.12",
121
+ "@storybook/addon-links": "^8.6.12",
122
+ "@storybook/addon-onboarding": "^8.6.12",
123
+ "@storybook/addon-storysource": "^8.6.12",
124
+ "@storybook/addon-themes": "^8.6.12",
125
+ "@storybook/addon-viewport": "^8.6.12",
126
+ "@storybook/blocks": "^8.6.12",
127
+ "@storybook/react": "^8.6.12",
128
+ "@storybook/react-vite": "^8.6.12",
129
+ "@storybook/test": "^8.6.12",
130
130
  "@storybook/test-runner": "^0.22.0",
131
- "@tailwindcss/postcss": "^4.0.17",
132
- "@tailwindcss/vite": "^4.0.17",
131
+ "@tailwindcss/postcss": "^4.1.3",
132
+ "@tailwindcss/vite": "^4.1.3",
133
133
  "@testing-library/jest-dom": "^6.6.3",
134
- "@testing-library/react": "^16.2.0",
134
+ "@testing-library/react": "^16.3.0",
135
135
  "@testing-library/user-event": "^14.6.1",
136
136
  "@types/jest-image-snapshot": "^6.4.0",
137
- "@types/node": "^22.13.16",
138
- "@types/react": "^19.0.12",
139
- "@types/react-dom": "^19.0.4",
140
- "@typescript-eslint/eslint-plugin": "^8.29.0",
141
- "@typescript-eslint/parser": "^8.29.0",
137
+ "@types/node": "^22.14.0",
138
+ "@types/react": "^19.1.0",
139
+ "@types/react-dom": "^19.1.1",
140
+ "@typescript-eslint/eslint-plugin": "^8.29.1",
141
+ "@typescript-eslint/parser": "^8.29.1",
142
142
  "@vitejs/plugin-react": "^4.3.4",
143
143
  "@vitest/coverage-v8": "^3.1.1",
144
144
  "@vitest/ui": "^3.1.1",
145
145
  "axe-playwright": "^2.1.0",
146
- "eslint": "^9.23.0",
147
- "eslint-plugin-react": "^7.37.4",
146
+ "daisyui": "^5.0.16",
147
+ "eslint": "^9.24.0",
148
+ "eslint-plugin-react": "^7.37.5",
148
149
  "eslint-plugin-react-hooks": "^5.2.0",
149
150
  "eslint-plugin-react-refresh": "^0.4.19",
150
151
  "eslint-plugin-storybook": "^0.12.0",
@@ -156,21 +157,22 @@
156
157
  "prettier": "^3.5.3",
157
158
  "react": "^19.1.0",
158
159
  "react-dom": "^19.1.0",
159
- "react-router-dom": "^7.4.1",
160
- "recharts": "^2.15.1",
161
- "storybook": "^8.6.11",
162
- "tailwindcss": "^4.0.17",
163
- "typescript": "^5.8.2",
164
- "typescript-eslint": "^8.29.0",
165
- "vite": "^6.2.4",
160
+ "react-router-dom": "^7.5.0",
161
+ "recharts": "^2.15.2",
162
+ "storybook": "^8.6.12",
163
+ "tailwindcss": "^4.1.3",
164
+ "typescript": "^5.8.3",
165
+ "typescript-eslint": "^8.29.1",
166
+ "vite": "^6.2.5",
166
167
  "vite-plugin-dts": "^4.5.3",
167
168
  "vitest": "^3.1.1"
168
169
  },
169
170
  "peerDependencies": {
170
- "react": "^19.0.0",
171
- "react-dom": "^19.0.0",
172
- "recharts": "^2.15.0",
173
- "typescript": "^5.7.2"
171
+ "daisyui": "5",
172
+ "react": "19",
173
+ "react-dom": "19",
174
+ "recharts": "2",
175
+ "typescript": "5"
174
176
  },
175
- "gitHead": "aa3d3090fd645ac0a64b1ccb1fe9451037083674"
177
+ "gitHead": "4e8242f09ad1b2aef4f84ee05573df8b875ab015"
176
178
  }
@@ -0,0 +1,41 @@
1
+ import type { DockButtonProps, DockIconProps, DockLabelProps, DockProps } from "./types";
2
+ import { cn } from "../../utilities";
3
+ import {
4
+ getDockButtonClasses,
5
+ getDockClasses,
6
+ getDockIconClasses,
7
+ getDockLabelClasses,
8
+ } from "./constants";
9
+
10
+ const Dock = ({ size, variant, outline, children, className, ...props }: DockProps) => (
11
+ <div className={cn(getDockClasses({ size, variant, outline }), className)} {...props}>
12
+ {children}
13
+ </div>
14
+ );
15
+
16
+ const DockButton = ({ active, children, className, ...props }: DockButtonProps) => (
17
+ <button className={cn(getDockButtonClasses({ active }), className)} {...props}>
18
+ {children}
19
+ </button>
20
+ );
21
+
22
+ const DockLabel = ({ className, children, ...props }: DockLabelProps) => (
23
+ <span className={cn(getDockLabelClasses(), className)} {...props}>
24
+ {children}
25
+ </span>
26
+ );
27
+
28
+ const DockIcon = ({ icon, size, className, children, ...props }: DockIconProps) => {
29
+ const Icon = icon;
30
+ return (
31
+ <Icon className={cn(getDockIconClasses({ size }), className)} {...props}>
32
+ {children}
33
+ </Icon>
34
+ );
35
+ };
36
+
37
+ Dock.Button = DockButton;
38
+ Dock.Label = DockLabel;
39
+ Dock.Icon = DockIcon;
40
+
41
+ export { Dock };
@@ -0,0 +1,62 @@
1
+ import { cva } from "../../libs";
2
+
3
+ export const getDockClasses = cva("dock", {
4
+ variants: {
5
+ size: {
6
+ xs: "dock-xs",
7
+ sm: "dock-sm",
8
+ md: "dock-md",
9
+ lg: "dock-lg",
10
+ xl: "dock-xl",
11
+ },
12
+ variant: {
13
+ accent: "bg-accent text-accent-content border-accent",
14
+ default: "bg-default text-default-content border-default",
15
+ error: "bg-error text-error-content border-error",
16
+ ghost: "bg-ghost text-ghost-content border-transparent",
17
+ info: "bg-info text-info-content border-info",
18
+ neutral: "bg-neutral text-neutral-content border-neutral",
19
+ primary: "bg-primary text-primary-content border-primary",
20
+ secondary: "bg-secondary text-secondary-content border-secondary",
21
+ success: "bg-success text-success-content border-success",
22
+ warning: "bg-warning text-warning-content border-warning",
23
+ },
24
+ outline: {
25
+ true: "border bg-default",
26
+ },
27
+ },
28
+ compoundVariants: [
29
+ { outline: true, variant: "accent", className: "text-accent" },
30
+ { outline: true, variant: "default", className: "text-default" },
31
+ { outline: true, variant: "error", className: "text-error" },
32
+ { outline: true, variant: "ghost", className: "text-ghost" },
33
+ { outline: true, variant: "info", className: "text-info" },
34
+ { outline: true, variant: "neutral", className: "text-neutral" },
35
+ { outline: true, variant: "primary", className: "text-primary" },
36
+ { outline: true, variant: "secondary", className: "text-secondary" },
37
+ { outline: true, variant: "success", className: "text-success" },
38
+ { outline: true, variant: "warning", className: "text-warning" },
39
+ ],
40
+ });
41
+
42
+ export const getDockButtonClasses = cva("", {
43
+ variants: {
44
+ active: {
45
+ true: "dock-active",
46
+ },
47
+ },
48
+ });
49
+
50
+ export const getDockIconClasses = cva("", {
51
+ variants: {
52
+ size: {
53
+ xs: "size-3",
54
+ sm: "size-4",
55
+ md: "size-5",
56
+ lg: "size-6",
57
+ xl: "size-6",
58
+ },
59
+ },
60
+ });
61
+
62
+ export const getDockLabelClasses = cva("dock-label");
@@ -0,0 +1 @@
1
+ export { Dock } from "./Dock";
@@ -0,0 +1,23 @@
1
+ import type { LucideProps } from "lucide-react";
2
+ import React from "react";
3
+ import { type VariantProps } from "../../libs";
4
+ import {
5
+ getDockButtonClasses,
6
+ getDockClasses,
7
+ getDockIconClasses,
8
+ getDockLabelClasses,
9
+ } from "./constants";
10
+
11
+ export type DockProps = React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof getDockClasses>;
12
+
13
+ export type DockButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> &
14
+ VariantProps<typeof getDockButtonClasses>;
15
+
16
+ export type DockLabelProps = React.HTMLAttributes<HTMLSpanElement> &
17
+ VariantProps<typeof getDockLabelClasses>;
18
+
19
+ type P = Omit<LucideProps, "ref"> & React.RefAttributes<SVGSVGElement>;
20
+ export type DockIconProps = P &
21
+ VariantProps<typeof getDockIconClasses> & {
22
+ icon: React.ForwardRefExoticComponent<P>;
23
+ };
@@ -1,22 +1,23 @@
1
1
  import { cva } from "../../../libs";
2
2
 
3
3
  export const getCheckboxClasses = cva(
4
- "peer flex items-center justify-center h-4 w-4 shrink-0 rounded-xs border focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-base-content disabled:cursor-not-allowed disabled:opacity-50",
4
+ "peer flex items-center justify-center h-4 w-4 shrink-0 rounded-xs border focus-visible:border-base-content focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-base-content disabled:cursor-not-allowed disabled:opacity-50",
5
5
  {
6
6
  variants: {
7
7
  variant: {
8
8
  primary:
9
- "border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-content",
9
+ "border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-content focus-visible:ring-primary",
10
10
  secondary:
11
- "border-secondary data-[state=checked]:bg-secondary data-[state=checked]:text-secondary-content",
11
+ "border-secondary data-[state=checked]:bg-secondary data-[state=checked]:text-secondary-content focus-visible:ring-secondary",
12
12
  accent:
13
- "border-accent data-[state=checked]:bg-accent data-[state=checked]:text-accent-content",
13
+ "border-accent data-[state=checked]:bg-accent data-[state=checked]:text-accent-content focus-visible:ring-accent",
14
14
  success:
15
- "border-success data-[state=checked]:bg-success data-[state=checked]:text-success-content",
15
+ "border-success data-[state=checked]:bg-success data-[state=checked]:text-success-content focus-visible:ring-success",
16
16
  warning:
17
- "border-warning data-[state=checked]:bg-warning data-[state=checked]:text-warning-content",
18
- info: "border-info data-[state=checked]:bg-info data-[state=checked]:text-info-content",
19
- error: "border-error data-[state=checked]:bg-error data-[state=checked]:text-error-content",
17
+ "border-warning data-[state=checked]:bg-warning data-[state=checked]:text-warning-content focus-visible:ring-warning",
18
+ info: "border-info data-[state=checked]:bg-info data-[state=checked]:text-info-content focus-visible:ring-info",
19
+ error:
20
+ "border-error data-[state=checked]:bg-error data-[state=checked]:text-error-content focus-visible:ring-error",
20
21
  },
21
22
  size: {
22
23
  xs: "h-3 w-3",
@@ -3,7 +3,7 @@
3
3
  import { forwardRef, useCallback, useEffect, useState } from "react";
4
4
  import type { DatetimeInputProps, TimeString } from "./types";
5
5
  import { cn } from "../../../utilities";
6
- import { getDatetimeInputContainerClasses } from "./constants";
6
+ import { getInputCommonClasses } from "../Input/constants";
7
7
  import { DatetimeCalendar } from "./DatetimeCalendar";
8
8
  import { DatetimeInputContext } from "./DatetimeInputContext";
9
9
  import { getParsedTime, parseDateTime } from "./helpers";
@@ -67,7 +67,7 @@ export const DatetimeInput = forwardRef<HTMLInputElement, DatetimeInputProps>(
67
67
  <div className="flex items-center justify-center flex-nowrap">
68
68
  <div
69
69
  className={cn(
70
- getDatetimeInputContainerClasses({ outline, disabled, size, variant, wide }),
70
+ getInputCommonClasses({ outline, disabled, size, variant, wide }),
71
71
  className
72
72
  )}
73
73
  >
@@ -2,59 +2,6 @@ import { cva } from "../../../libs";
2
2
 
3
3
  export const DEFAULT_SIZE = 96;
4
4
 
5
- export const getDatetimeInputContainerClasses = cva(
6
- `h-10 flex items-center justify-between w-fit px-2 rounded-md transition-all gap-1
7
- [&:has(input:focus)]:duration-100 [&:has(input:focus)]:outline [&:has(input:focus)]:outline-2 [&:has(input:focus)]:outline-offset-2 [&:has(input:focus)]:outline-base-content/20
8
- [&:has(input:focus-within)]:duration-100 [&:has(input:focus-within)]:outline [&:has(input:focus-within)]:outline-2 [&:has(input:focus-within)]:outline-offset-2 [&:has(input:focus-within)]:outline-base-content/20
9
- `,
10
- {
11
- variants: {
12
- variant: {
13
- default: "border-0",
14
- accent: "border border-accent",
15
- error: "border border-error",
16
- ghost: "border border-ghost",
17
- info: "border border-info",
18
- primary: "border border-primary",
19
- secondary: "border border-secondary",
20
- success: "border border-success",
21
- warning: "border border-warning",
22
- },
23
- outline: {
24
- true: "border",
25
- },
26
- disabled: {
27
- true: "border-base-300",
28
- },
29
- wide: {
30
- true: "w-full",
31
- },
32
- size: {
33
- xs: "h-6 leading-relaxed text-xs px-1",
34
- sm: "h-8 leading-8 text-sm px-1",
35
- md: "h-12 leading-loose text-sm px-2",
36
- lg: "h-16 leading-loose text-lg px-3",
37
- },
38
- },
39
- compoundVariants: [
40
- {
41
- size: undefined,
42
- className: "min-h-fit h-10",
43
- },
44
- {
45
- variant: undefined,
46
- outline: true,
47
- className: "border-neutral-content",
48
- },
49
- {
50
- variant: "default",
51
- outline: true,
52
- className: "border-base-content",
53
- },
54
- ],
55
- }
56
- );
57
-
58
5
  export const getDatetimeCalendarTriggerClasses = cva(
59
6
  `size-8 rounded-md p-1 flex items-center justify-center font-normal
60
7
  outline-hidden focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-base-content focus-visible:ring-inset
@@ -1,10 +1,10 @@
1
1
  import { type VariantProps } from "../../../libs";
2
2
  import { type CalendarProps } from "../../Calendar/types";
3
+ import { getInputCommonClasses } from "../Input/constants";
3
4
  import { type InputProps } from "../Input/types";
4
- import { getDatetimeInputContainerClasses } from "./constants";
5
5
 
6
6
  type DisabledType = { disabled?: boolean };
7
- type VariantType = VariantProps<typeof getDatetimeInputContainerClasses>;
7
+ type VariantType = VariantProps<typeof getInputCommonClasses>;
8
8
  type NaturalLanguageInputType = DisabledType & {
9
9
  locale?: Intl.LocalesArgument;
10
10
  } & Omit<InputProps, "type" | "ref" | "value" | "defaultValue" | "onBlur" | "disabled">;
@@ -1,16 +1,77 @@
1
1
  import React from "react";
2
+ import { Slot } from "@radix-ui/react-slot";
3
+ import type { InputLabelProps, InputProps } from "./types";
2
4
  import { cn } from "../../../utilities";
3
- import { getInputClasses } from "./constants";
4
- import { type InputProps } from "./types";
5
+ import { getFloatingLabelClasses, getInputClasses, getInputLabelClasses } from "./constants";
6
+
7
+ const InputLabel = ({ floating, children, ...props }: InputLabelProps) => {
8
+ const SlotChild = ["string", "number", "boolean", "undefined"].includes(typeof children) ? (
9
+ <span>{children}</span>
10
+ ) : (
11
+ children
12
+ );
13
+
14
+ return (
15
+ <Slot className={cn(getInputLabelClasses({ floating }))} {...props}>
16
+ {SlotChild}
17
+ </Slot>
18
+ );
19
+ };
5
20
 
6
21
  export const Input = React.forwardRef<HTMLInputElement, InputProps>(
7
- ({ size, variant, wide, outline, className, type, ...props }: InputProps, ref) => (
8
- <input
9
- ref={ref}
10
- type={type}
11
- className={cn(getInputClasses({ type, size, wide, variant, outline }), className)}
12
- {...props}
13
- />
14
- )
22
+ (
23
+ {
24
+ id,
25
+ size,
26
+ label,
27
+ labelPosition = "start",
28
+ variant,
29
+ wide,
30
+ outline,
31
+ className,
32
+ type,
33
+ ...props
34
+ }: InputProps,
35
+ ref
36
+ ) => {
37
+ if (label) {
38
+ if (labelPosition === "floating") {
39
+ return (
40
+ <label htmlFor={id} className={getFloatingLabelClasses()}>
41
+ <InputLabel floating>{label}</InputLabel>
42
+ <input
43
+ id={id}
44
+ ref={ref}
45
+ type={type}
46
+ className={cn(getInputClasses({ type, size, wide, variant, outline }), className)}
47
+ {...props}
48
+ />
49
+ </label>
50
+ );
51
+ }
52
+
53
+ return (
54
+ <label
55
+ htmlFor={id}
56
+ className={cn(getInputClasses({ type, size, wide, variant, outline }), className)}
57
+ >
58
+ {labelPosition === "start" && <InputLabel>{label}</InputLabel>}
59
+ <input id={id} ref={ref} type={type} {...props} />
60
+ {labelPosition === "end" && <InputLabel>{label}</InputLabel>}
61
+ </label>
62
+ );
63
+ }
64
+
65
+ return (
66
+ <input
67
+ id={id}
68
+ ref={ref}
69
+ type={type}
70
+ className={cn(getInputClasses({ type, size, wide, variant, outline }), className)}
71
+ {...props}
72
+ />
73
+ );
74
+ }
15
75
  );
76
+
16
77
  Input.displayName = "Input";