@khanacademy/wonder-blocks-breadcrumbs 3.3.8 → 4.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @khanacademy/wonder-blocks-breadcrumbs
2
2
 
3
+ ## 4.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - f52e4cd: Add an `exports` map (`.` and `./css`) and `"sideEffects": ["**/*.css"]` to the package.json. `./css` is the component stylesheet. It's conditional: `import` resolves to `dist/es/index.css` and `require` to `dist/index.css`, the same copy each JS entry already loads, so importing `./css` too doesn't duplicate the CSS.
8
+
9
+ **Breaking:** the new `exports` map blocks deep imports such as `@khanacademy/wonder-blocks-core/dist/...`. Import from the package root instead. No deep imports of these packages were found in Khan/frontend or Khan/perseus.
10
+
11
+ ### Minor Changes
12
+
13
+ - 3f9b565: Migrate `Breadcrumbs` and `BreadcrumbsItem` from Aphrodite to CSS Modules
14
+ (WB-2334, CSS Modules Phase 5 / Wave F). The public component API is
15
+ unchanged — same props and DOM structure.
16
+
17
+ - Styling now lives in `breadcrumbs.module.css`. The list, items and separator
18
+ are rendered by `addStyle`, so no other component's classes compete with
19
+ these rules.
20
+ - The package now ships `dist/index.css` (auto side-effect import).
21
+ `aphrodite` is dropped from `peerDependencies`.
22
+
23
+ ### Patch Changes
24
+
25
+ - 9652f57: Load each package's CSS after the CSS of the Wonder Blocks packages it depends
26
+ on. The published JS imported its own `index.css` before its dependencies, so
27
+ bundlers emitted, for example, Button's CSS before Typography's. Both sit in
28
+ `@layer shared` with single-class selectors, so the later `BodyText` rule won and
29
+ Button labels lost their own `font-weight`, `line-height` and `font-size`. The CSS
30
+ import now comes after the dependency imports, matching the source order that
31
+ Storybook already uses.
32
+ - Updated dependencies [0c6d97d]
33
+ - Updated dependencies [185dbbc]
34
+ - Updated dependencies [0b6c478]
35
+ - Updated dependencies [9652f57]
36
+ - Updated dependencies [f52e4cd]
37
+ - Updated dependencies [b66b7b7]
38
+ - Updated dependencies [dbb8f0f]
39
+ - Updated dependencies [ad52f4b]
40
+ - @khanacademy/wonder-blocks-tokens@18.3.0
41
+ - @khanacademy/wonder-blocks-core@13.0.0
42
+
3
43
  ## 3.3.8
4
44
 
5
45
  ### Patch Changes
