@microbit/ui 0.5.2 → 0.6.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.
Files changed (3) hide show
  1. package/README.md +14 -4
  2. package/package.json +8 -7
  3. package/src/system.ts +13 -10
package/README.md CHANGED
@@ -25,10 +25,12 @@ setup below, minus the app/brand presets. Everything an app must do:
25
25
 
26
26
  Later presets override earlier ones token-by-token — the base recipes and
27
27
  semantic tokens reference the brand tokens, which is how a brand swap
28
- restyles everything without touching recipes. Set `eject: true` (the stack
29
- supplies the full token system). After changing an _external_ preset
30
- dependency, regenerate clean: `rm -rf styled-system && npm run panda` —
31
- incremental codegen does not detect external preset changes.
28
+ restyles everything without touching recipes. Install
29
+ `@pandacss/preset-base` as a direct dependency: `@pandacss/dev` no longer
30
+ pulls it in, and nothing is added to the stack implicitly. After changing
31
+ an _external_ preset dependency, regenerate clean:
32
+ `rm -rf styled-system && npm run panda` — incremental codegen does not
33
+ detect external preset changes.
32
34
 
33
35
  2. **Include this package's source** in `panda.config.ts` so Panda extracts
34
36
  the styles the components use:
@@ -42,6 +44,14 @@ setup below, minus the app/brand presets. Everything an app must do:
42
44
  importers, this package's source included — a `styled-system` alias in
43
45
  both `tsconfig.json` `paths` and the bundler config (see the
44
46
  `viteFinal` in `apps/storybook`'s `.storybook/main.ts`).
47
+
48
+ App code imports `css`, `cx`, `cva` and `sva` from `styled-system/css`
49
+ and `styled` from `styled-system/jsx`, not from `@microbit/ui`: Panda
50
+ extracts those only when they are imported from the generated module, and
51
+ a call through a re-export emits no CSS and no diagnostic. What
52
+ `@microbit/ui` does export — the components, the layout patterns,
53
+ `token` — is safe wherever it is used.
54
+
45
55
  4. **Generate and load the CSS** with Panda's PostCSS plugin. Keep Vite's
46
56
  default transformer — do **not** set `css.transformer: "lightningcss"`,
47
57
  which disables PostCSS. Add a `postcss.config.cjs`:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microbit/ui",
3
- "version": "0.5.2",
3
+ "version": "0.6.0",
4
4
  "description": "micro:bit design-system primitives: react-aria-components + Panda CSS with a design language ported from Chakra UI v2. Ships as source; see README for the consumption setup.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -35,15 +35,16 @@
35
35
  "test": "vitest run"
36
36
  },
37
37
  "peerDependencies": {
38
- "@pandacss/dev": "^1.11.4",
38
+ "@pandacss/dev": "^2.4.0",
39
39
  "react": "^18.3.1 || ^19.0.0",
40
40
  "react-aria": "^3.50.0",
41
41
  "react-aria-components": "^1.19.0",
42
42
  "react-icons": "^4.12.0 || ^5.0.0",
43
- "react-intl": "^6.6.8 || ^7.0.0"
43
+ "react-intl": "^6.6.8 || ^7.0.0 || ^10.1.14 || ^12.0.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@pandacss/dev": "^1.11.4",
46
+ "@pandacss/dev": "^2.4.0",
47
+ "@pandacss/preset-base": "^2.4.0",
47
48
  "@storybook/react-vite": "^10.5.2",
48
49
  "@testing-library/react": "^16.3.2",
49
50
  "@testing-library/user-event": "^14.6.1",
@@ -51,15 +52,15 @@
51
52
  "@types/react": "^18.3.3",
52
53
  "@types/react-dom": "^18.3.0",
53
54
  "@vitejs/plugin-react": "^5.2.0",
54
- "jsdom": "^29.1.1",
55
+ "jsdom": "^30.1.3",
55
56
  "react": "^18.3.1",
56
57
  "react-aria": "^3.50.0",
57
58
  "react-aria-components": "^1.19.0",
58
59
  "react-dom": "^18.3.1",
59
60
  "react-icons": "^4.12.0",
60
- "react-intl": "^6.6.8",
61
+ "react-intl": "^12.1.5",
61
62
  "typescript": "^5.4.2",
62
63
  "vite": "^7.3.6",
63
- "vitest": "^4.1.10"
64
+ "vitest": "^5.0.5"
64
65
  }
65
66
  }
package/src/system.ts CHANGED
@@ -4,11 +4,18 @@
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
6
  /**
7
- * Stable re-export of the Panda styling primitives and layout patterns, so
7
+ * Stable re-export of the Panda layout patterns and runtime helpers, so
8
8
  * shared-ui consumers (and a future extracted library) import from one place
9
9
  * rather than reaching into the generated `styled-system` directly.
10
+ *
11
+ * `css`, `cva`, `sva`, `cx` and `styled` are deliberately NOT re-exported:
12
+ * Panda extracts those only when they are imported from `styled-system`, so
13
+ * calls reaching one through here would produce no CSS and no diagnostic.
14
+ * (`cx` only joins strings, but it shares the import line with `css`.)
15
+ * Everything this module does export works wherever it is used: the pattern
16
+ * components extract by name, and `token` is a runtime variable lookup with
17
+ * nothing to extract.
10
18
  */
11
- export { css, cva, sva, cx } from "styled-system/css";
12
19
  export { token } from "styled-system/tokens";
13
20
  export type { SystemStyleObject } from "styled-system/types";
14
21
  // react-aria collection types call sites need for selection handlers.
@@ -22,13 +29,10 @@ export type {
22
29
  GridProps,
23
30
  } from "styled-system/jsx";
24
31
 
25
- // Layout patterns — Box/Flex/Stack/etc.
26
- //
27
- // `styled` is re-exported for the `styled(Component)` form, which works from
28
- // anywhere. The `styled.tag` JSX form does NOT: Panda recognises the factory by
29
- // the module it was imported from, so `<styled.table css={…}>` on a `styled`
30
- // imported from here silently produces no CSS. Import it from
31
- // "styled-system/jsx" for that.
32
+ // Layout patterns — Box/Flex/Stack/etc. These extract by component and prop
33
+ // name, so their style props work through a re-export. `styled` does not:
34
+ // `styled(Component)` would be safe but `<styled.table css={…}>` silently
35
+ // produces no CSS, so it stays in "styled-system/jsx" with the helpers.
32
36
  export {
33
37
  AspectRatio,
34
38
  Box,
@@ -41,7 +45,6 @@ export {
41
45
  GridItem,
42
46
  Center,
43
47
  Wrap,
44
- styled,
45
48
  } from "styled-system/jsx";
46
49
 
47
50
  /**