asterui 0.12.15 → 0.12.17

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/index43.js CHANGED
@@ -1,18 +1,158 @@
1
- import { jsx as c } from "react/jsx-runtime";
2
- import n from "react";
3
- function f({ children: o, direction: t = "horizontal", className: s = "", ...r }) {
4
- const a = ["join", t === "vertical" && "join-vertical", s].filter(Boolean).join(" "), l = n.Children.map(o, (e) => {
5
- if (n.isValidElement(e)) {
6
- const i = e.props.className || "", m = i ? `join-item ${i}` : "join-item";
7
- return n.cloneElement(e, {
8
- className: m
9
- });
10
- }
11
- return e;
12
- });
13
- return /* @__PURE__ */ c("div", { className: a, ...r, children: l });
14
- }
1
+ import { jsxs as k, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as S, useState as A, useRef as K, useImperativeHandle as W } from "react";
3
+ const H = S(
4
+ ({
5
+ value: o,
6
+ defaultValue: I,
7
+ min: a = -1 / 0,
8
+ max: u = 1 / 0,
9
+ step: d = 1,
10
+ precision: s,
11
+ size: c,
12
+ disabled: l = !1,
13
+ onChange: p,
14
+ formatter: f,
15
+ parser: h,
16
+ className: w = "",
17
+ controls: v = !0,
18
+ block: C = !1,
19
+ ...D
20
+ }, V) => {
21
+ const [j, m] = A(I ?? null), b = K(null);
22
+ W(V, () => b.current);
23
+ const t = o !== void 0 ? o : j, B = (e) => {
24
+ if (e === null) return "";
25
+ let n = e;
26
+ return s !== void 0 && (n = Number(e.toFixed(s))), f ? f(n) : String(n);
27
+ }, M = (e) => {
28
+ if (!e) return null;
29
+ const n = h ? h(e) : parseFloat(e);
30
+ return isNaN(n) ? null : n;
31
+ }, x = (e) => {
32
+ let n = Math.max(a, Math.min(u, e));
33
+ return s !== void 0 && (n = Number(n.toFixed(s))), n;
34
+ }, i = (e) => {
35
+ if (e === null) {
36
+ o === void 0 && m(null), p?.(null);
37
+ return;
38
+ }
39
+ const n = x(e);
40
+ o === void 0 && m(n), p?.(n);
41
+ }, y = () => {
42
+ if (l) return;
43
+ i((t ?? 0) + d);
44
+ }, g = () => {
45
+ if (l) return;
46
+ i((t ?? 0) - d);
47
+ }, L = (e) => {
48
+ const n = M(e.target.value);
49
+ n !== null ? i(n) : e.target.value === "" && i(null);
50
+ }, $ = (e) => {
51
+ l || (e.key === "ArrowUp" ? (e.preventDefault(), y()) : e.key === "ArrowDown" && (e.preventDefault(), g()));
52
+ }, F = () => {
53
+ t !== null && (t < a || t > u) && i(x(t));
54
+ }, R = [
55
+ "input",
56
+ "input-bordered",
57
+ "w-full",
58
+ c && {
59
+ xs: "input-xs",
60
+ sm: "input-sm",
61
+ md: "input-md",
62
+ lg: "input-lg",
63
+ xl: "input-xl"
64
+ }[c],
65
+ l && "input-disabled",
66
+ v && "pr-8"
67
+ ].filter(Boolean).join(" "), N = c === "xs" || c === "sm" ? "btn-xs" : "btn-sm";
68
+ return /* @__PURE__ */ k("div", { className: `relative ${C ? "w-full" : "inline-block"} group ${w}`, children: [
69
+ /* @__PURE__ */ r(
70
+ "input",
71
+ {
72
+ ref: b,
73
+ type: "text",
74
+ inputMode: "decimal",
75
+ role: "spinbutton",
76
+ "aria-valuemin": a !== -1 / 0 ? a : void 0,
77
+ "aria-valuemax": u !== 1 / 0 ? u : void 0,
78
+ "aria-valuenow": t ?? void 0,
79
+ className: R,
80
+ value: B(t),
81
+ onChange: L,
82
+ onKeyDown: $,
83
+ onBlur: F,
84
+ disabled: l,
85
+ ...D
86
+ }
87
+ ),
88
+ v && /* @__PURE__ */ k("div", { className: "absolute right-1 top-1/2 -translate-y-1/2 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity", children: [
89
+ /* @__PURE__ */ r(
90
+ "button",
91
+ {
92
+ type: "button",
93
+ "aria-label": "Increase value",
94
+ className: `btn ${N} btn-ghost px-1 min-h-0 h-3.5`,
95
+ onClick: y,
96
+ disabled: l || t !== null && t >= u,
97
+ tabIndex: -1,
98
+ children: /* @__PURE__ */ r(
99
+ "svg",
100
+ {
101
+ className: "w-3 h-3",
102
+ fill: "none",
103
+ viewBox: "0 0 24 24",
104
+ stroke: "currentColor",
105
+ "aria-hidden": "true",
106
+ children: /* @__PURE__ */ r(
107
+ "path",
108
+ {
109
+ strokeLinecap: "round",
110
+ strokeLinejoin: "round",
111
+ strokeWidth: 2,
112
+ d: "M5 15l7-7 7 7"
113
+ }
114
+ )
115
+ }
116
+ )
117
+ }
118
+ ),
119
+ /* @__PURE__ */ r(
120
+ "button",
121
+ {
122
+ type: "button",
123
+ "aria-label": "Decrease value",
124
+ className: `btn ${N} btn-ghost px-1 min-h-0 h-3.5`,
125
+ onClick: g,
126
+ disabled: l || t !== null && t <= a,
127
+ tabIndex: -1,
128
+ children: /* @__PURE__ */ r(
129
+ "svg",
130
+ {
131
+ className: "w-3 h-3",
132
+ fill: "none",
133
+ viewBox: "0 0 24 24",
134
+ stroke: "currentColor",
135
+ "aria-hidden": "true",
136
+ children: /* @__PURE__ */ r(
137
+ "path",
138
+ {
139
+ strokeLinecap: "round",
140
+ strokeLinejoin: "round",
141
+ strokeWidth: 2,
142
+ d: "M19 9l-7 7-7-7"
143
+ }
144
+ )
145
+ }
146
+ )
147
+ }
148
+ )
149
+ ] })
150
+ ] });
151
+ }
152
+ );
153
+ H.displayName = "InputNumber";
15
154
  export {
16
- f as Join
155
+ H as InputNumber,
156
+ H as default
17
157
  };
