@khanacademy/wonder-blocks-button 10.0.4 → 10.1.0

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@10.0.4 build:css /home/runner/work/wonder-blocks/wonder-blocks/packages/wonder-blocks-button
2
+ > @khanacademy/wonder-blocks-button@10.1.0 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,33 @@
1
1
  # @khanacademy/wonder-blocks-button
2
2
 
3
+ ## 10.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 7c59ffd: Adds the `thunderblocks` theme to the `Button` component.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [8468d8d]
12
+ - Updated dependencies [308696e]
13
+ - Updated dependencies [dc34e0c]
14
+ - Updated dependencies [2cace08]
15
+ - Updated dependencies [f714517]
16
+ - Updated dependencies [8468d8d]
17
+ - @khanacademy/wonder-blocks-tokens@10.5.0
18
+ - @khanacademy/wonder-blocks-icon@5.2.0
19
+ - @khanacademy/wonder-blocks-clickable@7.1.6
20
+ - @khanacademy/wonder-blocks-progress-spinner@3.1.17
21
+ - @khanacademy/wonder-blocks-styles@0.2.13
22
+ - @khanacademy/wonder-blocks-typography@4.2.1
23
+
24
+ ## 10.0.5
25
+
26
+ ### Patch Changes
27
+
28
+ - Updated dependencies [6998d03]
29
+ - @khanacademy/wonder-blocks-typography@4.2.0
30
+
3
31
  ## 10.0.4
4
32
 
5
33
  ### Patch Changes
package/dist/css/vars.css CHANGED
@@ -5,27 +5,83 @@
5
5
  --wb-c-button-root-border-width-secondary-hover: var(--wb-border-width-thin);
6
6
  --wb-c-button-root-border-width-secondary-press: var(--wb-border-width-thin);
7
7
  --wb-c-button-root-border-width-tertiary-default: var(--wb-border-width-none);
8
- --wb-c-button-root-border-width-tertiary-hover: var(--wb-border-width-medium);
9
- --wb-c-button-root-border-width-tertiary-press: var(--wb-border-width-medium);
8
+ --wb-c-button-root-border-width-tertiary-hover: var(--wb-border-width-none);
9
+ --wb-c-button-root-border-width-tertiary-press: var(--wb-border-width-none);
10
10
  --wb-c-button-root-border-offset-primary: var(--wb-border-width-medium);
11
11
  --wb-c-button-root-border-offset-secondary: 0;
12
12
  --wb-c-button-root-border-offset-tertiary: 0;
13
- --wb-c-button-root-border-radius-small: var(--wb-border-radius-radius_040);
14
- --wb-c-button-root-border-radius-medium: var(--wb-border-radius-radius_040);
15
- --wb-c-button-root-border-radius-large: var(--wb-border-radius-radius_040);
13
+ --wb-c-button-root-border-radius-default: var(--wb-border-radius-radius_040);
14
+ --wb-c-button-root-border-radius-hover: var(--wb-border-radius-radius_040);
15
+ --wb-c-button-root-border-radius-press: var(--wb-border-radius-radius_040);
16
16
  --wb-c-button-root-sizing-height-small: var(--wb-sizing-size_320);
17
17
  --wb-c-button-root-sizing-height-medium: var(--wb-sizing-size_400);
18
18
  --wb-c-button-root-sizing-height-large: var(--wb-sizing-size_560);
19
19
  --wb-c-button-root-sizing-underline-hover: var(--wb-sizing-size_020);
20
20
  --wb-c-button-root-sizing-underline-press: var(--wb-sizing-size_010);
21
- --wb-c-button-root-padding-medium: var(--wb-sizing-size_160);
22
- --wb-c-button-root-padding-large: var(--wb-sizing-size_320);
21
+ --wb-c-button-root-layout-padding-inline-primary-small: var(--wb-sizing-size_160);
22
+ --wb-c-button-root-layout-padding-inline-primary-medium: var(--wb-sizing-size_160);
23
+ --wb-c-button-root-layout-padding-inline-primary-large: var(--wb-sizing-size_320);
24
+ --wb-c-button-root-layout-padding-inline-secondary-small: var(--wb-sizing-size_120);
25
+ --wb-c-button-root-layout-padding-inline-secondary-medium: var(--wb-sizing-size_160);
26
+ --wb-c-button-root-layout-padding-inline-secondary-large: var(--wb-sizing-size_180);
27
+ --wb-c-button-root-layout-padding-inline-tertiary-small: var(--wb-sizing-size_0);
28
+ --wb-c-button-root-layout-padding-inline-tertiary-medium: var(--wb-sizing-size_0);
29
+ --wb-c-button-root-layout-padding-inline-tertiary-large: var(--wb-sizing-size_0);
23
30
  --wb-c-button-root-font-size-large: 1.8rem;
24
31
  --wb-c-button-root-font-lineHeight-small: var(--wb-font-lineHeight-xMedium);
25
32
  --wb-c-button-root-font-lineHeight-default: var(--wb-font-lineHeight-large);
26
33
  --wb-c-button-root-font-lineHeight-large: 2.6rem;
27
34
  --wb-c-button-root-font-weight-default: var(--wb-font-weight-bold);
35
+ --wb-c-button-root-font-decoration-hover: underline;
36
+ --wb-c-button-root-font-decoration-press: underline;
28
37
  --wb-c-button-root-font-offset-default: var(--wb-sizing-size_040);
29
38
  --wb-c-button-icon-margin-inline-inner: var(--wb-sizing-size_060);
30
39
  --wb-c-button-icon-margin-inline-outer: calc(-1 * var(--wb-border-width-medium));
