@rovula/ui 0.0.17 → 0.0.18
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/dist/cjs/bundle.css +152 -0
- package/dist/cjs/bundle.js +3 -3
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/AlertDialog/Alert.stories.d.ts +1 -1
- package/dist/cjs/types/components/Calendar/Calendar.d.ts +8 -0
- package/dist/cjs/types/components/Calendar/Calendar.stories.d.ts +272 -0
- package/dist/cjs/types/components/Calendar/index.d.ts +1 -0
- package/dist/cjs/types/components/DatePicker/DatePicker.d.ts +8 -0
- package/dist/cjs/types/components/DatePicker/DatePicker.stories.d.ts +21 -0
- package/dist/cjs/types/components/Popover/Popover.d.ts +6 -0
- package/dist/cjs/types/components/Popover/Popover.stories.d.ts +21 -0
- package/dist/cjs/types/components/TextInput/TextInput.stories.d.ts +7 -0
- package/dist/cjs/types/components/TextInput/TextInput.styles.d.ts +5 -0
- package/dist/cjs/types/index.d.ts +3 -0
- package/dist/components/Calendar/Calendar.js +43 -0
- package/dist/components/Calendar/Calendar.stories.js +36 -0
- package/dist/components/Calendar/index.js +1 -0
- package/dist/components/DatePicker/DatePicker.js +22 -0
- package/dist/components/DatePicker/DatePicker.stories.js +36 -0
- package/dist/components/Popover/Popover.js +35 -0
- package/dist/components/Popover/Popover.stories.js +33 -0
- package/dist/components/TextInput/TextInput.js +9 -3
- package/dist/components/TextInput/TextInput.stories.js +12 -0
- package/dist/components/TextInput/TextInput.styles.js +41 -0
- package/dist/esm/bundle.css +152 -0
- package/dist/esm/bundle.js +3 -3
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/AlertDialog/Alert.stories.d.ts +1 -1
- package/dist/esm/types/components/Calendar/Calendar.d.ts +8 -0
- package/dist/esm/types/components/Calendar/Calendar.stories.d.ts +272 -0
- package/dist/esm/types/components/Calendar/index.d.ts +1 -0
- package/dist/esm/types/components/DatePicker/DatePicker.d.ts +8 -0
- package/dist/esm/types/components/DatePicker/DatePicker.stories.d.ts +21 -0
- package/dist/esm/types/components/Popover/Popover.d.ts +6 -0
- package/dist/esm/types/components/Popover/Popover.stories.d.ts +21 -0
- package/dist/esm/types/components/TextInput/TextInput.stories.d.ts +7 -0
- package/dist/esm/types/components/TextInput/TextInput.styles.d.ts +5 -0
- package/dist/esm/types/index.d.ts +3 -0
- package/dist/index.d.ts +19 -1
- package/dist/index.js +3 -0
- package/dist/src/theme/global.css +192 -0
- package/package.json +5 -2
- package/src/components/Calendar/Calendar.stories.tsx +45 -0
- package/src/components/Calendar/Calendar.tsx +66 -0
- package/src/components/Calendar/index.ts +1 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +40 -0
- package/src/components/DatePicker/DatePicker.tsx +57 -0
- package/src/components/Popover/Popover.stories.tsx +40 -0
- package/src/components/Popover/Popover.tsx +31 -0
- package/src/components/TextInput/TextInput.stories.tsx +36 -0
- package/src/components/TextInput/TextInput.styles.ts +45 -0
- package/src/components/TextInput/TextInput.tsx +13 -3
- package/src/index.ts +7 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/utils/cn";
|
|
7
|
+
|
|
8
|
+
const Popover = PopoverPrimitive.Root;
|
|
9
|
+
|
|
10
|
+
const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
11
|
+
|
|
12
|
+
const PopoverContent = React.forwardRef<
|
|
13
|
+
React.ElementRef<typeof PopoverPrimitive.Content>,
|
|
14
|
+
React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
|
|
15
|
+
>(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
|
|
16
|
+
<PopoverPrimitive.Portal>
|
|
17
|
+
<PopoverPrimitive.Content
|
|
18
|
+
ref={ref}
|
|
19
|
+
align={align}
|
|
20
|
+
sideOffset={sideOffset}
|
|
21
|
+
className={cn(
|
|
22
|
+
"z-50 w-72 rounded-md border bg-popup-background p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
</PopoverPrimitive.Portal>
|
|
28
|
+
));
|
|
29
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
30
|
+
|
|
31
|
+
export { Popover, PopoverTrigger, PopoverContent };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useRef } from "react";
|
|
2
2
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
3
|
import TextInput from "./TextInput";
|
|
4
|
+
import { CalendarIcon } from "@heroicons/react/16/solid";
|
|
4
5
|
|
|
5
6
|
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
|
|
6
7
|
const meta = {
|
|
@@ -87,3 +88,38 @@ export const CustomLabel = {
|
|
|
87
88
|
);
|
|
88
89
|
},
|
|
89
90
|
} satisfies StoryObj;
|
|
91
|
+
|
|
92
|
+
export const FuctionInput = {
|
|
93
|
+
args: {
|
|
94
|
+
label: "Placeholder Text",
|
|
95
|
+
disabled: false,
|
|
96
|
+
},
|
|
97
|
+
render: (args) => {
|
|
98
|
+
console.log("args ", args);
|
|
99
|
+
const props: typeof args = {
|
|
100
|
+
...args,
|
|
101
|
+
};
|
|
102
|
+
return (
|
|
103
|
+
<div className="flex flex-row gap-4 w-full">
|
|
104
|
+
<TextInput
|
|
105
|
+
id="1"
|
|
106
|
+
size="lg"
|
|
107
|
+
{...args}
|
|
108
|
+
endIcon={<CalendarIcon className="size-full" fill="inherit" />}
|
|
109
|
+
/>
|
|
110
|
+
<TextInput
|
|
111
|
+
id="2"
|
|
112
|
+
size="md"
|
|
113
|
+
{...args}
|
|
114
|
+
endIcon={<CalendarIcon className="size-full" fill="inherit" />}
|
|
115
|
+
/>
|
|
116
|
+
<TextInput
|
|
117
|
+
id="3"
|
|
118
|
+
size="sm"
|
|
119
|
+
{...args}
|
|
120
|
+
endIcon={<CalendarIcon className="size-full" fill="inherit" />}
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
);
|
|
124
|
+
},
|
|
125
|
+
} satisfies StoryObj;
|
|
@@ -37,6 +37,9 @@ export const inputVariant = cva(
|
|
|
37
37
|
hasClearIcon: {
|
|
38
38
|
true: "",
|
|
39
39
|
},
|
|
40
|
+
rightSectionIcon: {
|
|
41
|
+
false: "",
|
|
42
|
+
},
|
|
40
43
|
},
|
|
41
44
|
compoundVariants: [
|
|
42
45
|
{
|
|
@@ -58,6 +61,21 @@ export const inputVariant = cva(
|
|
|
58
61
|
size: "lg",
|
|
59
62
|
class: "focus:pe-10",
|
|
60
63
|
},
|
|
64
|
+
{
|
|
65
|
+
rightSectionIcon: true,
|
|
66
|
+
size: "sm",
|
|
67
|
+
class: "pe-[38px]",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
rightSectionIcon: true,
|
|
71
|
+
size: "md",
|
|
72
|
+
class: "pe-[46px]",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
rightSectionIcon: true,
|
|
76
|
+
size: "lg",
|
|
77
|
+
class: "pe-[72px]",
|
|
78
|
+
},
|
|
61
79
|
],
|
|
62
80
|
defaultVariants: {
|
|
63
81
|
size: "md",
|
|
@@ -67,6 +85,7 @@ export const inputVariant = cva(
|
|
|
67
85
|
disabled: false,
|
|
68
86
|
error: false,
|
|
69
87
|
hasClearIcon: false,
|
|
88
|
+
rightSectionIcon: false,
|
|
70
89
|
},
|
|
71
90
|
}
|
|
72
91
|
);
|
|
@@ -167,3 +186,29 @@ export const iconVariant = cva(
|
|
|
167
186
|
},
|
|
168
187
|
}
|
|
169
188
|
);
|
|
189
|
+
|
|
190
|
+
export const sectionIconWrapperVariant = cva(
|
|
191
|
+
[
|
|
192
|
+
"absolute inset-y-0 right-0 items-center justify-center flex",
|
|
193
|
+
"border-l border-l-input-stroke peer-hover:border-l-input-active peer-focus:border-l-input-stroke-active peer-disabled:border-l-input-stroke-disabled",
|
|
194
|
+
"fill-input-text peer-hover:fill-input-text-active peer-focus:fill-input-text-active",
|
|
195
|
+
],
|
|
196
|
+
{
|
|
197
|
+
variants: {
|
|
198
|
+
size: {
|
|
199
|
+
sm: "p-1 size-[30px]",
|
|
200
|
+
md: "p-2 size-[38px]",
|
|
201
|
+
lg: "p-3 size-14",
|
|
202
|
+
},
|
|
203
|
+
rounded: {
|
|
204
|
+
none: "rounded-r-none",
|
|
205
|
+
normal: "rounded-r-xl",
|
|
206
|
+
full: "rounded-r-full",
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
defaultVariants: {
|
|
210
|
+
size: "md",
|
|
211
|
+
rounded: "normal",
|
|
212
|
+
},
|
|
213
|
+
}
|
|
214
|
+
);
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
iconWrapperVariant,
|
|
12
12
|
inputVariant,
|
|
13
13
|
labelVariant,
|
|
14
|
+
sectionIconWrapperVariant,
|
|
14
15
|
} from "./TextInput.styles";
|
|
15
16
|
import { XCircleIcon, ExclamationCircleIcon } from "@heroicons/react/16/solid";
|
|
16
17
|
import { cn } from "@/utils/cn";
|
|
@@ -58,6 +59,7 @@ export const TextInput = forwardRef<HTMLInputElement, InputProps>(
|
|
|
58
59
|
) => {
|
|
59
60
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
60
61
|
const _id = id || `${type}-${label}-input`;
|
|
62
|
+
const hasRightSectionIcon = !!endIcon;
|
|
61
63
|
const inputClassname = inputVariant({
|
|
62
64
|
size,
|
|
63
65
|
rounded,
|
|
@@ -65,7 +67,8 @@ export const TextInput = forwardRef<HTMLInputElement, InputProps>(
|
|
|
65
67
|
fullwidth,
|
|
66
68
|
disabled,
|
|
67
69
|
error,
|
|
68
|
-
hasClearIcon,
|
|
70
|
+
hasClearIcon: hasRightSectionIcon ? false : hasClearIcon,
|
|
71
|
+
rightSectionIcon: hasRightSectionIcon,
|
|
69
72
|
});
|
|
70
73
|
const labelClassname = labelVariant({
|
|
71
74
|
size,
|
|
@@ -75,6 +78,10 @@ export const TextInput = forwardRef<HTMLInputElement, InputProps>(
|
|
|
75
78
|
const helperTextClassname = helperTextVariant({ size, error, disabled });
|
|
76
79
|
const iconWrapperClassname = iconWrapperVariant({ size });
|
|
77
80
|
const iconClassname = iconVariant({ size });
|
|
81
|
+
const sectionIconWrapperClassname = sectionIconWrapperVariant({
|
|
82
|
+
size,
|
|
83
|
+
rounded,
|
|
84
|
+
});
|
|
78
85
|
|
|
79
86
|
useImperativeHandle(ref, () => inputRef?.current as HTMLInputElement);
|
|
80
87
|
|
|
@@ -96,7 +103,7 @@ export const TextInput = forwardRef<HTMLInputElement, InputProps>(
|
|
|
96
103
|
disabled={disabled}
|
|
97
104
|
className={cn(inputClassname, props.className)}
|
|
98
105
|
/>
|
|
99
|
-
{hasClearIcon && (
|
|
106
|
+
{hasClearIcon && !hasRightSectionIcon && (
|
|
100
107
|
<div className={iconWrapperClassname}>
|
|
101
108
|
<XCircleIcon
|
|
102
109
|
type="button"
|
|
@@ -105,7 +112,10 @@ export const TextInput = forwardRef<HTMLInputElement, InputProps>(
|
|
|
105
112
|
/>
|
|
106
113
|
</div>
|
|
107
114
|
)}
|
|
108
|
-
{
|
|
115
|
+
{hasRightSectionIcon && (
|
|
116
|
+
<div className={sectionIconWrapperClassname}>{endIcon}</div>
|
|
117
|
+
)}
|
|
118
|
+
|
|
109
119
|
<label htmlFor={_id} className={cn(labelClassname, labelClassName)}>
|
|
110
120
|
{label} {required && <span className="text-error">*</span>}
|
|
111
121
|
</label>
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,13 @@ export { Navbar } from "./components/Navbar";
|
|
|
13
13
|
export { default as ActionButton } from "./components/ActionButton/ActionButton";
|
|
14
14
|
export { Avatar, AvatarGroup } from "./components/Avatar";
|
|
15
15
|
export { Collapsible } from "./components/Collapsible";
|
|
16
|
+
export { Calendar } from "./components/Calendar";
|
|
17
|
+
export { default as DatePicker } from "./components/DatePicker/DatePicker";
|
|
18
|
+
export {
|
|
19
|
+
Popover,
|
|
20
|
+
PopoverTrigger,
|
|
21
|
+
PopoverContent,
|
|
22
|
+
} from "./components/Popover/Popover";
|
|
16
23
|
export * from "./components/Table/Table";
|
|
17
24
|
export * from "./components/DataTable/DataTable";
|
|
18
25
|
export * from "./components/Dialog/Dialog";
|