@@ -0,0 +1,40 @@
1
+ @layer shared {/**
2
+ * Breadcrumbs styles
3
+ *
4
+ * Breadcrumbs has no theme of its own, so every value is the plain `--wb-*`
5
+ * token. The list is rendered by `addStyle`, which ships no class of its own,
6
+ * so this single-class rule doesn't compete with anything else in
7
+ * `@layer shared`. The items' styles live in `breadcrumbs-item.module.css`.
8
+ * The build wraps every rule in `@layer shared { … }`.
9
+ */.wb-breadcrumbs-container-825ed2ba {
10
+ display: flex;
11
+ list-style: none;
12
+ margin: 0;
13
+ padding: 0;
14
+ overflow: hidden;
15
+ }
16
+ }
17
+
18
+ @layer shared {/**
19
+ * BreadcrumbsItem styles
20
+ *
21
+ * Every value is the plain `--wb-*` token. The item and its separator are
22
+ * rendered by `addStyle`, which ships no class of its own, so these
23
+ * single-class rules don't compete with anything else in `@layer shared`
24
+ * (and none of them targets the same element as `breadcrumbs.module.css`,
25
+ * so the order the two files load in doesn't matter). The build wraps every
26
+ * rule in `@layer shared { … }`.
27
+ */.wb-breadcrumbs-item-item-44aa9824 {
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ margin-inline-end: var(--wb-sizing-size_040);
32
+ line-height: inherit;
33
+ font-family: var(--wb-font-family-sans);
34
+ }/* The circular bullet point drawn between items. */.wb-breadcrumbs-item-separator-44aa9824 {
35
+ margin-inline-start: var(--wb-sizing-size_040);
36
+ fill: var(--wb-semanticColor-core-foreground-neutral-default);
37
+ }
38
+ }
39
+
40
+ /*# sourceMappingURL=index.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["<no source>","../../src/components/breadcrumbs.module.css","../../src/components/breadcrumbs-item.module.css"],"names":[],"mappings":"AAAA,eCAA;;;;;;;;EAQE,CAEF;IACI,aAAa;IACb,gBAAgB;IAChB,SAAS;IACT,UAAU;IACV,gBAAgB;AACpB;CDhBA;;AAAA,eEAA;;;;;;;;;EASE,CAEF;IACI,aAAa;IACb,mBAAmB;IACnB,uBAAuB;IACvB,4CAA4C;IAC5C,oBAAoB;IACpB,uCAAuC;AAC3C,CAEA,mDAAmD,CACnD;IACI,8CAA8C;IAC9C,6DAA6D;AACjE;CFxBA","file":"index.css","sourcesContent":[null,"/**\n * Breadcrumbs styles\n *\n * Breadcrumbs has no theme of its own, so every value is the plain `--wb-*`\n * token. The list is rendered by `addStyle`, which ships no class of its own,\n * so this single-class rule doesn't compete with anything else in\n * `@layer shared`. The items' styles live in `breadcrumbs-item.module.css`.\n * The build wraps every rule in `@layer shared { … }`.\n */\n\n.container {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n overflow: hidden;\n}\n","/**\n * BreadcrumbsItem styles\n *\n * Every value is the plain `--wb-*` token. The item and its separator are\n * rendered by `addStyle`, which ships no class of its own, so these\n * single-class rules don't compete with anything else in `@layer shared`\n * (and none of them targets the same element as `breadcrumbs.module.css`,\n * so the order the two files load in doesn't matter). The build wraps every\n * rule in `@layer shared { … }`.\n */\n\n.item {\n display: flex;\n align-items: center;\n justify-content: center;\n margin-inline-end: var(--wb-sizing-size_040);\n line-height: inherit;\n font-family: var(--wb-font-family-sans);\n}\n\n/* The circular bullet point drawn between items. */\n.separator {\n margin-inline-start: var(--wb-sizing-size_040);\n fill: var(--wb-semanticColor-core-foreground-neutral-default);\n}\n"]}
package/dist/es/index.js CHANGED
@@ -1,12 +1,16 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { StyleSheet } from 'aphrodite';
4
3
  import { useWonderBlocksI18n } from '@khanacademy/wonder-blocks-config';
5
4
  import { addStyle } from '@khanacademy/wonder-blocks-core';
6
- import { sizing, font, semanticColor } from '@khanacademy/wonder-blocks-tokens';
7
5
 
8
- const StyledOl=addStyle("ol");const Breadcrumbs=React.forwardRef(function Breadcrumbs(props,ref){const{strings}=useWonderBlocksI18n();const{"aria-label":ariaLabel,children,testId,...otherProps}=props;const lastChildIndex=React.Children.count(children)-1;return jsx("nav",{...otherProps,"aria-label":ariaLabel||strings.breadcrumbs,"data-testid":testId,ref:ref,children:jsx(StyledOl,{style:styles$1.container,children:React.Children.map(children,(item,index)=>{const isLastChild=index===lastChildIndex;return React.cloneElement(item,{...item.props,showSeparator:!isLastChild,["aria-current"]:isLastChild?"page":undefined})})})})});const styles$1=StyleSheet.create({container:{display:"flex",listStyle:"none",margin:0,padding:0,overflow:"hidden"}});
6
+ var modules_14357f3f={"container":"wb-breadcrumbs-container-825ed2ba"};
9
7
 