18
158
  //# sourceMappingURL=index43.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index43.js","sources":["../src/components/Join.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface JoinProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n direction?: 'horizontal' | 'vertical'\n}\n\nexport function Join({ children, direction = 'horizontal', className = '', ...rest }: JoinProps) {\n const classes = ['join', direction === 'vertical' && 'join-vertical', className].filter(Boolean).join(' ')\n\n // Automatically add join-item class to all children\n const childrenWithJoinItem = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n const existingClassName = (child.props as any).className || ''\n const newClassName = existingClassName ? `join-item ${existingClassName}` : 'join-item'\n\n return React.cloneElement(child as React.ReactElement<any>, {\n className: newClassName,\n })\n }\n return child\n })\n\n return <div className={classes} {...rest}>{childrenWithJoinItem}</div>\n}\n"],"names":["Join","children","direction","className","rest","classes","childrenWithJoinItem","React","child","existingClassName","newClassName"],"mappings":";;AAOO,SAASA,EAAK,EAAE,UAAAC,GAAU,WAAAC,IAAY,cAAc,WAAAC,IAAY,IAAI,GAAGC,KAAmB;AAC/F,QAAMC,IAAU,CAAC,QAAQH,MAAc,cAAc,iBAAiBC,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAGnGG,IAAuBC,EAAM,SAAS,IAAIN,GAAU,CAACO,MAAU;AACnE,QAAID,EAAM,eAAeC,CAAK,GAAG;AAC/B,YAAMC,IAAqBD,EAAM,MAAc,aAAa,IACtDE,IAAeD,IAAoB,aAAaA,CAAiB,KAAK;AAE5E,aAAOF,EAAM,aAAaC,GAAkC;AAAA,QAC1D,WAAWE;AAAA,MAAA,CACZ;AAAA,IACH;AACA,WAAOF;AAAA,EACT,CAAC;AAED,2BAAQ,OAAA,EAAI,WAAWH,GAAU,GAAGD,GAAO,UAAAE,GAAqB;AAClE;"}
