asheeui 0.6.3 → 0.6.6
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/accordion/Accordion.js +10 -10
- package/dist/components/autocomplete/Autocomplete.d.ts +8 -0
- package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/Autocomplete.js +120 -118
- package/dist/components/autocomplete/autocomplete-config.d.ts +29 -3
- package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-config.js +14 -6
- package/dist/components/date-picker/DatePicker.d.ts +20 -0
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +230 -229
- package/dist/components/date-picker/date-picker-config.d.ts +16 -0
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +14 -10
- package/dist/components/keyboard/OnScreenKeyboard.d.ts +16 -6
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +96 -90
- package/dist/components/keyboard/index.js +1 -0
- package/dist/components/keyboard/keyboard-config.d.ts +27 -1
- package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
- package/dist/components/keyboard/keyboard-config.js +12 -8
- package/dist/components/keyboard/keyboard-context.d.ts +4 -7
- package/dist/components/keyboard/keyboard-context.d.ts.map +1 -1
- package/dist/components/keyboard/keyboard-context.js +61 -58
- package/dist/components/keyboard/keyboard-styles.d.ts +13 -0
- package/dist/components/keyboard/keyboard-styles.d.ts.map +1 -0
- package/dist/components/keyboard/keyboard-styles.js +14 -0
- package/dist/components/multi-select/MultiSelect.d.ts +8 -0
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +186 -184
- package/dist/components/multi-select/multi-select-config.d.ts +18 -0
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +14 -10
- package/dist/components/resizable-screen/ResizableScreen.d.ts +23 -11
- package/dist/components/resizable-screen/ResizableScreen.d.ts.map +1 -1
- package/dist/components/resizable-screen/ResizableScreen.js +69 -60
- package/dist/components/select/Select.d.ts +8 -6
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +135 -135
- package/dist/components/select/select-config.d.ts +27 -1
- package/dist/components/select/select-config.d.ts.map +1 -1
- package/dist/components/select/select-config.js +14 -6
- package/dist/components/select-menu/SelectMenu.d.ts +23 -1
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +72 -67
- package/dist/components/select-menu/index.d.ts +1 -0
- package/dist/components/select-menu/index.d.ts.map +1 -1
- package/dist/components/select-menu/index.js +1 -0
- package/dist/components/select-menu/select-menu-config.d.ts +1 -1
- package/dist/components/select-menu/select-menu-config.js +3 -3
- package/dist/components/select-menu/use-select-floating.d.ts +95 -0
- package/dist/components/select-menu/use-select-floating.d.ts.map +1 -0
- package/dist/components/select-menu/use-select-floating.js +36 -0
- package/dist/components/toast/toast-config.d.ts +11 -0
- package/dist/components/toast/toast-config.d.ts.map +1 -1
- package/dist/components/toast/toast-config.js +4 -2
- package/dist/components/toast/toast-context.d.ts +21 -1
- package/dist/components/toast/toast-context.d.ts.map +1 -1
- package/dist/components/toast/toast-context.js +134 -114
- package/dist/components/tooltip/Tooltip.d.ts +19 -0
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +129 -121
- package/dist/components/tooltip/tooltip-config.d.ts +7 -3
- package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip-config.js +5 -4
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/utils/merge-object.d.ts +7 -1
- package/dist/utils/merge-object.d.ts.map +1 -1
- package/dist/utils/types.d.ts +16 -4
- package/dist/utils/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -25,6 +25,22 @@ export interface DatePickerConfig extends FieldConfig {
|
|
|
25
25
|
* @default "date"
|
|
26
26
|
*/
|
|
27
27
|
mode?: PickerMode;
|
|
28
|
+
/**
|
|
29
|
+
* Whether to render the calendar popover in a React portal.
|
|
30
|
+
* When true, the popover is rendered at the document body level,
|
|
31
|
+
* escaping any parent DOM hierarchy. This prevents CSS containment
|
|
32
|
+
* and stacking context issues. Defaults to true because popovers
|
|
33
|
+
* should always appear above other content.
|
|
34
|
+
*
|
|
35
|
+
* @default true
|
|
36
|
+
*/
|
|
37
|
+
portal?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Custom portal target element for the calendar popover.
|
|
40
|
+
* When portal is enabled, the popover is rendered into this element.
|
|
41
|
+
* Defaults to document.body.
|
|
42
|
+
*/
|
|
43
|
+
portalTarget?: HTMLElement | null;
|
|
28
44
|
}
|
|
29
45
|
/**
|
|
30
46
|
* Default config values registered for the DatePicker component.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker-config.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"date-picker-config.d.ts","sourceRoot":"","sources":["../../../src/components/date-picker/date-picker-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;;OAKG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAKrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAAC,gBAAgB,CAKzD,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,UAAU,EAAE,gBAAgB,CAAC;KAC9B;CACF"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { registerComponentDefaults as
|
|
3
|
-
import { FALLBACK_FIELD_CONFIG as
|
|
4
|
-
const
|
|
2
|
+
import { registerComponentDefaults as t } from "../../libs/registry.js";
|
|
3
|
+
import { FALLBACK_FIELD_CONFIG as e, defaultFieldConfig as o } from "../field/field-config.js";
|
|
4
|
+
const r = {
|
|
5
5
|
...o,
|
|
6
|
-
mode: "date"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
mode: "date",
|
|
7
|
+
portal: !0,
|
|
8
|
+
portalTarget: null
|
|
9
|
+
}, i = {
|
|
10
|
+
...e,
|
|
11
|
+
mode: "date",
|
|
12
|
+
portal: !0,
|
|
13
|
+
portalTarget: null
|
|
10
14
|
};
|
|
11
|
-
|
|
15
|
+
t("datePicker", r);
|
|
12
16
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
i as FALLBACK_DATE_PICKER_CONFIG,
|
|
18
|
+
r as defaultDatePickerConfig
|
|
15
19
|
};
|
|
@@ -16,10 +16,11 @@ export interface OnScreenKeyboardProps extends KeyboardConfig {
|
|
|
16
16
|
*/
|
|
17
17
|
keyClassName?: string;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* Whether to render the keyboard in a Floating UI portal.
|
|
20
|
+
* When true, the keyboard is rendered at the document body level.
|
|
21
|
+
* Defaults to true.
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
+
portal?: boolean;
|
|
23
24
|
}
|
|
24
25
|
/**
|
|
25
26
|
* The on-screen virtual keyboard UI.
|
|
@@ -34,14 +35,23 @@ export interface OnScreenKeyboardProps extends KeyboardConfig {
|
|
|
34
35
|
* placed inside a KeyboardProvider. It automatically shows and hides
|
|
35
36
|
* based on the context state.
|
|
36
37
|
*
|
|
38
|
+
* By default, the keyboard uses FloatingPortal to render at the document
|
|
39
|
+
* body level. This ensures the keyboard appears at the bottom of the screen
|
|
40
|
+
* regardless of where the input is in the DOM tree, escaping CSS containment,
|
|
41
|
+
* overflow clipping, and stacking context issues. The portal can be disabled
|
|
42
|
+
* via the `portal` prop or `components.keyboard.portal` in the config if the
|
|
43
|
+
* keyboard needs to stay within a specific parent container.
|
|
44
|
+
*
|
|
37
45
|
* @param props - OnScreenKeyboard configuration options.
|
|
38
46
|
* @param props.className - Extra CSS classes for the container.
|
|
39
|
-
* @param props.heightClass - CSS height class for the keyboard.
|
|
47
|
+
* @param props.heightClass - CSS height class for the keyboard (deprecated).
|
|
48
|
+
* @param props.size - Size scale for keyboard keys. Defaults to "md".
|
|
40
49
|
* @param props.initialLayout - Initial layout name.
|
|
41
50
|
* @param props.keyClassName - Extra CSS classes for keys.
|
|
42
51
|
* @param props.variant - Visual variant for keys.
|
|
43
52
|
* @param props.color - Theme color for keys.
|
|
44
53
|
* @param props.radius - Corner rounding for keys.
|
|
54
|
+
* @param props.portal - Whether to render the keyboard in a portal. Defaults to true.
|
|
45
55
|
*
|
|
46
56
|
* @example
|
|
47
57
|
* ```tsx
|
|
@@ -49,7 +59,7 @@ export interface OnScreenKeyboardProps extends KeyboardConfig {
|
|
|
49
59
|
*
|
|
50
60
|
* export function App() {
|
|
51
61
|
* return (
|
|
52
|
-
* <KeyboardProvider
|
|
62
|
+
* <KeyboardProvider size="lg">
|
|
53
63
|
* <Input label="Search" enableVirtualKeyboard />
|
|
54
64
|
* <OnScreenKeyboard />
|
|
55
65
|
* </KeyboardProvider>
|
|
@@ -60,5 +70,5 @@ export interface OnScreenKeyboardProps extends KeyboardConfig {
|
|
|
60
70
|
* @see KeyboardProvider - The provider that controls the keyboard state.
|
|
61
71
|
* @see useKeyboardField - Hook for connecting inputs to the keyboard.
|
|
62
72
|
*/
|
|
63
|
-
export declare function OnScreenKeyboard({ className,
|
|
73
|
+
export declare function OnScreenKeyboard({ className, initialLayout, size: sizeProp, variant: variantProp, color: colorProp, radius: radiusProp, keyClassName, portal: portalProp, }: OnScreenKeyboardProps): import("react").JSX.Element | null;
|
|
64
74
|
//# sourceMappingURL=OnScreenKeyboard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OnScreenKeyboard.d.ts","sourceRoot":"","sources":["../../../src/components/keyboard/OnScreenKeyboard.tsx"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"OnScreenKeyboard.d.ts","sourceRoot":"","sources":["../../../src/components/keyboard/OnScreenKeyboard.tsx"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AA2E3B;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC;IAE3B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,SAAS,EACT,aAAa,EACb,IAAI,EAAE,QAAQ,EACd,OAAO,EAAE,WAAW,EACpB,KAAK,EAAE,SAAS,EAChB,MAAM,EAAE,UAAU,EAClB,YAAY,EACZ,MAAM,EAAE,UAAU,GACnB,EAAE,qBAAqB,sCAsOvB"}
|
|
@@ -1,160 +1,166 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as y } from "react/jsx-runtime";
|
|
3
|
-
import { FloatingPortal as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useAsheeConfig as
|
|
6
|
-
import { Button as
|
|
7
|
-
import { FALLBACK_KEYBOARD_CONFIG as
|
|
8
|
-
import { useKeyboard as
|
|
9
|
-
import {
|
|
10
|
-
|
|
3
|
+
import { FloatingPortal as X } from "@floating-ui/react";
|
|
4
|
+
import { useState as E, useEffect as N, useMemo as J, useCallback as z } from "react";
|
|
5
|
+
import { useAsheeConfig as Q } from "../../libs/context.js";
|
|
6
|
+
import { Button as ee } from "../button/Button.js";
|
|
7
|
+
import { FALLBACK_KEYBOARD_CONFIG as w } from "./keyboard-config.js";
|
|
8
|
+
import { useKeyboard as re } from "./keyboard-context.js";
|
|
9
|
+
import { KEYBOARD_KEY_SIZE_CLASS as te, KEYBOARD_SIZE_CLASS as se } from "./keyboard-styles.js";
|
|
10
|
+
import { cn as P } from "../../utils/cn.js";
|
|
11
|
+
function oe(e) {
|
|
11
12
|
return e === "{space}" ? "flex-[4]" : ["{bksp}", "{enter}", "{shift}", "{symbols}", "{abc}", "{clear}"].includes(
|
|
12
13
|
e
|
|
13
14
|
) ? "flex-[1.6]" : "flex-1";
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
-
var
|
|
17
|
-
const m = Object.getPrototypeOf(e),
|
|
18
|
-
|
|
16
|
+
function _(e, s, i) {
|
|
17
|
+
var C;
|
|
18
|
+
const m = Object.getPrototypeOf(e), K = (C = Object.getOwnPropertyDescriptor(m, "value")) == null ? void 0 : C.set;
|
|
19
|
+
K ? K.call(e, s) : e.value = s, e.dispatchEvent(new Event("input", { bubbles: !0 })), requestAnimationFrame(() => {
|
|
19
20
|
e.focus(), e.setSelectionRange(i, i);
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
24
|
-
value: e.slice(0,
|
|
25
|
-
cursor:
|
|
23
|
+
function ne(e, s, i) {
|
|
24
|
+
return s !== i ? { value: e.slice(0, s) + e.slice(i), cursor: s } : s === 0 ? { value: e, cursor: 0 } : {
|
|
25
|
+
value: e.slice(0, s - 1) + e.slice(i),
|
|
26
|
+
cursor: s - 1
|
|
26
27
|
};
|
|
27
28
|
}
|
|
28
29
|
function T(e) {
|
|
29
|
-
return (
|
|
30
|
-
value:
|
|
30
|
+
return (s, i, m) => ({
|
|
31
|
+
value: s.slice(0, i) + e + s.slice(m),
|
|
31
32
|
cursor: i + e.length
|
|
32
33
|
});
|
|
33
34
|
}
|
|
34
|
-
function
|
|
35
|
+
function me({
|
|
35
36
|
className: e,
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
initialLayout: s,
|
|
38
|
+
size: i,
|
|
38
39
|
variant: m,
|
|
39
|
-
color:
|
|
40
|
-
radius:
|
|
41
|
-
keyClassName:
|
|
40
|
+
color: K,
|
|
41
|
+
radius: C,
|
|
42
|
+
keyClassName: $,
|
|
43
|
+
portal: j
|
|
42
44
|
}) {
|
|
43
|
-
const
|
|
44
|
-
if (!
|
|
45
|
-
const { isOpen: h, activeElement: n, config:
|
|
46
|
-
|
|
47
|
-
), [
|
|
48
|
-
|
|
49
|
-
h &&
|
|
50
|
-
}, [h,
|
|
51
|
-
const
|
|
52
|
-
id: `${u}-row-${
|
|
53
|
-
keys:
|
|
54
|
-
id: `${u}-r${
|
|
45
|
+
const L = re();
|
|
46
|
+
if (!L) return null;
|
|
47
|
+
const { isOpen: h, activeElement: n, config: c, forceClose: A } = L, R = Q(), v = c.layouts ?? {}, F = c.display ?? {}, a = c.defaultLayout ?? w.defaultLayout, x = i ?? c.size ?? w.size, H = se[x], M = m ?? c.variant ?? R.defaultVariant ?? w.variant, Y = K ?? c.color ?? R.defaultColor ?? w.color, I = C ?? c.radius, V = j ?? c.portal ?? w.portal, Z = te[x], [u, b] = E(
|
|
48
|
+
s ?? a
|
|
49
|
+
), [q, O] = E(/* @__PURE__ */ new Set()), [G, k] = E(null);
|
|
50
|
+
N(() => {
|
|
51
|
+
h && b(s ?? a);
|
|
52
|
+
}, [h, s, a]);
|
|
53
|
+
const U = J(() => (v[u] || v[a] || []).map((l, r) => ({
|
|
54
|
+
id: `${u}-row-${r}`,
|
|
55
|
+
keys: l.split(" ").map((f, d) => ({
|
|
56
|
+
id: `${u}-r${r}-k${d}-${f}`,
|
|
55
57
|
token: f
|
|
56
58
|
}))
|
|
57
|
-
})), [
|
|
58
|
-
|
|
59
|
+
})), [v, u, a]);
|
|
60
|
+
N(() => {
|
|
59
61
|
if (!h) return;
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
|
|
62
|
+
const l = (v[u] || []).join(" ").split(" "), r = (o) => o === "Backspace" ? "{bksp}" : o === "Enter" ? "{enter}" : o === " " ? "{space}" : o === "Shift" ? "{shift}" : o.length === 1 && l.includes(o) ? o : null, f = (o) => {
|
|
63
|
+
if (o.key === "Escape") {
|
|
64
|
+
A();
|
|
63
65
|
return;
|
|
64
66
|
}
|
|
65
|
-
const p =
|
|
66
|
-
p &&
|
|
67
|
-
}, d = (
|
|
68
|
-
const p =
|
|
69
|
-
p &&
|
|
70
|
-
const
|
|
71
|
-
return
|
|
67
|
+
const p = r(o.key);
|
|
68
|
+
p && O((S) => new Set(S).add(p));
|
|
69
|
+
}, d = (o) => {
|
|
70
|
+
const p = r(o.key);
|
|
71
|
+
p && O((S) => {
|
|
72
|
+
const D = new Set(S);
|
|
73
|
+
return D.delete(p), D;
|
|
72
74
|
});
|
|
73
75
|
};
|
|
74
76
|
return window.addEventListener("keydown", f), window.addEventListener("keyup", d), () => {
|
|
75
77
|
window.removeEventListener("keydown", f), window.removeEventListener("keyup", d);
|
|
76
78
|
};
|
|
77
|
-
}, [h, u,
|
|
78
|
-
const
|
|
79
|
-
(
|
|
79
|
+
}, [h, u, v, A]);
|
|
80
|
+
const g = z(
|
|
81
|
+
(t) => {
|
|
80
82
|
if (!n) return;
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
+
const l = n.value, r = n.selectionStart ?? l.length, f = n.selectionEnd ?? l.length, { value: d, cursor: o } = t(l, r, f);
|
|
84
|
+
_(n, d, o);
|
|
83
85
|
},
|
|
84
86
|
[n]
|
|
85
|
-
),
|
|
86
|
-
(
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
(
|
|
87
|
+
), W = z(
|
|
88
|
+
(t) => {
|
|
89
|
+
if (t === "{shift}") {
|
|
90
|
+
b(
|
|
91
|
+
(r) => r === "shift" ? a : r === a ? "shift" : r
|
|
90
92
|
);
|
|
91
93
|
return;
|
|
92
94
|
}
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
+
if (t === "{symbols}") {
|
|
96
|
+
b("symbols");
|
|
95
97
|
return;
|
|
96
98
|
}
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
+
if (t === "{abc}") {
|
|
100
|
+
b(a);
|
|
99
101
|
return;
|
|
100
102
|
}
|
|
101
|
-
if (
|
|
102
|
-
n &&
|
|
103
|
+
if (t === "{clear}") {
|
|
104
|
+
n && _(n, "", 0);
|
|
103
105
|
return;
|
|
104
106
|
}
|
|
105
|
-
if (
|
|
106
|
-
(n == null ? void 0 : n.tagName) === "TEXTAREA" ?
|
|
107
|
+
if (t === "{enter}") {
|
|
108
|
+
(n == null ? void 0 : n.tagName) === "TEXTAREA" ? g(T(`
|
|
107
109
|
`)) : n == null || n.blur();
|
|
108
110
|
return;
|
|
109
111
|
}
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
+
if (t === "{bksp}") {
|
|
113
|
+
g(ne);
|
|
112
114
|
return;
|
|
113
115
|
}
|
|
114
|
-
|
|
116
|
+
g(T(t === "{space}" ? " " : t)), u === "shift" && c.autoShiftBack && b(a);
|
|
115
117
|
},
|
|
116
|
-
[n,
|
|
118
|
+
[n, g, u, c.autoShiftBack, a]
|
|
117
119
|
);
|
|
118
|
-
|
|
120
|
+
if (!h) return null;
|
|
121
|
+
const B = /* @__PURE__ */ y(
|
|
119
122
|
"section",
|
|
120
123
|
{
|
|
121
124
|
"aria-label": "Virtual Keyboard",
|
|
122
125
|
className: "fixed inset-x-0 bottom-0 z-9999 pointer-events-auto",
|
|
123
|
-
onMouseDown: (
|
|
126
|
+
onMouseDown: (t) => t.preventDefault(),
|
|
124
127
|
children: /* @__PURE__ */ y(
|
|
125
128
|
"div",
|
|
126
129
|
{
|
|
127
|
-
className:
|
|
130
|
+
className: P(
|
|
128
131
|
"w-full bg-background border-t border-border shadow-2xl flex flex-col select-none",
|
|
129
|
-
|
|
132
|
+
H,
|
|
130
133
|
e
|
|
131
134
|
),
|
|
132
|
-
children: /* @__PURE__ */ y("div", { className: "flex flex-col gap-1.5 p-2 flex-1 min-h-0", children:
|
|
133
|
-
const
|
|
135
|
+
children: /* @__PURE__ */ y("div", { className: "flex flex-col gap-1.5 p-2 flex-1 min-h-0", children: U.map((t) => /* @__PURE__ */ y("div", { className: "flex gap-1.5 flex-1", children: t.keys.map(({ id: l, token: r }) => {
|
|
136
|
+
const o = q.has(r) || G === r, p = F[r] ?? r;
|
|
134
137
|
return /* @__PURE__ */ y(
|
|
135
|
-
|
|
138
|
+
ee,
|
|
136
139
|
{
|
|
137
|
-
variant:
|
|
138
|
-
color:
|
|
139
|
-
radius:
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
variant: M,
|
|
141
|
+
color: o ? Y : "secondary",
|
|
142
|
+
radius: I,
|
|
143
|
+
size: x,
|
|
144
|
+
onClick: () => W(r),
|
|
145
|
+
onMouseEnter: () => k(r),
|
|
146
|
+
onMouseLeave: () => k(null),
|
|
147
|
+
className: P(
|
|
148
|
+
"font-medium p-0 flex items-center justify-center",
|
|
149
|
+
Z,
|
|
150
|
+
oe(r),
|
|
146
151
|
$
|
|
147
152
|
),
|
|
148
153
|
children: p
|
|
149
154
|
},
|
|
150
|
-
|
|
155
|
+
l
|
|
151
156
|
);
|
|
152
|
-
}) },
|
|
157
|
+
}) }, t.id)) })
|
|
153
158
|
}
|
|
154
159
|
)
|
|
155
160
|
}
|
|
156
|
-
)
|
|
161
|
+
);
|
|
162
|
+
return V ? /* @__PURE__ */ y(X, { children: B }) : B;
|
|
157
163
|
}
|
|
158
164
|
export {
|
|
159
|
-
|
|
165
|
+
me as OnScreenKeyboard
|
|
160
166
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Color, Radius, Variant } from '../../shared';
|
|
2
|
+
import { Color, Radius, Size, Variant } from '../../shared';
|
|
3
3
|
/**
|
|
4
4
|
* Standard layout names for the virtual keyboard.
|
|
5
5
|
* - `default`: Lowercase alphabetic layout.
|
|
@@ -13,6 +13,12 @@ export type StandardLayoutName = "default" | "shift" | "symbols" | "numeric";
|
|
|
13
13
|
* Can be either a StandardLayoutName or a custom string identifier.
|
|
14
14
|
*/
|
|
15
15
|
export type LayoutName = StandardLayoutName | (string & {});
|
|
16
|
+
/**
|
|
17
|
+
* Size key for the keyboard.
|
|
18
|
+
* Maps to the standard Size type: "sm", "md", or "lg".
|
|
19
|
+
* Controls the height, font size, and padding of keyboard keys.
|
|
20
|
+
*/
|
|
21
|
+
export type KeyboardSizeKey = Size;
|
|
16
22
|
/**
|
|
17
23
|
* Mapping of layout names to arrays of row strings.
|
|
18
24
|
* Each row string contains space-separated key tokens.
|
|
@@ -55,6 +61,13 @@ export interface KeyboardConfig {
|
|
|
55
61
|
* @default true
|
|
56
62
|
*/
|
|
57
63
|
autoShiftBack?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Size scale for keyboard keys.
|
|
66
|
+
* Controls the height, font size, and padding of individual keys.
|
|
67
|
+
*
|
|
68
|
+
* @default "md"
|
|
69
|
+
*/
|
|
70
|
+
size?: KeyboardSizeKey;
|
|
58
71
|
/**
|
|
59
72
|
* Visual style variant for keyboard keys.
|
|
60
73
|
* @default "solid"
|
|
@@ -69,6 +82,17 @@ export interface KeyboardConfig {
|
|
|
69
82
|
* Corner rounding for keyboard keys.
|
|
70
83
|
*/
|
|
71
84
|
radius?: Radius;
|
|
85
|
+
/**
|
|
86
|
+
* Whether to render the keyboard in a Floating UI portal.
|
|
87
|
+
* When true, the keyboard is rendered at the document body level,
|
|
88
|
+
* escaping any parent DOM hierarchy. This prevents CSS containment,
|
|
89
|
+
* overflow clipping, and stacking context issues. Defaults to true
|
|
90
|
+
* because the keyboard should always appear at the bottom of the screen
|
|
91
|
+
* above all other content.
|
|
92
|
+
*
|
|
93
|
+
* @default true
|
|
94
|
+
*/
|
|
95
|
+
portal?: boolean;
|
|
72
96
|
}
|
|
73
97
|
/**
|
|
74
98
|
* Default keyboard layouts.
|
|
@@ -97,7 +121,9 @@ declare module "../../libs/registry" {
|
|
|
97
121
|
*/
|
|
98
122
|
export declare const FALLBACK_KEYBOARD_CONFIG: {
|
|
99
123
|
defaultLayout: string;
|
|
124
|
+
size: KeyboardSizeKey;
|
|
100
125
|
variant: Variant;
|
|
101
126
|
color: Color;
|
|
127
|
+
portal: boolean;
|
|
102
128
|
};
|
|
103
129
|
//# sourceMappingURL=keyboard-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-config.d.ts","sourceRoot":"","sources":["../../../src/components/keyboard/keyboard-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"keyboard-config.d.ts","sourceRoot":"","sources":["../../../src/components/keyboard/keyboard-config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7E;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,kBAAkB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC;AAEnC;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;AAEvD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAE1B;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;OAGG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC;IAE3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,eAAe,CAAC;IAEvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAAE,eAuBpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAQ/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAQnC,CAAC;AAEF,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,QAAQ,EAAE,cAAc,CAAC;KAC1B;CACF;AAID;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;UAErB,eAAe;aACT,OAAO;WACP,KAAK;;CAE1B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
|
-
const
|
|
3
|
+
const t = {
|
|
4
4
|
default: [
|
|
5
5
|
"1 2 3 4 5 6 7 8 9 0 {bksp}",
|
|
6
6
|
"q w e r t y u i o p",
|
|
@@ -23,7 +23,7 @@ const s = {
|
|
|
23
23
|
"{abc} , {space} . {enter}"
|
|
24
24
|
],
|
|
25
25
|
numeric: ["1 2 3 {bksp}", "4 5 6 {clear}", "7 8 9 {enter}", "0 . {space}"]
|
|
26
|
-
},
|
|
26
|
+
}, s = {
|
|
27
27
|
"{bksp}": "⌫",
|
|
28
28
|
"{enter}": "↵",
|
|
29
29
|
"{shift}": "⇧",
|
|
@@ -32,21 +32,25 @@ const s = {
|
|
|
32
32
|
"{space}": "space",
|
|
33
33
|
"{clear}": "C"
|
|
34
34
|
}, a = {
|
|
35
|
-
layouts:
|
|
36
|
-
display:
|
|
35
|
+
layouts: t,
|
|
36
|
+
display: s,
|
|
37
37
|
defaultLayout: "default",
|
|
38
38
|
closeDelay: 500,
|
|
39
|
-
autoShiftBack: !0
|
|
39
|
+
autoShiftBack: !0,
|
|
40
|
+
size: "md",
|
|
41
|
+
portal: !0
|
|
40
42
|
};
|
|
41
43
|
e("keyboard", a);
|
|
42
44
|
const l = {
|
|
43
45
|
defaultLayout: "default",
|
|
46
|
+
size: "md",
|
|
44
47
|
variant: "solid",
|
|
45
|
-
color: "primary"
|
|
48
|
+
color: "primary",
|
|
49
|
+
portal: !0
|
|
46
50
|
};
|
|
47
51
|
export {
|
|
48
52
|
l as FALLBACK_KEYBOARD_CONFIG,
|
|
49
|
-
|
|
53
|
+
s as defaultKeyDisplay,
|
|
50
54
|
a as defaultKeyboardConfig,
|
|
51
|
-
|
|
55
|
+
t as defaultKeyboardLayouts
|
|
52
56
|
};
|
|
@@ -59,10 +59,6 @@ export interface KeyboardProviderProps extends KeyboardConfig {
|
|
|
59
59
|
* @default "default"
|
|
60
60
|
*/
|
|
61
61
|
defaultLayout?: LayoutName;
|
|
62
|
-
/**
|
|
63
|
-
* CSS height class for the keyboard container.
|
|
64
|
-
*/
|
|
65
|
-
heightClass?: string;
|
|
66
62
|
}
|
|
67
63
|
/**
|
|
68
64
|
* Provider component for the virtual keyboard.
|
|
@@ -77,12 +73,13 @@ export interface KeyboardProviderProps extends KeyboardConfig {
|
|
|
77
73
|
* @param props.layouts - Available keyboard layouts.
|
|
78
74
|
* @param props.display - Display mappings for special keys.
|
|
79
75
|
* @param props.defaultLayout - Default layout name. Defaults to "default".
|
|
80
|
-
* @param props.
|
|
76
|
+
* @param props.size - Size scale for keyboard keys. Defaults to "md".
|
|
81
77
|
* @param props.autoShiftBack - Auto switch back from shift. Defaults to true.
|
|
82
78
|
* @param props.closeDelay - Close delay in milliseconds. Defaults to 120.
|
|
83
79
|
* @param props.variant - Visual variant for keys.
|
|
84
80
|
* @param props.color - Theme color for keys.
|
|
85
81
|
* @param props.radius - Corner rounding for keys.
|
|
82
|
+
* @param props.portal - Whether to render the keyboard in a portal. Defaults to true.
|
|
86
83
|
*
|
|
87
84
|
* @example
|
|
88
85
|
* ```tsx
|
|
@@ -90,7 +87,7 @@ export interface KeyboardProviderProps extends KeyboardConfig {
|
|
|
90
87
|
*
|
|
91
88
|
* export function App() {
|
|
92
89
|
* return (
|
|
93
|
-
* <KeyboardProvider
|
|
90
|
+
* <KeyboardProvider size="lg">
|
|
94
91
|
* <Input
|
|
95
92
|
* label="Search"
|
|
96
93
|
* enableVirtualKeyboard
|
|
@@ -104,7 +101,7 @@ export interface KeyboardProviderProps extends KeyboardConfig {
|
|
|
104
101
|
* @see useKeyboard - Hook for accessing the keyboard context.
|
|
105
102
|
* @see OnScreenKeyboard - The keyboard UI component.
|
|
106
103
|
*/
|
|
107
|
-
export declare function KeyboardProvider({ children, layouts, display, defaultLayout,
|
|
104
|
+
export declare function KeyboardProvider({ children, layouts, display, defaultLayout, size, autoShiftBack, closeDelay, variant, color, radius, portal: portalProp, }: KeyboardProviderProps): import("react").JSX.Element;
|
|
108
105
|
/**
|
|
109
106
|
* Hook for accessing the keyboard context.
|
|
110
107
|
* Must be used within a KeyboardProvider.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-context.d.ts","sourceRoot":"","sources":["../../../src/components/keyboard/keyboard-context.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,cAAc,EAEnB,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,aAAa,EAAE,eAAe,GAAG,IAAI,CAAC;IAEtC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IAEvB;;;;OAIG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,KAAK,IAAI,CAAC;IAExD;;;;OAIG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC;;OAEG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,qDAAkD,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"keyboard-context.d.ts","sourceRoot":"","sources":["../../../src/components/keyboard/keyboard-context.tsx"],"names":[],"mappings":"AASA,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAEf,OAAO,EAEL,KAAK,cAAc,EAEnB,KAAK,UAAU,EAChB,MAAM,mBAAmB,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;OAEG;IACH,aAAa,EAAE,eAAe,GAAG,IAAI,CAAC;IAEtC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAC;IAEvB;;;;OAIG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,KAAK,IAAI,CAAC;IAExD;;;;OAIG;IACH,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAEnC;;OAEG;IACH,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,qDAAkD,CAAC;AAE/E;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;OAGG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,OAAO,EACP,aAAa,EACb,IAAI,EACJ,aAAa,EACb,UAAgB,EAChB,OAAO,EACP,KAAK,EACL,MAAM,EACN,MAAM,EAAE,UAAU,GACnB,EAAE,qBAAqB,+BAwHvB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,wBAM1B"}
|