31
- --wb-c-button-icon-padding: var(--wb-sizing-size_020);}
40
+ --wb-c-button-icon-padding: var(--wb-sizing-size_020);
41
+ --wb-c-button-icon-sizing-small: var(--wb-sizing-size_160);
42
+ --wb-c-button-icon-sizing-medium: var(--wb-sizing-size_240);
43
+ --wb-c-button-icon-sizing-large: var(--wb-sizing-size_240);}
44
+
45
+ [data-wb-theme='thunderblocks'] {--wb-c-button-root-border-width-primary-default: var(--wb-border-width-none);
46
+ --wb-c-button-root-border-width-primary-hover: var(--wb-border-width-none);
47
+ --wb-c-button-root-border-width-primary-press: var(--wb-border-width-none);
48
+ --wb-c-button-root-border-width-secondary-default: var(--wb-border-width-thin);
49
+ --wb-c-button-root-border-width-secondary-hover: var(--wb-border-width-thin);
50
+ --wb-c-button-root-border-width-secondary-press: var(--wb-border-width-thin);
51
+ --wb-c-button-root-border-width-tertiary-default: var(--wb-border-width-none);
52
+ --wb-c-button-root-border-width-tertiary-hover: var(--wb-border-width-medium);
53
+ --wb-c-button-root-border-width-tertiary-press: var(--wb-border-width-medium);
54
+ --wb-c-button-root-border-offset-primary: var(--wb-border-width-medium);
55
+ --wb-c-button-root-border-offset-secondary: 0;
56
+ --wb-c-button-root-border-offset-tertiary: 0;
57
+ --wb-c-button-root-border-radius-default: var(--wb-border-radius-radius_080);
58
+ --wb-c-button-root-border-radius-hover: var(--wb-border-radius-radius_080);
59
+ --wb-c-button-root-border-radius-press: var(--wb-border-radius-radius_120);
60
+ --wb-c-button-root-sizing-height-small: var(--wb-sizing-size_260);
61
+ --wb-c-button-root-sizing-height-medium: var(--wb-sizing-size_400);
62
+ --wb-c-button-root-sizing-height-large: var(--wb-sizing-size_440);
63
+ --wb-c-button-root-sizing-underline-hover: var(--wb-sizing-size_0);
64
+ --wb-c-button-root-sizing-underline-press: var(--wb-sizing-size_0);
65
+ --wb-c-button-root-layout-padding-inline-primary-small: var(--wb-sizing-size_080);
66
+ --wb-c-button-root-layout-padding-inline-primary-medium: var(--wb-sizing-size_160);
67
+ --wb-c-button-root-layout-padding-inline-primary-large: var(--wb-sizing-size_180);
68
+ --wb-c-button-root-layout-padding-inline-secondary-small: var(--wb-sizing-size_080);
69
+ --wb-c-button-root-layout-padding-inline-secondary-medium: var(--wb-sizing-size_160);
70
+ --wb-c-button-root-layout-padding-inline-secondary-large: var(--wb-sizing-size_180);
71
+ --wb-c-button-root-layout-padding-inline-tertiary-small: var(--wb-sizing-size_080);
72
+ --wb-c-button-root-layout-padding-inline-tertiary-medium: var(--wb-sizing-size_160);
73
+ --wb-c-button-root-layout-padding-inline-tertiary-large: var(--wb-sizing-size_180);
74
+ --wb-c-button-root-font-size-large: 1.8rem;
75
+ --wb-c-button-root-font-lineHeight-small: var(--wb-font-lineHeight-xMedium);
76
+ --wb-c-button-root-font-lineHeight-default: var(--wb-font-lineHeight-large);
77
+ --wb-c-button-root-font-lineHeight-large: 2.6rem;
78
+ --wb-c-button-root-font-weight-default: var(--wb-font-weight-bold);
79
+ --wb-c-button-root-font-decoration-hover: none;
80
+ --wb-c-button-root-font-decoration-press: none;
81
+ --wb-c-button-root-font-offset-default: var(--wb-sizing-size_0);
82
+ --wb-c-button-icon-margin-inline-inner: var(--wb-sizing-size_060);
83
+ --wb-c-button-icon-margin-inline-outer: calc(-1 * var(--wb-border-width-medium));
84
+ --wb-c-button-icon-padding: var(--wb-sizing-size_020);
85
+ --wb-c-button-icon-sizing-small: var(--wb-sizing-size_120);
86
+ --wb-c-button-icon-sizing-medium: var(--wb-sizing-size_180);
87
+ --wb-c-button-icon-sizing-large: var(--wb-sizing-size_200);}
package/dist/es/index.js CHANGED
@@ -10,15 +10,15 @@ import { focusStyles } from '@khanacademy/wonder-blocks-styles';
10
10
  import { sizing, border, font, mapValuesToCssVars, semanticColor } from '@khanacademy/wonder-blocks-tokens';
11
11
  import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
12
12
 
13
- function ButtonIcon({icon,size,style,testId}){const commonProps={"aria-hidden":true,color:"currentColor",style:style,testId};switch(size){case"small":return jsx(PhosphorIcon,{...commonProps,size:"small",icon:icon});case"medium":default:return jsx(PhosphorIcon,{...commonProps,size:"medium",icon:icon})}}
14
-
15
- const textUnderlineOffset=sizing.size_040;const theme$1={root:{border:{width:{primary:{default:border.width.none,hover:border.width.medium,press:border.width.medium},secondary:{default:border.width.thin,hover:border.width.thin,press:border.width.thin},tertiary:{default:border.width.none,hover:border.width.medium,press:border.width.medium}},offset:{primary:border.width.medium,secondary:0,tertiary:0},radius:{small:border.radius.radius_040,medium:border.radius.radius_040,large:border.radius.radius_040}},sizing:{height:{small:sizing.size_320,medium:sizing.size_400,large:sizing.size_560},underline:{hover:sizing.size_020,press:sizing.size_010}},padding:{medium:sizing.size_160,large:sizing.size_320},font:{size:{large:"1.8rem"},lineHeight:{small:font.lineHeight.xMedium,default:font.lineHeight.large,large:"2.6rem"},weight:{default:font.weight.bold},offset:{default:textUnderlineOffset}}},icon:{margin:{inline:{inner:sizing.size_060,outer:`calc(-1 * ${border.width.medium})`}},padding:sizing.size_020}};
13
+ const textUnderlineOffset=sizing.size_040;const theme$1={root:{border:{width:{primary:{default:border.width.none,hover:border.width.medium,press:border.width.medium},secondary:{default:border.width.thin,hover:border.width.thin,press:border.width.thin},tertiary:{default:border.width.none,hover:border.width.none,press:border.width.none}},offset:{primary:border.width.medium,secondary:0,tertiary:0},radius:{default:border.radius.radius_040,hover:border.radius.radius_040,press:border.radius.radius_040}},sizing:{height:{small:sizing.size_320,medium:sizing.size_400,large:sizing.size_560},underline:{hover:sizing.size_020,press:sizing.size_010}},layout:{padding:{inline:{primary:{small:sizing.size_160,medium:sizing.size_160,large:sizing.size_320},secondary:{small:sizing.size_120,medium:sizing.size_160,large:sizing.size_180},tertiary:{small:sizing.size_0,medium:sizing.size_0,large:sizing.size_0}}}},font:{size:{large:"1.8rem"},lineHeight:{small:font.lineHeight.xMedium,default:font.lineHeight.large,large:"2.6rem"},weight:{default:font.weight.bold},decoration:{hover:"underline",press:"underline"},offset:{default:textUnderlineOffset}}},icon:{margin:{inline:{inner:sizing.size_060,outer:`calc(-1 * ${border.width.medium})`}},padding:sizing.size_020,sizing:{small:sizing.size_160,medium:sizing.size_240,large:sizing.size_240}}};
16
14
 
17
15
  var theme = mapValuesToCssVars(theme$1,"--wb-c-button-");
18
16
 
17
+ function ButtonIcon({icon,size,style,testId}){const iconStyle={width:theme.icon.sizing[size],height:theme.icon.sizing[size]};const commonProps={"aria-hidden":true,color:"currentColor",style:[style,iconStyle],testId};switch(size){case"small":return jsx(PhosphorIcon,{...commonProps,size:"small",icon:icon});case"medium":default:return jsx(PhosphorIcon,{...commonProps,size:"medium",icon:icon})}}
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$1.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$1=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
 