10
- const StyledLi=addStyle("li");const StyledSvg=addStyle("svg");const BreadcrumbsItem=React.forwardRef(function BreadcrumbsItem(props,ref){const{children,showSeparator,testId,...otherProps}=props;const _renderSeparator=()=>{return jsx(StyledSvg,{style:styles.separator,width:16,height:16,viewBox:"0 0 16 16","aria-hidden":true,children:jsx("circle",{cx:"8",cy:"9",r:"1.5"})})};return jsxs(StyledLi,{...otherProps,style:styles.item,"data-testid":testId,ref:ref,children:[children,showSeparator&&_renderSeparator()]})});const styles=StyleSheet.create({item:{display:"flex",alignItems:"center",justifyContent:"center",marginInlineEnd:sizing.size_040,lineHeight:"inherit",fontFamily:font.family.sans},separator:{marginInlineStart:sizing.size_040,fill:semanticColor.core.foreground.neutral.default}});
8
+ const StyledOl=addStyle("ol");const Breadcrumbs=React.forwardRef(function Breadcrumbs(props,ref){const{strings}=useWonderBlocksI18n();const{"aria-label":ariaLabel,children,testId,...otherProps}=props;const lastChildIndex=React.Children.count(children)-1;return jsx("nav",{...otherProps,"aria-label":ariaLabel||strings.breadcrumbs,"data-testid":testId,ref:ref,children:jsx(StyledOl,{style:modules_14357f3f.container,children:React.Children.map(children,(item,index)=>{const isLastChild=index===lastChildIndex;return React.cloneElement(item,{...item.props,showSeparator:!isLastChild,["aria-current"]:isLastChild?"page":undefined})})})})});var Breadcrumbs$1 = Breadcrumbs;
11
9
 
12
- export { Breadcrumbs, BreadcrumbsItem };
10
+ var modules_31015aff={"item":"wb-breadcrumbs-item-item-44aa9824","separator":"wb-breadcrumbs-item-separator-44aa9824"};
11
+
12
+ const StyledLi=addStyle("li");const StyledSvg=addStyle("svg");const BreadcrumbsItem=React.forwardRef(function BreadcrumbsItem(props,ref){const{children,showSeparator,testId,...otherProps}=props;const _renderSeparator=()=>{return jsx(StyledSvg,{style:modules_31015aff.separator,width:16,height:16,viewBox:"0 0 16 16","aria-hidden":true,children:jsx("circle",{cx:"8",cy:"9",r:"1.5"})})};return jsxs(StyledLi,{...otherProps,style:modules_31015aff.item,"data-testid":testId,ref:ref,children:[children,showSeparator&&_renderSeparator()]})});var BreadcrumbsItem$1 = BreadcrumbsItem;
13
+
14
+ export { Breadcrumbs$1 as Breadcrumbs, BreadcrumbsItem$1 as BreadcrumbsItem };
15
+
16
+ import "./index.css";
package/dist/index.css ADDED
@@ -0,0 +1,40 @@
1
+ @layer shared {/**
2
+ * Breadcrumbs styles
3
+ *
4
+ * Breadcrumbs has no theme of its own, so every value is the plain `--wb-*`
5
+ * token. The list is rendered by `addStyle`, which ships no class of its own,
6
+ * so this single-class rule doesn't compete with anything else in
7
+ * `@layer shared`. The items' styles live in `breadcrumbs-item.module.css`.
8
+ * The build wraps every rule in `@layer shared { … }`.
9
+ */.wb-breadcrumbs-container-825ed2ba {
10
+ display: flex;
11
+ list-style: none;
12
+ margin: 0;
13
+ padding: 0;
14
+ overflow: hidden;
15
+ }
16
+ }
17
+
18
+ @layer shared {/**
19
+ * BreadcrumbsItem styles
20
+ *
21
+ * Every value is the plain `--wb-*` token. The item and its separator are
22
+ * rendered by `addStyle`, which ships no class of its own, so these
23
+ * single-class rules don't compete with anything else in `@layer shared`
24
+ * (and none of them targets the same element as `breadcrumbs.module.css`,
25
+ * so the order the two files load in doesn't matter). The build wraps every
26
+ * rule in `@layer shared { … }`.
27
+ */.wb-breadcrumbs-item-item-44aa9824 {
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ margin-inline-end: var(--wb-sizing-size_040);
32
+ line-height: inherit;
33
+ font-family: var(--wb-font-family-sans);
34
+ }/* The circular bullet point drawn between items. */.wb-breadcrumbs-item-separator-44aa9824 {
35
+ margin-inline-start: var(--wb-sizing-size_040);
36
+ fill: var(--wb-semanticColor-core-foreground-neutral-default);
37
+ }
38
+ }
39
+
40
+ /*# sourceMappingURL=index.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["<no source>","../src/components/breadcrumbs.module.css","../src/components/breadcrumbs-item.module.css"],"names":[],"mappings":"AAAA,eCAA;;;;;;;;EAQE,CAEF;IACI,aAAa;IACb,gBAAgB;IAChB,SAAS;IACT,UAAU;IACV,gBAAgB;AACpB;CDhBA;;AAAA,eEAA;;;;;;;;;EASE,CAEF;IACI,aAAa;IACb,mBAAmB;IACnB,uBAAuB;IACvB,4CAA4C;IAC5C,oBAAoB;IACpB,uCAAuC;AAC3C,CAEA,mDAAmD,CACnD;IACI,8CAA8C;IAC9C,6DAA6D;AACjE;CFxBA","file":"index.css","sourcesContent":[null,"/**\n * Breadcrumbs styles\n *\n * Breadcrumbs has no theme of its own, so every value is the plain `--wb-*`\n * token. The list is rendered by `addStyle`, which ships no class of its own,\n * so this single-class rule doesn't compete with anything else in\n * `@layer shared`. The items' styles live in `breadcrumbs-item.module.css`.\n * The build wraps every rule in `@layer shared { … }`.\n */\n\n.container {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n overflow: hidden;\n}\n","/**\n * BreadcrumbsItem styles\n *\n * Every value is the plain `--wb-*` token. The item and its separator are\n * rendered by `addStyle`, which ships no class of its own, so these\n * single-class rules don't compete with anything else in `@layer shared`\n * (and none of them targets the same element as `breadcrumbs.module.css`,\n * so the order the two files load in doesn't matter). The build wraps every\n * rule in `@layer shared { … }`.\n */\n\n.item {\n display: flex;\n align-items: center;\n justify-content: center;\n margin-inline-end: var(--wb-sizing-size_040);\n line-height: inherit;\n font-family: var(--wb-font-family-sans);\n}\n\n/* The circular bullet point drawn between items. */\n.separator {\n margin-inline-start: var(--wb-sizing-size_040);\n fill: var(--wb-semanticColor-core-foreground-neutral-default);\n}\n"]}
package/dist/index.js CHANGED
@@ -4,10 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
- var aphrodite = require('aphrodite');
8
7
  var wonderBlocksConfig = require('@khanacademy/wonder-blocks-config');
