@seeqdev/qomponents 0.0.106 → 0.0.108

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 (110) hide show
  1. package/dist/Accordion/Accordion.js +8 -8
  2. package/dist/Accordion/Accordion.stories.js +114 -114
  3. package/dist/Accordion/Accordion.test.js +54 -54
  4. package/dist/Accordion/Accordion.types.js +1 -1
  5. package/dist/Accordion/index.js +1 -1
  6. package/dist/Alert/Alert.js +31 -31
  7. package/dist/Alert/Alert.stories.js +44 -44
  8. package/dist/Alert/Alert.test.js +50 -50
  9. package/dist/Alert/Alert.types.js +1 -1
  10. package/dist/Alert/index.js +1 -1
  11. package/dist/Button/Button.js +91 -89
  12. package/dist/Button/Button.js.map +1 -1
  13. package/dist/Button/Button.stories.js +97 -97
  14. package/dist/Button/Button.test.js +48 -48
  15. package/dist/Button/Button.types.js +4 -4
  16. package/dist/Button/index.js +1 -1
  17. package/dist/ButtonWithDropdown/ButtonWithDropdown.js +66 -66
  18. package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +97 -97
  19. package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +84 -84
  20. package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +1 -1
  21. package/dist/ButtonWithDropdown/index.js +1 -1
  22. package/dist/ButtonWithPopover/ButtonWithPopover.js +50 -50
  23. package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +74 -74
  24. package/dist/ButtonWithPopover/ButtonWithPopover.test.js +81 -81
  25. package/dist/ButtonWithPopover/ButtonWithPopover.types.js +1 -1
  26. package/dist/ButtonWithPopover/index.js +1 -1
  27. package/dist/Checkbox/Checkbox.js +25 -25
  28. package/dist/Checkbox/Checkbox.stories.js +33 -33
  29. package/dist/Checkbox/Checkbox.test.js +93 -93
  30. package/dist/Checkbox/Checkbox.types.js +1 -1
  31. package/dist/Checkbox/index.js +1 -1
  32. package/dist/Icon/Icon.js +53 -53
  33. package/dist/Icon/Icon.stories.js +44 -44
  34. package/dist/Icon/Icon.test.js +54 -54
  35. package/dist/Icon/Icon.types.js +15 -15
  36. package/dist/Icon/index.js +1 -1
  37. package/dist/InputGroup/InputGroup.d.ts +7 -0
  38. package/dist/InputGroup/InputGroup.js +25 -26
  39. package/dist/InputGroup/InputGroup.js.map +1 -1
  40. package/dist/InputGroup/InputGroup.stories.d.ts +5 -0
  41. package/dist/InputGroup/InputGroup.stories.js +141 -65
  42. package/dist/InputGroup/InputGroup.stories.js.map +1 -1
  43. package/dist/InputGroup/InputGroup.test.d.ts +1 -1
  44. package/dist/InputGroup/InputGroup.test.js +42 -39
  45. package/dist/InputGroup/InputGroup.test.js.map +1 -1
  46. package/dist/InputGroup/InputGroup.types.d.ts +20 -0
  47. package/dist/InputGroup/InputGroup.types.js +1 -1
  48. package/dist/InputGroup/index.d.ts +1 -0
  49. package/dist/InputGroup/index.js +1 -1
  50. package/dist/Modal/Modal.js +97 -97
  51. package/dist/Modal/Modal.stories.js +126 -126
  52. package/dist/Modal/Modal.test.js +107 -107
  53. package/dist/Modal/Modal.types.js +1 -1
  54. package/dist/Modal/index.js +1 -1
  55. package/dist/SeeqActionDropdown/SeeqActionDropdown.js +47 -47
  56. package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js +79 -79
  57. package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js +72 -72
  58. package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js +1 -1
  59. package/dist/SeeqActionDropdown/index.js +1 -1
  60. package/dist/SeeqActionDropdown/variants.js +22 -22
  61. package/dist/Select/Select.js +173 -173
  62. package/dist/Select/Select.stories.js +79 -79
  63. package/dist/Select/Select.test.js +181 -181
  64. package/dist/Select/Select.types.js +1 -1
  65. package/dist/Select/index.js +2 -2
  66. package/dist/Tabs/Tabs.js +21 -21
  67. package/dist/Tabs/Tabs.stories.js +90 -90
  68. package/dist/Tabs/Tabs.test.js +90 -90
  69. package/dist/Tabs/Tabs.types.js +1 -1
  70. package/dist/Tabs/index.js +1 -1
  71. package/dist/TextArea/TextArea.js +24 -24
  72. package/dist/TextArea/TextArea.stories.js +45 -45
  73. package/dist/TextArea/TextArea.test.js +67 -67
  74. package/dist/TextArea/TextArea.types.js +1 -1
  75. package/dist/TextArea/index.js +1 -1
  76. package/dist/TextField/TextField.js +78 -76
  77. package/dist/TextField/TextField.js.map +1 -1
  78. package/dist/TextField/TextField.stories.js +69 -63
  79. package/dist/TextField/TextField.stories.js.map +1 -1
  80. package/dist/TextField/TextField.test.js +38 -38
  81. package/dist/TextField/TextField.types.d.ts +2 -1
  82. package/dist/TextField/TextField.types.js +1 -1
  83. package/dist/TextField/index.js +1 -1
  84. package/dist/ToolbarButton/ToolbarButton.js +74 -74
  85. package/dist/ToolbarButton/ToolbarButton.stories.js +93 -93
  86. package/dist/ToolbarButton/ToolbarButton.test.js +92 -92
  87. package/dist/ToolbarButton/ToolbarButton.types.js +1 -1
  88. package/dist/ToolbarButton/index.js +1 -1
  89. package/dist/Tooltip/QTip.stories.js +44 -44
  90. package/dist/Tooltip/QTip.types.js +1 -1
  91. package/dist/Tooltip/QTipPerformance.stories.js +29 -29
  92. package/dist/Tooltip/Qtip.js +154 -154
  93. package/dist/Tooltip/Tooltip.js +30 -30
  94. package/dist/Tooltip/Tooltip.stories.js +31 -31
  95. package/dist/Tooltip/Tooltip.types.js +2 -2
  96. package/dist/Tooltip/TooltipPerformance.stories.js +29 -29
  97. package/dist/Tooltip/index.js +2 -2
  98. package/dist/Tooltip/qTip.utilities.js +10 -10
  99. package/dist/index.d.ts +2 -0
  100. package/dist/index.esm.js +41 -17
  101. package/dist/index.esm.js.map +1 -1
  102. package/dist/index.js +41 -16
  103. package/dist/index.js.map +1 -1
  104. package/dist/styles.css +563 -520
  105. package/dist/types.js +1 -1
  106. package/dist/utils/browserId.js +28 -28
  107. package/dist/utils/svg.js +19 -19
  108. package/dist/utils/validateStyleDimension.js +13 -13
  109. package/dist/utils/validateStyleDimension.test.js +19 -19
  110. package/package.json +1 -1