21
- const ButtonCore=React.forwardRef(function ButtonCore(props,ref){const{children,skipClientNav,actionType,disabled:disabledProp,focused,hovered,href=undefined,kind="primary",labelStyle,pressed,size="medium",style,testId,type=undefined,spinner,startIcon,endIcon,id,waiting:_,...restProps}=props;const buttonStyles=_generateStyles(actionType,kind,size);const disabled=spinner||disabledProp;const defaultStyle=[sharedStyles.shared,startIcon&&sharedStyles.withStartIcon,endIcon&&sharedStyles.withEndIcon,buttonStyles.default,disabled&&buttonStyles.disabled,!disabled&&(pressed?buttonStyles.pressed:focused&&buttonStyles.focused),size==="small"&&sharedStyles.small,size==="large"&&sharedStyles.large];const Label=size==="small"?LabelSmall:LabelLarge;const label=jsx(Label,{style:[sharedStyles.text,size==="small"&&sharedStyles.smallText,size==="large"&&sharedStyles.largeText,labelStyle,spinner&&sharedStyles.hiddenText,kind==="tertiary"&&!disabled&&(pressed?[buttonStyles.hover,buttonStyles.active]:hovered&&buttonStyles.hover)],testId:testId?`${testId}-inner-label`:undefined,children:children});const sizeMapping={medium:"small",small:"xsmall",large:"medium"};const iconSize=size==="small"?"small":"medium";const contents=jsxs(React.Fragment,{children:[startIcon&&jsx(View,{style:sharedStyles.iconWrapper,children:jsx(ButtonIcon,{size:iconSize,icon:startIcon,style:[sharedStyles.startIcon,kind==="tertiary"&&sharedStyles.tertiaryStartIcon],testId:testId?`${testId}-start-icon`:undefined})}),label,spinner&&jsx(CircularSpinner,{style:sharedStyles.spinner,size:sizeMapping[size],light:kind==="primary",testId:`${testId||"button"}-spinner`}),endIcon&&jsx(View,{testId:testId?`${testId}-end-icon-wrapper`:undefined,style:[styles.endIcon,sharedStyles.iconWrapper,sharedStyles.endIconWrapper,kind==="tertiary"&&sharedStyles.endIconWrapperTertiary],children:jsx(ButtonIcon,{size:iconSize,icon:endIcon,testId:testId?`${testId}-end-icon`:undefined})})]});return jsx(ButtonUnstyled,{...restProps,disabled:disabled,href:href,id:id,ref:ref,skipClientNav:skipClientNav,style:[defaultStyle,style],testId:testId,tabIndex:props.tabIndex,type:type,children:contents})});const sharedStyles=StyleSheet.create({shared:{height:theme.root.sizing.height.medium,paddingBlock:0,paddingInline:theme.root.padding.medium},small:{borderRadius:theme.root.border.radius.small,height:theme.root.sizing.height.small},large:{borderRadius:theme.root.border.radius.large,height:theme.root.sizing.height.large},text:{alignItems:"center",fontWeight:theme.root.font.weight.default,whiteSpace:"nowrap",overflow:"hidden",lineHeight:theme.root.font.lineHeight.default,textOverflow:"ellipsis",display:"inline-block",pointerEvents:"none"},smallText:{lineHeight:theme.root.font.lineHeight.small},largeText:{fontSize:theme.root.font.size.large,lineHeight:theme.root.font.lineHeight.large},hiddenText:{visibility:"hidden"},spinner:{position:"absolute"},startIcon:{marginInlineStart:theme.icon.margin.inline.outer,marginInlineEnd:theme.icon.margin.inline.inner},tertiaryStartIcon:{marginInlineStart:0},endIcon:{marginInlineStart:theme.icon.margin.inline.inner},iconWrapper:{padding:theme.icon.padding,minWidth:"auto"},endIconWrapper:{marginInlineStart:theme.icon.margin.inline.inner,marginInlineEnd:theme.icon.margin.inline.outer},endIconWrapperTertiary:{marginInlineEnd:0}});const styles={};const _generateStyles=(actionType="progressive",kind,size)=>{const buttonType=`${actionType}-${kind}-${size}`;if(styles[buttonType]){return styles[buttonType]}const padding=size==="large"?theme.root.padding.large:theme.root.padding.medium;const borderWidthKind=theme.root.border.width[kind];const outlineOffsetKind=theme.root.border.offset[kind];const themeVariant=semanticColor.action[kind][actionType];const disabledState=semanticColor.action[kind].disabled;const disabledStatesStyles={borderColor:disabledState.border,borderWidth:borderWidthKind.default,background:disabledState.background,color:disabledState.foreground};const disabledStatesOverrides={...disabledStatesStyles,outline:"none",boxShadow:"none",textDecoration:"none",textDecorationThickness:"unset",textUnderlineOffset:"unset"};const newStyles={default:{borderRadius:theme.root.border.radius[size],paddingInline:kind==="tertiary"?0:padding,borderStyle:"solid",borderWidth:borderWidthKind.default,borderColor:themeVariant.default.border,background:themeVariant.default.background,color:themeVariant.default.foreground,":hover":{background:themeVariant.hover.background,color:themeVariant.hover.foreground,...kind==="primary"?{outline:`${borderWidthKind.hover} solid ${themeVariant.hover.border}`,outlineOffset:outlineOffsetKind}:undefined,...kind==="secondary"?{borderColor:themeVariant.hover.border,boxShadow:`inset 0 0 0 ${borderWidthKind.hover} ${themeVariant.hover.border}`}:undefined,...kind==="tertiary"?{textDecoration:"underline",textUnderlineOffset:theme.root.font.offset.default,textDecorationThickness:theme.root.sizing.underline.hover}:undefined},["@media not (hover: hover)"]:{":hover":{backgroundColor:"transparent"}},":active":{background:themeVariant.press.background,color:themeVariant.press.foreground,...kind==="primary"?{outline:`${borderWidthKind.press} solid ${themeVariant.press.border}`,outlineOffset:outlineOffsetKind}:undefined,...kind==="secondary"?{borderColor:themeVariant.press.border,boxShadow:`inset 0 0 0 ${borderWidthKind.press} ${themeVariant.press.border}`}:undefined,...kind==="tertiary"?{textDecoration:"underline",textUnderlineOffset:theme.root.font.offset.default,textDecorationThickness:theme.root.sizing.underline.press}:undefined},...focusStyles.focus,...kind==="secondary"?{":focus-visible:hover":{...focusStyles.focus[":focus-visible"],boxShadow:`inset 0 0 0 ${borderWidthKind.hover} ${themeVariant.hover.border}, ${focusStyles.focus[":focus-visible"].boxShadow}`},":focus-visible:active":{...focusStyles.focus[":focus-visible"],boxShadow:`inset 0 0 0 ${borderWidthKind.press} ${themeVariant.press.border}, ${focusStyles.focus[":focus-visible"].boxShadow}`}}:{}},disabled:{cursor:"not-allowed",...disabledStatesStyles,":hover":disabledStatesOverrides,":active":disabledStatesOverrides,":focus-visible":disabledStatesStyles}};styles[buttonType]=StyleSheet.create(newStyles);return styles[buttonType]};
21
+ const ButtonCore=React.forwardRef(function ButtonCore(props,ref){const{children,skipClientNav,actionType,disabled:disabledProp,focused,hovered,href=undefined,kind="primary",labelStyle,pressed,size="medium",style,testId,type=undefined,spinner,startIcon,endIcon,id,waiting:_,...restProps}=props;const buttonStyles=_generateStyles(actionType,kind,size);const disabled=spinner||disabledProp;const defaultStyle=[sharedStyles.shared,startIcon&&sharedStyles.withStartIcon,endIcon&&sharedStyles.withEndIcon,buttonStyles.default,disabled&&buttonStyles.disabled,!disabled&&(pressed?buttonStyles.pressed:focused&&buttonStyles.focused),size==="small"&&sharedStyles.small,size==="large"&&sharedStyles.large];const Label=size==="small"?LabelSmall:LabelLarge;const label=jsx(Label,{style:[sharedStyles.text,size==="small"&&sharedStyles.smallText,size==="large"&&sharedStyles.largeText,labelStyle,spinner&&sharedStyles.hiddenText,kind==="tertiary"&&!disabled&&(pressed?[buttonStyles.hover,buttonStyles.active]:hovered&&buttonStyles.hover)],testId:testId?`${testId}-inner-label`:undefined,children:children});const sizeMapping={medium:"small",small:"xsmall",large:"medium"};const iconSize=size==="small"?"small":"medium";const contents=jsxs(React.Fragment,{children:[startIcon&&jsx(View,{style:sharedStyles.iconWrapper,children:jsx(ButtonIcon,{size:iconSize,icon:startIcon,style:[sharedStyles.startIcon,kind==="tertiary"&&sharedStyles.tertiaryStartIcon],testId:testId?`${testId}-start-icon`:undefined})}),label,spinner&&jsx(CircularSpinner,{style:sharedStyles.spinner,size:sizeMapping[size],light:kind==="primary",testId:`${testId||"button"}-spinner`}),endIcon&&jsx(View,{testId:testId?`${testId}-end-icon-wrapper`:undefined,style:[styles.endIcon,sharedStyles.iconWrapper,sharedStyles.endIconWrapper,kind==="tertiary"&&sharedStyles.endIconWrapperTertiary],children:jsx(ButtonIcon,{size:iconSize,icon:endIcon,testId:testId?`${testId}-end-icon`:undefined})})]});return jsx(ButtonUnstyled,{...restProps,disabled:disabled,href:href,id:id,ref:ref,skipClientNav:skipClientNav,style:[defaultStyle,style],testId:testId,tabIndex:props.tabIndex,type:type,children:contents})});const sharedStyles=StyleSheet.create({shared:{height:theme.root.sizing.height.medium,paddingBlock:0},small:{height:theme.root.sizing.height.small},large:{height:theme.root.sizing.height.large},text:{alignItems:"center",fontWeight:theme.root.font.weight.default,whiteSpace:"nowrap",overflow:"hidden",lineHeight:theme.root.font.lineHeight.default,textOverflow:"ellipsis",display:"inline-block",pointerEvents:"none"},smallText:{lineHeight:theme.root.font.lineHeight.small},largeText:{fontSize:theme.root.font.size.large,lineHeight:theme.root.font.lineHeight.large},hiddenText:{visibility:"hidden"},spinner:{position:"absolute"},startIcon:{marginInlineStart:theme.icon.margin.inline.outer,marginInlineEnd:theme.icon.margin.inline.inner},tertiaryStartIcon:{marginInlineStart:0},endIcon:{marginInlineStart:theme.icon.margin.inline.inner},iconWrapper:{padding:theme.icon.padding,minWidth:"auto"},endIconWrapper:{marginInlineStart:theme.icon.margin.inline.inner,marginInlineEnd:theme.icon.margin.inline.outer},endIconWrapperTertiary:{marginInlineEnd:0}});const styles={};const _generateStyles=(actionType="progressive",kind,size)=>{const buttonType=`${actionType}-${kind}-${size}`;if(styles[buttonType]){return styles[buttonType]}const paddingInline=theme.root.layout.padding.inline[kind][size];const borderWidthKind=theme.root.border.width[kind];const outlineOffsetKind=theme.root.border.offset[kind];const themeVariant=semanticColor.action[kind][actionType];const disabledState=semanticColor.action[kind].disabled;const disabledStatesStyles={borderColor:disabledState.border,borderWidth:borderWidthKind.default,borderRadius:theme.root.border.radius.default,background:disabledState.background,color:disabledState.foreground};const disabledStatesOverrides={...disabledStatesStyles,outline:"none",boxShadow:"none",textDecoration:"none",textDecorationThickness:"unset",textUnderlineOffset:"unset"};const pressStyles={background:themeVariant.press.background,borderRadius:theme.root.border.radius.press,color:themeVariant.press.foreground,...kind==="primary"?{outline:`${borderWidthKind.press} solid ${themeVariant.press.border}`,outlineOffset:outlineOffsetKind}:undefined,...kind!=="primary"?{borderColor:themeVariant.press.border,boxShadow:`inset 0 0 0 ${borderWidthKind.press} ${themeVariant.press.border}`}:undefined,...kind==="tertiary"?{textUnderlineOffset:theme.root.font.offset.default,textDecoration:`${theme.root.font.decoration.press} ${theme.root.sizing.underline.press}`}:undefined};const newStyles={default:{borderRadius:theme.root.border.radius.default,paddingInline:paddingInline,borderStyle:"solid",borderWidth:borderWidthKind.default,borderColor:themeVariant.default.border,background:themeVariant.default.background,color:themeVariant.default.foreground,transition:"border-radius 0.1s ease-in-out",":hover":{background:themeVariant.hover.background,borderRadius:theme.root.border.radius.hover,color:themeVariant.hover.foreground,...kind==="primary"?{outline:`${borderWidthKind.hover} solid ${themeVariant.hover.border}`,outlineOffset:outlineOffsetKind}:undefined,...kind!=="primary"?{borderColor:themeVariant.hover.border,boxShadow:`inset 0 0 0 ${borderWidthKind.hover} ${themeVariant.hover.border}`}:undefined,...kind==="tertiary"?{textUnderlineOffset:theme.root.font.offset.default,textDecoration:`${theme.root.font.decoration.hover} ${theme.root.sizing.underline.hover}`}:undefined},["@media not (hover: hover)"]:{":hover":{backgroundColor:"transparent"}},":active":pressStyles,...focusStyles.focus,...kind==="secondary"?{":focus-visible:hover":{...focusStyles.focus[":focus-visible"],boxShadow:`inset 0 0 0 ${borderWidthKind.hover} ${themeVariant.hover.border}, ${focusStyles.focus[":focus-visible"].boxShadow}`},":focus-visible:active":{...focusStyles.focus[":focus-visible"],boxShadow:`inset 0 0 0 ${borderWidthKind.press} ${themeVariant.press.border}, ${focusStyles.focus[":focus-visible"].boxShadow}`}}:{}},pressed:pressStyles,disabled:{cursor:"not-allowed",...disabledStatesStyles,":hover":disabledStatesOverrides,":active":disabledStatesOverrides,":focus-visible":disabledStatesStyles}};styles[buttonType]=StyleSheet.create(newStyles);return styles[buttonType]};
22
22
 
