@workday/canvas-kit-docs 12.4.17 → 12.4.18

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 +1 @@
1
- {"version":3,"file":"ExampleCodeBlock.d.ts","sourceRoot":"","sources":["../../../lib/ExampleCodeBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiE1B,eAAO,MAAM,gBAAgB,aAAY,GAAG,sBAwG3C,CAAC"}
1
+ {"version":3,"file":"ExampleCodeBlock.d.ts","sourceRoot":"","sources":["../../../lib/ExampleCodeBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiE1B,eAAO,MAAM,gBAAgB,aAAY,GAAG,sBA0G3C,CAAC"}
@@ -80,7 +80,9 @@ export const ExampleCodeBlock = ({ code }) => {
80
80
  * `code` returns our examples. We need to rewrite them so that they export `Demo`.
81
81
  */
82
82
  const handleExampleRewrite = (code) => {
83
- return code.replace(/\bexport\s+const\s+(\w+)\s*=/, `export const Demo =`);
83
+ return code
84
+ .replace(/\bexport\s+const\s+(\w+)\s*=/, `export const Demo =`)
85
+ .replace(/export default/, 'export const Demo =');
84
86
  };
85
87
  const openProjectInStackblitz = () => {
86
88
  sdk.openProject({
@@ -0,0 +1,15 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: {browser: true, es2020: true},
4
+ extends: [
5
+ 'eslint:recommended',
6
+ 'plugin:@typescript-eslint/recommended',
7
+ 'plugin:react-hooks/recommended',
8
+ ],
9
+ ignorePatterns: ['dist', '.eslintrc.cjs'],
10
+ parser: '@typescript-eslint/parser',
11
+ plugins: ['react-refresh'],
12
+ rules: {
13
+ 'react-refresh/only-export-components': ['warn', {allowConstantExport: true}],
14
+ },
15
+ };
@@ -0,0 +1,34 @@
1
+ import * as React from 'react';
2
+ import {
3
+ CanvasProvider,
4
+ ContentDirection,
5
+ PartialEmotionCanvasTheme,
6
+ useTheme,
7
+ } from '@workday/canvas-kit-react/common';
8
+ import {createStyles} from '@workday/canvas-kit-styling';
9
+
10
+ import {Demo} from './Demo';
11
+ import {system} from '@workday/canvas-tokens-web';
12
+
13
+ const mainContentStyles = createStyles({
14
+ padding: system.space.x4,
15
+ });
16
+
17
+ export const App = () => {
18
+ // useTheme is filling in the Canvas theme object if any keys are missing
19
+ const canvasTheme: PartialEmotionCanvasTheme = useTheme({
20
+ canvas: {
21
+ direction: ContentDirection.LTR,
22
+ },
23
+ });
24
+
25
+ return (
26
+ <CanvasProvider theme={canvasTheme}>
27
+ <>
28
+ <main className={mainContentStyles}>
29
+ <Demo />
30
+ </main>
31
+ </>
32
+ </CanvasProvider>
33
+ );
34
+ };
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+
3
+ export const Demo = ({}) => <div></div>;
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + React + TS</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.tsx"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,28 @@
1
+ import * as React from 'react';
2
+ import {createRoot} from 'react-dom/client';
3
+ import {fonts} from '@workday/canvas-kit-react-fonts';
4
+ import {system} from '@workday/canvas-tokens-web';
5
+ import {cssVar, injectGlobal} from '@workday/canvas-kit-styling';
6
+ import {App} from './App';
7
+
8
+ import '@workday/canvas-tokens-web/css/base/_variables.css';
9
+ import '@workday/canvas-tokens-web/css/brand/_variables.css';
10
+ import '@workday/canvas-tokens-web/css/system/_variables.css';
11
+
12
+ //@ts-ignore
13
+ injectGlobal({
14
+ ...fonts,
15
+ 'html, body': {
16
+ fontFamily: cssVar(system.fontFamily.default),
17
+ margin: 0,
18
+ minHeight: '100vh',
19
+ },
20
+ '#root, #root < div': {
21
+ minHeight: '100vh',
22
+ ...system.type.body.small,
23
+ },
24
+ });
25
+
26
+ const container = document.getElementById('root')!;
27
+ const root = createRoot(container);
28
+ root.render(<App />);
@@ -0,0 +1,42 @@
1
+ // @ts-ignore: Cannot find module error
2
+
3
+ export const packageJSONFile = `{
4
+ "name": "vite-react-typescript-starter",
5
+ "private": true,
6
+ "version": "0.0.0",
7
+ "type": "module",
8
+ "scripts": {
9
+ "dev": "vite",
10
+ "build": "tsc && vite build",
11
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
12
+ "preview": "vite preview"
13
+ },
14
+ "dependencies": {
15
+ "react": "^18.2.0",
16
+ "react-dom": "^18.2.0",
17
+ "@emotion/css": "11.11.2",
18
+ "@emotion/react": "11.11.4",
19
+ "@types/react": "18.2.60",
20
+ "@types/react-dom": "18.2.19",
21
+ "@workday/canvas-kit-labs-react": "12.4.18",
22
+ "@workday/canvas-kit-preview-react": "12.4.18",
23
+ "@workday/canvas-kit-react": "12.4.18",
24
+ "@workday/canvas-kit-react-fonts": "^12.4.18",
25
+ "@workday/canvas-kit-styling": "12.4.18",
26
+ "@workday/canvas-system-icons-web": "3.0.22",
27
+ "@workday/canvas-tokens-web": "2.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/react": "^18.2.59",
31
+ "@types/react-dom": "^18.2.19",
32
+ "@typescript-eslint/eslint-plugin": "^7.1.0",
33
+ "@typescript-eslint/parser": "^7.1.0",
34
+ "@vitejs/plugin-react": "^4.2.1",
35
+ "eslint": "^8.57.0",
36
+ "eslint-plugin-react-hooks": "^4.6.0",
37
+ "eslint-plugin-react-refresh": "^0.4.5",
38
+ "typescript": "^5.2.2",
39
+ "vite": "^5.1.4"
40
+ }
41
+ }
42
+ `;
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "useDefineForClassFields": true,
5
+ "lib": ["ES2020", "DOM", "DOM.Iterable"],
6
+ "module": "ESNext",
7
+ "skipLibCheck": true,
8
+
9
+ /* Bundler mode */
10
+ "moduleResolution": "bundler",
11
+ "allowImportingTsExtensions": true,
12
+ "resolveJsonModule": true,
13
+ "isolatedModules": true,
14
+ "noEmit": true,
15
+ "jsx": "react-jsx",
16
+ "types": ["vite-env"],
17
+
18
+ /* Linting */
19
+ "strict": true,
20
+ "noUnusedLocals": true,
21
+ "noUnusedParameters": true,
22
+ "noFallthroughCasesInSwitch": true
23
+ },
24
+ "include": ["src"],
25
+ "references": [{ "path": "./tsconfig.node.json" }]
26
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "skipLibCheck": true,
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "allowSyntheticDefaultImports": true,
8
+ "strict": true
9
+ },
10
+ "include": ["vite.config.ts"]
11
+ }
12
+
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />`
@@ -0,0 +1,10 @@
1
+ /// <reference path="./types/custom-imports.d.ts" />
2
+
3
+ import {defineConfig} from 'vite';
4
+
5
+ import react from '@vitejs/plugin-react';
6
+
7
+ // https://vitejs.dev/config/
8
+ export default defineConfig({
9
+ plugins: [react()],
10
+ });
@@ -86,7 +86,9 @@ export const ExampleCodeBlock = ({code}: any) => {
86
86
  * `code` returns our examples. We need to rewrite them so that they export `Demo`.
87
87
  */
88
88
  const handleExampleRewrite = (code: any) => {
89
- return code.replace(/\bexport\s+const\s+(\w+)\s*=/, `export const Demo =`);
89
+ return code
90
+ .replace(/\bexport\s+const\s+(\w+)\s*=/, `export const Demo =`)
91
+ .replace(/export default/, 'export const Demo =');
90
92
  };
91
93
 
92
94
  const openProjectInStackblitz = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "12.4.17",
3
+ "version": "12.4.18",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -45,10 +45,10 @@
45
45
  "@emotion/styled": "^11.6.0",
46
46
  "@stackblitz/sdk": "^1.11.0",
47
47
  "@storybook/csf": "0.0.1",
48
- "@workday/canvas-kit-labs-react": "^12.4.17",
49
- "@workday/canvas-kit-preview-react": "^12.4.17",
50
- "@workday/canvas-kit-react": "^12.4.17",
51
- "@workday/canvas-kit-styling": "^12.4.17",
48
+ "@workday/canvas-kit-labs-react": "^12.4.18",
49
+ "@workday/canvas-kit-preview-react": "^12.4.18",
50
+ "@workday/canvas-kit-react": "^12.4.18",
51
+ "@workday/canvas-kit-styling": "^12.4.18",
52
52
  "@workday/canvas-system-icons-web": "^3.0.0",
53
53
  "@workday/canvas-tokens-web": "^2.1.1",
54
54
  "markdown-to-jsx": "^7.2.0",
@@ -61,5 +61,5 @@
61
61
  "mkdirp": "^1.0.3",
62
62
  "typescript": "5.0"
63
63
  },
64
- "gitHead": "7c83a9837b73e969423cfe67b31ed7167cf9fdab"
64
+ "gitHead": "48387697acdb14e7688ee9d7d7b8a0827a52c07a"
65
65
  }