@@ -1,77 +1,79 @@
1
- import React, { useEffect, useRef, useState } from 'react';
2
- import '../styles.css';
3
- import { setValidInputDimension } from '../utils/validateStyleDimension';
4
- const errorClasses = 'tw-border-sq-danger-color';
5
- const borderColorClasses = [
6
- 'tw-border-sq-disabled-gray',
7
- 'dark:tw-border-sq-dark-disabled-gray',
8
- 'dark:focus:tw-border-sq-color-dark-dark',
9
- 'dark:active:tw-border-sq-color-dark-dark',
10
- 'focus:tw-border-sq-color-dark',
11
- 'active:tw-border-sq-color-dark',
12
- ].join(' ');
13
- const baseClasses = 'tw-h-inputs tw-leading-normal tw-outline-none tw-py-1 tw-px-3' +
14
- ' disabled:tw-pointer-events-none disabled:tw-bg-sq-light-gray disabled:dark:tw-bg-sq-dark-disabled-gray' +
15
- ' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border tw-placeholder-gray-400' +
16
- ' dark:tw-placeholder-sq-dark-text-lighter specTextField';
17
- const darkTheme = 'dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text disabled:dark:tw-text-sq-dark-text-lighter';
18
- const lightTheme = 'tw-text-sq-text-color disabled:tw-text-sq-darkish-gray';
19
- const sizeClasses = {
20
- sm: 'tw-text-sm',
21
- lg: 'tw-text-xl',
22
- };
23
- /**
24
- * Textfield.
25
- */
26
- export const TextField = React.forwardRef((props, ref) => {
27
- const { readonly = false, disabled = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', inputGroup, step, showError, errorText, min, max, maxLength, minLength, required = false, autoComplete = 'off', inputWidth = undefined, inputHeight = undefined, autoFocus = false, } = props;
28
- const internalRef = useRef(null);
29
- const [cursor, setCursor] = useState(null);
30
- const setAllRefs = (receivedRef) => {
31
- if (ref)
32
- ref.current = receivedRef;
33
- internalRef.current = receivedRef;
34
- };
35
- useEffect(() => {
36
- const input = internalRef.current;
37
- if (input && type !== 'number' && type !== 'email')
38
- input.setSelectionRange(cursor, cursor);
39
- }, [ref, cursor, value]);
40
- const handleChange = (e) => {
41
- setCursor(e.target.selectionStart);
42
- onChange && onChange(e);
43
- };
44
- useEffect(() => {
45
- /**
46
- * we need to change the value only if it's different since the internal state of "input" will change it anyway
47
- * this will only be the case when the value has been changed externally via store (undo / redo)
48
- */
49
- if (value !== null && value !== undefined && value !== internalRef.current?.value && internalRef.current) {
50
- // we need to use this method because using the value props directly will switch the input to a "controlled"
51
- // component
52
- internalRef.current.value = `${value}`;
53
- }
54
- }, [value]);
55
- let borderRadius = 'tw-rounded-sm';
56
- if (inputGroup === 'left') {
57
- borderRadius = 'tw-rounded-l-sm tw-border-r-0 focus:tw-border-r' + ' active:tw-border-r';
58
- }
59
- else if (inputGroup === 'right') {
60
- borderRadius = 'tw-rounded-r-sm tw-border-l-0 focus:tw-border-l active:tw-border-l';
61
- }
62
- const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme} ${borderRadius} ${showError ? errorClasses : borderColorClasses} `;
63
- const inputProp = setValidInputDimension(inputWidth, inputHeight)
64
- ? {
65
- style: setValidInputDimension(inputWidth, inputHeight),
66
- }
67
- : {};
68
- const inputLenghtProp = {};
69
- if (maxLength)
70
- inputLenghtProp.maxLength = maxLength;
71
- if (minLength)
72
- inputLenghtProp.minLength = minLength;
73
- return (React.createElement(React.Fragment, null,
74
- React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, autoFocus: autoFocus, min: min, max: max, ...inputLenghtProp, ...inputProp }),
75
- errorText && showError && React.createElement("div", { className: "tw-text-sq-danger-color tw-text-xs tw-mt-1" }, errorText)));
76
- });
1
+ import React, { useEffect, useRef, useState } from 'react';
2
+ import '../styles.css';
3
+ import { setValidInputDimension } from '../utils/validateStyleDimension';
4
+ import { getQTipData } from '../Tooltip/qTip.utilities';
5
+ const errorClasses = 'tw-border-sq-danger-color';
6
+ const borderColorClasses = [
7
+ 'tw-border-sq-disabled-gray',
8
+ 'dark:tw-border-sq-dark-disabled-gray',
9
+ 'dark:focus:tw-border-sq-color-dark-dark',
10
+ 'dark:active:tw-border-sq-color-dark-dark',
11
+ 'focus:tw-border-sq-color-dark',
12
+ 'active:tw-border-sq-color-dark',
13
+ ].join(' ');
14
+ const baseClasses = 'tw-h-inputs tw-leading-normal tw-outline-none tw-py-1 tw-px-3' +
15
+ ' disabled:tw-pointer-events-none disabled:tw-bg-sq-light-gray disabled:dark:tw-bg-sq-dark-disabled-gray' +
16
+ ' disabled:tw-cursor-not-allowed tw-p-1 tw-border-solid tw-border tw-placeholder-gray-400' +
17
+ ' dark:tw-placeholder-sq-dark-text-lighter specTextField';
18
+ const darkTheme = 'dark:tw-bg-sq-dark-background dark:tw-text-sq-dark-text disabled:dark:tw-text-sq-dark-text-lighter';
19
+ const lightTheme = 'tw-text-sq-text-color disabled:tw-text-sq-darkish-gray';
20
+ const sizeClasses = {
21
+ sm: 'tw-text-sm',
22
+ lg: 'tw-text-xl',
23
+ };
24
+ /**
25
+ * Textfield.
26
+ */
27
+ export const TextField = React.forwardRef((props, ref) => {
28
+ const { readonly = false, disabled = false, onChange, onKeyUp, onFocus, onBlur, onKeyDown, id, name, size = 'sm', value, placeholder, extraClassNames, testId, type = 'text', inputGroup, step, showError, errorText, min, max, maxLength, minLength, required = false, autoComplete = 'off', inputWidth = undefined, inputHeight = undefined, autoFocus = false, ...tooltipProps } = props;
29
+ const internalRef = useRef(null);
30
+ const [cursor, setCursor] = useState(null);
31
+ const tooltipData = getQTipData(tooltipProps);
32
+ const setAllRefs = (receivedRef) => {
33
+ if (ref)
34
+ ref.current = receivedRef;
35
+ internalRef.current = receivedRef;
36
+ };
37
+ useEffect(() => {
38
+ const input = internalRef.current;
39
+ if (input && type !== 'number' && type !== 'email')
40
+ input.setSelectionRange(cursor, cursor);
41
+ }, [ref, cursor, value]);
42
+ const handleChange = (e) => {
43
+ setCursor(e.target.selectionStart);
44
+ onChange && onChange(e);
45
+ };
46
+ useEffect(() => {
47
+ /**
48
+ * we need to change the value only if it's different since the internal state of "input" will change it anyway
49
+ * this will only be the case when the value has been changed externally via store (undo / redo)
50
+ */
51
+ if (value !== null && value !== undefined && value !== internalRef.current?.value && internalRef.current) {
52
+ // we need to use this method because using the value props directly will switch the input to a "controlled"
53
+ // component
54
+ internalRef.current.value = `${value}`;
55
+ }
56
+ }, [value]);
57
+ let borderRadius = 'tw-rounded-sm';
58
+ if (inputGroup === 'left') {
59
+ borderRadius = 'tw-rounded-l-sm tw-border-r-0 focus:tw-border-r' + ' active:tw-border-r';
60
+ }
61
+ else if (inputGroup === 'right') {
62
+ borderRadius = 'tw-rounded-r-sm tw-border-l-0 focus:tw-border-l active:tw-border-l';
63
+ }
64
+ const appliedClasses = `${baseClasses} ${sizeClasses[size]} ${extraClassNames} ${lightTheme} ${darkTheme} ${borderRadius} ${showError ? errorClasses : borderColorClasses} `;
65
+ const inputProp = setValidInputDimension(inputWidth, inputHeight)
66
+ ? {
67
+ style: setValidInputDimension(inputWidth, inputHeight),
68
+ }
69
+ : {};
70
+ const inputLenghtProp = {};
71
+ if (maxLength)
72
+ inputLenghtProp.maxLength = maxLength;
73
+ if (minLength)
74
+ inputLenghtProp.minLength = minLength;
75
+ return (React.createElement(React.Fragment, null,
76
+ React.createElement("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, autoFocus: autoFocus, min: min, max: max, ...inputLenghtProp, ...inputProp, ...tooltipData }),
77
+ errorText && showError && React.createElement("div", { className: "tw-text-sq-danger-color tw-text-xs tw-mt-1" }, errorText)));
78
+ });
77
79
  //# sourceMappingURL=TextField.js.map
@@ -1 +1 @@
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;AACvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAEzE,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAEjD,MAAM,kBAAkB,GAAG;IACzB,4BAA4B;IAC5B,sCAAsC;IACtC,yCAAyC;IACzC,0CAA0C;IAC1C,+BAA+B;IAC/B,gCAAgC;CACjC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,WAAW,GACf,+DAA+D;IAC/D,0GAA0G;IAC1G,0FAA0F;IAC1F,0DAA0D,CAAC;AAE7D,MAAM,SAAS,GAAG,oGAAoG,CAAC;AACvH,MAAM,UAAU,GAAG,wDAAwD,CAAC;AAE5E,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;CACjB,CAAC;AACF;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAoE,KAAK,CAAC,UAAU,CAGxG,CAAC,KAAK,EAAE,GAAQ,EAAE,EAAE;IACpB,MAAM,EACJ,QAAQ,GAAG,KAAK,EAChB,QAAQ,GAAG,KAAK,EAChB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,MAAM,EACN,SAAS,EACT,EAAE,EACF,IAAI,EACJ,IAAI,GAAG,IAAI,EACX,KAAK,EACL,WAAW,EACX,eAAe,EACf,MAAM,EACN,IAAI,GAAG,MAAM,EACb,UAAU,EACV,IAAI,EACJ,SAAS,EACT,SAAS,EACT,GAAG,EACH,GAAG,EACH,SAAS,EACT,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,YAAY,GAAG,KAAK,EACpB,UAAU,GAAG,SAAS,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ACV,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,GAAG,KACJ,eAAe,KACf,SAAS,KACT,WAAW,GACf;QACD,SAAS,IAAI,SAAS,IAAI,6BAAK,SAAS,EAAC,4CAA4C,IAAE,SAAS,CAAO,CACvG,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,64 +1,70 @@
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, { placeholder: "with error", showError: true })),
15
- React.createElement("div", { className: "tw-p-4" },
16
- React.createElement(TextField, { placeholder: "with error text", showError: true, errorText: "this is a major test error and it is long on purpose to see its looks" })),
17
- React.createElement("div", { className: "tw-p-4" },
18
- React.createElement(TextField, { value: "read-only", readonly: true, onFocus: (e) => e.currentTarget.select() })),
19
- React.createElement("div", { className: "tw-p-4" },
20
- React.createElement(TextField, { value: "disabled", disabled: true, onFocus: (e) => e.currentTarget.select() })),
21
- React.createElement("div", { className: "tw-p-4" },
22
- React.createElement("div", null, "max value = 10"),
23
- React.createElement(TextField, { type: "number", value: 20, max: 10 })),
24
- React.createElement("div", { className: "tw-p-4" },
25
- React.createElement("div", null, "min value = 2"),
26
- React.createElement(TextField, { type: "number", value: 1, min: 2 })),
27
- React.createElement("div", { className: "tw-p-4" },
28
- React.createElement(TextField, { value: "large", size: "lg" }))),
29
- React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
30
- React.createElement("div", { className: "tw-p-4" },
31
- React.createElement(TextField, { value: "value provided" })),
32
- React.createElement("div", { className: "tw-p-4" },
33
- React.createElement(TextField, { placeholder: "placeholder text" })),
34
- React.createElement("div", { className: "tw-p-4" },
35
- React.createElement(TextField, { placeholder: "with error", showError: true })),
36
- React.createElement("div", { className: "tw-p-4" },
37
- React.createElement(TextField, { placeholder: "with error text", showError: true, errorText: "this is a major test error and it is long on purpose to see its looks" })),
38
- React.createElement("div", { className: "tw-p-4" },
39
- React.createElement(TextField, { value: "read-only", readonly: true, onFocus: (e) => e.currentTarget.select() })),
40
- React.createElement("div", { className: "tw-p-4" },
41
- React.createElement(TextField, { value: "disabled", disabled: true, onFocus: (e) => e.currentTarget.select() })),
42
- React.createElement("div", { className: "tw-p-4" },
43
- React.createElement("div", { className: "tw-text-sq-color-dark dark:tw-text-sq-color-dark-dark" }, "max value = 10"),
44
- React.createElement(TextField, { type: "number", value: 8, max: 10 })),
45
- React.createElement("div", { className: "tw-p-4" },
46
- React.createElement("div", { className: "tw-text-sq-color-dark dark:tw-text-sq-color-dark-dark" }, "min value = 2"),
47
- React.createElement(TextField, { type: "number", value: 10, min: 2 })),
48
- React.createElement("div", { className: "tw-p-4" },
49
- React.createElement(TextField, { value: "large", size: "lg" })))));
50
- return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
51
- React.createElement("div", { className: "color_topic" },
52
- React.createElement("b", null, "Topic Colors"),
53
- renderAllVariations()),
54
- React.createElement("div", { className: "color_analysis" },
55
- React.createElement("b", null, "Analysis Colors"),
56
- renderAllVariations()),
57
- React.createElement("div", { className: "color_datalab" },
58
- React.createElement("b", null, "Datalab Colors"),
59
- renderAllVariations()),
60
- React.createElement("div", { className: "color_vantage" },
61
- React.createElement("b", null, "Vantage Colors"),
62
- renderAllVariations())));
63
- };
1
+ import React from 'react';
2
+ import { TextField } from './TextField';
3
+ import { QTip } from '../Tooltip';
4
+ export default {
5
+ title: 'TextField',
6
+ };
7
+ export const AllTextFields = () => {
8
+ const renderAllVariations = () => (React.createElement(React.Fragment, null,
9
+ React.createElement("div", { className: "tw-p-4 light" },
10
+ React.createElement("div", { className: "tw-p-4" },
11
+ React.createElement(TextField, { value: "value provided" })),
12
+ React.createElement("div", { className: "tw-p-4" },
13
+ React.createElement(TextField, { placeholder: "placeholder text" })),
14
+ React.createElement("div", { className: "tw-p-4" },
15
+ React.createElement(TextField, { placeholder: "with error", showError: true })),
16
+ React.createElement("div", { className: "tw-p-4" },
17
+ React.createElement(TextField, { placeholder: "with error text", showError: true, errorText: "this is a major test error and it is long on purpose to see its looks" })),
18
+ React.createElement("div", { className: "tw-p-4" },
19
+ React.createElement(TextField, { value: "read-only", readonly: true, onFocus: (e) => e.currentTarget.select() })),
20
+ React.createElement("div", { className: "tw-p-4" },
21
+ React.createElement(TextField, { value: "disabled", disabled: true, onFocus: (e) => e.currentTarget.select() })),
22
+ React.createElement("div", { className: "tw-p-4" },
23
+ React.createElement("div", null, "max value = 10"),
24
+ React.createElement(TextField, { type: "number", value: 20, max: 10 })),
25
+ React.createElement("div", { className: "tw-p-4" },
26
+ React.createElement("div", null, "min value = 2"),
27
+ React.createElement(TextField, { type: "number", value: 1, min: 2 })),
28
+ React.createElement("div", { className: "tw-p-4" },
29
+ React.createElement(TextField, { value: "large", size: "lg" })),
30
+ React.createElement("div", { className: "tw-p-4" },
31
+ React.createElement(TextField, { value: "with tooltip", tooltip: "small tooltip" }))),
32
+ React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
33
+ React.createElement("div", { className: "tw-p-4" },
34
+ React.createElement(TextField, { value: "value provided" })),
35
+ React.createElement("div", { className: "tw-p-4" },
36
+ React.createElement(TextField, { placeholder: "placeholder text" })),
37
+ React.createElement("div", { className: "tw-p-4" },
38
+ React.createElement(TextField, { placeholder: "with error", showError: true })),
39
+ React.createElement("div", { className: "tw-p-4" },
40
+ React.createElement(TextField, { placeholder: "with error text", showError: true, errorText: "this is a major test error and it is long on purpose to see its looks" })),
41
+ React.createElement("div", { className: "tw-p-4" },
42
+ React.createElement(TextField, { value: "read-only", readonly: true, onFocus: (e) => e.currentTarget.select() })),
43
+ React.createElement("div", { className: "tw-p-4" },
44
+ React.createElement(TextField, { value: "disabled", disabled: true, onFocus: (e) => e.currentTarget.select() })),
45
+ React.createElement("div", { className: "tw-p-4" },
46
+ React.createElement("div", { className: "tw-text-sq-color-dark dark:tw-text-sq-color-dark-dark" }, "max value = 10"),
47
+ React.createElement(TextField, { type: "number", value: 8, max: 10 })),
48
+ React.createElement("div", { className: "tw-p-4" },
49
+ React.createElement("div", { className: "tw-text-sq-color-dark dark:tw-text-sq-color-dark-dark" }, "min value = 2"),
50
+ React.createElement(TextField, { type: "number", value: 10, min: 2 })),
51
+ React.createElement("div", { className: "tw-p-4" },
52
+ React.createElement(TextField, { value: "large", size: "lg" })),
53
+ React.createElement("div", { className: "tw-p-4" },
54
+ React.createElement(TextField, { value: "with tooltip", tooltip: "small tooltip" })))));
55
+ return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
56
+ React.createElement(QTip, null),
57
+ React.createElement("div", { className: "color_topic" },
58
+ React.createElement("b", null, "Topic Colors"),
59
+ renderAllVariations()),
60
+ React.createElement("div", { className: "color_analysis" },
61
+ React.createElement("b", null, "Analysis Colors"),
62
+ renderAllVariations()),
63
+ React.createElement("div", { className: "color_datalab" },
64
+ React.createElement("b", null, "Datalab Colors"),
65
+ renderAllVariations()),
66
+ React.createElement("div", { className: "color_vantage" },
67
+ React.createElement("b", null, "Vantage Colors"),
68
+ renderAllVariations())));
69
+ };
64
70
  //# sourceMappingURL=TextField.stories.js.map
@@ -1 +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,MA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I,EAAC,IAAI,GAAG,CACjC;YACN,6BAAK,SAAS,EAAC,QAAQ;gBACrB,oBAAC,SAAS,IAAC,KAAK,EAAC,cAAc,EAAC,OAAO,EAAC,eAAe,GAAG,CACtD,CACF,CACL,CACJ,CAAC;IACF,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,oBAAC,IAAI,OAAG;QACR,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;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,39 +1,39 @@
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
- it('autofocuses the textfield', async () => {
35
- renderTextField({ ...tc.props, autoFocus: true });
36
- expect(screen.getByTestId(tc.testId)).toHaveFocus();
37
- });
38
- });
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
+ it('autofocuses the textfield', async () => {
35
+ renderTextField({ ...tc.props, autoFocus: true });
36
+ expect(screen.getByTestId(tc.testId)).toHaveFocus();
37
+ });
38
+ });
39
39
  //# sourceMappingURL=TextField.test.js.map
@@ -1,5 +1,6 @@
1
+ import { TooltipComponentProps } from '../Tooltip/Tooltip.types';
1
2
  import { FormControlElement, InputGroupPlacement } from '../types';
2
- export interface TextFieldProps {
3
+ export interface TextFieldProps extends TooltipComponentProps {
3
4
  readonly?: boolean;
4
5
  disabled?: boolean;
5
6
  onChange?: React.ChangeEventHandler<FormControlElement>;
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=TextField.types.js.map
@@ -1,2 +1,2 @@
1
- export { TextField as default } from './TextField';
1
+ export { TextField as default } from './TextField';
2
2
  //# sourceMappingURL=index.js.map
@@ -1,75 +1,75 @@
1
- import * as React from 'react';
2
- import * as PopoverPrimitive from '@radix-ui/react-popover';
3
- import Icon from '../Icon';
4
- import { DEFAULT_TOOL_TIP_DELAY } from '../Tooltip/Tooltip.types';
5
- import { getSvgIconPath } from '../utils/svg';
6
- const borderStyles = [
7
- 'tw-border-solid',
8
- 'tw-border',
9
- 'tw-rounded-sm',
10
- 'tw-border-sq-disabled-gray',
11
- 'dark:tw-border-gray-500',
12
- ].join(' ');
13
- const triggerBorderStyles = [
14
- 'tw-border-solid',
15
- 'tw-border',
16
- 'tw-rounded-sm',
17
- 'tw-border-transparent',
18
- 'hover:tw-border-solid',
19
- 'hover:tw-border',
20
- 'hover:tw-rounded-sm',
21
- 'hover:tw-border-sq-darkish-gray',
22
- 'active:tw-border-sq-color-dark',
23
- 'dark:hover:tw-border-sq-color-dark-dark',
24
- 'dark:focus:tw-border-sq-color-dark-dark',
25
- 'dark:active:tw-border-sq-color-dark-dark',
26
- ].join(' ');
27
- const activeBorderStyles = [
28
- 'active',
29
- 'tw-border-solid',
30
- 'tw-border',
31
- 'tw-rounded-sm',
32
- 'tw-border-sq-color-dark',
33
- 'active:tw-border-sq-color-dark',
34
- 'dark:hover:tw-border-sq-color-dark-dark',
35
- ].join(' ');
36
- const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
37
- const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
38
- const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (React.createElement(PopoverPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
39
- export const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip = false, hasArrow = false, disabled = false, isPrimaryAnSvg = false, primaryIconExtraClassNames = false, iconHeight = 24, iconWidth = 24, primaryIconViewbox = '0 0 24 24', onClick, onHide, }) => {
40
- let tooltipData = undefined;
41
- if (tooltipText) {
42
- tooltipData = {
43
- 'data-qtip-text': tooltipText,
44
- 'data-qtip-placement': tooltipOptions?.position,
45
- 'data-qtip-is-html': isHtmlTooltip,
46
- 'data-qtip-testid': tooltipTestId,
47
- 'data-qtip-delay': tooltipOptions?.delay ?? DEFAULT_TOOL_TIP_DELAY,
48
- };
49
- }
50
- const onOpenChange = (open) => {
51
- if (!open) {
52
- onHide && onHide();
53
- }
54
- };
55
- return (React.createElement(PopoverPrimitive.Root, { defaultOpen: false, onOpenChange: onOpenChange },
56
- React.createElement(PopoverPrimitive.Trigger, { id: id, className: `tw-border-none ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
57
- onClick && onClick(e);
58
- } },
59
- React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-items-center ${isSmall ? 'tw-py-[1px] tw-px-[5px]' : 'tw-px-2 tw-py-[5px]'} ${disabled ? disabledClasses : isActive ? activeBorderStyles : triggerBorderStyles} ${extraClassNames || ''}` },
60
- React.createElement("span", { className: "tw-nowrap" },
61
- isPrimaryAnSvg ? (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: `tw-text-sq-text-color dark:tw-text-sq-dark-text ${primaryIconExtraClassNames || ''}`, viewBox: primaryIconViewbox, height: `${iconHeight}px`, width: `${iconWidth}px`, fill: "currentColor", "data-testid": testId },
62
- React.createElement("path", { d: getSvgIconPath(icon) }))) : (React.createElement(Icon, { icon: icon, testId: "firstIcon", type: "text", large: !isSmall && !label && !secondIcon && !forceSmallIcon, extraClassNames: `tw-text-sq-text-color dark:tw-text-sq-dark-text` })),
63
- secondIcon && React.createElement(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }),
64
- popoverContent ? (React.createElement(Icon, { icon: "fc-arrow-dropdown", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-ml-[3px] tw-text-[8px]", type: "text" })) : undefined),
65
- !isSmall && (React.createElement("small", { className: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-text-[10px]" }, label)))),
66
- !!popoverContent ? (React.createElement(PopoverContent, { sideOffset: 2, align: "start" },
67
- React.createElement("div", { className: bgStyles +
68
- ' tw-relative tw-z-[1000] tw-min-w-6 tw-p-[0.5rem] focus-visible:tw-outline-none tw-outline-none data-[state=open]:animate-in data-[state=closed]:animate-out' +
69
- ' data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2' +
70
- borderStyles },
71
- hasArrow && (React.createElement(PopoverPrimitive.Arrow, { asChild: true },
72
- React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[15px] tw-h-[15px] tw-mt-[-7px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-disabled-gray dark:tw-border-gray-500" }))),
73
- popoverContent))) : undefined));
74
- };
1
+ import * as React from 'react';
2
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
3
+ import Icon from '../Icon';
4
+ import { DEFAULT_TOOL_TIP_DELAY } from '../Tooltip/Tooltip.types';
5
+ import { getSvgIconPath } from '../utils/svg';
6
+ const borderStyles = [
7
+ 'tw-border-solid',
8
+ 'tw-border',
9
+ 'tw-rounded-sm',
10
+ 'tw-border-sq-disabled-gray',
11
+ 'dark:tw-border-gray-500',
12
+ ].join(' ');
13
+ const triggerBorderStyles = [
14
+ 'tw-border-solid',
15
+ 'tw-border',
16
+ 'tw-rounded-sm',
17
+ 'tw-border-transparent',
18
+ 'hover:tw-border-solid',
19
+ 'hover:tw-border',
20
+ 'hover:tw-rounded-sm',
21
+ 'hover:tw-border-sq-darkish-gray',
22
+ 'active:tw-border-sq-color-dark',
23
+ 'dark:hover:tw-border-sq-color-dark-dark',
24
+ 'dark:focus:tw-border-sq-color-dark-dark',
25
+ 'dark:active:tw-border-sq-color-dark-dark',
26
+ ].join(' ');
27
+ const activeBorderStyles = [
28
+ 'active',
29
+ 'tw-border-solid',
30
+ 'tw-border',
31
+ 'tw-rounded-sm',
32
+ 'tw-border-sq-color-dark',
33
+ 'active:tw-border-sq-color-dark',
34
+ 'dark:hover:tw-border-sq-color-dark-dark',
35
+ ].join(' ');
36
+ const bgStyles = ['tw-bg-sq-white', 'dark:tw-bg-sq-dark-background'].join(' ');
37
+ const disabledClasses = ['tw-opacity-50', 'tw-cursor-not-allowed'].join(' ');
38
+ const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (React.createElement(PopoverPrimitive.Content, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
39
+ export const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip = false, hasArrow = false, disabled = false, isPrimaryAnSvg = false, primaryIconExtraClassNames = false, iconHeight = 24, iconWidth = 24, primaryIconViewbox = '0 0 24 24', onClick, onHide, }) => {
40
+ let tooltipData = undefined;
41
+ if (tooltipText) {
42
+ tooltipData = {
43
+ 'data-qtip-text': tooltipText,
44
+ 'data-qtip-placement': tooltipOptions?.position,
45
+ 'data-qtip-is-html': isHtmlTooltip,
46
+ 'data-qtip-testid': tooltipTestId,
47
+ 'data-qtip-delay': tooltipOptions?.delay ?? DEFAULT_TOOL_TIP_DELAY,
48
+ };
49
+ }
50
+ const onOpenChange = (open) => {
51
+ if (!open) {
52
+ onHide && onHide();
53
+ }
54
+ };
55
+ return (React.createElement(PopoverPrimitive.Root, { defaultOpen: false, onOpenChange: onOpenChange },
56
+ React.createElement(PopoverPrimitive.Trigger, { id: id, className: `tw-border-none ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
57
+ onClick && onClick(e);
58
+ } },
59
+ React.createElement("div", { ...tooltipData, className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-items-center ${isSmall ? 'tw-py-[1px] tw-px-[5px]' : 'tw-px-2 tw-py-[5px]'} ${disabled ? disabledClasses : isActive ? activeBorderStyles : triggerBorderStyles} ${extraClassNames || ''}` },
60
+ React.createElement("span", { className: "tw-nowrap" },
61
+ isPrimaryAnSvg ? (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", className: `tw-text-sq-text-color dark:tw-text-sq-dark-text ${primaryIconExtraClassNames || ''}`, viewBox: primaryIconViewbox, height: `${iconHeight}px`, width: `${iconWidth}px`, fill: "currentColor", "data-testid": testId },
62
+ React.createElement("path", { d: getSvgIconPath(icon) }))) : (React.createElement(Icon, { icon: icon, testId: "firstIcon", type: "text", large: !isSmall && !label && !secondIcon && !forceSmallIcon, extraClassNames: `tw-text-sq-text-color dark:tw-text-sq-dark-text` })),
63
+ secondIcon && React.createElement(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }),
64
+ popoverContent ? (React.createElement(Icon, { icon: "fc-arrow-dropdown", extraClassNames: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-ml-[3px] tw-text-[8px]", type: "text" })) : undefined),
65
+ !isSmall && (React.createElement("small", { className: "tw-text-sq-text-color dark:tw-text-sq-dark-text tw-text-[10px]" }, label)))),
66
+ !!popoverContent ? (React.createElement(PopoverContent, { sideOffset: 2, align: "start" },
67
+ React.createElement("div", { className: bgStyles +
68
+ ' tw-relative tw-z-[1000] tw-min-w-6 tw-p-[0.5rem] focus-visible:tw-outline-none tw-outline-none data-[state=open]:animate-in data-[state=closed]:animate-out' +
69
+ ' data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2' +
70
+ borderStyles },
71
+ hasArrow && (React.createElement(PopoverPrimitive.Arrow, { asChild: true },
72
+ React.createElement("div", { className: " tw-fill-transparent tw-bg-white tw-w-[15px] tw-h-[15px] tw-mt-[-7px] tw-rotate-45 dark:tw-bg-sq-dark-background tw-border-b tw-border-r tw-border-sq-disabled-gray dark:tw-border-gray-500" }))),
73
+ popoverContent))) : undefined));
74
+ };
75
75
  //# sourceMappingURL=ToolbarButton.js.map