23
23
  const Button=React.forwardRef(function Button(props,ref){const{href=undefined,type=undefined,children,skipClientNav,onClick,beforeNav=undefined,safeWithNav=undefined,tabIndex,target,rel,actionType="progressive",kind="primary",size="medium",disabled=false,spinner=false,...sharedButtonCoreProps}=props;const inRouterContext=useInRouterContext();const ClickableBehavior=getClickableBehavior(href,skipClientNav,inRouterContext);const extraClickableProps=beforeNav?{beforeNav}:{target};return jsx(ClickableBehavior,{disabled:spinner||disabled,href:href,role:"button",type:type,onClick:onClick,safeWithNav:safeWithNav,rel:rel,...extraClickableProps,children:(state,restChildProps)=>jsx(ButtonCore,{...sharedButtonCoreProps,...state,...restChildProps,disabled:disabled,spinner:spinner||state.waiting,actionType:actionType,kind:kind,size:size,skipClientNav:skipClientNav,href:href,target:target,type:type,tabIndex:tabIndex,ref:ref,children:children})})});
24
24
 
package/dist/index.js CHANGED
@@ -32,15 +32,15 @@ function _interopNamespace(e) {
32
32
 
33
33
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
34
34
 
35
- function ButtonIcon({icon,size,style,testId}){const commonProps={"aria-hidden":true,color:"currentColor",style:style,testId};switch(size){case"small":return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{...commonProps,size:"small",icon:icon});case"medium":default:return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{...commonProps,size:"medium",icon:icon})}}
36
-
37
- const textUnderlineOffset=wonderBlocksTokens.sizing.size_040;const theme$1={root:{border:{width:{primary:{default:wonderBlocksTokens.border.width.none,hover:wonderBlocksTokens.border.width.medium,press:wonderBlocksTokens.border.width.medium},secondary:{default:wonderBlocksTokens.border.width.thin,hover:wonderBlocksTokens.border.width.thin,press:wonderBlocksTokens.border.width.thin},tertiary:{default:wonderBlocksTokens.border.width.none,hover:wonderBlocksTokens.border.width.medium,press:wonderBlocksTokens.border.width.medium}},offset:{primary:wonderBlocksTokens.border.width.medium,secondary:0,tertiary:0},radius:{small:wonderBlocksTokens.border.radius.radius_040,medium:wonderBlocksTokens.border.radius.radius_040,large:wonderBlocksTokens.border.radius.radius_040}},sizing:{height:{small:wonderBlocksTokens.sizing.size_320,medium:wonderBlocksTokens.sizing.size_400,large:wonderBlocksTokens.sizing.size_560},underline:{hover:wonderBlocksTokens.sizing.size_020,press:wonderBlocksTokens.sizing.size_010}},padding:{medium:wonderBlocksTokens.sizing.size_160,large:wonderBlocksTokens.sizing.size_320},font:{size:{large:"1.8rem"},lineHeight:{small:wonderBlocksTokens.font.lineHeight.xMedium,default:wonderBlocksTokens.font.lineHeight.large,large:"2.6rem"},weight:{default:wonderBlocksTokens.font.weight.bold},offset:{default:textUnderlineOffset}}},icon:{margin:{inline:{inner:wonderBlocksTokens.sizing.size_060,outer:`calc(-1 * ${wonderBlocksTokens.border.width.medium})`}},padding:wonderBlocksTokens.sizing.size_020}};
35
+ const textUnderlineOffset=wonderBlocksTokens.sizing.size_040;const theme$1={root:{border:{width:{primary:{default:wonderBlocksTokens.border.width.none,hover:wonderBlocksTokens.border.width.medium,press:wonderBlocksTokens.border.width.medium},secondary:{default:wonderBlocksTokens.border.width.thin,hover:wonderBlocksTokens.border.width.thin,press:wonderBlocksTokens.border.width.thin},tertiary:{default:wonderBlocksTokens.border.width.none,hover:wonderBlocksTokens.border.width.none,press:wonderBlocksTokens.border.width.none}},offset:{primary:wonderBlocksTokens.border.width.medium,secondary:0,tertiary:0},radius:{default:wonderBlocksTokens.border.radius.radius_040,hover:wonderBlocksTokens.border.radius.radius_040,press:wonderBlocksTokens.border.radius.radius_040}},sizing:{height:{small:wonderBlocksTokens.sizing.size_320,medium:wonderBlocksTokens.sizing.size_400,large:wonderBlocksTokens.sizing.size_560},underline:{hover:wonderBlocksTokens.sizing.size_020,press:wonderBlocksTokens.sizing.size_010}},layout:{padding:{inline:{primary:{small:wonderBlocksTokens.sizing.size_160,medium:wonderBlocksTokens.sizing.size_160,large:wonderBlocksTokens.sizing.size_320},secondary:{small:wonderBlocksTokens.sizing.size_120,medium:wonderBlocksTokens.sizing.size_160,large:wonderBlocksTokens.sizing.size_180},tertiary:{small:wonderBlocksTokens.sizing.size_0,medium:wonderBlocksTokens.sizing.size_0,large:wonderBlocksTokens.sizing.size_0}}}},font:{size:{large:"1.8rem"},lineHeight:{small:wonderBlocksTokens.font.lineHeight.xMedium,default:wonderBlocksTokens.font.lineHeight.large,large:"2.6rem"},weight:{default:wonderBlocksTokens.font.weight.bold},decoration:{hover:"underline",press:"underline"},offset:{default:textUnderlineOffset}}},icon:{margin:{inline:{inner:wonderBlocksTokens.sizing.size_060,outer:`calc(-1 * ${wonderBlocksTokens.border.width.medium})`}},padding:wonderBlocksTokens.sizing.size_020,sizing:{small:wonderBlocksTokens.sizing.size_160,medium:wonderBlocksTokens.sizing.size_240,large:wonderBlocksTokens.sizing.size_240}}};
38
36
 
