@seeqdev/qomponents 0.0.1 → 0.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.
Files changed (60) hide show
  1. package/README.md +33 -13
  2. package/dist/Checkbox/Checkbox.d.ts +7 -0
  3. package/dist/Checkbox/Checkbox.stories.d.ts +5 -0
  4. package/dist/Checkbox/Checkbox.test.d.ts +1 -0
  5. package/dist/Checkbox/Checkbox.types.d.ts +15 -0
  6. package/dist/Checkbox/index.d.ts +1 -0
  7. package/dist/TextArea/TextArea.d.ts +7 -0
  8. package/dist/TextArea/TextArea.stories.d.ts +5 -0
  9. package/dist/TextArea/TextArea.test.d.ts +1 -0
  10. package/dist/TextArea/TextArea.types.d.ts +26 -0
  11. package/dist/TextArea/index.d.ts +1 -0
  12. package/dist/TextField/TextField.types.d.ts +0 -2
  13. package/dist/index.d.ts +6 -0
  14. package/dist/index.esm.js +93 -14
  15. package/dist/index.esm.js.map +1 -1
  16. package/dist/index.js +95 -13
  17. package/dist/index.js.map +1 -1
  18. package/dist/sharedTypes.d.ts +1 -0
  19. package/dist/styles.css +271 -0
  20. package/package.json +2 -1
  21. package/dist/Button/Button.js +0 -44
  22. package/dist/Button/Button.js.map +0 -1
  23. package/dist/Button/Button.stories.js +0 -49
  24. package/dist/Button/Button.stories.js.map +0 -1
  25. package/dist/Button/Button.test.js +0 -49
  26. package/dist/Button/Button.test.js.map +0 -1
  27. package/dist/Button/Button.types.js +0 -4
  28. package/dist/Button/Button.types.js.map +0 -1
  29. package/dist/Button/index.js +0 -2
  30. package/dist/Button/index.js.map +0 -1
  31. package/dist/Icon/Icon.js +0 -38
  32. package/dist/Icon/Icon.js.map +0 -1
  33. package/dist/Icon/Icon.stories.js +0 -35
  34. package/dist/Icon/Icon.stories.js.map +0 -1
  35. package/dist/Icon/Icon.test.js +0 -55
  36. package/dist/Icon/Icon.test.js.map +0 -1
  37. package/dist/Icon/Icon.types.js +0 -16
  38. package/dist/Icon/Icon.types.js.map +0 -1
  39. package/dist/Icon/index.js +0 -2
  40. package/dist/Icon/index.js.map +0 -1
  41. package/dist/TextField/TextField.js +0 -45
  42. package/dist/TextField/TextField.js.map +0 -1
  43. package/dist/TextField/TextField.stories.js +0 -25
  44. package/dist/TextField/TextField.stories.js.map +0 -1
  45. package/dist/TextField/TextField.test.js +0 -35
  46. package/dist/TextField/TextField.test.js.map +0 -1
  47. package/dist/TextField/TextField.types.js +0 -2
  48. package/dist/TextField/TextField.types.js.map +0 -1
  49. package/dist/TextField/index.js +0 -2
  50. package/dist/TextField/index.js.map +0 -1
  51. package/dist/Tooltip/Tooltip.js +0 -30
  52. package/dist/Tooltip/Tooltip.js.map +0 -1
  53. package/dist/Tooltip/Tooltip.stories.js +0 -32
  54. package/dist/Tooltip/Tooltip.stories.js.map +0 -1
  55. package/dist/Tooltip/Tooltip.types.js +0 -3
  56. package/dist/Tooltip/Tooltip.types.js.map +0 -1
  57. package/dist/Tooltip/index.js +0 -2
  58. package/dist/Tooltip/index.js.map +0 -1
  59. package/dist/utils/browserId.js +0 -29
  60. package/dist/utils/browserId.js.map +0 -1