9
8
  var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
10
- var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
11
9
 
12
10
  function _interopNamespace(e) {
13
11
  if (e && e.__esModule) return e;
@@ -29,9 +27,15 @@ function _interopNamespace(e) {
29
27
 
30
28
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
31
29
 
32
- const StyledOl=wonderBlocksCore.addStyle("ol");const Breadcrumbs=React__namespace.forwardRef(function Breadcrumbs(props,ref){const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const{"aria-label":ariaLabel,children,testId,...otherProps}=props;const lastChildIndex=React__namespace.Children.count(children)-1;return jsxRuntime.jsx("nav",{...otherProps,"aria-label":ariaLabel||strings.breadcrumbs,"data-testid":testId,ref:ref,children:jsxRuntime.jsx(StyledOl,{style:styles$1.container,children:React__namespace.Children.map(children,(item,index)=>{const isLastChild=index===lastChildIndex;return React__namespace.cloneElement(item,{...item.props,showSeparator:!isLastChild,["aria-current"]:isLastChild?"page":undefined})})})})});const styles$1=aphrodite.StyleSheet.create({container:{display:"flex",listStyle:"none",margin:0,padding:0,overflow:"hidden"}});
30
+ var modules_14357f3f={"container":"wb-breadcrumbs-container-825ed2ba"};
33
31
 
34
- const StyledLi=wonderBlocksCore.addStyle("li");const StyledSvg=wonderBlocksCore.addStyle("svg");const BreadcrumbsItem=React__namespace.forwardRef(function BreadcrumbsItem(props,ref){const{children,showSeparator,testId,...otherProps}=props;const _renderSeparator=()=>{return jsxRuntime.jsx(StyledSvg,{style:styles.separator,width:16,height:16,viewBox:"0 0 16 16","aria-hidden":true,children:jsxRuntime.jsx("circle",{cx:"8",cy:"9",r:"1.5"})})};return jsxRuntime.jsxs(StyledLi,{...otherProps,style:styles.item,"data-testid":testId,ref:ref,children:[children,showSeparator&&_renderSeparator()]})});const styles=aphrodite.StyleSheet.create({item:{display:"flex",alignItems:"center",justifyContent:"center",marginInlineEnd:wonderBlocksTokens.sizing.size_040,lineHeight:"inherit",fontFamily:wonderBlocksTokens.font.family.sans},separator:{marginInlineStart:wonderBlocksTokens.sizing.size_040,fill:wonderBlocksTokens.semanticColor.core.foreground.neutral.default}});
32
+ const StyledOl=wonderBlocksCore.addStyle("ol");const Breadcrumbs=React__namespace.forwardRef(function Breadcrumbs(props,ref){const{strings}=wonderBlocksConfig.useWonderBlocksI18n();const{"aria-label":ariaLabel,children,testId,...otherProps}=props;const lastChildIndex=React__namespace.Children.count(children)-1;return jsxRuntime.jsx("nav",{...otherProps,"aria-label":ariaLabel||strings.breadcrumbs,"data-testid":testId,ref:ref,children:jsxRuntime.jsx(StyledOl,{style:modules_14357f3f.container,children:React__namespace.Children.map(children,(item,index)=>{const isLastChild=index===lastChildIndex;return React__namespace.cloneElement(item,{...item.props,showSeparator:!isLastChild,["aria-current"]:isLastChild?"page":undefined})})})})});var Breadcrumbs$1 = Breadcrumbs;
35
33
 
36
- exports.Breadcrumbs = Breadcrumbs;
37
- exports.BreadcrumbsItem = BreadcrumbsItem;
34
+ var modules_31015aff={"item":"wb-breadcrumbs-item-item-44aa9824","separator":"wb-breadcrumbs-item-separator-44aa9824"};
35
+
36
+ const StyledLi=wonderBlocksCore.addStyle("li");const StyledSvg=wonderBlocksCore.addStyle("svg");const BreadcrumbsItem=React__namespace.forwardRef(function BreadcrumbsItem(props,ref){const{children,showSeparator,testId,...otherProps}=props;const _renderSeparator=()=>{return jsxRuntime.jsx(StyledSvg,{style:modules_31015aff.separator,width:16,height:16,viewBox:"0 0 16 16","aria-hidden":true,children:jsxRuntime.jsx("circle",{cx:"8",cy:"9",r:"1.5"})})};return jsxRuntime.jsxs(StyledLi,{...otherProps,style:modules_31015aff.item,"data-testid":testId,ref:ref,children:[children,showSeparator&&_renderSeparator()]})});var BreadcrumbsItem$1 = BreadcrumbsItem;
37
+
38
+ exports.Breadcrumbs = Breadcrumbs$1;
39
+ exports.BreadcrumbsItem = BreadcrumbsItem$1;
40
+
41
+ require("./index.css");
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "3.3.8",
6
+ "version": "4.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -19,13 +19,27 @@
19
19
  "main": "dist/index.js",
20
20
  "module": "dist/es/index.js",
21
21
  "types": "dist/index.d.ts",
22
+ "sideEffects": [
23
+ "**/*.css"
24
+ ],
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/es/index.js",
29
+ "require": "./dist/index.js"
30
+ },
31
+ "./css": {
32
+ "import": "./dist/es/index.css",
33
+ "require": "./dist/index.css",
34
+ "default": "./dist/index.css"
35
+ }
36
+ },
22
37
  "dependencies": {
23
38
  "@khanacademy/wonder-blocks-config": "0.7.1",
24
- "@khanacademy/wonder-blocks-core": "12.5.0",
25
- "@khanacademy/wonder-blocks-tokens": "18.2.1"
39
+ "@khanacademy/wonder-blocks-core": "13.0.0",
40
+ "@khanacademy/wonder-blocks-tokens": "18.3.0"
26
41
  },
27
42
  "peerDependencies": {
28
- "aphrodite": "^1.2.5",
29
43
  "react": "18.2.0"
30
44
  },
31
45
  "devDependencies": {