@mackin.com/styleguide 11.0.0 → 11.0.1
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 +2 -0
- package/index.esm.js +27 -23
- package/index.js +27 -23
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
|
|
|
4
4
|
|
|
5
5
|
type HeaderVariant = 'label' | 'link' | 'primary' | 'secondary' | 'omg' | 'primary2' | 'positive' | 'negative';
|
|
6
6
|
interface AccordianProps {
|
|
7
|
+
/** Required for ARIA. */
|
|
8
|
+
id: string;
|
|
7
9
|
header: JSX.Element | string;
|
|
8
10
|
children: React.ReactNode;
|
|
9
11
|
variant?: HeaderVariant;
|
package/index.esm.js
CHANGED
|
@@ -292,7 +292,6 @@ const Text = (props) => {
|
|
|
292
292
|
}, props.children);
|
|
293
293
|
};
|
|
294
294
|
|
|
295
|
-
//TB: FUTURE de-dup these styles. create individual styles and compose them manually.
|
|
296
295
|
const Button = React.forwardRef((props, ref) => {
|
|
297
296
|
var _a;
|
|
298
297
|
const { variant, round, rightIcon, leftIcon, iconBlock, small, readOnly, waiting, enforceMinWidth, controlAlign } = props, nativeProps = __rest(props, ["variant", "round", "rightIcon", "leftIcon", "iconBlock", "small", "readOnly", "waiting", "enforceMinWidth", "controlAlign"]);
|
|
@@ -551,26 +550,33 @@ const Accordian = (props) => {
|
|
|
551
550
|
}
|
|
552
551
|
setOpen((_a = props.open) !== null && _a !== void 0 ? _a : false);
|
|
553
552
|
}, [props.open]);
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
|
|
553
|
+
const expandedPanelId = `${props.id}_expanded`;
|
|
554
|
+
return (React.createElement("div", { id: props.id, className: "accordian" },
|
|
555
|
+
React.createElement("h3", { className: css({
|
|
556
|
+
// required for ARIA
|
|
557
|
+
margin: 0,
|
|
558
|
+
padding: 0,
|
|
559
|
+
fontSize: 'inherit'
|
|
560
|
+
}) },
|
|
561
|
+
React.createElement(Button, { "aria-controls": expandedPanelId, "aria-expanded": open, "aria-disabled": props.disabled, readOnly: props.disabled, variant: props.variant, className: cx(css({
|
|
562
|
+
display: 'flex',
|
|
563
|
+
alignItems: 'center',
|
|
564
|
+
justifyContent: 'space-between',
|
|
565
|
+
height: 'auto',
|
|
566
|
+
minHeight: theme.controls.height,
|
|
567
|
+
width: ((_d = props.block) !== null && _d !== void 0 ? _d : true) ? '100%' : 'auto'
|
|
568
|
+
}, props.className)), onClick: e => {
|
|
569
|
+
e.stopPropagation();
|
|
570
|
+
if (props.onChange) {
|
|
571
|
+
props.onChange(!open);
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
setOpen(!open);
|
|
575
|
+
}
|
|
576
|
+
}, rightIcon: !props.disabled ? React.createElement(Icon, { id: open ? 'collapse' : 'expand' }) : undefined },
|
|
577
|
+
React.createElement("span", null, props.header))),
|
|
572
578
|
React.createElement("div", { ref: content, className: cx('accordian__body', contentStyles) },
|
|
573
|
-
React.createElement("div", { className: expandedContentWrapperStyles }, children))));
|
|
579
|
+
React.createElement("div", { className: expandedContentWrapperStyles, id: expandedPanelId }, children))));
|
|
574
580
|
};
|
|
575
581
|
const useAccordianState = (count, openIndex) => {
|
|
576
582
|
const [panels, setShowPanel] = React.useState(new Array(count).fill(false).map((b, i) => {
|
|
@@ -983,7 +989,7 @@ const defaultOnPickFocusMs = 100;
|
|
|
983
989
|
const Autocomplete = (p) => {
|
|
984
990
|
var _a;
|
|
985
991
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
986
|
-
const inputProps = __rest(p, ["value", "className", "inputWrapperClassName", "inputClassName", "listClassName", "listItemClassName", "maxShownValues", "allowScroll", "options", "onPick", "onPickFocusWaitMs"]);
|
|
992
|
+
const inputProps = __rest(p, ["value", "className", "inputWrapperClassName", "inputClassName", "listClassName", "listItemClassName", "maxShownValues", "allowScroll", "options", "onPick", "onPickFocusWaitMs", "ariaLabel"]);
|
|
987
993
|
const theme = useThemeSafely();
|
|
988
994
|
const element = React.useRef(null);
|
|
989
995
|
const input = React.useRef(null);
|
|
@@ -2892,7 +2898,6 @@ const LinkContent = (props) => {
|
|
|
2892
2898
|
}) }, props.rightIcon)));
|
|
2893
2899
|
};
|
|
2894
2900
|
|
|
2895
|
-
//TB: FUTURE de-dup these styles. create individual styles and compose them manually.
|
|
2896
2901
|
const generateLinkStyles = (props, theme) => {
|
|
2897
2902
|
const disabled = props.disabled || props.waiting;
|
|
2898
2903
|
let color = props.colorOverride;
|
|
@@ -4261,7 +4266,6 @@ const TextArea = React.forwardRef((props, ref) => {
|
|
|
4261
4266
|
}
|
|
4262
4267
|
else {
|
|
4263
4268
|
if (reportValueOnError) {
|
|
4264
|
-
//TB: temp, add a custom list of validators that will be run for all inputs if a pattern cannot be decided.
|
|
4265
4269
|
onValueChange(localValue);
|
|
4266
4270
|
}
|
|
4267
4271
|
else {
|
package/index.js
CHANGED
|
@@ -310,7 +310,6 @@ const Text = (props) => {
|
|
|
310
310
|
}, props.children);
|
|
311
311
|
};
|
|
312
312
|
|
|
313
|
-
//TB: FUTURE de-dup these styles. create individual styles and compose them manually.
|
|
314
313
|
const Button = React__namespace.forwardRef((props, ref) => {
|
|
315
314
|
var _a;
|
|
316
315
|
const { variant, round, rightIcon, leftIcon, iconBlock, small, readOnly, waiting, enforceMinWidth, controlAlign } = props, nativeProps = __rest(props, ["variant", "round", "rightIcon", "leftIcon", "iconBlock", "small", "readOnly", "waiting", "enforceMinWidth", "controlAlign"]);
|
|
@@ -569,26 +568,33 @@ const Accordian = (props) => {
|
|
|
569
568
|
}
|
|
570
569
|
setOpen((_a = props.open) !== null && _a !== void 0 ? _a : false);
|
|
571
570
|
}, [props.open]);
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
|
|
571
|
+
const expandedPanelId = `${props.id}_expanded`;
|
|
572
|
+
return (React__namespace.createElement("div", { id: props.id, className: "accordian" },
|
|
573
|
+
React__namespace.createElement("h3", { className: css.css({
|
|
574
|
+
// required for ARIA
|
|
575
|
+
margin: 0,
|
|
576
|
+
padding: 0,
|
|
577
|
+
fontSize: 'inherit'
|
|
578
|
+
}) },
|
|
579
|
+
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({
|
|
580
|
+
display: 'flex',
|
|
581
|
+
alignItems: 'center',
|
|
582
|
+
justifyContent: 'space-between',
|
|
583
|
+
height: 'auto',
|
|
584
|
+
minHeight: theme.controls.height,
|
|
585
|
+
width: ((_d = props.block) !== null && _d !== void 0 ? _d : true) ? '100%' : 'auto'
|
|
586
|
+
}, props.className)), onClick: e => {
|
|
587
|
+
e.stopPropagation();
|
|
588
|
+
if (props.onChange) {
|
|
589
|
+
props.onChange(!open);
|
|
590
|
+
}
|
|
591
|
+
else {
|
|
592
|
+
setOpen(!open);
|
|
593
|
+
}
|
|
594
|
+
}, rightIcon: !props.disabled ? React__namespace.createElement(Icon, { id: open ? 'collapse' : 'expand' }) : undefined },
|
|
595
|
+
React__namespace.createElement("span", null, props.header))),
|
|
590
596
|
React__namespace.createElement("div", { ref: content, className: css.cx('accordian__body', contentStyles) },
|
|
591
|
-
React__namespace.createElement("div", { className: expandedContentWrapperStyles }, children))));
|
|
597
|
+
React__namespace.createElement("div", { className: expandedContentWrapperStyles, id: expandedPanelId }, children))));
|
|
592
598
|
};
|
|
593
599
|
const useAccordianState = (count, openIndex) => {
|
|
594
600
|
const [panels, setShowPanel] = React__namespace.useState(new Array(count).fill(false).map((b, i) => {
|
|
@@ -1001,7 +1007,7 @@ const defaultOnPickFocusMs = 100;
|
|
|
1001
1007
|
const Autocomplete = (p) => {
|
|
1002
1008
|
var _a;
|
|
1003
1009
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1004
|
-
const inputProps = __rest(p, ["value", "className", "inputWrapperClassName", "inputClassName", "listClassName", "listItemClassName", "maxShownValues", "allowScroll", "options", "onPick", "onPickFocusWaitMs"]);
|
|
1010
|
+
const inputProps = __rest(p, ["value", "className", "inputWrapperClassName", "inputClassName", "listClassName", "listItemClassName", "maxShownValues", "allowScroll", "options", "onPick", "onPickFocusWaitMs", "ariaLabel"]);
|
|
1005
1011
|
const theme = useThemeSafely();
|
|
1006
1012
|
const element = React__namespace.useRef(null);
|
|
1007
1013
|
const input = React__namespace.useRef(null);
|
|
@@ -2910,7 +2916,6 @@ const LinkContent = (props) => {
|
|
|
2910
2916
|
}) }, props.rightIcon)));
|
|
2911
2917
|
};
|
|
2912
2918
|
|
|
2913
|
-
//TB: FUTURE de-dup these styles. create individual styles and compose them manually.
|
|
2914
2919
|
const generateLinkStyles = (props, theme) => {
|
|
2915
2920
|
const disabled = props.disabled || props.waiting;
|
|
2916
2921
|
let color = props.colorOverride;
|
|
@@ -4279,7 +4284,6 @@ const TextArea = React__namespace.forwardRef((props, ref) => {
|
|
|
4279
4284
|
}
|
|
4280
4285
|
else {
|
|
4281
4286
|
if (reportValueOnError) {
|
|
4282
|
-
//TB: temp, add a custom list of validators that will be run for all inputs if a pattern cannot be decided.
|
|
4283
4287
|
onValueChange(localValue);
|
|
4284
4288
|
}
|
|
4285
4289
|
else {
|