39
37
  var theme = wonderBlocksTokens.mapValuesToCssVars(theme$1,"--wb-c-button-");
40
38
 
39
+ function ButtonIcon({icon,size,style,testId}){const iconStyle={width:theme.icon.sizing[size],height:theme.icon.sizing[size]};const commonProps={"aria-hidden":true,color:"currentColor",style:[style,iconStyle],testId};switch(size){case"small":return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{...commonProps,size:"small",icon:icon});case"medium":default:return jsxRuntime.jsx(wonderBlocksIcon.PhosphorIcon,{...commonProps,size:"medium",icon:icon})}}
40
+
41
41
  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$1.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$1=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)"}}});
42
42
 
43
- const ButtonCore=React__namespace.forwardRef(function ButtonCore(props,ref){const{children,skipClientNav,actionType,disabled:disabledProp,focused,hovered,href=undefined,kind="primary",labelStyle,pressed,size="medium",style,testId,type=undefined,spinner,startIcon,endIcon,id,waiting:_,...restProps}=props;const buttonStyles=_generateStyles(actionType,kind,size);const disabled=spinner||disabledProp;const defaultStyle=[sharedStyles.shared,startIcon&&sharedStyles.withStartIcon,endIcon&&sharedStyles.withEndIcon,buttonStyles.default,disabled&&buttonStyles.disabled,!disabled&&(pressed?buttonStyles.pressed:focused&&buttonStyles.focused),size==="small"&&sharedStyles.small,size==="large"&&sharedStyles.large];const Label=size==="small"?wonderBlocksTypography.LabelSmall:wonderBlocksTypography.LabelLarge;const label=jsxRuntime.jsx(Label,{style:[sharedStyles.text,size==="small"&&sharedStyles.smallText,size==="large"&&sharedStyles.largeText,labelStyle,spinner&&sharedStyles.hiddenText,kind==="tertiary"&&!disabled&&(pressed?[buttonStyles.hover,buttonStyles.active]:hovered&&buttonStyles.hover)],testId:testId?`${testId}-inner-label`:undefined,children:children});const sizeMapping={medium:"small",small:"xsmall",large:"medium"};const iconSize=size==="small"?"small":"medium";const contents=jsxRuntime.jsxs(React__namespace.Fragment,{children:[startIcon&&jsxRuntime.jsx(wonderBlocksCore.View,{style:sharedStyles.iconWrapper,children:jsxRuntime.jsx(ButtonIcon,{size:iconSize,icon:startIcon,style:[sharedStyles.startIcon,kind==="tertiary"&&sharedStyles.tertiaryStartIcon],testId:testId?`${testId}-start-icon`:undefined})}),label,spinner&&jsxRuntime.jsx(wonderBlocksProgressSpinner.CircularSpinner,{style:sharedStyles.spinner,size:sizeMapping[size],light:kind==="primary",testId:`${testId||"button"}-spinner`}),endIcon&&jsxRuntime.jsx(wonderBlocksCore.View,{testId:testId?`${testId}-end-icon-wrapper`:undefined,style:[styles.endIcon,sharedStyles.iconWrapper,sharedStyles.endIconWrapper,kind==="tertiary"&&sharedStyles.endIconWrapperTertiary],children:jsxRuntime.jsx(ButtonIcon,{size:iconSize,icon:endIcon,testId:testId?`${testId}-end-icon`:undefined})})]});return jsxRuntime.jsx(ButtonUnstyled,{...restProps,disabled:disabled,href:href,id:id,ref:ref,skipClientNav:skipClientNav,style:[defaultStyle,style],testId:testId,tabIndex:props.tabIndex,type:type,children:contents})});const sharedStyles=aphrodite.StyleSheet.create({shared:{height:theme.root.sizing.height.medium,paddingBlock:0,paddingInline:theme.root.padding.medium},small:{borderRadius:theme.root.border.radius.small,height:theme.root.sizing.height.small},large:{borderRadius:theme.root.border.radius.large,height:theme.root.sizing.height.large},text:{alignItems:"center",fontWeight:theme.root.font.weight.default,whiteSpace:"nowrap",overflow:"hidden",lineHeight:theme.root.font.lineHeight.default,textOverflow:"ellipsis",display:"inline-block",pointerEvents:"none"},smallText:{lineHeight:theme.root.font.lineHeight.small},largeText:{fontSize:theme.root.font.size.large,lineHeight:theme.root.font.lineHeight.large},hiddenText:{visibility:"hidden"},spinner:{position:"absolute"},startIcon:{marginInlineStart:theme.icon.margin.inline.outer,marginInlineEnd:theme.icon.margin.inline.inner},tertiaryStartIcon:{marginInlineStart:0},endIcon:{marginInlineStart:theme.icon.margin.inline.inner},iconWrapper:{padding:theme.icon.padding,minWidth:"auto"},endIconWrapper:{marginInlineStart:theme.icon.margin.inline.inner,marginInlineEnd:theme.icon.margin.inline.outer},endIconWrapperTertiary:{marginInlineEnd:0}});const styles={};const _generateStyles=(actionType="progressive",kind,size)=>{const buttonType=`${actionType}-${kind}-${size}`;if(styles[buttonType]){return styles[buttonType]}const padding=size==="large"?theme.root.padding.large:theme.root.padding.medium;const borderWidthKind=theme.root.border.width[kind];const outlineOffsetKind=theme.root.border.offset[kind];const themeVariant=wonderBlocksTokens.semanticColor.action[kind][actionType];const disabledState=wonderBlocksTokens.semanticColor.action[kind].disabled;const disabledStatesStyles={borderColor:disabledState.border,borderWidth:borderWidthKind.default,background:disabledState.background,color:disabledState.foreground};const disabledStatesOverrides={...disabledStatesStyles,outline:"none",boxShadow:"none",textDecoration:"none",textDecorationThickness:"unset",textUnderlineOffset:"unset"};const newStyles={default:{borderRadius:theme.root.border.radius[size],paddingInline:kind==="tertiary"?0:padding,borderStyle:"solid",borderWidth:borderWidthKind.default,borderColor:themeVariant.default.border,background:themeVariant.default.background,color:themeVariant.default.foreground,":hover":{background:themeVariant.hover.background,color:themeVariant.hover.foreground,...kind==="primary"?{outline:`${borderWidthKind.hover} solid ${themeVariant.hover.border}`,outlineOffset:outlineOffsetKind}:undefined,...kind==="secondary"?{borderColor:themeVariant.hover.border,boxShadow:`inset 0 0 0 ${borderWidthKind.hover} ${themeVariant.hover.border}`}:undefined,...kind==="tertiary"?{textDecoration:"underline",textUnderlineOffset:theme.root.font.offset.default,textDecorationThickness:theme.root.sizing.underline.hover}:undefined},["@media not (hover: hover)"]:{":hover":{backgroundColor:"transparent"}},":active":{background:themeVariant.press.background,color:themeVariant.press.foreground,...kind==="primary"?{outline:`${borderWidthKind.press} solid ${themeVariant.press.border}`,outlineOffset:outlineOffsetKind}:undefined,...kind==="secondary"?{borderColor:themeVariant.press.border,boxShadow:`inset 0 0 0 ${borderWidthKind.press} ${themeVariant.press.border}`}:undefined,...kind==="tertiary"?{textDecoration:"underline",textUnderlineOffset:theme.root.font.offset.default,textDecorationThickness:theme.root.sizing.underline.press}:undefined},...wonderBlocksStyles.focusStyles.focus,...kind==="secondary"?{":focus-visible:hover":{...wonderBlocksStyles.focusStyles.focus[":focus-visible"],boxShadow:`inset 0 0 0 ${borderWidthKind.hover} ${themeVariant.hover.border}, ${wonderBlocksStyles.focusStyles.focus[":focus-visible"].boxShadow}`},":focus-visible:active":{...wonderBlocksStyles.focusStyles.focus[":focus-visible"],boxShadow:`inset 0 0 0 ${borderWidthKind.press} ${themeVariant.press.border}, ${wonderBlocksStyles.focusStyles.focus[":focus-visible"].boxShadow}`}}:{}},disabled:{cursor:"not-allowed",...disabledStatesStyles,":hover":disabledStatesOverrides,":active":disabledStatesOverrides,":focus-visible":disabledStatesStyles}};styles[buttonType]=aphrodite.StyleSheet.create(newStyles);return styles[buttonType]};
43
+ const ButtonCore=React__namespace.forwardRef(function ButtonCore(props,ref){const{children,skipClientNav,actionType,disabled:disabledProp,focused,hovered,href=undefined,kind="primary",labelStyle,pressed,size="medium",style,testId,type=undefined,spinner,startIcon,endIcon,id,waiting:_,...restProps}=props;const buttonStyles=_generateStyles(actionType,kind,size);const disabled=spinner||disabledProp;const defaultStyle=[sharedStyles.shared,startIcon&&sharedStyles.withStartIcon,endIcon&&sharedStyles.withEndIcon,buttonStyles.default,disabled&&buttonStyles.disabled,!disabled&&(pressed?buttonStyles.pressed:focused&&buttonStyles.focused),size==="small"&&sharedStyles.small,size==="large"&&sharedStyles.large];const Label=size==="small"?wonderBlocksTypography.LabelSmall:wonderBlocksTypography.LabelLarge;const label=jsxRuntime.jsx(Label,{style:[sharedStyles.text,size==="small"&&sharedStyles.smallText,size==="large"&&sharedStyles.largeText,labelStyle,spinner&&sharedStyles.hiddenText,kind==="tertiary"&&!disabled&&(pressed?[buttonStyles.hover,buttonStyles.active]:hovered&&buttonStyles.hover)],testId:testId?`${testId}-inner-label`:undefined,children:children});const sizeMapping={medium:"small",small:"xsmall",large:"medium"};const iconSize=size==="small"?"small":"medium";const contents=jsxRuntime.jsxs(React__namespace.Fragment,{children:[startIcon&&jsxRuntime.jsx(wonderBlocksCore.View,{style:sharedStyles.iconWrapper,children:jsxRuntime.jsx(ButtonIcon,{size:iconSize,icon:startIcon,style:[sharedStyles.startIcon,kind==="tertiary"&&sharedStyles.tertiaryStartIcon],testId:testId?`${testId}-start-icon`:undefined})}),label,spinner&&jsxRuntime.jsx(wonderBlocksProgressSpinner.CircularSpinner,{style:sharedStyles.spinner,size:sizeMapping[size],light:kind==="primary",testId:`${testId||"button"}-spinner`}),endIcon&&jsxRuntime.jsx(wonderBlocksCore.View,{testId:testId?`${testId}-end-icon-wrapper`:undefined,style:[styles.endIcon,sharedStyles.iconWrapper,sharedStyles.endIconWrapper,kind==="tertiary"&&sharedStyles.endIconWrapperTertiary],children:jsxRuntime.jsx(ButtonIcon,{size:iconSize,icon:endIcon,testId:testId?`${testId}-end-icon`:undefined})})]});return jsxRuntime.jsx(ButtonUnstyled,{...restProps,disabled:disabled,href:href,id:id,ref:ref,skipClientNav:skipClientNav,style:[defaultStyle,style],testId:testId,tabIndex:props.tabIndex,type:type,children:contents})});const sharedStyles=aphrodite.StyleSheet.create({shared:{height:theme.root.sizing.height.medium,paddingBlock:0},small:{height:theme.root.sizing.height.small},large:{height:theme.root.sizing.height.large},text:{alignItems:"center",fontWeight:theme.root.font.weight.default,whiteSpace:"nowrap",overflow:"hidden",lineHeight:theme.root.font.lineHeight.default,textOverflow:"ellipsis",display:"inline-block",pointerEvents:"none"},smallText:{lineHeight:theme.root.font.lineHeight.small},largeText:{fontSize:theme.root.font.size.large,lineHeight:theme.root.font.lineHeight.large},hiddenText:{visibility:"hidden"},spinner:{position:"absolute"},startIcon:{marginInlineStart:theme.icon.margin.inline.outer,marginInlineEnd:theme.icon.margin.inline.inner},tertiaryStartIcon:{marginInlineStart:0},endIcon:{marginInlineStart:theme.icon.margin.inline.inner},iconWrapper:{padding:theme.icon.padding,minWidth:"auto"},endIconWrapper:{marginInlineStart:theme.icon.margin.inline.inner,marginInlineEnd:theme.icon.margin.inline.outer},endIconWrapperTertiary:{marginInlineEnd:0}});const styles={};const _generateStyles=(actionType="progressive",kind,size)=>{const buttonType=`${actionType}-${kind}-${size}`;if(styles[buttonType]){return styles[buttonType]}const paddingInline=theme.root.layout.padding.inline[kind][size];const borderWidthKind=theme.root.border.width[kind];const outlineOffsetKind=theme.root.border.offset[kind];const themeVariant=wonderBlocksTokens.semanticColor.action[kind][actionType];const disabledState=wonderBlocksTokens.semanticColor.action[kind].disabled;const disabledStatesStyles={borderColor:disabledState.border,borderWidth:borderWidthKind.default,borderRadius:theme.root.border.radius.default,background:disabledState.background,color:disabledState.foreground};const disabledStatesOverrides={...disabledStatesStyles,outline:"none",boxShadow:"none",textDecoration:"none",textDecorationThickness:"unset",textUnderlineOffset:"unset"};const pressStyles={background:themeVariant.press.background,borderRadius:theme.root.border.radius.press,color:themeVariant.press.foreground,...kind==="primary"?{outline:`${borderWidthKind.press} solid ${themeVariant.press.border}`,outlineOffset:outlineOffsetKind}:undefined,...kind!=="primary"?{borderColor:themeVariant.press.border,boxShadow:`inset 0 0 0 ${borderWidthKind.press} ${themeVariant.press.border}`}:undefined,...kind==="tertiary"?{textUnderlineOffset:theme.root.font.offset.default,textDecoration:`${theme.root.font.decoration.press} ${theme.root.sizing.underline.press}`}:undefined};const newStyles={default:{borderRadius:theme.root.border.radius.default,paddingInline:paddingInline,borderStyle:"solid",borderWidth:borderWidthKind.default,borderColor:themeVariant.default.border,background:themeVariant.default.background,color:themeVariant.default.foreground,transition:"border-radius 0.1s ease-in-out",":hover":{background:themeVariant.hover.background,borderRadius:theme.root.border.radius.hover,color:themeVariant.hover.foreground,...kind==="primary"?{outline:`${borderWidthKind.hover} solid ${themeVariant.hover.border}`,outlineOffset:outlineOffsetKind}:undefined,...kind!=="primary"?{borderColor:themeVariant.hover.border,boxShadow:`inset 0 0 0 ${borderWidthKind.hover} ${themeVariant.hover.border}`}:undefined,...kind==="tertiary"?{textUnderlineOffset:theme.root.font.offset.default,textDecoration:`${theme.root.font.decoration.hover} ${theme.root.sizing.underline.hover}`}:undefined},["@media not (hover: hover)"]:{":hover":{backgroundColor:"transparent"}},":active":pressStyles,...wonderBlocksStyles.focusStyles.focus,...kind==="secondary"?{":focus-visible:hover":{...wonderBlocksStyles.focusStyles.focus[":focus-visible"],boxShadow:`inset 0 0 0 ${borderWidthKind.hover} ${themeVariant.hover.border}, ${wonderBlocksStyles.focusStyles.focus[":focus-visible"].boxShadow}`},":focus-visible:active":{...wonderBlocksStyles.focusStyles.focus[":focus-visible"],boxShadow:`inset 0 0 0 ${borderWidthKind.press} ${themeVariant.press.border}, ${wonderBlocksStyles.focusStyles.focus[":focus-visible"].boxShadow}`}}:{}},pressed:pressStyles,disabled:{cursor:"not-allowed",...disabledStatesStyles,":hover":disabledStatesOverrides,":active":disabledStatesOverrides,":focus-visible":disabledStatesStyles}};styles[buttonType]=aphrodite.StyleSheet.create(newStyles);return styles[buttonType]};
44
44
 
