@sproutsocial/seeds-react-keyboard-key 1.0.25 → 1.0.27

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.
@@ -1,5 +1,23 @@
1
1
  yarn run v1.22.22
2
- $ tsup --dts
2
+ $ tsup --dts && cp src/keyboard-key.css dist/keyboard-key.css
3
+ ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json]
4
+
5
+ package.json:14:6:
6
+ 14 │ "types": "./dist/index.d.ts"
7
+ ╵ ~~~~~~~
8
+
9
+ The "import" condition comes earlier and will be used for all "import" statements:
10
+
11
+ package.json:12:6:
12
+ 12 │ "import": "./dist/esm/index.js",
13
+ ╵ ~~~~~~~~
14
+
15
+ The "require" condition comes earlier and will be used for all "require" calls:
16
+
17
+ package.json:13:6:
18
+ 13 │ "require": "./dist/index.js",
19
+ ╵ ~~~~~~~~~
20
+
3
21
  CLI Building entry: src/index.ts
4
22
  CLI Using tsconfig: tsconfig.json
5
23
  CLI tsup v8.5.0
@@ -8,14 +26,52 @@ $ tsup --dts
8
26
  CLI Cleaning output folder
9
27
  CJS Build start
10
28
  ESM Build start
11
- CJS dist/index.js 3.05 KB
12
- CJS dist/index.js.map 2.43 KB
13
- CJS ⚡️ Build success in 14ms
14
- ESM dist/esm/index.js 1.18 KB
15
- ESM dist/esm/index.js.map 2.34 KB
16
- ESM ⚡️ Build success in 14ms
29
+ [warn] ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json]
30
+
31
+ package.json:14:6:
32
+  14 │ "types": "./dist/index.d.ts"
33
+ ~~~~~~~
34
+
35
+ The "import" condition comes earlier and will be used for all "import" statements:
36
+
37
+ package.json:12:6:
38
+  12 │ "import": "./dist/esm/index.js",
39
+ ╵ ~~~~~~~~
40
+
41
+ The "require" condition comes earlier and will be used for all "require" calls:
42
+
43
+ package.json:13:6:
44
+  13 │ "require": "./dist/index.js",
45
+ ╵ ~~~~~~~~~
46
+
47
+
48
+ [warn] ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json]
49
+
50
+ package.json:14:6:
51
+  14 │ "types": "./dist/index.d.ts"
52
+ ╵ ~~~~~~~
53
+
54
+ The "import" condition comes earlier and will be used for all "import" statements:
55
+
56
+ package.json:12:6:
57
+  12 │ "import": "./dist/esm/index.js",
58
+ ╵ ~~~~~~~~
59
+
60
+ The "require" condition comes earlier and will be used for all "require" calls:
61
+
62
+ package.json:13:6:
63
+  13 │ "require": "./dist/index.js",
64
+ ╵ ~~~~~~~~~
65
+
66
+
67
+ CJS dist/index.js 4.66 KB
68
+ CJS dist/index.js.map 5.70 KB
69
+ CJS ⚡️ Build success in 17ms
70
+ ESM dist/esm/index.js 2.52 KB
71
+ ESM dist/esm/index.js.map 5.53 KB
72
+ ESM ⚡️ Build success in 17ms
17
73
  DTS Build start
18
- DTS ⚡️ Build success in 4301ms
19
- DTS dist/index.d.ts 601.00 B
20
- DTS dist/index.d.mts 601.00 B
21
- Done in 6.01s.
74
+ DTS ⚡️ Build success in 5119ms
75
+ DTS dist/index.d.ts 793.00 B
76
+ DTS dist/index.d.mts 793.00 B
77
+ Done in 6.43s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @sproutsocial/seeds-react-keyboard-key
2
2
 
