@rovula/ui 0.0.42 → 0.0.44
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 +17 -1
- package/dist/cjs/bundle.js +2 -2
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/Dropdown/Dropdown.d.ts +4 -0
- package/dist/cjs/types/components/Dropdown/Dropdown.stories.d.ts +4 -0
- package/dist/cjs/types/components/Search/Search.stories.d.ts +2 -0
- package/dist/components/DatePicker/DatePicker.js +1 -1
- package/dist/components/Dropdown/Dropdown.js +10 -10
- package/dist/components/Dropdown/Dropdown.stories.js +4 -1
- package/dist/components/Toast/Toast.js +1 -1
- package/dist/components/Toast/useToast.js +2 -2
- package/dist/esm/bundle.css +17 -1
- package/dist/esm/bundle.js +2 -2
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/Dropdown/Dropdown.d.ts +4 -0
- package/dist/esm/types/components/Dropdown/Dropdown.stories.d.ts +4 -0
- package/dist/esm/types/components/Search/Search.stories.d.ts +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/src/theme/global.css +17 -1
- package/dist/theme/global.css +14 -1
- package/package.json +1 -1
- package/src/components/DatePicker/DatePicker.tsx +1 -1
- package/src/components/Dropdown/Dropdown.stories.tsx +12 -1
- package/src/components/Dropdown/Dropdown.tsx +28 -12
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/components/Toast/useToast.ts +2 -2
- package/src/theme/global.css +14 -1
|
@@ -26,6 +26,8 @@ export type DropdownProps = {
|
|
|
26
26
|
required?: boolean;
|
|
27
27
|
className?: string;
|
|
28
28
|
optionContainerClassName?: string;
|
|
29
|
+
optionItemClassName?: string;
|
|
30
|
+
optionNotFoundItemClassName?: string;
|
|
29
31
|
options: Options[];
|
|
30
32
|
value?: Options;
|
|
31
33
|
onChangeText?: InputProps["onChange"];
|
|
@@ -51,6 +53,8 @@ declare const Dropdown: React.ForwardRefExoticComponent<{
|
|
|
51
53
|
required?: boolean | undefined;
|
|
52
54
|
className?: string | undefined;
|
|
53
55
|
optionContainerClassName?: string | undefined;
|
|
56
|
+
optionItemClassName?: string | undefined;
|
|
57
|
+
optionNotFoundItemClassName?: string | undefined;
|
|
54
58
|
options: Options[];
|
|
55
59
|
value?: Options | undefined;
|
|
56
60
|
onChangeText?: InputProps["onChange"];
|
|
@@ -17,6 +17,8 @@ declare const meta: {
|
|
|
17
17
|
required?: boolean | undefined;
|
|
18
18
|
className?: string | undefined;
|
|
19
19
|
optionContainerClassName?: string | undefined;
|
|
20
|
+
optionItemClassName?: string | undefined;
|
|
21
|
+
optionNotFoundItemClassName?: string | undefined;
|
|
20
22
|
options: Options[];
|
|
21
23
|
value?: Options | undefined;
|
|
22
24
|
onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
|
|
@@ -46,6 +48,8 @@ declare const meta: {
|
|
|
46
48
|
required?: boolean | undefined;
|
|
47
49
|
className?: string | undefined;
|
|
48
50
|
optionContainerClassName?: string | undefined;
|
|
51
|
+
optionItemClassName?: string | undefined;
|
|
52
|
+
optionNotFoundItemClassName?: string | undefined;
|
|
49
53
|
options: Options[];
|
|
50
54
|
value?: Options | undefined;
|
|
51
55
|
onChangeText?: React.ChangeEventHandler<HTMLInputElement> | undefined;
|
|
@@ -324,6 +324,8 @@ declare const meta: {
|
|
|
324
324
|
onClick: (option: Options) => void;
|
|
325
325
|
}) => React.ReactNode) | undefined;
|
|
326
326
|
optionContainerClassName?: string | undefined;
|
|
327
|
+
optionItemClassName?: string | undefined;
|
|
328
|
+
optionNotFoundItemClassName?: string | undefined;
|
|
327
329
|
ref?: React.LegacyRef<HTMLInputElement> | undefined;
|
|
328
330
|
key?: React.Key | null | undefined;
|
|
329
331
|
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
@@ -20,7 +20,7 @@ import { format } from "date-fns/format";
|
|
|
20
20
|
const DatePicker = (_a) => {
|
|
21
21
|
var { date, onSelect, textInputProps, popoverContentProps } = _a, props = __rest(_a, ["date", "onSelect", "textInputProps", "popoverContentProps"]);
|
|
22
22
|
const [isOpen, setIsOpen] = useState(false);
|
|
23
|
-
return (_jsx("div", { children: _jsxs(Popover, { open: isOpen, onOpenChange: setIsOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("div", { className: "flex", children: _jsx(TextInput, Object.assign({ fullwidth: true, id: "2" // TODO
|
|
23
|
+
return (_jsx("div", { children: _jsxs(Popover, { modal: true, open: isOpen, onOpenChange: setIsOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("div", { className: "flex", children: _jsx(TextInput, Object.assign({ fullwidth: true, id: "2" // TODO
|
|
24
24
|
, readOnly: true, label: "Date", size: "md", value: date ? format(date, "dd MMM yyyy") : isOpen ? " " : "", hasClearIcon: false, endIcon: _jsx(CalendarIcon, { fill: "inherit", className: "cursor-pointer" }) }, textInputProps)) }) }), _jsx(PopoverContent, Object.assign({ className: "w-auto p-0 z-[100]" }, popoverContentProps, { children: _jsx(Calendar, Object.assign({ defaultMonth: date }, props, { mode: "single", selected: date, onSelect: (...value) => {
|
|
25
25
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(...value);
|
|
26
26
|
setIsOpen(false);
|
|
@@ -16,9 +16,9 @@ import { customInputVariant, dropdownIconVariant, iconWrapperVariant, } from "./
|
|
|
16
16
|
import { ChevronDownIcon } from "@heroicons/react/16/solid";
|
|
17
17
|
import { cn } from "@/utils/cn";
|
|
18
18
|
const Dropdown = forwardRef((_a, ref) => {
|
|
19
|
-
var { id, options = [], value, label, size = "md", rounded = "normal", variant = "outline", helperText, errorMessage, fullwidth = true, disabled = false, error = false, filterMode = false, required = true, onChangeText, onSelect, renderOptions: customRenderOptions, optionContainerClassName } = _a, props = __rest(_a, ["id", "options", "value", "label", "size", "rounded", "variant", "helperText", "errorMessage", "fullwidth", "disabled", "error", "filterMode", "required", "onChangeText", "onSelect", "renderOptions", "optionContainerClassName"]);
|
|
19
|
+
var { id, options = [], value, label, size = "md", rounded = "normal", variant = "outline", helperText, errorMessage, fullwidth = true, disabled = false, error = false, filterMode = false, required = true, onChangeText, onSelect, renderOptions: customRenderOptions, optionContainerClassName, optionItemClassName, optionNotFoundItemClassName } = _a, props = __rest(_a, ["id", "options", "value", "label", "size", "rounded", "variant", "helperText", "errorMessage", "fullwidth", "disabled", "error", "filterMode", "required", "onChangeText", "onSelect", "renderOptions", "optionContainerClassName", "optionItemClassName", "optionNotFoundItemClassName"]);
|
|
20
20
|
const _id = id || `${label}-select`;
|
|
21
|
-
const [isFocused, setIsFocused] = useState(
|
|
21
|
+
const [isFocused, setIsFocused] = useState(true);
|
|
22
22
|
const [selectedOption, setSelectedOption] = useState(null);
|
|
23
23
|
const [textValue, setTextValue] = useState("");
|
|
24
24
|
const keyCode = useRef("");
|
|
@@ -60,15 +60,15 @@ const Dropdown = forwardRef((_a, ref) => {
|
|
|
60
60
|
value: option.value,
|
|
61
61
|
label: option.label,
|
|
62
62
|
handleOnClick: () => handleOptionClick(option),
|
|
63
|
-
className: `px-4 py-2 hover:bg-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
className: cn(`px-4 py-2 hover:bg-primary-hover-bg cursor-pointer`, optionItemClassName, {
|
|
64
|
+
"bg-base-popup-highligh": (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value,
|
|
65
|
+
}),
|
|
66
66
|
}) }, option.value));
|
|
67
67
|
}
|
|
68
|
-
return (_jsx("li", { onMouseDown: () => handleOptionClick(option), className: `px-4 py-2 hover:bg-primary-hover-bg cursor-pointer
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}), optionsFiltered.length === 0 && (_jsx("li", { className: "px-4 py-14 text-center text-input-text", children: "Not found" }))] }));
|
|
68
|
+
return (_jsx("li", { onMouseDown: () => handleOptionClick(option), className: cn(`px-4 py-2 hover:bg-primary-hover-bg cursor-pointer`, optionItemClassName, {
|
|
69
|
+
"bg-base-popup-highligh": (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value,
|
|
70
|
+
}), children: option.label }, option.value));
|
|
71
|
+
}), optionsFiltered.length === 0 && (_jsx("li", { className: cn("px-4 py-14 text-center text-input-text", optionNotFoundItemClassName), children: "Not found" }))] }));
|
|
72
72
|
};
|
|
73
73
|
const handleOnFocus = useCallback((e) => {
|
|
74
74
|
var _a;
|
|
@@ -106,6 +106,6 @@ const Dropdown = forwardRef((_a, ref) => {
|
|
|
106
106
|
keyCode.current = e.code;
|
|
107
107
|
(_a = props === null || props === void 0 ? void 0 : props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
108
108
|
}, [props === null || props === void 0 ? void 0 : props.onKeyDown]);
|
|
109
|
-
return (_jsxs("div", { className: `relative ${fullwidth ? "w-full" : ""}`, children: [_jsx(TextInput, Object.assign({ hasClearIcon: false, endIcon: _jsx("div", { className: iconWrapperVariant({ size }), children: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ size, isFocus: isFocused }) }) }) }, props, { ref: ref, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: customInputVariant({ size }), onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: handleOnKeyDown })), isFocused && renderOptions()] }));
|
|
109
|
+
return (_jsxs("div", { className: `relative ${fullwidth ? "w-full" : ""}`, children: [_jsx(TextInput, Object.assign({ hasClearIcon: false, endIcon: _jsx("div", { className: iconWrapperVariant({ size }), children: _jsx(ChevronDownIcon, { className: dropdownIconVariant({ size, isFocus: isFocused }) }) }) }, props, { ref: ref, readOnly: !filterMode, value: textValue, onChange: handleOnChangeText, label: label, placeholder: " ", type: "text", autoComplete: "off", rounded: rounded, variant: variant, helperText: helperText, errorMessage: errorMessage, fullwidth: fullwidth, error: error, required: required, id: _id, disabled: disabled, size: size, className: customInputVariant({ size }), onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: handleOnKeyDown })), isFocused && renderOptions()] }));
|
|
110
110
|
});
|
|
111
111
|
export default Dropdown;
|
|
@@ -93,6 +93,9 @@ export const CustomOption = {
|
|
|
93
93
|
render: (args) => {
|
|
94
94
|
console.log("args ", args);
|
|
95
95
|
const props = Object.assign({}, args);
|
|
96
|
-
|
|
96
|
+
const onChangeText = (e) => {
|
|
97
|
+
console.log("aaa ", e);
|
|
98
|
+
};
|
|
99
|
+
return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(Dropdown, Object.assign({ id: "1", size: "lg", options: options }, args, { onChangeText: onChangeText })) }));
|
|
97
100
|
},
|
|
98
101
|
};
|
|
@@ -46,7 +46,7 @@ const ToastTitle = React.forwardRef((_a, ref) => {
|
|
|
46
46
|
ToastTitle.displayName = ToastPrimitives.Title.displayName;
|
|
47
47
|
const ToastDescription = React.forwardRef((_a, ref) => {
|
|
48
48
|
var { className } = _a, props = __rest(_a, ["className"]);
|
|
49
|
-
return (_jsx(ToastPrimitives.Description, Object.assign({ ref: ref, className: cn("typography-subtitile5 text-
|
|
49
|
+
return (_jsx(ToastPrimitives.Description, Object.assign({ ref: ref, className: cn("typography-subtitile5 text-input-default-tex", className) }, props)));
|
|
50
50
|
});
|
|
51
51
|
ToastDescription.displayName = ToastPrimitives.Description.displayName;
|
|
52
52
|
export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
|
|
@@ -13,7 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
13
13
|
// Inspired by react-hot-toast library
|
|
14
14
|
import * as React from "react";
|
|
15
15
|
const TOAST_LIMIT = 1;
|
|
16
|
-
const TOAST_REMOVE_DELAY =
|
|
16
|
+
const TOAST_REMOVE_DELAY = 3000;
|
|
17
17
|
const actionTypes = {
|
|
18
18
|
ADD_TOAST: "ADD_TOAST",
|
|
19
19
|
UPDATE_TOAST: "UPDATE_TOAST",
|
|
@@ -37,7 +37,7 @@ const addToRemoveQueue = (toastId) => {
|
|
|
37
37
|
type: "REMOVE_TOAST",
|
|
38
38
|
toastId: toastId,
|
|
39
39
|
});
|
|
40
|
-
}, TOAST_REMOVE_DELAY);
|
|
40
|
+
}, TOAST_REMOVE_DELAY); // TODO
|
|
41
41
|
toastTimeouts.set(toastId, timeout);
|
|
42
42
|
};
|
|
43
43
|
export const reducer = (state, action) => {
|
package/dist/esm/bundle.css
CHANGED
|
@@ -412,6 +412,22 @@ body {
|
|
|
412
412
|
/* @apply bg-[var(--backgroud)] text-[var(--foreground)]; */
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
+
/* hide input number arrow */
|
|
416
|
+
|
|
417
|
+
/* Chrome, Safari, Edge, Opera */
|
|
418
|
+
|
|
419
|
+
input::-webkit-outer-spin-button,
|
|
420
|
+
input::-webkit-inner-spin-button {
|
|
421
|
+
-webkit-appearance: none;
|
|
422
|
+
margin: 0;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/* Firefox */
|
|
426
|
+
|
|
427
|
+
input[type=number] {
|
|
428
|
+
-moz-appearance: textfield;
|
|
429
|
+
}
|
|
430
|
+
|
|
415
431
|
*, ::before, ::after{
|
|
416
432
|
--tw-border-spacing-x: 0;
|
|
417
433
|
--tw-border-spacing-y: 0;
|
|
@@ -5617,4 +5633,4 @@ body {
|
|
|
5617
5633
|
}
|
|
5618
5634
|
.\[\&_tr\]\:border-b tr{
|
|
5619
5635
|
border-bottom-width: 1px;
|
|
5620
|
-
}
|
|
5636
|
+
}
|