45
45
  const Button=React__namespace.forwardRef(function Button(props,ref){const{href=undefined,type=undefined,children,skipClientNav,onClick,beforeNav=undefined,safeWithNav=undefined,tabIndex,target,rel,actionType="progressive",kind="primary",size="medium",disabled=false,spinner=false,...sharedButtonCoreProps}=props;const inRouterContext=reactRouterDomV5Compat.useInRouterContext();const ClickableBehavior=wonderBlocksClickable.getClickableBehavior(href,skipClientNav,inRouterContext);const extraClickableProps=beforeNav?{beforeNav}:{target};return jsxRuntime.jsx(ClickableBehavior,{disabled:spinner||disabled,href:href,role:"button",type:type,onClick:onClick,safeWithNav:safeWithNav,rel:rel,...extraClickableProps,children:(state,restChildProps)=>jsxRuntime.jsx(ButtonCore,{...sharedButtonCoreProps,...state,...restChildProps,disabled:disabled,spinner:spinner||state.waiting,actionType:actionType,kind:kind,size:size,skipClientNav:skipClientNav,href:href,target:target,type:type,tabIndex:tabIndex,ref:ref,children:children})})});
46
46
 
@@ -24,9 +24,9 @@ declare const theme: {
24
24
  tertiary: number;
25
25
  };
