@khanacademy/wonder-blocks-button 11.3.2 → 11.3.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-button@11.3.2 build:css /home/runner/work/wonder-blocks/wonder-blocks/packages/wonder-blocks-button
2
+ > @khanacademy/wonder-blocks-button@11.3.4 build:css /home/runner/work/wonder-blocks/wonder-blocks/packages/wonder-blocks-button
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-button/dist/css
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @khanacademy/wonder-blocks-button
2
2
 
3
+ ## 11.3.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 12e04c3: Update component documentation for the `disabled` props to include details about `aria-disabled` being set internally to keep an element focusable while in a disabled state
8
+ - Updated dependencies [12e04c3]
9
+ - @khanacademy/wonder-blocks-clickable@8.1.3
10
+
11
+ ## 11.3.3
12
+
13
+ ### Patch Changes
14
+
15
+ - 61d61a9: Button: Removes unnecessary aria-hidden on start icon. This opens up the option
16
+ to add an accessible name to the icon if needed. By default, the start icon
17
+ isn't included in the accessibility tree because PhosphorIcon renders a `span`
18
+ and needs `role="image"` and the `aria-label` set explicitly.
19
+
3
20
  ## 11.3.2
4
21
 
5
22
  ### Patch Changes
@@ -34,24 +34,7 @@ export declare const ActivityButton: React.ForwardRefExoticComponent<Partial<Omi
34
34
  type?: "submit";
35
35
  className?: string;
36
36
  onClick?: (e: React.SyntheticEvent) => unknown;
37
- onMouseDown?: (e: React.MouseEvent /**
38
- * `ActivityButton` is a button that is used for actions in the context of
39
- * learner activities. It uses a "chonky" design, which is a more playful and
40
- * engaging design that is suitable for learner activities.
41
- *
42
- * ```tsx
43
- * import magnifyingGlassIcon from
44
- * "@phosphor-icons/core/regular/magnifying-glass.svg";
45
- * import {ActivityButton} from "@khanacademy/wonder-blocks-button";
46
- *
47
- * <ActivityButton
48
- * startIcon={magnifyingGlassIcon}
49
- * onClick={(e) => console.log("Hello, world!")}
50
- * >
51
- * Hello, world!
52
- * </ActivityButton>
53
- * ```
54
- */) => unknown;
37
+ onMouseDown?: (e: React.MouseEvent) => unknown;
55
38
  onMouseUp?: (e: React.MouseEvent) => unknown;
56
39
  onMouseEnter?: (e: React.MouseEvent) => unknown;
57
40
  onMouseLeave?: (e: React.MouseEvent) => unknown;
