@khanacademy/wonder-blocks-dropdown 5.3.4 → 5.3.6
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/CHANGELOG.md +21 -0
- package/dist/components/select-opener.d.ts +14 -2
- package/dist/es/index.js +112 -73
- package/dist/index.js +111 -72
- package/package.json +5 -5
- package/src/components/__tests__/multi-select.test.tsx +145 -25
- package/src/components/__tests__/select-opener.test.tsx +115 -0
- package/src/components/__tests__/single-select.test.tsx +160 -28
- package/src/components/select-opener.tsx +165 -106
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-dropdown
|
|
2
2
|
|
|
3
|
+
## 5.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cc2d8e86: - Update styling for variants of `SingleSelect` and `MultiSelect`. This addresses some styling edge cases around error/disabled states, focus/hover/active states, and light mode. The `not-allowed` cursor is also applied to the disabled state.
|
|
8
|
+
- Styling in the `SelectOpener` (`SingleSelect` and `MultiSelect`) is now applied using css pseudo-classes (`:focus-visible`, `:hover`, `:active`) instead of applying styles using js.
|
|
9
|
+
- Replaced internal use of `ClickableBehaviour` in `SelectOpener` for normalized keyboard interaction behaviour across browsers.
|
|
10
|
+
- 13f49f85: Allow `SingleSelect` and `MultiSelect` to be focusable when disabled. These components now have `aria-disabled` when the `disabled` prop is `true`. This makes it so screenreaders will continue to communicate that the component is disabled, while allowing focus on the disabled component. Focus styling is also added to the disabled state.
|
|
11
|
+
- Updated dependencies [47a758b6]
|
|
12
|
+
- @khanacademy/wonder-blocks-layout@2.1.0
|
|
13
|
+
- @khanacademy/wonder-blocks-cell@3.3.7
|
|
14
|
+
- @khanacademy/wonder-blocks-modal@5.1.4
|
|
15
|
+
- @khanacademy/wonder-blocks-search-field@2.2.15
|
|
16
|
+
|
|
17
|
+
## 5.3.5
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies [01fce89e]
|
|
22
|
+
- @khanacademy/wonder-blocks-search-field@2.2.14
|
|
23
|
+
|
|
3
24
|
## 5.3.4
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -49,13 +49,25 @@ type DefaultProps = {
|
|
|
49
49
|
light: SelectOpenerProps["light"];
|
|
50
50
|
isPlaceholder: SelectOpenerProps["isPlaceholder"];
|
|
51
51
|
};
|
|
52
|
+
type SelectOpenerState = {
|
|
53
|
+
/**
|
|
54
|
+
* We only keep track of the pressed state to apply styling for when the select
|
|
55
|
+
* opener is pressed using Enter/Space. Other states (active, hover, focus)
|
|
56
|
+
* are not tracked because we use css pseudo-classes to handle those styles
|
|
57
|
+
* instead. Note: `:active` styling is only applied on clicks across browsers,
|
|
58
|
+
* and not on keyboard interaction.
|
|
59
|
+
*/
|
|
60
|
+
pressed: boolean;
|
|
61
|
+
};
|
|
52
62
|
/**
|
|
53
63
|
* An opener that opens select boxes.
|
|
54
64
|
*/
|
|
55
|
-
export default class SelectOpener extends React.Component<SelectOpenerProps> {
|
|
65
|
+
export default class SelectOpener extends React.Component<SelectOpenerProps, SelectOpenerState> {
|
|
56
66
|
static defaultProps: DefaultProps;
|
|
67
|
+
constructor(props: SelectOpenerProps);
|
|
57
68
|
handleClick: (e: React.SyntheticEvent) => void;
|
|
58
|
-
|
|
69
|
+
handleKeyDown: (e: React.KeyboardEvent) => void;
|
|
70
|
+
handleKeyUp: (e: React.KeyboardEvent) => void;
|
|
59
71
|
render(): React.ReactNode;
|
|
60
72
|
}
|
|
61
73
|
export {};
|
package/dist/es/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { Strut } from '@khanacademy/wonder-blocks-layout';
|
|
|
9
9
|
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
10
10
|
import checkIcon from '@phosphor-icons/core/bold/check-bold.svg';
|
|
11
11
|
import * as ReactDOM from 'react-dom';
|
|
12
|
-
import { ClickableBehavior
|
|
12
|
+
import { ClickableBehavior } from '@khanacademy/wonder-blocks-clickable';
|
|
13
13
|
import SearchField from '@khanacademy/wonder-blocks-search-field';
|
|
14
14
|
import { withActionScheduler } from '@khanacademy/wonder-blocks-timing';
|
|
15
15
|
import { VariableSizeList } from 'react-window';
|
|
@@ -17,7 +17,6 @@ import { Popper } from 'react-popper';
|
|
|
17
17
|
import { maybeGetPortalMountedModalHostElement } from '@khanacademy/wonder-blocks-modal';
|
|
18
18
|
import { detectOverflow } from '@popperjs/core';
|
|
19
19
|
import caretDownIcon from '@phosphor-icons/core/bold/caret-down-bold.svg';
|
|
20
|
-
import { __RouterContext } from 'react-router';
|
|
21
20
|
|
|
22
21
|
function _extends() {
|
|
23
22
|
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -1630,16 +1629,37 @@ const styles$2 = StyleSheet.create({
|
|
|
1630
1629
|
const _excluded$2 = ["children", "disabled", "error", "id", "isPlaceholder", "light", "open", "testId", "onOpenChanged"];
|
|
1631
1630
|
const StyledButton = addStyle("button");
|
|
1632
1631
|
class SelectOpener extends React.Component {
|
|
1633
|
-
constructor(
|
|
1634
|
-
super(
|
|
1632
|
+
constructor(props) {
|
|
1633
|
+
super(props);
|
|
1635
1634
|
this.handleClick = e => {
|
|
1636
1635
|
const {
|
|
1637
1636
|
open
|
|
1638
1637
|
} = this.props;
|
|
1639
1638
|
this.props.onOpenChanged(!open);
|
|
1640
1639
|
};
|
|
1640
|
+
this.handleKeyDown = e => {
|
|
1641
|
+
const keyCode = e.key;
|
|
1642
|
+
if (keyCode === "Enter" || keyCode === " ") {
|
|
1643
|
+
this.setState({
|
|
1644
|
+
pressed: true
|
|
1645
|
+
});
|
|
1646
|
+
e.preventDefault();
|
|
1647
|
+
}
|
|
1648
|
+
};
|
|
1649
|
+
this.handleKeyUp = e => {
|
|
1650
|
+
const keyCode = e.key;
|
|
1651
|
+
if (keyCode === "Enter" || keyCode === " ") {
|
|
1652
|
+
this.setState({
|
|
1653
|
+
pressed: false
|
|
1654
|
+
});
|
|
1655
|
+
this.handleClick(e);
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
this.state = {
|
|
1659
|
+
pressed: false
|
|
1660
|
+
};
|
|
1641
1661
|
}
|
|
1642
|
-
|
|
1662
|
+
render() {
|
|
1643
1663
|
const _this$props = this.props,
|
|
1644
1664
|
{
|
|
1645
1665
|
children,
|
|
@@ -1652,40 +1672,29 @@ class SelectOpener extends React.Component {
|
|
|
1652
1672
|
testId
|
|
1653
1673
|
} = _this$props,
|
|
1654
1674
|
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$2);
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
}, children || "\u00A0"), React.createElement(PhosphorIcon, {
|
|
1679
|
-
icon: caretDownIcon,
|
|
1680
|
-
color: iconColor,
|
|
1681
|
-
size: "small",
|
|
1682
|
-
style: styles$1.caret,
|
|
1683
|
-
"aria-hidden": "true"
|
|
1684
|
-
}));
|
|
1685
|
-
});
|
|
1686
|
-
}
|
|
1687
|
-
render() {
|
|
1688
|
-
return React.createElement(__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
|
|
1675
|
+
const stateStyles = _generateStyles(light, isPlaceholder, error);
|
|
1676
|
+
const iconColor = light ? disabled || error ? "currentColor" : tokens.color.white : disabled ? tokens.color.offBlack32 : tokens.color.offBlack64;
|
|
1677
|
+
const style = [styles$1.shared, stateStyles.default, disabled && stateStyles.disabled, !disabled && this.state.pressed && stateStyles.pressed];
|
|
1678
|
+
return React.createElement(StyledButton, _extends({}, sharedProps, {
|
|
1679
|
+
"aria-disabled": disabled,
|
|
1680
|
+
"aria-expanded": open ? "true" : "false",
|
|
1681
|
+
"aria-haspopup": "listbox",
|
|
1682
|
+
"data-testid": testId,
|
|
1683
|
+
id: id,
|
|
1684
|
+
style: style,
|
|
1685
|
+
type: "button",
|
|
1686
|
+
onClick: !disabled ? this.handleClick : undefined,
|
|
1687
|
+
onKeyDown: !disabled ? this.handleKeyDown : undefined,
|
|
1688
|
+
onKeyUp: !disabled ? this.handleKeyUp : undefined
|
|
1689
|
+
}), React.createElement(LabelMedium, {
|
|
1690
|
+
style: styles$1.text
|
|
1691
|
+
}, children || "\u00A0"), React.createElement(PhosphorIcon, {
|
|
1692
|
+
icon: caretDownIcon,
|
|
1693
|
+
color: iconColor,
|
|
1694
|
+
size: "small",
|
|
1695
|
+
style: styles$1.caret,
|
|
1696
|
+
"aria-hidden": "true"
|
|
1697
|
+
}));
|
|
1689
1698
|
}
|
|
1690
1699
|
}
|
|
1691
1700
|
SelectOpener.defaultProps = {
|
|
@@ -1734,61 +1743,91 @@ const _generateStyles = (light, placeholder, error) => {
|
|
|
1734
1743
|
}
|
|
1735
1744
|
let newStyles = {};
|
|
1736
1745
|
if (light) {
|
|
1746
|
+
const focusHoverStyling = {
|
|
1747
|
+
borderColor: error ? tokens.color.red : tokens.color.white,
|
|
1748
|
+
borderWidth: tokens.spacing.xxxxSmall_2,
|
|
1749
|
+
paddingLeft: adjustedPaddingLeft,
|
|
1750
|
+
paddingRight: adjustedPaddingRight
|
|
1751
|
+
};
|
|
1752
|
+
const activePressedStyling = {
|
|
1753
|
+
paddingLeft: adjustedPaddingLeft,
|
|
1754
|
+
paddingRight: adjustedPaddingRight,
|
|
1755
|
+
borderColor: error ? tokens.color.red : tokens.color.fadedBlue,
|
|
1756
|
+
borderWidth: tokens.border.width.thin,
|
|
1757
|
+
color: error ? tokens.color.offBlack64 : placeholder ? mix(tokens.color.white32, tokens.color.blue) : tokens.color.fadedBlue,
|
|
1758
|
+
backgroundColor: error ? tokens.color.fadedRed : tokens.color.activeBlue
|
|
1759
|
+
};
|
|
1737
1760
|
newStyles = {
|
|
1738
1761
|
default: {
|
|
1739
1762
|
background: error ? tokens.color.fadedRed8 : "transparent",
|
|
1740
|
-
color: placeholder ? tokens.color.white50 : tokens.color.white,
|
|
1763
|
+
color: error ? tokens.color.offBlack64 : placeholder ? tokens.color.white50 : tokens.color.white,
|
|
1741
1764
|
borderColor: error ? tokens.color.red : tokens.color.white50,
|
|
1742
|
-
borderWidth: tokens.border.width.hairline
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
borderWidth: tokens.border.width.thin,
|
|
1755
|
-
color: placeholder ? mix(tokens.color.white32, tokens.color.blue) : tokens.color.fadedBlue,
|
|
1756
|
-
backgroundColor: error ? tokens.color.fadedRed : tokens.color.activeBlue
|
|
1765
|
+
borderWidth: tokens.border.width.hairline,
|
|
1766
|
+
":hover:not([aria-disabled=true])": focusHoverStyling,
|
|
1767
|
+
["@media not (hover: hover)"]: {
|
|
1768
|
+
":hover:not([aria-disabled=true])": {
|
|
1769
|
+
borderColor: error ? tokens.color.red : tokens.color.white50,
|
|
1770
|
+
borderWidth: tokens.border.width.hairline,
|
|
1771
|
+
paddingLeft: tokens.spacing.medium_16,
|
|
1772
|
+
paddingRight: tokens.spacing.small_12
|
|
1773
|
+
}
|
|
1774
|
+
},
|
|
1775
|
+
":focus-visible:not([aria-disabled=true])": focusHoverStyling,
|
|
1776
|
+
":active:not([aria-disabled=true])": activePressedStyling
|
|
1757
1777
|
},
|
|
1758
1778
|
disabled: {
|
|
1759
1779
|
background: "transparent",
|
|
1760
1780
|
borderColor: mix(tokens.color.white32, tokens.color.blue),
|
|
1761
1781
|
color: mix(tokens.color.white32, tokens.color.blue),
|
|
1762
|
-
cursor: "
|
|
1763
|
-
|
|
1782
|
+
cursor: "not-allowed",
|
|
1783
|
+
":focus-visible": {
|
|
1784
|
+
boxShadow: `0 0 0 1px ${tokens.color.offBlack32}, 0 0 0 3px ${tokens.color.fadedBlue}`
|
|
1785
|
+
}
|
|
1786
|
+
},
|
|
1787
|
+
pressed: activePressedStyling
|
|
1764
1788
|
};
|
|
1765
1789
|
} else {
|
|
1790
|
+
const focusHoverStyling = {
|
|
1791
|
+
borderColor: error ? tokens.color.red : tokens.color.blue,
|
|
1792
|
+
borderWidth: tokens.border.width.thin,
|
|
1793
|
+
paddingLeft: adjustedPaddingLeft,
|
|
1794
|
+
paddingRight: adjustedPaddingRight
|
|
1795
|
+
};
|
|
1796
|
+
const activePressedStyling = {
|
|
1797
|
+
background: error ? tokens.color.fadedRed : tokens.color.fadedBlue,
|
|
1798
|
+
borderColor: error ? tokens.color.red : tokens.color.activeBlue,
|
|
1799
|
+
borderWidth: tokens.border.width.thin,
|
|
1800
|
+
paddingLeft: adjustedPaddingLeft,
|
|
1801
|
+
paddingRight: adjustedPaddingRight
|
|
1802
|
+
};
|
|
1766
1803
|
newStyles = {
|
|
1767
1804
|
default: {
|
|
1768
1805
|
background: error ? tokens.color.fadedRed8 : tokens.color.white,
|
|
1769
1806
|
borderColor: error ? tokens.color.red : tokens.color.offBlack16,
|
|
1770
1807
|
borderWidth: tokens.border.width.hairline,
|
|
1771
|
-
color: placeholder ? tokens.color.offBlack64 : tokens.color.offBlack
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
paddingLeft: adjustedPaddingLeft,
|
|
1784
|
-
paddingRight: adjustedPaddingRight
|
|
1808
|
+
color: placeholder ? tokens.color.offBlack64 : tokens.color.offBlack,
|
|
1809
|
+
":hover:not([aria-disabled=true])": focusHoverStyling,
|
|
1810
|
+
["@media not (hover: hover)"]: {
|
|
1811
|
+
":hover:not([aria-disabled=true])": {
|
|
1812
|
+
borderColor: error ? tokens.color.red : tokens.color.offBlack16,
|
|
1813
|
+
borderWidth: tokens.border.width.hairline,
|
|
1814
|
+
paddingLeft: tokens.spacing.medium_16,
|
|
1815
|
+
paddingRight: tokens.spacing.small_12
|
|
1816
|
+
}
|
|
1817
|
+
},
|
|
1818
|
+
":focus-visible:not([aria-disabled=true])": focusHoverStyling,
|
|
1819
|
+
":active:not([aria-disabled=true])": activePressedStyling
|
|
1785
1820
|
},
|
|
1786
1821
|
disabled: {
|
|
1787
1822
|
background: tokens.color.offWhite,
|
|
1788
1823
|
borderColor: tokens.color.offBlack16,
|
|
1789
1824
|
color: tokens.color.offBlack64,
|
|
1790
|
-
cursor: "
|
|
1791
|
-
|
|
1825
|
+
cursor: "not-allowed",
|
|
1826
|
+
":focus-visible": {
|
|
1827
|
+
boxShadow: `0 0 0 1px ${tokens.color.white}, 0 0 0 3px ${tokens.color.offBlack32}`
|
|
1828
|
+
}
|
|
1829
|
+
},
|
|
1830
|
+
pressed: activePressedStyling
|
|
1792
1831
|
};
|
|
1793
1832
|
}
|
|
1794
1833
|
stateStyles[styleKey] = StyleSheet.create(newStyles);
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,6 @@ var reactPopper = require('react-popper');
|
|
|
20
20
|
var wonderBlocksModal = require('@khanacademy/wonder-blocks-modal');
|
|
21
21
|
var core = require('@popperjs/core');
|
|
22
22
|
var caretDownIcon = require('@phosphor-icons/core/bold/caret-down-bold.svg');
|
|
23
|
-
var reactRouter = require('react-router');
|
|
24
23
|
|
|
25
24
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
26
25
|
|
|
@@ -1660,16 +1659,37 @@ const styles$2 = aphrodite.StyleSheet.create({
|
|
|
1660
1659
|
const _excluded$2 = ["children", "disabled", "error", "id", "isPlaceholder", "light", "open", "testId", "onOpenChanged"];
|
|
1661
1660
|
const StyledButton = wonderBlocksCore.addStyle("button");
|
|
1662
1661
|
class SelectOpener extends React__namespace.Component {
|
|
1663
|
-
constructor(
|
|
1664
|
-
super(
|
|
1662
|
+
constructor(props) {
|
|
1663
|
+
super(props);
|
|
1665
1664
|
this.handleClick = e => {
|
|
1666
1665
|
const {
|
|
1667
1666
|
open
|
|
1668
1667
|
} = this.props;
|
|
1669
1668
|
this.props.onOpenChanged(!open);
|
|
1670
1669
|
};
|
|
1670
|
+
this.handleKeyDown = e => {
|
|
1671
|
+
const keyCode = e.key;
|
|
1672
|
+
if (keyCode === "Enter" || keyCode === " ") {
|
|
1673
|
+
this.setState({
|
|
1674
|
+
pressed: true
|
|
1675
|
+
});
|
|
1676
|
+
e.preventDefault();
|
|
1677
|
+
}
|
|
1678
|
+
};
|
|
1679
|
+
this.handleKeyUp = e => {
|
|
1680
|
+
const keyCode = e.key;
|
|
1681
|
+
if (keyCode === "Enter" || keyCode === " ") {
|
|
1682
|
+
this.setState({
|
|
1683
|
+
pressed: false
|
|
1684
|
+
});
|
|
1685
|
+
this.handleClick(e);
|
|
1686
|
+
}
|
|
1687
|
+
};
|
|
1688
|
+
this.state = {
|
|
1689
|
+
pressed: false
|
|
1690
|
+
};
|
|
1671
1691
|
}
|
|
1672
|
-
|
|
1692
|
+
render() {
|
|
1673
1693
|
const _this$props = this.props,
|
|
1674
1694
|
{
|
|
1675
1695
|
children,
|
|
@@ -1682,40 +1702,29 @@ class SelectOpener extends React__namespace.Component {
|
|
|
1682
1702
|
testId
|
|
1683
1703
|
} = _this$props,
|
|
1684
1704
|
sharedProps = _objectWithoutPropertiesLoose(_this$props, _excluded$2);
|
|
1685
|
-
const
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
}, children || "\u00A0"), React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
1709
|
-
icon: caretDownIcon__default["default"],
|
|
1710
|
-
color: iconColor,
|
|
1711
|
-
size: "small",
|
|
1712
|
-
style: styles$1.caret,
|
|
1713
|
-
"aria-hidden": "true"
|
|
1714
|
-
}));
|
|
1715
|
-
});
|
|
1716
|
-
}
|
|
1717
|
-
render() {
|
|
1718
|
-
return React__namespace.createElement(reactRouter.__RouterContext.Consumer, null, router => this.renderClickableBehavior(router));
|
|
1705
|
+
const stateStyles = _generateStyles(light, isPlaceholder, error);
|
|
1706
|
+
const iconColor = light ? disabled || error ? "currentColor" : tokens__namespace.color.white : disabled ? tokens__namespace.color.offBlack32 : tokens__namespace.color.offBlack64;
|
|
1707
|
+
const style = [styles$1.shared, stateStyles.default, disabled && stateStyles.disabled, !disabled && this.state.pressed && stateStyles.pressed];
|
|
1708
|
+
return React__namespace.createElement(StyledButton, _extends({}, sharedProps, {
|
|
1709
|
+
"aria-disabled": disabled,
|
|
1710
|
+
"aria-expanded": open ? "true" : "false",
|
|
1711
|
+
"aria-haspopup": "listbox",
|
|
1712
|
+
"data-testid": testId,
|
|
1713
|
+
id: id,
|
|
1714
|
+
style: style,
|
|
1715
|
+
type: "button",
|
|
1716
|
+
onClick: !disabled ? this.handleClick : undefined,
|
|
1717
|
+
onKeyDown: !disabled ? this.handleKeyDown : undefined,
|
|
1718
|
+
onKeyUp: !disabled ? this.handleKeyUp : undefined
|
|
1719
|
+
}), React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
1720
|
+
style: styles$1.text
|
|
1721
|
+
}, children || "\u00A0"), React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
1722
|
+
icon: caretDownIcon__default["default"],
|
|
1723
|
+
color: iconColor,
|
|
1724
|
+
size: "small",
|
|
1725
|
+
style: styles$1.caret,
|
|
1726
|
+
"aria-hidden": "true"
|
|
1727
|
+
}));
|
|
1719
1728
|
}
|
|
1720
1729
|
}
|
|
1721
1730
|
SelectOpener.defaultProps = {
|
|
@@ -1764,61 +1773,91 @@ const _generateStyles = (light, placeholder, error) => {
|
|
|
1764
1773
|
}
|
|
1765
1774
|
let newStyles = {};
|
|
1766
1775
|
if (light) {
|
|
1776
|
+
const focusHoverStyling = {
|
|
1777
|
+
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.white,
|
|
1778
|
+
borderWidth: tokens__namespace.spacing.xxxxSmall_2,
|
|
1779
|
+
paddingLeft: adjustedPaddingLeft,
|
|
1780
|
+
paddingRight: adjustedPaddingRight
|
|
1781
|
+
};
|
|
1782
|
+
const activePressedStyling = {
|
|
1783
|
+
paddingLeft: adjustedPaddingLeft,
|
|
1784
|
+
paddingRight: adjustedPaddingRight,
|
|
1785
|
+
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.fadedBlue,
|
|
1786
|
+
borderWidth: tokens__namespace.border.width.thin,
|
|
1787
|
+
color: error ? tokens__namespace.color.offBlack64 : placeholder ? tokens.mix(tokens__namespace.color.white32, tokens__namespace.color.blue) : tokens__namespace.color.fadedBlue,
|
|
1788
|
+
backgroundColor: error ? tokens__namespace.color.fadedRed : tokens__namespace.color.activeBlue
|
|
1789
|
+
};
|
|
1767
1790
|
newStyles = {
|
|
1768
1791
|
default: {
|
|
1769
1792
|
background: error ? tokens__namespace.color.fadedRed8 : "transparent",
|
|
1770
|
-
color: placeholder ? tokens__namespace.color.white50 : tokens__namespace.color.white,
|
|
1793
|
+
color: error ? tokens__namespace.color.offBlack64 : placeholder ? tokens__namespace.color.white50 : tokens__namespace.color.white,
|
|
1771
1794
|
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.white50,
|
|
1772
|
-
borderWidth: tokens__namespace.border.width.hairline
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
borderWidth: tokens__namespace.border.width.thin,
|
|
1785
|
-
color: placeholder ? tokens.mix(tokens__namespace.color.white32, tokens__namespace.color.blue) : tokens__namespace.color.fadedBlue,
|
|
1786
|
-
backgroundColor: error ? tokens__namespace.color.fadedRed : tokens__namespace.color.activeBlue
|
|
1795
|
+
borderWidth: tokens__namespace.border.width.hairline,
|
|
1796
|
+
":hover:not([aria-disabled=true])": focusHoverStyling,
|
|
1797
|
+
["@media not (hover: hover)"]: {
|
|
1798
|
+
":hover:not([aria-disabled=true])": {
|
|
1799
|
+
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.white50,
|
|
1800
|
+
borderWidth: tokens__namespace.border.width.hairline,
|
|
1801
|
+
paddingLeft: tokens__namespace.spacing.medium_16,
|
|
1802
|
+
paddingRight: tokens__namespace.spacing.small_12
|
|
1803
|
+
}
|
|
1804
|
+
},
|
|
1805
|
+
":focus-visible:not([aria-disabled=true])": focusHoverStyling,
|
|
1806
|
+
":active:not([aria-disabled=true])": activePressedStyling
|
|
1787
1807
|
},
|
|
1788
1808
|
disabled: {
|
|
1789
1809
|
background: "transparent",
|
|
1790
1810
|
borderColor: tokens.mix(tokens__namespace.color.white32, tokens__namespace.color.blue),
|
|
1791
1811
|
color: tokens.mix(tokens__namespace.color.white32, tokens__namespace.color.blue),
|
|
1792
|
-
cursor: "
|
|
1793
|
-
|
|
1812
|
+
cursor: "not-allowed",
|
|
1813
|
+
":focus-visible": {
|
|
1814
|
+
boxShadow: `0 0 0 1px ${tokens__namespace.color.offBlack32}, 0 0 0 3px ${tokens__namespace.color.fadedBlue}`
|
|
1815
|
+
}
|
|
1816
|
+
},
|
|
1817
|
+
pressed: activePressedStyling
|
|
1794
1818
|
};
|
|
1795
1819
|
} else {
|
|
1820
|
+
const focusHoverStyling = {
|
|
1821
|
+
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.blue,
|
|
1822
|
+
borderWidth: tokens__namespace.border.width.thin,
|
|
1823
|
+
paddingLeft: adjustedPaddingLeft,
|
|
1824
|
+
paddingRight: adjustedPaddingRight
|
|
1825
|
+
};
|
|
1826
|
+
const activePressedStyling = {
|
|
1827
|
+
background: error ? tokens__namespace.color.fadedRed : tokens__namespace.color.fadedBlue,
|
|
1828
|
+
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.activeBlue,
|
|
1829
|
+
borderWidth: tokens__namespace.border.width.thin,
|
|
1830
|
+
paddingLeft: adjustedPaddingLeft,
|
|
1831
|
+
paddingRight: adjustedPaddingRight
|
|
1832
|
+
};
|
|
1796
1833
|
newStyles = {
|
|
1797
1834
|
default: {
|
|
1798
1835
|
background: error ? tokens__namespace.color.fadedRed8 : tokens__namespace.color.white,
|
|
1799
1836
|
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.offBlack16,
|
|
1800
1837
|
borderWidth: tokens__namespace.border.width.hairline,
|
|
1801
|
-
color: placeholder ? tokens__namespace.color.offBlack64 : tokens__namespace.color.offBlack
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
paddingLeft: adjustedPaddingLeft,
|
|
1814
|
-
paddingRight: adjustedPaddingRight
|
|
1838
|
+
color: placeholder ? tokens__namespace.color.offBlack64 : tokens__namespace.color.offBlack,
|
|
1839
|
+
":hover:not([aria-disabled=true])": focusHoverStyling,
|
|
1840
|
+
["@media not (hover: hover)"]: {
|
|
1841
|
+
":hover:not([aria-disabled=true])": {
|
|
1842
|
+
borderColor: error ? tokens__namespace.color.red : tokens__namespace.color.offBlack16,
|
|
1843
|
+
borderWidth: tokens__namespace.border.width.hairline,
|
|
1844
|
+
paddingLeft: tokens__namespace.spacing.medium_16,
|
|
1845
|
+
paddingRight: tokens__namespace.spacing.small_12
|
|
1846
|
+
}
|
|
1847
|
+
},
|
|
1848
|
+
":focus-visible:not([aria-disabled=true])": focusHoverStyling,
|
|
1849
|
+
":active:not([aria-disabled=true])": activePressedStyling
|
|
1815
1850
|
},
|
|
1816
1851
|
disabled: {
|
|
1817
1852
|
background: tokens__namespace.color.offWhite,
|
|
1818
1853
|
borderColor: tokens__namespace.color.offBlack16,
|
|
1819
1854
|
color: tokens__namespace.color.offBlack64,
|
|
1820
|
-
cursor: "
|
|
1821
|
-
|
|
1855
|
+
cursor: "not-allowed",
|
|
1856
|
+
":focus-visible": {
|
|
1857
|
+
boxShadow: `0 0 0 1px ${tokens__namespace.color.white}, 0 0 0 3px ${tokens__namespace.color.offBlack32}`
|
|
1858
|
+
}
|
|
1859
|
+
},
|
|
1860
|
+
pressed: activePressedStyling
|
|
1822
1861
|
};
|
|
1823
1862
|
}
|
|
1824
1863
|
stateStyles[styleKey] = aphrodite.StyleSheet.create(newStyles);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-dropdown",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.6",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"description": "Dropdown variants for Wonder Blocks.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@babel/runtime": "^7.18.6",
|
|
19
|
-
"@khanacademy/wonder-blocks-cell": "^3.3.
|
|
19
|
+
"@khanacademy/wonder-blocks-cell": "^3.3.7",
|
|
20
20
|
"@khanacademy/wonder-blocks-clickable": "^4.2.2",
|
|
21
21
|
"@khanacademy/wonder-blocks-core": "^6.4.1",
|
|
22
22
|
"@khanacademy/wonder-blocks-icon": "^4.1.1",
|
|
23
|
-
"@khanacademy/wonder-blocks-layout": "^2.0
|
|
24
|
-
"@khanacademy/wonder-blocks-modal": "^5.1.
|
|
25
|
-
"@khanacademy/wonder-blocks-search-field": "^2.2.
|
|
23
|
+
"@khanacademy/wonder-blocks-layout": "^2.1.0",
|
|
24
|
+
"@khanacademy/wonder-blocks-modal": "^5.1.4",
|
|
25
|
+
"@khanacademy/wonder-blocks-search-field": "^2.2.15",
|
|
26
26
|
"@khanacademy/wonder-blocks-timing": "^5.0.0",
|
|
27
27
|
"@khanacademy/wonder-blocks-tokens": "^1.3.0",
|
|
28
28
|
"@khanacademy/wonder-blocks-typography": "^2.1.12"
|