26
26
  radius: {
27
- small: string;
28
- medium: string;
29
- large: string;
27
+ default: string;
28
+ hover: string;
29
+ press: string;
30
30
  };
31
31
  };
32
32
  sizing: {
@@ -40,9 +40,26 @@ declare const theme: {
40
40
  press: string;
41
41
  };
42
42
  };
43
- padding: {
44
- medium: string;
45
- large: string;
43
+ layout: {
44
+ padding: {
45
+ inline: {
46
+ primary: {
47
+ small: string;
48
+ medium: string;
49
+ large: string;
50
+ };
51
+ secondary: {
52
+ small: string;
53
+ medium: string;
54
+ large: string;
55
+ };
56
+ tertiary: {
57
+ small: string;
58
+ medium: string;
59
+ large: string;
60
+ };
61
+ };
62
+ };
46
63
  };
47
64
  font: {
48
65
  size: {
@@ -56,6 +73,10 @@ declare const theme: {
56
73
  weight: {
57
74
  default: number;
58
75
  };
76
+ decoration: {
77
+ hover: string;
78
+ press: string;
79
+ };
59
80
  offset: {
60
81
  default: string;
61
82
  };
@@ -69,6 +90,11 @@ declare const theme: {
69
90
  };
70
91
  };
71
92
  padding: string;
93
+ sizing: {
94
+ small: string;
95
+ medium: string;
96
+ large: string;
97
+ };
72
98
  };
73
99
  };
74
100
  export default theme;
@@ -24,9 +24,9 @@ declare const _default: {
24
24
  tertiary: number;
25
25
  };
26
26
  radius: {
27
- small: string;
28
- medium: string;
29
- large: string;
27
+ default: string;
28
+ hover: string;
29
+ press: string;
30
30
  };
31
31
  };
