@sproutsocial/seeds-react-token 1.0.2 → 1.0.3

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.
@@ -8,14 +8,14 @@ CLI Target: es2022
8
8
  CLI Cleaning output folder
9
9
  CJS Build start
10
10
  ESM Build start
11
- ESM dist/esm/index.js 4.37 KB
12
- ESM dist/esm/index.js.map 7.91 KB
13
- ESM ⚡️ Build success in 275ms
14
- CJS dist/index.js 6.82 KB
15
- CJS dist/index.js.map 8.04 KB
16
- CJS ⚡️ Build success in 282ms
11
+ CJS dist/index.js 6.97 KB
12
+ CJS dist/index.js.map 8.30 KB
13
+ CJS ⚡️ Build success in 203ms
14
+ ESM dist/esm/index.js 4.47 KB
15
+ ESM dist/esm/index.js.map 8.17 KB
16
+ ESM ⚡️ Build success in 208ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 37912ms
19
- DTS dist/index.d.ts 1.03 KB
20
- DTS dist/index.d.mts 1.03 KB
21
- Done in 47.08s.
18
+ DTS ⚡️ Build success in 43841ms
19
+ DTS dist/index.d.ts 1.13 KB
20
+ DTS dist/index.d.mts 1.13 KB
21
+ Done in 50.30s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @sproutsocial/seeds-react-token
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 9c149dd: The `innerRef` prop on the `Token` is now supported for passing a ref to the token
8
+ - Updated dependencies [9c149dd]
9
+ - @sproutsocial/seeds-react-utilities@4.1.0
10
+
3
11
  ## 1.0.2
4
12
 
5
13
  ### Patch Changes
package/dist/esm/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/Token.tsx
2
2
  import "react";
3
+ import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
3
4
  import { useTextContent } from "@sproutsocial/seeds-react-hooks";
4
5
  import Box from "@sproutsocial/seeds-react-box";
5
6
  import Icon from "@sproutsocial/seeds-react-icon";
