@khanacademy/wonder-blocks-dropdown 10.5.3 → 10.5.4
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @khanacademy/wonder-blocks-dropdown@10.5.
|
|
2
|
+
> @khanacademy/wonder-blocks-dropdown@10.5.4 build:css /home/runner/work/wonder-blocks/wonder-blocks/packages/wonder-blocks-dropdown
|
|
3
3
|
> pnpm exec wonder-blocks-tokens .
|
|
4
4
|
|
|
5
5
|
CSS variables generated successfully in: /home/runner/work/wonder-blocks/wonder-blocks/packages/wonder-blocks-dropdown/dist/css
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-dropdown
|
|
2
2
|
|
|
3
|
+
## 10.5.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 415dd5a: Fixes DropdownOpener to propagate onBlur event correctly. This change allows to update the focused styles when the opener is blurred.
|
|
8
|
+
- Updated dependencies [8b713e2]
|
|
9
|
+
- @khanacademy/wonder-blocks-modal@8.5.7
|
|
10
|
+
|
|
3
11
|
## 10.5.3
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { AriaProps } from "@khanacademy/wonder-blocks-core";
|
|
3
|
-
import type { ChildrenProps, ClickableState } from "@khanacademy/wonder-blocks-clickable";
|
|
4
3
|
import type { OpenerProps, OptionLabel } from "../util/types";
|
|
5
|
-
|
|
4
|
+
declare const DropdownOpener: React.ForwardRefExoticComponent<Partial<Omit<AriaProps, "aria-disabled">> & {
|
|
6
5
|
/**
|
|
7
6
|
* The child function that returns the anchor the Dropdown will be activated
|
|
8
7
|
* by. This function takes two arguments:
|
|
@@ -14,7 +13,7 @@ type Props = Partial<Omit<AriaProps, "aria-disabled">> & {
|
|
|
14
13
|
/**
|
|
15
14
|
* Whether the opener is disabled. If disabled, disallows interaction.
|
|
16
15
|
*/
|
|
17
|
-
disabled
|
|
16
|
+
disabled?: boolean;
|
|
18
17
|
/**
|
|
19
18
|
* Callback for when the opener is pressed.
|
|
20
19
|
*/
|
|
@@ -47,14 +46,5 @@ type Props = Partial<Omit<AriaProps, "aria-disabled">> & {
|
|
|
47
46
|
* The role of the opener.
|
|
48
47
|
*/
|
|
49
48
|
role: "combobox" | "button";
|
|
50
|
-
}
|
|
51
|
-
type DefaultProps = {
|
|
52
|
-
disabled: Props["disabled"];
|
|
53
|
-
};
|
|
54
|
-
declare class DropdownOpener extends React.Component<Props> {
|
|
55
|
-
static defaultProps: DefaultProps;
|
|
56
|
-
getTestIdFromProps: (childrenProps?: any) => string;
|
|
57
|
-
renderAnchorChildren(eventState: ClickableState, clickableChildrenProps: ChildrenProps): React.ReactElement;
|
|
58
|
-
render(): React.ReactNode;
|
|
59
|
-
}
|
|
49
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
60
50
|
export default DropdownOpener;
|
package/dist/es/index.js
CHANGED
|
@@ -42,7 +42,7 @@ class OptionItem extends React.Component{static isClassOf(instance){return insta
|
|
|
42
42
|
|
|
43
43
|
class SeparatorItem extends React.Component{static isClassOf(instance){return instance&&instance.type&&instance.type.__IS_SEPARATOR_ITEM__}render(){return jsx(View,{style:[styles$8.separator,this.props.style],"aria-hidden":"true"})}}SeparatorItem.__IS_SEPARATOR_ITEM__=true;const styles$8=StyleSheet.create({separator:{borderTop:`${border.width.thin} solid ${semanticColor.core.border.neutral.subtle}`,height:1,minHeight:1,marginBlock:sizing.size_040}});
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
const DropdownOpener=React.forwardRef((props,ref)=>{const{disabled=false,testId,text,opened,"aria-controls":ariaControls,"aria-haspopup":ariaHasPopUp,"aria-required":ariaRequired,"aria-label":ariaLabel,id,role,onBlur,onClick,children,error}=props;const renderAnchorChildren=(eventState,clickableChildrenProps)=>{const renderedChildren=children({...eventState,text,opened});const childrenProps=renderedChildren.props;const childrenTestId=childrenProps?.testId||childrenProps?.["data-testid"];const renderedAriaLabel=childrenProps["aria-label"]??ariaLabel;return React.cloneElement(renderedChildren,{...clickableChildrenProps,ref,"aria-label":renderedAriaLabel??undefined,"aria-invalid":error,disabled,"aria-controls":ariaControls,role,id,"aria-expanded":opened?"true":"false","aria-haspopup":ariaHasPopUp,"aria-required":ariaRequired,onClick:childrenProps.onClick?e=>{childrenProps.onClick(e);clickableChildrenProps.onClick(e);}:clickableChildrenProps.onClick,"data-testid":childrenTestId||testId,onBlur:onBlur?e=>{onBlur(e);clickableChildrenProps.onBlur(e);}:clickableChildrenProps.onBlur})};return jsx(ClickableBehavior,{onClick:onClick,disabled:disabled,tabIndex:0,children:(eventState,handlers)=>renderAnchorChildren(eventState,handlers)})});DropdownOpener.displayName="DropdownOpener";
|
|
46
46
|
|
|
47
47
|
class DropdownVirtualizedItem extends React.Component{render(){const{data,index,style}=this.props;const item=data[index];if(SeparatorItem.isClassOf(item.component)){return React.cloneElement(item.component,{style})}else {const{component,populatedProps,onClick,role,ref}=item;return React.cloneElement(component,{style,...populatedProps,key:index,onClick,ref:item.focusable&&ref,role})}}}
|
|
48
48
|
|
package/dist/index.js
CHANGED
|
@@ -74,7 +74,7 @@ class OptionItem extends React__namespace.Component{static isClassOf(instance){r
|
|
|
74
74
|
|
|
75
75
|
class SeparatorItem extends React__namespace.Component{static isClassOf(instance){return instance&&instance.type&&instance.type.__IS_SEPARATOR_ITEM__}render(){return jsxRuntime.jsx(wonderBlocksCore.View,{style:[styles$8.separator,this.props.style],"aria-hidden":"true"})}}SeparatorItem.__IS_SEPARATOR_ITEM__=true;const styles$8=aphrodite.StyleSheet.create({separator:{borderTop:`${wonderBlocksTokens.border.width.thin} solid ${wonderBlocksTokens.semanticColor.core.border.neutral.subtle}`,height:1,minHeight:1,marginBlock:wonderBlocksTokens.sizing.size_040}});
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
const DropdownOpener=React__namespace.forwardRef((props,ref)=>{const{disabled=false,testId,text,opened,"aria-controls":ariaControls,"aria-haspopup":ariaHasPopUp,"aria-required":ariaRequired,"aria-label":ariaLabel,id,role,onBlur,onClick,children,error}=props;const renderAnchorChildren=(eventState,clickableChildrenProps)=>{const renderedChildren=children({...eventState,text,opened});const childrenProps=renderedChildren.props;const childrenTestId=childrenProps?.testId||childrenProps?.["data-testid"];const renderedAriaLabel=childrenProps["aria-label"]??ariaLabel;return React__namespace.cloneElement(renderedChildren,{...clickableChildrenProps,ref,"aria-label":renderedAriaLabel??undefined,"aria-invalid":error,disabled,"aria-controls":ariaControls,role,id,"aria-expanded":opened?"true":"false","aria-haspopup":ariaHasPopUp,"aria-required":ariaRequired,onClick:childrenProps.onClick?e=>{childrenProps.onClick(e);clickableChildrenProps.onClick(e);}:clickableChildrenProps.onClick,"data-testid":childrenTestId||testId,onBlur:onBlur?e=>{onBlur(e);clickableChildrenProps.onBlur(e);}:clickableChildrenProps.onBlur})};return jsxRuntime.jsx(wonderBlocksClickable.ClickableBehavior,{onClick:onClick,disabled:disabled,tabIndex:0,children:(eventState,handlers)=>renderAnchorChildren(eventState,handlers)})});DropdownOpener.displayName="DropdownOpener";
|
|
78
78
|
|
|
79
79
|
class DropdownVirtualizedItem extends React__namespace.Component{render(){const{data,index,style}=this.props;const item=data[index];if(SeparatorItem.isClassOf(item.component)){return React__namespace.cloneElement(item.component,{style})}else {const{component,populatedProps,onClick,role,ref}=item;return React__namespace.cloneElement(component,{style,...populatedProps,key:index,onClick,ref:item.focusable&&ref,role})}}}
|
|
80
80
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Dropdown variants for Wonder Blocks.",
|
|
4
4
|
"author": "Khan Academy",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "10.5.
|
|
6
|
+
"version": "10.5.4",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@khanacademy/wonder-blocks-form": "7.4.5",
|
|
36
36
|
"@khanacademy/wonder-blocks-icon": "5.3.4",
|
|
37
37
|
"@khanacademy/wonder-blocks-icon-button": "10.5.7",
|
|
38
|
-
"@khanacademy/wonder-blocks-modal": "8.5.
|
|
38
|
+
"@khanacademy/wonder-blocks-modal": "8.5.7",
|
|
39
39
|
"@khanacademy/wonder-blocks-pill": "3.1.47",
|
|
40
40
|
"@khanacademy/wonder-blocks-search-field": "5.1.53",
|
|
41
41
|
"@khanacademy/wonder-blocks-styles": "0.2.36",
|