1
+ {"version":3,"file":"index43.js","sources":["../src/components/InputNumber.tsx"],"sourcesContent":["import React, { useState, useRef, forwardRef, useImperativeHandle } from 'react'\n\nexport interface InputNumberProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'onChange' | 'value' | 'defaultValue'> {\n value?: number\n defaultValue?: number\n min?: number\n max?: number\n step?: number\n precision?: number\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n disabled?: boolean\n onChange?: (value: number | null) => void\n formatter?: (value: number | undefined) => string\n parser?: (displayValue: string) => number\n className?: string\n controls?: boolean\n block?: boolean\n}\n\nexport const InputNumber = forwardRef<HTMLInputElement, InputNumberProps>(\n (\n {\n value: controlledValue,\n defaultValue,\n min = -Infinity,\n max = Infinity,\n step = 1,\n precision,\n size,\n disabled = false,\n onChange,\n formatter,\n parser,\n className = '',\n controls = true,\n block = false,\n ...props\n },\n ref\n ) => {\n const [internalValue, setInternalValue] = useState<number | null>(defaultValue ?? null)\n const inputRef = useRef<HTMLInputElement>(null)\n\n useImperativeHandle(ref, () => inputRef.current!)\n\n const value = controlledValue !== undefined ? controlledValue : internalValue\n\n const formatValue = (num: number | null): string => {\n if (num === null) return ''\n let formatted = num\n if (precision !== undefined) {\n formatted = Number(num.toFixed(precision))\n }\n return formatter ? formatter(formatted) : String(formatted)\n }\n\n const parseValue = (str: string): number | null => {\n if (!str) return null\n const parsed = parser ? parser(str) : parseFloat(str)\n if (isNaN(parsed)) return null\n return parsed\n }\n\n const clampValue = (num: number): number => {\n let clamped = Math.max(min, Math.min(max, num))\n if (precision !== undefined) {\n clamped = Number(clamped.toFixed(precision))\n }\n return clamped\n }\n\n const updateValue = (newValue: number | null) => {\n if (newValue === null) {\n if (controlledValue === undefined) {\n setInternalValue(null)\n }\n onChange?.(null)\n return\n }\n\n const clamped = clampValue(newValue)\n if (controlledValue === undefined) {\n setInternalValue(clamped)\n }\n onChange?.(clamped)\n }\n\n const handleIncrement = () => {\n if (disabled) return\n const currentValue = value ?? 0\n updateValue(currentValue + step)\n }\n\n const handleDecrement = () => {\n if (disabled) return\n const currentValue = value ?? 0\n updateValue(currentValue - step)\n }\n\n const handleInputChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const parsed = parseValue(e.target.value)\n if (parsed !== null) {\n updateValue(parsed)\n } else if (e.target.value === '') {\n updateValue(null)\n }\n }\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (disabled) return\n\n if (e.key === 'ArrowUp') {\n e.preventDefault()\n handleIncrement()\n } else if (e.key === 'ArrowDown') {\n e.preventDefault()\n handleDecrement()\n }\n }\n\n const handleBlur = () => {\n // Ensure value is within bounds on blur\n if (value !== null && (value < min || value > max)) {\n updateValue(clampValue(value))\n }\n }\n\n const sizeClasses = {\n xs: 'input-xs',\n sm: 'input-sm',\n md: 'input-md',\n lg: 'input-lg',\n xl: 'input-xl',\n }\n\n const inputClasses = [\n 'input',\n 'input-bordered',\n 'w-full',\n size && sizeClasses[size],\n disabled && 'input-disabled',\n controls && 'pr-8',\n ]\n .filter(Boolean)\n .join(' ')\n\n const buttonSize = size === 'xs' || size === 'sm' ? 'btn-xs' : 'btn-sm'\n\n return (\n <div className={`relative ${block ? 'w-full' : 'inline-block'} group ${className}`}>\n <input\n ref={inputRef}\n type=\"text\"\n inputMode=\"decimal\"\n role=\"spinbutton\"\n aria-valuemin={min !== -Infinity ? min : undefined}\n aria-valuemax={max !== Infinity ? max : undefined}\n aria-valuenow={value ?? undefined}\n className={inputClasses}\n value={formatValue(value)}\n onChange={handleInputChange}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n disabled={disabled}\n {...props}\n />\n {controls && (\n <div className=\"absolute right-1 top-1/2 -translate-y-1/2 flex flex-col gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity\">\n <button\n type=\"button\"\n aria-label=\"Increase value\"\n className={`btn ${buttonSize} btn-ghost px-1 min-h-0 h-3.5`}\n onClick={handleIncrement}\n disabled={disabled || (value !== null && value >= max)}\n tabIndex={-1}\n >\n <svg\n className=\"w-3 h-3\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M5 15l7-7 7 7\"\n />\n </svg>\n </button>\n <button\n type=\"button\"\n aria-label=\"Decrease value\"\n className={`btn ${buttonSize} btn-ghost px-1 min-h-0 h-3.5`}\n onClick={handleDecrement}\n disabled={disabled || (value !== null && value <= min)}\n tabIndex={-1}\n >\n <svg\n className=\"w-3 h-3\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n </button>\n </div>\n )}\n </div>\n )\n }\n)\n\nInputNumber.displayName = 'InputNumber'\n\nexport default InputNumber\n"],"names":["InputNumber","forwardRef","controlledValue","defaultValue","min","max","step","precision","size","disabled","onChange","formatter","parser","className","controls","block","props","ref","internalValue","setInternalValue","useState","inputRef","useRef","useImperativeHandle","value","formatValue","num","formatted","parseValue","str","parsed","clampValue","clamped","updateValue","newValue","handleIncrement","handleDecrement","handleInputChange","handleKeyDown","handleBlur","inputClasses","buttonSize","jsxs","jsx"],"mappings":";;AAmBO,MAAMA,IAAcC;AAAA,EACzB,CACE;AAAA,IACE,OAAOC;AAAA,IACP,cAAAC;AAAA,IACA,KAAAC,IAAM;AAAA,IACN,KAAAC,IAAM;AAAA,IACN,MAAAC,IAAO;AAAA,IACP,WAAAC;AAAA,IACA,MAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,UAAAC,IAAW;AAAA,IACX,OAAAC,IAAQ;AAAA,IACR,GAAGC;AAAA,EAAA,GAELC,MACG;AACH,UAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAwBjB,KAAgB,IAAI,GAChFkB,IAAWC,EAAyB,IAAI;AAE9C,IAAAC,EAAoBN,GAAK,MAAMI,EAAS,OAAQ;AAEhD,UAAMG,IAAQtB,MAAoB,SAAYA,IAAkBgB,GAE1DO,IAAc,CAACC,MAA+B;AAClD,UAAIA,MAAQ,KAAM,QAAO;AACzB,UAAIC,IAAYD;AAChB,aAAInB,MAAc,WAChBoB,IAAY,OAAOD,EAAI,QAAQnB,CAAS,CAAC,IAEpCI,IAAYA,EAAUgB,CAAS,IAAI,OAAOA,CAAS;AAAA,IAC5D,GAEMC,IAAa,CAACC,MAA+B;AACjD,UAAI,CAACA,EAAK,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A,oBACd,gBAAe;AAAA,oBACf,aAAa;AAAA,oBACb,GAAE;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACJ;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,QAEF,gBAAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,cAAW;AAAA,YACX,WAAW,OAAOF,CAAU;AAAA,YAC5B,SAASL;AAAA,YACT,UAAU3B,KAAae,MAAU,QAAQA,KAASpB;AAAA,YAClD,UAAU;AAAA,YAEV,UAAA,gBAAAuC;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,WAAU;AAAA,gBACV,MAAK;AAAA,gBACL,SAAQ;AAAA,gBACR,QAAO;AAAA,gBACP,eAAY;AAAA,gBAEZ,UAAA,gBAAAA;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,eAAc;AAAA,oBACd,gBAAe;AAAA,oBACf,aAAa;AAAA,oBACb,GAAE;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACJ;AAAA,YAAA;AAAA,UACF;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,EAEJ;AACF;AAEA3C,EAAY,cAAc;"}
package/dist/index44.js CHANGED
@@ -1,20 +1,18 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- const k = {
3
- xs: "kbd-xs",
4
- sm: "kbd-sm",
5
- md: "kbd-md",
6
- lg: "kbd-lg",
7
- xl: "kbd-xl"
8
- }, t = ({
9
- size: s,
10
- children: d,
11
- className: l = "",
12
- ...o
13
- }) => {
14
- const b = ["kbd", s ? k[s] : "", l].filter(Boolean).join(" ");
15
- return /* @__PURE__ */ e("kbd", { className: b, ...o, children: d });
16
- };
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import n from "react";
3
+ function f({ children: o, direction: t = "horizontal", className: s = "", ...r }) {
4
+ const a = ["join", t === "vertical" && "join-vertical", s].filter(Boolean).join(" "), l = n.Children.map(o, (e) => {
5
+ if (n.isValidElement(e)) {
6
+ const i = e.props.className || "", m = i ? `join-item ${i}` : "join-item";
7
+ return n.cloneElement(e, {
8
+ className: m
9
+ });
10
+ }
11
+ return e;
12
+ });
13
+ return /* @__PURE__ */ c("div", { className: a, ...r, children: l });
14
+ }
17
15
  export {
18
- t as Kbd
16
+ f as Join
19
17
  };