package/dist/es/index.js CHANGED
@@ -14,7 +14,7 @@ const textUnderlineOffset=sizing.size_040;const theme$2={root:{border:{width:{pr
14
14
 
15
15
  var theme$1 = mapValuesToCssVars(theme$2,"--wb-c-button-");
16
16
 
17
- function ButtonIcon({icon,size,style,testId}){const iconStyle={width:theme$1.icon.sizing[size],height:theme$1.icon.sizing[size]};const commonProps={"aria-hidden":true,style:[style,iconStyle],testId};const phosphorIconProps={...commonProps,color:"currentColor"};if(typeof icon!=="string"){return React.cloneElement(icon,commonProps)}switch(size){case"small":return jsx(PhosphorIcon,{...phosphorIconProps,size:"small",icon:icon});case"medium":default:return jsx(PhosphorIcon,{...phosphorIconProps,size:"medium",icon:icon})}}
17
+ function ButtonIcon({icon,size,style,testId}){const iconStyle={width:theme$1.icon.sizing[size],height:theme$1.icon.sizing[size]};const commonProps={style:[style,iconStyle],testId};const phosphorIconProps={...commonProps,color:"currentColor"};if(typeof icon!=="string"){return React.cloneElement(icon,commonProps)}switch(size){case"small":return jsx(PhosphorIcon,{...phosphorIconProps,size:"small",icon:icon});case"medium":default:return jsx(PhosphorIcon,{...phosphorIconProps,size:"medium",icon:icon})}}
18
18
 
19
19
  const StyledA=addStyle("a");const StyledButton=addStyle("button");const StyledLink=addStyle(Link);const ButtonUnstyled=React.forwardRef(function ButtonUnstyled(props,ref){const{children,disabled,href,id,skipClientNav,style,testId,type,...restProps}=props;const commonProps={"data-testid":testId,id:id,role:"button",style:[styles$2.reset,style],...restProps};const inRouterContext=useInRouterContext();if(href&&!disabled){return inRouterContext&&!skipClientNav&&isClientSideUrl(href)?jsx(StyledLink,{...commonProps,to:href,ref:ref,children:children}):jsx(StyledA,{...commonProps,href:href,ref:ref,children:children})}else {return jsx(StyledButton,{type:type||"button",...commonProps,"aria-disabled":disabled,ref:ref,children:children})}});const styles$2=StyleSheet.create({reset:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",margin:0,padding:0,border:"none",cursor:"pointer",outline:"none",textDecoration:"none",boxSizing:"border-box",touchAction:"manipulation",userSelect:"none",":focus":{WebkitTapHighlightColor:"rgba(0,0,0,0)"}}});
20
20
 
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ const textUnderlineOffset=wonderBlocksTokens.sizing.size_040;const theme$2={root
38
38
 
39
39
  var theme$1 = wonderBlocksTokens.mapValuesToCssVars(theme$2,"--wb-c-button-");
40
40
 
41
- function ButtonIcon({icon,size,style,testId}){const iconStyle={width:theme$1.icon.sizing[size],height:theme$1.icon.sizing[size]};const commonProps={"aria-hidden":true,style:[style,iconStyle],testId};const phosphorIconProps={...commonProps,color:"currentColor"};if(typeof icon!=="string"){return React__namespace.cloneElement(icon,commonProps)}switch(size){case"small":return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{...phosphorIconProps,size:"small",icon:icon});case"medium":default:return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{...phosphorIconProps,size:"medium",icon:icon})}}
41
+ function ButtonIcon({icon,size,style,testId}){const iconStyle={width:theme$1.icon.sizing[size],height:theme$1.icon.sizing[size]};const commonProps={style:[style,iconStyle],testId};const phosphorIconProps={...commonProps,color:"currentColor"};if(typeof icon!=="string"){return React__namespace.cloneElement(icon,commonProps)}switch(size){case"small":return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{...phosphorIconProps,size:"small",icon:icon});case"medium":default:return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{...phosphorIconProps,size:"medium",icon:icon})}}
42
42
 
43
43
  const StyledA=wonderBlocksCore.addStyle("a");const StyledButton=wonderBlocksCore.addStyle("button");const StyledLink=wonderBlocksCore.addStyle(reactRouterDomV5Compat.Link);const ButtonUnstyled=React__namespace.forwardRef(function ButtonUnstyled(props,ref){const{children,disabled,href,id,skipClientNav,style,testId,type,...restProps}=props;const commonProps={"data-testid":testId,id:id,role:"button",style:[styles$2.reset,style],...restProps};const inRouterContext=reactRouterDomV5Compat.useInRouterContext();if(href&&!disabled){return inRouterContext&&!skipClientNav&&wonderBlocksClickable.isClientSideUrl(href)?jsxRuntime.jsx(StyledLink,{...commonProps,to:href,ref:ref,children:children}):jsxRuntime.jsx(StyledA,{...commonProps,href:href,ref:ref,children:children})}else {return jsxRuntime.jsx(StyledButton,{type:type||"button",...commonProps,"aria-disabled":disabled,ref:ref,children:children})}});const styles$2=aphrodite.StyleSheet.create({reset:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",margin:0,padding:0,border:"none",cursor:"pointer",outline:"none",textDecoration:"none",boxSizing:"border-box",touchAction:"manipulation",userSelect:"none",":focus":{WebkitTapHighlightColor:"rgba(0,0,0,0)"}}});
44
44
 
@@ -46,6 +46,9 @@ Partial<Omit<AriaProps, "aria-disabled">> & {
46
46
  kind?: ButtonKind;
47
47
  /**
48
48
  * Whether the button is disabled.
49
+ *
50
+ * Internally, the `aria-disabled` attribute will be set so that the
51
+ * element remains focusable and will be included in the tab order.
49
52
  */
50
53
  disabled?: boolean;
51
54
  /**
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "11.3.2",
6
+ "version": "11.3.4",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -28,7 +28,7 @@
28
28
  "./styles.css": "./dist/css/vars.css"
29
29
  },
30
30
  "dependencies": {
31
- "@khanacademy/wonder-blocks-clickable": "8.1.2",
31
+ "@khanacademy/wonder-blocks-clickable": "8.1.3",
32
32
  "@khanacademy/wonder-blocks-core": "12.4.3",
33
33
  "@khanacademy/wonder-blocks-icon": "5.3.7",
34
34
  "@khanacademy/wonder-blocks-progress-spinner": "3.1.44",