Skip to content

Commit 689ef1f

Browse files
Merge release/1.34.1 into main branch (#728)
* Add label for Pill close button (#722) * remove prop spread on Accordion and ToggleInput, expose additional props as needed (#724) * update custom select Option to allow for indeterminate state on CheckboxButton (#727) * Prepare release 1.34.1
1 parent 52fb483 commit 689ef1f

File tree

10 files changed

+211
-18
lines changed

10 files changed

+211
-18
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@user-interviews/ui-design-system",
3-
"version": "1.34.0",
3+
"version": "1.34.1",
44
"dependencies": {
55
"react-bootstrap": "^2.0.2",
66
"react-router-dom": "^5.2.0",

spec/__snapshots__/Storyshots.test.js.snap

Lines changed: 98 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8025,6 +8025,7 @@ exports[`Storyshots Components/Pill With Close 1`] = `
80258025
>
80268026
Text
80278027
<button
8028+
aria-label="Remove undefined"
80288029
className="Pill__button--close"
80298030
onClick={[Function]}
80308031
type="button"
@@ -9030,6 +9031,99 @@ exports[`Storyshots Components/Selects/Single Custom Option With Checkbox 1`] =
90309031
</div>
90319032
`;
90329033

9034+
exports[`Storyshots Components/Selects/Single Custom Option With Indeterminate Checkbox 1`] = `
9035+
<div
9036+
style={
9037+
Object {
9038+
"padding": "1rem",
9039+
}
9040+
}
9041+
>
9042+
<label
9043+
htmlFor="multi-select"
9044+
id="select-label-custom-option-indeterminate"
9045+
>
9046+
Custom option with indeterminate checkbox
9047+
</label>
9048+
<div
9049+
className="SingleSelect css-b62m3t-container"
9050+
id="multi-select"
9051+
onKeyDown={[Function]}
9052+
>
9053+
<span
9054+
className="css-1f43avz-a11yText-A11yText"
9055+
id="react-select-13-live-region"
9056+
/>
9057+
<span
9058+
aria-atomic="false"
9059+
aria-live="polite"
9060+
aria-relevant="additions text"
9061+
className="css-1f43avz-a11yText-A11yText"
9062+
/>
9063+
<div
9064+
className=" css-15ub2n0-control"
9065+
onMouseDown={[Function]}
9066+
onTouchEnd={[Function]}
9067+
>
9068+
<div
9069+
className=" css-319lph-ValueContainer"
9070+
>
9071+
<div
9072+
className=" css-858797-placeholder"
9073+
id="react-select-13-placeholder"
9074+
>
9075+
Select...
9076+
</div>
9077+
<input
9078+
aria-autocomplete="list"
9079+
aria-describedby="react-select-13-placeholder"
9080+
aria-expanded={false}
9081+
aria-haspopup={true}
9082+
aria-labelledby="select-label"
9083+
aria-readonly={true}
9084+
className="css-mohuvp-dummyInput-DummyInput"
9085+
disabled={false}
9086+
id="react-select-13-input"
9087+
inputMode="none"
9088+
onBlur={[Function]}
9089+
onChange={[Function]}
9090+
onFocus={[Function]}
9091+
role="combobox"
9092+
tabIndex={0}
9093+
value=""
9094+
/>
9095+
</div>
9096+
<div
9097+
className=" css-1hb7zxy-IndicatorsContainer"
9098+
>
9099+
<span
9100+
className=" css-43ykx9-indicatorSeparator"
9101+
/>
9102+
<div
9103+
aria-hidden="true"
9104+
className=" css-7sl878-indicatorContainer"
9105+
onMouseDown={[Function]}
9106+
onTouchEnd={[Function]}
9107+
>
9108+
<svg
9109+
aria-hidden="true"
9110+
className="css-tj5bde-Svg"
9111+
focusable="false"
9112+
height={20}
9113+
viewBox="0 0 20 20"
9114+
width={20}
9115+
>
9116+
<path
9117+
d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"
9118+
/>
9119+
</svg>
9120+
</div>
9121+
</div>
9122+
</div>
9123+
</div>
9124+
</div>
9125+
`;
9126+
90339127
exports[`Storyshots Components/Selects/Single Custom Value Container 1`] = `
90349128
<div
90359129
style={
@@ -9051,7 +9145,7 @@ exports[`Storyshots Components/Selects/Single Custom Value Container 1`] = `
90519145
>
90529146
<span
90539147
className="css-1f43avz-a11yText-A11yText"
9054-
id="react-select-13-live-region"
9148+
id="react-select-14-live-region"
90559149
/>
90569150
<span
90579151
aria-atomic="false"
@@ -9069,20 +9163,20 @@ exports[`Storyshots Components/Selects/Single Custom Value Container 1`] = `
90699163
>
90709164
<div
90719165
className=" css-858797-placeholder"
9072-
id="react-select-13-placeholder"
9166+
id="react-select-14-placeholder"
90739167
>
90749168
Select...
90759169
</div>
90769170
<input
90779171
aria-autocomplete="list"
9078-
aria-describedby="react-select-13-placeholder"
9172+
aria-describedby="react-select-14-placeholder"
90799173
aria-expanded={false}
90809174
aria-haspopup={true}
90819175
aria-labelledby="select-label"
90829176
aria-readonly={true}
90839177
className="css-mohuvp-dummyInput-DummyInput"
90849178
disabled={false}
9085-
id="react-select-13-input"
9179+
id="react-select-14-input"
90869180
inputMode="none"
90879181
onBlur={[Function]}
90889182
onChange={[Function]}

src/Accordion/Accordion.jsx

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,65 @@ import PropTypes from 'prop-types';
55
import RBAccordion from 'react-bootstrap/Accordion';
66

77
const Accordion = ({
8+
activeKey,
9+
alwaysOpen,
10+
as,
11+
defaultActiveKey,
812
children,
13+
flush,
14+
onSelect,
915
// eslint-disable-next-line camelcase
1016
UNSAFE_className,
11-
...props
1217
}) => (
1318
<RBAccordion
19+
activeKey={activeKey}
20+
alwaysOpen={alwaysOpen}
21+
as={as}
1422
className={classNames(UNSAFE_className, 'Accordion')}
15-
{...props}
23+
defaultActiveKey={defaultActiveKey}
24+
flush={flush}
25+
onSelect={onSelect}
1626
>
1727
{ children }
1828
</RBAccordion>
1929
);
2030

2131
Accordion.propTypes = {
32+
/**
33+
The current active key that corresponds to the currently expanded accordion
34+
*/
35+
activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
36+
/**
37+
Allow accordion items to stay open when another item is opened
38+
*/
39+
alwaysOpen: PropTypes.bool,
40+
/**
41+
Sets a custom element for this component
42+
*/
43+
as: PropTypes.elementType,
44+
/**
45+
The default active key that is expanded on start
46+
*/
47+
defaultActiveKey: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
48+
/**
49+
Renders accordion edge-to-edge with its parent container
50+
*/
51+
flush: PropTypes.bool,
2252
UNSAFE_className: PropTypes.string,
53+
/**
54+
Callback fired when the active item changes
55+
*/
56+
onSelect: PropTypes.func,
2357
};
2458

2559
Accordion.defaultProps = {
60+
activeKey: undefined,
61+
alwaysOpen: undefined,
62+
as: undefined,
63+
defaultActiveKey: undefined,
64+
flush: undefined,
2665
UNSAFE_className: undefined,
66+
onSelect: undefined,
2767
};
2868

2969
export default Accordion;

src/Accordion/AccordionItem.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,38 @@ import RBAccordionItem from 'react-bootstrap/AccordionItem';
77
import './AccordionItem.scss';
88

99
const AccordionItem = ({
10+
as,
1011
borderless,
1112
children,
1213
// eslint-disable-next-line camelcase
1314
UNSAFE_className,
14-
...props
1515
}) => (
1616
<RBAccordionItem
17+
as={as}
1718
className={classNames(
1819
UNSAFE_className,
1920
'AccordionItem',
2021
borderless && 'AccordionItem--borderless',
2122
)}
22-
{...props}
2323
>
2424
{ children }
2525
</RBAccordionItem>
2626
);
2727

2828
AccordionItem.propTypes = {
29+
/**
30+
Sets a custom element for this component
31+
*/
32+
as: PropTypes.elementType,
33+
/**
34+
Removes border from accordion item
35+
*/
2936
borderless: PropTypes.bool,
3037
UNSAFE_className: PropTypes.string,
3138
};
3239

3340
AccordionItem.defaultProps = {
41+
as: undefined,
3442
borderless: undefined,
3543
UNSAFE_className: undefined,
3644
};

src/Accordion/AccordionToggle.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const AccordionToggle = ({
2121
title,
2222
// eslint-disable-next-line camelcase
2323
UNSAFE_className,
24-
...props
2524
}) => {
2625
const { activeEventKey } = React.useContext(AccordionContext);
2726

@@ -61,7 +60,6 @@ const AccordionToggle = ({
6160
disabled={disabled}
6261
type="button"
6362
onClick={decoratedOnClick}
64-
{...props}
6563
>
6664
<div className="AccordionToggle__container">
6765
<div className="AccordionToggle__container--content">

src/Pill/Pill.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ const Pill = ({
3737
{ children }
3838
{ text }
3939
{ onClose && (
40-
<button className="Pill__button--close" type="button" onClick={() => onClose(id)}>
40+
<button
41+
aria-label={`Remove ${text}`}
42+
className="Pill__button--close"
43+
type="button"
44+
onClick={() => onClose(id)}
45+
>
4146
<FontAwesomeIcon icon={faTimes} />
4247
</button>
4348
)}

src/Select/Option.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { forwardRef } from 'react';
22
import { components } from 'react-select';
33

44
import CheckboxButton from 'src/CheckboxButton';
@@ -13,18 +13,20 @@ import './Option.scss';
1313
// See: https://react-select.com/components#replaceable-components
1414

1515
/* eslint-disable react/prop-types */
16-
const Option = ({ ...props }) => (
16+
const Option = forwardRef(({ indeterminate, ...props }, ref) => (
1717
<components.Option {...props}>
1818
<div className="Option">
1919
<label>{props.label}</label>
2020
<CheckboxButton
2121
checked={props.isSelected}
2222
id={props.label}
23+
indeterminate={indeterminate}
24+
ref={ref}
2325
onChange={() => null}
2426
/>
2527
</div>
2628
</components.Option>
27-
);
29+
));
2830
/* eslint-enable react/prop-types */
2931

3032
export default Option;

src/Select/SingleSelect.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ A base select input. Flexible and comes with multiselect, clearable, searchable,
5353
<Story id="components-selects-single--custom-option-with-checkbox" />
5454
</Preview>
5555

56+
### Custom Option With Indeterminate Checkbox
57+
58+
<Preview>
59+
<Story id="components-selects-single--custom-option-with-indeterminate-checkbox" />
60+
</Preview>
61+
5662
### Custom Value Container
5763

5864
<Preview>

src/Select/SingleSelect.stories.jsx

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Fragment } from 'react';
1+
import React, { Fragment, useRef } from 'react';
22
import { action } from '@storybook/addon-actions';
33

44
import {
@@ -117,6 +117,48 @@ export const CustomOptionWithCheckbox = () => (
117117
</Fragment>
118118
);
119119

120+
export const CustomOptionWithIndeterminateCheckbox = () => {
121+
const optionsArr = [
122+
{ label: 'Riley Researcher', value: 1 },
123+
{ label: 'Patty Participant', value: 2 },
124+
{ label: 'Patrick Participant (indeterminate)', value: 3 },
125+
{ label: 'Polly Participant (indeterminate)', value: 4 },
126+
];
127+
128+
let inputRef;
129+
130+
const createInputRef = () => {
131+
// eslint-disable-next-line react-hooks/rules-of-hooks
132+
inputRef = useRef();
133+
return inputRef;
134+
};
135+
136+
return (
137+
<Fragment>
138+
<label htmlFor="multi-select" id="select-label-custom-option-indeterminate">Custom option with indeterminate checkbox</label>
139+
<SingleSelect
140+
aria-labelledby="select-label"
141+
closeMenuOnSelect={false}
142+
components={{
143+
Option: (props) => (
144+
<Option
145+
{...props}
146+
// eslint-disable-next-line react/prop-types
147+
indeterminate={props.value > 2}
148+
ref={createInputRef()}
149+
/>
150+
),
151+
}}
152+
hideSelectedOptions={false}
153+
id="multi-select"
154+
isMulti
155+
options={optionsArr}
156+
onChange={onChange}
157+
/>
158+
</Fragment>
159+
);
160+
};
161+
120162
export const CustomValueContainer = () => (
121163
<Fragment>
122164
<label htmlFor="custom-value-container-select" id="select-label-custom-value-container">

0 commit comments

Comments
 (0)