@bouku/core 0.0.1 → 0.0.2
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/components/button/_.d.ts +2 -0
- package/dist/components/button/_.js +10 -0
- package/dist/components/button/copy.d.ts +6 -0
- package/dist/components/button/copy.js +16 -0
- package/dist/components/button/normal.d.ts +11 -0
- package/dist/components/button/normal.js +48 -0
- package/dist/components/date/_.d.ts +1 -0
- package/dist/components/date/_.js +8 -0
- package/dist/components/date/time-ago.d.ts +7 -0
- package/dist/components/date/time-ago.js +13 -0
- package/dist/components/dropdown/normal.d.ts +10 -0
- package/dist/components/dropdown/normal.js +22 -0
- package/dist/components/fade/_.d.ts +1 -0
- package/dist/components/fade/_.js +8 -0
- package/dist/components/fade/circle.d.ts +10 -0
- package/dist/components/fade/circle.js +8 -0
- package/dist/components/heading/_.d.ts +2 -0
- package/dist/components/heading/_.js +10 -0
- package/dist/components/heading/normal.d.ts +24 -0
- package/dist/components/heading/normal.js +26 -0
- package/dist/components/heading/page.d.ts +25 -0
- package/dist/components/heading/page.js +26 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.js +45 -0
- package/dist/components/information/_.d.ts +1 -0
- package/dist/components/information/_.js +8 -0
- package/dist/components/information/card.d.ts +7 -0
- package/dist/components/information/card.js +20 -0
- package/dist/components/layout/_.d.ts +2 -0
- package/dist/components/layout/_.js +10 -0
- package/dist/components/layout/absolute.d.ts +9 -0
- package/dist/components/layout/absolute.js +12 -0
- package/dist/components/layout/fade.d.ts +7 -0
- package/dist/components/layout/fade.js +20 -0
- package/dist/components/layout/flex.d.ts +17 -0
- package/dist/components/layout/flex.js +49 -0
- package/dist/components/layout/footer.d.ts +15 -0
- package/dist/components/layout/footer.js +13 -0
- package/dist/components/layout/media-row.d.ts +15 -0
- package/dist/components/layout/media-row.js +11 -0
- package/dist/components/layout/rnd.d.ts +10 -0
- package/dist/components/layout/rnd.js +32 -0
- package/dist/components/layout/scroll-box.d.ts +14 -0
- package/dist/components/layout/scroll-box.js +11 -0
- package/dist/components/layout/section.d.ts +15 -0
- package/dist/components/layout/section.js +19 -0
- package/dist/components/layout/separator.d.ts +3 -0
- package/dist/components/layout/separator.js +8 -0
- package/dist/components/link/_.d.ts +1 -0
- package/dist/components/link/_.js +8 -0
- package/dist/components/link/tab.d.ts +22 -0
- package/dist/components/link/tab.js +30 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +10 -0
- package/dist/components/list/item.d.ts +9 -0
- package/dist/components/list/item.js +9 -0
- package/dist/components/list/search-bar.d.ts +14 -0
- package/dist/components/list/search-bar.js +33 -0
- package/dist/components/list/variants/bullet.d.ts +9 -0
- package/dist/components/list/variants/bullet.js +21 -0
- package/dist/components/list/variants/number.d.ts +10 -0
- package/dist/components/list/variants/number.js +23 -0
- package/dist/components/pagination/index.d.ts +9 -0
- package/dist/components/pagination/index.js +21 -0
- package/dist/components/progress/_.d.ts +1 -0
- package/dist/components/progress/_.js +8 -0
- package/dist/components/progress/bar.d.ts +4 -0
- package/dist/components/progress/bar.js +12 -0
- package/dist/components/table/_.d.ts +1 -0
- package/dist/components/table/_.js +8 -0
- package/dist/components/table/normal.d.ts +7 -0
- package/dist/components/table/normal.js +20 -0
- package/dist/components/text/_.d.ts +2 -0
- package/dist/components/text/_.js +10 -0
- package/dist/components/text/badge.d.ts +18 -0
- package/dist/components/text/badge.js +42 -0
- package/dist/components/text/input.d.ts +39 -0
- package/dist/components/text/input.js +50 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +8 -1
- package/package.json +2 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Input;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const style_1 = require("@bouko/style");
|
|
6
|
+
const tailwind_variants_1 = require("tailwind-variants");
|
|
7
|
+
function Field({ style, label, required = true, note, children }) {
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, style_1.cn)(fieldStyles.container, style), children: [label && (0, jsx_runtime_1.jsxs)("span", { className: fieldStyles.label, children: [label, " ", !required ? (0, jsx_runtime_1.jsx)("span", { className: "italic text-slate-400", children: "(optional)" }) : ""] }), children, note && (0, jsx_runtime_1.jsx)("span", { className: fieldStyles.note, children: note })] }));
|
|
9
|
+
}
|
|
10
|
+
const fieldStyles = {
|
|
11
|
+
container: "flex flex-col shrink-0 gap-1 overflow-hidden",
|
|
12
|
+
label: "text-xs text-primary-dark",
|
|
13
|
+
note: "mt-1 text-xs text-slate-500 whitespace-pre-line"
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Text field component.
|
|
17
|
+
*
|
|
18
|
+
* Wraps the native `input` element with custom styling and validation.
|
|
19
|
+
* It displays an optional label and note, and can be marked as required.
|
|
20
|
+
* Optional callback for when the user presses `Enter` key.
|
|
21
|
+
* The value is controlled externally via props, usually `useState`.
|
|
22
|
+
*
|
|
23
|
+
* Variants:
|
|
24
|
+
* - `normal`: Standard input with primary color scheme.
|
|
25
|
+
* - `ghost`: Transparent for injecting input inside other component.
|
|
26
|
+
*
|
|
27
|
+
* @param {Variant} variant - Visual style variant. (optional, default = normal)
|
|
28
|
+
* @param {string} style - Additional class names for styling. (optional)
|
|
29
|
+
* @param {string} placeholder - Placeholder text for the input. (optional)
|
|
30
|
+
* @param {Function} onEnter - Callback when `Enter` key is pressed. (optional)
|
|
31
|
+
**/
|
|
32
|
+
function Input({ id, type = "text", variant, style, value, update, updateForm, onEnter, disabled, placeholder, ...props }) {
|
|
33
|
+
const handleUpdate = (value) => {
|
|
34
|
+
if (id && updateForm)
|
|
35
|
+
updateForm(id, value);
|
|
36
|
+
else if (update)
|
|
37
|
+
update(value);
|
|
38
|
+
};
|
|
39
|
+
return ((0, jsx_runtime_1.jsx)(Field, { ...props, children: (0, jsx_runtime_1.jsx)("input", { type: type, className: (0, style_1.cn)(styles({ variant }), style), placeholder: placeholder || `Enter ${id}`, value: value, onChange: ({ target: { value } }) => handleUpdate(value), onKeyUp: ({ key }) => key === "Enter" && value ? onEnter?.(value) : null, disabled: disabled }) }));
|
|
40
|
+
}
|
|
41
|
+
const styles = (0, tailwind_variants_1.tv)({
|
|
42
|
+
base: "px-3 py-2 duration-200 rounded text-xs sm:text-sm placeholder:text-primary-darker text-primary disabled:brightness-90 disabled:cursor-not-allowed",
|
|
43
|
+
defaultVariants: { variant: "normal" },
|
|
44
|
+
variants: {
|
|
45
|
+
variant: {
|
|
46
|
+
normal: "bg-input border border-outline focus:border-outline-light outline-none",
|
|
47
|
+
ghost: "p-0 bg-transparent border-none outline-none"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -14,5 +14,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
17
|
+
exports.mountApp = mountApp;
|
|
18
|
+
const client_1 = require("react-dom/client");
|
|
19
|
+
__exportStar(require("./components"), exports);
|
|
18
20
|
__exportStar(require("./utils"), exports);
|
|
21
|
+
function mountApp(app) {
|
|
22
|
+
const element = document.getElementById("root");
|
|
23
|
+
const root = (0, client_1.createRoot)(element);
|
|
24
|
+
root.render(app);
|
|
25
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bouku/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^24.3.1",
|
|
36
36
|
"@types/react": "^19.1.10",
|
|
37
|
+
"@types/react-dom": "^19.2.3",
|
|
37
38
|
"dependency-cruiser": "^17.0.1",
|
|
38
39
|
"react": "^19.1.1",
|
|
39
40
|
"react-router-dom": "^7.12.0",
|