@momo-webplatform/mobase 0.0.29 → 0.0.31
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/package.json +1 -1
- package/publish/cjs/components/Select/Select.js +3 -3
- package/publish/cjs/components/TextArea/TextArea.js +2 -2
- package/publish/cjs/components/TextInput/TextInput.js +2 -2
- package/publish/cjs/mobase-tw-plugin/animations/index.js +5 -0
- package/publish/cjs/mobase-tw-plugin/plugin.js +0 -9
- package/publish/cjs/tsconfig.lib.tsbuildinfo +1 -1
- package/publish/esm/components/Select/Select.d.ts +1 -1
- package/publish/esm/components/Select/Select.js +3 -3
- package/publish/esm/components/TextArea/TextArea.d.ts +1 -0
- package/publish/esm/components/TextArea/TextArea.js +2 -2
- package/publish/esm/components/TextInput/TextInput.d.ts +1 -0
- package/publish/esm/components/TextInput/TextInput.js +2 -2
- package/publish/esm/mobase-tw-plugin/animations/index.d.ts +9 -0
- package/publish/esm/mobase-tw-plugin/animations/index.js +5 -0
- package/publish/esm/mobase-tw-plugin/plugin.js +0 -9
- package/publish/esm/tsconfig.lib.tsbuildinfo +1 -1
|
@@ -4,7 +4,7 @@ declare const Select: React.ForwardRefExoticComponent<SelectPrimitive.SelectProp
|
|
|
4
4
|
className?: string | undefined;
|
|
5
5
|
label?: string | null | undefined;
|
|
6
6
|
message?: string | null | undefined;
|
|
7
|
-
size?:
|
|
7
|
+
size?: 2 | 1 | undefined;
|
|
8
8
|
isError?: boolean | undefined;
|
|
9
9
|
} & React.RefAttributes<never>>;
|
|
10
10
|
declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
@@ -7,11 +7,11 @@ import * as SelectPrimitive from "@radix-ui/react-select";
|
|
|
7
7
|
import { cn } from "../../helpers/utils";
|
|
8
8
|
const Select = React.forwardRef(({ className, children, label, message, size, isError, disabled, ...props }) => (_jsxs("div", { className: cn("select-mobase relative", className, disabled ? "disabled" : "", isError
|
|
9
9
|
? "[&>.select-mobase-button]:border-red-500 [&>.select-mobase-button]:ring-red-500 [&>.select-mobase-button]:ring-1"
|
|
10
|
-
: "", size ===
|
|
10
|
+
: "", size === 2
|
|
11
11
|
? "[&>.select-mobase-button]:text-base [&>.select-mobase-button]:h-12"
|
|
12
|
-
: ""), children: [label && (_jsx("span", { className: cn("mobase-select-label absolute bg-white -top-2 px-1.5 left-2 text-xs text-gray-500 z-[1]", size ===
|
|
12
|
+
: ""), children: [label && (_jsx("span", { className: cn("mobase-select-label absolute bg-white -top-2 px-1.5 left-2 text-xs text-gray-500 z-[1]", size === 2 && "text-sm -top-2.5", isError && "text-red-500"), children: label })), _jsx(SelectPrimitive.Root, { disabled: disabled, ...props, children: children }), message && (_jsxs("div", { className: cn("mobase-select-message flex space-x-1 items-center mt-1 text-gray-500", isError && "text-red-500"), children: [isError ? (_jsx(XCircleIcon, { width: 16, height: 16 })) : (_jsx(QuestionMarkCircleIcon, { width: 16, height: 16 })), _jsx("span", { className: cn(size === 2 ? "text-sm" : "text-xs"), children: message })] }))] })));
|
|
13
13
|
const SelectValue = SelectPrimitive.Value;
|
|
14
|
-
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn("select-mobase-button bg-white w-full ring-0 transition-all focus-visible:border-pink-500 focus-visible:ring-offset-0 focus-visible:ring-offset-transparent focus-visible:ring-1 focus-visible:!ring-pink-500 rounded border border-gray-400 data-[placeholder]:text-gray-500 p-3 disabled:bg-gray-50 disabled:border-gray-300
|
|
14
|
+
const SelectTrigger = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn("select-mobase-button bg-white w-full ring-0 transition-all focus-visible:border-pink-500 focus-visible:ring-offset-0 focus-visible:ring-offset-transparent focus-visible:ring-1 focus-visible:!ring-pink-500 rounded-md border border-gray-400 data-[placeholder]:text-gray-500 p-3 disabled:bg-gray-50 disabled:border-gray-300 disabled:pointer-events-none flex items-center justify-between data-[state=open]:border-pink-500 data-[state=open]:ring-1 hover:ring-1 hover:ring-gray-400 data-[state=open]:ring-pink-500 text-gray-900 h-11 ring-inset text-sm", className), ...props, children: [_jsx("div", { className: "line-clamp-1 text-left", children: children }), _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDownIcon, { className: "h-4 w-4 text-gray-700 flex-none" }) })] })));
|
|
15
15
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
16
16
|
const SelectScrollUpButton = React.forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn("flex cursor-default items-center justify-center py-1", className), ...props, children: _jsx(ChevronUpIcon, { className: "h-5 w-5" }) })));
|
|
17
17
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
|
@@ -4,5 +4,6 @@ export interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElemen
|
|
|
4
4
|
message?: string;
|
|
5
5
|
isError?: boolean;
|
|
6
6
|
inputClassName?: string;
|
|
7
|
+
size?: 1 | 2;
|
|
7
8
|
}
|
|
8
9
|
export declare const TextArea: import("react").ForwardRefExoticComponent<TextAreaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -3,8 +3,8 @@ import { forwardRef } from "react";
|
|
|
3
3
|
import { QuestionMarkCircleIcon } from "@heroicons/react/24/outline";
|
|
4
4
|
import { XCircleIcon } from "@heroicons/react/24/solid";
|
|
5
5
|
import { cn } from "../../helpers/utils";
|
|
6
|
-
export const TextArea = forwardRef(({ disabled, isError, message, label, className, inputClassName, rows = 3, ...restProps }, ref) => {
|
|
7
|
-
return (_jsxs("div", { className: cn("relative", className, isError && "mobase-text-area-error"), children: [label && (_jsx("span", { className: cn("mobase-text-area-label absolute bg-white -top-2.5 px-1.5 left-2 text-sm",
|
|
6
|
+
export const TextArea = forwardRef(({ disabled, isError, message, label, className, inputClassName, size, rows = 3, ...restProps }, ref) => {
|
|
7
|
+
return (_jsxs("div", { className: cn("relative", className, isError && "mobase-text-area-error"), children: [label && (_jsx("span", { className: cn("mobase-text-area-label absolute bg-white -top-2.5 px-1.5 left-2 text-sm text-gray-500", size === 2 && " -top-2.5 text-sm"), children: label })), _jsx("textarea", { disabled: disabled, ref: ref, className: cn("mobase-text-area-box bg-white w-full text-sm transition-all rounded-md border border-gray-400 placeholder:text-gray-500 p-3 text-gray-900 focus:border-pink-500 disabled:bg-gray-50 disabled:border-gray-300 outline-none block", size === 2 && "text-base", inputClassName), rows: rows, ...restProps }), message && (_jsxs("div", { className: "mobase-text-area-message flex space-x-1 items-center mt-0.5", children: [isError ? (_jsx(XCircleIcon, { width: 16, height: 16, className: "text-red-500" })) : (_jsx(QuestionMarkCircleIcon, { width: 16, height: 16, className: "text-gray-500" })), _jsx("span", { className: cn("text-gray-500 ", size === 2 ? "text-sm" : "text-xs"), children: message })] })), _jsx("style", { children: `
|
|
8
8
|
.mobase-text-area-box:hover {
|
|
9
9
|
box-shadow: 0px 0px 0px 1px rgb(var(--mobase-gray-400) / 1) inset;
|
|
10
10
|
}
|
|
@@ -5,6 +5,7 @@ export interface TextInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
|
5
5
|
isError?: boolean;
|
|
6
6
|
inputClassName?: string;
|
|
7
7
|
withClearButton?: boolean;
|
|
8
|
+
size?: 1 | 2;
|
|
8
9
|
onClickClear?: (inputValue: string) => void;
|
|
9
10
|
}
|
|
10
11
|
export declare const TextInput: import("react").ForwardRefExoticComponent<TextInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -3,7 +3,7 @@ import { forwardRef, useEffect, useRef, useState, } from "react";
|
|
|
3
3
|
import { QuestionMarkCircleIcon, XCircleIcon, } from "@heroicons/react/24/outline";
|
|
4
4
|
import { XCircleIcon as XCircleIconSolid } from "@heroicons/react/24/solid";
|
|
5
5
|
import { cn } from "../../helpers/utils";
|
|
6
|
-
export const TextInput = forwardRef(({ disabled, isError, message, label, className, inputClassName, withClearButton, onChange, onFocus, onClickClear, value, defaultValue, type = "text", ...restProps }, ref) => {
|
|
6
|
+
export const TextInput = forwardRef(({ disabled, isError, message, label, className, inputClassName, withClearButton, size, onChange, onFocus, onClickClear, value, defaultValue, type = "text", ...restProps }, ref) => {
|
|
7
7
|
const [clearable, setClearable] = useState(false);
|
|
8
8
|
const rootRef = useRef(null);
|
|
9
9
|
const handleShowClearButton = (inputValue) => {
|
|
@@ -36,7 +36,7 @@ export const TextInput = forwardRef(({ disabled, isError, message, label, classN
|
|
|
36
36
|
useEffect(() => {
|
|
37
37
|
handleShowClearButton(defaultValue || value);
|
|
38
38
|
}, [value, defaultValue]);
|
|
39
|
-
return (_jsxs("div", { className: cn(className, isError && "mobase-text-input-error"), ref: rootRef, children: [_jsxs("div", { className: "relative", children: [label && (_jsx("span", { className: cn("mobase-text-input-label absolute bg-white -top-2
|
|
39
|
+
return (_jsxs("div", { className: cn(className, isError && "mobase-text-input-error"), ref: rootRef, children: [_jsxs("div", { className: "relative", children: [label && (_jsx("span", { className: cn("mobase-text-input-label absolute bg-white -top-2 px-1.5 left-2 text-xs text-gray-500", size === 2 && " -top-2.5 text-sm"), children: label })), _jsx("input", { disabled: disabled, type: type, ref: ref, className: cn("mobase-text-input-box bg-white w-full transition-all text-sm rounded-md border border-gray-400 placeholder:text-gray-500 p-3 text-gray-900 h-11 focus:border-pink-500 disabled:bg-gray-50 disabled:border-gray-300 disabled:pointer-events-none block", size === 2 && "h-12 text-base", inputClassName), onChange: onChangeFactory, onFocus: onFocusFactory, value: value, defaultValue: defaultValue, ...restProps }), withClearButton && clearable && (_jsx("button", { "aria-label": "button", type: "button", className: "absolute right-3 top-1/2 -translate-y-1/2 shrink-0 cursor-pointer text-gray-500 duration-200 hover:opacity-70 disabled:pointer-events-none", disabled: disabled, onClick: handleClear, children: _jsx(XCircleIcon, { strokeWidth: 2, width: 20, height: 20 }) }))] }), message && (_jsxs("div", { className: "mobase-text-input-message flex space-x-1 items-center mt-0.5", children: [isError ? (_jsx(XCircleIconSolid, { width: 16, height: 16, className: "text-red-500" })) : (_jsx(QuestionMarkCircleIcon, { width: 16, height: 16, className: "text-gray-500" })), _jsx("span", { className: cn("text-gray-500 ", size === 2 ? "text-sm" : "text-xs"), children: message })] })), _jsx("style", { children: `
|
|
40
40
|
.mobase-text-input-box:hover {
|
|
41
41
|
box-shadow: 0px 0px 0px 1px rgb(var(--mobase-gray-400) / 1) inset;
|
|
42
42
|
}
|
|
@@ -3,6 +3,7 @@ export declare const animations: {
|
|
|
3
3
|
"accordion-down": string;
|
|
4
4
|
"accordion-up": string;
|
|
5
5
|
"spin-loading": string;
|
|
6
|
+
"fade-in": string;
|
|
6
7
|
};
|
|
7
8
|
keyframes: {
|
|
8
9
|
"accordion-down": {
|
|
@@ -21,5 +22,13 @@ export declare const animations: {
|
|
|
21
22
|
height: string;
|
|
22
23
|
};
|
|
23
24
|
};
|
|
25
|
+
"fade-in": {
|
|
26
|
+
"0%": {
|
|
27
|
+
opacity: string;
|
|
28
|
+
};
|
|
29
|
+
"100%": {
|
|
30
|
+
opacity: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
24
33
|
};
|
|
25
34
|
};
|
|
@@ -3,6 +3,7 @@ export const animations = {
|
|
|
3
3
|
"accordion-down": "accordion-down 0.2s ease-out",
|
|
4
4
|
"accordion-up": "accordion-up 0.2s ease-out",
|
|
5
5
|
"spin-loading": "spin 1s steps(12, end) infinite",
|
|
6
|
+
"fade-in": "fade-in 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both",
|
|
6
7
|
},
|
|
7
8
|
keyframes: {
|
|
8
9
|
"accordion-down": {
|
|
@@ -13,5 +14,9 @@ export const animations = {
|
|
|
13
14
|
from: { height: "var(--radix-accordion-content-height)" },
|
|
14
15
|
to: { height: "0" },
|
|
15
16
|
},
|
|
17
|
+
"fade-in": {
|
|
18
|
+
"0%": { opacity: "0" },
|
|
19
|
+
"100%": { opacity: "1" },
|
|
20
|
+
},
|
|
16
21
|
},
|
|
17
22
|
};
|
|
@@ -179,15 +179,6 @@ export const mobaseTW = () => {
|
|
|
179
179
|
...createSpacingUnits(prefix),
|
|
180
180
|
},
|
|
181
181
|
...animations,
|
|
182
|
-
keyframes: {
|
|
183
|
-
'fade-in': {
|
|
184
|
-
'0%': { opacity: "0" },
|
|
185
|
-
'100%': { opacity: "1" },
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
animation: {
|
|
189
|
-
'fade-in': 'fade-in 250ms cubic-bezier(0.25, 0.46, 0.45, 0.94) both',
|
|
190
|
-
},
|
|
191
182
|
},
|
|
192
183
|
},
|
|
193
184
|
});
|