@seeqdev/qomponents 0.0.0 → 0.0.2

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 (67) hide show
  1. package/README.md +33 -13
  2. package/dist/Button/Button.d.ts +5 -0
  3. package/dist/Button/Button.js +71 -0
  4. package/dist/Button/Button.js.map +1 -0
  5. package/dist/Button/Button.stories.d.ts +3 -5
  6. package/dist/Button/Button.stories.js +58 -0
  7. package/dist/Button/Button.stories.js.map +1 -0
  8. package/dist/Button/Button.test.js +49 -0
  9. package/dist/Button/Button.test.js.map +1 -0
  10. package/dist/Button/Button.types.d.ts +19 -4
  11. package/dist/Button/Button.types.js +4 -0
  12. package/dist/Button/Button.types.js.map +1 -0
  13. package/dist/Button/index.js +2 -0
  14. package/dist/Button/index.js.map +1 -0
  15. package/dist/FontCustom.woff +0 -0
  16. package/dist/FontCustom.woff2 +0 -0
  17. package/dist/Icon/Icon.d.ts +10 -0
  18. package/dist/Icon/Icon.js +54 -0
  19. package/dist/Icon/Icon.js.map +1 -0
  20. package/dist/Icon/Icon.stories.d.ts +5 -0
  21. package/dist/Icon/Icon.stories.js +40 -0
  22. package/dist/Icon/Icon.stories.js.map +1 -0
  23. package/dist/Icon/Icon.test.d.ts +1 -0
  24. package/dist/Icon/Icon.test.js +55 -0
  25. package/dist/Icon/Icon.test.js.map +1 -0
  26. package/dist/Icon/Icon.types.d.ts +38 -0
  27. package/dist/Icon/Icon.types.js +16 -0
  28. package/dist/Icon/Icon.types.js.map +1 -0
  29. package/dist/Icon/index.d.ts +1 -0
  30. package/dist/Icon/index.js +2 -0
  31. package/dist/Icon/index.js.map +1 -0
  32. package/dist/TextField/TextField.d.ts +7 -0
  33. package/dist/TextField/TextField.js +47 -0
  34. package/dist/TextField/TextField.js.map +1 -0
  35. package/dist/TextField/TextField.stories.d.ts +5 -0
  36. package/dist/TextField/TextField.stories.js +33 -0
  37. package/dist/TextField/TextField.stories.js.map +1 -0
  38. package/dist/TextField/TextField.test.d.ts +1 -0
  39. package/dist/TextField/TextField.test.js +35 -0
  40. package/dist/TextField/TextField.test.js.map +1 -0
  41. package/dist/TextField/TextField.types.d.ts +16 -0
  42. package/dist/TextField/TextField.types.js +2 -0
  43. package/dist/TextField/TextField.types.js.map +1 -0
  44. package/dist/TextField/index.d.ts +1 -0
  45. package/dist/TextField/index.js +2 -0
  46. package/dist/TextField/index.js.map +1 -0
  47. package/dist/Tooltip/Tooltip.d.ts +7 -0
  48. package/dist/Tooltip/Tooltip.js +30 -0
  49. package/dist/Tooltip/Tooltip.js.map +1 -0
  50. package/dist/Tooltip/Tooltip.stories.d.ts +5 -0
  51. package/dist/Tooltip/Tooltip.stories.js +32 -0
  52. package/dist/Tooltip/Tooltip.stories.js.map +1 -0
  53. package/dist/Tooltip/Tooltip.types.d.ts +9 -0
  54. package/dist/Tooltip/Tooltip.types.js +3 -0
  55. package/dist/Tooltip/Tooltip.types.js.map +1 -0
  56. package/dist/Tooltip/index.d.ts +1 -0
  57. package/dist/Tooltip/index.js +2 -0
  58. package/dist/Tooltip/index.js.map +1 -0
  59. package/dist/index.d.ts +6 -0
  60. package/dist/index.esm.js +182 -15
  61. package/dist/index.esm.js.map +1 -1
  62. package/dist/index.js +183 -13
  63. package/dist/index.js.map +1 -1
  64. package/dist/styles.css +1732 -181
  65. package/dist/utils/browserId.js +29 -0
  66. package/dist/utils/browserId.js.map +1 -0
  67. package/package.json +3 -1
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { TextFieldProps } from './TextField.types';
3
+ import '../styles.css';
4
+ /**
5
+ * Textfield.
6
+ */
7
+ export declare const TextField: React.FunctionComponent<TextFieldProps>;
@@ -0,0 +1,47 @@
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-solid tw-border';
37
+ const darkTheme = 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +
38
+ ' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark';
39
+ const lightTheme = 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';
40
+ const sizeClasses = {
41
+ sm: 'tw-text-sm',
42
+ lg: 'tw-text-xl',
43
+ };
44
+ const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme}`;
45
+ 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 }));
46
+ });
47
+ //# sourceMappingURL=TextField.js.map
@@ -0,0 +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C,GAAG,EAAE;QACb;;;WAGG;QACH,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW,CAAC,OAAO,EAAE,KAAK,IAAI,WAAW,CAAC,OAAO,EAAE;YACxG,4GAA4G;YAC5G,YAAY;YACZ,WAAW,CAAC,OAAO,CAAC,KAAK,GAAG,GAAG,KAAK,EAAE,CAAC;SACxC;IACH,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,WAAW,GACf,8GAA8G;QAC9G,kEAAkE,CAAC;IAErE,MAAM,SAAS,GAAG,8FAA8F;QAC9G,mFAAmF,CAAC;IACtF,MAAM,UAAU,GAAG,+GAA+G,CAAC;IAEnI,MAAM,WAAW,GAAG;QAClB,EAAE,EAAE,YAAY;QAChB,EAAE,EAAE,YAAY;KACjB,CAAC;IAEF,MAAM,cAAc,GAAG,GAAG,WAAW,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,eAAe,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;IAE3G,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"}
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ title: string;
3
+ };
4
+ export default _default;
5
+ export declare const AllTextFields: () => JSX.Element;
@@ -0,0 +1,33 @@
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(React.Fragment, null,
8
+ React.createElement("div", { className: "tw-p-4 light" },
9
+ React.createElement("div", { className: "tw-p-4" },
10
+ React.createElement(TextField, { value: "value provided" })),
11
+ React.createElement("div", { className: "tw-p-4" },
12
+ React.createElement(TextField, { placeholder: "placeholder text" })),
13
+ React.createElement("div", { className: "tw-p-4" },
14
+ React.createElement(TextField, { value: "read-only", readonly: true }))),
15
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
16
+ React.createElement("div", { className: "tw-p-4" },
17
+ React.createElement(TextField, { value: "value provided" })),
18
+ React.createElement("div", { className: "tw-p-4" },
19
+ React.createElement(TextField, { placeholder: "placeholder text" })),
20
+ React.createElement("div", { className: "tw-p-4" },
21
+ React.createElement(TextField, { value: "read-only", readonly: true })))));
22
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-3 tw-gap-4" },
23
+ React.createElement("div", { className: "color_topic" },
24
+ React.createElement("b", null, "Topic Colors"),
25
+ renderAllVariations()),
26
+ React.createElement("div", { className: "color_analysis" },
27
+ React.createElement("b", null, "Analysis Colors"),
28
+ renderAllVariations()),
29
+ React.createElement("div", { className: "color_datalab" },
30
+ React.createElement("b", null, "Datalab Colors"),
31
+ renderAllVariations())));
32
+ };
33
+ //# sourceMappingURL=TextField.stories.js.map
@@ -0,0 +1 @@
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,CAAC;QAC/B,6BAAK,SAAS,EAAC,cAAc;YAC3B,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,KAAK,EAAC,gBAAgB,GAAG,CAChC;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,WAAW,EAAC,kBAAkB,GAAG,CACxC;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,KAAK,EAAC,WAAW,EAAC,QAAQ,EAAE,IAAI,GAAI,CAC3C,CACF;QAEN,6BAAK,SAAS,EAAC,yCAAyC;YACtD,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,KAAK,EAAC,gBAAgB,GAAG,CAChC;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,WAAW,EAAC,kBAAkB,GAAG,CACxC;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,KAAK,EAAC,WAAW,EAAC,QAAQ,EAAE,IAAI,GAAI,CAC3C,CACF,CACL,CACJ,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"}
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
@@ -0,0 +1,35 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,16 @@
1
+ declare type FormControlElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
2
+ export interface TextFieldProps {
3
+ readonly?: boolean;
4
+ onChange?: React.ChangeEventHandler<FormControlElement>;
5
+ onKeyUp?: React.KeyboardEventHandler<FormControlElement>;
6
+ id?: string;
7
+ name?: string;
8
+ size?: 'sm' | 'lg';
9
+ value?: string | string[] | number;
10
+ placeholder?: string;
11
+ extraClassNames?: string;
12
+ type?: 'text' | 'password';
13
+ testId?: string;
14
+ ref?: any;
15
+ }
16
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TextField.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextField.types.js","sourceRoot":"","sources":["../../src/TextField/TextField.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export { TextField as default } from './TextField';
@@ -0,0 +1,2 @@
1
+ export { TextField as default } from './TextField';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import '../styles.css';
3
+ import { TooltipProps } from './Tooltip.types';
4
+ /**
5
+ * This component displays a Tooltip for the provided children.
6
+ */
7
+ export declare const Tooltip: React.FunctionComponent<TooltipProps>;
@@ -0,0 +1,30 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ title: string;
3
+ };
4
+ export default _default;
5
+ export declare const AllTooltips: () => JSX.Element;
@@ -0,0 +1,32 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,9 @@
1
+ export declare const DEFAULT_TOOL_TIP_DELAY = 1000;
2
+ export declare const tooltipPositions: readonly ["top", "left", "right", "bottom"];
3
+ export type TooltipPosition = typeof tooltipPositions[number];
4
+ export interface TooltipProps {
5
+ position?: TooltipPosition;
6
+ children?: JSX.Element | string;
7
+ text: JSX.Element | string;
8
+ delay?: number;
9
+ }
@@ -0,0 +1,3 @@
1
+ export const DEFAULT_TOOL_TIP_DELAY = 1000;
2
+ export const tooltipPositions = ['top', 'left', 'right', 'bottom'];
3
+ //# sourceMappingURL=Tooltip.types.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
1
+ export { Tooltip as default } from './Tooltip';
@@ -0,0 +1,2 @@
1
+ export { Tooltip as default } from './Tooltip';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Tooltip/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,8 @@
1
1
  import Button from './Button';
2
+ import TextField from './TextField';
3
+ import Tooltip from './Tooltip';
4
+ import Icon from './Icon';
2
5
  export { Button };
6
+ export { TextField };
7
+ export { Tooltip };
8
+ export { Icon };
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useRef, useState, useEffect } from 'react';
2
2
 
3
3
  /**
4
4
  * @exports the browser id (i.e., 'IE 11' 'Chrome 90')
@@ -28,27 +28,194 @@ const browserName = browserId && browserId.split(' ', 2)[0];
28
28
  browserId && parseInt(browserId.split(' ', 2)[1], 10);
29
29
  const browserIsFirefox = browserId && browserName === 'Firefox';
30
30
 
31
- const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, }) => {
32
- const baseClasses = 'py-1 px-3 rounded-sm focus:ring-0 disabled:pointer-events-none';
33
- const classesByVariant = {
34
- outline: 'text-sq-text-color border-sq-disabled-gray border-solid border hover:bg-sq-light-gray' +
35
- ' focus:bg-sq-dark-gray active:bg-sq-dark-gray focus:border-sq-color-dark active:border-sq-color-dark',
36
- theme: 'bg-sq-color-dark hover:bg-sq-color-highlight text-white disabled:bg-opacity-50',
37
- danger: 'bg-sq-danger-color text-white hover:bg-sq-danger-color-hover disabled:bg-opacity-50',
38
- 'theme-light': 'bg-sq-icon text-white hover:bg-sq-link disabled:bg-opacity-50',
31
+ const DEFAULT_TOOL_TIP_DELAY = 1000;
32
+
33
+ /**
34
+ * This component displays a Tooltip for the provided children.
35
+ */
36
+ const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP_DELAY, }) => {
37
+ const arrowBaseClasses = "before:tw-content-[''] before:tw-absolute before:tw-border-8";
38
+ const centerArrowVertically = 'before:tw-top-1/2 before:-tw-translate-y-1/2';
39
+ const centerArrowHorizontally = 'before:tw-left-1/2 before:-tw-translate-x-1/2';
40
+ const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent
41
+ before:tw-border-l-transparent before:tw-border-r-black`;
42
+ const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent
43
+ before:tw-border-l-black before:tw-border-r-transparent`;
44
+ const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black
45
+ before:tw-border-r-transparent before:tw-border-l-transparent before:tw-border-t-transparent`;
46
+ const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent
47
+ before:tw-border-t-black before:tw-border-l-transparent before:tw-border-r-transparent`;
48
+ const placements = {
49
+ top: `-tw-top-2 -tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowTop}`,
50
+ left: `-tw-translate-x-full -tw-left-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowLeft}`,
51
+ right: `tw-translate-x-full -tw-right-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowRight}`,
52
+ bottom: `-tw-bottom-2 tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowBottom}`,
53
+ };
54
+ return (React.createElement("div", { className: "tw-group tw-relative tw-inline-block" },
55
+ children,
56
+ React.createElement("div", { className: `tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms]
57
+ 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)));
58
+ };
59
+
60
+ /**
61
+ * Icon:
62
+ * - access to Seeq custom icons by providing the desired icon
63
+ * - leverage "type" to style your icon
64
+ */
65
+ const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small, color, testId, customId, tooltip, tooltipDelay, tooltipPlacement, number, hasExternalTooltipHandler = false, }) => {
66
+ if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {
67
+ const errorMessage = color === undefined || color === ''
68
+ ? 'Icon with type="color" must have prop color specified.'
69
+ : 'Icon with prop color must have type="color".';
70
+ return React.createElement("div", { className: "tw-text-sq-danger-color" }, errorMessage);
71
+ }
72
+ const colorClassesThemeLight = {
73
+ 'theme': 'tw-text-sq-color-dark',
74
+ 'white': 'tw-text-white',
75
+ 'dark-gray': 'tw-text-sq-fairly-dark-gray',
76
+ 'warning': 'tw-text-sq-warning-color',
77
+ 'darkish-gray': 'tw-text-sq-darkish-gray',
78
+ 'gray': 'tw-text-sq-disabled-gray',
79
+ 'color': '',
80
+ 'info': 'tw-text-sq-link',
81
+ 'text': 'tw-text-sq-text-color',
82
+ 'inherit': '',
83
+ 'danger': 'tw-text-sq-danger-color',
84
+ 'theme-light': 'tw-text-sq-color-light',
85
+ 'success': 'tw-text-sq-success-color',
86
+ };
87
+ const colorClassesThemeDark = {
88
+ 'theme': 'dark:tw-text-sq-color-dark-dark',
89
+ 'white': '',
90
+ 'dark-gray': 'tw-text-sq-fairly-dark-gray',
91
+ 'warning': '',
92
+ 'darkish-gray': 'tw-text-sq-darkish-gray',
93
+ 'gray': 'dark:tw-text-sq-dark-disabled-gray',
94
+ 'color': '',
95
+ 'info': 'dark:tw-text-sq-link-dark',
96
+ 'text': 'dark:tw-text-sq-dark-text',
97
+ 'inherit': '',
98
+ 'danger': 'tw-text-sq-danger-color',
99
+ 'theme-light': 'tw-text-sq-color-light',
100
+ 'success': 'tw-text-sq-success-color',
101
+ };
102
+ const iconPrefix = icon.startsWith('fc') ? 'fc' : 'fa';
103
+ const style = type === 'color' && color ? { color } : {};
104
+ const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
105
+ ${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;
106
+ const iconTag = (React.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number }));
107
+ return !hasExternalTooltipHandler && tooltip && tooltip !== '' ? (React.createElement(Tooltip, { text: tooltip, delay: tooltipDelay, position: tooltipPlacement }, iconTag)) : (iconTag);
108
+ };
109
+
110
+ /**
111
+ * All-in-one Button:
112
+ * - use "variant" to achieve the desired style
113
+ * - include tooltips and/or icons
114
+ */
115
+ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, }) => {
116
+ const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';
117
+ const baseClassesByVariant = {
118
+ 'outline': 'tw-border-solid tw-border',
119
+ 'theme': 'disabled:tw-bg-opacity-50',
120
+ 'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-bg-opacity-50',
121
+ 'theme-light': 'disabled:tw-bg-opacity-50',
122
+ 'no-border': '',
123
+ 'warning': 'tw-bg-sq-warning-color',
124
+ };
125
+ const textClassesByVariantLightTheme = {
126
+ 'outline': 'tw-text-sq-text-color',
127
+ 'theme': 'tw-text-white',
128
+ 'theme-light': 'tw-text-white',
129
+ 'danger': 'tw-text-white',
130
+ 'no-border': 'tw-text-sq-text-color',
131
+ 'warning': 'tw-text-white',
132
+ };
133
+ const textClassesByVariantDarkTheme = {
134
+ 'outline': 'dark:tw-text-sq-dark-text',
135
+ 'theme': 'dark:tw-text-white',
136
+ 'theme-light': 'dark:tw-text-white',
137
+ 'danger': 'dark:tw-text-white',
138
+ 'no-border': 'dark:tw-text-sq-dark-text',
139
+ 'warning': 'dark:tw-text-white',
140
+ };
141
+ const classesByVariantLightTheme = {
142
+ 'outline': 'tw-border-sq-disabled-gray hover:tw-bg-sq-light-gray' +
143
+ ' focus:tw-bg-sq-dark-gray active:tw-bg-sq-dark-gray focus:tw-border-sq-color-dark active:tw-border-sq-color-dark',
144
+ 'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight',
145
+ 'danger': '',
146
+ 'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link',
147
+ 'no-border': '',
148
+ 'warning': 'tw-bg-sq-warning-color',
149
+ };
150
+ const classesByVariantDarkTheme = {
151
+ 'outline': 'dark:tw-border-sq-dark-disabled-gray dark:hover:tw-bg-sq-highlight-color-dark' +
152
+ ' dark:focus:tw-bg-sq-dark-gray dark:active:tw-bg-sq-dark-gray dark:focus:tw-border-sq-color-dark' +
153
+ ' dark:active:tw-border-sq-color-dark',
154
+ 'theme': 'dark:tw-bg-sq-color-dark dark:hover:tw-bg-sq-color-highlight',
155
+ 'danger': '',
156
+ 'theme-light': 'dark:tw-bg-sq-icon-dark dark:hover:tw-bg-sq-link-dark',
39
157
  'no-border': '',
40
158
  'warning': '',
41
159
  };
42
160
  const sizeClasses = {
43
- sm: 'text-xs',
44
- lg: 'text-xl',
161
+ sm: 'tw-text-sm',
162
+ lg: 'tw-text-xl',
45
163
  };
46
- const appliedClasses = baseClasses + ' ' + sizeClasses[size] + ' ' + classesByVariant[variant] + ' ' + extraClassNames;
47
- return (React.createElement("button", { id: id, disabled: disabled, "data-testid": testId, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
164
+ const appliedClasses = `${baseClasses} ${baseClassesByVariant[variant]} ${sizeClasses[size]} ${classesByVariantLightTheme[variant]} ${classesByVariantDarkTheme[variant]} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]} ${extraClassNames}`;
165
+ const button = (React.createElement("button", { id: id, disabled: disabled, "data-testid": testId, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
48
166
  stopPropagation && e.stopPropagation();
49
167
  onClick && onClick();
50
- }, className: appliedClasses }, label));
168
+ }, className: appliedClasses },
169
+ icon && (React.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ?
170
+ `tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` })),
171
+ label));
172
+ return tooltip ? (React.createElement(Tooltip, { text: tooltip, ...tooltipOptions }, button)) : (button);
51
173
  };