20
18
  //# sourceMappingURL=index44.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index44.js","sources":["../src/components/Kbd.tsx"],"sourcesContent":["import React from 'react'\n\nexport type KbdSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\nexport interface KbdProps extends React.HTMLAttributes<HTMLElement> {\n /** Size of the kbd */\n size?: KbdSize\n /** Key content */\n children?: React.ReactNode\n}\n\nconst sizeClasses: Record<KbdSize, string> = {\n xs: 'kbd-xs',\n sm: 'kbd-sm',\n md: 'kbd-md',\n lg: 'kbd-lg',\n xl: 'kbd-xl',\n}\n\nexport const Kbd: React.FC<KbdProps> = ({\n size,\n children,\n className = '',\n ...rest\n}) => {\n const classes = ['kbd', size ? sizeClasses[size] : '', className]\n .filter(Boolean)\n .join(' ')\n\n return (\n <kbd className={classes} {...rest}>\n {children}\n </kbd>\n )\n}\n"],"names":["sizeClasses","Kbd","size","children","className","rest","classes"],"mappings":";AAWA,MAAMA,IAAuC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEaC,IAA0B,CAAC;AAAA,EACtC,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAU,CAAC,OAAOJ,IAAOF,EAAYE,CAAI,IAAI,IAAIE,CAAS,EAC7D,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,2BACG,OAAA,EAAI,WAAWE,GAAU,GAAGD,GAC1B,UAAAF,GACH;AAEJ;"}