3
+ ## 1.0.27
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d21ae54]
8
+ - @sproutsocial/seeds-react-theme@4.2.1
9
+
10
+ ## 1.0.26
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [6611f6a]
15
+ - @sproutsocial/seeds-react-system-props@3.1.2
16
+ - @sproutsocial/seeds-react-text@1.5.1
17
+
3
18
  ## 1.0.25
4
19
 
5
20
  ### Patch Changes
package/dist/esm/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  // src/KeyboardKey.tsx
2
2
  import "react";
3
- import Text from "@sproutsocial/seeds-react-text";
3
+
4
+ // src/KeyboardKeyHybrid.tsx
5
+ import "react";
6
+ import Text2 from "@sproutsocial/seeds-react-text";
4
7
 
5
8
  // src/styles.ts
6
9
  import styled from "styled-components";
@@ -20,11 +23,59 @@ var Container = styled.div`
20
23
  `;
21
24
  var styles_default = Container;
22
25
 
23
- // src/KeyboardKey.tsx
26
+ // src/KeyboardKeyTailwind.tsx
27
+ import "react";
28
+ import Text from "@sproutsocial/seeds-react-text";
24
29
  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 }) }) });
30
+ function cn(...inputs) {
31
+ const classes = [];
32
+ for (const input of inputs) {
33
+ if (!input) continue;
34
+ if (typeof input === "string") {
35
+ classes.push(input);
36
+ } else if (typeof input === "object") {
37
+ for (const [key, value] of Object.entries(input)) {
38
+ if (value) {
39
+ classes.push(key);
40
+ }
41
+ }
42
+ }
43
+ }
44
+ return classes.join(" ");
45
+ }
46
+ var KeyboardKeyTailwind = ({
47
+ children,
48
+ className,
49
+ ...rest
50
+ }) => {
51
+ return /* @__PURE__ */ jsx(
52
+ "div",
53
+ {
54
+ className: cn("seeds-keyboard-key", className),
55
+ ...rest,
56
+ children: /* @__PURE__ */ jsx("kbd", { "data-qa-keyboardkey": children, children: /* @__PURE__ */ jsx(Text, { children }) })
57
+ }
58
+ );
59
+ };
60
+ KeyboardKeyTailwind.displayName = "KeyboardKeyTailwind";
61
+
62
+ // src/KeyboardKeyHybrid.tsx
63
+ import { hasStyledProps } from "@sproutsocial/seeds-react-system-props";
64
+ import { jsx as jsx2 } from "react/jsx-runtime";
65
+ var KeyboardKeyHybrid = ({
66
+ children,
67
+ ...rest
68
+ }) => {
69
+ if (hasStyledProps(rest)) {
70
+ return /* @__PURE__ */ jsx2(styles_default, { ...rest, children: /* @__PURE__ */ jsx2("kbd", { "data-qa-keyboardkey": children, children: /* @__PURE__ */ jsx2(Text2, { children }) }) });
71
+ }
72
+ return /* @__PURE__ */ jsx2(KeyboardKeyTailwind, { ...rest, children });
27
73
  };
74
+ KeyboardKeyHybrid.displayName = "KeyboardKey";
75
+
76
+ // src/KeyboardKey.tsx
77
+ import { jsx as jsx3 } from "react/jsx-runtime";
78
+ var KeyboardKey = (props) => /* @__PURE__ */ jsx3(KeyboardKeyHybrid, { ...props });
28
79
 
29
80
  // src/KeyboardKeyTypes.ts
30
81
  import "react";