@@ -1,49 +0,0 @@
1
- import React from 'react';
2
- import '@testing-library/jest-dom';
3
- import { render, screen } from '@testing-library/react';
4
- import userEvent from '@testing-library/user-event';
5
- import Button from './Button';
6
- describe('Button', () => {
7
- class Context {
8
- testId = 'buttonTestId';
9
- label = 'button label';
10
- props = {
11
- label: this.label,
12
- onClick: jest.fn(),
13
- testId: this.testId,
14
- };
15
- }
16
- let tc;
17
- beforeEach(() => {
18
- tc = new Context();
19
- });
20
- const renderButton = (props) => render(React.createElement(Button, { ...props }));
21
- it('renders button label', () => {
22
- renderButton(tc.props);
23
- expect(screen.getByText(tc.label)).toBeInTheDocument();
24
- });
25
- it('calls on click', async () => {
26
- renderButton(tc.props);
27
- await userEvent.click(screen.getByTestId(tc.testId));
28
- expect(tc.props.onClick).toHaveBeenCalled();
29
- });
30
- it('renders disabled button', () => {
31
- renderButton({ ...tc.props, disabled: true });
32
- expect(screen.getByText(tc.label)).toBeDisabled();
33
- });
34
- it('respects stopPropagation default', async () => {
35
- const callOnPropagation = jest.fn();
36
- render(React.createElement("div", { onClick: callOnPropagation },
37
- React.createElement(Button, { ...tc.props })));
38
- await userEvent.click(screen.getByTestId(tc.testId));
39
- expect(callOnPropagation).not.toHaveBeenCalled();
40
- });
41
- it('propagates click event if not told not to', async () => {
42
- const callOnPropagation = jest.fn();
43
- render(React.createElement("div", { onClick: callOnPropagation },
44
- React.createElement(Button, { ...{ ...tc.props, stopPropagation: false } })));
45
- await userEvent.click(screen.getByTestId(tc.testId));
46
- expect(callOnPropagation).toHaveBeenCalled();
47
- });
48
- });
49
- //# sourceMappingURL=Button.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.test.js","sourceRoot":"","sources":["../../src/Button/Button.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAEpD,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,MAAM,OAAO;QACX,MAAM,GAAG,cAAc,CAAC;QACxB,KAAK,GAAG,cAAc,CAAC;QACvB,KAAK,GAAgB;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;YAClB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;KACH;IAED,IAAI,EAAW,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,CAAC,KAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAC,MAAM,OAAK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CAA2C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,iBAAiB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,CACJ,6BAAK,OAAO,EAAE,iBAAiB;YAC7B,oBAAC,MAAM,OAAK,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,GAAI,CACnD,CACP,CAAC;QACF,MAAM,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,MAAM,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- export const buttonTypes = ['button', 'reset', 'submit', 'link'];
2
- export const buttonSizes = ['sm', 'lg'];
3
- export const buttonVariants = ['outline', 'theme', 'theme-light', 'warning', 'danger', 'no-border'];
4
- //# sourceMappingURL=Button.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.types.js","sourceRoot":"","sources":["../../src/Button/Button.types.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,CAAU,CAAC;AACjD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default } from "./Button";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
package/dist/Icon/Icon.js DELETED
@@ -1,38 +0,0 @@
1
- import React from 'react';
2
- import '../styles.css';
3
- import Tooltip from '../Tooltip';
4
- /**
5
- * Icon:
6
- * - access to Seeq custom icons by providing the desired icon
7
- * - leverage "type" to style your icon
8
- */
9
- const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small, color, testId, customId, tooltip, tooltipDelay, tooltipPlacement, number, hasExternalTooltipHandler = false, }) => {
10
- if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {
11
- const errorMessage = color === undefined || color === ''
12
- ? 'Icon with type="color" must have prop color specified.'
13
- : 'Icon with prop color must have type="color".';
14
- return React.createElement("div", { className: "tw-text-sq-danger-color" }, errorMessage);
15
- }
16
- const colorClasses = {
17
- 'theme': 'tw-text-sq-color-dark',
18
- 'white': 'tw-text-white',
19
- 'dark-gray': 'tw-text-sq-fairly-dark-gray',
20
- 'warning': 'tw-text-sq-warning-color',
21
- 'darkish-gray': 'tw-text-sq-darkish-gray',
22
- 'gray': 'tw-text-sq-disabled-gray',
23
- 'color': '',
24
- 'info': 'tw-text-sq-link',
25
- 'text': 'tw-text-sq-text-color',
26
- 'inherit': '',
27
- 'danger': 'tw-text-sq-danger-color',
28
- 'theme-light': 'tw-text-sq-color-light',
29
- 'success': 'tw-text-sq-success-color',
30
- };
31
- const iconPrefix = icon.startsWith('fc') ? 'fc' : 'fa';
32
- const style = type === 'color' && color ? { color } : {};
33
- const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''} ${colorClasses[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;
34
- const iconTag = (React.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number }));
35
- return !hasExternalTooltipHandler && tooltip && tooltip !== '' ? (React.createElement(Tooltip, { text: tooltip, delay: tooltipDelay, position: tooltipPlacement }, iconTag)) : (iconTag);
36
- };
37
- export default Icon;
38
- //# sourceMappingURL=Icon.js.map
@@ -1 +0,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AAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACvD,MAAM,KAAK,GAAG,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,MAAM,iBAAiB,GAAG,GAAG,UAAU,IAAI,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAC7F,YAAY,CAAC,IAAI,CACnB,IAAI,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,eAAe,EAAE,CAAC;IAEzD,MAAM,OAAO,GAAG,CACd,2BACE,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,iBACH,MAAM,mBACJ,QAAQ,EACvB,EAAE,EAAE,EAAE,iBACO,MAAM,GACnB,CACH,CAAC;IAEF,OAAO,CAAC,yBAAyB,IAAI,OAAO,IAAI,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAC/D,oBAAC,OAAO,IAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,IACpE,OAAO,CACA,CACX,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,IAAI,CAAC"}
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import Icon from './Icon';
3
- import { iconTypes } from './Icon.types';
4
- export default {
5
- title: 'Icons',
6
- };
7
- export const AllIcons = () => {
8
- const renderAllVariations = () => {
9
- return (React.createElement(React.Fragment, null,
10
- React.createElement("br", null),
11
- React.createElement("br", null),
12
- iconTypes.map((iconType) => {
13
- return (React.createElement("div", { key: `${iconType}` },
14
- React.createElement("b", null,
15
- "type=",
16
- iconType),
17
- React.createElement("br", null),
18
- React.createElement(Icon, { icon: 'fc-announcements', small: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'purple' : undefined }),
19
- React.createElement(Icon, { icon: 'fc-announcements', extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? '#928378' : undefined }),
20
- React.createElement(Icon, { icon: 'fc-announcements', large: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined }),
21
- React.createElement("br", null)));
22
- })));
23
- };
24
- return (React.createElement("div", { className: "tw-grid tw-grid-cols-3 tw-gap-4" },
25
- React.createElement("div", { className: "color_topic" },
26
- React.createElement("b", null, "Topic Colors"),
27
- renderAllVariations()),
28
- React.createElement("div", { className: "color_analysis" },
29
- React.createElement("b", null, "Analysis Colors"),
30
- renderAllVariations()),
31
- React.createElement("div", { className: "color_datalab" },
32
- React.createElement("b", null, "Datalab Colors"),
33
- renderAllVariations())));
34
- };
35
- //# sourceMappingURL=Icon.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Icon.stories.js","sourceRoot":"","sources":["../../src/Icon/Icon.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAe;IACb,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,MAAM,mBAAmB,GAAG,GAAG,EAAE;QAC/B,OAAO,CACL;YACE,+BAAM;YACN,+BAAM;YACL,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;gBAC1B,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,QAAQ,EAAE;oBACrB;;wBAAS,QAAQ,CAAK;oBACtB,+BAAM;oBACN,oBAAC,IAAI,IACH,IAAI,EAAE,kBAAkB,EACxB,KAAK,EAAE,IAAI,EACX,eAAe,EAAE,QAAQ,EACzB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,GAClD;oBACF,oBAAC,IAAI,IACH,IAAI,EAAE,kBAAkB,EACxB,eAAe,EAAE,QAAQ,EACzB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GACnD;oBACF,oBAAC,IAAI,IACH,IAAI,EAAE,kBAAkB,EACxB,KAAK,EAAE,IAAI,EACX,eAAe,EAAE,QAAQ,EACzB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,GAChD;oBACF,+BAAM,CACF,CACP,CAAC;YACJ,CAAC,CAAC,CACD,CACJ,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,6BAAK,SAAS,EAAC,aAAa;YAC1B,8CAAmB;YAClB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,iDAAsB;YACrB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,55 +0,0 @@
1
- import React from 'react';
2
- import '@testing-library/jest-dom';
3
- import { render, screen } from '@testing-library/react';
4
- import Icon from './Icon';
5
- describe('Icon', () => {
6
- class Context {
7
- testId = 'iconTestId';
8
- icon = 'testIcon';
9
- props = {
10
- icon: this.icon,
11
- onClick: jest.fn(),
12
- testId: this.testId,
13
- };
14
- }
15
- let tc;
16
- beforeEach(() => {
17
- tc = new Context();
18
- });
19
- const renderIcon = (props) => render(React.createElement(Icon, { ...props }));
20
- it('renders icon', () => {
21
- renderIcon(tc.props);
22
- expect(screen.getByTestId(tc.testId)).toHaveClass(tc.icon);
23
- });
24
- it('renders large icon', () => {
25
- renderIcon({ ...tc.props, large: true });
26
- expect(screen.getByTestId(tc.testId)).toHaveClass('fa-lg');
27
- });
28
- it('renders small icon', () => {
29
- renderIcon({ ...tc.props, small: true });
30
- expect(screen.getByTestId(tc.testId)).toHaveClass('fa-sm');
31
- });
32
- describe('icon types', () => {
33
- it('renders the theme type by default', () => {
34
- renderIcon(tc.props);
35
- expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-color-dark');
36
- });
37
- it('renders the white icon', () => {
38
- renderIcon({ ...tc.props, type: 'white' });
39
- expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-white');
40
- });
41
- it('renders the text-type icon', () => {
42
- renderIcon({ ...tc.props, type: 'text' });
43
- expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-text-color');
44
- });
45
- it('renders the color-type icon', () => {
46
- renderIcon({ ...tc.props, type: 'color', color: '#AABBFF' });
47
- expect(screen.getByTestId(tc.testId)).toHaveStyle('color: #AABBFF');
48
- });
49
- it('renders a warning if type=color and no color is provided', () => {
50
- renderIcon({ ...tc.props, type: 'color' });
51
- expect(screen.getByText('Icon with type="color" must have prop color specified.')).toBeInTheDocument();
52
- });
53
- });
54
- });
55
- //# sourceMappingURL=Icon.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Icon.test.js","sourceRoot":"","sources":["../../src/Icon/Icon.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,IAAI,MAAM,QAAQ,CAAC;AAG1B,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,MAAM,OAAO;QACX,MAAM,GAAG,YAAY,CAAC;QACtB,IAAI,GAAG,UAAU,CAAC;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,iBAAiB,EAAE,CAAC;QACzG,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,16 +0,0 @@
1
- export const iconTypes = [
2
- 'theme',
3
- 'white',
4
- 'dark-gray',
5
- 'darkish-gray',
6
- 'gray',
7
- 'color',
8
- 'info',
9
- 'text',
10
- 'warning',
11
- 'inherit',
12
- 'danger',
13
- 'theme-light',
14
- 'success',
15
- ];
16
- //# sourceMappingURL=Icon.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Icon.types.js","sourceRoot":"","sources":["../../src/Icon/Icon.types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO;IACP,OAAO;IACP,WAAW;IACX,cAAc;IACd,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,SAAS;IACT,SAAS;IACT,QAAQ;IACR,aAAa;IACb,SAAS;CACD,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default } from './Icon';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Icon/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,45 +0,0 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import '../styles.css';
3
- /**
4
- * Textfield.
5
- */
6
- export const TextField = React.forwardRef((props, ref) => {
7
- const { readonly = false, onChange, onKeyUp, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', } = props;
8
- const internalRef = useRef(null);
9
- const [cursor, setCursor] = useState(null);
10
- const setAllRefs = (receivedRef) => {
11
- if (ref)
12
- ref.current = receivedRef;
13
- internalRef.current = receivedRef;
14
- };
15
- useEffect(() => {
16
- const input = internalRef.current;
17
- if (input)
18
- input.setSelectionRange(cursor, cursor);
19
- }, [ref, cursor, value]);
20
- const handleChange = (e) => {
21
- setCursor(e.target.selectionStart);
22
- onChange && onChange(e);
23
- };
24
- useEffect(() => {
25
- /**
26
- * we need to change the value only if it's different since the internal state of "input" will change it anyway
27
- * this will only be the case when the value has been changed externally via store (undo / redo)
28
- */
29
- if (value !== null && value !== undefined && value !== internalRef.current?.value && internalRef.current) {
30
- // we need to use this method because using the value props directly will switch the input to a "controlled"
31
- // component
32
- internalRef.current.value = `${value}`;
33
- }
34
- }, [value]);
35
- const baseClasses = 'tw-height-34 tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm disabled:tw-pointer-events-none' +
36
- ' disabled:tw-cursor-not-allowed tw-p-1 tw-border-sq-disabled-gray tw-border-solid tw-border' +
37
- ' tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';
38
- const sizeClasses = {
39
- sm: 'tw-text-sm',
40
- lg: 'tw-text-xl',
41
- };
42
- const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames}`;
43
- return (React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: readonly, autoComplete: "none", onChange: handleChange, onKeyUp: onKeyUp }));
44
- });
45
- //# sourceMappingURL=TextField.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../src/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAA4C,KAAK,CAAC,UAAU,CAChF,CAAC,KAAK,EAAE,GAAQ,EAAE,EAAE;IAClB,MAAM,EACJ,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,EAAE,EACF,IAAI,EACJ,IAAI,GAAG,IAAI,EACX,KAAK,EACL,WAAW,EACX,eAAe,EACf,MAAM,EACN,IAAI,GAAG,M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,cAAc,GAAG,GAAG,WAAW,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,eAAe,EAAE,CAAC;IAEhF,OAAO,CACL,+BACE,GAAG,EAAE,UAAU,iBACF,MAAM,EACnB,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAC,MAAM,EACnB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,OAAO,GAChB,CACH,CAAC;AACJ,CAAC,CACF,CAAC"}
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { TextField } from './TextField';
3
- export default {
4
- title: 'TextField',
5
- };
6
- export const AllTextFields = () => {
7
- const renderAllVariations = () => (React.createElement("div", { className: "tw-p-4" },
8
- React.createElement("div", { className: "tw-p-4" },
9
- React.createElement(TextField, { value: "value provided" })),
10
- React.createElement("div", { className: "tw-p-4" },
11
- React.createElement(TextField, { placeholder: "placeholder text" })),
12
- React.createElement("div", { className: "tw-p-4" },
13
- React.createElement(TextField, { value: "read-only", readonly: true }))));
14
- return (React.createElement("div", { className: "tw-grid tw-grid-cols-3 tw-gap-4" },
15
- React.createElement("div", { className: "color_topic" },
16
- React.createElement("b", null, "Topic Colors"),
17
- renderAllVariations()),
18
- React.createElement("div", { className: "color_analysis" },
19
- React.createElement("b", null, "Analysis Colors"),
20
- renderAllVariations()),
21
- React.createElement("div", { className: "color_datalab" },
22
- React.createElement("b", null, "Datalab Colors"),
23
- renderAllVariations())));
24
- };
25
- //# sourceMappingURL=TextField.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextField.stories.js","sourceRoot":"","sources":["../../src/TextField/TextField.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,eAAe;IACb,KAAK,EAAE,WAAW;CACnB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,CAChC,6BAAK,SAAS,EAAC,QAAQ;QACrB,6BAAK,SAAS,EAAC,QAAQ;YACrB,oBAAC,SAAS,IAAC,KAAK,EAAC,gBAAgB,GAAG,CAChC;QACN,6BAAK,SAAS,EAAC,QAAQ;YACrB,oBAAC,SAAS,IAAC,WAAW,EAAC,kBAAkB,GAAG,CACxC;QACN,6BAAK,SAAS,EAAC,QAAQ;YACrB,oBAAC,SAAS,IAAC,KAAK,EAAC,WAAW,EAAC,QAAQ,EAAE,IAAI,GAAI,CAC3C,CACF,CACP,CAAC;IACF,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,6BAAK,SAAS,EAAC,aAAa;YAC1B,8CAAmB;YAClB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,iDAAsB;YACrB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import '@testing-library/jest-dom';
3
- import { render, screen } from '@testing-library/react';
4
- import userEvent from '@testing-library/user-event';
5
- import { TextField } from './TextField';
6
- describe('TextField', () => {
7
- class Context {
8
- testId = 'textFieldTestId';
9
- props = {
10
- onChange: jest.fn(),
11
- testId: this.testId,
12
- };
13
- }
14
- let tc;
15
- beforeEach(() => {
16
- tc = new Context();
17
- });
18
- const renderTextField = (props) => render(React.createElement(TextField, { ...props }));
19
- it('renders the provided value', () => {
20
- const value = 'hello';
21
- renderTextField({ ...tc.props, value });
22
- expect(screen.getByDisplayValue(value)).toBeInTheDocument();
23
- });
24
- it('renders the provided placeholder', () => {
25
- const placeholder = 'Prompt to enter';
26
- renderTextField({ ...tc.props, placeholder });
27
- expect(screen.getByPlaceholderText(placeholder)).toBeInTheDocument();
28
- });
29
- it('calls onChange handler', async () => {
30
- renderTextField({ ...tc.props });
31
- await userEvent.type(screen.getByTestId(tc.testId), 'trigger');
32
- expect(tc.props.onChange).toHaveBeenCalled();
33
- });
34
- });
35
- //# sourceMappingURL=TextField.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextField.test.js","sourceRoot":"","sources":["../../src/TextField/TextField.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,OAAO;QACX,MAAM,GAAG,iBAAiB,CAAC;QAC3B,KAAK,GAAmB;YACtB,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;YACnB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;KACH;IAED,IAAI,EAAW,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,MAAM,eAAe,GAAG,CAAC,KAAqB,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAC,SAAS,OAAK,KAAK,GAAI,CAAC,CAAC;IAEpF,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACpC,MAAM,KAAK,GAAG,OAAO,CAAC;QACtB,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,WAAW,GAAG,iBAAiB,CAAC;QACtC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;QAC9C,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACvE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wBAAwB,EAAE,KAAK,IAAI,EAAE;QACtC,eAAe,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QACjC,MAAM,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;QAC/D,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=TextField.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TextField.types.js","sourceRoot":"","sources":["../../src/TextField/TextField.types.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export { TextField as default } from './TextField';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
@@ -1,30 +0,0 @@
1
- import React from 'react';
2
- import '../styles.css';
3
- import { DEFAULT_TOOL_TIP_DELAY } from './Tooltip.types';
4
- /**
5
- * This component displays a Tooltip for the provided children.
6
- */
7
- export const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP_DELAY, }) => {
8
- const arrowBaseClasses = "before:tw-content-[''] before:tw-absolute before:tw-border-8";
9
- const centerArrowVertically = 'before:tw-top-1/2 before:-tw-translate-y-1/2';
10
- const centerArrowHorizontally = 'before:tw-left-1/2 before:-tw-translate-x-1/2';
11
- const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent
12
- before:tw-border-l-transparent before:tw-border-r-black`;
13
- const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent
14
- before:tw-border-l-black before:tw-border-r-transparent`;
15
- const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black
16
- before:tw-border-r-transparent before:tw-border-l-transparent before:tw-border-t-transparent`;
17
- const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent
18
- before:tw-border-t-black before:tw-border-l-transparent before:tw-border-r-transparent`;
19
- const placements = {
20
- top: `-tw-top-2 -tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowTop}`,
21
- left: `-tw-translate-x-full -tw-left-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowLeft}`,
22
- right: `tw-translate-x-full -tw-right-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowRight}`,
23
- bottom: `-tw-bottom-2 tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowBottom}`,
24
- };
25
- return (React.createElement("div", { className: "tw-group tw-relative tw-inline-block" },
26
- children,
27
- React.createElement("div", { className: `tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms]
28
- tw-absolute tw-opacity-0 group-hover:tw-opacity-100 tw-rounded tw-bg-black tw-p-2 tw-text-xs tw-text-white ${placements[position]}` }, text)));
29
- };
30
- //# sourceMappingURL=Tooltip.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,sBAAsB,EAAgB,MAAM,iBAAiB,CAAC;AAEvE;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAA0C,CAAC,EAC7D,QAAQ,GAAG,QAAQ,EACnB,QAAQ,EACR,IAAI,EACJ,KAAK,GAAG,sBAAsB,GAC/B,EAAE,EAAE;IACH,MAAM,gBAAgB,GAAG,8DAA8D,CAAC;IACxF,MAAM,qBAAqB,GAAG,8CAA8C,CAAC;IAC7E,MAAM,uBAAuB,GAAG,+CAA+C,CAAC;IAChF,MAAM,UAAU,GAAG,GAAG,gBAAgB,IAAI,qBAAqB;0DACP,CAAC;IAEzD,MAAM,SAAS,GAAG,GAAG,gBAAgB,IAAI,qBAAqB;2DACL,CAAC;IAE1D,MAAM,WAAW,GAAG,GAAG,gBAAgB,IAAI,uBAAuB;+FAC2B,CAAC;IAC9F,MAAM,QAAQ,GAAG,GAAG,gBAAgB,IAAI,uBAAuB;yFACwB,CAAC;IAExF,MAAM,UAAU,GAAG;QACjB,GAAG,EAAE,kEAAkE,QAAQ,EAAE;QACjF,IAAI,EAAE,kEAAkE,SAAS,EAAE;QACnF,KAAK,EAAE,kEAAkE,UAAU,EAAE;QACrF,MAAM,EAAE,oEAAoE,WAAW,EAAE;KAC1F,CAAC;IAEF,OAAO,CACL,6BAAK,SAAS,EAAC,sCAAsC;QAClD,QAAQ;QACT,6BACE,SAAS,EAAE,4FAA4F,KAAK;qHACC,UAAU,CAAC,QAAQ,CAAC,EAAE,IAClI,IAAI,CACD,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,32 +0,0 @@
1
- import React from 'react';
2
- import { Tooltip } from './Tooltip';
3
- import Icon from '../Icon';
4
- import Button from '../Button';
5
- import { tooltipPositions } from './Tooltip.types';
6
- export default {
7
- title: 'Tooltip',
8
- };
9
- export const AllTooltips = () => {
10
- const renderButtonsWithTooltip = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_button` },
11
- React.createElement(Tooltip, { text: `Tooltip on the ${position}`, position: position },
12
- React.createElement(Button, { label: position })))));
13
- const renderIconsWithHtmlTooltip = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_icon` },
14
- React.createElement(Tooltip, { text: React.createElement("div", null,
15
- React.createElement("h2", null, "Fancy Tooltip"),
16
- " This is a special tooltip. Why?",
17
- React.createElement("br", null),
18
- "Because it supports ",
19
- React.createElement("b", null, "HTML!")), position: position },
20
- React.createElement(Icon, { icon: "fc-sun" })))));
21
- const renderTextTooltipOnText = () => tooltipPositions.map((position) => (React.createElement("div", { key: `${position}_text` },
22
- React.createElement(Tooltip, { text: "Helpful information provided here", position: position },
23
- React.createElement("span", null,
24
- "Hover for Tooltip (on the ",
25
- position,
26
- ")")))));
27
- return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4 tw-text-center" },
28
- renderButtonsWithTooltip(),
29
- renderIconsWithHtmlTooltip(),
30
- renderTextTooltipOnText()));
31
- };
32
- //# sourceMappingURL=Tooltip.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tooltip.stories.js","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,eAAe;IACb,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE;IAC9B,MAAM,wBAAwB,GAAG,GAAG,EAAE,CACpC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACjC,6BAAK,GAAG,EAAE,GAAG,QAAQ,SAAS;QAC5B,oBAAC,OAAO,IAAC,IAAI,EAAE,kBAAkB,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ;YAC7D,oBAAC,MAAM,IAAC,KAAK,EAAE,QAAQ,GAAI,CACnB,CACN,CACP,CAAC,CAAC;IAEL,MAAM,0BAA0B,GAAG,GAAG,EAAE,CACtC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACjC,6BAAK,GAAG,EAAE,GAAG,QAAQ,OAAO;QAC1B,oBAAC,OAAO,IACN,IAAI,EACF;gBACE,gDAAsB;;gBACtB,+BAAM;;gBACc,uCAAY,CAC5B,EAER,QAAQ,EAAE,QAAQ;YAClB,oBAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,GAAG,CACd,CACN,CACP,CAAC,CAAC;IAEL,MAAM,uBAAuB,GAAG,GAAG,EAAE,CACnC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CACjC,6BAAK,GAAG,EAAE,GAAG,QAAQ,OAAO;QAC1B,oBAAC,OAAO,IAAC,IAAI,EAAC,mCAAmC,EAAC,QAAQ,EAAE,QAAQ;YAClE;;gBAAiC,QAAQ;oBAAS,CAC1C,CACN,CACP,CAAC,CAAC;IAEL,OAAO,CACL,6BAAK,SAAS,EAAC,gDAAgD;QAC5D,wBAAwB,EAAE;QAC1B,0BAA0B,EAAE;QAC5B,uBAAuB,EAAE,CACtB,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- export const DEFAULT_TOOL_TIP_DELAY = 1000;
2
- export const tooltipPositions = ['top', 'left', 'right', 'bottom'];
3
- //# sourceMappingURL=Tooltip.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Tooltip.types.js","sourceRoot":"","sources":["../../src/Tooltip/Tooltip.types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAC3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC"}
@@ -1,2 +0,0 @@
1
- export { Tooltip as default } from './Tooltip';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -1,29 +0,0 @@
1
- /**
2
- * @exports the browser id (i.e., 'IE 11' 'Chrome 90')
3
- * @see http://stackoverflow.com/questions/2400935/browser-detection-in-javascript
4
- */
5
- export const browserId = (function () {
6
- let tem;
7
- const ua = navigator.userAgent;
8
- let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
9
- if (/trident/i.test(M[1])) {
10
- tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
11
- return `IE ${tem[1] || ''}`;
12
- }
13
- if (M[1] === 'Chrome') {
14
- tem = ua.match(/\b(OPR|Edge?)\/(\d+)/);
15
- if (tem !== null) {
16
- return tem.slice(1).join(' ').replace('OPR', 'Opera').replace('Edg ', 'Edge ');
17
- }
18
- }
19
- M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
20
- if ((tem = ua.match(/version\/(\d+)/i)) !== null) {
21
- M.splice(1, 1, tem[1]);
22
- }
23
- return M.join(' ');
24
- })();
25
- export const browserName = browserId && browserId.split(' ', 2)[0];
26
- export const browserVersion = browserId && parseInt(browserId.split(' ', 2)[1], 10);
27
- export const browserIsFirefox = browserId && browserName === 'Firefox';
28
- export const browserIsEdgeBeforeChromium = browserName && browserVersion && browserName === 'Edge' && browserVersion < 70;
29
- //# sourceMappingURL=browserId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"browserId.js","sourceRoot":"","sources":["../../src/utils/browserId.ts"],"names":[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