1
+ {"version":3,"file":"index44.js","sources":["../src/components/Join.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface JoinProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode\n direction?: 'horizontal' | 'vertical'\n}\n\nexport function Join({ children, direction = 'horizontal', className = '', ...rest }: JoinProps) {\n const classes = ['join', direction === 'vertical' && 'join-vertical', className].filter(Boolean).join(' ')\n\n // Automatically add join-item class to all children\n const childrenWithJoinItem = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n const existingClassName = (child.props as any).className || ''\n const newClassName = existingClassName ? `join-item ${existingClassName}` : 'join-item'\n\n return React.cloneElement(child as React.ReactElement<any>, {\n className: newClassName,\n })\n }\n return child\n })\n\n return <div className={classes} {...rest}>{childrenWithJoinItem}</div>\n}\n"],"names":["Join","children","direction","className","rest","classes","childrenWithJoinItem","React","child","existingClassName","newClassName"],"mappings":";;AAOO,SAASA,EAAK,EAAE,UAAAC,GAAU,WAAAC,IAAY,cAAc,WAAAC,IAAY,IAAI,GAAGC,KAAmB;AAC/F,QAAMC,IAAU,CAAC,QAAQH,MAAc,cAAc,iBAAiBC,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,GAGnGG,IAAuBC,EAAM,SAAS,IAAIN,GAAU,CAACO,MAAU;AACnE,QAAID,EAAM,eAAeC,CAAK,GAAG;AAC/B,YAAMC,IAAqBD,EAAM,MAAc,aAAa,IACtDE,IAAeD,IAAoB,aAAaA,CAAiB,KAAK;AAE5E,aAAOF,EAAM,aAAaC,GAAkC;AAAA,QAC1D,WAAWE;AAAA,MAAA,CACZ;AAAA,IACH;AACA,WAAOF;AAAA,EACT,CAAC;AAED,2BAAQ,OAAA,EAAI,WAAWH,GAAU,GAAGD,GAAO,UAAAE,GAAqB;AAClE;"}
package/dist/index45.js CHANGED
@@ -1,24 +1,20 @@
1
- import { jsx as a, jsxs as o } from "react/jsx-runtime";
2
- function c({ children: l, className: n = "", ...s }) {
3
- return /* @__PURE__ */ a("span", { className: `label ${n}`, ...s, children: l });
4
- }
5
- function r({ children: l, label: n, size: s, className: e = "", ...t }) {
6
- const i = ["floating-label", s && {
7
- xs: "input-xs",
8
- sm: "input-sm",
9
- md: "input-md",
10
- lg: "input-lg",
11
- xl: "input-xl"
12
- }[s], e].filter(Boolean).join(" ");
13
- return /* @__PURE__ */ o("label", { className: i, ...t, children: [
14
- l,
15
- /* @__PURE__ */ a("span", { children: n })
16
- ] });
17
- }
18
- const m = Object.assign(c, {
19
- Floating: r
20
- });
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ const k = {
3
+ xs: "kbd-xs",
4
+ sm: "kbd-sm",
5
+ md: "kbd-md",
6
+ lg: "kbd-lg",
7
+ xl: "kbd-xl"
8
+ }, t = ({
9
+ size: s,
10
+ children: d,
11
+ className: l = "",
12
+ ...o
13
+ }) => {
14
+ const b = ["kbd", s ? k[s] : "", l].filter(Boolean).join(" ");
15
+ return /* @__PURE__ */ e("kbd", { className: b, ...o, children: d });
16
+ };
21
17
  export {
22
- m as Label
18
+ t as Kbd
23
19
  };