@@ -1 +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,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/KeyboardKey.tsx","../../src/KeyboardKeyHybrid.tsx","../../src/styles.ts","../../src/KeyboardKeyTailwind.tsx","../../src/KeyboardKeyTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { KeyboardKeyHybrid } from \"./KeyboardKeyHybrid\";\nimport type { TypeKeyboardKeyProps } from \"./KeyboardKeyTypes\";\n\n/**\n * KeyboardKey component. Automatically routes between the Tailwind\n * implementation (preferred) and the styled-components implementation (for\n * consumers using system props or styled() extension).\n */\nexport const KeyboardKey = (props: TypeKeyboardKeyProps) => (\n <KeyboardKeyHybrid {...props} />\n);\n","/**\n * Hybrid KeyboardKey Component\n * Automatically chooses between Tailwind and styled-components based on props\n */\n\nimport * as React from \"react\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport Container from \"./styles\"; // Styled-components version\nimport { KeyboardKeyTailwind } from \"./KeyboardKeyTailwind\"; // Tailwind version\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeKeyboardKeyProps } from \"./KeyboardKeyTypes\";\n\nexport const KeyboardKeyHybrid = ({\n children,\n ...rest\n}: TypeKeyboardKeyProps) => {\n if (hasStyledProps(rest)) {\n return (\n <Container {...rest}>\n <kbd data-qa-keyboardkey={children}>\n <Text>{children}</Text>\n </kbd>\n </Container>\n );\n }\n\n // Use Tailwind version (preferred - better performance)\n return <KeyboardKeyTailwind {...rest}>{children}</KeyboardKeyTailwind>;\n};\n\nKeyboardKeyHybrid.displayName = \"KeyboardKey\";\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","/**\n * Tailwind CSS implementation of KeyboardKey component\n * Uses Seeds keyboard-key CSS classes from keyboard-key.css\n */\n\nimport * as React from \"react\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport type { TypeKeyboardKeyProps } from \"./KeyboardKeyTypes\";\n\n// Utility for merging class names properly\nfunction cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === \"string\") {\n classes.push(input);\n } else if (typeof input === \"object\") {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(\" \");\n}\n\nexport const KeyboardKeyTailwind = ({\n children,\n className,\n ...rest\n}: TypeKeyboardKeyProps) => {\n return (\n <div\n className={cn(\"seeds-keyboard-key\", className)}\n {...(rest as React.ComponentPropsWithoutRef<\"div\">)}\n >\n <kbd data-qa-keyboardkey={children}>\n <Text>{children}</Text>\n </kbd>\n </div>\n );\n};\n\nKeyboardKeyTailwind.displayName = \"KeyboardKeyTailwind\";\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;;;ACKvB,OAAuB;AACvB,OAAOA,WAAU;;;ACNjB,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;;;ACZf,OAAuB;AACvB,OAAO,UAAU;AAqCT;AAjCR,SAAS,MACJ,QACK;AACR,QAAM,UAAoB,CAAC;AAE3B,aAAW,SAAS,QAAQ;AAC1B,QAAI,CAAC,MAAO;AAEZ,QAAI,OAAO,UAAU,UAAU;AAC7B,cAAQ,KAAK,KAAK;AAAA,IACpB,WAAW,OAAO,UAAU,UAAU;AACpC,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,YAAI,OAAO;AACT,kBAAQ,KAAK,GAAG;AAAA,QAClB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,QAAQ,KAAK,GAAG;AACzB;AAEO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAA4B;AAC1B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,sBAAsB,SAAS;AAAA,MAC5C,GAAI;AAAA,MAEL,8BAAC,SAAI,uBAAqB,UACxB,8BAAC,QAAM,UAAS,GAClB;AAAA;AAAA,EACF;AAEJ;AAEA,oBAAoB,cAAc;;;AFxClC,SAAS,sBAAsB;AAWrB,gBAAAC,YAAA;AARH,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,GAAG;AACL,MAA4B;AAC1B,MAAI,eAAe,IAAI,GAAG;AACxB,WACE,gBAAAA,KAAC,kBAAW,GAAG,MACb,0BAAAA,KAAC,SAAI,uBAAqB,UACxB,0BAAAA,KAACC,OAAA,EAAM,UAAS,GAClB,GACF;AAAA,EAEJ;AAGA,SAAO,gBAAAD,KAAC,uBAAqB,GAAG,MAAO,UAAS;AAClD;AAEA,kBAAkB,cAAc;;;ADpB9B,gBAAAE,YAAA;AADK,IAAM,cAAc,CAAC,UAC1B,gBAAAA,KAAC,qBAAmB,GAAG,OAAO;;;AIVhC,OAAuB;;;ACEvB,IAAO,gBAAQ;","names":["Text","jsx","Text","jsx"]}
package/dist/index.d.mts CHANGED
@@ -7,6 +7,11 @@ interface TypeKeyboardKeyProps extends TypeStyledComponentsCommonProps, TypeSyst
7
7
  children: string;
