@sfgov/design-system 0.0.0-53b7e30

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 (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/babel.config.js +16 -0
  4. package/dist/css/base.css +2 -0
  5. package/dist/css/base.css.map +1 -0
  6. package/dist/css/components.css +2 -0
  7. package/dist/css/components.css.map +1 -0
  8. package/dist/css/fonts.css +2 -0
  9. package/dist/css/fonts.css.map +1 -0
  10. package/dist/css/icons.css +2 -0
  11. package/dist/css/icons.css.map +1 -0
  12. package/dist/css/overrides.css +2 -0
  13. package/dist/css/overrides.css.map +1 -0
  14. package/dist/css/sfds.css +2 -0
  15. package/dist/css/sfds.css.map +1 -0
  16. package/dist/css/typography.css +2 -0
  17. package/dist/css/typography.css.map +1 -0
  18. package/dist/css/utilities.css +2 -0
  19. package/dist/css/utilities.css.map +1 -0
  20. package/dist/css/utilities.json +7350 -0
  21. package/dist/elements/index.d.mts +30 -0
  22. package/dist/elements/index.d.mts.map +1 -0
  23. package/dist/elements/index.d.ts +30 -0
  24. package/dist/elements/index.d.ts.map +1 -0
  25. package/dist/elements/index.js +1 -0
  26. package/dist/elements/index.mjs +1 -0
  27. package/dist/manifest.json +45 -0
  28. package/dist/react/index.d.mts +5725 -0
  29. package/dist/react/index.d.mts.map +1 -0
  30. package/dist/react/index.d.ts +5725 -0
  31. package/dist/react/index.d.ts.map +1 -0
  32. package/dist/react/index.js +1 -0
  33. package/dist/react/index.mjs +1 -0
  34. package/lib/markdownlint/frontmatter.js +51 -0
  35. package/lib/markdownlint/no-empty.js +19 -0
  36. package/package.json +348 -0
  37. package/postcss.config.js +17 -0
  38. package/rollup.config.mjs +72 -0
  39. package/svgo.config.js +27 -0
  40. package/tailwind.config.js +5 -0
  41. package/tailwind.preset.js +128 -0
package/package.json ADDED
@@ -0,0 +1,348 @@
1
+ {
2
+ "name": "@sfgov/design-system",
3
+ "version": "0.0.0-53b7e30",
4
+ "engines": {
5
+ "node": "16.x",
6
+ "npm": "8.x"
7
+ },
8
+ "config": {
9
+ "website_port": 3002,
10
+ "storybook_port": 3001
11
+ },
12
+ "repository": "SFDigitalServices/design-system",
13
+ "files": [
14
+ "dist",
15
+ "lib",
16
+ "tailwind.*",
17
+ "*.{config.*,rc}",
18
+ "!website/**",
19
+ "!storybook/**"
20
+ ],
21
+ "scripts": {
22
+ "build": "wireit",
23
+ "build:ci": "wireit",
24
+ "build:css": "wireit",
25
+ "build:css-manifest": "wireit",
26
+ "build:docs": "wireit",
27
+ "build:favicon": "mkdir -p public && curl -O https://sf.gov/favicon.ico --output-dir public",
28
+ "build:js": "wireit",
29
+ "build:manifest": "wireit",
30
+ "build:storybook": "wireit",
31
+ "build:urls": "wireit",
32
+ "build:website": "wireit",
33
+ "figma-export": "env-cmd -f .env figma-export use-config",
34
+ "lint": "wireit",
35
+ "lint:css": "stylelint '**/src/*.css'",
36
+ "lint:js": "eslint --ext js,jsx,mjs,ts,tsx css elements icons react '*.{js,mjs}'",
37
+ "lint:docs": "markdownlint --rules './lib/markdownlint/*.js' --ignore '**/node_modules/**' '**/*.md'",
38
+ "lint:scripts": "shellcheck scripts/*.sh",
39
+ "lint:storybook": "eslint --ext js,jsx,ts,tsx stories .storybook",
40
+ "lint:website": "npx eslint --ext js,jsx,ts,tsx website",
41
+ "postbuild:website": "scripts/run-website-checks.sh",
42
+ "postbuild:css": "npm run build:css-manifest",
43
+ "postfigma-export": "eslint --fix react/src/icons",
44
+ "prepublishOnly": "scripts/prepublish-checks.sh",
45
+ "serve:docs": "docusaurus serve website --dir public",
46
+ "start": "wireit",
47
+ "start:website": "wireit",
48
+ "start:storybook": "wireit",
49
+ "swizzle": "docusaurus swizzle",
50
+ "watch": "wireit",
51
+ "watch:css": "wireit",
52
+ "watch:js": "wireit",
53
+ "watch:icons": "echo 'watch icons (noop)'"
54
+ },
55
+ "wireit": {
56
+ "build": {
57
+ "dependencies": [
58
+ "build:css",
59
+ "build:js",
60
+ "build:manifest",
61
+ "build:website",
62
+ "build:storybook"
63
+ ]
64
+ },
65
+ "build:ci": {
66
+ "dependencies": [
67
+ "build:css",
68
+ "build:js",
69
+ "build:manifest"
70
+ ]
71
+ },
72
+ "build:css": {
73
+ "command": "postcss --verbose -d dist/css 'css/src/*.css'",
74
+ "files": [
75
+ "css/**",
76
+ "postcss.config.js"
77
+ ],
78
+ "output": [
79
+ "dist/**/*.css{,.map}"
80
+ ]
81
+ },
82
+ "build:css-manifest": {
83
+ "command": "node scripts/build-css-manifest.js",
84
+ "output": [
85
+ "dist/css/utilties.json"
86
+ ],
87
+ "files": [
88
+ "dist/css",
89
+ "!dist/css/**/*.json"
90
+ ],
91
+ "dependencies": [
92
+ "build:css"
93
+ ]
94
+ },
95
+ "build:docs": {
96
+ "command": "docusaurus build website --out-dir public",
97
+ "dependencies": [
98
+ "build:css",
99
+ "build:js",
100
+ "build:manifest"
101
+ ],
102
+ "files": [
103
+ "website/**"
104
+ ],
105
+ "output": [
106
+ "public"
107
+ ]
108
+ },
109
+ "build:js": {
110
+ "command": "rollup -c",
111
+ "files": [
112
+ "{elements,icons,react}/src/**",
113
+ "*.config.*"
114
+ ],
115
+ "output": [
116
+ "dist/**/*.{js,mjs}{,.map}"
117
+ ]
118
+ },
119
+ "build:website-index": {
120
+ "command": "find public -type f | grep -v '^storybook/' | perl -pe 's#^public/#/#' | sort > public/index.txt",
121
+ "dependencies": [
122
+ "build:docs"
123
+ ],
124
+ "clean": true,
125
+ "files": [
126
+ "public/**",
127
+ "!public/storybook"
128
+ ],
129
+ "output": [
130
+ "public/index.txt"
131
+ ]
132
+ },
133
+ "build:manifest": {
134
+ "command": "scripts/manifest.mjs 'dist/**/*.{css,js,mjs,svg}'",
135
+ "dependencies": [
136
+ "build:css",
137
+ "build:js",
138
+ "build:css-manifest"
139
+ ],
140
+ "output": [
141
+ "dist/manifest.json"
142
+ ]
143
+ },
144
+ "build:storybook": {
145
+ "command": "build-storybook -o public/storybook",
146
+ "clean": true,
147
+ "files": [
148
+ "public/storybook"
149
+ ],
150
+ "dependencies": [
151
+ "build:css",
152
+ "build:js"
153
+ ]
154
+ },
155
+ "build:urls": {
156
+ "command": "scripts/build-urls.sh",
157
+ "files": [
158
+ "public/index.txt"
159
+ ],
160
+ "output": [
161
+ "public/urls.txt"
162
+ ],
163
+ "dependencies": [
164
+ "build:docs"
165
+ ]
166
+ },
167
+ "build:website": {
168
+ "dependencies": [
169
+ "build:docs",
170
+ "build:storybook",
171
+ "build:urls",
172
+ "build:favicon"
173
+ ]
174
+ },
175
+ "lint": {
176
+ "dependencies": [
177
+ "lint:css",
178
+ "lint:js",
179
+ "lint:docs",
180
+ "lint:scripts",
181
+ "lint:website",
182
+ "lint:storybook"
183
+ ]
184
+ },
185
+ "start": {
186
+ "dependencies": [
187
+ "watch",
188
+ "start:website",
189
+ "start:storybook"
190
+ ]
191
+ },
192
+ "start:website": {
193
+ "command": "docusaurus start website --port=3002",
194
+ "service": true,
195
+ "files": [
196
+ "website/*.js",
197
+ "package.json"
198
+ ],
199
+ "dependencies": [
200
+ "build:css",
201
+ "build:js",
202
+ "build:manifest"
203
+ ]
204
+ },
205
+ "start:storybook": {
206
+ "command": "start-storybook --port=3001",
207
+ "service": true,
208
+ "files": [
209
+ ".storybook/*",
210
+ "package.json"
211
+ ],
212
+ "dependencies": [
213
+ "build:css",
214
+ "build:js"
215
+ ]
216
+ },
217
+ "watch": {
218
+ "dependencies": [
219
+ "watch:css",
220
+ "watch:icons",
221
+ "watch:js"
222
+ ]
223
+ },
224
+ "watch:css": {
225
+ "command": "npm run build:css -- --watch",
226
+ "service": true,
227
+ "files": [
228
+ "postcss.config.js"
229
+ ]
230
+ },
231
+ "watch:js": {
232
+ "command": "rollup -c --watch",
233
+ "service": true,
234
+ "files": [
235
+ "rollup.config.*"
236
+ ]
237
+ }
238
+ },
239
+ "peerDependencies": {
240
+ "react": "^18.2.0",
241
+ "react-dom": "^18.2.0",
242
+ "tailwindcss": "^2.2.19"
243
+ },
244
+ "peerDependenciesMeta": {
245
+ "react": {
246
+ "optional": true
247
+ },
248
+ "react-dom": {
249
+ "optional": true
250
+ },
251
+ "tailwindcss": {
252
+ "optional": true
253
+ }
254
+ },
255
+ "devDependencies": {
256
+ "@babel/cli": "^7.20.7",
257
+ "@babel/core": "^7.20.12",
258
+ "@babel/preset-env": "^7.20.2",
259
+ "@babel/preset-react": "^7.18.6",
260
+ "@babel/preset-typescript": "^7.18.6",
261
+ "@docusaurus/core": "^2.2.0",
262
+ "@docusaurus/eslint-plugin": "^2.2.0",
263
+ "@docusaurus/module-type-aliases": "^2.2.0",
264
+ "@docusaurus/plugin-client-redirects": "^2.2.0",
265
+ "@docusaurus/preset-classic": "^2.2.0",
266
+ "@docusaurus/theme-live-codeblock": "^2.2.0",
267
+ "@figma-export/cli": "^4.5.0",
268
+ "@figma-export/output-components-as-svg": "^4.5.0",
269
+ "@figma-export/output-components-as-svgr": "^4.5.0",
270
+ "@figma-export/transform-svg-with-svgo": "^4.5.0",
271
+ "@figma-export/types": "^4.5.0",
272
+ "@mdx-js/react": "^1.6.22",
273
+ "@rollup/plugin-babel": "^6.0.3",
274
+ "@rollup/plugin-commonjs": "^24.0.0",
275
+ "@rollup/plugin-json": "^6.0.0",
276
+ "@rollup/plugin-node-resolve": "^15.0.1",
277
+ "@stitches/react": "^1.2.8",
278
+ "@storybook/addon-actions": "^6.5.15",
279
+ "@storybook/addon-essentials": "^6.5.15",
280
+ "@storybook/addon-interactions": "^6.5.15",
281
+ "@storybook/addon-links": "^6.5.15",
282
+ "@storybook/addon-storysource": "^6.5.15",
283
+ "@storybook/builder-webpack5": "^6.5.15",
284
+ "@storybook/manager-webpack5": "^6.5.15",
285
+ "@storybook/react": "^6.5.15",
286
+ "@storybook/testing-library": "^0.0.13",
287
+ "@tsconfig/docusaurus": "^1.0.6",
288
+ "@types/eslint": "^8.4.2",
289
+ "@types/node": "^16.18.6",
290
+ "@typescript-eslint/eslint-plugin": "^5.45.0",
291
+ "@typescript-eslint/parser": "^5.45.0",
292
+ "autoprefixer": "^10.4.7",
293
+ "babel-loader": "^8.2.5",
294
+ "clsx": "^1.1.0",
295
+ "core-js": "^3.27.1",
296
+ "cssnano": "^5.1.14",
297
+ "dedent": "^0.7.0",
298
+ "dotenv": "^16.0.3",
299
+ "env-cmd": "^10.1.0",
300
+ "eslint": "^8.24.0",
301
+ "eslint-plugin-html": "^6.2.0",
302
+ "eslint-plugin-import": "^2.26.0",
303
+ "eslint-plugin-n": "^15.5.1",
304
+ "eslint-plugin-promise": "^6.0.0",
305
+ "eslint-plugin-react": "^7.30.0",
306
+ "eslint-plugin-sfgov": "^2.0.0",
307
+ "eslint-plugin-storybook": "^0.6.4",
308
+ "eslint-plugin-unicorn": "^42.0.0",
309
+ "filesize": "^8.0.7",
310
+ "fs-extra": "^11.1.0",
311
+ "globby": "^13.1.3",
312
+ "js-yaml": "^4.1.0",
313
+ "lodash.startcase": "^4.4.0",
314
+ "markdownlint-cli": "^0.31.1",
315
+ "postcss": "^8.4.14",
316
+ "postcss-cli": "^10.1.0",
317
+ "postcss-import": "^15.1.0",
318
+ "postcss-nested": "^6.0.0",
319
+ "prettysize": "^2.0.0",
320
+ "prism-react-renderer": "^1.3.1",
321
+ "prop-types": "^15.8.1",
322
+ "raw-loader": "^4.0.2",
323
+ "react": "^18.2.0",
324
+ "react-copy-to-clipboard": "^5.1.0",
325
+ "react-dom": "^18.2.0",
326
+ "react-masonry-css": "^1.0.16",
327
+ "react-shadow": "^19.0.3",
328
+ "rollup": "^3.9.1",
329
+ "rollup-cache": "^1.2.0",
330
+ "rollup-plugin-peer-deps-external": "^2.2.4",
331
+ "rollup-plugin-terser": "^7.0.2",
332
+ "rollup-plugin-ts": "^3.1.1",
333
+ "shellcheck": "^1.1.0",
334
+ "storybook-addon-designs": "^6.3.1",
335
+ "storybook-source-link": "^2.0.4",
336
+ "stylelint": "^14.8.4",
337
+ "stylelint-config-standard": "^25.0.0",
338
+ "stylelint-config-tailwindcss": "^0.0.7",
339
+ "stylelint-expiring-todo-comments": "^0.0.1",
340
+ "svgo": "^3.0.2",
341
+ "tailwind-styled-components": "^2.2.0",
342
+ "tailwindcss": "^2.2.19",
343
+ "tailwindcss-interaction-variants": "^5.0.0",
344
+ "typescript": "^4.9.3",
345
+ "use-bus": "^2.5.1",
346
+ "wireit": "^0.9.3"
347
+ }
348
+ }
@@ -0,0 +1,17 @@
1
+ const { NODE_ENV } = process.env
2
+ const production = NODE_ENV === 'production'
3
+
4
+ /** @type {import('postcss').ProcessOptions} */
5
+ module.exports = {
6
+ /** @type {import('postcss').AcceptedPlugin[]} */
7
+ plugins: [
8
+ require('postcss-import'),
9
+ require('postcss-nested'),
10
+ require('tailwindcss'),
11
+ require('autoprefixer'),
12
+ production && require('cssnano')
13
+ ].filter(Boolean),
14
+ map: {
15
+ inline: false
16
+ }
17
+ }
@@ -0,0 +1,72 @@
1
+ import commonjs from '@rollup/plugin-commonjs'
2
+ import json from '@rollup/plugin-json'
3
+ import peerDepsExternal from 'rollup-plugin-peer-deps-external'
4
+ import resolve from '@rollup/plugin-node-resolve'
5
+ import ts from 'rollup-plugin-ts'
6
+ import { terser } from 'rollup-plugin-terser'
7
+
8
+ /**
9
+ * @typedef {import('rollup').RollupOptions} RollupOptions
10
+ * @typedef {import('rollup').InputOptions} InputOptions
11
+ * @typedef {import('rollup').OutputOptions} OutputOptions
12
+ */
13
+
14
+ const { NODE_ENV } = process.env
15
+ const production = NODE_ENV === 'production'
16
+ const sourcemap = !production
17
+
18
+ const commonPlugins = [
19
+ commonjs({
20
+ }),
21
+ json({
22
+ compact: true
23
+ }),
24
+ resolve({
25
+ }),
26
+ peerDepsExternal(),
27
+ ts({
28
+ transpiler: 'babel'
29
+ }),
30
+ production && terser()
31
+ ]
32
+
33
+ /** @type {RollupOptions[]} */
34
+ export default [
35
+ {
36
+ input: './elements/src/index.js',
37
+ plugins: commonPlugins,
38
+ output: [
39
+ {
40
+ file: 'dist/elements/index.mjs',
41
+ format: 'esm',
42
+ sourcemap
43
+ },
44
+ {
45
+ file: 'dist/elements/index.js',
46
+ format: 'umd',
47
+ name: 'sfgov.elements',
48
+ sourcemap
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ input: './react/src/index.ts',
54
+ plugins: commonPlugins,
55
+ output: [
56
+ {
57
+ file: 'dist/react/index.mjs',
58
+ format: 'esm',
59
+ sourcemap
60
+ },
61
+ {
62
+ file: 'dist/react/index.js',
63
+ format: 'umd',
64
+ name: 'sfgov.react',
65
+ sourcemap,
66
+ globals: {
67
+ react: 'React'
68
+ }
69
+ }
70
+ ]
71
+ }
72
+ ]
package/svgo.config.js ADDED
@@ -0,0 +1,27 @@
1
+ /** @type {import('svgo/lib/svgo').Config} */
2
+ module.exports = {
3
+ multipass: true,
4
+ js2svg: {
5
+ pretty: true,
6
+ indent: 2
7
+ },
8
+ plugins: [
9
+ 'removeDimensions',
10
+ { name: 'removeViewBox', active: false },
11
+ {
12
+ name: 'removeAttrs',
13
+ params: {
14
+ attrs: ['fill', 'stroke', 'id', 'clipPath', 'clip-path', 'clipRule']
15
+ }
16
+ },
17
+ 'removeUselessDefs',
18
+ 'removeXMLNS',
19
+ 'collapseGroups',
20
+ {
21
+ name: 'addAttributesToSVGElement',
22
+ params: {
23
+ attributes: ['fill="currentcolor"']
24
+ }
25
+ }
26
+ ]
27
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ presets: [
3
+ require('./tailwind.preset')
4
+ ]
5
+ }
@@ -0,0 +1,128 @@
1
+ const theme = require('./css/src/theme')
2
+
3
+ module.exports = {
4
+ theme,
5
+
6
+ important: true,
7
+
8
+ /*
9
+ * This is where we disable Tailwind's "core plugins", most of
10
+ * which generate utility classes. There are a *lot* of these
11
+ * turned on by default. Disabling them here saves us many
12
+ * kilobytes in generated CSS.
13
+ *
14
+ * See: <https://tailwindcss.com/docs/configuration#core-plugins>
15
+ */
16
+ corePlugins: [
17
+ // TODO [^3]: add preflight (https://tailwindcss.com/docs/preflight)
18
+ 'accessibility',
19
+ 'alignContent',
20
+ 'alignItems',
21
+ 'appearance',
22
+ 'backgroundColor',
23
+ 'borderColor',
24
+ 'borderRadius',
25
+ 'borderStyle',
26
+ 'borderWidth',
27
+ 'cursor',
28
+ 'display',
29
+ 'flex',
30
+ 'flexDirection',
31
+ 'flexShrink',
32
+ 'flexWrap',
33
+ 'fontFamily',
34
+ 'fontSize',
35
+ 'fontSmoothing',
36
+ 'fontWeight',
37
+ 'gap',
38
+ 'gridColumn',
39
+ 'gridRow',
40
+ 'gridTemplateColumns',
41
+ 'gridTemplateRows',
42
+ 'height',
43
+ 'inset',
44
+ 'justifyContent',
45
+ 'justifyItems',
46
+ 'letterSpacing',
47
+ 'listStyleType',
48
+ 'margin',
49
+ 'maxWidth',
50
+ 'opacity',
51
+ 'overflow',
52
+ 'padding',
53
+ 'pointerEvents',
54
+ 'position',
55
+ 'space',
56
+ 'textAlign',
57
+ 'textColor',
58
+ 'textDecoration',
59
+ 'verticalAlign',
60
+ 'visibility',
61
+ 'whitespace',
62
+ 'width',
63
+ 'zIndex'
64
+ ],
65
+
66
+ /*
67
+ * This is where we tell Tailwind which variants to make available
68
+ * for each "core plugin". Most plugins get responsive variants out
69
+ * of the box, but we can shrink the size of our CSS significantly
70
+ * by turning off responsive variants for ones that we don't need
71
+ * to change at different screen widths.
72
+ *
73
+ * See: <https://tailwindcss.com/docs/configuring-variants>
74
+ */
75
+ variants: {
76
+ // TODO [^3]: nix 'focus'
77
+ accessibility: ['responsive', 'focus', 'hocus'],
78
+ appearance: [],
79
+ // TODO [^3]: nix 'focus' + 'hover'
80
+ backgroundColor: ['focus', 'focus-within', 'hover', 'hocus', 'group-hocus', 'details'],
81
+ // TODO [^3]: nix 'focus' + 'hover'
82
+ borderColor: ['focus', 'hover', 'hocus', 'group-hocus', 'details'],
83
+ borderWidth: ['hocus'],
84
+ cursor: [],
85
+ display: ['responsive', 'group-hocus', 'details'],
86
+ fill: [],
87
+ fontWeight: ['responsive'],
88
+ fontSize: ['responsive'],
89
+ fontSmoothing: [],
90
+ fontStyle: [],
91
+ flexDirection: ['responsive'],
92
+ flexWrap: [],
93
+ gap: ['responsive'],
94
+ gridColumn: ['responsive'],
95
+ gridRow: ['responsive'],
96
+ gridTemplateColumns: ['responsive'],
97
+ gridTemplateRows: ['responsive'],
98
+ height: ['responsive'],
99
+ inset: ['responsive'],
100
+ letterSpacing: ['responsive'],
101
+ lineHeight: ['responsive'],
102
+ listStyleType: ['responsive'],
103
+ listStylePosition: [],
104
+ overflow: [], // TODO [^2.3]: add 'hocus', 'group-hocus'
105
+ padding: ['responsive'],
106
+ pointerEvents: [],
107
+ position: ['responsive'],
108
+ margin: ['responsive'],
109
+ maxWidth: ['responsive'],
110
+ space: ['responsive'],
111
+ stroke: [],
112
+ strokeWidth: [],
113
+ // TODO [^3]: nix 'focus' + 'hover'
114
+ textColor: ['focus', 'hover', 'hocus', 'group-hocus', 'details'],
115
+ // TODO [^3]: nix 'focus' + 'hover'
116
+ textDecoration: ['focus', 'hover', 'hocus'],
117
+ userSelect: [],
118
+ verticalAlign: ['responsive'],
119
+ visibility: ['responsive', 'group-hocus'],
120
+ width: ['responsive'],
121
+ zIndex: ['responsive']
122
+ },
123
+
124
+ plugins: [
125
+ require('tailwindcss-interaction-variants'),
126
+ require('./css/lib/tailwind/details')
127
+ ]
128
+ }