@geckou/ui-react 0.3.0 → 0.5.0
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/README.md +33 -0
- package/dist/components/CheckBox.d.ts +7 -1
- package/dist/components/CheckBox.js +37 -46
- package/dist/components/DatePicker.d.ts +8 -1
- package/dist/components/DatePicker.js +86 -79
- package/dist/components/DateRangePicker.js +60 -50
- package/dist/components/DateSelector.d.ts +11 -1
- package/dist/components/DateSelector.js +74 -62
- package/dist/components/ErrorMessage.js +7 -6
- package/dist/components/InputBox.js +36 -40
- package/dist/components/LabeledCheckbox.js +26 -23
- package/dist/components/ModalBox.js +54 -35
- package/dist/components/RadioButtons.js +45 -39
- package/dist/components/SearchableSelectBox.d.ts +3 -1
- package/dist/components/SearchableSelectBox.js +86 -43
- package/dist/components/TabUI.js +28 -27
- package/dist/components/TextBox.d.ts +15 -2
- package/dist/components/TextBox.js +54 -38
- package/dist/components/ToggleButton.d.ts +4 -1
- package/dist/components/ToggleButton.js +50 -53
- package/package.json +8 -6
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as h, Fragment as m, jsx as f } from "react/jsx-runtime";
|
|
3
3
|
import { COLOR as e } from "@geckou/ui-core";
|
|
4
|
-
function
|
|
4
|
+
function y({
|
|
5
5
|
name: l,
|
|
6
6
|
label: n = { on: "ON", off: "OFF" },
|
|
7
|
-
checked:
|
|
7
|
+
checked: p,
|
|
8
8
|
onChange: d,
|
|
9
9
|
isDisabled: o,
|
|
10
|
-
cssStyle:
|
|
10
|
+
cssStyle: a,
|
|
11
|
+
ariaLabel: g,
|
|
12
|
+
ariaLabelledBy: c
|
|
11
13
|
}) {
|
|
12
|
-
var
|
|
13
|
-
const
|
|
14
|
+
var u, s, b;
|
|
15
|
+
const r = p ?? !1, x = Math.max(n.on.length, n.off.length), t = o ? a == null ? void 0 : a.disabled : a == null ? void 0 : a.default, i = {
|
|
14
16
|
on: {
|
|
15
17
|
textColor: o ? e.lightGray : e.white,
|
|
16
18
|
backgroundColor: o ? e.gray : e.blue,
|
|
@@ -33,60 +35,55 @@ function m({
|
|
|
33
35
|
boxShadow: "0 0 0 0 rgba(0, 0, 0, 0)",
|
|
34
36
|
...t == null ? void 0 : t.off
|
|
35
37
|
}
|
|
36
|
-
}[
|
|
38
|
+
}[r ? "on" : "off"], z = {
|
|
37
39
|
"--text-color": i.textColor,
|
|
38
|
-
"--border-color": (
|
|
39
|
-
"--border-size": (
|
|
40
|
-
"--radius-size": (
|
|
40
|
+
"--border-color": (u = i.border) == null ? void 0 : u.color,
|
|
41
|
+
"--border-size": (s = i.border) == null ? void 0 : s.size,
|
|
42
|
+
"--radius-size": (b = i.border) == null ? void 0 : b.radius,
|
|
41
43
|
"--background-color": i.backgroundColor,
|
|
42
44
|
"--box-shadow": i.boxShadow,
|
|
43
|
-
"--inline-size": `${
|
|
45
|
+
"--inline-size": `${x * 2}ch`,
|
|
44
46
|
"--handle-size": "1.5rem",
|
|
45
47
|
"--padding-size": "calc(var(--border-size) + 2px)",
|
|
46
48
|
"--duration": ".15s"
|
|
47
49
|
};
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
)
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
);
|
|
50
|
+
return /* @__PURE__ */ h(m, { children: [
|
|
51
|
+
/* @__PURE__ */ h(
|
|
52
|
+
"button",
|
|
53
|
+
{
|
|
54
|
+
type: "button",
|
|
55
|
+
style: z,
|
|
56
|
+
disabled: o,
|
|
57
|
+
role: "switch",
|
|
58
|
+
"aria-checked": r,
|
|
59
|
+
"data-checked": r,
|
|
60
|
+
"aria-labelledby": c,
|
|
61
|
+
"aria-label": c ? void 0 : g ?? l,
|
|
62
|
+
onClick: (v) => {
|
|
63
|
+
v.stopPropagation(), o || d == null || d(!r);
|
|
64
|
+
},
|
|
65
|
+
className: "relative inline-block w-[calc(var(--inline-size)+var(--handle-size)+(var(--padding-size)*2))] cursor-pointer rounded-(--radius-size) border-none bg-(--background-color) p-(--padding-size) shadow-[0_0_0_var(--border-size)_var(--border-color)_inset,var(--box-shadow)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-(--border-color)",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ f(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
"data-on": n.on,
|
|
71
|
+
"data-off": n.off,
|
|
72
|
+
className: `absolute top-0 left-0 h-full w-full text-(--text-color) uppercase before:absolute before:right-0 before:m-auto before:inline-flex before:h-full before:w-[calc(100%-var(--handle-size)-var(--padding-size))] before:items-center before:justify-center before:leading-none before:transition-opacity before:duration-(--duration) before:ease-out before:content-[attr(data-off)] after:absolute after:left-0 after:m-auto after:inline-flex after:h-full after:w-[calc(100%-var(--handle-size)-var(--padding-size))] after:items-center after:justify-center after:leading-none after:transition-opacity after:duration-(--duration) after:ease-out after:content-[attr(data-on)] ${r ? "before:opacity-0 after:opacity-100" : "before:opacity-100 after:opacity-0"}`
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
/* @__PURE__ */ f(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
className: `relative m-0 aspect-square w-(--handle-size) rounded-[calc(var(--radius-size)-(var(--padding-size)/2))] bg-(--text-color) shadow-(--box-shadow) transition-[left] duration-(--duration) ease-out ${r ? "left-[calc(100%-var(--handle-size))]" : "left-0"}`
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
r && /* @__PURE__ */ f("input", { type: "hidden", name: l, value: "on", disabled: o })
|
|
85
|
+
] });
|
|
89
86
|
}
|
|
90
87
|
export {
|
|
91
|
-
|
|
88
|
+
y as ToggleButton
|
|
92
89
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geckou/ui-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "A set of reusable React UI components (forms) by Geckou",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"sideEffects":
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.css"
|
|
8
|
+
],
|
|
7
9
|
"main": "./dist/index.js",
|
|
8
10
|
"types": "./dist/index.d.ts",
|
|
9
11
|
"exports": {
|
|
@@ -38,16 +40,16 @@
|
|
|
38
40
|
"react-dom": "^19.0.0"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
|
-
"@geckou/ui-core": "^0.
|
|
43
|
+
"@geckou/ui-core": "^0.4.0"
|
|
42
44
|
},
|
|
43
45
|
"scripts": {
|
|
44
46
|
"build": "vite build && node scripts/copy-assets.mjs",
|
|
45
|
-
"lint": "eslint src",
|
|
46
|
-
"lint:fix": "eslint src --fix",
|
|
47
|
+
"lint": "eslint src tests",
|
|
48
|
+
"lint:fix": "eslint src tests --fix",
|
|
47
49
|
"prepublishOnly": "yarn build",
|
|
48
50
|
"test": "vitest run",
|
|
49
51
|
"test:watch": "vitest",
|
|
50
|
-
"type-check": "tsc --noEmit"
|
|
52
|
+
"type-check": "tsc --noEmit && tsc -p tsconfig.test.json"
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
55
|
"@types/react": "^19.0.0",
|