8
8
  }
9
9
 
10
- declare const KeyboardKey: ({ children, ...rest }: TypeKeyboardKeyProps) => react_jsx_runtime.JSX.Element;
10
+ /**
11
+ * KeyboardKey component. Automatically routes between the Tailwind
12
+ * implementation (preferred) and the styled-components implementation (for
13
+ * consumers using system props or styled() extension).
14
+ */
15
+ declare const KeyboardKey: (props: TypeKeyboardKeyProps) => react_jsx_runtime.JSX.Element;
11
16
 
12
17
  export { KeyboardKey, type TypeKeyboardKeyProps, KeyboardKey as default };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,11 @@ interface TypeKeyboardKeyProps extends TypeStyledComponentsCommonProps, TypeSyst
7
7
  children: string;
8
8
  }
9
9
 
10
- declare const KeyboardKey: ({ children, ...rest }: TypeKeyboardKeyProps) => react_jsx_runtime.JSX.Element;
10
+ /**
11
+ * KeyboardKey component. Automatically routes between the Tailwind
12
+ * implementation (preferred) and the styled-components implementation (for
13
+ * consumers using system props or styled() extension).
14
+ */
15
+ declare const KeyboardKey: (props: TypeKeyboardKeyProps) => react_jsx_runtime.JSX.Element;
11
16
 
12
17
  export { KeyboardKey, type TypeKeyboardKeyProps, KeyboardKey as default };
package/dist/index.js CHANGED
@@ -36,8 +36,11 @@ __export(index_exports, {
36
36
  module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/KeyboardKey.tsx
39
- var React = require("react");
40
- var import_seeds_react_text = __toESM(require("@sproutsocial/seeds-react-text"));
39
+ var React3 = require("react");
40
+
41
+ // src/KeyboardKeyHybrid.tsx
42
+ var React2 = require("react");
43
+ var import_seeds_react_text2 = __toESM(require("@sproutsocial/seeds-react-text"));
41
44
 
42
45
  // src/styles.ts
43
46
  var import_styled_components = __toESM(require("styled-components"));
@@ -57,14 +60,62 @@ var Container = import_styled_components.default.div`
57
60
  `;
58
61
  var styles_default = Container;
59
62
 
60
- // src/KeyboardKey.tsx
63
+ // src/KeyboardKeyTailwind.tsx
64
+ var React = require("react");
65
+ var import_seeds_react_text = __toESM(require("@sproutsocial/seeds-react-text"));
61
66
  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 }) }) });
67
+ function cn(...inputs) {
68
+ const classes = [];
69
+ for (const input of inputs) {
70
+ if (!input) continue;
71
+ if (typeof input === "string") {
72
+ classes.push(input);
73
+ } else if (typeof input === "object") {
74
+ for (const [key, value] of Object.entries(input)) {
75
+ if (value) {
76
+ classes.push(key);
77
+ }
78
+ }
79
+ }
80
+ }
81
+ return classes.join(" ");
82
+ }
83
+ var KeyboardKeyTailwind = ({
84
+ children,
85
+ className,
86
+ ...rest
87
+ }) => {
88
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
+ "div",
90
+ {
91
+ className: cn("seeds-keyboard-key", className),
92
+ ...rest,
93
+ 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 }) })
94
+ }
95
+ );
96
+ };
97
+ KeyboardKeyTailwind.displayName = "KeyboardKeyTailwind";
98
+
99
+ // src/KeyboardKeyHybrid.tsx
100
+ var import_seeds_react_system_props2 = require("@sproutsocial/seeds-react-system-props");
101
+ var import_jsx_runtime2 = require("react/jsx-runtime");
102
+ var KeyboardKeyHybrid = ({
103
+ children,
104
+ ...rest
105
+ }) => {
106
+ if ((0, import_seeds_react_system_props2.hasStyledProps)(rest)) {
107
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(styles_default, { ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("kbd", { "data-qa-keyboardkey": children, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_seeds_react_text2.default, { children }) }) });
108
+ }
109
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(KeyboardKeyTailwind, { ...rest, children });
64
110
  };
