@nucleux/kbd 0.0.0-stage → 0.7.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/LICENSE +21 -0
- package/README.md +37 -2
- package/dist/index.cjs +50 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nucleux
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nucleux/kbd
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Keyboard key and shortcut display — Nucleux agentic UI for React.
|
|
4
|
+
|
|
5
|
+
Part of **[Nucleux](https://github.com/intelligaia-open-labs/nucleux)** — agentic UI components for React. Install a single component, or the full kit via [`@nucleux/react`](https://www.npmjs.com/package/@nucleux/react).
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
## Exports
|
|
9
|
+
|
|
10
|
+
- **`Kbd`** — a single key (`<kbd>`), e.g. `Esc`, `⌘`
|
|
11
|
+
- **`KbdGroup`** — a key combination wrapping several `Kbd`s
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pnpm add @nucleux/kbd @nucleux/tokens
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`react` / `react-dom` are peer dependencies.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import { Kbd, KbdGroup } from "@nucleux/kbd";
|
|
25
|
+
|
|
26
|
+
<KbdGroup>
|
|
27
|
+
<Kbd>Ctrl</Kbd>
|
|
28
|
+
<span>+</span>
|
|
29
|
+
<Kbd>K</Kbd>
|
|
30
|
+
</KbdGroup>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Requires the theme once in your app: `import "@nucleux/tokens/styles.css";`
|
|
34
|
+
and the Tailwind preset from `@nucleux/tokens/preset`.
|
|
35
|
+
|
|
36
|
+
## License
|
|
37
|
+
|
|
38
|
+
MIT © Nucleux
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var utils = require('@nucleux/utils');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
// src/index.tsx
|
|
29
|
+
var Kbd = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
+
"kbd",
|
|
31
|
+
{
|
|
32
|
+
ref,
|
|
33
|
+
"data-slot": "kbd",
|
|
34
|
+
className: utils.cn(
|
|
35
|
+
"pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground",
|
|
36
|
+
"[&_svg:not([class*='size-'])]:size-3",
|
|
37
|
+
"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background",
|
|
38
|
+
className
|
|
39
|
+
),
|
|
40
|
+
...props
|
|
41
|
+
}
|
|
42
|
+
));
|
|
43
|
+
Kbd.displayName = "Kbd";
|
|
44
|
+
var KbdGroup = React__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("kbd", { ref, "data-slot": "kbd-group", className: utils.cn("inline-flex items-center gap-1", className), ...props }));
|
|
45
|
+
KbdGroup.displayName = "KbdGroup";
|
|
46
|
+
|
|
47
|
+
exports.Kbd = Kbd;
|
|
48
|
+
exports.KbdGroup = KbdGroup;
|
|
49
|
+
//# sourceMappingURL=index.cjs.map
|
|
50
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":["React","jsx","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,IAAM,GAAA,GAAYA,4BAAkC,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAA,qBACnFC,cAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,GAAA;AAAA,IACA,WAAA,EAAU,KAAA;AAAA,IACV,SAAA,EAAWC,QAAA;AAAA,MACT,8KAAA;AAAA,MACA,sCAAA;AAAA,MACA,kGAAA;AAAA,MACA;AAAA,KACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,GAAA,CAAI,WAAA,GAAc,KAAA;AASX,IAAM,QAAA,GAAiBF,4BAAuC,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAA,qBAC7FC,cAAA,CAAC,SAAI,GAAA,EAAU,WAAA,EAAU,aAAY,SAAA,EAAWC,QAAA,CAAG,kCAAkC,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO,CAC7G;AACD,QAAA,CAAS,WAAA,GAAc,UAAA","file":"index.cjs","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\nexport type KbdProps = React.HTMLAttributes<HTMLElement>;\n\n/**\n * A single keyboard key, e.g. `<Kbd>⌘</Kbd>` or `<Kbd>Enter</Kbd>`. Renders a\n * semantic `<kbd>` in a small muted keycap; icons inside are sized to 12px.\n * Inside a tooltip it switches to a translucent keycap that reads on the\n * inverted tooltip surface. Combine several keys with KbdGroup.\n */\nexport const Kbd = React.forwardRef<HTMLElement, KbdProps>(({ className, ...props }, ref) => (\n <kbd\n ref={ref}\n data-slot=\"kbd\"\n className={cn(\n \"pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground\",\n \"[&_svg:not([class*='size-'])]:size-3\",\n \"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background\",\n className,\n )}\n {...props}\n />\n));\nKbd.displayName = \"Kbd\";\n\nexport type KbdGroupProps = React.HTMLAttributes<HTMLElement>;\n\n/**\n * Groups several Kbd keys into one shortcut, e.g. `⌘ + K`. Renders an outer\n * `<kbd>` (the HTML pattern for a key combination) laid out inline with a\n * small gap; put separators such as \"+\" or \"then\" between the keys as text.\n */\nexport const KbdGroup = React.forwardRef<HTMLElement, KbdGroupProps>(({ className, ...props }, ref) => (\n <kbd ref={ref} data-slot=\"kbd-group\" className={cn(\"inline-flex items-center gap-1\", className)} {...props} />\n));\nKbdGroup.displayName = \"KbdGroup\";\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type KbdProps = React.HTMLAttributes<HTMLElement>;
|
|
4
|
+
/**
|
|
5
|
+
* A single keyboard key, e.g. `<Kbd>⌘</Kbd>` or `<Kbd>Enter</Kbd>`. Renders a
|
|
6
|
+
* semantic `<kbd>` in a small muted keycap; icons inside are sized to 12px.
|
|
7
|
+
* Inside a tooltip it switches to a translucent keycap that reads on the
|
|
8
|
+
* inverted tooltip surface. Combine several keys with KbdGroup.
|
|
9
|
+
*/
|
|
10
|
+
declare const Kbd: React.ForwardRefExoticComponent<KbdProps & React.RefAttributes<HTMLElement>>;
|
|
11
|
+
type KbdGroupProps = React.HTMLAttributes<HTMLElement>;
|
|
12
|
+
/**
|
|
13
|
+
* Groups several Kbd keys into one shortcut, e.g. `⌘ + K`. Renders an outer
|
|
14
|
+
* `<kbd>` (the HTML pattern for a key combination) laid out inline with a
|
|
15
|
+
* small gap; put separators such as "+" or "then" between the keys as text.
|
|
16
|
+
*/
|
|
17
|
+
declare const KbdGroup: React.ForwardRefExoticComponent<KbdGroupProps & React.RefAttributes<HTMLElement>>;
|
|
18
|
+
|
|
19
|
+
export { Kbd, KbdGroup, type KbdGroupProps, type KbdProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type KbdProps = React.HTMLAttributes<HTMLElement>;
|
|
4
|
+
/**
|
|
5
|
+
* A single keyboard key, e.g. `<Kbd>⌘</Kbd>` or `<Kbd>Enter</Kbd>`. Renders a
|
|
6
|
+
* semantic `<kbd>` in a small muted keycap; icons inside are sized to 12px.
|
|
7
|
+
* Inside a tooltip it switches to a translucent keycap that reads on the
|
|
8
|
+
* inverted tooltip surface. Combine several keys with KbdGroup.
|
|
9
|
+
*/
|
|
10
|
+
declare const Kbd: React.ForwardRefExoticComponent<KbdProps & React.RefAttributes<HTMLElement>>;
|
|
11
|
+
type KbdGroupProps = React.HTMLAttributes<HTMLElement>;
|
|
12
|
+
/**
|
|
13
|
+
* Groups several Kbd keys into one shortcut, e.g. `⌘ + K`. Renders an outer
|
|
14
|
+
* `<kbd>` (the HTML pattern for a key combination) laid out inline with a
|
|
15
|
+
* small gap; put separators such as "+" or "then" between the keys as text.
|
|
16
|
+
*/
|
|
17
|
+
declare const KbdGroup: React.ForwardRefExoticComponent<KbdGroupProps & React.RefAttributes<HTMLElement>>;
|
|
18
|
+
|
|
19
|
+
export { Kbd, KbdGroup, type KbdGroupProps, type KbdProps };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { cn } from '@nucleux/utils';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
// src/index.tsx
|
|
7
|
+
var Kbd = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
8
|
+
"kbd",
|
|
9
|
+
{
|
|
10
|
+
ref,
|
|
11
|
+
"data-slot": "kbd",
|
|
12
|
+
className: cn(
|
|
13
|
+
"pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground",
|
|
14
|
+
"[&_svg:not([class*='size-'])]:size-3",
|
|
15
|
+
"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background",
|
|
16
|
+
className
|
|
17
|
+
),
|
|
18
|
+
...props
|
|
19
|
+
}
|
|
20
|
+
));
|
|
21
|
+
Kbd.displayName = "Kbd";
|
|
22
|
+
var KbdGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("kbd", { ref, "data-slot": "kbd-group", className: cn("inline-flex items-center gap-1", className), ...props }));
|
|
23
|
+
KbdGroup.displayName = "KbdGroup";
|
|
24
|
+
|
|
25
|
+
export { Kbd, KbdGroup };
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.tsx"],"names":[],"mappings":";;;;;AAWO,IAAM,GAAA,GAAY,iBAAkC,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAA,qBACnF,GAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,GAAA;AAAA,IACA,WAAA,EAAU,KAAA;AAAA,IACV,SAAA,EAAW,EAAA;AAAA,MACT,8KAAA;AAAA,MACA,sCAAA;AAAA,MACA,kGAAA;AAAA,MACA;AAAA,KACF;AAAA,IACC,GAAG;AAAA;AACN,CACD;AACD,GAAA,CAAI,WAAA,GAAc,KAAA;AASX,IAAM,QAAA,GAAiB,iBAAuC,CAAC,EAAE,WAAW,GAAG,KAAA,IAAS,GAAA,qBAC7F,GAAA,CAAC,SAAI,GAAA,EAAU,WAAA,EAAU,aAAY,SAAA,EAAW,EAAA,CAAG,kCAAkC,SAAS,CAAA,EAAI,GAAG,KAAA,EAAO,CAC7G;AACD,QAAA,CAAS,WAAA,GAAc,UAAA","file":"index.js","sourcesContent":["import * as React from \"react\";\nimport { cn } from \"@nucleux/utils\";\n\nexport type KbdProps = React.HTMLAttributes<HTMLElement>;\n\n/**\n * A single keyboard key, e.g. `<Kbd>⌘</Kbd>` or `<Kbd>Enter</Kbd>`. Renders a\n * semantic `<kbd>` in a small muted keycap; icons inside are sized to 12px.\n * Inside a tooltip it switches to a translucent keycap that reads on the\n * inverted tooltip surface. Combine several keys with KbdGroup.\n */\nexport const Kbd = React.forwardRef<HTMLElement, KbdProps>(({ className, ...props }, ref) => (\n <kbd\n ref={ref}\n data-slot=\"kbd\"\n className={cn(\n \"pointer-events-none inline-flex h-5 w-fit min-w-5 select-none items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground\",\n \"[&_svg:not([class*='size-'])]:size-3\",\n \"[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background\",\n className,\n )}\n {...props}\n />\n));\nKbd.displayName = \"Kbd\";\n\nexport type KbdGroupProps = React.HTMLAttributes<HTMLElement>;\n\n/**\n * Groups several Kbd keys into one shortcut, e.g. `⌘ + K`. Renders an outer\n * `<kbd>` (the HTML pattern for a key combination) laid out inline with a\n * small gap; put separators such as \"+\" or \"then\" between the keys as text.\n */\nexport const KbdGroup = React.forwardRef<HTMLElement, KbdGroupProps>(({ className, ...props }, ref) => (\n <kbd ref={ref} data-slot=\"kbd-group\" className={cn(\"inline-flex items-center gap-1\", className)} {...props} />\n));\nKbdGroup.displayName = \"KbdGroup\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nucleux/kbd",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.7.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"react": ">=18",
|
|
22
|
+
"react-dom": ">=18"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@nucleux/utils": "0.7.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"tsup": "^8.3.5",
|
|
29
|
+
"typescript": "^5.7.2",
|
|
30
|
+
"@types/react": "^18.3.18",
|
|
31
|
+
"react": "^18.3.1",
|
|
32
|
+
"lucide-react": "^0.469.0"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/intelligaia-open-labs/nucleux.git",
|
|
41
|
+
"directory": "packages/kbd"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/intelligaia-open-labs/nucleux#readme",
|
|
44
|
+
"description": "Keyboard key and shortcut display — Nucleux agentic UI for React.",
|
|
45
|
+
"keywords": [
|
|
46
|
+
"nucleux",
|
|
47
|
+
"react",
|
|
48
|
+
"ui",
|
|
49
|
+
"components",
|
|
50
|
+
"agentic",
|
|
51
|
+
"ai",
|
|
52
|
+
"tailwind",
|
|
53
|
+
"kbd"
|
|
54
|
+
],
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsup"
|
|
57
|
+
}
|
|
6
58
|
}
|