@bookjane2/bookjane-design-library 9.0.21 → 9.0.23
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/lib/components/BKJPillDropdown/BKJPillDropdown.context.d.ts.map +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.context.js +23 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.context.js.map +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.d.ts.map +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.js +9 -6
- package/lib/components/BKJPillDropdown/BKJPillDropdown.js.map +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.stories.d.ts +5 -0
- package/lib/components/BKJPillDropdown/BKJPillDropdown.stories.d.ts.map +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.stories.js +48 -17
- package/lib/components/BKJPillDropdown/BKJPillDropdown.stories.js.map +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.styled.d.ts +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.styled.d.ts.map +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.styled.js +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.styled.js.map +1 -1
- package/lib/components/BKJPillDropdown/BKJPillDropdown.test.d.ts +2 -0
- package/lib/components/BKJPillDropdown/BKJPillDropdown.test.d.ts.map +1 -0
- package/lib/components/BKJPillDropdown/BKJPillDropdown.test.js +231 -0
- package/lib/components/BKJPillDropdown/BKJPillDropdown.test.js.map +1 -0
- package/lib/components/BKJPillTextArea/BKJPillTextArea.context.d.ts.map +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.context.js +47 -17
- package/lib/components/BKJPillTextArea/BKJPillTextArea.context.js.map +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.d.ts.map +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.js +12 -7
- package/lib/components/BKJPillTextArea/BKJPillTextArea.js.map +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.stories.d.ts +15 -0
- package/lib/components/BKJPillTextArea/BKJPillTextArea.stories.d.ts.map +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.stories.js +45 -0
- package/lib/components/BKJPillTextArea/BKJPillTextArea.stories.js.map +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.styled.d.ts +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.styled.d.ts.map +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.styled.js +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.styled.js.map +1 -1
- package/lib/components/BKJPillTextArea/BKJPillTextArea.test.d.ts +2 -0
- package/lib/components/BKJPillTextArea/BKJPillTextArea.test.d.ts.map +1 -0
- package/lib/components/BKJPillTextArea/BKJPillTextArea.test.js +227 -0
- package/lib/components/BKJPillTextArea/BKJPillTextArea.test.js.map +1 -0
- package/lib/components/BKJPillTextArea/BKJPillTextArea.types.d.ts +6 -2
- package/lib/components/BKJPillTextArea/BKJPillTextArea.types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BKJPillDropdown.context.d.ts","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,
|
|
1
|
+
{"version":3,"file":"BKJPillDropdown.context.d.ts","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,EAAE,EAUH,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAI5F,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,wBAAwB,CA2HhE,CAAC;AAEF,eAAO,MAAM,yBAAyB,+BAA2C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useCallback, useContext, useMemo, useRef, useState, } from 'react';
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
3
|
import { v4 as uuidv4 } from 'uuid';
|
|
4
4
|
const BKJPillDropdownContext = createContext(null);
|
|
5
5
|
export const BKJPillDropdownProvider = ({ children, value = [], onChange, name, max, }) => {
|
|
@@ -12,6 +12,16 @@ export const BKJPillDropdownProvider = ({ children, value = [], onChange, name,
|
|
|
12
12
|
const onInputFocused = useCallback((event) => {
|
|
13
13
|
event.preventDefault();
|
|
14
14
|
event.stopPropagation();
|
|
15
|
+
// When the input is already the active element (e.g., user just clicked
|
|
16
|
+
// the input directly, or focus was programmatically moved here after a
|
|
17
|
+
// chip remove), calling .focus() again is a no-op and does NOT fire a
|
|
18
|
+
// fresh focus event — so Downshift's onFocus → openMenu does not run and
|
|
19
|
+
// the dropdown stays closed even though the visual focus is correct.
|
|
20
|
+
// Briefly blur first so the subsequent .focus() always fires a focus
|
|
21
|
+
// event and re-opens the menu.
|
|
22
|
+
if (document.activeElement === inputRef.current) {
|
|
23
|
+
inputRef.current?.blur();
|
|
24
|
+
}
|
|
15
25
|
inputRef.current?.focus();
|
|
16
26
|
setFocus(true);
|
|
17
27
|
inputRef.current?.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
@@ -31,6 +41,8 @@ export const BKJPillDropdownProvider = ({ children, value = [], onChange, name,
|
|
|
31
41
|
return (event) => {
|
|
32
42
|
event.preventDefault();
|
|
33
43
|
event.stopPropagation();
|
|
44
|
+
inputRef.current?.focus();
|
|
45
|
+
setFocus(true);
|
|
34
46
|
const index = value.indexOf(__VALUE__);
|
|
35
47
|
const nextValue = Array.from(value).filter((value) => value !== 'select_all');
|
|
36
48
|
nextValue.splice(index, 1);
|
|
@@ -54,6 +66,16 @@ export const BKJPillDropdownProvider = ({ children, value = [], onChange, name,
|
|
|
54
66
|
if (!isOpen)
|
|
55
67
|
setFocus(false);
|
|
56
68
|
}, []);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
const inputEl = inputRef.current;
|
|
71
|
+
if (!inputEl)
|
|
72
|
+
return undefined;
|
|
73
|
+
const handleFocus = () => setFocus(true);
|
|
74
|
+
inputEl.addEventListener('focus', handleFocus);
|
|
75
|
+
return () => {
|
|
76
|
+
inputEl.removeEventListener('focus', handleFocus);
|
|
77
|
+
};
|
|
78
|
+
}, []);
|
|
57
79
|
return (_jsx(BKJPillDropdownContext.Provider, { value: {
|
|
58
80
|
wrapperRef,
|
|
59
81
|
inputRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BKJPillDropdown.context.js","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.context.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAKb,WAAW,EACX,UAAU,EACV,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAKpC,MAAM,sBAAsB,GAAG,aAAa,CAA0B,IAAK,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,uBAAuB,GAAiC,CAAC,EACpE,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,QAAQ,EACR,IAAI,EACJ,GAAG,GACJ,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAChD,MAAM,kBAAkB,GAAkC,MAAM,CAAC,IAA8B,CAAC,CAAC;IACjG,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAS,MAAM,EAAE,CAAC,CAAC;IAC1C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAC;IACzD,MAAM,CAA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AAa;YACb,WAAW;YACX,YAAY;YACZ,SAAS;YACT,aAAa;YACb,IAAI;YACJ,iBAAiB;YACjB,cAAc;SACf,YAEA,QAAQ,GACuB,CACnC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"BKJPillDropdown.context.js","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.context.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAKb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAKpC,MAAM,sBAAsB,GAAG,aAAa,CAA0B,IAAK,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,uBAAuB,GAAiC,CAAC,EACpE,QAAQ,EACR,KAAK,GAAG,EAAE,EACV,QAAQ,EACR,IAAI,EACJ,GAAG,GACJ,EAAE,EAAE;IACH,MAAM,UAAU,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAChD,MAAM,kBAAkB,GAAkC,MAAM,CAAC,IAA8B,CAAC,CAAC;IACjG,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAS,MAAM,EAAE,CAAC,CAAC;IAC1C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAS,EAAE,CAAC,CAAC;IACzD,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9C,MAAM,cAAc,GAAsC,WAAW,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9E,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,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AAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;QACjC,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAC/B,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzC,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC/C,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QACpD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,KAAC,sBAAsB,CAAC,QAAQ,IAC9B,KAAK,EAAE;YACL,UAAU;YACV,QAAQ;YACR,KAAK;YACL,UAAU;YACV,cAAc;YACd,aAAa;YACb,WAAW;YACX,YAAY;YACZ,SAAS;YACT,aAAa;YACb,IAAI;YACJ,iBAAiB;YACjB,cAAc;SACf,YAEA,QAAQ,GACuB,CACnC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BKJPillDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAwB,MAAM,OAAO,CAAC;AAajD,OAAO,EAAE,gBAAgB,EAA2B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"BKJPillDropdown.d.ts","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAwB,MAAM,OAAO,CAAC;AAajD,OAAO,EAAE,gBAAgB,EAA2B,MAAM,yBAAyB,CAAC;AAqNpF,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,gBAAgB,CA4BhD,CAAC"}
|
|
@@ -8,19 +8,20 @@ import { ArrowIconWrapper, BKJPillDropdownComboBox, BKJPillDropdownWrapper, Inpu
|
|
|
8
8
|
import i18next from 'i18next';
|
|
9
9
|
import { SELECT_ALL_NODE_ID } from './BKJPillDropdown.constants.js';
|
|
10
10
|
import { useResizeObserver } from '../../hooks/index.js';
|
|
11
|
-
const InputComponent = forwardRef(({ onInputChange, value, isFocused, onIsOpenChange, options = [], wrapperRef, placeholder, ...rest }, ref) => {
|
|
11
|
+
const InputComponent = forwardRef(({ onInputChange, value, isFocused, onIsOpenChange, options = [], wrapperRef, placeholder, ariaLabelledBy, ...rest }, ref) => {
|
|
12
12
|
const [, height] = useResizeObserver(wrapperRef?.current);
|
|
13
|
-
return (_jsx(BKJPillDropdownComboBox, { ...rest, "$dropdownOffset": height || 0, overrides: ['HIDE_VALUE_LABEL', 'CHECKBOX_VARIANT'], ref: ref, action: "OpenToggle", name: "BKJPillDropdown_InputValue", placeholder: !!value?.length ? '' : placeholder, options: options, type: "Multiple", onIsOpenChange: onIsOpenChange, onChange: onInputChange, value: value, hasValue: value.length > 0 }));
|
|
13
|
+
return (_jsx(BKJPillDropdownComboBox, { ...rest, "$dropdownOffset": height || 0, overrides: ['HIDE_VALUE_LABEL', 'CHECKBOX_VARIANT'], ref: ref, action: "OpenToggle", name: "BKJPillDropdown_InputValue", placeholder: !!value?.length ? '' : placeholder, options: options, type: "Multiple", onIsOpenChange: onIsOpenChange, onChange: onInputChange, value: value, hasValue: value.length > 0, "aria-labelledby": ariaLabelledBy }));
|
|
14
14
|
});
|
|
15
15
|
const BKJPillDropdownComponent = (props) => {
|
|
16
16
|
const { value, label, required, disabled, description, name, error, max, options, placeholder, showSelectAll, allowedAutoPlacements, ...rest } = props;
|
|
17
17
|
const { wrapperRef, inputRef, uuid, onChipRemove, onInputFocused, onInputChange, onInputBlur, isMaxLimitReached, onIsOpenChange, isFocused, } = useBKJPillDropdownContext();
|
|
18
|
+
const selectableCount = options.filter((o) => !o.isGroupNode).length;
|
|
18
19
|
const dropdownListOptions = [
|
|
19
20
|
...(showSelectAll && options?.length ? [{
|
|
20
21
|
name: SELECT_ALL_NODE_ID,
|
|
21
22
|
id: SELECT_ALL_NODE_ID,
|
|
22
23
|
key: SELECT_ALL_NODE_ID,
|
|
23
|
-
label: i18next.t('translations:SELECT_ALL')
|
|
24
|
+
label: `${i18next.t('translations:SELECT_ALL')} ${selectableCount} items`,
|
|
24
25
|
value: SELECT_ALL_NODE_ID,
|
|
25
26
|
}] : []),
|
|
26
27
|
...options
|
|
@@ -63,13 +64,15 @@ const BKJPillDropdownComponent = (props) => {
|
|
|
63
64
|
}
|
|
64
65
|
return onInputChange({ ...event, target: { ...event.target, name, value: filteredValue } });
|
|
65
66
|
};
|
|
66
|
-
|
|
67
|
+
const inputLabelId = `BKJPillDropdown_${uuid}_Label`;
|
|
68
|
+
return (_jsxs(BKJPillDropdownWrapper, { children: [label && (_jsxs(InputLabel, { id: inputLabelId, disabled: disabled, children: [label, required && _jsx(RequiredAsterisk, { children: "\u00A0*" })] })), value.length !== 0 && (_createElement(TextAreaWrapper, { ...rest, key: `BKJPillDropdown_${uuid}`, id: `BKJPillDropdown_${uuid}_TextAreaWrapper`, ref: wrapperRef, error: !!error || isMaxLimitReached, disabled: disabled, onMouseDown: onInputFocused, hasValue: value.length > 0, isFocused: isFocused },
|
|
67
69
|
_jsxs(Flex, { flexWrap: "wrap", gap: "4px", padding: value.length > 0 ? '8px 8px 0' : '8px 8px', margin: "0 17px 0 0", children: [value.map((strValue) => {
|
|
68
70
|
const MATCHED = options.find(({ value, isGroupNode }) => value === strValue && !isGroupNode);
|
|
69
71
|
if (!MATCHED)
|
|
70
72
|
return _jsx(Fragment, {});
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
const closeAriaLabel = disabled ? undefined : `Remove ${MATCHED.label}`;
|
|
74
|
+
return (_jsx(BKJChip, { onClose: onChipRemove(MATCHED.value), variant: "Purple", closeAriaLabel: closeAriaLabel, children: MATCHED.label }, MATCHED.value));
|
|
75
|
+
}), _jsx(ArrowIconWrapper, { children: _jsx(BKJIcon, { iconName: isFocused ? 'ArrowUp' : 'ArrowDown' }) })] }))), _jsx(InputComponent, { ref: inputRef, options: dropdownListOptions, isFocused: isFocused, value: value, ariaLabelledBy: label ? inputLabelId : undefined, onInputChange: (event) => {
|
|
73
76
|
if (showSelectAll && event.target.value.includes(SELECT_ALL_NODE_ID)) {
|
|
74
77
|
return handleSelectAllChange(event, dropdownListOptions, onInputChange);
|
|
75
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BKJPillDropdown.js","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAM,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"BKJPillDropdown.js","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAM,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,OAAO,EA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AAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,GAAG,YAER,KAAC,wBAAwB,IACvB,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,KACJ,IAAI,EACR,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,GACxB,GACsB,CAC3B,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -30,5 +30,10 @@ declare const setup: {
|
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
32
|
export declare const Default: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, IBKJPillDropdown>;
|
|
33
|
+
export declare const WithChips: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, IBKJPillDropdown>;
|
|
34
|
+
export declare const ErrorState: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, IBKJPillDropdown>;
|
|
35
|
+
export declare const WithSelectAll: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, IBKJPillDropdown>;
|
|
36
|
+
export declare const WithSelectAllAllSelected: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, IBKJPillDropdown>;
|
|
37
|
+
export declare const Disabled: import("@storybook/core/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, IBKJPillDropdown>;
|
|
33
38
|
export default setup;
|
|
34
39
|
//# sourceMappingURL=BKJPillDropdown.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BKJPillDropdown.stories.d.ts","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAS3D,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BV,CAAC;
|
|
1
|
+
{"version":3,"file":"BKJPillDropdown.stories.d.ts","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAS3D,QAAA,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BV,CAAC;AA8GF,eAAO,MAAM,OAAO,4GAAoB,CAAC;AAOzC,eAAO,MAAM,SAAS,4GAAoC,CAAC;AAO3D,eAAO,MAAM,UAAU,4GAA+B,CAAC;AAQvD,eAAO,MAAM,aAAa,4GAAoC,CAAC;AAS/D,eAAO,MAAM,wBAAwB,4GAA6C,CAAC;AAQnF,eAAO,MAAM,QAAQ,4GAAoC,CAAC;AAQ1D,eAAe,KAAK,CAAC"}
|
|
@@ -35,9 +35,6 @@ const setup = {
|
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
|
-
const initialState = {
|
|
39
|
-
data: ['2'],
|
|
40
|
-
};
|
|
41
38
|
function VALIDATION_unique(data) {
|
|
42
39
|
let errs = [];
|
|
43
40
|
const hasDuplicates = uniq(data).length !== data.length;
|
|
@@ -50,9 +47,6 @@ function VALIDATION_unique(data) {
|
|
|
50
47
|
return errs;
|
|
51
48
|
return '';
|
|
52
49
|
}
|
|
53
|
-
const opts = [...Array(10)].map((_, i) => {
|
|
54
|
-
return { id: String(i + 1), label: `Item Number #${i + 1}`, value: String(i + 1) };
|
|
55
|
-
});
|
|
56
50
|
const groupedOpts = [
|
|
57
51
|
{
|
|
58
52
|
"id": "1",
|
|
@@ -118,23 +112,60 @@ const groupedOpts = [
|
|
|
118
112
|
"groupId": "2",
|
|
119
113
|
}
|
|
120
114
|
];
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
115
|
+
const makeTemplate = (initialData) => {
|
|
116
|
+
const Tpl = (props) => {
|
|
117
|
+
const { values: { data }, onChange, } = useFormBehaviors({
|
|
118
|
+
initialState: { data: initialData },
|
|
119
|
+
onSubmit: console.log,
|
|
120
|
+
validations: {
|
|
121
|
+
data: VALIDATION_unique,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
return (_jsx(Flex, { width: "400px", children: _jsx(BKJPillDropdown, { ...props, options: groupedOpts, onChange: onChange, name: "data", value: data }) }));
|
|
125
|
+
};
|
|
126
|
+
return Tpl;
|
|
132
127
|
};
|
|
128
|
+
const Template = makeTemplate(['2']);
|
|
133
129
|
export const Default = Template.bind({});
|
|
134
130
|
Default.args = {
|
|
135
131
|
label: 'Employment Status',
|
|
136
132
|
placeholder: "Type or paste a list of dropdown values, so that there's one value per line.",
|
|
137
133
|
max: Number.MAX_SAFE_INTEGER,
|
|
138
134
|
};
|
|
135
|
+
export const WithChips = makeTemplate(['2', '3']).bind({});
|
|
136
|
+
WithChips.args = {
|
|
137
|
+
label: 'Employment Status',
|
|
138
|
+
placeholder: 'Choose an option',
|
|
139
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
140
|
+
};
|
|
141
|
+
export const ErrorState = makeTemplate(['2']).bind({});
|
|
142
|
+
ErrorState.args = {
|
|
143
|
+
label: 'Employment Status',
|
|
144
|
+
placeholder: 'Choose an option',
|
|
145
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
146
|
+
error: 'At least 1 option is required',
|
|
147
|
+
};
|
|
148
|
+
export const WithSelectAll = makeTemplate(['2', '3']).bind({});
|
|
149
|
+
WithSelectAll.args = {
|
|
150
|
+
label: 'Employment Status',
|
|
151
|
+
placeholder: 'Choose an option',
|
|
152
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
153
|
+
showSelectAll: true,
|
|
154
|
+
};
|
|
155
|
+
const allSelectableValues = groupedOpts.filter((o) => !o.isGroupNode).map((o) => o.value);
|
|
156
|
+
export const WithSelectAllAllSelected = makeTemplate(allSelectableValues).bind({});
|
|
157
|
+
WithSelectAllAllSelected.args = {
|
|
158
|
+
label: 'Employment Status',
|
|
159
|
+
placeholder: 'Choose an option',
|
|
160
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
161
|
+
showSelectAll: true,
|
|
162
|
+
};
|
|
163
|
+
export const Disabled = makeTemplate(['2', '3']).bind({});
|
|
164
|
+
Disabled.args = {
|
|
165
|
+
label: 'Employment Status',
|
|
166
|
+
placeholder: 'Choose an option',
|
|
167
|
+
max: Number.MAX_SAFE_INTEGER,
|
|
168
|
+
disabled: true,
|
|
169
|
+
};
|
|
139
170
|
export default setup;
|
|
140
171
|
//# sourceMappingURL=BKJPillDropdown.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BKJPillDropdown.stories.js","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.stories.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,MAAM,KAAK,GAAG;IACZ,KAAK,EAAE,gCAAgC;IACvC,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,IAAI,EAAE,YAAY;SACnB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM;aACb;SACF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;SACf;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,gBAAgB;SACvB;QACD,WAAW,EAAE;YACX,IAAI,EAAE,aAAa;SACpB;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,UAAU;SACjB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,aAAa;SACpB;KACF;CACF,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"BKJPillDropdown.stories.js","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.stories.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,IAAI,MAAM,aAAa,CAAC;AAC/B,OAAO,MAAM,MAAM,eAAe,CAAC;AACnC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,MAAM,KAAK,GAAG;IACZ,KAAK,EAAE,gCAAgC;IACvC,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,IAAI,EAAE,YAAY;SACnB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE;gBACP,IAAI,EAAE,MAAM;aACb;SACF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;SACf;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,gBAAgB;SACvB;QACD,WAAW,EAAE;YACX,IAAI,EAAE,aAAa;SACpB;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,UAAU;SACjB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,aAAa;SACpB;KACF;CACF,CAAC;AAEF,SAAS,iBAAiB,CAAC,IAAc;IACvC,IAAI,IAAI,GAAa,EAAE,CAAC;IACxB,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC;IACxD,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,QAA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BAAmB;IAC1B,WAAW,EAAE,kBAAkB;IAC/B,GAAG,EAAE,MAAM,CAAC,gBAAgB;IAC5B,aAAa,EAAE,IAAI;CAC6B,CAAC;AAEnD,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1D,QAAQ,CAAC,IAAI,GAAG;IACd,KAAK,EAAE,mBAAmB;IAC1B,WAAW,EAAE,kBAAkB;IAC/B,GAAG,EAAE,MAAM,CAAC,gBAAgB;IAC5B,QAAQ,EAAE,IAAI;CACf,CAAC;AAEF,eAAe,KAAK,CAAC"}
|
|
@@ -9,7 +9,7 @@ export declare const RequiredAsterisk: import("styled-components/dist/types").IS
|
|
|
9
9
|
}, "disabled" | "key" | keyof import("react").LabelHTMLAttributes<HTMLLabelElement>> & {
|
|
10
10
|
ref?: import("react").Ref<HTMLLabelElement>;
|
|
11
11
|
}, never>> & string;
|
|
12
|
-
export declare const BKJPillDropdownWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").
|
|
12
|
+
export declare const BKJPillDropdownWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
13
13
|
export declare const TextAreaWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, TextAreaWrapperProps>> & string;
|
|
14
14
|
export declare const BKJPillDropdownComboBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Pick<import("../BKJComboBox/BKJComboBox.types.js").IBKJComboBoxProps<import("../BKJComboBox/BKJComboBox.types.js").IBKJComboBoxOption<string | number, string, string | number>>, "target" | "name" | "value" | "label" | "checked" | "filter" | "cite" | "data" | "form" | "slot" | "span" | "style" | "summary" | "title" | "id" | "selected" | "disabled" | "variant" | "type" | "start" | "hidden" | "color" | "content" | "size" | "default" | "wrap" | "open" | "multiple" | "width" | "css" | "isOpen" | "overrides" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "noValidate" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "useMap" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "leftIconProps" | "rightIconProps" | "labelProps" | "fieldSetProps" | "description" | "isRequired" | "error" | "openBorderLocation" | "useFocusBorder" | "options" | "onIsOpenChange" | "allowedAutoPlacements" | "showFullFocusBorder" | "$dropdownHeight"> & import("react").RefAttributes<HTMLInputElement>, {
|
|
15
15
|
hasValue: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BKJPillDropdown.styled.d.ts","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.styled.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGxF,eAAO,MAAM,UAAU;eAA6B,OAAO;YAE1D,CAAC;AAEF,eAAO,MAAM,YAAY,sOAExB,CAAC;AAEF,eAAO,MAAM,YAAY,wTAYxB,CAAC;AAEF,eAAO,MAAM,gBAAgB;eAtBuB,OAAO;;;mBAwB1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"BKJPillDropdown.styled.d.ts","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.styled.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAGxF,eAAO,MAAM,UAAU;eAA6B,OAAO;YAE1D,CAAC;AAEF,eAAO,MAAM,YAAY,sOAExB,CAAC;AAEF,eAAO,MAAM,YAAY,wTAYxB,CAAC;AAEF,eAAO,MAAM,gBAAgB;eAtBuB,OAAO;;;mBAwB1D,CAAC;AAEF,eAAO,MAAM,sBAAsB,6NAMlC,CAAC;AAEF,eAAO,MAAM,eAAe,yPAyB3B,CAAC;AAQF,eAAO,MAAM,uBAAuB;cACxB,OAAO;qBACA,MAAM;40MAuBxB,CAAC;AAEF,eAAO,MAAM,gBAAgB,6NAK5B,CAAC"}
|
|
@@ -21,7 +21,7 @@ export const InputMessage = styled.label `
|
|
|
21
21
|
export const RequiredAsterisk = styled(InputLabel) `
|
|
22
22
|
${InputRequiredAsteriskCSS}
|
|
23
23
|
`;
|
|
24
|
-
export const BKJPillDropdownWrapper = styled.
|
|
24
|
+
export const BKJPillDropdownWrapper = styled.div `
|
|
25
25
|
${InputWrapperCSS};
|
|
26
26
|
|
|
27
27
|
display: flex;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BKJPillDropdown.styled.js","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.styled.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,YAAY,GACb,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAwB;IAC1D,aAAa;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAA;IACpC,oBAAoB;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAEvC;IACG,eAAe;;IAEf,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE;IAC1B,IAAI,iBAAiB;QACnB,OAAO,GAAG,CAAA;iBACC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,YAAY;OAClD,CAAC;IACJ,OAAO,GAAG,CAAA,EAAE,CAAC;AACf,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,UAAU,CAAC,CAAA;IAC9C,wBAAwB;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"BKJPillDropdown.styled.js","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.styled.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,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CAAC,KAAK;KAC9C;CACJ,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,eAAuB,EAAE,EAAE;IACrD,MAAM,UAAU,GAAG,CAAC,EAAE,CAAC;IACvB,MAAM,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,eAAe,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,OAAO,UAAU,GAAG,MAAM,CAAC;AAC7B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,WAAW,CAAC,CAGxD;IACE,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,EAAE,EAAE,CAClC,QAAQ;IACN,CAAC,CAAC,GAAG,CAAA;;;;0BAIe,kBAAkB,CAAC,eAAe,CAAC;sBACvC,eAAe;;;;;;;;SAQ5B;IACH,CAAC,CAAC,GAAG,CAAA;;;;SAIF;CACR,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;CAKzC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BKJPillDropdown.test.d.ts","sourceRoot":"","sources":["../../../src/components/BKJPillDropdown/BKJPillDropdown.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
class ResizeObserverMock {
|
|
3
|
+
observe() { }
|
|
4
|
+
unobserve() { }
|
|
5
|
+
disconnect() { }
|
|
6
|
+
}
|
|
7
|
+
globalThis.ResizeObserver =
|
|
8
|
+
ResizeObserverMock;
|
|
9
|
+
import { act, render, screen } from '@testing-library/react';
|
|
10
|
+
import userEvent from '@testing-library/user-event';
|
|
11
|
+
import { computeAccessibleName } from 'dom-accessibility-api';
|
|
12
|
+
import { useState } from 'react';
|
|
13
|
+
import { renderAndCheckA11y } from '../../test-utils/index.js';
|
|
14
|
+
import { BKJThemeProvider } from '../../providers/BKJThemeProvider/index.js';
|
|
15
|
+
import { BKJPillDropdown } from './BKJPillDropdown.js';
|
|
16
|
+
const PLAIN_OPTIONS = Array.from({ length: 10 }, (_, i) => ({
|
|
17
|
+
id: String(i + 1),
|
|
18
|
+
value: String(i + 1),
|
|
19
|
+
label: `Item Number #${i + 1}`,
|
|
20
|
+
}));
|
|
21
|
+
const GROUPED_OPTIONS = [
|
|
22
|
+
{ id: '1', label: 'Department A', value: '1', groupId: '0', isGroupNode: true },
|
|
23
|
+
{ id: '2', label: 'Item Number #2', value: '2', groupId: '0' },
|
|
24
|
+
{ id: '3', label: 'Item Number #3', value: '3', groupId: '0' },
|
|
25
|
+
{ id: '4', label: 'Item Number #4', value: '4', groupId: '0' },
|
|
26
|
+
{ id: '5', label: 'Department B', value: '5', groupId: '1', isGroupNode: true },
|
|
27
|
+
{ id: '6', label: 'Item Number #6', value: '6', groupId: '1' },
|
|
28
|
+
{ id: '7', label: 'Item Number #7', value: '7', groupId: '1' },
|
|
29
|
+
{ id: '8', label: 'Item Number #8', value: '8', groupId: '1' },
|
|
30
|
+
{ id: '9', label: 'Department C', value: '9', groupId: '2', isGroupNode: true },
|
|
31
|
+
{ id: '10', label: 'Item Number #10', value: '10', groupId: '2' },
|
|
32
|
+
];
|
|
33
|
+
const ALL_NON_GROUP_VALUES = GROUPED_OPTIONS
|
|
34
|
+
.filter((o) => !o.isGroupNode)
|
|
35
|
+
.map((o) => o.value);
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
document.querySelectorAll('#dropdown-root').forEach((el) => el.remove());
|
|
38
|
+
document.getElementById('a11y-status-message')?.remove();
|
|
39
|
+
});
|
|
40
|
+
function ControlledHarness({ initialValue = [], options = PLAIN_OPTIONS, validations = [], ...rest }) {
|
|
41
|
+
const [value, setValue] = useState(initialValue);
|
|
42
|
+
return (_jsx(BKJPillDropdown, { label: "Departments", max: Number.MAX_SAFE_INTEGER, ...rest, name: "departments", options: options, value: value, onChange: (e) => setValue(e.target.value), validations: validations }));
|
|
43
|
+
}
|
|
44
|
+
function renderHarness(overrides = {}) {
|
|
45
|
+
return render(_jsx(BKJThemeProvider, { children: _jsx(ControlledHarness, { ...overrides }) }));
|
|
46
|
+
}
|
|
47
|
+
async function renderHarnessWithA11y(overrides = {}) {
|
|
48
|
+
return renderAndCheckA11y(_jsx(BKJThemeProvider, { children: _jsx(ControlledHarness, { ...overrides }) }));
|
|
49
|
+
}
|
|
50
|
+
async function openDropdown(user) {
|
|
51
|
+
const input = screen.getByRole('combobox');
|
|
52
|
+
await act(async () => {
|
|
53
|
+
await user.click(input);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
describe('BKJPillDropdown', () => {
|
|
57
|
+
describe('Accessibility (axe) — FR-008', () => {
|
|
58
|
+
it('(a) empty: zero violations with no chips and ungrouped options', async () => {
|
|
59
|
+
const { axeResults } = await renderHarnessWithA11y({ options: PLAIN_OPTIONS });
|
|
60
|
+
expect(axeResults).toHaveNoViolations();
|
|
61
|
+
});
|
|
62
|
+
it('(b) with chips: zero violations with two chipped values and ungrouped options', async () => {
|
|
63
|
+
const { axeResults } = await renderHarnessWithA11y({
|
|
64
|
+
options: PLAIN_OPTIONS,
|
|
65
|
+
initialValue: ['2', '3'],
|
|
66
|
+
});
|
|
67
|
+
expect(axeResults).toHaveNoViolations();
|
|
68
|
+
});
|
|
69
|
+
it('(c) grouped + showSelectAll not-all-selected: zero violations', async () => {
|
|
70
|
+
const { axeResults } = await renderHarnessWithA11y({
|
|
71
|
+
options: GROUPED_OPTIONS,
|
|
72
|
+
initialValue: ['2', '3'],
|
|
73
|
+
showSelectAll: true,
|
|
74
|
+
});
|
|
75
|
+
expect(axeResults).toHaveNoViolations();
|
|
76
|
+
});
|
|
77
|
+
it('(d) grouped + showSelectAll all-selected: zero violations', async () => {
|
|
78
|
+
const { axeResults } = await renderHarnessWithA11y({
|
|
79
|
+
options: GROUPED_OPTIONS,
|
|
80
|
+
initialValue: ALL_NON_GROUP_VALUES,
|
|
81
|
+
showSelectAll: true,
|
|
82
|
+
});
|
|
83
|
+
expect(axeResults).toHaveNoViolations();
|
|
84
|
+
});
|
|
85
|
+
it('(e) error: zero violations', async () => {
|
|
86
|
+
const { axeResults } = await renderHarnessWithA11y({
|
|
87
|
+
options: GROUPED_OPTIONS,
|
|
88
|
+
initialValue: ['2'],
|
|
89
|
+
error: 'At least 1 option is required',
|
|
90
|
+
});
|
|
91
|
+
expect(axeResults).toHaveNoViolations();
|
|
92
|
+
});
|
|
93
|
+
it('(f) disabled: zero violations', async () => {
|
|
94
|
+
const { axeResults } = await renderHarnessWithA11y({
|
|
95
|
+
options: GROUPED_OPTIONS,
|
|
96
|
+
initialValue: ['2', '3'],
|
|
97
|
+
disabled: true,
|
|
98
|
+
});
|
|
99
|
+
expect(axeResults).toHaveNoViolations();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
// role="group" wrappers around grouped options were considered (Jira AC and FR-004)
|
|
103
|
+
// but are NOT strictly required by WCAG 2.1 Level A — 1.3.1 is interpretive and most
|
|
104
|
+
// audits don't fail a listbox for missing role="group" as long as options carry
|
|
105
|
+
// role="option" with aria-selected and descriptive labels. Dropping the wrapper
|
|
106
|
+
// keeps the shared BKJComboBox rendering pipeline untouched. Visual grouping via
|
|
107
|
+
// the existing paddingLeft: '42px' indent and the group node options' labels
|
|
108
|
+
// (e.g., "Department A") preserves the perceivable grouping for both sighted and
|
|
109
|
+
// AT users.
|
|
110
|
+
describe('Select All — FR-006 / FR-009 (b)', () => {
|
|
111
|
+
it('(b) accessible name includes the count of selectable non-group-node options', async () => {
|
|
112
|
+
const user = userEvent.setup();
|
|
113
|
+
renderHarness({ options: GROUPED_OPTIONS, showSelectAll: true });
|
|
114
|
+
await openDropdown(user);
|
|
115
|
+
const selectAllOption = screen.getByRole('option', { name: /7 items/ });
|
|
116
|
+
expect(computeAccessibleName(selectAllOption)).toContain('7 items');
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
// Group node and Select All `aria-selected` accuracy intentionally use the default
|
|
120
|
+
// BKJComboBox rule (`value.includes(props.value)`) — not a derived "all children
|
|
121
|
+
// selected" computation. Rationale: keeping shared BKJComboBox files untouched is
|
|
122
|
+
// worth more than perfect aria-selected on the convenience-toggle controls (group
|
|
123
|
+
// nodes are a grouping affordance, not values; Select All's interactive flow already
|
|
124
|
+
// maintains the marker correctly via existing handlers). Leaf-option aria-selected
|
|
125
|
+
// is what users navigate by, and that already works through the default rule.
|
|
126
|
+
describe('Chip remove button — FR-001 / FR-009 (d)', () => {
|
|
127
|
+
it('every chip has a focusable button with accessible name "Remove {value}"', () => {
|
|
128
|
+
renderHarness({ options: GROUPED_OPTIONS, initialValue: ['2', '3'] });
|
|
129
|
+
const removeButtons = screen.getAllByRole('button', { name: /^Remove Item Number #/ });
|
|
130
|
+
expect(removeButtons).toHaveLength(2);
|
|
131
|
+
expect(computeAccessibleName(removeButtons[0])).toBe('Remove Item Number #2');
|
|
132
|
+
expect(computeAccessibleName(removeButtons[1])).toBe('Remove Item Number #3');
|
|
133
|
+
expect(removeButtons[0].tagName).toBe('BUTTON');
|
|
134
|
+
});
|
|
135
|
+
it('Enter on a chip remove button removes the chip', async () => {
|
|
136
|
+
const user = userEvent.setup();
|
|
137
|
+
renderHarness({ options: GROUPED_OPTIONS, initialValue: ['2', '3'] });
|
|
138
|
+
const removeBtn = screen.getByRole('button', { name: 'Remove Item Number #2' });
|
|
139
|
+
removeBtn.focus();
|
|
140
|
+
await act(async () => {
|
|
141
|
+
await user.keyboard('{Enter}');
|
|
142
|
+
});
|
|
143
|
+
expect(screen.queryByRole('button', { name: 'Remove Item Number #2' })).not.toBeInTheDocument();
|
|
144
|
+
});
|
|
145
|
+
it('Space on a chip remove button removes the chip', async () => {
|
|
146
|
+
const user = userEvent.setup();
|
|
147
|
+
renderHarness({ options: GROUPED_OPTIONS, initialValue: ['2', '3'] });
|
|
148
|
+
const removeBtn = screen.getByRole('button', { name: 'Remove Item Number #2' });
|
|
149
|
+
removeBtn.focus();
|
|
150
|
+
await act(async () => {
|
|
151
|
+
await user.keyboard(' ');
|
|
152
|
+
});
|
|
153
|
+
expect(screen.queryByRole('button', { name: 'Remove Item Number #2' })).not.toBeInTheDocument();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
describe('Focus management after chip removal — FR-002a / FR-009 (f)', () => {
|
|
157
|
+
it('focus lands on combobox input after Enter activation of a chip remove button', async () => {
|
|
158
|
+
const user = userEvent.setup();
|
|
159
|
+
renderHarness({ options: GROUPED_OPTIONS, initialValue: ['2', '3'] });
|
|
160
|
+
const removeBtn = screen.getByRole('button', { name: 'Remove Item Number #2' });
|
|
161
|
+
removeBtn.focus();
|
|
162
|
+
await act(async () => {
|
|
163
|
+
await user.keyboard('{Enter}');
|
|
164
|
+
});
|
|
165
|
+
expect(document.activeElement).toBe(screen.getByRole('combobox'));
|
|
166
|
+
});
|
|
167
|
+
it('focus lands on combobox input after removing the only chip', async () => {
|
|
168
|
+
const user = userEvent.setup();
|
|
169
|
+
renderHarness({ options: GROUPED_OPTIONS, initialValue: ['2'] });
|
|
170
|
+
const removeBtn = screen.getByRole('button', { name: 'Remove Item Number #2' });
|
|
171
|
+
removeBtn.focus();
|
|
172
|
+
await act(async () => {
|
|
173
|
+
await user.keyboard('{Enter}');
|
|
174
|
+
});
|
|
175
|
+
expect(document.activeElement).toBe(screen.getByRole('combobox'));
|
|
176
|
+
});
|
|
177
|
+
});
|
|
178
|
+
describe('Wrapper-click does not remove chips — FR-009 (g) / SC-006', () => {
|
|
179
|
+
it('clicking on the wrapper background does NOT activate any chip remove button', async () => {
|
|
180
|
+
const user = userEvent.setup();
|
|
181
|
+
const { container } = renderHarness({
|
|
182
|
+
options: GROUPED_OPTIONS,
|
|
183
|
+
initialValue: ['2', '3'],
|
|
184
|
+
});
|
|
185
|
+
const wrapper = container.firstChild;
|
|
186
|
+
expect(wrapper.tagName).toBe('DIV');
|
|
187
|
+
await act(async () => {
|
|
188
|
+
await user.click(wrapper);
|
|
189
|
+
});
|
|
190
|
+
// Both chips still rendered (no accidental implicit-label-wrap activation)
|
|
191
|
+
expect(screen.getByRole('button', { name: 'Remove Item Number #2' })).toBeInTheDocument();
|
|
192
|
+
expect(screen.getByRole('button', { name: 'Remove Item Number #3' })).toBeInTheDocument();
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
describe('Disabled state — FR-001 (Q4) / FR-009 (h) / SC-008', () => {
|
|
196
|
+
it('no focusable chip remove button is rendered when disabled={true}', () => {
|
|
197
|
+
renderHarness({
|
|
198
|
+
options: GROUPED_OPTIONS,
|
|
199
|
+
initialValue: ['2', '3'],
|
|
200
|
+
disabled: true,
|
|
201
|
+
});
|
|
202
|
+
const removeButtons = screen.queryAllByRole('button', { name: /^Remove Item Number #/ });
|
|
203
|
+
expect(removeButtons).toHaveLength(0);
|
|
204
|
+
});
|
|
205
|
+
it('tabbing through a form does not focus any chip remove button when disabled', async () => {
|
|
206
|
+
const user = userEvent.setup();
|
|
207
|
+
render(_jsxs(BKJThemeProvider, { children: [_jsx("input", { "data-testid": "before" }), _jsx(ControlledHarness, { options: GROUPED_OPTIONS, initialValue: ['2', '3'], disabled: true }), _jsx("input", { "data-testid": "after" })] }));
|
|
208
|
+
const before = screen.getByTestId('before');
|
|
209
|
+
before.focus();
|
|
210
|
+
// Walk forward via Tab through every focusable target downstream of `before`.
|
|
211
|
+
// Assert that none of them are chip remove buttons (those should be unrendered
|
|
212
|
+
// when disabled per FR-001 / Clarifications Q4). The combobox input itself
|
|
213
|
+
// remains focusable — that is preserved existing UX and out of bare-minimum
|
|
214
|
+
// scope per the project's "no UX behaviour changes" rule for AODA Phase 1.
|
|
215
|
+
const seen = new Set();
|
|
216
|
+
for (let i = 0; i < 10; i += 1) {
|
|
217
|
+
await act(async () => { await user.tab(); });
|
|
218
|
+
const active = document.activeElement;
|
|
219
|
+
if (!active || seen.has(active))
|
|
220
|
+
break;
|
|
221
|
+
seen.add(active);
|
|
222
|
+
// No chip remove button has accessible name starting with "Remove Item"
|
|
223
|
+
const accName = (active.getAttribute('aria-label') || active.textContent || '').trim();
|
|
224
|
+
expect(accName).not.toMatch(/^Remove Item Number #/);
|
|
225
|
+
if (active === screen.getByTestId('after'))
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
//# sourceMappingURL=BKJPillDropdown.test.js.map
|