111
+ KeyboardKeyHybrid.displayName = "KeyboardKey";
112
+
113
+ // src/KeyboardKey.tsx
114
+ var import_jsx_runtime3 = require("react/jsx-runtime");
115
+ var KeyboardKey = (props) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(KeyboardKeyHybrid, { ...props });
65
116
 
66
117
  // src/KeyboardKeyTypes.ts
67
- var React2 = require("react");
118
+ var React4 = require("react");
68
119
 
69
120
  // src/index.ts
70
121
  var index_default = KeyboardKey;
package/dist/index.js.map CHANGED
@@ -1 +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,gBAAQ;","names":["styled","Text","React"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/KeyboardKey.tsx","../src/KeyboardKeyHybrid.tsx","../src/styles.ts","../src/KeyboardKeyTailwind.tsx","../src/KeyboardKeyTypes.ts"],"sourcesContent":["import { KeyboardKey } from \"./KeyboardKey\";\n\nexport default KeyboardKey;\nexport { KeyboardKey };\nexport * from \"./KeyboardKeyTypes\";\n","import * as React from \"react\";\nimport { KeyboardKeyHybrid } from \"./KeyboardKeyHybrid\";\nimport type { TypeKeyboardKeyProps } from \"./KeyboardKeyTypes\";\n\n/**\n * KeyboardKey component. Automatically routes between the Tailwind\n * implementation (preferred) and the styled-components implementation (for\n * consumers using system props or styled() extension).\n */\nexport const KeyboardKey = (props: TypeKeyboardKeyProps) => (\n <KeyboardKeyHybrid {...props} />\n);\n","/**\n * Hybrid KeyboardKey Component\n * Automatically chooses between Tailwind and styled-components based on props\n */\n\nimport * as React from \"react\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport Container from \"./styles\"; // Styled-components version\nimport { KeyboardKeyTailwind } from \"./KeyboardKeyTailwind\"; // Tailwind version\nimport { hasStyledProps } from \"@sproutsocial/seeds-react-system-props\";\nimport type { TypeKeyboardKeyProps } from \"./KeyboardKeyTypes\";\n\nexport const KeyboardKeyHybrid = ({\n children,\n ...rest\n}: TypeKeyboardKeyProps) => {\n if (hasStyledProps(rest)) {\n return (\n <Container {...rest}>\n <kbd data-qa-keyboardkey={children}>\n <Text>{children}</Text>\n </kbd>\n </Container>\n );\n }\n\n // Use Tailwind version (preferred - better performance)\n return <KeyboardKeyTailwind {...rest}>{children}</KeyboardKeyTailwind>;\n};\n\nKeyboardKeyHybrid.displayName = \"KeyboardKey\";\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","/**\n * Tailwind CSS implementation of KeyboardKey component\n * Uses Seeds keyboard-key CSS classes from keyboard-key.css\n */\n\nimport * as React from \"react\";\nimport Text from \"@sproutsocial/seeds-react-text\";\nimport type { TypeKeyboardKeyProps } from \"./KeyboardKeyTypes\";\n\n// Utility for merging class names properly\nfunction cn(\n ...inputs: (string | undefined | null | false | Record<string, boolean>)[]\n): string {\n const classes: string[] = [];\n\n for (const input of inputs) {\n if (!input) continue;\n\n if (typeof input === \"string\") {\n classes.push(input);\n } else if (typeof input === \"object\") {\n for (const [key, value] of Object.entries(input)) {\n if (value) {\n classes.push(key);\n }\n }\n }\n }\n\n return classes.join(\" \");\n}\n\nexport const KeyboardKeyTailwind = ({\n children,\n className,\n ...rest\n}: TypeKeyboardKeyProps) => {\n return (\n <div\n className={cn(\"seeds-keyboard-key\", className)}\n {...(rest as React.ComponentPropsWithoutRef<\"div\">)}\n >\n <kbd data-qa-keyboardkey={children}>\n <Text>{children}</Text>\n </kbd>\n </div>\n );\n};\n\nKeyboardKeyTailwind.displayName = \"KeyboardKeyTailwind\";\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,IAAAA,SAAuB;;;ACKvB,IAAAC,SAAuB;AACvB,IAAAC,2BAAiB;;;ACNjB,+BAAmB;AACnB,sCAAuB;AAEvB,IAAM,YAAY,yBAAAC,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;;;ACZf,YAAuB;AACvB,8BAAiB;AAqCT;AAjCR,SAAS,MACJ,QACK;AACR,QAAM,UAAoB,CAAC;AAE3B,aAAW,SAAS,QAAQ;AAC1B,QAAI,CAAC,MAAO;AAEZ,QAAI,OAAO,UAAU,UAAU;AAC7B,cAAQ,KAAK,KAAK;AAAA,IACpB,WAAW,OAAO,UAAU,UAAU;AACpC,iBAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;AAChD,YAAI,OAAO;AACT,kBAAQ,KAAK,GAAG;AAAA,QAClB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,SAAO,QAAQ,KAAK,GAAG;AACzB;AAEO,IAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAA4B;AAC1B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,sBAAsB,SAAS;AAAA,MAC5C,GAAI;AAAA,MAEL,sDAAC,SAAI,uBAAqB,UACxB,sDAAC,wBAAAC,SAAA,EAAM,UAAS,GAClB;AAAA;AAAA,EACF;AAEJ;AAEA,oBAAoB,cAAc;;;AFxClC,IAAAC,mCAA+B;AAWrB,IAAAC,sBAAA;AARH,IAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA,GAAG;AACL,MAA4B;AAC1B,UAAI,iDAAe,IAAI,GAAG;AACxB,WACE,6CAAC,kBAAW,GAAG,MACb,uDAAC,SAAI,uBAAqB,UACxB,uDAAC,yBAAAC,SAAA,EAAM,UAAS,GAClB,GACF;AAAA,EAEJ;AAGA,SAAO,6CAAC,uBAAqB,GAAG,MAAO,UAAS;AAClD;AAEA,kBAAkB,cAAc;;;ADpB9B,IAAAC,sBAAA;AADK,IAAM,cAAc,CAAC,UAC1B,6CAAC,qBAAmB,GAAG,OAAO;;;AIVhC,IAAAC,SAAuB;;;ALEvB,IAAO,gBAAQ;","names":["React","React","import_seeds_react_text","styled","Text","import_seeds_react_system_props","import_jsx_runtime","Text","import_jsx_runtime","React"]}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Seeds KeyboardKey component classes
3
+ * Use these instead of writing out individual Tailwind utility classes.
4
+ *
5
+ * Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
6
+ * CSS variable definitions and dark mode support.
7
+ *
8
+ * All rules are wrapped in `@layer components` so that consumer Tailwind
9
+ * utilities (unlayered) win the cascade over these styles.
10
+ */
11
+
12
+ @layer components {
13
+ .seeds-keyboard-key {
14
+ display: inline-flex;
15
+ color: var(--color-text-body);
16
+ background-color: var(--color-container-bg-base);
17
+ border: 1px solid var(--color-container-border-base);
18
+ border-radius: var(--radius-500);
19
+ box-shadow: var(--shadow-low);
20
+ padding: 0 var(--space-200);
21
+ min-width: 20px;
22
+ justify-content: center;
23
+ }
24
+ }
package/package.json CHANGED
@@ -1,15 +1,23 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-keyboard-key",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "description": "Seeds React KeyboardKey",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/esm/index.js",
9
9
  "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/esm/index.js",