@@ -92,13 +93,14 @@ var Token = ({
92
93
  valid = true,
93
94
  disabled = false,
94
95
  palette = "neutral",
96
+ innerRef,
95
97
  ...rest
96
98
  }) => {
97
99
  const textContainer = useTextContent("");
98
100
  return /* @__PURE__ */ jsxs(
99
101
  styles_default,
100
102
  {
101
- ref: textContainer,
103
+ ref: mergeRefs([innerRef ?? null, textContainer]),
102
104
  valid,
103
105
  palette,
104
106
  type: closeable || onClick ? "button" : void 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Token.tsx","../../src/styles.ts","../../src/TokenTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { useTextContent } from \"@sproutsocial/seeds-react-hooks\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport { VisuallyHidden } from \"@sproutsocial/seeds-react-visually-hidden\";\nimport Container from \"./styles\";\nimport type { TypeTokenProps } from \"./TokenTypes\";\n\nconst Token = ({\n children,\n closeable = true,\n onClick,\n qa,\n valid = true,\n disabled = false,\n palette = \"neutral\",\n ...rest\n}: TypeTokenProps) => {\n const textContainer = useTextContent(\"\");\n\n return (\n <Container\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-ignore some legacy ref type mismatch between divs\n ref={textContainer}\n valid={valid}\n palette={palette}\n type={closeable || onClick ? \"button\" : undefined}\n as={closeable || onClick ? \"button\" : \"div\"}\n closeable={closeable || !!onClick}\n disabled={disabled}\n onClick={onClick}\n data-qa-token={textContainer.current}\n data-qa-token-iscloseable={closeable === true}\n data-qa-token-isvalid={valid === true}\n data-qa-token-isdisabled={disabled === true}\n {...qa}\n {...rest}\n >\n {!valid && (\n <>\n <VisuallyHidden as=\"div\" role=\"status\">\n This is an invalid token\n </VisuallyHidden>\n <Icon\n aria-hidden\n pr={300}\n name=\"circle-exclamation-solid\"\n size=\"mini\"\n />\n <VisuallyHidden>Invalid</VisuallyHidden>\n </>\n )}\n {closeable ? (\n <Box display=\"flex\" alignItems=\"center\" justifyContent=\"space-between\">\n <Box as=\"span\" display=\"flex\" alignItems=\"center\">\n {children}\n </Box>\n <Icon aria-hidden pl={300} name=\"x-solid\" size=\"mini\" />\n </Box>\n ) : (\n children\n )}\n </Container>\n );\n};\n\nexport default Token;\n","import styled, { css } from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { focusRing } from \"@sproutsocial/seeds-react-mixins\";\nimport { useInteractiveColor } from \"@sproutsocial/seeds-react-hooks\";\nimport type { TypeTokenProps } from \"./TokenTypes\";\n\nconst Container = styled.button<TypeTokenProps>`\n position: relative;\n display: inline-flex;\n align-items: center;\n margin: 0;\n line-height: 1;\n outline: none;\n /* Theme Properties */\n ${({ theme }) => css`\n ${theme.typography[200]}\n font-family: ${theme.fontFamily};\n font-weight: ${theme.fontWeights.normal};\n border: 1px solid ${theme.colors.container.border.base};\n border-radius: ${theme.radii[500]};\n color: ${theme.colors.text.body};\n background: ${theme.colors.container.background.base};\n padding: ${theme.space[200]} ${theme.space[300]};\n transition: all ${theme.duration.fast} ${theme.easing.ease_inout};\n `}\n\n &:focus {\n ${focusRing}\n }\n\n ${({ closeable, theme }) =>\n closeable &&\n css`\n cursor: pointer;\n &:hover,\n &:active {\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.base)};\n }\n `}\n\n ${({ theme, palette }) =>\n palette === \"blue\" &&\n css`\n color: ${theme.colors.text.body};\n background: ${theme.colors.container.background.decorative.blue};\n border: 1px solid ${theme.colors.container.border.decorative.blue};\n &:hover,\n &:active {\n cursor: pointer;\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.decorative.blue)};\n }\n `}\n\n ${({ disabled, theme }) =>\n disabled &&\n css`\n opacity: 0.4;\n cursor: not-allowed;\n &:hover,\n &:active {\n box-shadow: none;\n border: 1px solid ${theme.colors.container.border.base};\n }\n `}\n \n ${({ valid, theme }) =>\n !valid &&\n css`\n color: ${theme.colors.text.error};\n background: ${theme.colors.container.background.error};\n border: 1px solid ${theme.colors.container.border.error};\n &:hover {\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.error)};\n }\n `}\n\n ${COMMON}\n`;\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ntype TypeQaProps = object;\n\nexport interface TypeTokenProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"button\">, \"color\"> {\n onClick?: (event: React.SyntheticEvent<HTMLButtonElement>) => void;\n children: React.ReactNode;\n qa?: TypeQaProps;\n\n /** Show the close icon in the token. Can be used with or without icon prop */\n closeable?: boolean;\n\n /** Indicates whether the token value is valid or not */\n valid?: boolean;\n\n /** Indicates whether the token is disabled */\n disabled?: boolean;\n palette?: \"neutral\" | \"blue\";\n as?: TypeStyledComponentsCommonProps[\"as\"];\n}\n","import Token from \"./Token\";\n\nexport default Token;\nexport { Token };\nexport * from \"./TokenTypes\";\n"],"mappings":";AAAA,OAAuB;AACvB,SAAS,sBAAsB;AAC/B,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,SAAS,sBAAsB;;;ACJ/B,OAAO,UAAU,WAAW;AAC5B,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AAGpC,IAAM,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQrB,CAAC,EAAE,MAAM,MAAM;AAAA,MACb,MAAM,WAAW,GAAG,CAAC;AAAA,mBACR,MAAM,UAAU;AAAA,mBAChB,MAAM,YAAY,MAAM;AAAA,wBACnB,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA,qBACrC,MAAM,MAAM,GAAG,CAAC;AAAA,aACxB,MAAM,OAAO,KAAK,IAAI;AAAA,kBACjB,MAAM,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ADF;AAhCR,IAAM,QAAQ,CAAC;AAAA,EACb;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,GAAG;AACL,MAAsB;AACpB,QAAM,gBAAgB,eAAe,EAAE;AAEvC,SACE;AAAA,IAAC;AAAA;AAAA,MAGC,KAAK;AAAA,MACL;AAAA,MACA;AAAA,MACA,MAAM,aAAa,UAAU,WAAW;AAAA,MACxC,IAAI,aAAa,UAAU,WAAW;AAAA,MACtC,WAAW,aAAa,CAAC,CAAC;AAAA,MAC1B;AAAA,MACA;AAAA,MACA,iBAAe,cAAc;AAAA,MAC7B,6BAA2B,cAAc;AAAA,MACzC,yBAAuB,UAAU;AAAA,MACjC,4BAA0B,aAAa;AAAA,MACtC,GAAG;AAAA,MACH,GAAG;AAAA,MAEH;AAAA,SAAC,SACA,iCACE;AAAA,8BAAC,kBAAe,IAAG,OAAM,MAAK,UAAS,sCAEvC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,cACX,IAAI;AAAA,cACJ,MAAK;AAAA,cACL,MAAK;AAAA;AAAA,UACP;AAAA,UACA,oBAAC,kBAAe,qBAAO;AAAA,WACzB;AAAA,QAED,YACC,qBAAC,OAAI,SAAQ,QAAO,YAAW,UAAS,gBAAe,iBACrD;AAAA,8BAAC,OAAI,IAAG,QAAO,SAAQ,QAAO,YAAW,UACtC,UACH;AAAA,UACA,oBAAC,QAAK,eAAW,MAAC,IAAI,KAAK,MAAK,WAAU,MAAK,QAAO;AAAA,WACxD,IAEA;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAO,gBAAQ;;;AEnEf,OAAuB;;;ACEvB,IAAO,gBAAQ;","names":[]}
1
+ {"version":3,"sources":["../../src/Token.tsx","../../src/styles.ts","../../src/TokenTypes.ts","../../src/index.ts"],"sourcesContent":["import * as React from \"react\";\nimport { mergeRefs } from \"@sproutsocial/seeds-react-utilities\";\nimport { useTextContent } from \"@sproutsocial/seeds-react-hooks\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport { VisuallyHidden } from \"@sproutsocial/seeds-react-visually-hidden\";\nimport Container from \"./styles\";\nimport type { TypeTokenProps } from \"./TokenTypes\";\n\nconst Token = ({\n children,\n closeable = true,\n onClick,\n qa,\n valid = true,\n disabled = false,\n palette = \"neutral\",\n innerRef,\n ...rest\n}: TypeTokenProps) => {\n const textContainer = useTextContent(\"\");\n\n return (\n <Container\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-ignore some legacy ref type mismatch between divs\n ref={mergeRefs([innerRef ?? null, textContainer])}\n valid={valid}\n palette={palette}\n type={closeable || onClick ? \"button\" : undefined}\n as={closeable || onClick ? \"button\" : \"div\"}\n closeable={closeable || !!onClick}\n disabled={disabled}\n onClick={onClick}\n data-qa-token={textContainer.current}\n data-qa-token-iscloseable={closeable === true}\n data-qa-token-isvalid={valid === true}\n data-qa-token-isdisabled={disabled === true}\n {...qa}\n {...rest}\n >\n {!valid && (\n <>\n <VisuallyHidden as=\"div\" role=\"status\">\n This is an invalid token\n </VisuallyHidden>\n <Icon\n aria-hidden\n pr={300}\n name=\"circle-exclamation-solid\"\n size=\"mini\"\n />\n <VisuallyHidden>Invalid</VisuallyHidden>\n </>\n )}\n {closeable ? (\n <Box display=\"flex\" alignItems=\"center\" justifyContent=\"space-between\">\n <Box as=\"span\" display=\"flex\" alignItems=\"center\">\n {children}\n </Box>\n <Icon aria-hidden pl={300} name=\"x-solid\" size=\"mini\" />\n </Box>\n ) : (\n children\n )}\n </Container>\n );\n};\n\nexport default Token;\n","import styled, { css } from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { focusRing } from \"@sproutsocial/seeds-react-mixins\";\nimport { useInteractiveColor } from \"@sproutsocial/seeds-react-hooks\";\nimport type { TypeTokenProps } from \"./TokenTypes\";\n\nconst Container = styled.button<TypeTokenProps>`\n position: relative;\n display: inline-flex;\n align-items: center;\n margin: 0;\n line-height: 1;\n outline: none;\n /* Theme Properties */\n ${({ theme }) => css`\n ${theme.typography[200]}\n font-family: ${theme.fontFamily};\n font-weight: ${theme.fontWeights.normal};\n border: 1px solid ${theme.colors.container.border.base};\n border-radius: ${theme.radii[500]};\n color: ${theme.colors.text.body};\n background: ${theme.colors.container.background.base};\n padding: ${theme.space[200]} ${theme.space[300]};\n transition: all ${theme.duration.fast} ${theme.easing.ease_inout};\n `}\n\n &:focus {\n ${focusRing}\n }\n\n ${({ closeable, theme }) =>\n closeable &&\n css`\n cursor: pointer;\n &:hover,\n &:active {\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.base)};\n }\n `}\n\n ${({ theme, palette }) =>\n palette === \"blue\" &&\n css`\n color: ${theme.colors.text.body};\n background: ${theme.colors.container.background.decorative.blue};\n border: 1px solid ${theme.colors.container.border.decorative.blue};\n &:hover,\n &:active {\n cursor: pointer;\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.decorative.blue)};\n }\n `}\n\n ${({ disabled, theme }) =>\n disabled &&\n css`\n opacity: 0.4;\n cursor: not-allowed;\n &:hover,\n &:active {\n box-shadow: none;\n border: 1px solid ${theme.colors.container.border.base};\n }\n `}\n \n ${({ valid, theme }) =>\n !valid &&\n css`\n color: ${theme.colors.text.error};\n background: ${theme.colors.container.background.error};\n border: 1px solid ${theme.colors.container.border.error};\n &:hover {\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.error)};\n }\n `}\n\n ${COMMON}\n`;\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ntype TypeQaProps = object;\n\nexport interface TypeTokenProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"button\">, \"color\"> {\n onClick?: (event: React.MouseEvent<Element, MouseEvent>) => void;\n children: React.ReactNode;\n qa?: TypeQaProps;\n\n /** Show the close icon in the token. Can be used with or without icon prop */\n closeable?: boolean;\n\n /** Indicates whether the token value is valid or not */\n valid?: boolean;\n\n /** Indicates whether the token is disabled */\n disabled?: boolean;\n palette?: \"neutral\" | \"blue\";\n as?: TypeStyledComponentsCommonProps[\"as\"];\n\n /** Used to get a reference to the underlying element */\n innerRef?: React.Ref<HTMLElement>;\n}\n","import Token from \"./Token\";\n\nexport default Token;\nexport { Token };\nexport * from \"./TokenTypes\";\n"],"mappings":";AAAA,OAAuB;AACvB,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,OAAO,SAAS;AAChB,OAAO,UAAU;AACjB,SAAS,sBAAsB;;;ACL/B,OAAO,UAAU,WAAW;AAC5B,SAAS,cAAc;AACvB,SAAS,iBAAiB;AAC1B,SAAS,2BAA2B;AAGpC,IAAM,YAAY,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQrB,CAAC,EAAE,MAAM,MAAM;AAAA,MACb,MAAM,WAAW,GAAG,CAAC;AAAA,mBACR,MAAM,UAAU;AAAA,mBAChB,MAAM,YAAY,MAAM;AAAA,wBACnB,MAAM,OAAO,UAAU,OAAO,IAAI;AAAA,qBACrC,MAAM,MAAM,GAAG,CAAC;AAAA,aACxB,MAAM,OAAO,KAAK,IAAI;AAAA,kBACjB,MAAM,OAAO,UAAU,WAAW,IAAI;AAAA,eACzC,MAAM,MAAM,GAAG,CAAC,IAAI,MAAM,MAAM,GAAG,CAAC;AAAA,sBAC7B,MAAM,SAAS,IAAI,IAAI,MAAM,OAAO,UAAU;AAAA,GACjE;AAAA;AAAA;AAAA,MAGG,SAAS;AAAA;AAAA;AAAA,IAGX,CAAC,EAAE,WAAW,MAAM,MACpB,aACA;AAAA;AAAA;AAAA;AAAA,sBAIkB,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a,CAAC;AAAA,MAChD;AAAA,MACA;AAAA,MACA,MAAM,aAAa,UAAU,WAAW;AAAA,MACxC,IAAI,aAAa,UAAU,WAAW;AAAA,MACtC,WAAW,aAAa,CAAC,CAAC;AAAA,MAC1B;AAAA,MACA;AAAA,MACA,iBAAe,cAAc;AAAA,MAC7B,6BAA2B,cAAc;AAAA,MACzC,yBAAuB,UAAU;AAAA,MACjC,4BAA0B,aAAa;AAAA,MACtC,GAAG;AAAA,MACH,GAAG;AAAA,MAEH;AAAA,SAAC,SACA,iCACE;AAAA,8BAAC,kBAAe,IAAG,OAAM,MAAK,UAAS,sCAEvC;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,eAAW;AAAA,cACX,IAAI;AAAA,cACJ,MAAK;AAAA,cACL,MAAK;AAAA;AAAA,UACP;AAAA,UACA,oBAAC,kBAAe,qBAAO;AAAA,WACzB;AAAA,QAED,YACC,qBAAC,OAAI,SAAQ,QAAO,YAAW,UAAS,gBAAe,iBACrD;AAAA,8BAAC,OAAI,IAAG,QAAO,SAAQ,QAAO,YAAW,UACtC,UACH;AAAA,UACA,oBAAC,QAAK,eAAW,MAAC,IAAI,KAAK,MAAK,WAAU,MAAK,QAAO;AAAA,WACxD,IAEA;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAO,gBAAQ;;;AErEf,OAAuB;;;ACEvB,IAAO,gBAAQ;","names":[]}
package/dist/index.d.mts CHANGED
@@ -4,7 +4,7 @@ import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sprouts
4
4
 
5
5
  type TypeQaProps = object;
6
6
  interface TypeTokenProps extends TypeStyledComponentsCommonProps, TypeSystemCommonProps, Omit<React.ComponentPropsWithoutRef<"button">, "color"> {
7
- onClick?: (event: React.SyntheticEvent<HTMLButtonElement>) => void;
7
+ onClick?: (event: React.MouseEvent<Element, MouseEvent>) => void;
8
8
  children: React.ReactNode;
9
9
  qa?: TypeQaProps;
10
10
  /** Show the close icon in the token. Can be used with or without icon prop */
@@ -15,8 +15,10 @@ interface TypeTokenProps extends TypeStyledComponentsCommonProps, TypeSystemComm
15
15
  disabled?: boolean;
16
16
  palette?: "neutral" | "blue";
17
17
  as?: TypeStyledComponentsCommonProps["as"];
18
+ /** Used to get a reference to the underlying element */
19
+ innerRef?: React.Ref<HTMLElement>;
18
20
  }
19
21
 
20
- declare const Token: ({ children, closeable, onClick, qa, valid, disabled, palette, ...rest }: TypeTokenProps) => react_jsx_runtime.JSX.Element;
22
+ declare const Token: ({ children, closeable, onClick, qa, valid, disabled, palette, innerRef, ...rest }: TypeTokenProps) => react_jsx_runtime.JSX.Element;
21
23
 
22
24
  export { Token, type TypeTokenProps, Token as default };
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { TypeStyledComponentsCommonProps, TypeSystemCommonProps } from '@sprouts
4
4
 
5
5
  type TypeQaProps = object;
6
6
  interface TypeTokenProps extends TypeStyledComponentsCommonProps, TypeSystemCommonProps, Omit<React.ComponentPropsWithoutRef<"button">, "color"> {
7
- onClick?: (event: React.SyntheticEvent<HTMLButtonElement>) => void;
7
+ onClick?: (event: React.MouseEvent<Element, MouseEvent>) => void;
8
8
  children: React.ReactNode;
9
9
  qa?: TypeQaProps;
10
10
  /** Show the close icon in the token. Can be used with or without icon prop */
@@ -15,8 +15,10 @@ interface TypeTokenProps extends TypeStyledComponentsCommonProps, TypeSystemComm
15
15
  disabled?: boolean;
16
16
  palette?: "neutral" | "blue";
17
17
  as?: TypeStyledComponentsCommonProps["as"];
18
+ /** Used to get a reference to the underlying element */
19
+ innerRef?: React.Ref<HTMLElement>;
18
20
  }
19
21
 
20
- declare const Token: ({ children, closeable, onClick, qa, valid, disabled, palette, ...rest }: TypeTokenProps) => react_jsx_runtime.JSX.Element;
22
+ declare const Token: ({ children, closeable, onClick, qa, valid, disabled, palette, innerRef, ...rest }: TypeTokenProps) => react_jsx_runtime.JSX.Element;
21
23
 
22
24
  export { Token, type TypeTokenProps, Token as default };
package/dist/index.js CHANGED
@@ -37,6 +37,7 @@ module.exports = __toCommonJS(index_exports);
37
37
 
38
38
  // src/Token.tsx
39
39
  var React = require("react");
40
+ var import_seeds_react_utilities = require("@sproutsocial/seeds-react-utilities");
40
41
  var import_seeds_react_hooks2 = require("@sproutsocial/seeds-react-hooks");
41
42
  var import_seeds_react_box = __toESM(require("@sproutsocial/seeds-react-box"));
42
43
  var import_seeds_react_icon = __toESM(require("@sproutsocial/seeds-react-icon"));
@@ -129,13 +130,14 @@ var Token = ({
129
130
  valid = true,
130
131
  disabled = false,
131
132
  palette = "neutral",
133
+ innerRef,
132
134
  ...rest
133
135
  }) => {
134
136
  const textContainer = (0, import_seeds_react_hooks2.useTextContent)("");
135
137
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
136
138
  styles_default,
137
139
  {
138
- ref: textContainer,
140
+ ref: (0, import_seeds_react_utilities.mergeRefs)([innerRef ?? null, textContainer]),
139
141
  valid,
140
142
  palette,
141
143
  type: closeable || onClick ? "button" : void 0,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/Token.tsx","../src/styles.ts","../src/TokenTypes.ts"],"sourcesContent":["import Token from \"./Token\";\n\nexport default Token;\nexport { Token };\nexport * from \"./TokenTypes\";\n","import * as React from \"react\";\nimport { useTextContent } from \"@sproutsocial/seeds-react-hooks\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport { VisuallyHidden } from \"@sproutsocial/seeds-react-visually-hidden\";\nimport Container from \"./styles\";\nimport type { TypeTokenProps } from \"./TokenTypes\";\n\nconst Token = ({\n children,\n closeable = true,\n onClick,\n qa,\n valid = true,\n disabled = false,\n palette = \"neutral\",\n ...rest\n}: TypeTokenProps) => {\n const textContainer = useTextContent(\"\");\n\n return (\n <Container\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-ignore some legacy ref type mismatch between divs\n ref={textContainer}\n valid={valid}\n palette={palette}\n type={closeable || onClick ? \"button\" : undefined}\n as={closeable || onClick ? \"button\" : \"div\"}\n closeable={closeable || !!onClick}\n disabled={disabled}\n onClick={onClick}\n data-qa-token={textContainer.current}\n data-qa-token-iscloseable={closeable === true}\n data-qa-token-isvalid={valid === true}\n data-qa-token-isdisabled={disabled === true}\n {...qa}\n {...rest}\n >\n {!valid && (\n <>\n <VisuallyHidden as=\"div\" role=\"status\">\n This is an invalid token\n </VisuallyHidden>\n <Icon\n aria-hidden\n pr={300}\n name=\"circle-exclamation-solid\"\n size=\"mini\"\n />\n <VisuallyHidden>Invalid</VisuallyHidden>\n </>\n )}\n {closeable ? (\n <Box display=\"flex\" alignItems=\"center\" justifyContent=\"space-between\">\n <Box as=\"span\" display=\"flex\" alignItems=\"center\">\n {children}\n </Box>\n <Icon aria-hidden pl={300} name=\"x-solid\" size=\"mini\" />\n </Box>\n ) : (\n children\n )}\n </Container>\n );\n};\n\nexport default Token;\n","import styled, { css } from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { focusRing } from \"@sproutsocial/seeds-react-mixins\";\nimport { useInteractiveColor } from \"@sproutsocial/seeds-react-hooks\";\nimport type { TypeTokenProps } from \"./TokenTypes\";\n\nconst Container = styled.button<TypeTokenProps>`\n position: relative;\n display: inline-flex;\n align-items: center;\n margin: 0;\n line-height: 1;\n outline: none;\n /* Theme Properties */\n ${({ theme }) => css`\n ${theme.typography[200]}\n font-family: ${theme.fontFamily};\n font-weight: ${theme.fontWeights.normal};\n border: 1px solid ${theme.colors.container.border.base};\n border-radius: ${theme.radii[500]};\n color: ${theme.colors.text.body};\n background: ${theme.colors.container.background.base};\n padding: ${theme.space[200]} ${theme.space[300]};\n transition: all ${theme.duration.fast} ${theme.easing.ease_inout};\n `}\n\n &:focus {\n ${focusRing}\n }\n\n ${({ closeable, theme }) =>\n closeable &&\n css`\n cursor: pointer;\n &:hover,\n &:active {\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.base)};\n }\n `}\n\n ${({ theme, palette }) =>\n palette === \"blue\" &&\n css`\n color: ${theme.colors.text.body};\n background: ${theme.colors.container.background.decorative.blue};\n border: 1px solid ${theme.colors.container.border.decorative.blue};\n &:hover,\n &:active {\n cursor: pointer;\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.decorative.blue)};\n }\n `}\n\n ${({ disabled, theme }) =>\n disabled &&\n css`\n opacity: 0.4;\n cursor: not-allowed;\n &:hover,\n &:active {\n box-shadow: none;\n border: 1px solid ${theme.colors.container.border.base};\n }\n `}\n \n ${({ valid, theme }) =>\n !valid &&\n css`\n color: ${theme.colors.text.error};\n background: ${theme.colors.container.background.error};\n border: 1px solid ${theme.colors.container.border.error};\n &:hover {\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.error)};\n }\n `}\n\n ${COMMON}\n`;\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ntype TypeQaProps = object;\n\nexport interface TypeTokenProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"button\">, \"color\"> {\n onClick?: (event: React.SyntheticEvent<HTMLButtonElement>) => void;\n children: React.ReactNode;\n qa?: TypeQaProps;\n\n /** Show the close icon in the token. Can be used with or without icon prop */\n closeable?: boolean;\n\n /** Indicates whether the token value is valid or not */\n valid?: boolean;\n\n /** Indicates whether the token is disabled */\n disabled?: boolean;\n palette?: \"neutral\" | \"blue\";\n as?: TypeStyledComponentsCommonProps[\"as\"];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,IAAAA,4BAA+B;AAC/B,6BAAgB;AAChB,8BAAiB;AACjB,yCAA+B;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,EAAI,SAAQ,QAAO,YAAW,UAAS,gBAAe,iBACrD;AAAA,sDAAC,uBAAAA,SAAA,EAAI,IAAG,QAAO,SAAQ,QAAO,YAAW,UACtC,UACH;AAAA,UACA,4CAAC,wBAAAD,SAAA,EAAK,eAAW,MAAC,IAAI,KAAK,MAAK,WAAU,MAAK,QAAO;AAAA,WACxD,IAEA;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAO,gBAAQ;;;AEnEf,IAAAE,SAAuB;;;AHEvB,IAAO,gBAAQ;","names":["import_seeds_react_hooks","styled","Icon","Box","React"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/Token.tsx","../src/styles.ts","../src/TokenTypes.ts"],"sourcesContent":["import Token from \"./Token\";\n\nexport default Token;\nexport { Token };\nexport * from \"./TokenTypes\";\n","import * as React from \"react\";\nimport { mergeRefs } from \"@sproutsocial/seeds-react-utilities\";\nimport { useTextContent } from \"@sproutsocial/seeds-react-hooks\";\nimport Box from \"@sproutsocial/seeds-react-box\";\nimport Icon from \"@sproutsocial/seeds-react-icon\";\nimport { VisuallyHidden } from \"@sproutsocial/seeds-react-visually-hidden\";\nimport Container from \"./styles\";\nimport type { TypeTokenProps } from \"./TokenTypes\";\n\nconst Token = ({\n children,\n closeable = true,\n onClick,\n qa,\n valid = true,\n disabled = false,\n palette = \"neutral\",\n innerRef,\n ...rest\n}: TypeTokenProps) => {\n const textContainer = useTextContent(\"\");\n\n return (\n <Container\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-ignore some legacy ref type mismatch between divs\n ref={mergeRefs([innerRef ?? null, textContainer])}\n valid={valid}\n palette={palette}\n type={closeable || onClick ? \"button\" : undefined}\n as={closeable || onClick ? \"button\" : \"div\"}\n closeable={closeable || !!onClick}\n disabled={disabled}\n onClick={onClick}\n data-qa-token={textContainer.current}\n data-qa-token-iscloseable={closeable === true}\n data-qa-token-isvalid={valid === true}\n data-qa-token-isdisabled={disabled === true}\n {...qa}\n {...rest}\n >\n {!valid && (\n <>\n <VisuallyHidden as=\"div\" role=\"status\">\n This is an invalid token\n </VisuallyHidden>\n <Icon\n aria-hidden\n pr={300}\n name=\"circle-exclamation-solid\"\n size=\"mini\"\n />\n <VisuallyHidden>Invalid</VisuallyHidden>\n </>\n )}\n {closeable ? (\n <Box display=\"flex\" alignItems=\"center\" justifyContent=\"space-between\">\n <Box as=\"span\" display=\"flex\" alignItems=\"center\">\n {children}\n </Box>\n <Icon aria-hidden pl={300} name=\"x-solid\" size=\"mini\" />\n </Box>\n ) : (\n children\n )}\n </Container>\n );\n};\n\nexport default Token;\n","import styled, { css } from \"styled-components\";\nimport { COMMON } from \"@sproutsocial/seeds-react-system-props\";\nimport { focusRing } from \"@sproutsocial/seeds-react-mixins\";\nimport { useInteractiveColor } from \"@sproutsocial/seeds-react-hooks\";\nimport type { TypeTokenProps } from \"./TokenTypes\";\n\nconst Container = styled.button<TypeTokenProps>`\n position: relative;\n display: inline-flex;\n align-items: center;\n margin: 0;\n line-height: 1;\n outline: none;\n /* Theme Properties */\n ${({ theme }) => css`\n ${theme.typography[200]}\n font-family: ${theme.fontFamily};\n font-weight: ${theme.fontWeights.normal};\n border: 1px solid ${theme.colors.container.border.base};\n border-radius: ${theme.radii[500]};\n color: ${theme.colors.text.body};\n background: ${theme.colors.container.background.base};\n padding: ${theme.space[200]} ${theme.space[300]};\n transition: all ${theme.duration.fast} ${theme.easing.ease_inout};\n `}\n\n &:focus {\n ${focusRing}\n }\n\n ${({ closeable, theme }) =>\n closeable &&\n css`\n cursor: pointer;\n &:hover,\n &:active {\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.base)};\n }\n `}\n\n ${({ theme, palette }) =>\n palette === \"blue\" &&\n css`\n color: ${theme.colors.text.body};\n background: ${theme.colors.container.background.decorative.blue};\n border: 1px solid ${theme.colors.container.border.decorative.blue};\n &:hover,\n &:active {\n cursor: pointer;\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.decorative.blue)};\n }\n `}\n\n ${({ disabled, theme }) =>\n disabled &&\n css`\n opacity: 0.4;\n cursor: not-allowed;\n &:hover,\n &:active {\n box-shadow: none;\n border: 1px solid ${theme.colors.container.border.base};\n }\n `}\n \n ${({ valid, theme }) =>\n !valid &&\n css`\n color: ${theme.colors.text.error};\n background: ${theme.colors.container.background.error};\n border: 1px solid ${theme.colors.container.border.error};\n &:hover {\n box-shadow: ${theme.shadows.low};\n border: 1px solid\n ${useInteractiveColor(theme.colors.container.border.error)};\n }\n `}\n\n ${COMMON}\n`;\n\nexport default Container;\n","import * as React from \"react\";\nimport type {\n TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n} from \"@sproutsocial/seeds-react-system-props\";\n\ntype TypeQaProps = object;\n\nexport interface TypeTokenProps\n extends TypeStyledComponentsCommonProps,\n TypeSystemCommonProps,\n Omit<React.ComponentPropsWithoutRef<\"button\">, \"color\"> {\n onClick?: (event: React.MouseEvent<Element, MouseEvent>) => void;\n children: React.ReactNode;\n qa?: TypeQaProps;\n\n /** Show the close icon in the token. Can be used with or without icon prop */\n closeable?: boolean;\n\n /** Indicates whether the token value is valid or not */\n valid?: boolean;\n\n /** Indicates whether the token is disabled */\n disabled?: boolean;\n palette?: \"neutral\" | \"blue\";\n as?: TypeStyledComponentsCommonProps[\"as\"];\n\n /** Used to get a reference to the underlying element */\n innerRef?: React.Ref<HTMLElement>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,mCAA0B;AAC1B,IAAAA,4BAA+B;AAC/B,6BAAgB;AAChB,8BAAiB;AACjB,yCAA+B;;;ACL/B,+BAA4B;AAC5B,sCAAuB;AACvB,gCAA0B;AAC1B,+BAAoC;AAGpC,IAAM,YAAY,yBAAAC,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQrB,CA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AAW,UACtC,UACH;AAAA,UACA,4CAAC,wBAAAD,SAAA,EAAK,eAAW,MAAC,IAAI,KAAK,MAAK,WAAU,MAAK,QAAO;AAAA,WACxD,IAEA;AAAA;AAAA;AAAA,EAEJ;AAEJ;AAEA,IAAO,gBAAQ;;;AErEf,IAAAE,SAAuB;;;AHEvB,IAAO,gBAAQ;","names":["import_seeds_react_hooks","styled","Icon","Box","React"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-token",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Seeds React Token",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
@@ -24,6 +24,7 @@
24
24
  "@sproutsocial/seeds-react-icon": "^1.1.1",
25
25
  "@sproutsocial/seeds-react-visually-hidden": "^1.0.1",
26
26
  "@sproutsocial/seeds-react-hooks": "^3.0.1",
27
+ "@sproutsocial/seeds-react-utilities": "^4.0.1",
27
28
  "@sproutsocial/seeds-react-mixins": "^4.1.0"
28
29
  },
29
30
  "devDependencies": {
package/src/Token.tsx CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as React from "react";
2
+ import { mergeRefs } from "@sproutsocial/seeds-react-utilities";
2
3
  import { useTextContent } from "@sproutsocial/seeds-react-hooks";
3
4
  import Box from "@sproutsocial/seeds-react-box";
4
5
  import Icon from "@sproutsocial/seeds-react-icon";
@@ -14,6 +15,7 @@ const Token = ({
14
15
  valid = true,
15
16
  disabled = false,
16
17
  palette = "neutral",
18
+ innerRef,
17
19
  ...rest
18
20
  }: TypeTokenProps) => {
19
21
  const textContainer = useTextContent("");
@@ -22,7 +24,7 @@ const Token = ({
22
24
  <Container
23
25
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24
26
  //@ts-ignore some legacy ref type mismatch between divs
25
- ref={textContainer}
27
+ ref={mergeRefs([innerRef ?? null, textContainer])}
26
28
  valid={valid}
27
29
  palette={palette}
28
30
  type={closeable || onClick ? "button" : undefined}
package/src/TokenTypes.ts CHANGED
@@ -10,7 +10,7 @@ export interface TypeTokenProps
10
10
  extends TypeStyledComponentsCommonProps,
11
11
  TypeSystemCommonProps,
12
12
  Omit<React.ComponentPropsWithoutRef<"button">, "color"> {
13
- onClick?: (event: React.SyntheticEvent<HTMLButtonElement>) => void;
13
+ onClick?: (event: React.MouseEvent<Element, MouseEvent>) => void;
14
14
  children: React.ReactNode;
15
15
  qa?: TypeQaProps;
16
16
 
@@ -24,4 +24,7 @@ export interface TypeTokenProps
24
24
  disabled?: boolean;
25
25
  palette?: "neutral" | "blue";
26
26
  as?: TypeStyledComponentsCommonProps["as"];
27
+
28
+ /** Used to get a reference to the underlying element */
29
+ innerRef?: React.Ref<HTMLElement>;
27
30
  }