@khanacademy/wonder-blocks-card 0.0.0-PR2799-20250925193915 → 0.0.0-PR2799-20250926210119
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 +1 -1
- package/dist/es/index.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/card.tsx +7 -4
package/CHANGELOG.md
CHANGED
package/dist/es/index.js
CHANGED
|
@@ -9,6 +9,6 @@ import { focusStyles } from '@khanacademy/wonder-blocks-styles';
|
|
|
9
9
|
|
|
10
10
|
const DismissButton=props=>{const{onClick,style,testId}=props;return jsx(IconButton,{icon:xIcon,"aria-label":props["aria-label"]||"Close",onClick:onClick,kind:"tertiary",actionType:"neutral",style:[componentStyles.root,style],testId:testId})};const componentStyles=StyleSheet.create({root:{position:"absolute",insetInlineEnd:sizing.size_080,top:sizing.size_080,zIndex:1,":focus":focusStyles.focus[":focus-visible"]}});
|
|
11
11
|
|
|
12
|
-
const Card=React.forwardRef(function Card(props,ref){const{styles,labels,tag,testId,backgroundColor="default",borderRadius="radius_080",padding="size_160",children,onDismiss,inert}=props;const componentStyles=getComponentStyles({backgroundColor,borderRadius,padding});return jsxs(View,{"aria-label":labels?.cardAriaLabel,style:[componentStyles.root,styles?.root],ref:ref,tag:tag,testId:testId,inert:inert?"":undefined,children:[onDismiss?jsx(DismissButton,{"aria-label":labels?.dismissButtonAriaLabel||"Close",onClick:e=>onDismiss?.(e)}):null,children]})});const getComponentStyles=({backgroundColor,borderRadius,padding})=>{const backgroundColorStyle=backgroundColor&&backgroundColor==="subtle"||backgroundColor==="default"?semanticColor.core.background.base[backgroundColor]:undefined;return StyleSheet.create({root:{backgroundColor:backgroundColorStyle,borderColor:semanticColor.core.border.neutral.subtle,borderStyle:"solid",borderRadius:borderRadius&&border.radius[borderRadius],borderWidth:border.width.thin,boxShadow:boxShadow.low,padding:padding&&sizing[padding],
|
|
12
|
+
const Card=React.forwardRef(function Card(props,ref){const{styles,labels,tag,testId,backgroundColor="default",borderRadius="radius_080",padding="size_160",children,onDismiss,inert}=props;const componentStyles=getComponentStyles({backgroundColor,borderRadius,padding});return jsxs(View,{"aria-label":labels?.cardAriaLabel,style:[componentStyles.root,styles?.root],ref:ref,tag:tag,testId:testId,inert:inert?"":undefined,children:[onDismiss?jsx(DismissButton,{"aria-label":labels?.dismissButtonAriaLabel||"Close",onClick:e=>onDismiss?.(e)}):null,children]})});const getComponentStyles=({backgroundColor,borderRadius,padding})=>{const backgroundColorStyle=backgroundColor&&backgroundColor==="subtle"||backgroundColor==="default"?semanticColor.core.background.base[backgroundColor]:undefined;return StyleSheet.create({root:{backgroundColor:backgroundColorStyle,borderColor:semanticColor.core.border.neutral.subtle,borderStyle:"solid",borderRadius:borderRadius&&border.radius[borderRadius],borderWidth:border.width.thin,boxShadow:boxShadow.low,padding:padding&&sizing[padding],minInlineSize:sizing.size_280,position:"relative"}})};
|
|
13
13
|
|
|
14
14
|
export { Card };
|
package/dist/index.js
CHANGED
|
@@ -37,6 +37,6 @@ var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
|
|
37
37
|
|
|
38
38
|
const DismissButton=props=>{const{onClick,style,testId}=props;return jsxRuntime.jsx(IconButton__default["default"],{icon:xIcon__default["default"],"aria-label":props["aria-label"]||"Close",onClick:onClick,kind:"tertiary",actionType:"neutral",style:[componentStyles.root,style],testId:testId})};const componentStyles=aphrodite.StyleSheet.create({root:{position:"absolute",insetInlineEnd:wonderBlocksTokens.sizing.size_080,top:wonderBlocksTokens.sizing.size_080,zIndex:1,":focus":wonderBlocksStyles.focusStyles.focus[":focus-visible"]}});
|
|
39
39
|
|
|
40
|
-
const Card=React__namespace.forwardRef(function Card(props,ref){const{styles,labels,tag,testId,backgroundColor="default",borderRadius="radius_080",padding="size_160",children,onDismiss,inert}=props;const componentStyles=getComponentStyles({backgroundColor,borderRadius,padding});return jsxRuntime.jsxs(wonderBlocksCore.View,{"aria-label":labels?.cardAriaLabel,style:[componentStyles.root,styles?.root],ref:ref,tag:tag,testId:testId,inert:inert?"":undefined,children:[onDismiss?jsxRuntime.jsx(DismissButton,{"aria-label":labels?.dismissButtonAriaLabel||"Close",onClick:e=>onDismiss?.(e)}):null,children]})});const getComponentStyles=({backgroundColor,borderRadius,padding})=>{const backgroundColorStyle=backgroundColor&&backgroundColor==="subtle"||backgroundColor==="default"?wonderBlocksTokens.semanticColor.core.background.base[backgroundColor]:undefined;return aphrodite.StyleSheet.create({root:{backgroundColor:backgroundColorStyle,borderColor:wonderBlocksTokens.semanticColor.core.border.neutral.subtle,borderStyle:"solid",borderRadius:borderRadius&&wonderBlocksTokens.border.radius[borderRadius],borderWidth:wonderBlocksTokens.border.width.thin,boxShadow:wonderBlocksTokens.boxShadow.low,padding:padding&&wonderBlocksTokens.sizing[padding],
|
|
40
|
+
const Card=React__namespace.forwardRef(function Card(props,ref){const{styles,labels,tag,testId,backgroundColor="default",borderRadius="radius_080",padding="size_160",children,onDismiss,inert}=props;const componentStyles=getComponentStyles({backgroundColor,borderRadius,padding});return jsxRuntime.jsxs(wonderBlocksCore.View,{"aria-label":labels?.cardAriaLabel,style:[componentStyles.root,styles?.root],ref:ref,tag:tag,testId:testId,inert:inert?"":undefined,children:[onDismiss?jsxRuntime.jsx(DismissButton,{"aria-label":labels?.dismissButtonAriaLabel||"Close",onClick:e=>onDismiss?.(e)}):null,children]})});const getComponentStyles=({backgroundColor,borderRadius,padding})=>{const backgroundColorStyle=backgroundColor&&backgroundColor==="subtle"||backgroundColor==="default"?wonderBlocksTokens.semanticColor.core.background.base[backgroundColor]:undefined;return aphrodite.StyleSheet.create({root:{backgroundColor:backgroundColorStyle,borderColor:wonderBlocksTokens.semanticColor.core.border.neutral.subtle,borderStyle:"solid",borderRadius:borderRadius&&wonderBlocksTokens.border.radius[borderRadius],borderWidth:wonderBlocksTokens.border.width.thin,boxShadow:wonderBlocksTokens.boxShadow.low,padding:padding&&wonderBlocksTokens.sizing[padding],minInlineSize:wonderBlocksTokens.sizing.size_280,position:"relative"}})};
|
|
41
41
|
|
|
42
42
|
exports.Card = Card;
|
package/package.json
CHANGED
package/src/components/card.tsx
CHANGED
|
@@ -100,6 +100,9 @@ type Props = {
|
|
|
100
100
|
* use cases that involve displaying comparable content items side-by-side or
|
|
101
101
|
* in structured layouts such as grids, lists, or dashboards.
|
|
102
102
|
*
|
|
103
|
+
* Note: cards do not set a default width. Width styles should be set by the consumer
|
|
104
|
+
* with the `styles.root` prop.
|
|
105
|
+
*
|
|
103
106
|
* ### Usage
|
|
104
107
|
*
|
|
105
108
|
* ```jsx
|
|
@@ -110,6 +113,7 @@ type Props = {
|
|
|
110
113
|
* </Card>
|
|
111
114
|
* ```
|
|
112
115
|
*/
|
|
116
|
+
|
|
113
117
|
const Card = React.forwardRef(function Card(
|
|
114
118
|
props: Props,
|
|
115
119
|
ref: React.ForwardedRef<any>,
|
|
@@ -121,7 +125,7 @@ const Card = React.forwardRef(function Card(
|
|
|
121
125
|
testId,
|
|
122
126
|
backgroundColor = "default",
|
|
123
127
|
borderRadius = "radius_080",
|
|
124
|
-
padding = "size_160",
|
|
128
|
+
padding = "size_160",
|
|
125
129
|
children,
|
|
126
130
|
onDismiss,
|
|
127
131
|
inert,
|
|
@@ -170,10 +174,9 @@ const getComponentStyles = ({
|
|
|
170
174
|
borderRadius: borderRadius && border.radius[borderRadius],
|
|
171
175
|
borderWidth: border.width.thin,
|
|
172
176
|
boxShadow: boxShadow.low,
|
|
173
|
-
padding: padding && sizing[padding], // TODO: figure out conversion to px
|
|
174
|
-
|
|
177
|
+
padding: padding && sizing[padding], // TODO[WB-2094]: figure out conversion to px
|
|
178
|
+
minInlineSize: sizing.size_280,
|
|
175
179
|
position: "relative",
|
|
176
|
-
width: "100%",
|
|
177
180
|
},
|
|
178
181
|
});
|
|
179
182
|
};
|