13
+ "require": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ },
16
+ "./dist/keyboard-key.css": "./dist/keyboard-key.css"
17
+ },
10
18
  "scripts": {
11
- "build": "tsup --dts",
12
- "build:debug": "tsup --dts --metafile",
19
+ "build": "tsup --dts && cp src/keyboard-key.css dist/keyboard-key.css",
20
+ "build:debug": "tsup --dts --metafile && cp src/keyboard-key.css dist/keyboard-key.css",
13
21
  "dev": "tsup --watch --dts",
14
22
  "clean": "rm -rf .turbo dist",
15
23
  "clean:modules": "rm -rf node_modules",
@@ -18,9 +26,9 @@
18
26
  "test:watch": "jest --watch --coverage=false"
19
27
  },
20
28
  "dependencies": {
21
- "@sproutsocial/seeds-react-theme": "^4.2.0",
22
- "@sproutsocial/seeds-react-system-props": "^3.1.1",
23
- "@sproutsocial/seeds-react-text": "^1.5.0"
29
+ "@sproutsocial/seeds-react-theme": "^4.2.1",
30
+ "@sproutsocial/seeds-react-system-props": "^3.1.2",
31
+ "@sproutsocial/seeds-react-text": "^1.5.1"
24
32
  },
25
33
  "devDependencies": {
26
34
  "@types/react": "^18.0.0",
@@ -1,14 +1,12 @@
1
1
  import * as React from "react";
2
- import Text from "@sproutsocial/seeds-react-text";
3
- import Container from "./styles";
2
+ import { KeyboardKeyHybrid } from "./KeyboardKeyHybrid";
4
3
  import type { TypeKeyboardKeyProps } from "./KeyboardKeyTypes";
5
4
 
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
- };
5
+ /**
6
+ * KeyboardKey component. Automatically routes between the Tailwind
7
+ * implementation (preferred) and the styled-components implementation (for
8
+ * consumers using system props or styled() extension).
9
+ */
10
+ export const KeyboardKey = (props: TypeKeyboardKeyProps) => (
11
+ <KeyboardKeyHybrid {...props} />
12
+ );
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Hybrid KeyboardKey Component
3
+ * Automatically chooses between Tailwind and styled-components based on props
4
+ */
5
+
6
+ import * as React from "react";
7
+ import Text from "@sproutsocial/seeds-react-text";
8
+ import Container from "./styles"; // Styled-components version
9
+ import { KeyboardKeyTailwind } from "./KeyboardKeyTailwind"; // Tailwind version
10
+ import { hasStyledProps } from "@sproutsocial/seeds-react-system-props";
11
+ import type { TypeKeyboardKeyProps } from "./KeyboardKeyTypes";
12
+
13
+ export const KeyboardKeyHybrid = ({
14
+ children,
15
+ ...rest
16
+ }: TypeKeyboardKeyProps) => {
17
+ if (hasStyledProps(rest)) {
18
+ return (
19
+ <Container {...rest}>
20
+ <kbd data-qa-keyboardkey={children}>
21
+ <Text>{children}</Text>
22
+ </kbd>
23
+ </Container>
24
+ );
25
+ }
26
+
27
+ // Use Tailwind version (preferred - better performance)
28
+ return <KeyboardKeyTailwind {...rest}>{children}</KeyboardKeyTailwind>;
29
+ };
30
+
31
+ KeyboardKeyHybrid.displayName = "KeyboardKey";
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Tailwind CSS implementation of KeyboardKey component
3
+ * Uses Seeds keyboard-key CSS classes from keyboard-key.css
4
+ */
5
+
6
+ import * as React from "react";
7
+ import Text from "@sproutsocial/seeds-react-text";
8
+ import type { TypeKeyboardKeyProps } from "./KeyboardKeyTypes";
9
+
10
+ // Utility for merging class names properly
11
+ function cn(
12
+ ...inputs: (string | undefined | null | false | Record<string, boolean>)[]
13
+ ): string {
14
+ const classes: string[] = [];
15
+
16
+ for (const input of inputs) {
17
+ if (!input) continue;
18
+
19
+ if (typeof input === "string") {
20
+ classes.push(input);
21
+ } else if (typeof input === "object") {
22
+ for (const [key, value] of Object.entries(input)) {
23
+ if (value) {
24
+ classes.push(key);
25
+ }
26
+ }
27
+ }
28
+ }
29
+
30
+ return classes.join(" ");
31
+ }
32
+
33
+ export const KeyboardKeyTailwind = ({
34
+ children,
35
+ className,
36
+ ...rest
37
+ }: TypeKeyboardKeyProps) => {
38
+ return (
39
+ <div
40
+ className={cn("seeds-keyboard-key", className)}
41
+ {...(rest as React.ComponentPropsWithoutRef<"div">)}
42
+ >
43
+ <kbd data-qa-keyboardkey={children}>
44
+ <Text>{children}</Text>
45
+ </kbd>
46
+ </div>
47
+ );
48
+ };
49
+
50
+ KeyboardKeyTailwind.displayName = "KeyboardKeyTailwind";
@@ -8,4 +8,28 @@ describe("KeyboardKey", () => {
8
8
  render(<KeyboardKey>{children}</KeyboardKey>);
9
9
  expect(screen.getByText(children)).toBeInTheDocument();
10
10
  });
