@veeqo/ui 15.10.0 → 15.12.0
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.
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +9 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.module.scss.cjs +2 -2
- package/dist/components/Checkbox/Checkbox.module.scss.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.module.scss.js +2 -2
- package/dist/components/Checkbox/Checkbox.module.scss.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.cjs +2 -1
- package/dist/components/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.js +2 -1
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.cjs","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useMemo } from 'react';\nimport { Choice, ForwardedChoiceProps } from '../Choice';\nimport { generateId } from '../../utils/generateId';\n\nimport styles from './Checkbox.module.scss';\n\nexport type CheckboxValue = string | number;\n\nexport interface CheckboxProps extends ForwardedChoiceProps {\n id?: string;\n checked: boolean;\n indeterminate?: boolean;\n value?: CheckboxValue;\n name?: string;\n disabled?: boolean;\n ariaLabel?: string;\n onChange: (checked: boolean, value?: CheckboxValue, meta?: { shiftKey?: boolean }) => void;\n className?: string;\n}\n\nexport const Checkbox = ({\n id,\n checked,\n indeterminate,\n value,\n name,\n hint,\n disabled,\n ariaLabel,\n className,\n onChange,\n ...otherProps\n}: CheckboxProps) => {\n const componentId = useMemo(() => id ?? generateId('checkbox'), [id]);\n const checkboxRef = useRef<HTMLInputElement>(null);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.checked, value);\n },\n [onChange, value],\n );\n\n useEffect(() => {\n if (!checkboxRef.current) return;\n if (indeterminate === true) {\n checkboxRef.current.indeterminate = true;\n return;\n }\n checkboxRef.current.indeterminate = false;\n }, [indeterminate]);\n\n const ariaDescribedBy = hint ? `hint-${componentId}` : undefined;\n\n return (\n <Choice\n htmlFor={componentId}\n disabled={disabled}\n className={className}\n hint={hint}\n {...otherProps}\n >\n <input\n ref={checkboxRef}\n id={componentId}\n type=\"checkbox\"\n checked={checked}\n value={value}\n name={name}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy}\n onChange={handleChange}\n className={styles.input}\n />\n </Choice>\n );\n};\n"],"names":["useMemo","generateId","useRef","useCallback","useEffect","React","Choice","styles"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Checkbox.cjs","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useMemo } from 'react';\nimport { Choice, ForwardedChoiceProps } from '../Choice';\nimport { generateId } from '../../utils/generateId';\n\nimport styles from './Checkbox.module.scss';\n\nexport type CheckboxValue = string | number;\n\nexport interface CheckboxProps extends ForwardedChoiceProps {\n /** Unique identifier for the checkbox input */\n id?: string;\n /** Whether the checkbox is selected */\n checked: boolean;\n /** Whether the checkbox is in an indeterminate (partial) state */\n indeterminate?: boolean;\n /** The value associated with this checkbox option */\n value?: CheckboxValue;\n /** Name attribute for form submission */\n name?: string;\n /** Whether the checkbox is disabled and non-interactive */\n disabled?: boolean;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** Callback fired when the checkbox selection changes */\n onChange: (checked: boolean, value?: CheckboxValue, meta?: { shiftKey?: boolean }) => void;\n /** Additional CSS class name */\n className?: string;\n}\n\nexport const Checkbox = ({\n id,\n checked,\n indeterminate,\n value,\n name,\n hint,\n disabled,\n ariaLabel,\n className,\n onChange,\n ...otherProps\n}: CheckboxProps) => {\n const componentId = useMemo(() => id ?? generateId('checkbox'), [id]);\n const checkboxRef = useRef<HTMLInputElement>(null);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.checked, value);\n },\n [onChange, value],\n );\n\n useEffect(() => {\n if (!checkboxRef.current) return;\n if (indeterminate === true) {\n checkboxRef.current.indeterminate = true;\n return;\n }\n checkboxRef.current.indeterminate = false;\n }, [indeterminate]);\n\n const ariaDescribedBy = hint ? `hint-${componentId}` : undefined;\n\n return (\n <Choice\n htmlFor={componentId}\n disabled={disabled}\n className={className}\n hint={hint}\n {...otherProps}\n >\n <input\n ref={checkboxRef}\n id={componentId}\n type=\"checkbox\"\n checked={checked}\n value={value}\n name={name}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy}\n onChange={handleChange}\n className={styles.input}\n />\n </Choice>\n );\n};\n"],"names":["useMemo","generateId","useRef","useCallback","useEffect","React","Choice","styles"],"mappings":";;;;;;;;;;;AA6BO,MAAM,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,OAAO,EACP,aAAa,EACb,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,UAAU,EACC,KAAI;IAClB,MAAM,WAAW,GAAGA,aAAO,CAAC,MAAM,EAAE,KAAA,IAAA,IAAF,EAAE,KAAA,MAAA,GAAF,EAAE,GAAIC,qBAAU,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACrE,IAAA,MAAM,WAAW,GAAGC,YAAM,CAAmB,IAAI,CAAC;AAElD,IAAA,MAAM,YAAY,GAAGC,iBAAW,CAC9B,CAAC,CAAsC,KAAI;QACzC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC;AAC1C,IAAA,CAAC,EACD,CAAC,QAAQ,EAAE,KAAK,CAAC,CAClB;IAEDC,eAAS,CAAC,MAAK;QACb,IAAI,CAAC,WAAW,CAAC,OAAO;YAAE;QAC1B,IAAI,aAAa,KAAK,IAAI,EAAE;AAC1B,YAAA,WAAW,CAAC,OAAO,CAAC,aAAa,GAAG,IAAI;YACxC;AACD,QAAA;AACD,QAAA,WAAW,CAAC,OAAO,CAAC,aAAa,GAAG,KAAK;AAC3C,IAAA,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;AAEnB,IAAA,MAAM,eAAe,GAAG,IAAI,GAAG,CAAA,KAAA,EAAQ,WAAW,CAAA,CAAE,GAAG,SAAS;IAEhE,QACEC,qCAACC,aAAM,EAAA,EACL,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,KACN,UAAU,EAAA;QAEdD,sBAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EACE,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,WAAW,EACf,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAAA,YAAA,EACN,SAAS,EAAA,kBAAA,EACH,eAAe,EACjC,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAEE,eAAM,CAAC,KAAK,EAAA,CACvB,CACK;AAEb;;;;"}
|
|
@@ -2,16 +2,25 @@ import React from 'react';
|
|
|
2
2
|
import { ForwardedChoiceProps } from '../Choice';
|
|
3
3
|
export type CheckboxValue = string | number;
|
|
4
4
|
export interface CheckboxProps extends ForwardedChoiceProps {
|
|
5
|
+
/** Unique identifier for the checkbox input */
|
|
5
6
|
id?: string;
|
|
7
|
+
/** Whether the checkbox is selected */
|
|
6
8
|
checked: boolean;
|
|
9
|
+
/** Whether the checkbox is in an indeterminate (partial) state */
|
|
7
10
|
indeterminate?: boolean;
|
|
11
|
+
/** The value associated with this checkbox option */
|
|
8
12
|
value?: CheckboxValue;
|
|
13
|
+
/** Name attribute for form submission */
|
|
9
14
|
name?: string;
|
|
15
|
+
/** Whether the checkbox is disabled and non-interactive */
|
|
10
16
|
disabled?: boolean;
|
|
17
|
+
/** Accessible label for screen readers */
|
|
11
18
|
ariaLabel?: string;
|
|
19
|
+
/** Callback fired when the checkbox selection changes */
|
|
12
20
|
onChange: (checked: boolean, value?: CheckboxValue, meta?: {
|
|
13
21
|
shiftKey?: boolean;
|
|
14
22
|
}) => void;
|
|
23
|
+
/** Additional CSS class name */
|
|
15
24
|
className?: string;
|
|
16
25
|
}
|
|
17
26
|
export declare const Checkbox: ({ id, checked, indeterminate, value, name, hint, disabled, ariaLabel, className, onChange, ...otherProps }: CheckboxProps) => React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useMemo } from 'react';\nimport { Choice, ForwardedChoiceProps } from '../Choice';\nimport { generateId } from '../../utils/generateId';\n\nimport styles from './Checkbox.module.scss';\n\nexport type CheckboxValue = string | number;\n\nexport interface CheckboxProps extends ForwardedChoiceProps {\n id?: string;\n checked: boolean;\n indeterminate?: boolean;\n value?: CheckboxValue;\n name?: string;\n disabled?: boolean;\n ariaLabel?: string;\n onChange: (checked: boolean, value?: CheckboxValue, meta?: { shiftKey?: boolean }) => void;\n className?: string;\n}\n\nexport const Checkbox = ({\n id,\n checked,\n indeterminate,\n value,\n name,\n hint,\n disabled,\n ariaLabel,\n className,\n onChange,\n ...otherProps\n}: CheckboxProps) => {\n const componentId = useMemo(() => id ?? generateId('checkbox'), [id]);\n const checkboxRef = useRef<HTMLInputElement>(null);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.checked, value);\n },\n [onChange, value],\n );\n\n useEffect(() => {\n if (!checkboxRef.current) return;\n if (indeterminate === true) {\n checkboxRef.current.indeterminate = true;\n return;\n }\n checkboxRef.current.indeterminate = false;\n }, [indeterminate]);\n\n const ariaDescribedBy = hint ? `hint-${componentId}` : undefined;\n\n return (\n <Choice\n htmlFor={componentId}\n disabled={disabled}\n className={className}\n hint={hint}\n {...otherProps}\n >\n <input\n ref={checkboxRef}\n id={componentId}\n type=\"checkbox\"\n checked={checked}\n value={value}\n name={name}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy}\n onChange={handleChange}\n className={styles.input}\n />\n </Choice>\n );\n};\n"],"names":["React"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useMemo } from 'react';\nimport { Choice, ForwardedChoiceProps } from '../Choice';\nimport { generateId } from '../../utils/generateId';\n\nimport styles from './Checkbox.module.scss';\n\nexport type CheckboxValue = string | number;\n\nexport interface CheckboxProps extends ForwardedChoiceProps {\n /** Unique identifier for the checkbox input */\n id?: string;\n /** Whether the checkbox is selected */\n checked: boolean;\n /** Whether the checkbox is in an indeterminate (partial) state */\n indeterminate?: boolean;\n /** The value associated with this checkbox option */\n value?: CheckboxValue;\n /** Name attribute for form submission */\n name?: string;\n /** Whether the checkbox is disabled and non-interactive */\n disabled?: boolean;\n /** Accessible label for screen readers */\n ariaLabel?: string;\n /** Callback fired when the checkbox selection changes */\n onChange: (checked: boolean, value?: CheckboxValue, meta?: { shiftKey?: boolean }) => void;\n /** Additional CSS class name */\n className?: string;\n}\n\nexport const Checkbox = ({\n id,\n checked,\n indeterminate,\n value,\n name,\n hint,\n disabled,\n ariaLabel,\n className,\n onChange,\n ...otherProps\n}: CheckboxProps) => {\n const componentId = useMemo(() => id ?? generateId('checkbox'), [id]);\n const checkboxRef = useRef<HTMLInputElement>(null);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange(e.currentTarget.checked, value);\n },\n [onChange, value],\n );\n\n useEffect(() => {\n if (!checkboxRef.current) return;\n if (indeterminate === true) {\n checkboxRef.current.indeterminate = true;\n return;\n }\n checkboxRef.current.indeterminate = false;\n }, [indeterminate]);\n\n const ariaDescribedBy = hint ? `hint-${componentId}` : undefined;\n\n return (\n <Choice\n htmlFor={componentId}\n disabled={disabled}\n className={className}\n hint={hint}\n {...otherProps}\n >\n <input\n ref={checkboxRef}\n id={componentId}\n type=\"checkbox\"\n checked={checked}\n value={value}\n name={name}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-describedby={ariaDescribedBy}\n onChange={handleChange}\n className={styles.input}\n />\n </Choice>\n );\n};\n"],"names":["React"],"mappings":";;;;;AA6BO,MAAM,QAAQ,GAAG,CAAC,EACvB,EAAE,EACF,OAAO,EACP,aAAa,EACb,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,SAAS,EACT,QAAQ,EACR,GAAG,UAAU,EACC,KAAI;IAClB,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,KAAA,IAAA,IAAF,EAAE,KAAA,MAAA,GAAF,EAAE,GAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACrE,IAAA,MAAM,WAAW,GAAG,MAAM,CAAmB,IAAI,CAAC;AAElD,IAAA,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,CAAsC,KAAI;QACzC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC;AAC1C,IAAA,CAAC,EACD,CAAC,QAAQ,EAAE,KAAK,CAAC,CAClB;IAED,SAAS,CAAC,MAAK;QACb,IAAI,CAAC,WAAW,CAAC,OAAO;YAAE;QAC1B,IAAI,aAAa,KAAK,IAAI,EAAE;AAC1B,YAAA,WAAW,CAAC,OAAO,CAAC,aAAa,GAAG,IAAI;YACxC;AACD,QAAA;AACD,QAAA,WAAW,CAAC,OAAO,CAAC,aAAa,GAAG,KAAK;AAC3C,IAAA,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;AAEnB,IAAA,MAAM,eAAe,GAAG,IAAI,GAAG,CAAA,KAAA,EAAQ,WAAW,CAAA,CAAE,GAAG,SAAS;IAEhE,QACEA,6BAAC,MAAM,EAAA,EACL,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,KACN,UAAU,EAAA;QAEdA,cAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EACE,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,WAAW,EACf,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAAA,YAAA,EACN,SAAS,EAAA,kBAAA,EACH,eAAe,EACjC,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAE,MAAM,CAAC,KAAK,EAAA,CACvB,CACK;AAEb;;;;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
4
|
|
|
5
|
-
___$insertStyle(".
|
|
6
|
-
var styles = {"input":"
|
|
5
|
+
___$insertStyle("._input_1iza9_1 {\n appearance: none;\n width: 18px;\n height: 18px;\n background-color: transparent;\n border: 2px solid var(--choice-error-border, var(--colors-neutral-ink-lightest));\n border-radius: var(--radius-base);\n cursor: pointer;\n flex-shrink: 0;\n transition: box-shadow 0.1s, background-color 0.1s;\n}\n._input_1iza9_1:checked {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='white' /></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n}\n._input_1iza9_1:hover {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n}\n._input_1iza9_1:checked:hover {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-dark));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-dark));\n}\n._input_1iza9_1:active {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n}\n._input_1iza9_1:focus {\n box-shadow: 0 0 0 var(--sizes-xs) var(--choice-error-focus, var(--colors-secondary-blue-light));\n outline: 0;\n}\n._input_1iza9_1:indeterminate {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='white'/></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n}\n._input_1iza9_1:disabled {\n box-shadow: none;\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--colors-neutral-grey-base);\n color: var(--colors-neutral-ink-light);\n cursor: default;\n}\n._input_1iza9_1:checked:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='%23637381' /></svg>\");\n}\n._input_1iza9_1:indeterminate:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='%23637381'/></svg>\");\n}");
|
|
6
|
+
var styles = {"input":"_input_1iza9_1"};
|
|
7
7
|
|
|
8
8
|
module.exports = styles;
|
|
9
9
|
//# sourceMappingURL=Checkbox.module.scss.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.module.scss.cjs","sources":["../../../src/components/Checkbox/Checkbox.module.scss"],"sourcesContent":[".input {\n appearance: none;\n width: 18px;\n height: 18px;\n background-color: transparent;\n border: 2px solid var(--choice-error-border, var(--colors-neutral-ink-lightest));\n border-radius: var(--radius-base);\n cursor: pointer;\n flex-shrink: 0;\n transition:\n box-shadow 0.1s,\n background-color 0.1s;\n\n &:checked {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='white' /></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n }\n\n &:hover {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n }\n\n &:active {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n }\n\n &:focus {\n box-shadow: 0 0 0 var(--sizes-xs) var(--choice-error-focus, var(--colors-secondary-blue-light));\n outline: 0;\n }\n\n &:indeterminate {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='white'/></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n }\n\n &:disabled {\n box-shadow: none;\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--colors-neutral-grey-base);\n color: var(--colors-neutral-ink-light);\n cursor: default;\n }\n\n &:checked:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='%23637381' /></svg>\");\n }\n\n &:indeterminate:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='%23637381'/></svg>\");\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"Checkbox.module.scss.cjs","sources":["../../../src/components/Checkbox/Checkbox.module.scss"],"sourcesContent":[".input {\n appearance: none;\n width: 18px;\n height: 18px;\n background-color: transparent;\n border: 2px solid var(--choice-error-border, var(--colors-neutral-ink-lightest));\n border-radius: var(--radius-base);\n cursor: pointer;\n flex-shrink: 0;\n transition:\n box-shadow 0.1s,\n background-color 0.1s;\n\n &:checked {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='white' /></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n }\n\n &:hover {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n }\n\n &:checked:hover {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-dark));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-dark));\n }\n\n &:active {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n }\n\n &:focus {\n box-shadow: 0 0 0 var(--sizes-xs) var(--choice-error-focus, var(--colors-secondary-blue-light));\n outline: 0;\n }\n\n &:indeterminate {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='white'/></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n }\n\n &:disabled {\n box-shadow: none;\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--colors-neutral-grey-base);\n color: var(--colors-neutral-ink-light);\n cursor: default;\n }\n\n &:checked:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='%23637381' /></svg>\");\n }\n\n &:indeterminate:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='%23637381'/></svg>\");\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,stFAAA;AACA,aAAA,CAAA,OAAA,CAAA,gBAAA;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
2
|
|
|
3
|
-
insertStyle(".
|
|
4
|
-
var styles = {"input":"
|
|
3
|
+
insertStyle("._input_1iza9_1 {\n appearance: none;\n width: 18px;\n height: 18px;\n background-color: transparent;\n border: 2px solid var(--choice-error-border, var(--colors-neutral-ink-lightest));\n border-radius: var(--radius-base);\n cursor: pointer;\n flex-shrink: 0;\n transition: box-shadow 0.1s, background-color 0.1s;\n}\n._input_1iza9_1:checked {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='white' /></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n}\n._input_1iza9_1:hover {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n}\n._input_1iza9_1:checked:hover {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-dark));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-dark));\n}\n._input_1iza9_1:active {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n}\n._input_1iza9_1:focus {\n box-shadow: 0 0 0 var(--sizes-xs) var(--choice-error-focus, var(--colors-secondary-blue-light));\n outline: 0;\n}\n._input_1iza9_1:indeterminate {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='white'/></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n}\n._input_1iza9_1:disabled {\n box-shadow: none;\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--colors-neutral-grey-base);\n color: var(--colors-neutral-ink-light);\n cursor: default;\n}\n._input_1iza9_1:checked:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='%23637381' /></svg>\");\n}\n._input_1iza9_1:indeterminate:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='%23637381'/></svg>\");\n}");
|
|
4
|
+
var styles = {"input":"_input_1iza9_1"};
|
|
5
5
|
|
|
6
6
|
export { styles as default };
|
|
7
7
|
//# sourceMappingURL=Checkbox.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.module.scss.js","sources":["../../../src/components/Checkbox/Checkbox.module.scss"],"sourcesContent":[".input {\n appearance: none;\n width: 18px;\n height: 18px;\n background-color: transparent;\n border: 2px solid var(--choice-error-border, var(--colors-neutral-ink-lightest));\n border-radius: var(--radius-base);\n cursor: pointer;\n flex-shrink: 0;\n transition:\n box-shadow 0.1s,\n background-color 0.1s;\n\n &:checked {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='white' /></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n }\n\n &:hover {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n }\n\n &:active {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n }\n\n &:focus {\n box-shadow: 0 0 0 var(--sizes-xs) var(--choice-error-focus, var(--colors-secondary-blue-light));\n outline: 0;\n }\n\n &:indeterminate {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='white'/></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n }\n\n &:disabled {\n box-shadow: none;\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--colors-neutral-grey-base);\n color: var(--colors-neutral-ink-light);\n cursor: default;\n }\n\n &:checked:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='%23637381' /></svg>\");\n }\n\n &:indeterminate:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='%23637381'/></svg>\");\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"Checkbox.module.scss.js","sources":["../../../src/components/Checkbox/Checkbox.module.scss"],"sourcesContent":[".input {\n appearance: none;\n width: 18px;\n height: 18px;\n background-color: transparent;\n border: 2px solid var(--choice-error-border, var(--colors-neutral-ink-lightest));\n border-radius: var(--radius-base);\n cursor: pointer;\n flex-shrink: 0;\n transition:\n box-shadow 0.1s,\n background-color 0.1s;\n\n &:checked {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='white' /></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n }\n\n &:hover {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n }\n\n &:checked:hover {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-dark));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-dark));\n }\n\n &:active {\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n }\n\n &:focus {\n box-shadow: 0 0 0 var(--sizes-xs) var(--choice-error-focus, var(--colors-secondary-blue-light));\n outline: 0;\n }\n\n &:indeterminate {\n background-color: var(--choice-error-bg, var(--colors-secondary-blue-base));\n border-color: var(--choice-error-border, var(--colors-secondary-blue-base));\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='white'/></svg>\");\n background-repeat: no-repeat;\n background-size: var(--sizes-4);\n background-position: center;\n }\n\n &:disabled {\n box-shadow: none;\n background-color: var(--colors-neutral-grey-base);\n border-color: var(--colors-neutral-grey-base);\n color: var(--colors-neutral-ink-light);\n cursor: default;\n }\n\n &:checked:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M8.56846 16.3657L3.86697 11.6642L2.2998 13.2313L8.56846 19.5L22.0013 6.06716L20.4341 4.5L8.56846 16.3657Z' fill='%23637381' /></svg>\");\n }\n\n &:indeterminate:disabled {\n background-image: url(\"data:image/svg+xml;utf-8,<svg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'><rect x='5' y='11' width='14' height='3' fill='%23637381'/></svg>\");\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,stFAAA;AACA,aAAA,CAAA,OAAA,CAAA,gBAAA;;;;"}
|
|
@@ -17,6 +17,7 @@ const WithOptionalPortal = ({ usePortal = false, children,
|
|
|
17
17
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
18
18
|
}) => (usePortal ? React__default.default.createElement(Portal.Portal, null, children) : React__default.default.createElement(React__default.default.Fragment, null, children));
|
|
19
19
|
const Tooltip = ({ children, text, content, config, reversed = false, className, hoverableClassName, withTriangle, initialShouldShow = false, useReactPortal = true, }) => {
|
|
20
|
+
var _a;
|
|
20
21
|
const [shouldShow, setShouldShow] = React.useState(initialShouldShow);
|
|
21
22
|
const [hoverableElement, setHoverableElement] = React.useState(null);
|
|
22
23
|
const hasText = text ? text.trim().length > 0 : false;
|
|
@@ -31,7 +32,7 @@ const Tooltip = ({ children, text, content, config, reversed = false, className,
|
|
|
31
32
|
}
|
|
32
33
|
: undefined;
|
|
33
34
|
if (!hasContent)
|
|
34
|
-
return children;
|
|
35
|
+
return (_a = children) !== null && _a !== void 0 ? _a : null;
|
|
35
36
|
const show = () => setShouldShow(true);
|
|
36
37
|
const hide = () => setShouldShow(false);
|
|
37
38
|
return (React__default.default.createElement("div", { className: buildClassnames.buildClassnames([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.cjs","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { ReactNode, useState } from 'react';\nimport { buildClassnames } from '../../utils';\nimport { Portal } from '../Portal';\nimport { TooltipPopover } from './components/TooltipPopover';\nimport { LegacyClassNames } from './components/types';\nimport tooltipStyles from './Tooltip.module.scss';\nimport { TooltipProps } from './types';\n\nconst WithOptionalPortal: React.FC<{ usePortal: boolean; children: ReactNode }> = ({\n usePortal = false,\n children,\n // eslint-disable-next-line react/jsx-no-useless-fragment\n}) => (usePortal ? <Portal>{children}</Portal> : <>{children}</>);\n\nexport const Tooltip = ({\n children,\n text,\n content,\n config,\n reversed = false,\n className,\n hoverableClassName,\n withTriangle,\n initialShouldShow = false,\n useReactPortal = true,\n}: TooltipProps):
|
|
1
|
+
{"version":3,"file":"Tooltip.cjs","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { ReactElement, ReactNode, useState } from 'react';\nimport { buildClassnames } from '../../utils';\nimport { Portal } from '../Portal';\nimport { TooltipPopover } from './components/TooltipPopover';\nimport { LegacyClassNames } from './components/types';\nimport tooltipStyles from './Tooltip.module.scss';\nimport { TooltipProps } from './types';\n\nconst WithOptionalPortal: React.FC<{ usePortal: boolean; children: ReactNode }> = ({\n usePortal = false,\n children,\n // eslint-disable-next-line react/jsx-no-useless-fragment\n}) => (usePortal ? <Portal>{children}</Portal> : <>{children}</>);\n\nexport const Tooltip = ({\n children,\n text,\n content,\n config,\n reversed = false,\n className,\n hoverableClassName,\n withTriangle,\n initialShouldShow = false,\n useReactPortal = true,\n}: TooltipProps): ReactElement | null => {\n const [shouldShow, setShouldShow] = useState(initialShouldShow);\n const [hoverableElement, setHoverableElement] = useState<HTMLDivElement | null>(null);\n\n const hasText = text ? text.trim().length > 0 : false;\n const hasContent = !!(content || hasText);\n\n // Backward-compatible suffix classes for monolith consumers that\n // target sub-elements via the className prefix convention.\n const legacyClassNames: LegacyClassNames | undefined = className\n ? {\n tip: `${className}-tip`,\n wrap: `${className}-wrap`,\n triangle: `${className}-triangle`,\n }\n : undefined;\n\n if (!hasContent) return (children as ReactElement) ?? null;\n\n const show = () => setShouldShow(true);\n const hide = () => setShouldShow(false);\n\n return (\n <div\n className={buildClassnames([\n tooltipStyles.container,\n className,\n className && `${className}-container`,\n ])}\n >\n <AnimatePresence>\n {shouldShow && (\n <WithOptionalPortal usePortal={useReactPortal}>\n <TooltipPopover\n key=\"tooltip-popover\"\n hoverableElement={hoverableElement}\n config={config}\n reversed={reversed}\n withTriangle={withTriangle}\n text={text}\n content={content}\n legacyClassNames={legacyClassNames}\n />\n </WithOptionalPortal>\n )}\n </AnimatePresence>\n\n <div\n ref={setHoverableElement}\n className={buildClassnames([\n tooltipStyles.hoverable,\n hoverableClassName,\n className && `${className}-hoverable`,\n ])}\n onMouseEnter={show}\n onMouseLeave={hide}\n onFocus={show}\n onBlur={hide}\n >\n {children}\n </div>\n </div>\n );\n};\n"],"names":["React","Portal","useState","buildClassnames","tooltipStyles","AnimatePresence","TooltipPopover"],"mappings":";;;;;;;;;;;;;;;AASA,MAAM,kBAAkB,GAA0D,CAAC,EACjF,SAAS,GAAG,KAAK,EACjB,QAAQ;AACR;AACD,EAAA,MAAM,SAAS,GAAGA,sBAAA,CAAA,aAAA,CAACC,aAAM,QAAE,QAAQ,CAAU,GAAGD,4EAAG,QAAQ,CAAI,CAAC;AAE1D,MAAM,OAAO,GAAG,CAAC,EACtB,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,MAAM,EACN,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,GAAG,KAAK,EACzB,cAAc,GAAG,IAAI,GACR,KAAyB;;IACtC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGE,cAAQ,CAAC,iBAAiB,CAAC;IAC/D,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAGA,cAAQ,CAAwB,IAAI,CAAC;AAErF,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK;IACrD,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,IAAI,OAAO,CAAC;;;IAIzC,MAAM,gBAAgB,GAAiC;AACrD,UAAE;YACE,GAAG,EAAE,CAAA,EAAG,SAAS,CAAA,IAAA,CAAM;YACvB,IAAI,EAAE,CAAA,EAAG,SAAS,CAAA,KAAA,CAAO;YACzB,QAAQ,EAAE,CAAA,EAAG,SAAS,CAAA,SAAA,CAAW;AAClC;UACD,SAAS;AAEb,IAAA,IAAI,CAAC,UAAU;AAAE,QAAA,OAAO,CAAA,EAAA,GAAC,QAAyB,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,IAAI;IAE1D,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC;IACtC,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC;AAEvC,IAAA,QACEF,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAEG,+BAAe,CAAC;AACzB,YAAAC,cAAa,CAAC,SAAS;YACvB,SAAS;YACT,SAAS,IAAI,CAAA,EAAG,SAAS,CAAA,UAAA,CAAY;SACtC,CAAC,EAAA;QAEFJ,sBAAA,CAAA,aAAA,CAACK,4BAAe,EAAA,IAAA,EACb,UAAU,KACTL,qCAAC,kBAAkB,EAAA,EAAC,SAAS,EAAE,cAAc,EAAA;AAC3C,YAAAA,sBAAA,CAAA,aAAA,CAACM,6BAAc,EAAA,EACb,GAAG,EAAC,iBAAiB,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,EAAA,CAClC,CACiB,CACtB,CACe;AAElB,QAAAN,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,mBAAmB,EACxB,SAAS,EAAEG,+BAAe,CAAC;AACzB,gBAAAC,cAAa,CAAC,SAAS;gBACvB,kBAAkB;gBAClB,SAAS,IAAI,CAAA,EAAG,SAAS,CAAA,UAAA,CAAY;aACtC,CAAC,EACF,YAAY,EAAE,IAAI,EAClB,YAAY,EAAE,IAAI,EAClB,OAAO,EAAE,IAAI,EACb,MAAM,EAAE,IAAI,IAEX,QAAQ,CACL,CACF;AAEV;;;;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
2
|
import { TooltipProps } from './types';
|
|
3
|
-
export declare const Tooltip: ({ children, text, content, config, reversed, className, hoverableClassName, withTriangle, initialShouldShow, useReactPortal, }: TooltipProps) =>
|
|
3
|
+
export declare const Tooltip: ({ children, text, content, config, reversed, className, hoverableClassName, withTriangle, initialShouldShow, useReactPortal, }: TooltipProps) => ReactElement | null;
|
|
@@ -11,6 +11,7 @@ const WithOptionalPortal = ({ usePortal = false, children,
|
|
|
11
11
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
12
12
|
}) => (usePortal ? React__default.createElement(Portal, null, children) : React__default.createElement(React__default.Fragment, null, children));
|
|
13
13
|
const Tooltip = ({ children, text, content, config, reversed = false, className, hoverableClassName, withTriangle, initialShouldShow = false, useReactPortal = true, }) => {
|
|
14
|
+
var _a;
|
|
14
15
|
const [shouldShow, setShouldShow] = useState(initialShouldShow);
|
|
15
16
|
const [hoverableElement, setHoverableElement] = useState(null);
|
|
16
17
|
const hasText = text ? text.trim().length > 0 : false;
|
|
@@ -25,7 +26,7 @@ const Tooltip = ({ children, text, content, config, reversed = false, className,
|
|
|
25
26
|
}
|
|
26
27
|
: undefined;
|
|
27
28
|
if (!hasContent)
|
|
28
|
-
return children;
|
|
29
|
+
return (_a = children) !== null && _a !== void 0 ? _a : null;
|
|
29
30
|
const show = () => setShouldShow(true);
|
|
30
31
|
const hide = () => setShouldShow(false);
|
|
31
32
|
return (React__default.createElement("div", { className: buildClassnames([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { ReactNode, useState } from 'react';\nimport { buildClassnames } from '../../utils';\nimport { Portal } from '../Portal';\nimport { TooltipPopover } from './components/TooltipPopover';\nimport { LegacyClassNames } from './components/types';\nimport tooltipStyles from './Tooltip.module.scss';\nimport { TooltipProps } from './types';\n\nconst WithOptionalPortal: React.FC<{ usePortal: boolean; children: ReactNode }> = ({\n usePortal = false,\n children,\n // eslint-disable-next-line react/jsx-no-useless-fragment\n}) => (usePortal ? <Portal>{children}</Portal> : <>{children}</>);\n\nexport const Tooltip = ({\n children,\n text,\n content,\n config,\n reversed = false,\n className,\n hoverableClassName,\n withTriangle,\n initialShouldShow = false,\n useReactPortal = true,\n}: TooltipProps):
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"sourcesContent":["import { AnimatePresence } from 'framer-motion';\nimport React, { ReactElement, ReactNode, useState } from 'react';\nimport { buildClassnames } from '../../utils';\nimport { Portal } from '../Portal';\nimport { TooltipPopover } from './components/TooltipPopover';\nimport { LegacyClassNames } from './components/types';\nimport tooltipStyles from './Tooltip.module.scss';\nimport { TooltipProps } from './types';\n\nconst WithOptionalPortal: React.FC<{ usePortal: boolean; children: ReactNode }> = ({\n usePortal = false,\n children,\n // eslint-disable-next-line react/jsx-no-useless-fragment\n}) => (usePortal ? <Portal>{children}</Portal> : <>{children}</>);\n\nexport const Tooltip = ({\n children,\n text,\n content,\n config,\n reversed = false,\n className,\n hoverableClassName,\n withTriangle,\n initialShouldShow = false,\n useReactPortal = true,\n}: TooltipProps): ReactElement | null => {\n const [shouldShow, setShouldShow] = useState(initialShouldShow);\n const [hoverableElement, setHoverableElement] = useState<HTMLDivElement | null>(null);\n\n const hasText = text ? text.trim().length > 0 : false;\n const hasContent = !!(content || hasText);\n\n // Backward-compatible suffix classes for monolith consumers that\n // target sub-elements via the className prefix convention.\n const legacyClassNames: LegacyClassNames | undefined = className\n ? {\n tip: `${className}-tip`,\n wrap: `${className}-wrap`,\n triangle: `${className}-triangle`,\n }\n : undefined;\n\n if (!hasContent) return (children as ReactElement) ?? null;\n\n const show = () => setShouldShow(true);\n const hide = () => setShouldShow(false);\n\n return (\n <div\n className={buildClassnames([\n tooltipStyles.container,\n className,\n className && `${className}-container`,\n ])}\n >\n <AnimatePresence>\n {shouldShow && (\n <WithOptionalPortal usePortal={useReactPortal}>\n <TooltipPopover\n key=\"tooltip-popover\"\n hoverableElement={hoverableElement}\n config={config}\n reversed={reversed}\n withTriangle={withTriangle}\n text={text}\n content={content}\n legacyClassNames={legacyClassNames}\n />\n </WithOptionalPortal>\n )}\n </AnimatePresence>\n\n <div\n ref={setHoverableElement}\n className={buildClassnames([\n tooltipStyles.hoverable,\n hoverableClassName,\n className && `${className}-hoverable`,\n ])}\n onMouseEnter={show}\n onMouseLeave={hide}\n onFocus={show}\n onBlur={hide}\n >\n {children}\n </div>\n </div>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;AASA,MAAM,kBAAkB,GAA0D,CAAC,EACjF,SAAS,GAAG,KAAK,EACjB,QAAQ;AACR;AACD,EAAA,MAAM,SAAS,GAAGA,cAAA,CAAA,aAAA,CAAC,MAAM,QAAE,QAAQ,CAAU,GAAGA,4DAAG,QAAQ,CAAI,CAAC;AAE1D,MAAM,OAAO,GAAG,CAAC,EACtB,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,MAAM,EACN,QAAQ,GAAG,KAAK,EAChB,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,GAAG,KAAK,EACzB,cAAc,GAAG,IAAI,GACR,KAAyB;;IACtC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC;IAC/D,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAwB,IAAI,CAAC;AAErF,IAAA,MAAM,OAAO,GAAG,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK;IACrD,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,IAAI,OAAO,CAAC;;;IAIzC,MAAM,gBAAgB,GAAiC;AACrD,UAAE;YACE,GAAG,EAAE,CAAA,EAAG,SAAS,CAAA,IAAA,CAAM;YACvB,IAAI,EAAE,CAAA,EAAG,SAAS,CAAA,KAAA,CAAO;YACzB,QAAQ,EAAE,CAAA,EAAG,SAAS,CAAA,SAAA,CAAW;AAClC;UACD,SAAS;AAEb,IAAA,IAAI,CAAC,UAAU;AAAE,QAAA,OAAO,CAAA,EAAA,GAAC,QAAyB,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAI,IAAI;IAE1D,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,IAAI,CAAC;IACtC,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,KAAK,CAAC;AAEvC,IAAA,QACEA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,SAAS,EAAE,eAAe,CAAC;AACzB,YAAA,aAAa,CAAC,SAAS;YACvB,SAAS;YACT,SAAS,IAAI,CAAA,EAAG,SAAS,CAAA,UAAA,CAAY;SACtC,CAAC,EAAA;QAEFA,cAAA,CAAA,aAAA,CAAC,eAAe,EAAA,IAAA,EACb,UAAU,KACTA,6BAAC,kBAAkB,EAAA,EAAC,SAAS,EAAE,cAAc,EAAA;AAC3C,YAAAA,cAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EACb,GAAG,EAAC,iBAAiB,EACrB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,EAAA,CAClC,CACiB,CACtB,CACe;AAElB,QAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EACE,GAAG,EAAE,mBAAmB,EACxB,SAAS,EAAE,eAAe,CAAC;AACzB,gBAAA,aAAa,CAAC,SAAS;gBACvB,kBAAkB;gBAClB,SAAS,IAAI,CAAA,EAAG,SAAS,CAAA,UAAA,CAAY;aACtC,CAAC,EACF,YAAY,EAAE,IAAI,EAClB,YAAY,EAAE,IAAI,EAClB,OAAO,EAAE,IAAI,EACb,MAAM,EAAE,IAAI,IAEX,QAAQ,CACL,CACF;AAEV;;;;"}
|