@optigrit/optigrit-ui 0.0.10 → 0.0.11
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.
|
@@ -229,15 +229,15 @@ var Input = forwardRef((props, ref) => {
|
|
|
229
229
|
"--bg-color": bgColor,
|
|
230
230
|
"--text-color": textColor,
|
|
231
231
|
"--placeholder-color": colorMix(textColor, 80),
|
|
232
|
-
"--border-color": colorMix(borderColor,
|
|
233
|
-
"--border-color-hover": colorMix(
|
|
232
|
+
"--border-color": colorMix(borderColor, 10),
|
|
233
|
+
"--border-color-hover": colorMix(primaryColor, 40),
|
|
234
234
|
"--light-primary-color": colorMix(primaryColor, 50),
|
|
235
235
|
"--primary-color": colorMix(primaryColor, 100),
|
|
236
236
|
width: fullWidth === void 0 || fullWidth ? "100%" : "auto",
|
|
237
237
|
...inputContainerProps?.style
|
|
238
238
|
},
|
|
239
239
|
className: cn(
|
|
240
|
-
"flex items-center gap-1 border rounded-
|
|
240
|
+
"flex items-center gap-1 border rounded-xl h-[44px] p-1 transition-all duration-200 relative bg-[var(--bg-color)]",
|
|
241
241
|
isFocus ? "ring-2 ring-[var(--light-primary-color)] border-[var(--primary-color)]" : "border-[var(--border-color)] hover:border-[var(--border-color-hover)]",
|
|
242
242
|
inputContainerProps?.className
|
|
243
243
|
),
|
|
@@ -246,8 +246,11 @@ var Input = forwardRef((props, ref) => {
|
|
|
246
246
|
"div",
|
|
247
247
|
{
|
|
248
248
|
id: "label",
|
|
249
|
-
className: "absolute bg-[var(--bg-color)] text-[var(--text-color)] px-1 rounded-sm transition-all duration-200 select-none cursor-text",
|
|
250
249
|
onClick: () => container.current?.querySelector("input")?.focus(),
|
|
250
|
+
className: cn(
|
|
251
|
+
"absolute bg-[var(--bg-color)] px-1 rounded-sm transition-all duration-200 select-none cursor-text",
|
|
252
|
+
isFocus || !label || labelShrink === void 0 || labelShrink ? "text-[var(--text-color)]" : "text-[var(--placeholder-color)]"
|
|
253
|
+
),
|
|
251
254
|
children: label
|
|
252
255
|
}
|
|
253
256
|
),
|
|
@@ -260,7 +263,7 @@ var Input = forwardRef((props, ref) => {
|
|
|
260
263
|
ref,
|
|
261
264
|
required: required === void 0 || required,
|
|
262
265
|
className: cn(
|
|
263
|
-
"w-full h-full border-none outline-none rounded-sm transition-all duration-200 placeholder-[var(--placeholder-color)] text-[var(--text-color)] [&:-webkit-autofill]:[-webkit-text-fill-color:var(--text-color)] bg-[var(--bg-color)]",
|
|
266
|
+
"text-sm w-full h-full border-none outline-none rounded-sm transition-all duration-200 placeholder-[var(--placeholder-color)] text-[var(--text-color)] [&:-webkit-autofill]:[-webkit-text-fill-color:var(--text-color)] bg-[var(--bg-color)]",
|
|
264
267
|
isFocus || !label || labelShrink === void 0 || labelShrink ? "" : "placeholder:opacity-0",
|
|
265
268
|
inputProps.className
|
|
266
269
|
),
|
|
@@ -44,6 +44,7 @@ declare function Tooltip(props: TooltipProps): react_jsx_runtime.JSX.Element;
|
|
|
44
44
|
|
|
45
45
|
type InputFieldProps = {
|
|
46
46
|
value?: string;
|
|
47
|
+
labelBehavior?: 'fixed' | 'float';
|
|
47
48
|
errorColor?: string;
|
|
48
49
|
validateValue?: (value: string) => string | null;
|
|
49
50
|
onChangeValue?: (value: string) => void;
|
package/dist/components/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
ShowWithAnimation,
|
|
7
7
|
Spinner,
|
|
8
8
|
cn
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-CGY2R33R.js";
|
|
10
10
|
import "../chunk-MCQS3QNN.js";
|
|
11
11
|
import {
|
|
12
12
|
useKeyboardShortcuts
|
|
@@ -300,6 +300,7 @@ function InputField(props) {
|
|
|
300
300
|
onChangeValue,
|
|
301
301
|
containerProps = {},
|
|
302
302
|
errorColor = "rgb(240, 70, 70)",
|
|
303
|
+
labelBehavior = "fixed",
|
|
303
304
|
...inputProps
|
|
304
305
|
} = props;
|
|
305
306
|
const initRef = useRef4({ isUserTyped: false });
|
|
@@ -334,18 +335,22 @@ function InputField(props) {
|
|
|
334
335
|
}
|
|
335
336
|
}, [props.value]);
|
|
336
337
|
return /* @__PURE__ */ jsxs4("div", { ...containerProps, children: [
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
338
|
+
/* @__PURE__ */ jsxs4("label", { children: [
|
|
339
|
+
/* @__PURE__ */ jsx4(Show, { when: labelBehavior === "fixed", children: /* @__PURE__ */ jsx4("span", { className: "text-[10px] text-text-secondary/60 uppercase font-medium", children: props.label }) }),
|
|
340
|
+
/* @__PURE__ */ jsx4(
|
|
341
|
+
Input,
|
|
342
|
+
{
|
|
343
|
+
...inputProps,
|
|
344
|
+
label: labelBehavior === "float" ? inputProps.label : void 0,
|
|
345
|
+
textColor: error ? errorColor : inputProps.textColor,
|
|
346
|
+
borderColor: error ? errorColor : inputProps.borderColor,
|
|
347
|
+
primaryColor: error ? errorColor : inputProps.primaryColor,
|
|
348
|
+
onChange: handleOnChange,
|
|
349
|
+
onFocus: handleOnFocus,
|
|
350
|
+
onBlur: handleOnBlur
|
|
351
|
+
}
|
|
352
|
+
)
|
|
353
|
+
] }),
|
|
349
354
|
/* @__PURE__ */ jsx4("p", { className: "pl-1 text-xs", style: { color: errorColor, display: error ? "block" : "none" }, children: error })
|
|
350
355
|
] });
|
|
351
356
|
}
|
|
@@ -1267,7 +1272,7 @@ function Dialog(props) {
|
|
|
1267
1272
|
role: "dialog",
|
|
1268
1273
|
"aria-modal": "true",
|
|
1269
1274
|
className: cn(
|
|
1270
|
-
"relative z-10 w-full mx-4 bg-bg rounded-
|
|
1275
|
+
"relative z-10 w-full mx-4 bg-bg-secondary rounded-2xl shadow-lg overflow-hidden max-h-[100vh] overflow-y-auto",
|
|
1271
1276
|
sizeClasses2[size],
|
|
1272
1277
|
className
|
|
1273
1278
|
),
|
|
@@ -1287,8 +1292,8 @@ function Dialog(props) {
|
|
|
1287
1292
|
import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1288
1293
|
function DialogHeader(props) {
|
|
1289
1294
|
const { title, children, ...rest } = props;
|
|
1290
|
-
return /* @__PURE__ */ jsxs11("div", { ...rest, className: "
|
|
1291
|
-
/* @__PURE__ */ jsx23(Show, { when: !!title, children: /* @__PURE__ */ jsx23("h1", { className: "text-lg font-
|
|
1295
|
+
return /* @__PURE__ */ jsxs11("div", { ...rest, className: cn("p-4 sticky top-0 z-[20] backdrop-blur-sm", props.className), children: [
|
|
1296
|
+
/* @__PURE__ */ jsx23(Show, { when: !!title, children: /* @__PURE__ */ jsx23("h1", { className: "text-lg font-bold", children: title }) }),
|
|
1292
1297
|
children
|
|
1293
1298
|
] });
|
|
1294
1299
|
}
|
|
@@ -1300,7 +1305,7 @@ function DialogFooter(props) {
|
|
|
1300
1305
|
"div",
|
|
1301
1306
|
{
|
|
1302
1307
|
...props,
|
|
1303
|
-
className: cn("
|
|
1308
|
+
className: cn("p-4 flex items-center justify-end sticky bottom-0 z-[20] backdrop-blur-sm", props.className)
|
|
1304
1309
|
}
|
|
1305
1310
|
);
|
|
1306
1311
|
}
|
|
@@ -1312,7 +1317,7 @@ function DialogContent(props) {
|
|
|
1312
1317
|
"div",
|
|
1313
1318
|
{
|
|
1314
1319
|
...props,
|
|
1315
|
-
className: cn("
|
|
1320
|
+
className: cn("px-4 z-[10]", props.className)
|
|
1316
1321
|
}
|
|
1317
1322
|
);
|
|
1318
1323
|
}
|
package/dist/core/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optigrit/optigrit-ui",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "UI components library for optigrit apps",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"lint": "tsc",
|
|
55
55
|
"storybook": "storybook dev -p 6006",
|
|
56
56
|
"build-storybook": "storybook build",
|
|
57
|
-
"dev:yalc": "chokidar \"src/**/*\" -c \"npm run build && yalc push\" --polling"
|
|
57
|
+
"dev:yalc": "chokidar \"src/**/*\" --debounce 2000 -c \"npm run build && yalc push\" --polling"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@chromatic-com/storybook": "^5.1.2",
|