@sproutsocial/seeds-react-keyboard-key 1.0.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/.eslintignore +6 -0
- package/.eslintrc.js +4 -0
- package/.turbo/turbo-build.log +21 -0
- package/CHANGELOG.md +7 -0
- package/dist/esm/index.js +38 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -0
- package/jest.config.js +9 -0
- package/package.json +43 -0
- package/src/KeyboardKey.tsx +14 -0
- package/src/KeyboardKeyTypes.ts +13 -0
- package/src/__tests__/features.test.tsx +11 -0
- package/src/__tests__/types.test.tsx +17 -0
- package/src/index.stories.tsx +24 -0
- package/src/index.ts +5 -0
- package/src/styles.ts +18 -0
- package/tsconfig.json +9 -0
- package/tsup.config.ts +12 -0
package/.eslintignore
ADDED
package/.eslintrc.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
yarn run v1.22.22
|
|
2
|
+
$ tsup --dts
|
|
3
|
+
CLI Building entry: src/index.ts
|
|
4
|
+
CLI Using tsconfig: tsconfig.json
|
|
5
|
+
CLI tsup v8.0.2
|
|
6
|
+
CLI Using tsup config: /home/runner/work/seeds/seeds/seeds-react/seeds-react-keyboard-key/tsup.config.ts
|
|
7
|
+
CLI Target: es2022
|
|
8
|
+
CLI Cleaning output folder
|
|
9
|
+
CJS Build start
|
|
10
|
+
ESM Build start
|
|
11
|
+
ESM dist/esm/index.js 1.18 KB
|
|
12
|
+
ESM dist/esm/index.js.map 2.34 KB
|
|
13
|
+
ESM ⚡️ Build success in 218ms
|
|
14
|
+
CJS dist/index.js 3.04 KB
|
|
15
|
+
CJS dist/index.js.map 2.43 KB
|
|
16
|
+
CJS ⚡️ Build success in 218ms
|
|
17
|
+
DTS Build start
|
|
18
|
+
DTS ⚡️ Build success in 30158ms
|
|
19
|
+
DTS dist/index.d.ts 601.00 B
|
|
20
|
+
DTS dist/index.d.mts 601.00 B
|
|
21
|
+
Done in 38.13s.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// src/KeyboardKey.tsx
|
|
2
|
+
import "react";
|
|
3
|
+
import Text from "@sproutsocial/seeds-react-text";
|
|
4
|
+
|
|
5
|
+
// src/styles.ts
|
|
6
|
+
import styled from "styled-components";
|
|
7
|
+
import { COMMON } from "@sproutsocial/seeds-react-system-props";
|
|
8
|
+
var Container = styled.div`
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
color: ${(props) => props.theme.colors.text.body};
|
|
11
|
+
background-color: ${(props) => props.theme.colors.container.background.base};
|
|
12
|
+
border: 1px solid ${(props) => props.theme.colors.container.border.base};
|
|
13
|
+
border-radius: ${(props) => props.theme.radii[500]};
|
|
14
|
+
box-shadow: ${(props) => props.theme.shadows.low};
|
|
15
|
+
padding: 0 ${(props) => props.theme.space[200]};
|
|
16
|
+
min-width: 20px;
|
|
17
|
+
justify-content: center;
|
|
18
|
+
|
|
19
|
+
${COMMON}
|
|
20
|
+
`;
|
|
21
|
+
var styles_default = Container;
|
|
22
|
+
|
|
23
|
+
// src/KeyboardKey.tsx
|
|
24
|
+
import { jsx } from "react/jsx-runtime";
|
|
25
|
+
var KeyboardKey = ({ children, ...rest }) => {
|
|
26
|
+
return /* @__PURE__ */ jsx(styles_default, { ...rest, children: /* @__PURE__ */ jsx("kbd", { "data-qa-keyboardkey": children, children: /* @__PURE__ */ jsx(Text, { children }) }) });
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// src/KeyboardKeyTypes.ts
|
|
30
|
+
import "react";
|
|
31
|
+
|
|
32
|
+
// src/index.ts
|
|
33
|
+
var src_default = KeyboardKey;
|
|
34
|
+
export {
|
|
35
|
+
KeyboardKey,
|
|
36
|
+
src_default as default
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/KeyboardKey.tsx","../../src/styles.ts","../../src/KeyboardKeyTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport Container from \"./styles\";\nimport type { TypeKeyboardKeyProps } from \"./KeyboardKeyTypes\";\n\nexport const KeyboardKey = ({ children, ...rest }: TypeKeyboardKeyProps) => {\n return (\n <Container {...rest}>\n <kbd data-qa-keyboardkey={children}>\n <Text>{children}</Text>\n </kbd>\n </Container>\n );\n};\n","import styled from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\n\nconst Container = styled.div`\n display: inline-flex;\n color: ${(props) => props.theme.colors.text.body};\n background-color: ${(props) => props.theme.colors.container.background.base};\n border: 1px solid ${(props) => props.theme.colors.container.border.base};\n border-radius: ${(props) => props.theme.radii[500]};\n box-shadow: ${(props) => props.theme.shadows.low};\n padding: 0 ${(props) => props.theme.space[200]};\n min-width: 20px;\n justify-content: center;\n\n ${COMMON}\n`;\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeSystemCommonProps,\n TypeStyledComponentsCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\nexport interface TypeKeyboardKeyProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\"> {\n /** Text to display inside of key */\n children: string;\n}\n","import { KeyboardKey } from \"./KeyboardKey\";\n\nexport default KeyboardKey;\nexport { KeyboardKey };\nexport * from \"./KeyboardKeyTypes\";\n"],"mappings":";AAAA,OAAuB;AACvB,OAAO,UAAU;;;ACDjB,OAAO,YAAY;AACnB,SAAS,cAAc;AAEvB,IAAM,YAAY,OAAO;AAAA;AAAA,WAEd,CAAC,UAAU,MAAM,MAAM,OAAO,KAAK,IAAI;AAAA,sBAC5B,CAAC,UAAU,MAAM,MAAM,OAAO,UAAU,WAAW,IAAI;AAAA,sBACvD,CAAC,UAAU,MAAM,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA,mBACtD,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,gBACpC,CAAC,UAAU,MAAM,MAAM,QAAQ,GAAG;AAAA,eACnC,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA,IAI5C,MAAM;AAAA;AAGV,IAAO,iBAAQ;;;ADRP;AAJD,IAAM,cAAc,CAAC,EAAE,UAAU,GAAG,KAAK,MAA4B;AAC1E,SACE,oBAAC,kBAAW,GAAG,MACb,8BAAC,SAAI,uBAAqB,UACxB,8BAAC,QAAM,UAAS,GAClB,GACF;AAEJ;;;AEbA,OAAuB;;;ACEvB,IAAO,cAAQ;","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
4
|
+
|
|
5
|
+
interface TypeKeyboardKeyProps extends TypeStyledComponentsCommonProps, TypeSystemCommonProps, Omit<React.ComponentPropsWithoutRef<"div">, "color"> {
|
|
6
|
+
/** Text to display inside of key */
|
|
7
|
+
children: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const KeyboardKey: ({ children, ...rest }: TypeKeyboardKeyProps) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { KeyboardKey, type TypeKeyboardKeyProps, KeyboardKey as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sproutsocial/seeds-react-system-props';
|
|
4
|
+
|
|
5
|
+
interface TypeKeyboardKeyProps extends TypeStyledComponentsCommonProps, TypeSystemCommonProps, Omit<React.ComponentPropsWithoutRef<"div">, "color"> {
|
|
6
|
+
/** Text to display inside of key */
|
|
7
|
+
children: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
declare const KeyboardKey: ({ children, ...rest }: TypeKeyboardKeyProps) => react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { KeyboardKey, type TypeKeyboardKeyProps, KeyboardKey as default };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
KeyboardKey: () => KeyboardKey,
|
|
34
|
+
default: () => src_default
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
|
|
38
|
+
// src/KeyboardKey.tsx
|
|
39
|
+
var React = require("react");
|
|
40
|
+
var import_seeds_react_text = __toESM(require("@sproutsocial/seeds-react-text"));
|
|
41
|
+
|
|
42
|
+
// src/styles.ts
|
|
43
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
44
|
+
var import_seeds_react_system_props = require("@sproutsocial/seeds-react-system-props");
|
|
45
|
+
var Container = import_styled_components.default.div`
|
|
46
|
+
display: inline-flex;
|
|
47
|
+
color: ${(props) => props.theme.colors.text.body};
|
|
48
|
+
background-color: ${(props) => props.theme.colors.container.background.base};
|
|
49
|
+
border: 1px solid ${(props) => props.theme.colors.container.border.base};
|
|
50
|
+
border-radius: ${(props) => props.theme.radii[500]};
|
|
51
|
+
box-shadow: ${(props) => props.theme.shadows.low};
|
|
52
|
+
padding: 0 ${(props) => props.theme.space[200]};
|
|
53
|
+
min-width: 20px;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
|
|
56
|
+
${import_seeds_react_system_props.COMMON}
|
|
57
|
+
`;
|
|
58
|
+
var styles_default = Container;
|
|
59
|
+
|
|
60
|
+
// src/KeyboardKey.tsx
|
|
61
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
62
|
+
var KeyboardKey = ({ children, ...rest }) => {
|
|
63
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(styles_default, { ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kbd", { "data-qa-keyboardkey": children, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_seeds_react_text.default, { children }) }) });
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/KeyboardKeyTypes.ts
|
|
67
|
+
var React2 = require("react");
|
|
68
|
+
|
|
69
|
+
// src/index.ts
|
|
70
|
+
var src_default = KeyboardKey;
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
KeyboardKey
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/KeyboardKey.tsx","../src/styles.ts","../src/KeyboardKeyTypes.ts"],"sourcesContent":["import { KeyboardKey } from \"./KeyboardKey\";\n\nexport default KeyboardKey;\nexport { KeyboardKey };\nexport * from \"./KeyboardKeyTypes\";\n","import * as React from \"react\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport Container from \"./styles\";\nimport type { TypeKeyboardKeyProps } from \"./KeyboardKeyTypes\";\n\nexport const KeyboardKey = ({ children, ...rest }: TypeKeyboardKeyProps) => {\n return (\n <Container {...rest}>\n <kbd data-qa-keyboardkey={children}>\n <Text>{children}</Text>\n </kbd>\n </Container>\n );\n};\n","import styled from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\n\nconst Container = styled.div`\n display: inline-flex;\n color: ${(props) => props.theme.colors.text.body};\n background-color: ${(props) => props.theme.colors.container.background.base};\n border: 1px solid ${(props) => props.theme.colors.container.border.base};\n border-radius: ${(props) => props.theme.radii[500]};\n box-shadow: ${(props) => props.theme.shadows.low};\n padding: 0 ${(props) => props.theme.space[200]};\n min-width: 20px;\n justify-content: center;\n\n ${COMMON}\n`;\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeSystemCommonProps,\n TypeStyledComponentsCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\nexport interface TypeKeyboardKeyProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"div\">, \"color\"> {\n /** Text to display inside of key */\n children: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,8BAAiB;;;ACDjB,+BAAmB;AACnB,sCAAuB;AAEvB,IAAM,YAAY,yBAAAA,QAAO;AAAA;AAAA,WAEd,CAAC,UAAU,MAAM,MAAM,OAAO,KAAK,IAAI;AAAA,sBAC5B,CAAC,UAAU,MAAM,MAAM,OAAO,UAAU,WAAW,IAAI;AAAA,sBACvD,CAAC,UAAU,MAAM,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA,mBACtD,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA,gBACpC,CAAC,UAAU,MAAM,MAAM,QAAQ,GAAG;AAAA,eACnC,CAAC,UAAU,MAAM,MAAM,MAAM,GAAG,CAAC;AAAA;AAAA;AAAA;AAAA,IAI5C,sCAAM;AAAA;AAGV,IAAO,iBAAQ;;;ADRP;AAJD,IAAM,cAAc,CAAC,EAAE,UAAU,GAAG,KAAK,MAA4B;AAC1E,SACE,4CAAC,kBAAW,GAAG,MACb,sDAAC,SAAI,uBAAqB,UACxB,sDAAC,wBAAAC,SAAA,EAAM,UAAS,GAClB,GACF;AAEJ;;;AEbA,IAAAC,SAAuB;;;AHEvB,IAAO,cAAQ;","names":["styled","Text","React"]}
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sproutsocial/seeds-react-keyboard-key",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Seeds React KeyboardKey",
|
|
5
|
+
"author": "Sprout Social, Inc.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/esm/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsup --dts",
|
|
12
|
+
"build:debug": "tsup --dts --metafile",
|
|
13
|
+
"dev": "tsup --watch --dts",
|
|
14
|
+
"clean": "rm -rf .turbo dist",
|
|
15
|
+
"clean:modules": "rm -rf node_modules",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"test": "jest",
|
|
18
|
+
"test:watch": "jest --watch --coverage=false"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@sproutsocial/seeds-react-theme": "^*",
|
|
22
|
+
"@sproutsocial/seeds-react-system-props": "^*",
|
|
23
|
+
"@sproutsocial/seeds-react-text": "*"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/react": "^18.0.0",
|
|
27
|
+
"@types/styled-components": "^5.1.26",
|
|
28
|
+
"@sproutsocial/eslint-config-seeds": "*",
|
|
29
|
+
"react": "^18.0.0",
|
|
30
|
+
"styled-components": "^5.2.3",
|
|
31
|
+
"tsup": "^8.0.2",
|
|
32
|
+
"typescript": "^5.6.2",
|
|
33
|
+
"@sproutsocial/seeds-tsconfig": "*",
|
|
34
|
+
"@sproutsocial/seeds-testing": "*",
|
|
35
|
+
"@sproutsocial/seeds-react-testing-library": "*"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"styled-components": "^5.2.3"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import Text from "@sproutsocial/seeds-react-text";
|
|
3
|
+
import Container from "./styles";
|
|
4
|
+
import type { TypeKeyboardKeyProps } from "./KeyboardKeyTypes";
|
|
5
|
+
|
|
6
|
+
export const KeyboardKey = ({ children, ...rest }: TypeKeyboardKeyProps) => {
|
|
7
|
+
return (
|
|
8
|
+
<Container {...rest}>
|
|
9
|
+
<kbd data-qa-keyboardkey={children}>
|
|
10
|
+
<Text>{children}</Text>
|
|
11
|
+
</kbd>
|
|
12
|
+
</Container>
|
|
13
|
+
);
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type {
|
|
3
|
+
TypeSystemCommonProps,
|
|
4
|
+
TypeStyledComponentsCommonProps,
|
|
5
|
+
} from "@sproutsocial/seeds-react-system-props";
|
|
6
|
+
|
|
7
|
+
export interface TypeKeyboardKeyProps
|
|
8
|
+
extends TypeStyledComponentsCommonProps,
|
|
9
|
+
TypeSystemCommonProps,
|
|
10
|
+
Omit<React.ComponentPropsWithoutRef<"div">, "color"> {
|
|
11
|
+
/** Text to display inside of key */
|
|
12
|
+
children: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, screen } from "@sproutsocial/seeds-react-testing-library";
|
|
3
|
+
import KeyboardKey from "../";
|
|
4
|
+
|
|
5
|
+
describe("KeyboardKey", () => {
|
|
6
|
+
it("should render children RTL", () => {
|
|
7
|
+
const children = "command";
|
|
8
|
+
render(<KeyboardKey>{children}</KeyboardKey>);
|
|
9
|
+
expect(screen.getByText(children)).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { render } from "@sproutsocial/seeds-react-testing-library";
|
|
3
|
+
import KeyboardKey from "../";
|
|
4
|
+
|
|
5
|
+
describe.skip("KeyboardKey/types", () => {
|
|
6
|
+
it("should render valid props", () => {
|
|
7
|
+
render(
|
|
8
|
+
<>
|
|
9
|
+
<KeyboardKey children="ctrl" />
|
|
10
|
+
<KeyboardKey children="]" />
|
|
11
|
+
<KeyboardKey>command</KeyboardKey>
|
|
12
|
+
{/* @ts-expect-error - test that invalid flexDirection is rejected */}
|
|
13
|
+
<KeyboardKey />
|
|
14
|
+
</>
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { KeyboardKey } from "./";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/KeyboardKey",
|
|
6
|
+
component: KeyboardKey,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const singleKey = () => <KeyboardKey children="ctrl" />;
|
|
10
|
+
|
|
11
|
+
singleKey.story = {
|
|
12
|
+
name: "Single key",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const keyCombination = () => (
|
|
16
|
+
<>
|
|
17
|
+
<KeyboardKey children="ctrl" />
|
|
18
|
+
<KeyboardKey children="]" />
|
|
19
|
+
</>
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
keyCombination.story = {
|
|
23
|
+
name: "Key combination",
|
|
24
|
+
};
|
package/src/index.ts
ADDED
package/src/styles.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { COMMON } from "@sproutsocial/seeds-react-system-props";
|
|
3
|
+
|
|
4
|
+
const Container = styled.div`
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
color: ${(props) => props.theme.colors.text.body};
|
|
7
|
+
background-color: ${(props) => props.theme.colors.container.background.base};
|
|
8
|
+
border: 1px solid ${(props) => props.theme.colors.container.border.base};
|
|
9
|
+
border-radius: ${(props) => props.theme.radii[500]};
|
|
10
|
+
box-shadow: ${(props) => props.theme.shadows.low};
|
|
11
|
+
padding: 0 ${(props) => props.theme.space[200]};
|
|
12
|
+
min-width: 20px;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
|
|
15
|
+
${COMMON}
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
export default Container;
|
package/tsconfig.json
ADDED
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig((options) => ({
|
|
4
|
+
entry: ["src/index.ts"],
|
|
5
|
+
format: ["cjs", "esm"],
|
|
6
|
+
clean: true,
|
|
7
|
+
legacyOutput: true,
|
|
8
|
+
dts: options.dts,
|
|
9
|
+
external: ["react"],
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
metafile: options.metafile,
|
|
12
|
+
}));
|