@mackin.com/styleguide 11.0.6 → 11.0.7
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/index.d.ts +13 -10
- package/index.esm.js +74 -38
- package/index.js +75 -39
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import React__default, { ReactNode } from 'react';
|
|
|
4
4
|
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
5
5
|
|
|
6
6
|
type HeaderVariant = 'label' | 'link' | 'primary' | 'secondary' | 'omg' | 'primary2' | 'positive' | 'negative';
|
|
7
|
-
interface
|
|
7
|
+
interface AccordionProps {
|
|
8
8
|
/** Required for ARIA. */
|
|
9
9
|
id: string;
|
|
10
10
|
header: JSX.Element | string;
|
|
@@ -12,24 +12,25 @@ interface AccordianProps {
|
|
|
12
12
|
variant?: HeaderVariant;
|
|
13
13
|
/** Defaults to 'true'. */
|
|
14
14
|
block?: boolean;
|
|
15
|
-
|
|
15
|
+
/** Applied to the outer wrapping `DIV`. */
|
|
16
|
+
wrapperClassName?: string;
|
|
17
|
+
/** Applied to the expand/collapse header button. */
|
|
18
|
+
headerButtonClassName?: string;
|
|
16
19
|
/** If true, padding will not be added to the expanded content */
|
|
17
20
|
noPad?: boolean;
|
|
18
|
-
/** The initial state of the
|
|
19
|
-
* Use with onChange to control the state from outside the
|
|
21
|
+
/** The initial state of the Accordion. Defaults to 'false'.
|
|
22
|
+
* Use with onChange to control the state from outside the Accordion.
|
|
20
23
|
*/
|
|
21
24
|
open?: boolean;
|
|
22
25
|
disabled?: boolean;
|
|
23
|
-
/** Defaults to 1020px. */
|
|
24
|
-
maxHeight?: string | undefined;
|
|
25
26
|
/** Defaults to 250ms. */
|
|
26
27
|
expandTimeMs?: number;
|
|
27
28
|
/** Defaults to 'ease-in-out'. */
|
|
28
29
|
transitionTimingFunction?: string;
|
|
29
30
|
onChange?: (open: boolean) => void;
|
|
30
31
|
}
|
|
31
|
-
declare const
|
|
32
|
-
declare const
|
|
32
|
+
declare const Accordion: (props: AccordionProps) => React.JSX.Element;
|
|
33
|
+
declare const useAccordionState: (count: number, openIndex?: number) => [boolean[], (index: number, open: boolean) => void];
|
|
33
34
|
|
|
34
35
|
interface InputOnFocusProps {
|
|
35
36
|
/** If true, the component will respond to outside changes even if the control has focus. Default is false. */
|
|
@@ -445,6 +446,8 @@ declare const Nav: (props: {
|
|
|
445
446
|
slideMs?: number;
|
|
446
447
|
/** Defaults to `theme.layout.navWidth`. */
|
|
447
448
|
navWidth?: string;
|
|
449
|
+
/** The DOM ID of the element to focus when the nav closes. */
|
|
450
|
+
onCloseFocusId?: string;
|
|
448
451
|
__debug?: boolean;
|
|
449
452
|
}) => React.JSX.Element;
|
|
450
453
|
|
|
@@ -1229,10 +1232,10 @@ declare const LocalizationProvider: (p: {
|
|
|
1229
1232
|
declare function useAriaLiveRegion(): {
|
|
1230
1233
|
/**
|
|
1231
1234
|
* @param message - The text to be read by the screen reader.
|
|
1232
|
-
* @param clearTimeoutMs - Milliseconds to wait before the message is cleared. Defaults to `2000
|
|
1235
|
+
* @param clearTimeoutMs - Milliseconds to wait before the message is cleared. Defaults to `2000`.
|
|
1233
1236
|
*/
|
|
1234
1237
|
notify: (message: string, clearTimoutMs?: number) => void;
|
|
1235
1238
|
clearNotification: () => void;
|
|
1236
1239
|
};
|
|
1237
1240
|
|
|
1238
|
-
export {
|
|
1241
|
+
export { Accordion, type AccordionProps, type Alignment, Autocomplete, AutocompleteController, AutocompleteEntityController, type AutocompleteProps, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, type ButtonProps, Calendar, type CalendarProps, Checkbox, type CheckboxProps, ConfirmModal, type ConfirmModalProps, CopyButton, DateInput, type DateInputProps, DialogPopover, type DialogPopoverProps, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, type FormProps, GlobalStyles, Header, Highlight, ICONS, Icon, Image, type ImageProps, InfoPanel, InfoTip, type InfoTipProps, ItemPager, Label, type LabelProps, Link, type LinkProps, List, ListItem, type ListItemProps, type ListProps, LocalizationProvider, type MackinTheme, Modal, type ModalProps, Nav, NormalizeCss, NumberInput, type NumberInputProps, OmniLink, type OmniLinkProps, PagedResult, type PagedResultDto, Pager, type PagerProps, Picker, type PickerOption, type PickerProps, type PickerValue, ProgressBar, type ProgressBarProps, SearchBox, type SearchBoxProps, Slider, type SliderProps, type SliderValue, StyleGuideLanguage, TabContainer, type TabContainerProps, TabHeader, type TabHeaderProps, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextArea, type TextAreaProps, TextInput, type TextInputProps, type TextProps, Th, ThSort, ThemeProvider, ThemeRenderer, ToggleButton, ToggleButtonGroup, type ToggleButtonGroupProps, type ToggleButtonProps, TogglePasswordInput, TooltipPopover, type TooltipPopoverProps, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, enumToEntities, getCurrencyDisplay, getFileSizeDisplay, modalScrollFixClassName, useAccordionState, useAriaLiveRegion, useBooleanChanged, useIgnoreMount, useMediaQuery, useScrollbarSize, useThemeSafely, useWaiting };
|
package/index.esm.js
CHANGED
|
@@ -497,53 +497,75 @@ const Button = React.forwardRef((props, ref) => {
|
|
|
497
497
|
return content;
|
|
498
498
|
});
|
|
499
499
|
|
|
500
|
-
const
|
|
501
|
-
const
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
const visibleStyle = css({
|
|
506
|
-
overflow: 'visible !important'
|
|
507
|
-
});
|
|
508
|
-
const Accordian = (props) => {
|
|
509
|
-
var _a, _b, _c, _d;
|
|
500
|
+
const defaultExpandTimeMs = 250;
|
|
501
|
+
const timingFunction = 'ease-in-out';
|
|
502
|
+
const Accordion = (props) => {
|
|
503
|
+
var _a, _b, _c;
|
|
504
|
+
const ignoreTransitionCount = React.useRef(props.open === true ? 2 : 0);
|
|
510
505
|
const [open, setOpen] = React.useState(false);
|
|
511
506
|
const theme = useThemeSafely();
|
|
512
507
|
const content = React.useRef(null);
|
|
513
|
-
const
|
|
508
|
+
const expandTimeMs = (_a = props.expandTimeMs) !== null && _a !== void 0 ? _a : defaultExpandTimeMs;
|
|
514
509
|
const contentStyles = css({
|
|
510
|
+
label: 'AccordionContent',
|
|
511
|
+
height: 0,
|
|
515
512
|
overflow: 'hidden',
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
});
|
|
519
|
-
const expandedContentStyles = css({
|
|
520
|
-
maxHeight: (_c = props.maxHeight) !== null && _c !== void 0 ? _c : accordianMaxHeight
|
|
513
|
+
transition: `height ${expandTimeMs}ms ${(_b = props.transitionTimingFunction) !== null && _b !== void 0 ? _b : timingFunction}`,
|
|
514
|
+
visibility: 'hidden',
|
|
521
515
|
});
|
|
522
516
|
const expandedContentWrapperStyles = !props.noPad ? css({
|
|
517
|
+
label: 'AccordionWrapper',
|
|
523
518
|
padding: '0 1rem 1rem 1rem'
|
|
524
519
|
}) : undefined;
|
|
520
|
+
function forceBrowserReflow() {
|
|
521
|
+
var _a;
|
|
522
|
+
// accessing this prop will cause browser to reflow and allow for calculations
|
|
523
|
+
(_a = content.current) === null || _a === void 0 ? void 0 : _a.offsetHeight;
|
|
524
|
+
}
|
|
525
525
|
React.useEffect(() => {
|
|
526
526
|
const currentContent = content.current;
|
|
527
527
|
if (currentContent) {
|
|
528
528
|
if (open) {
|
|
529
|
-
|
|
530
|
-
currentContent.
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
529
|
+
currentContent.style.visibility = 'visible';
|
|
530
|
+
currentContent.style.height = '0px';
|
|
531
|
+
forceBrowserReflow();
|
|
532
|
+
if (ignoreTransitionCount.current) {
|
|
533
|
+
// set the height to a auto so content changes will causes re-size
|
|
534
|
+
currentContent.style.height = 'auto';
|
|
535
|
+
ignoreTransitionCount.current -= 1;
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
// set the height so the CSS transitions take over
|
|
539
|
+
currentContent.style.height = `${currentContent.scrollHeight}px`;
|
|
540
|
+
setTimeout(() => {
|
|
541
|
+
// set the height to a auto so content changes will causes re-size
|
|
542
|
+
currentContent.style.height = 'auto';
|
|
543
|
+
}, expandTimeMs + 1);
|
|
544
|
+
}
|
|
534
545
|
}
|
|
535
546
|
else {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
547
|
+
// set the height back from 'auto' above.
|
|
548
|
+
currentContent.style.height = `${currentContent.scrollHeight}px`;
|
|
549
|
+
forceBrowserReflow();
|
|
550
|
+
// set the height so the CSS transitions take over
|
|
551
|
+
currentContent.style.height = '0px';
|
|
552
|
+
if (ignoreTransitionCount.current) {
|
|
553
|
+
// undo the style so the root class takes back over ('hidden')
|
|
554
|
+
currentContent.style.visibility = '';
|
|
555
|
+
ignoreTransitionCount.current -= 1;
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
setTimeout(() => {
|
|
559
|
+
// undo the style so the root class takes back over ('hidden')
|
|
560
|
+
currentContent.style.visibility = '';
|
|
561
|
+
}, expandTimeMs + 1);
|
|
541
562
|
}
|
|
542
563
|
}
|
|
543
564
|
}
|
|
544
565
|
}, [open]);
|
|
545
566
|
React.useEffect(() => {
|
|
546
567
|
var _a;
|
|
568
|
+
console.warn('props.open', 'changed', props.open);
|
|
547
569
|
if (props.open === undefined) {
|
|
548
570
|
// technically, we only need to use this effect if props.open was initialized with a boolean.
|
|
549
571
|
// you can't have conditional effects so here we go...
|
|
@@ -552,22 +574,24 @@ const Accordian = (props) => {
|
|
|
552
574
|
setOpen((_a = props.open) !== null && _a !== void 0 ? _a : false);
|
|
553
575
|
}, [props.open]);
|
|
554
576
|
const expandedPanelId = `${props.id}_expanded`;
|
|
555
|
-
|
|
577
|
+
const buttonId = `${props.id}_button`;
|
|
578
|
+
return (React.createElement("div", { id: props.id, className: props.wrapperClassName },
|
|
556
579
|
React.createElement("h3", { className: css({
|
|
557
580
|
// required for ARIA
|
|
558
581
|
margin: 0,
|
|
559
582
|
padding: 0,
|
|
560
583
|
fontSize: 'inherit'
|
|
561
584
|
}) },
|
|
562
|
-
React.createElement(Button, { "aria-controls": expandedPanelId, "aria-expanded": open, "aria-disabled": props.disabled, readOnly: props.disabled, variant: props.variant, className: cx(css({
|
|
585
|
+
React.createElement(Button, { id: buttonId, "aria-controls": expandedPanelId, "aria-expanded": open, "aria-disabled": props.disabled, readOnly: props.disabled, variant: props.variant, className: cx(css({
|
|
563
586
|
display: 'flex',
|
|
564
587
|
alignItems: 'center',
|
|
565
588
|
justifyContent: 'space-between',
|
|
566
589
|
height: 'auto',
|
|
567
590
|
minHeight: theme.controls.height,
|
|
568
|
-
width: ((
|
|
569
|
-
}, props.
|
|
591
|
+
width: ((_c = props.block) !== null && _c !== void 0 ? _c : true) ? '100%' : 'auto'
|
|
592
|
+
}, props.headerButtonClassName)), onClick: e => {
|
|
570
593
|
e.stopPropagation();
|
|
594
|
+
console.warn('click');
|
|
571
595
|
if (props.onChange) {
|
|
572
596
|
props.onChange(!open);
|
|
573
597
|
}
|
|
@@ -576,10 +600,10 @@ const Accordian = (props) => {
|
|
|
576
600
|
}
|
|
577
601
|
}, rightIcon: !props.disabled ? React.createElement(Icon, { id: open ? 'collapse' : 'expand' }) : undefined },
|
|
578
602
|
React.createElement("span", null, props.header))),
|
|
579
|
-
React.createElement("div", { ref: content, className:
|
|
580
|
-
React.createElement("div", { className: expandedContentWrapperStyles, id: expandedPanelId }, children))));
|
|
603
|
+
React.createElement("div", { ref: content, className: contentStyles },
|
|
604
|
+
React.createElement("div", { className: expandedContentWrapperStyles, id: expandedPanelId, hidden: !open, role: "region", "aria-labelledby": buttonId }, props.children))));
|
|
581
605
|
};
|
|
582
|
-
const
|
|
606
|
+
const useAccordionState = (count, openIndex) => {
|
|
583
607
|
const [panels, setShowPanel] = React.useState(new Array(count).fill(false).map((b, i) => {
|
|
584
608
|
return i === openIndex;
|
|
585
609
|
}));
|
|
@@ -1123,8 +1147,13 @@ const Autocomplete = (p) => {
|
|
|
1123
1147
|
break;
|
|
1124
1148
|
}
|
|
1125
1149
|
case 'Tab': {
|
|
1126
|
-
|
|
1127
|
-
|
|
1150
|
+
// if there are options showing - and whether or not you picked one -
|
|
1151
|
+
// Tab is supposed to "select" the current value in the box per ARIA.
|
|
1152
|
+
// the normal blur process should be allowed to continue.
|
|
1153
|
+
if (displayOptions.length) {
|
|
1154
|
+
onPickValue(p.value, false);
|
|
1155
|
+
setSelectedResultIndex(-1);
|
|
1156
|
+
}
|
|
1128
1157
|
break;
|
|
1129
1158
|
}
|
|
1130
1159
|
}
|
|
@@ -2498,7 +2527,7 @@ const InfoTip = (props) => {
|
|
|
2498
2527
|
font-family: serif;
|
|
2499
2528
|
display:inline-block;
|
|
2500
2529
|
`;
|
|
2501
|
-
|
|
2530
|
+
const onButtonBlur = props.variant.type === 'Info' ?
|
|
2502
2531
|
() => {
|
|
2503
2532
|
closeTip();
|
|
2504
2533
|
} :
|
|
@@ -2971,6 +3000,13 @@ const Nav = (props) => {
|
|
|
2971
3000
|
var _a;
|
|
2972
3001
|
log('show changed', `${previous !== null && previous !== void 0 ? previous : 'undefined'} > ${current}`);
|
|
2973
3002
|
backdrop.setShow(current, { key: (_a = props.id) !== null && _a !== void 0 ? _a : 'Nav', zIndex });
|
|
3003
|
+
if (!props.show && props.onCloseFocusId) {
|
|
3004
|
+
const focusId = props.onCloseFocusId;
|
|
3005
|
+
setTimeout(() => {
|
|
3006
|
+
var _a;
|
|
3007
|
+
(_a = document.getElementById(focusId)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3008
|
+
}, 0);
|
|
3009
|
+
}
|
|
2974
3010
|
}, props.show);
|
|
2975
3011
|
React.useLayoutEffect(() => {
|
|
2976
3012
|
if (nav && nav.current) {
|
|
@@ -4623,7 +4659,7 @@ function useAriaLiveRegion() {
|
|
|
4623
4659
|
return {
|
|
4624
4660
|
/**
|
|
4625
4661
|
* @param message - The text to be read by the screen reader.
|
|
4626
|
-
* @param clearTimeoutMs - Milliseconds to wait before the message is cleared. Defaults to `2000
|
|
4662
|
+
* @param clearTimeoutMs - Milliseconds to wait before the message is cleared. Defaults to `2000`.
|
|
4627
4663
|
*/
|
|
4628
4664
|
notify: (message, clearTimoutMs) => {
|
|
4629
4665
|
if (clearTimerId) {
|
|
@@ -5291,5 +5327,5 @@ const LocalizationProvider = (p) => {
|
|
|
5291
5327
|
} }, p.children));
|
|
5292
5328
|
};
|
|
5293
5329
|
|
|
5294
|
-
export {
|
|
5330
|
+
export { Accordion, Autocomplete, AutocompleteController, AutocompleteEntityController, Backdrop$1 as Backdrop, Backdrop as Backdrop2, BoundMemoryPager, BoundStaticPager, Button, Calendar, Checkbox, ConfirmModal, CopyButton, DateInput, DialogPopover, Divider, ErrorModal, FileUploader, Form, FormColumnRow, FormFlexRow, GlobalStyles, Header, Highlight, ICONS, Icon, Image, InfoPanel, InfoTip, ItemPager, Label, Link, List, ListItem, LocalizationProvider, Modal, Nav, NormalizeCss, NumberInput, OmniLink, PagedResult, Pager, Picker, ProgressBar, SearchBox, Slider, StyleGuideLanguage, TabContainer, TabHeader, TabLocker, Table, Td, TdCurrency, TdNumber, Text, TextArea, TextInput, Th, ThSort, ThemeProvider, ThemeRenderer, ToggleButton, ToggleButtonGroup, TogglePasswordInput, TooltipPopover, Tr, WaitingIndicator, calcDynamicThemeProps, defaultTheme, enumToEntities, getCurrencyDisplay, getFileSizeDisplay, modalScrollFixClassName, useAccordionState, useAriaLiveRegion, useBooleanChanged, useIgnoreMount, useMediaQuery, useScrollbarSize, useThemeSafely, useWaiting };
|
|
5295
5331
|
//# sourceMappingURL=index.esm.js.map
|
package/index.js
CHANGED
|
@@ -515,53 +515,75 @@ const Button = React__namespace.forwardRef((props, ref) => {
|
|
|
515
515
|
return content;
|
|
516
516
|
});
|
|
517
517
|
|
|
518
|
-
const
|
|
519
|
-
const
|
|
520
|
-
const
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
const visibleStyle = css.css({
|
|
524
|
-
overflow: 'visible !important'
|
|
525
|
-
});
|
|
526
|
-
const Accordian = (props) => {
|
|
527
|
-
var _a, _b, _c, _d;
|
|
518
|
+
const defaultExpandTimeMs = 250;
|
|
519
|
+
const timingFunction = 'ease-in-out';
|
|
520
|
+
const Accordion = (props) => {
|
|
521
|
+
var _a, _b, _c;
|
|
522
|
+
const ignoreTransitionCount = React__namespace.useRef(props.open === true ? 2 : 0);
|
|
528
523
|
const [open, setOpen] = React__namespace.useState(false);
|
|
529
524
|
const theme = useThemeSafely();
|
|
530
525
|
const content = React__namespace.useRef(null);
|
|
531
|
-
const
|
|
526
|
+
const expandTimeMs = (_a = props.expandTimeMs) !== null && _a !== void 0 ? _a : defaultExpandTimeMs;
|
|
532
527
|
const contentStyles = css.css({
|
|
528
|
+
label: 'AccordionContent',
|
|
529
|
+
height: 0,
|
|
533
530
|
overflow: 'hidden',
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
});
|
|
537
|
-
const expandedContentStyles = css.css({
|
|
538
|
-
maxHeight: (_c = props.maxHeight) !== null && _c !== void 0 ? _c : accordianMaxHeight
|
|
531
|
+
transition: `height ${expandTimeMs}ms ${(_b = props.transitionTimingFunction) !== null && _b !== void 0 ? _b : timingFunction}`,
|
|
532
|
+
visibility: 'hidden',
|
|
539
533
|
});
|
|
540
534
|
const expandedContentWrapperStyles = !props.noPad ? css.css({
|
|
535
|
+
label: 'AccordionWrapper',
|
|
541
536
|
padding: '0 1rem 1rem 1rem'
|
|
542
537
|
}) : undefined;
|
|
538
|
+
function forceBrowserReflow() {
|
|
539
|
+
var _a;
|
|
540
|
+
// accessing this prop will cause browser to reflow and allow for calculations
|
|
541
|
+
(_a = content.current) === null || _a === void 0 ? void 0 : _a.offsetHeight;
|
|
542
|
+
}
|
|
543
543
|
React__namespace.useEffect(() => {
|
|
544
544
|
const currentContent = content.current;
|
|
545
545
|
if (currentContent) {
|
|
546
546
|
if (open) {
|
|
547
|
-
|
|
548
|
-
currentContent.
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
547
|
+
currentContent.style.visibility = 'visible';
|
|
548
|
+
currentContent.style.height = '0px';
|
|
549
|
+
forceBrowserReflow();
|
|
550
|
+
if (ignoreTransitionCount.current) {
|
|
551
|
+
// set the height to a auto so content changes will causes re-size
|
|
552
|
+
currentContent.style.height = 'auto';
|
|
553
|
+
ignoreTransitionCount.current -= 1;
|
|
554
|
+
}
|
|
555
|
+
else {
|
|
556
|
+
// set the height so the CSS transitions take over
|
|
557
|
+
currentContent.style.height = `${currentContent.scrollHeight}px`;
|
|
558
|
+
setTimeout(() => {
|
|
559
|
+
// set the height to a auto so content changes will causes re-size
|
|
560
|
+
currentContent.style.height = 'auto';
|
|
561
|
+
}, expandTimeMs + 1);
|
|
562
|
+
}
|
|
552
563
|
}
|
|
553
564
|
else {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
565
|
+
// set the height back from 'auto' above.
|
|
566
|
+
currentContent.style.height = `${currentContent.scrollHeight}px`;
|
|
567
|
+
forceBrowserReflow();
|
|
568
|
+
// set the height so the CSS transitions take over
|
|
569
|
+
currentContent.style.height = '0px';
|
|
570
|
+
if (ignoreTransitionCount.current) {
|
|
571
|
+
// undo the style so the root class takes back over ('hidden')
|
|
572
|
+
currentContent.style.visibility = '';
|
|
573
|
+
ignoreTransitionCount.current -= 1;
|
|
574
|
+
}
|
|
575
|
+
else {
|
|
576
|
+
setTimeout(() => {
|
|
577
|
+
// undo the style so the root class takes back over ('hidden')
|
|
578
|
+
currentContent.style.visibility = '';
|
|
579
|
+
}, expandTimeMs + 1);
|
|
559
580
|
}
|
|
560
581
|
}
|
|
561
582
|
}
|
|
562
583
|
}, [open]);
|
|
563
584
|
React__namespace.useEffect(() => {
|
|
564
585
|
var _a;
|
|
586
|
+
console.warn('props.open', 'changed', props.open);
|
|
565
587
|
if (props.open === undefined) {
|
|
566
588
|
// technically, we only need to use this effect if props.open was initialized with a boolean.
|
|
567
589
|
// you can't have conditional effects so here we go...
|
|
@@ -570,22 +592,24 @@ const Accordian = (props) => {
|
|
|
570
592
|
setOpen((_a = props.open) !== null && _a !== void 0 ? _a : false);
|
|
571
593
|
}, [props.open]);
|
|
572
594
|
const expandedPanelId = `${props.id}_expanded`;
|
|
573
|
-
|
|
595
|
+
const buttonId = `${props.id}_button`;
|
|
596
|
+
return (React__namespace.createElement("div", { id: props.id, className: props.wrapperClassName },
|
|
574
597
|
React__namespace.createElement("h3", { className: css.css({
|
|
575
598
|
// required for ARIA
|
|
576
599
|
margin: 0,
|
|
577
600
|
padding: 0,
|
|
578
601
|
fontSize: 'inherit'
|
|
579
602
|
}) },
|
|
580
|
-
React__namespace.createElement(Button, { "aria-controls": expandedPanelId, "aria-expanded": open, "aria-disabled": props.disabled, readOnly: props.disabled, variant: props.variant, className: css.cx(css.css({
|
|
603
|
+
React__namespace.createElement(Button, { id: buttonId, "aria-controls": expandedPanelId, "aria-expanded": open, "aria-disabled": props.disabled, readOnly: props.disabled, variant: props.variant, className: css.cx(css.css({
|
|
581
604
|
display: 'flex',
|
|
582
605
|
alignItems: 'center',
|
|
583
606
|
justifyContent: 'space-between',
|
|
584
607
|
height: 'auto',
|
|
585
608
|
minHeight: theme.controls.height,
|
|
586
|
-
width: ((
|
|
587
|
-
}, props.
|
|
609
|
+
width: ((_c = props.block) !== null && _c !== void 0 ? _c : true) ? '100%' : 'auto'
|
|
610
|
+
}, props.headerButtonClassName)), onClick: e => {
|
|
588
611
|
e.stopPropagation();
|
|
612
|
+
console.warn('click');
|
|
589
613
|
if (props.onChange) {
|
|
590
614
|
props.onChange(!open);
|
|
591
615
|
}
|
|
@@ -594,10 +618,10 @@ const Accordian = (props) => {
|
|
|
594
618
|
}
|
|
595
619
|
}, rightIcon: !props.disabled ? React__namespace.createElement(Icon, { id: open ? 'collapse' : 'expand' }) : undefined },
|
|
596
620
|
React__namespace.createElement("span", null, props.header))),
|
|
597
|
-
React__namespace.createElement("div", { ref: content, className:
|
|
598
|
-
React__namespace.createElement("div", { className: expandedContentWrapperStyles, id: expandedPanelId }, children))));
|
|
621
|
+
React__namespace.createElement("div", { ref: content, className: contentStyles },
|
|
622
|
+
React__namespace.createElement("div", { className: expandedContentWrapperStyles, id: expandedPanelId, hidden: !open, role: "region", "aria-labelledby": buttonId }, props.children))));
|
|
599
623
|
};
|
|
600
|
-
const
|
|
624
|
+
const useAccordionState = (count, openIndex) => {
|
|
601
625
|
const [panels, setShowPanel] = React__namespace.useState(new Array(count).fill(false).map((b, i) => {
|
|
602
626
|
return i === openIndex;
|
|
603
627
|
}));
|
|
@@ -1141,8 +1165,13 @@ const Autocomplete = (p) => {
|
|
|
1141
1165
|
break;
|
|
1142
1166
|
}
|
|
1143
1167
|
case 'Tab': {
|
|
1144
|
-
|
|
1145
|
-
|
|
1168
|
+
// if there are options showing - and whether or not you picked one -
|
|
1169
|
+
// Tab is supposed to "select" the current value in the box per ARIA.
|
|
1170
|
+
// the normal blur process should be allowed to continue.
|
|
1171
|
+
if (displayOptions.length) {
|
|
1172
|
+
onPickValue(p.value, false);
|
|
1173
|
+
setSelectedResultIndex(-1);
|
|
1174
|
+
}
|
|
1146
1175
|
break;
|
|
1147
1176
|
}
|
|
1148
1177
|
}
|
|
@@ -2516,7 +2545,7 @@ const InfoTip = (props) => {
|
|
|
2516
2545
|
font-family: serif;
|
|
2517
2546
|
display:inline-block;
|
|
2518
2547
|
`;
|
|
2519
|
-
|
|
2548
|
+
const onButtonBlur = props.variant.type === 'Info' ?
|
|
2520
2549
|
() => {
|
|
2521
2550
|
closeTip();
|
|
2522
2551
|
} :
|
|
@@ -2989,6 +3018,13 @@ const Nav = (props) => {
|
|
|
2989
3018
|
var _a;
|
|
2990
3019
|
log('show changed', `${previous !== null && previous !== void 0 ? previous : 'undefined'} > ${current}`);
|
|
2991
3020
|
backdrop.setShow(current, { key: (_a = props.id) !== null && _a !== void 0 ? _a : 'Nav', zIndex });
|
|
3021
|
+
if (!props.show && props.onCloseFocusId) {
|
|
3022
|
+
const focusId = props.onCloseFocusId;
|
|
3023
|
+
setTimeout(() => {
|
|
3024
|
+
var _a;
|
|
3025
|
+
(_a = document.getElementById(focusId)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
3026
|
+
}, 0);
|
|
3027
|
+
}
|
|
2992
3028
|
}, props.show);
|
|
2993
3029
|
React__namespace.useLayoutEffect(() => {
|
|
2994
3030
|
if (nav && nav.current) {
|
|
@@ -4641,7 +4677,7 @@ function useAriaLiveRegion() {
|
|
|
4641
4677
|
return {
|
|
4642
4678
|
/**
|
|
4643
4679
|
* @param message - The text to be read by the screen reader.
|
|
4644
|
-
* @param clearTimeoutMs - Milliseconds to wait before the message is cleared. Defaults to `2000
|
|
4680
|
+
* @param clearTimeoutMs - Milliseconds to wait before the message is cleared. Defaults to `2000`.
|
|
4645
4681
|
*/
|
|
4646
4682
|
notify: (message, clearTimoutMs) => {
|
|
4647
4683
|
if (clearTimerId) {
|
|
@@ -5309,7 +5345,7 @@ const LocalizationProvider = (p) => {
|
|
|
5309
5345
|
} }, p.children));
|
|
5310
5346
|
};
|
|
5311
5347
|
|
|
5312
|
-
exports.
|
|
5348
|
+
exports.Accordion = Accordion;
|
|
5313
5349
|
exports.Autocomplete = Autocomplete;
|
|
5314
5350
|
exports.AutocompleteController = AutocompleteController;
|
|
5315
5351
|
exports.AutocompleteEntityController = AutocompleteEntityController;
|
|
@@ -5381,7 +5417,7 @@ exports.enumToEntities = enumToEntities;
|
|
|
5381
5417
|
exports.getCurrencyDisplay = getCurrencyDisplay;
|
|
5382
5418
|
exports.getFileSizeDisplay = getFileSizeDisplay;
|
|
5383
5419
|
exports.modalScrollFixClassName = modalScrollFixClassName;
|
|
5384
|
-
exports.
|
|
5420
|
+
exports.useAccordionState = useAccordionState;
|
|
5385
5421
|
exports.useAriaLiveRegion = useAriaLiveRegion;
|
|
5386
5422
|
exports.useBooleanChanged = useBooleanChanged;
|
|
5387
5423
|
exports.useIgnoreMount = useIgnoreMount;
|