@bouku/core 0.0.1 → 0.0.3

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.
Files changed (86) hide show
  1. package/dist/assets/icons/chevron-up.svg +6 -0
  2. package/dist/components/accordion/index.d.ts +6 -0
  3. package/dist/components/accordion/index.js +12 -0
  4. package/dist/components/accordion/tab.d.ts +4 -0
  5. package/dist/components/accordion/tab.js +35 -0
  6. package/dist/components/button/_.d.ts +2 -0
  7. package/dist/components/button/_.js +10 -0
  8. package/dist/components/button/copy.d.ts +6 -0
  9. package/dist/components/button/copy.js +16 -0
  10. package/dist/components/button/normal.d.ts +11 -0
  11. package/dist/components/button/normal.js +48 -0
  12. package/dist/components/date/_.d.ts +1 -0
  13. package/dist/components/date/_.js +8 -0
  14. package/dist/components/date/time-ago.d.ts +7 -0
  15. package/dist/components/date/time-ago.js +13 -0
  16. package/dist/components/dropdown/normal.d.ts +10 -0
  17. package/dist/components/dropdown/normal.js +22 -0
  18. package/dist/components/fade/_.d.ts +1 -0
  19. package/dist/components/fade/_.js +8 -0
  20. package/dist/components/fade/circle.d.ts +10 -0
  21. package/dist/components/fade/circle.js +8 -0
  22. package/dist/components/heading/_.d.ts +2 -0
  23. package/dist/components/heading/_.js +10 -0
  24. package/dist/components/heading/normal.d.ts +24 -0
  25. package/dist/components/heading/normal.js +26 -0
  26. package/dist/components/heading/page.d.ts +25 -0
  27. package/dist/components/heading/page.js +26 -0
  28. package/dist/components/index.d.ts +20 -0
  29. package/dist/components/index.js +46 -0
  30. package/dist/components/information/_.d.ts +1 -0
  31. package/dist/components/information/_.js +8 -0
  32. package/dist/components/information/card.d.ts +7 -0
  33. package/dist/components/information/card.js +20 -0
  34. package/dist/components/layout/_.d.ts +2 -0
  35. package/dist/components/layout/_.js +10 -0
  36. package/dist/components/layout/absolute.d.ts +9 -0
  37. package/dist/components/layout/absolute.js +12 -0
  38. package/dist/components/layout/fade.d.ts +7 -0
  39. package/dist/components/layout/fade.js +20 -0
  40. package/dist/components/layout/flex.d.ts +17 -0
  41. package/dist/components/layout/flex.js +49 -0
  42. package/dist/components/layout/footer.d.ts +15 -0
  43. package/dist/components/layout/footer.js +13 -0
  44. package/dist/components/layout/media-row.d.ts +15 -0
  45. package/dist/components/layout/media-row.js +11 -0
  46. package/dist/components/layout/rnd.d.ts +10 -0
  47. package/dist/components/layout/rnd.js +32 -0
  48. package/dist/components/layout/scroll-box.d.ts +14 -0
  49. package/dist/components/layout/scroll-box.js +11 -0
  50. package/dist/components/layout/section.d.ts +15 -0
  51. package/dist/components/layout/section.js +19 -0
  52. package/dist/components/layout/separator.d.ts +3 -0
  53. package/dist/components/layout/separator.js +8 -0
  54. package/dist/components/link/_.d.ts +1 -0
  55. package/dist/components/link/_.js +8 -0
  56. package/dist/components/link/tab.d.ts +22 -0
  57. package/dist/components/link/tab.js +30 -0
  58. package/dist/components/list/index.d.ts +2 -0
  59. package/dist/components/list/index.js +10 -0
  60. package/dist/components/list/item.d.ts +9 -0
  61. package/dist/components/list/item.js +9 -0
  62. package/dist/components/list/search-bar.d.ts +14 -0
  63. package/dist/components/list/search-bar.js +33 -0
  64. package/dist/components/list/variants/bullet.d.ts +9 -0
  65. package/dist/components/list/variants/bullet.js +21 -0
  66. package/dist/components/list/variants/number.d.ts +10 -0
  67. package/dist/components/list/variants/number.js +23 -0
  68. package/dist/components/pagination/index.d.ts +9 -0
  69. package/dist/components/pagination/index.js +21 -0
  70. package/dist/components/progress/_.d.ts +1 -0
  71. package/dist/components/progress/_.js +8 -0
  72. package/dist/components/progress/bar.d.ts +4 -0
  73. package/dist/components/progress/bar.js +12 -0
  74. package/dist/components/table/_.d.ts +1 -0
  75. package/dist/components/table/_.js +8 -0
  76. package/dist/components/table/normal.d.ts +7 -0
  77. package/dist/components/table/normal.js +20 -0
  78. package/dist/components/text/_.d.ts +2 -0
  79. package/dist/components/text/_.js +10 -0
  80. package/dist/components/text/badge.d.ts +18 -0
  81. package/dist/components/text/badge.js +42 -0
  82. package/dist/components/text/input.d.ts +39 -0
  83. package/dist/components/text/input.js +50 -0
  84. package/dist/index.d.ts +1 -1
  85. package/dist/index.js +1 -1
  86. package/package.json +2 -1
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Badge = Badge;
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
+ /**
8
+ * Color-themed badge component.
9
+ *
10
+ * To use a CSS variable it must exist and be passed in the
11
+ * form `--variable-name`. Any other format may cause unexpected
12
+ * results. CSS variables use 'color-mix' which is not supported in
13
+ * some old browsers such as Safari 15.3 and Internet Explorer.
14
+ *
15
+ * @param {string} color - Color of badge. (optional, default = accent)
16
+ **/
17
+ function Badge({ style, color = "--color-accent", size = "md", icon, children }) {
18
+ if (!children)
19
+ return null;
20
+ if (color === "future")
21
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 test-badge", children: [icon && (0, jsx_runtime_1.jsx)("div", { className: "text-primary-dark", children: icon }), (0, jsx_runtime_1.jsx)("span", { children: children })] }));
22
+ return ((0, jsx_runtime_1.jsx)("span", { className: (0, style_1.cn)(base({ size }), style), style: styles(color), children: children }));
23
+ }
24
+ const styles = (color) => ({
25
+ background: (0, style_1.opacitize)(color),
26
+ border: `1px solid var(${color})`,
27
+ borderRadius: "calc(infinity * 1px)",
28
+ textAlign: "center",
29
+ fontWeight: "600",
30
+ color: "var(--color-primary)"
31
+ });
32
+ const base = (0, tailwind_variants_1.tv)({
33
+ base: "w-min",
34
+ variants: {
35
+ size: {
36
+ xs: "px-1 py-px text-[0.5rem]",
37
+ sm: "px-1 py-px text-xs",
38
+ md: "px-2 py-1 text-sm"
39
+ }
40
+ }
41
+ });
42
+ exports.default = Badge;
@@ -0,0 +1,39 @@
1
+ import { ReactNode } from "react";
2
+ type FieldProps<T> = {
3
+ id?: string;
4
+ label?: string;
5
+ style?: string;
6
+ value?: T;
7
+ update?: (x: T) => void;
8
+ updateForm?: (id: string, x: T) => void;
9
+ required?: boolean;
10
+ disabled?: boolean;
11
+ note?: ReactNode;
12
+ };
13
+ type Variant = "normal" | "ghost";
14
+ type Props<T> = FieldProps<T> & {
15
+ type?: "text" | "number" | "email" | "password";
16
+ variant?: Variant;
17
+ style?: string;
18
+ placeholder?: string;
19
+ onEnter?: (x: string) => void;
20
+ };
21
+ /**
22
+ * Text field component.
23
+ *
24
+ * Wraps the native `input` element with custom styling and validation.
25
+ * It displays an optional label and note, and can be marked as required.
26
+ * Optional callback for when the user presses `Enter` key.
27
+ * The value is controlled externally via props, usually `useState`.
28
+ *
29
+ * Variants:
30
+ * - `normal`: Standard input with primary color scheme.
31
+ * - `ghost`: Transparent for injecting input inside other component.
32
+ *
33
+ * @param {Variant} variant - Visual style variant. (optional, default = normal)
34
+ * @param {string} style - Additional class names for styling. (optional)
35
+ * @param {string} placeholder - Placeholder text for the input. (optional)
36
+ * @param {Function} onEnter - Callback when `Enter` key is pressed. (optional)
37
+ **/
38
+ export default function Input<T>({ id, type, variant, style, value, update, updateForm, onEnter, disabled, placeholder, ...props }: Props<T>): import("react").JSX.Element;
39
+ export {};
@@ -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
@@ -1,2 +1,2 @@
1
- export * from "./ui";
1
+ export * from "./components";
2
2
  export * from "./utils";
package/dist/index.js CHANGED
@@ -14,5 +14,5 @@ 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
- __exportStar(require("./ui"), exports);
17
+ __exportStar(require("./components"), exports);
18
18
  __exportStar(require("./utils"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bouku/core",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
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",