24
20
  //# sourceMappingURL=index45.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index45.js","sources":["../src/components/Label.tsx"],"sourcesContent":["import React from 'react'\n\nexport interface LabelProps extends React.HTMLAttributes<HTMLSpanElement> {\n children: React.ReactNode\n}\n\nexport interface FloatingLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {\n children: React.ReactNode\n label: string\n size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n}\n\nfunction LabelRoot({ children, className = '', ...rest }: LabelProps) {\n return <span className={`label ${className}`} {...rest}>{children}</span>\n}\n\nfunction FloatingLabel({ children, label, size, className = '', ...rest }: FloatingLabelProps) {\n const sizeClasses = {\n xs: 'input-xs',\n sm: 'input-sm',\n md: 'input-md',\n lg: 'input-lg',\n xl: 'input-xl',\n }\n\n const classes = ['floating-label', size && sizeClasses[size], className].filter(Boolean).join(' ')\n\n return (\n <label className={classes} {...rest}>\n {children}\n <span>{label}</span>\n </label>\n )\n}\n\nexport const Label = Object.assign(LabelRoot, {\n Floating: FloatingLabel,\n})\n"],"names":["LabelRoot","children","className","rest","jsx","FloatingLabel","label","size","classes","jsxs","Label"],"mappings":";AAYA,SAASA,EAAU,EAAE,UAAAC,GAAU,WAAAC,IAAY,IAAI,GAAGC,KAAoB;AACpE,SAAO,gBAAAC,EAAC,UAAK,WAAW,SAASF,CAAS,IAAK,GAAGC,GAAO,UAAAF,GAAS;AACpE;AAEA,SAASI,EAAc,EAAE,UAAAJ,GAAU,OAAAK,GAAO,MAAAC,GAAM,WAAAL,IAAY,IAAI,GAAGC,KAA4B;AAS7F,QAAMK,IAAU,CAAC,kBAAkBD,KARf;AAAA,IAClB,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EAAA,EAGiDA,CAAI,GAAGL,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAEjG,SACE,gBAAAO,EAAC,SAAA,EAAM,WAAWD,GAAU,GAAGL,GAC5B,UAAA;AAAA,IAAAF;AAAA,IACD,gBAAAG,EAAC,UAAM,UAAAE,EAAA,CAAM;AAAA,EAAA,GACf;AAEJ;AAEO,MAAMI,IAAQ,OAAO,OAAOV,GAAW;AAAA,EAC5C,UAAUK;AACZ,CAAC;"}