52
174
 
53
- export { Button };
175
+ /**
176
+ * Textfield.
177
+ */
178
+ const TextField = React.forwardRef((props, ref) => {
179
+ const { readonly = false, onChange, onKeyUp, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', } = props;
180
+ const internalRef = useRef(null);
181
+ const [cursor, setCursor] = useState(null);
182
+ const setAllRefs = (receivedRef) => {
183
+ if (ref)
184
+ ref.current = receivedRef;
185
+ internalRef.current = receivedRef;
186
+ };
187
+ useEffect(() => {
188
+ const input = internalRef.current;
189
+ if (input)
190
+ input.setSelectionRange(cursor, cursor);
191
+ }, [ref, cursor, value]);
192
+ const handleChange = (e) => {
193
+ setCursor(e.target.selectionStart);
194
+ onChange && onChange(e);
195
+ };
196
+ useEffect(() => {
197
+ /**
198
+ * we need to change the value only if it's different since the internal state of "input" will change it anyway
199
+ * this will only be the case when the value has been changed externally via store (undo / redo)
200
+ */
201
+ if (value !== null && value !== undefined && value !== internalRef.current?.value && internalRef.current) {
202
+ // we need to use this method because using the value props directly will switch the input to a "controlled"
203
+ // component
204
+ internalRef.current.value = `${value}`;
205
+ }
206
+ }, [value]);
207
+ 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' +
208
+ ' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border';
209
+ const darkTheme = 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +
210
+ ' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark';
211
+ const lightTheme = 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';
212
+ const sizeClasses = {
213
+ sm: 'tw-text-sm',
214
+ lg: 'tw-text-xl',
215
+ };
216
+ const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme}`;
217
+ 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 }));
218
+ });
219
+
220
+ export { Button, Icon, TextField, Tooltip };
54
221
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/utils/browserId.ts","../src/Button/Button.tsx"],"sourcesContent":["/**\n * @exports the browser id (i.e., 'IE 11' 'Chrome 90')\n * @see http://stackoverflow.com/questions/2400935/browser-detection-in-javascript\n */\nexport const browserId: string = (function () {\n let tem;\n const ua = navigator.userAgent;\n let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if (/trident/i.test(M[1])) {\n tem = /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return `IE ${tem[1] || ''}`;\n }\n\n if (M[1] === 'Chrome') {\n tem = ua.match(/\\b(OPR|Edge?)\\/(\\d+)/);\n if (tem !== null) {\n return tem.slice(1).join(' ').replace('OPR', 'Opera').replace('Edg ', 'Edge ');\n }\n }\n\n M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];\n if ((tem = ua.match(/version\\/(\\d+)/i)) !== null) {\n M.splice(1, 1, tem[1]);\n }\n\n return M.join(' ');\n})();\nexport const browserName = browserId && browserId.split(' ', 2)[0];\nexport const browserVersion = browserId && parseInt(browserId.split(' ', 2)[1], 10);\nexport const browserIsFirefox = browserId && browserName === 'Firefox';\nexport const browserIsEdgeBeforeChromium =\n browserName && browserVersion && browserName === 'Edge' && browserVersion < 70;\n","import React from 'react';\nimport { ButtonProps } from './Button.types';\nimport '../styles.css';\nimport { browserIsFirefox } from '../utils/browserId';\n\nconst Button: React.FunctionComponent<ButtonProps> =\n ({\n onClick,\n label,\n variant = 'outline',\n type = 'button',\n size = 'sm',\n disabled,\n extraClassNames,\n id,\n testId,\n stopPropagation = true,\n }) => {\n const baseClasses = 'py-1 px-3 rounded-sm focus:ring-0 disabled:pointer-events-none';\n const classesByVariant = {\n outline: 'text-sq-text-color border-sq-disabled-gray border-solid border hover:bg-sq-light-gray' +\n ' focus:bg-sq-dark-gray active:bg-sq-dark-gray focus:border-sq-color-dark active:border-sq-color-dark',\n theme: 'bg-sq-color-dark hover:bg-sq-color-highlight text-white disabled:bg-opacity-50',\n danger: 'bg-sq-danger-color text-white hover:bg-sq-danger-color-hover disabled:bg-opacity-50',\n 'theme-light': 'bg-sq-icon text-white hover:bg-sq-link disabled:bg-opacity-50',\n 'no-border': '',\n 'warning': '',\n };\n const sizeClasses = {\n sm: 'text-xs',\n lg: 'text-xl',\n };\n const appliedClasses = baseClasses + ' ' + sizeClasses[size] + ' ' + classesByVariant[variant] + ' ' + extraClassNames;\n\n return (\n <button\n id={id}\n disabled={disabled}\n data-testid={testId}\n type={type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type}\n onClick={(e) => {\n stopPropagation && e.stopPropagation();\n onClick && onClick();\n }}\n className={appliedClasses}>\n {label}\n </button>\n );\n };\nexport default Button;\n\n"],"names":[],"mappings":";;AAAA;;;AAGG;AACI,MAAM,SAAS,GAAW,CAAC,YAAA;AAChC,IAAA,IAAI,GAAG,CAAC;AACR,IAAA,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC;I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,CAAC,CAAC,eAAe,EAAE,CAAC;YACvC,OAAO,IAAI,OAAO,EAAE,CAAC;SACtB,EACD,SAAS,EAAE,cAAc,IACxB,KAAK,CACC,EACT;AACJ;;;;"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/utils/browserId.ts","../src/Tooltip/Tooltip.types.ts","../src/Tooltip/Tooltip.tsx","../src/Icon/Icon.tsx","../src/Button/Button.tsx","../src/TextField/TextField.tsx"],"sourcesContent":["/**\n * @exports the browser id (i.e., 'IE 11' 'Chrome 90')\n * @see http://stackoverflow.com/questions/2400935/browser-detection-in-javascript\n */\nexport const browserId: string = (function () {\n let tem;\n const ua = navigator.userAgent;\n let M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\n if (/trident/i.test(M[1])) {\n tem = /\\brv[ :]+(\\d+)/g.exec(ua) || [];\n return `IE ${tem[1] || ''}`;\n }\n\n if (M[1] === 'Chrome') {\n tem = ua.match(/\\b(OPR|Edge?)\\/(\\d+)/);\n if (tem !== null) {\n return tem.slice(1).join(' ').replace('OPR', 'Opera').replace('Edg ', 'Edge ');\n }\n }\n\n M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];\n if ((tem = ua.match(/version\\/(\\d+)/i)) !== null) {\n M.splice(1, 1, tem[1]);\n }\n\n return M.join(' ');\n})();\nexport const browserName = browserId && browserId.split(' ', 2)[0];\nexport const browserVersion = browserId && parseInt(browserId.split(' ', 2)[1], 10);\nexport const browserIsFirefox = browserId && browserName === 'Firefox';\nexport const browserIsEdgeBeforeChromium =\n browserName && browserVersion && browserName === 'Edge' && browserVersion < 70;\n","export const DEFAULT_TOOL_TIP_DELAY = 1000;\nexport const tooltipPositions = ['top', 'left', 'right', 'bottom'] as const;\n\nexport type TooltipPosition = typeof tooltipPositions[number];\n\nexport interface TooltipProps {\n position?: TooltipPosition;\n children?: JSX.Element | string;\n text: JSX.Element | string;\n delay?: number;\n}\n","import React from 'react';\nimport '../styles.css';\nimport { DEFAULT_TOOL_TIP_DELAY, TooltipProps } from './Tooltip.types';\n\n/**\n * This component displays a Tooltip for the provided children.\n */\nexport const Tooltip: React.FunctionComponent<TooltipProps> = ({\n position = 'bottom',\n children,\n text,\n delay = DEFAULT_TOOL_TIP_DELAY,\n}) => {\n const arrowBaseClasses = \"before:tw-content-[''] before:tw-absolute before:tw-border-8\";\n const centerArrowVertically = 'before:tw-top-1/2 before:-tw-translate-y-1/2';\n const centerArrowHorizontally = 'before:tw-left-1/2 before:-tw-translate-x-1/2';\n const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:tw-right-[100%] before:tw-border-y-transparent \n before:tw-border-l-transparent before:tw-border-r-black`;\n\n const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:tw-left-[100%] before:tw-border-y-transparent\n before:tw-border-l-black before:tw-border-r-transparent`;\n\n const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-top-4 before:tw-border-b-black \n before:tw-border-r-transparent before:tw-border-l-transparent before:tw-border-t-transparent`;\n const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-tw-bottom-4 before:tw-border-b-transparent \n before:tw-border-t-black before:tw-border-l-transparent before:tw-border-r-transparent`;\n\n const placements = {\n top: `-tw-top-2 -tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowTop}`,\n left: `-tw-translate-x-full -tw-left-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowLeft}`,\n right: `tw-translate-x-full -tw-right-3 -tw-translate-y-1/2 tw-top-1/2 ${arrowRight}`,\n bottom: `-tw-bottom-2 tw-translate-y-full tw-left-1/2 -tw-translate-x-1/2 ${arrowBottom}`,\n };\n\n return (\n <div className=\"tw-group tw-relative tw-inline-block\">\n {children}\n <div\n className={`tw-z-50 tw-whitespace-nowrap tw-hidden group-hover:tw-inline-block group-hover:tw-delay-[${delay}ms] \n 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]}`}>\n {text}\n </div>\n </div>\n );\n};\n","import React from 'react';\nimport '../styles.css';\nimport { IconProps } from './Icon.types';\nimport Tooltip from '../Tooltip';\n\n/**\n * Icon:\n * - access to Seeq custom icons by providing the desired icon\n * - leverage \"type\" to style your icon\n */\nconst Icon: React.FunctionComponent<IconProps> = ({\n onClick,\n icon,\n type = 'theme',\n extraClassNames,\n id,\n large,\n small,\n color,\n testId,\n customId,\n tooltip,\n tooltipDelay,\n tooltipPlacement,\n number,\n hasExternalTooltipHandler = false,\n}) => {\n if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {\n const errorMessage =\n color === undefined || color === ''\n ? 'Icon with type=\"color\" must have prop color specified.'\n : 'Icon with prop color must have type=\"color\".';\n return <div className=\"tw-text-sq-danger-color\">{errorMessage}</div>;\n }\n\n const colorClassesThemeLight = {\n 'theme': 'tw-text-sq-color-dark',\n 'white': 'tw-text-white',\n 'dark-gray': 'tw-text-sq-fairly-dark-gray',\n 'warning': 'tw-text-sq-warning-color',\n 'darkish-gray': 'tw-text-sq-darkish-gray',\n 'gray': 'tw-text-sq-disabled-gray',\n 'color': '',\n 'info': 'tw-text-sq-link',\n 'text': 'tw-text-sq-text-color',\n 'inherit': '',\n 'danger': 'tw-text-sq-danger-color',\n 'theme-light': 'tw-text-sq-color-light',\n 'success': 'tw-text-sq-success-color',\n };\n\n const colorClassesThemeDark = {\n 'theme': 'dark:tw-text-sq-color-dark-dark',\n 'white': '',\n 'dark-gray': 'tw-text-sq-fairly-dark-gray',\n 'warning': '',\n 'darkish-gray': 'tw-text-sq-darkish-gray',\n 'gray': 'dark:tw-text-sq-dark-disabled-gray',\n 'color': '',\n 'info': 'dark:tw-text-sq-link-dark',\n 'text': 'dark:tw-text-sq-dark-text',\n 'inherit': '',\n 'danger': 'tw-text-sq-danger-color',\n 'theme-light': 'tw-text-sq-color-light',\n 'success': 'tw-text-sq-success-color',\n };\n\n const iconPrefix = icon.startsWith('fc') ? 'fc' : 'fa';\n const style = type === 'color' && color ? { color } : {};\n const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''} \n ${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;\n\n const iconTag = (\n <i\n className={appliedClassNames}\n style={style}\n onClick={onClick}\n data-testid={testId}\n data-customid={customId}\n id={id}\n data-number={number}\n />\n );\n\n return !hasExternalTooltipHandler && tooltip && tooltip !== '' ? (\n <Tooltip text={tooltip} delay={tooltipDelay} position={tooltipPlacement}>\n {iconTag}\n </Tooltip>\n ) : (\n iconTag\n );\n};\nexport default Icon;\n","import React from 'react';\nimport { ButtonProps } from './Button.types';\nimport '../styles.css';\nimport { browserIsFirefox } from '../utils/browserId';\nimport Tooltip from '../Tooltip';\nimport Icon from '../Icon';\n\n/**\n * All-in-one Button:\n * - use \"variant\" to achieve the desired style\n * - include tooltips and/or icons\n */\nconst Button: React.FunctionComponent<ButtonProps> = ({\n onClick,\n label,\n variant = 'outline',\n type = 'button',\n size = 'sm',\n disabled,\n extraClassNames,\n id,\n testId,\n stopPropagation = true,\n tooltip,\n tooltipOptions,\n iconStyle = 'text',\n icon,\n iconColor,\n}) => {\n const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';\n const baseClassesByVariant = {\n 'outline':\n 'tw-border-solid tw-border',\n 'theme': 'disabled:tw-bg-opacity-50',\n 'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-bg-opacity-50',\n 'theme-light': 'disabled:tw-bg-opacity-50',\n 'no-border': '',\n 'warning': 'tw-bg-sq-warning-color',\n };\n const textClassesByVariantLightTheme = {\n 'outline': 'tw-text-sq-text-color',\n 'theme': 'tw-text-white',\n 'theme-light': 'tw-text-white',\n 'danger': 'tw-text-white',\n 'no-border': 'tw-text-sq-text-color',\n 'warning': 'tw-text-white',\n };\n const textClassesByVariantDarkTheme = {\n 'outline': 'dark:tw-text-sq-dark-text',\n 'theme': 'dark:tw-text-white',\n 'theme-light': 'dark:tw-text-white',\n 'danger': 'dark:tw-text-white',\n 'no-border': 'dark:tw-text-sq-dark-text',\n 'warning': 'dark:tw-text-white',\n };\n\n const classesByVariantLightTheme = {\n 'outline':\n 'tw-border-sq-disabled-gray hover:tw-bg-sq-light-gray' +\n ' focus:tw-bg-sq-dark-gray active:tw-bg-sq-dark-gray focus:tw-border-sq-color-dark active:tw-border-sq-color-dark',\n 'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight',\n 'danger': '',\n 'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link',\n 'no-border': '',\n 'warning': 'tw-bg-sq-warning-color',\n };\n\n const classesByVariantDarkTheme = {\n 'outline':\n 'dark:tw-border-sq-dark-disabled-gray dark:hover:tw-bg-sq-highlight-color-dark' +\n ' dark:focus:tw-bg-sq-dark-gray dark:active:tw-bg-sq-dark-gray dark:focus:tw-border-sq-color-dark' +\n ' dark:active:tw-border-sq-color-dark',\n 'theme': 'dark:tw-bg-sq-color-dark dark:hover:tw-bg-sq-color-highlight',\n 'danger': '',\n 'theme-light': 'dark:tw-bg-sq-icon-dark dark:hover:tw-bg-sq-link-dark',\n 'no-border': '',\n 'warning': '',\n };\n const sizeClasses = {\n sm: 'tw-text-sm',\n lg: 'tw-text-xl',\n };\n const appliedClasses = `${baseClasses} ${baseClassesByVariant[variant]} ${sizeClasses[size]} ${classesByVariantLightTheme[variant]} ${classesByVariantDarkTheme[variant]} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]} ${extraClassNames}`;\n\n const button = (\n <button\n id={id}\n disabled={disabled}\n data-testid={testId}\n type={type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type}\n onClick={(e) => {\n stopPropagation && e.stopPropagation();\n onClick && onClick();\n }}\n className={appliedClasses}>\n {icon && (\n <Icon\n icon={icon}\n type={iconStyle}\n color={iconColor}\n extraClassNames={label ?\n `tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : ''}\n testId={`${id}_spinner`}\n />\n )}\n {label}\n </button>\n );\n\n return tooltip ? (\n <Tooltip text={tooltip} {...tooltipOptions}>\n {button}\n </Tooltip>\n ) : (\n button\n );\n};\nexport default Button;\n","import React, { useEffect, useRef, useState } from 'react';\nimport { TextFieldProps } from './TextField.types';\nimport '../styles.css';\n\n/**\n * Textfield.\n */\nexport const TextField: React.FunctionComponent<TextFieldProps> = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (props, ref: any) => {\n const {\n readonly = false,\n onChange,\n onKeyUp,\n id,\n name,\n size = 'sm',\n value,\n placeholder,\n extraClassNames,\n testId,\n type = 'text',\n } = props;\n\n const internalRef = useRef<HTMLInputElement | null>(null);\n const [cursor, setCursor] = useState(null);\n\n const setAllRefs = (receivedRef: any) => {\n if (ref) ref.current = receivedRef;\n internalRef.current = receivedRef;\n };\n\n useEffect(() => {\n const input = internalRef.current! as unknown as HTMLInputElement;\n if (input) input.setSelectionRange(cursor, cursor);\n }, [ref, cursor, value]);\n\n const handleChange = (e: any) => {\n setCursor(e.target.selectionStart);\n onChange && onChange(e);\n };\n\n useEffect(() => {\n /**\n * we need to change the value only if it's different since the internal state of \"input\" will change it anyway\n * this will only be the case when the value has been changed externally via store (undo / redo)\n */\n if (value !== null && value !== undefined && value !== internalRef.current?.value && internalRef.current) {\n // we need to use this method because using the value props directly will switch the input to a \"controlled\"\n // component\n internalRef.current.value = `${value}`;\n }\n }, [value]);\n\n const baseClasses =\n 'tw-height-34 tw-leading-normal tw-outline-none tw-py-1 tw-px-3 tw-rounded-sm disabled:tw-pointer-events-none' +\n ' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border';\n\n const darkTheme = 'dark:tw-border-sq-dark-disabled-gray dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text' +\n ' dark:focus:tw-border-sq-color-dark-dark dark:active:tw-border-sq-color-dark-dark';\n const lightTheme = 'tw-border-sq-disabled-gray tw-text-sq-text-color focus:tw-border-sq-color-dark active:tw-border-sq-color-dark';\n\n const sizeClasses = {\n sm: 'tw-text-sm',\n lg: 'tw-text-xl',\n };\n\n const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme}`;\n\n return (\n <input\n ref={setAllRefs}\n data-testid={testId}\n name={name}\n id={id}\n type={type}\n value={value}\n className={appliedClasses}\n placeholder={placeholder}\n disabled={readonly}\n autoComplete=\"none\"\n onChange={handleChange}\n onKeyUp={onKeyUp}\n />\n );\n },\n);\n"],"names":[],"mappings":";;AAAA;;;AAGG;AACI,MAAM,SAAS,GAAW,CAAC,YAAA;AAChC,IAAA,IAAI,GAAG,CAAC;AACR,IAAA,MAAM,EAAE,GAAG,SAAS,CAAC,SAAS,CAAC;IAC/B,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,8DAA8D,CAAC,IAAI,EAAE,CAAC;IACvF,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;QACzB,GAAG,GAAG,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;QACvC,OAAO,CAAA,GAAA,EAAM,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;AAC7B,KAAA;AAED,IAAA,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;AACrB,QAAA,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACvC,IAAI,GAAG,KAAK,IAAI,EAAE;YAChB,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAChF,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