braid-design-system 31.21.1 → 31.22.1

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,33 @@
1
1
  # braid-design-system
2
2
 
3
+ ## 31.22.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix type checking for Playroom config ([#1192](https://github.com/seek-oss/braid-design-system/pull/1192))
8
+
9
+ ## 31.22.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Expose Playroom config ([#1190](https://github.com/seek-oss/braid-design-system/pull/1190))
14
+
15
+ This allows consuming packages (e.g. Metropolis) to enhance the Playroom experience by leveraging Braid's internal Playroom configuration.
16
+
17
+ **EXAMPLE USAGE:**
18
+
19
+ ```jsx
20
+ // playroom.config.js
21
+ module.exports = {
22
+ frameComponent: require.resolve(
23
+ 'braid-design-system/playroom/FrameComponent.tsx',
24
+ ),
25
+ components: require.resolve('braid-design-system/playroom/components.ts'),
26
+ snippets: require.resolve('braid-design-system/playroom/snippets.ts'),
27
+ scope: require.resolve('braid-design-system/playroom/scope.ts'),
28
+ };
29
+ ```
30
+
3
31
  ## 31.21.1
4
32
 
5
33
  ### Patch Changes
@@ -3,9 +3,9 @@ import type { Snippets as PlayroomSnippets } from 'playroom';
3
3
  import type { Optional } from 'utility-types';
4
4
  import type { Source } from '../../utils/source.macro';
5
5
 
6
- export interface BraidSnippet
6
+ interface BraidSnippet
7
7
  extends Omit<Optional<PlayroomSnippets[number], 'group'>, 'code'> {
8
8
  code: Source<ReactElement>;
9
9
  }
10
10
 
11
- export type Snippets = Array<BraidSnippet>;
11
+ export type Snippets = BraidSnippet[];
@@ -10,12 +10,12 @@ export const ensureResetImported = () => {
10
10
  if (!resetImported) {
11
11
  throw new Error(dedent`
12
12
  Braid components imported before reset.
13
-
14
- Make sure to import the Braid reset module before importing any components.
15
- This ensures the CSS reset does not override the component styles.
16
-
13
+
14
+ Make sure to import the Braid reset module before importing any components.
15
+ This ensures the CSS reset does not override the component styles.
16
+
17
17
  e.g.
18
-
18
+
19
19
  import 'braid-design-system/reset'; // <-- Must be first
20
20
  import { BraidProvider, Box } from 'braid-design-system';
21
21
  `);
@@ -1,7 +1,8 @@
1
1
  import { flatten } from 'lodash';
2
- import type { BraidSnippet } from '../components/private/Snippets';
2
+ import type { Snippets } from '../components/private/Snippets';
3
3
 
4
4
  const req = require.context('../components', true, /\.snippets\.tsx?$/);
5
+
5
6
  export default flatten(
6
7
  req.keys().map((filename) => {
7
8
  const matches = filename.match(/([a-zA-Z]+)\.snippets\.tsx?$/);
@@ -9,7 +10,7 @@ export default flatten(
9
10
  return [];
10
11
  }
11
12
 
12
- const snippets = req(filename).snippets as BraidSnippet[];
13
+ const snippets = req(filename).snippets as Snippets;
13
14
 
14
15
  return snippets.map((snippet) => ({
15
16
  ...snippet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-design-system",
3
- "version": "31.21.1",
3
+ "version": "31.22.1",
4
4
  "description": "Themeable design system for the SEEK Group",
5
5
  "main": "lib/components/index.ts",
6
6
  "bin": {
@@ -12,6 +12,7 @@
12
12
  "lib/css/reset/**/*",
13
13
  "themes/**/*",
14
14
  "reset/**/*",
15
+ "playroom/**/*",
15
16
  "*.css.ts"
16
17
  ],
17
18
  "repository": {
@@ -0,0 +1 @@
1
+ export { default } from '../lib/playroom/FrameComponent';
@@ -0,0 +1,17 @@
1
+ import dedent from 'dedent';
2
+
3
+ declare const global: typeof globalThis & {
4
+ __IS_PLAYROOM_ENVIRONMENT__?: string;
5
+ };
6
+ if (global?.__IS_PLAYROOM_ENVIRONMENT__ !== 'clearly') {
7
+ throw new Error(dedent`
8
+ Playroom prototyping components are being imported instead of Braid components.
9
+
10
+ These components must not be used in production. Please import from the top level Braid entry point:
11
+
12
+ -import { Component } from 'braid-design-system/playroom/components';
13
+ +import { Component } from 'braid-design-system';
14
+ `);
15
+ }
16
+
17
+ export * from '../lib/playroom/components';
@@ -0,0 +1 @@
1
+ export { default } from '../lib/playroom/useScope';
@@ -0,0 +1 @@
1
+ export { default } from '../lib/playroom/snippets';