1
+ {"version":3,"file":"index45.js","sources":["../src/components/Kbd.tsx"],"sourcesContent":["import React from 'react'\n\nexport type KbdSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\n\nexport interface KbdProps extends React.HTMLAttributes<HTMLElement> {\n /** Size of the kbd */\n size?: KbdSize\n /** Key content */\n children?: React.ReactNode\n}\n\nconst sizeClasses: Record<KbdSize, string> = {\n xs: 'kbd-xs',\n sm: 'kbd-sm',\n md: 'kbd-md',\n lg: 'kbd-lg',\n xl: 'kbd-xl',\n}\n\nexport const Kbd: React.FC<KbdProps> = ({\n size,\n children,\n className = '',\n ...rest\n}) => {\n const classes = ['kbd', size ? sizeClasses[size] : '', className]\n .filter(Boolean)\n .join(' ')\n\n return (\n <kbd className={classes} {...rest}>\n {children}\n </kbd>\n )\n}\n"],"names":["sizeClasses","Kbd","size","children","className","rest","classes"],"mappings":";AAWA,MAAMA,IAAuC;AAAA,EAC3C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEaC,IAA0B,CAAC;AAAA,EACtC,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,MAAM;AACJ,QAAMC,IAAU,CAAC,OAAOJ,IAAOF,EAAYE,CAAI,IAAI,IAAIE,CAAS,EAC7D,OAAO,OAAO,EACd,KAAK,GAAG;AAEX,2BACG,OAAA,EAAI,WAAWE,GAAU,GAAGD,GAC1B,UAAAF,GACH;AAEJ;"}
package/dist/index86.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
2
  import { useState as a, useRef as Y, useEffect as j } from "react";
3
- import { Input as _ } from "./index41.js";
3
+ import { Input as _ } from "./index42.js";
4
4
  function q(t, N = "24", p = !1) {
5
5
  if (!t) return "";
6
6
  let n = t.getHours();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asterui",
3
- "version": "0.12.15",
3
+ "version": "0.12.17",
4
4
  "description": "React UI component library with DaisyUI",
5
5
  "homepage": "https://asterui.com",
6
6
  "repository": {
@@ -1,15 +0,0 @@
1
- import { default as React } from 'react';
2
- export interface LabelProps extends React.HTMLAttributes<HTMLSpanElement> {
3
- children: React.ReactNode;
4
- }
5
- export interface FloatingLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
6
- children: React.ReactNode;
7
- label: string;
8
- size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
- }
10
- declare function LabelRoot({ children, className, ...rest }: LabelProps): import("react/jsx-runtime").JSX.Element;
11
- declare function FloatingLabel({ children, label, size, className, ...rest }: FloatingLabelProps): import("react/jsx-runtime").JSX.Element;
12
- export declare const Label: typeof LabelRoot & {
13
- Floating: typeof FloatingLabel;
14
- };
15
- export {};