32
32
  sizing: {
@@ -40,9 +40,26 @@ declare const _default: {
40
40
  press: string;
41
41
  };
42
42
  };
43
- padding: {
44
- medium: string;
45
- large: string;
43
+ layout: {
44
+ padding: {
45
+ inline: {
46
+ primary: {
47
+ small: string;
48
+ medium: string;
49
+ large: string;
50
+ };
51
+ secondary: {
52
+ small: string;
53
+ medium: string;
54
+ large: string;
55
+ };
56
+ tertiary: {
57
+ small: string;
58
+ medium: string;
59
+ large: string;
60
+ };
61
+ };
62
+ };
46
63
  };
47
64
  font: {
48
65
  size: {
@@ -56,6 +73,10 @@ declare const _default: {
56
73
  weight: {
57
74
  default: number;
58
75
  };
76
+ decoration: {
77
+ hover: string;
78
+ press: string;
79
+ };
59
80
  offset: {
60
81
  default: string;
61
82
  };
@@ -69,6 +90,11 @@ declare const _default: {
69
90
  };
70
91
  };
71
92
  padding: string;
93
+ sizing: {
94
+ small: string;
95
+ medium: string;
96
+ large: string;
97
+ };
72
98
  };
73
99
  };
74
100
  export default _default;
@@ -0,0 +1,100 @@
1
+ declare const _default: {
2
+ root: {
3
+ border: {
4
+ width: {
5
+ primary: {
6
+ default: string;
7
+ hover: string;
8
+ press: string;
9
+ };
10
+ secondary: {
11
+ default: string;
12
+ hover: string;
13
+ press: string;
14
+ };
15
+ tertiary: {
16
+ default: string;
17
+ hover: string;
18
+ press: string;
19
+ };
20
+ };
21
+ offset: {
22
+ primary: string;
23
+ secondary: number;
24
+ tertiary: number;
25
+ };
26
+ radius: {
27
+ default: string;
28
+ hover: string;
29
+ press: string;
30
+ };
31
+ };
32
+ sizing: {
33
+ height: {
34
+ small: string;
35
+ medium: string;
36
+ large: string;
37
+ };
38
+ underline: {
39
+ hover: string;
40
+ press: string;
41
+ };
42
+ };
43
+ layout: {
44
+ padding: {
45
+ inline: {
46
+ primary: {
47
+ small: string;
48
+ medium: string;
49
+ large: string;
50
+ };
51
+ secondary: {
52
+ small: string;
53
+ medium: string;
54
+ large: string;
55
+ };
56
+ tertiary: {
57
+ small: string;
58
+ medium: string;
59
+ large: string;
60
+ };
61
+ };
62
+ };
63
+ };
64
+ font: {
65
+ size: {
66
+ large: string;
67
+ };
68
+ lineHeight: {
69
+ small: string;
70
+ default: string;
71
+ large: string;
72
+ };
73
+ weight: {
74
+ default: number;
75
+ };
76
+ decoration: {
77
+ hover: string;
78
+ press: string;
79
+ };
80
+ offset: {
81
+ default: string;
82
+ };
83
+ };
84
+ };
85
+ icon: {
86
+ margin: {
87
+ inline: {
88
+ inner: string;
89
+ outer: string;
90
+ };
91
+ };
92
+ padding: string;
93
+ sizing: {
94
+ small: string;
95
+ medium: string;
96
+ large: string;
97
+ };
98
+ };
99
+ };
100
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-button",
3
- "version": "10.0.4",
3
+ "version": "10.1.0",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -20,13 +20,13 @@
20
20
  "author": "",
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@khanacademy/wonder-blocks-clickable": "7.1.5",
23
+ "@khanacademy/wonder-blocks-clickable": "7.1.6",
24
24
  "@khanacademy/wonder-blocks-core": "12.3.0",
25
- "@khanacademy/wonder-blocks-icon": "5.1.4",
26
- "@khanacademy/wonder-blocks-progress-spinner": "3.1.16",
27
- "@khanacademy/wonder-blocks-styles": "0.2.12",
28
- "@khanacademy/wonder-blocks-tokens": "10.4.0",
29
- "@khanacademy/wonder-blocks-typography": "4.1.0"
25
+ "@khanacademy/wonder-blocks-icon": "5.2.0",
26
+ "@khanacademy/wonder-blocks-progress-spinner": "3.1.17",
27
+ "@khanacademy/wonder-blocks-styles": "0.2.13",
28
+ "@khanacademy/wonder-blocks-tokens": "10.5.0",
29
+ "@khanacademy/wonder-blocks-typography": "4.2.1"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "aphrodite": "^1.2.5",