11
+
12
+ it("renders the Tailwind path with the seeds-keyboard-key class and qa attribute", () => {
13
+ render(<KeyboardKey>esc</KeyboardKey>);
14
+ const kbd = screen.getByText("esc").closest("kbd");
15
+ expect(kbd).toHaveAttribute("data-qa-keyboardkey", "esc");
16
+ expect(kbd?.parentElement).toHaveClass("seeds-keyboard-key");
17
+ });
18
+
19
+ it("merges a consumer className on the Tailwind path (styled() contract)", () => {
20
+ render(<KeyboardKey className="custom">esc</KeyboardKey>);
21
+ const container = screen.getByText("esc").closest("kbd")?.parentElement;
22
+ expect(container).toHaveClass("seeds-keyboard-key");
23
+ expect(container).toHaveClass("custom");
24
+ });
25
+
26
+ it("routes through the styled-components path when a system prop is present", () => {
27
+ // mt is a system prop, which routes KeyboardKey through the styled-components path
28
+ render(<KeyboardKey mt={200}>esc</KeyboardKey>);
29
+ expect(screen.getByText("esc")).toBeInTheDocument();
30
+ expect(screen.getByText("esc").closest("kbd")).toHaveAttribute(
31
+ "data-qa-keyboardkey",
32
+ "esc"
33
+ );
34
+ });
11
35
  });
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Seeds KeyboardKey component classes
3
+ * Use these instead of writing out individual Tailwind utility classes.
4
+ *
5
+ * Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
6
+ * CSS variable definitions and dark mode support.
7
+ *
8
+ * All rules are wrapped in `@layer components` so that consumer Tailwind
9
+ * utilities (unlayered) win the cascade over these styles.
10
+ */
11
+
12
+ @layer components {
13
+ .seeds-keyboard-key {
14
+ display: inline-flex;
15
+ color: var(--color-text-body);
16
+ background-color: var(--color-container-bg-base);
17
+ border: 1px solid var(--color-container-border-base);
18
+ border-radius: var(--radius-500);
19
+ box-shadow: var(--shadow-low);
20
+ padding: 0 var(--space-200);
21
+ min-width: 20px;
22
+ justify-content: center;
23
+ }
24
+ }