@rovula/ui 0.0.43 → 0.0.45

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.
@@ -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)[];
@@ -16,7 +16,7 @@ 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
21
  const [isFocused, setIsFocused] = useState(false);
22
22
  const [selectedOption, setSelectedOption] = useState(null);
@@ -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-gray-100 cursor-pointer ${(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value
64
- ? " bg-gray-200"
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 ${(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.value) === option.value
69
- ? "bg-base-popup-highligh"
70
- : ""}`, children: option.label }, option.value));
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
- return (_jsx("div", { className: "flex flex-row gap-4 w-full", children: _jsx(DropdownWithRef, Object.assign({ id: "1", size: "lg", options: options }, args)) }));
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-text-grey-dark", className) }, props)));
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 = 6000;
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) => {
@@ -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
+ }