@next-degree/pickle-shared-js 0.3.23 → 0.3.24
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/app/layout.css +84 -0
- package/dist/app/layout.css.map +1 -1
- package/dist/app/page.cjs +121 -6
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +121 -6
- package/dist/app/page.js.map +1 -1
- package/dist/components/demos/InputDemo.cjs +175 -0
- package/dist/components/demos/InputDemo.cjs.map +1 -0
- package/dist/components/demos/InputDemo.d.cts +5 -0
- package/dist/components/demos/InputDemo.d.ts +5 -0
- package/dist/components/demos/InputDemo.js +152 -0
- package/dist/components/demos/InputDemo.js.map +1 -0
- package/dist/components/demos/index.cjs +119 -4
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +119 -4
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/ui/Input.cjs +159 -0
- package/dist/components/ui/Input.cjs.map +1 -0
- package/dist/components/ui/Input.d.cts +22 -0
- package/dist/components/ui/Input.d.ts +22 -0
- package/dist/components/ui/Input.js +138 -0
- package/dist/components/ui/Input.js.map +1 -0
- package/dist/index.cjs +169 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +164 -63
- package/dist/index.js.map +1 -1
- package/dist/styles/globals.css +84 -0
- package/dist/styles/globals.css.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// src/components/ui/Input.tsx
|
|
2
|
+
import { cva } from "cva";
|
|
3
|
+
import { icons, X } from "lucide-react";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
|
|
6
|
+
// src/lib/utils.ts
|
|
7
|
+
import { clsx } from "clsx";
|
|
8
|
+
import { twMerge } from "tailwind-merge";
|
|
9
|
+
function cn(...inputs) {
|
|
10
|
+
return twMerge(clsx(inputs));
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// src/components/ui/ErrorMessage.tsx
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
function ErrorMessage({ message, className, ...props }) {
|
|
16
|
+
if (!message) return null;
|
|
17
|
+
return /* @__PURE__ */ jsx("p", { className: cn("px-1 text-xs text-red-600", className), ...props, children: message });
|
|
18
|
+
}
|
|
19
|
+
var ErrorMessage_default = ErrorMessage;
|
|
20
|
+
|
|
21
|
+
// src/components/ui/Label.tsx
|
|
22
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
23
|
+
function Label({ text, className, ...props }) {
|
|
24
|
+
if (!text) return null;
|
|
25
|
+
return /* @__PURE__ */ jsx2(
|
|
26
|
+
"label",
|
|
27
|
+
{
|
|
28
|
+
className: cn(
|
|
29
|
+
"text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
...props,
|
|
33
|
+
children: text
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
var Label_default = Label;
|
|
38
|
+
|
|
39
|
+
// src/components/ui/Input.tsx
|
|
40
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
41
|
+
var Input = forwardRef(
|
|
42
|
+
({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
|
|
43
|
+
const handleClear = () => {
|
|
44
|
+
onChange?.({ target: { value: "" } });
|
|
45
|
+
onClear?.();
|
|
46
|
+
};
|
|
47
|
+
const IconComponent = icon && icons[icon];
|
|
48
|
+
const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
|
|
49
|
+
const hasIcon = !!icon;
|
|
50
|
+
const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
|
|
51
|
+
return /* @__PURE__ */ jsxs("div", { className: "group flex w-full flex-col", "data-testid": `input-wrapper-${props.id}`, children: [
|
|
52
|
+
label && /* @__PURE__ */ jsx3(Label_default, { text: label, htmlFor: props.name, className: cn("body mb-1", classNames?.label) }),
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex flex-row items-center", children: [
|
|
54
|
+
IconComponent && /* @__PURE__ */ jsx3(
|
|
55
|
+
IconComponent,
|
|
56
|
+
{
|
|
57
|
+
className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ jsx3(
|
|
61
|
+
"input",
|
|
62
|
+
{
|
|
63
|
+
className: cn(inputVariants({ theme, hasIcon })),
|
|
64
|
+
ref,
|
|
65
|
+
placeholder,
|
|
66
|
+
value,
|
|
67
|
+
onChange,
|
|
68
|
+
"data-testid": `input-element-${props.id}`,
|
|
69
|
+
...props
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
hasIcon && value && /* @__PURE__ */ jsx3(
|
|
73
|
+
X,
|
|
74
|
+
{
|
|
75
|
+
className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
|
|
76
|
+
onClick: handleClear,
|
|
77
|
+
"data-testid": "clear-button"
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ jsx3(ErrorMessage_default, { message: error, className: "mt-1" })
|
|
82
|
+
] });
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
Input.displayName = "Input";
|
|
86
|
+
var inputVariants = cva(
|
|
87
|
+
[
|
|
88
|
+
"border-input",
|
|
89
|
+
"placeholder:text-muted-foreground",
|
|
90
|
+
"focus-visible:ring-ring",
|
|
91
|
+
"inline-flex",
|
|
92
|
+
"w-full",
|
|
93
|
+
"h-11",
|
|
94
|
+
"items-center",
|
|
95
|
+
"justify-start",
|
|
96
|
+
"gap-3",
|
|
97
|
+
"rounded-lg",
|
|
98
|
+
"bg-transparent",
|
|
99
|
+
"px-3",
|
|
100
|
+
"pt-0.5",
|
|
101
|
+
"text-sm",
|
|
102
|
+
"shadow-sm",
|
|
103
|
+
"ring-grey-50",
|
|
104
|
+
"transition-colors",
|
|
105
|
+
"focus-visible:outline-none",
|
|
106
|
+
"focus-visible:ring-1",
|
|
107
|
+
"disabled:cursor-not-allowed",
|
|
108
|
+
"disabled:opacity-50",
|
|
109
|
+
"appearance-none",
|
|
110
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
111
|
+
"[&::-webkit-search-decoration]:appearance-none",
|
|
112
|
+
"[&::-webkit-search-results-button]:appearance-none",
|
|
113
|
+
"[&::-webkit-search-results-decoration]:appearance-none",
|
|
114
|
+
"[&::-ms-clear]:display-none",
|
|
115
|
+
"[&::-ms-reveal]:display-none"
|
|
116
|
+
],
|
|
117
|
+
{
|
|
118
|
+
variants: {
|
|
119
|
+
theme: {
|
|
120
|
+
light: "text-grey-80 border",
|
|
121
|
+
dark: "text-white"
|
|
122
|
+
},
|
|
123
|
+
hasIcon: {
|
|
124
|
+
false: "pl-3",
|
|
125
|
+
true: "pl-8"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
defaultVariants: {
|
|
129
|
+
theme: "light",
|
|
130
|
+
hasIcon: false
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
var Input_default = Input;
|
|
135
|
+
|
|
136
|
+
// src/components/demos/InputDemo.tsx
|
|
137
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
138
|
+
function InputDemo() {
|
|
139
|
+
return /* @__PURE__ */ jsxs2("div", { className: "m-4", children: [
|
|
140
|
+
/* @__PURE__ */ jsx4("h3", { children: "Input" }),
|
|
141
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col gap-2 md:flex-row", children: [
|
|
142
|
+
/* @__PURE__ */ jsx4("div", { className: "bg-green-80 p-2", children: /* @__PURE__ */ jsx4(Input_default, { theme: "dark", icon: "Search" }) }),
|
|
143
|
+
/* @__PURE__ */ jsx4("div", { className: "p-2", children: /* @__PURE__ */ jsx4(Input_default, {}) }),
|
|
144
|
+
/* @__PURE__ */ jsx4("div", { className: "p-2", children: /* @__PURE__ */ jsx4(Input_default, { icon: "MapPin" }) })
|
|
145
|
+
] })
|
|
146
|
+
] });
|
|
147
|
+
}
|
|
148
|
+
var InputDemo_default = InputDemo;
|
|
149
|
+
export {
|
|
150
|
+
InputDemo_default as default
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=InputDemo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/ui/Input.tsx","../../../src/lib/utils.ts","../../../src/components/ui/ErrorMessage.tsx","../../../src/components/ui/Label.tsx","../../../src/components/demos/InputDemo.tsx"],"sourcesContent":["import { cva, type VariantProps } from 'cva'\nimport { icons, X } from 'lucide-react'\nimport { type ChangeEvent, forwardRef, type InputHTMLAttributes } from 'react'\n\nimport ErrorMessage from '@/components/ui/ErrorMessage'\nimport Label from '@/components/ui/Label'\nimport { cn } from '@/lib/utils'\n\ninterface Props extends InputHTMLAttributes<HTMLInputElement>, VariantProps<typeof inputVariants> {\n label?: string\n error?: string\n icon?: keyof typeof icons\n onClear?: () => void\n classNames?: { label?: string }\n}\n\nconst Input = forwardRef<HTMLInputElement, Props>(\n ({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {\n const handleClear = () => {\n onChange?.({ target: { value: '' } } as ChangeEvent<HTMLInputElement>)\n onClear?.()\n }\n\n const IconComponent = icon && icons[icon]\n\n const placeholder = props.placeholder ?? (icon === 'Search' ? 'Search...' : '')\n const hasIcon = !!icon\n\n const iconColor = theme === 'dark' ? 'text-white' : 'text-grey-80'\n\n return (\n <div className=\"group flex w-full flex-col\" data-testid={`input-wrapper-${props.id}`}>\n {label && (\n <Label text={label} htmlFor={props.name} className={cn('body mb-1', classNames?.label)} />\n )}\n <div className=\"relative flex flex-row items-center\">\n {IconComponent && (\n <IconComponent\n className={`absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`}\n />\n )}\n <input\n className={cn(inputVariants({ theme, hasIcon }))}\n ref={ref}\n placeholder={placeholder}\n value={value}\n onChange={onChange}\n data-testid={`input-element-${props.id}`}\n {...props}\n />\n {hasIcon && value && (\n <X\n className={`absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`}\n onClick={handleClear}\n data-testid=\"clear-button\"\n />\n )}\n </div>\n\n <ErrorMessage message={error} className=\"mt-1\" />\n </div>\n )\n }\n)\nInput.displayName = 'Input'\n\nconst inputVariants = cva(\n [\n 'border-input',\n 'placeholder:text-muted-foreground',\n 'focus-visible:ring-ring',\n 'inline-flex',\n 'w-full',\n 'h-11',\n 'items-center',\n 'justify-start',\n 'gap-3',\n 'rounded-lg',\n 'bg-transparent',\n 'px-3',\n 'pt-0.5',\n 'text-sm',\n 'shadow-sm',\n 'ring-grey-50',\n 'transition-colors',\n 'focus-visible:outline-none',\n 'focus-visible:ring-1',\n 'disabled:cursor-not-allowed',\n 'disabled:opacity-50',\n 'appearance-none',\n '[&::-webkit-search-cancel-button]:appearance-none',\n '[&::-webkit-search-decoration]:appearance-none',\n '[&::-webkit-search-results-button]:appearance-none',\n '[&::-webkit-search-results-decoration]:appearance-none',\n '[&::-ms-clear]:display-none',\n '[&::-ms-reveal]:display-none',\n ],\n {\n variants: {\n theme: {\n light: 'text-grey-80 border',\n dark: 'text-white',\n },\n hasIcon: {\n false: 'pl-3',\n true: 'pl-8',\n },\n },\n defaultVariants: {\n theme: 'light',\n hasIcon: false,\n },\n }\n)\n\nexport default Input\n","import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'p'> {\n message?: string\n}\n\nfunction ErrorMessage({ message, className, ...props }: Readonly<Props>) {\n if (!message) return null\n\n return (\n <p className={cn('px-1 text-xs text-red-600', className)} {...props}>\n {message}\n </p>\n )\n}\n\nexport default ErrorMessage\n","import { type ComponentPropsWithoutRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\ninterface Props extends ComponentPropsWithoutRef<'label'> {\n text?: string\n}\n\nfunction Label({ text, className, ...props }: Readonly<Props>) {\n if (!text) return null\n\n return (\n <label\n className={cn(\n 'text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70',\n className\n )}\n {...props}\n >\n {text}\n </label>\n )\n}\n\nexport default Label\n","import Input from '@/components/ui/Input'\n\nfunction InputDemo() {\n return (\n <div className='m-4'>\n <h3>Input</h3>\n <div className=\"flex flex-col gap-2 md:flex-row\">\n <div className=\"bg-green-80 p-2\">\n <Input theme=\"dark\" icon=\"Search\" />\n </div>\n <div className=\"p-2\">\n <Input />\n </div>\n <div className=\"p-2\">\n <Input icon=\"MapPin\" />\n </div>\n </div>\n </div>\n )\n}\n\nexport default InputDemo\n"],"mappings":"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","names":["jsx","jsx","jsx","jsxs"]}
|
|
@@ -1009,12 +1009,127 @@ function SelectDemo() {
|
|
|
1009
1009
|
}
|
|
1010
1010
|
var SelectDemo_default = SelectDemo;
|
|
1011
1011
|
|
|
1012
|
-
// src/components/
|
|
1012
|
+
// src/components/ui/Input.tsx
|
|
1013
|
+
var import_cva5 = require("cva");
|
|
1014
|
+
var import_lucide_react8 = require("lucide-react");
|
|
1015
|
+
var import_react6 = require("react");
|
|
1013
1016
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1017
|
+
var Input = (0, import_react6.forwardRef)(
|
|
1018
|
+
({ label, error, theme, icon, onClear, value, onChange, classNames, ...props }, ref) => {
|
|
1019
|
+
const handleClear = () => {
|
|
1020
|
+
onChange?.({ target: { value: "" } });
|
|
1021
|
+
onClear?.();
|
|
1022
|
+
};
|
|
1023
|
+
const IconComponent = icon && import_lucide_react8.icons[icon];
|
|
1024
|
+
const placeholder = props.placeholder ?? (icon === "Search" ? "Search..." : "");
|
|
1025
|
+
const hasIcon = !!icon;
|
|
1026
|
+
const iconColor = theme === "dark" ? "text-white" : "text-grey-80";
|
|
1027
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "group flex w-full flex-col", "data-testid": `input-wrapper-${props.id}`, children: [
|
|
1028
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Label_default, { text: label, htmlFor: props.name, className: cn("body mb-1", classNames?.label) }),
|
|
1029
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "relative flex flex-row items-center", children: [
|
|
1030
|
+
IconComponent && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1031
|
+
IconComponent,
|
|
1032
|
+
{
|
|
1033
|
+
className: `absolute left-3 h-4 w-4 ${iconColor} opacity-50 group-hover:opacity-100`
|
|
1034
|
+
}
|
|
1035
|
+
),
|
|
1036
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1037
|
+
"input",
|
|
1038
|
+
{
|
|
1039
|
+
className: cn(inputVariants({ theme, hasIcon })),
|
|
1040
|
+
ref,
|
|
1041
|
+
placeholder,
|
|
1042
|
+
value,
|
|
1043
|
+
onChange,
|
|
1044
|
+
"data-testid": `input-element-${props.id}`,
|
|
1045
|
+
...props
|
|
1046
|
+
}
|
|
1047
|
+
),
|
|
1048
|
+
hasIcon && value && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1049
|
+
import_lucide_react8.X,
|
|
1050
|
+
{
|
|
1051
|
+
className: `absolute right-3 h-4 w-4 cursor-pointer ${iconColor}`,
|
|
1052
|
+
onClick: handleClear,
|
|
1053
|
+
"data-testid": "clear-button"
|
|
1054
|
+
}
|
|
1055
|
+
)
|
|
1056
|
+
] }),
|
|
1057
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ErrorMessage_default, { message: error, className: "mt-1" })
|
|
1058
|
+
] });
|
|
1059
|
+
}
|
|
1060
|
+
);
|
|
1061
|
+
Input.displayName = "Input";
|
|
1062
|
+
var inputVariants = (0, import_cva5.cva)(
|
|
1063
|
+
[
|
|
1064
|
+
"border-input",
|
|
1065
|
+
"placeholder:text-muted-foreground",
|
|
1066
|
+
"focus-visible:ring-ring",
|
|
1067
|
+
"inline-flex",
|
|
1068
|
+
"w-full",
|
|
1069
|
+
"h-11",
|
|
1070
|
+
"items-center",
|
|
1071
|
+
"justify-start",
|
|
1072
|
+
"gap-3",
|
|
1073
|
+
"rounded-lg",
|
|
1074
|
+
"bg-transparent",
|
|
1075
|
+
"px-3",
|
|
1076
|
+
"pt-0.5",
|
|
1077
|
+
"text-sm",
|
|
1078
|
+
"shadow-sm",
|
|
1079
|
+
"ring-grey-50",
|
|
1080
|
+
"transition-colors",
|
|
1081
|
+
"focus-visible:outline-none",
|
|
1082
|
+
"focus-visible:ring-1",
|
|
1083
|
+
"disabled:cursor-not-allowed",
|
|
1084
|
+
"disabled:opacity-50",
|
|
1085
|
+
"appearance-none",
|
|
1086
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
1087
|
+
"[&::-webkit-search-decoration]:appearance-none",
|
|
1088
|
+
"[&::-webkit-search-results-button]:appearance-none",
|
|
1089
|
+
"[&::-webkit-search-results-decoration]:appearance-none",
|
|
1090
|
+
"[&::-ms-clear]:display-none",
|
|
1091
|
+
"[&::-ms-reveal]:display-none"
|
|
1092
|
+
],
|
|
1093
|
+
{
|
|
1094
|
+
variants: {
|
|
1095
|
+
theme: {
|
|
1096
|
+
light: "text-grey-80 border",
|
|
1097
|
+
dark: "text-white"
|
|
1098
|
+
},
|
|
1099
|
+
hasIcon: {
|
|
1100
|
+
false: "pl-3",
|
|
1101
|
+
true: "pl-8"
|
|
1102
|
+
}
|
|
1103
|
+
},
|
|
1104
|
+
defaultVariants: {
|
|
1105
|
+
theme: "light",
|
|
1106
|
+
hasIcon: false
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
);
|
|
1110
|
+
var Input_default = Input;
|
|
1111
|
+
|
|
1112
|
+
// src/components/demos/InputDemo.tsx
|
|
1113
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1114
|
+
function InputDemo() {
|
|
1115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "m-4", children: [
|
|
1116
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h3", { children: "Input" }),
|
|
1117
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-col gap-2 md:flex-row", children: [
|
|
1118
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "bg-green-80 p-2", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Input_default, { theme: "dark", icon: "Search" }) }),
|
|
1119
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Input_default, {}) }),
|
|
1120
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Input_default, { icon: "MapPin" }) })
|
|
1121
|
+
] })
|
|
1122
|
+
] });
|
|
1123
|
+
}
|
|
1124
|
+
var InputDemo_default = InputDemo;
|
|
1125
|
+
|
|
1126
|
+
// src/components/demos/index.tsx
|
|
1127
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1014
1128
|
function Demos() {
|
|
1015
|
-
return /* @__PURE__ */ (0,
|
|
1016
|
-
/* @__PURE__ */ (0,
|
|
1017
|
-
/* @__PURE__ */ (0,
|
|
1129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
|
|
1130
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ComboboxDemo_default, {}),
|
|
1131
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SelectDemo_default, {}),
|
|
1132
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(InputDemo_default, {})
|
|
1018
1133
|
] });
|
|
1019
1134
|
}
|
|
1020
1135
|
var demos_default = Demos;
|