@sfgov/design-system 0.0.0-2b1f226
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/LICENSE +21 -0
- package/README.md +7 -0
- package/babel.config.js +16 -0
- package/css/.eslintrc.js +26 -0
- package/css/babel.config.js +6 -0
- package/css/lib/tailwind/details.js +14 -0
- package/css/package-lock.json +35561 -0
- package/css/src/base.css +26 -0
- package/css/src/components/button.css +61 -0
- package/css/src/components/details.css +10 -0
- package/css/src/components/grid.css +12 -0
- package/css/src/components/index.css +4 -0
- package/css/src/components/kbd.css +5 -0
- package/css/src/components.css +1 -0
- package/css/src/fonts.css +1 -0
- package/css/src/icons.css +7 -0
- package/css/src/overrides.css +3 -0
- package/css/src/sfds.css +6 -0
- package/css/src/theme.js +104 -0
- package/css/src/tokens/breakpoints.js +5 -0
- package/css/src/tokens/colors.js +116 -0
- package/css/src/tokens/index.js +8 -0
- package/css/src/tokens/spacing.js +27 -0
- package/css/src/tokens/typography.js +66 -0
- package/css/src/tokens/widths.js +11 -0
- package/css/src/typography.css +103 -0
- package/css/src/utilities.css +1 -0
- package/dist/css/base.css +2 -0
- package/dist/css/base.css.map +1 -0
- package/dist/css/components.css +2 -0
- package/dist/css/components.css.map +1 -0
- package/dist/css/fonts.css +2 -0
- package/dist/css/fonts.css.map +1 -0
- package/dist/css/icons.css +2 -0
- package/dist/css/icons.css.map +1 -0
- package/dist/css/overrides.css +2 -0
- package/dist/css/overrides.css.map +1 -0
- package/dist/css/sfds.css +2 -0
- package/dist/css/sfds.css.map +1 -0
- package/dist/css/typography.css +2 -0
- package/dist/css/typography.css.map +1 -0
- package/dist/css/utilities.css +2 -0
- package/dist/css/utilities.css.map +1 -0
- package/dist/css/utilities.json +7350 -0
- package/dist/elements/index.d.mts +30 -0
- package/dist/elements/index.d.mts.map +1 -0
- package/dist/elements/index.d.ts +30 -0
- package/dist/elements/index.d.ts.map +1 -0
- package/dist/elements/index.js +1 -0
- package/dist/elements/index.mjs +1 -0
- package/dist/manifest.json +45 -0
- package/dist/react/index.d.mts +5725 -0
- package/dist/react/index.d.mts.map +1 -0
- package/dist/react/index.d.ts +5725 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +1 -0
- package/dist/react/index.mjs +1 -0
- package/elements/.eslintrc.js +6 -0
- package/elements/index.js +1 -0
- package/elements/index.mjs +1 -0
- package/elements/src/index.js +7 -0
- package/elements/src/sfgov-icon.js +109 -0
- package/icons/.eslintrc.js +23 -0
- package/icons/index.json +439 -0
- package/icons/svg/accessibility.svg +4 -0
- package/icons/svg/alert.svg +5 -0
- package/icons/svg/archive.svg +4 -0
- package/icons/svg/arrow-down.svg +3 -0
- package/icons/svg/arrow-left.svg +3 -0
- package/icons/svg/arrow-right.svg +3 -0
- package/icons/svg/arrow-up.svg +3 -0
- package/icons/svg/building.svg +7 -0
- package/icons/svg/calendar.svg +3 -0
- package/icons/svg/caution.svg +3 -0
- package/icons/svg/chart.svg +6 -0
- package/icons/svg/check.svg +3 -0
- package/icons/svg/chevron-down.svg +3 -0
- package/icons/svg/chevron-left.svg +3 -0
- package/icons/svg/chevron-right.svg +3 -0
- package/icons/svg/chevron-up.svg +3 -0
- package/icons/svg/clock.svg +4 -0
- package/icons/svg/close.svg +3 -0
- package/icons/svg/document.svg +3 -0
- package/icons/svg/globe.svg +3 -0
- package/icons/svg/hamburger-button.svg +5 -0
- package/icons/svg/index.json +346 -0
- package/icons/svg/info.svg +5 -0
- package/icons/svg/location.svg +4 -0
- package/icons/svg/mail.svg +3 -0
- package/icons/svg/minus.svg +3 -0
- package/icons/svg/pencil.svg +3 -0
- package/icons/svg/phone.svg +3 -0
- package/icons/svg/plus.svg +3 -0
- package/icons/svg/question.svg +4 -0
- package/icons/svg/search.svg +3 -0
- package/icons/svg/wip.svg +3 -0
- package/lib/markdownlint/frontmatter.js +51 -0
- package/lib/markdownlint/no-empty.js +19 -0
- package/package.json +352 -0
- package/postcss.config.js +17 -0
- package/react/README.md +36 -0
- package/react/index.js +1 -0
- package/react/index.mjs +1 -0
- package/react/scripts/wrap-icons.mjs +25 -0
- package/react/src/components/Box.tsx +6 -0
- package/react/src/components/Button.tsx +94 -0
- package/react/src/components/Container.tsx +19 -0
- package/react/src/components/Flex.tsx +16 -0
- package/react/src/components/GlobalStyle.tsx +35 -0
- package/react/src/components/GoogleFonts.tsx +67 -0
- package/react/src/components/Grid.tsx +15 -0
- package/react/src/components/SSRStyle.tsx +47 -0
- package/react/src/components/SVGIcon.tsx +42 -0
- package/react/src/components/Text.tsx +78 -0
- package/react/src/components/Tile.tsx +93 -0
- package/react/src/components/index.ts +11 -0
- package/react/src/components/page/AboutSection.tsx +90 -0
- package/react/src/components/page/AgencyHeader.tsx +56 -0
- package/react/src/components/page/ArchiveInformation.tsx +43 -0
- package/react/src/components/page/ContactSection.tsx +92 -0
- package/react/src/components/page/Section.tsx +53 -0
- package/react/src/components/page/Spotlight.tsx +70 -0
- package/react/src/components/page/index.ts +6 -0
- package/react/src/constants.ts +48 -0
- package/react/src/icons/IconAccessibility.jsx +3 -0
- package/react/src/icons/IconAlert.jsx +3 -0
- package/react/src/icons/IconArchive.jsx +3 -0
- package/react/src/icons/IconArrowDown.jsx +3 -0
- package/react/src/icons/IconArrowLeft.jsx +3 -0
- package/react/src/icons/IconArrowRight.jsx +3 -0
- package/react/src/icons/IconArrowUp.jsx +3 -0
- package/react/src/icons/IconBuilding.jsx +3 -0
- package/react/src/icons/IconCalendar.jsx +3 -0
- package/react/src/icons/IconCaution.jsx +3 -0
- package/react/src/icons/IconChart.jsx +3 -0
- package/react/src/icons/IconCheck.jsx +3 -0
- package/react/src/icons/IconChevronDown.jsx +3 -0
- package/react/src/icons/IconChevronLeft.jsx +3 -0
- package/react/src/icons/IconChevronRight.jsx +3 -0
- package/react/src/icons/IconChevronUp.jsx +3 -0
- package/react/src/icons/IconClock.jsx +3 -0
- package/react/src/icons/IconClose.jsx +3 -0
- package/react/src/icons/IconDocument.jsx +3 -0
- package/react/src/icons/IconGlobe.jsx +3 -0
- package/react/src/icons/IconHamburgerButton.jsx +3 -0
- package/react/src/icons/IconInfo.jsx +3 -0
- package/react/src/icons/IconLocation.jsx +3 -0
- package/react/src/icons/IconMail.jsx +3 -0
- package/react/src/icons/IconMinus.jsx +3 -0
- package/react/src/icons/IconPencil.jsx +3 -0
- package/react/src/icons/IconPhone.jsx +3 -0
- package/react/src/icons/IconPlus.jsx +3 -0
- package/react/src/icons/IconQuestion.jsx +3 -0
- package/react/src/icons/IconSearch.jsx +3 -0
- package/react/src/icons/IconWIP.jsx +3 -0
- package/react/src/icons/index.js +31 -0
- package/react/src/icons/index.json +346 -0
- package/react/src/icons.tsx +34 -0
- package/react/src/index.ts +4 -0
- package/react/src/stitches.config.ts +85 -0
- package/react/src/theme/breakpoints.ts +14 -0
- package/react/src/theme/colors.ts +34 -0
- package/react/src/theme/index.tsx +31 -0
- package/react/src/theme/space.ts +16 -0
- package/react/src/theme/typography.ts +136 -0
- package/react/src/types.ts +31 -0
- package/react/src/utils.tsx +25 -0
- package/rollup.config.mjs +72 -0
- package/svgo.config.js +27 -0
- package/tailwind.config.js +5 -0
- package/tailwind.preset.js +128 -0
package/package.json
ADDED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sfgov/design-system",
|
|
3
|
+
"version": "0.0.0-2b1f226",
|
|
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
|
+
"css",
|
|
15
|
+
"elements",
|
|
16
|
+
"icons",
|
|
17
|
+
"react",
|
|
18
|
+
"dist",
|
|
19
|
+
"lib",
|
|
20
|
+
"tailwind.*",
|
|
21
|
+
"*.{config.*,rc}",
|
|
22
|
+
"!website/**",
|
|
23
|
+
"!storybook/**"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "wireit",
|
|
27
|
+
"build:ci": "wireit",
|
|
28
|
+
"build:css": "wireit",
|
|
29
|
+
"build:css-manifest": "wireit",
|
|
30
|
+
"build:docs": "wireit",
|
|
31
|
+
"build:favicon": "mkdir -p public && curl -O https://sf.gov/favicon.ico --output-dir public",
|
|
32
|
+
"build:js": "wireit",
|
|
33
|
+
"build:manifest": "wireit",
|
|
34
|
+
"build:storybook": "wireit",
|
|
35
|
+
"build:urls": "wireit",
|
|
36
|
+
"build:website": "wireit",
|
|
37
|
+
"figma-export": "env-cmd -f .env figma-export use-config",
|
|
38
|
+
"lint": "wireit",
|
|
39
|
+
"lint:css": "stylelint '**/src/*.css'",
|
|
40
|
+
"lint:js": "eslint --ext js,jsx,mjs,ts,tsx css elements icons react '*.{js,mjs}'",
|
|
41
|
+
"lint:docs": "markdownlint --rules './lib/markdownlint/*.js' --ignore '**/node_modules/**' '**/*.md'",
|
|
42
|
+
"lint:scripts": "shellcheck scripts/*.sh",
|
|
43
|
+
"lint:storybook": "eslint --ext js,jsx,ts,tsx stories .storybook",
|
|
44
|
+
"lint:website": "npx eslint --ext js,jsx,ts,tsx website",
|
|
45
|
+
"postbuild:website": "scripts/run-website-checks.sh",
|
|
46
|
+
"postbuild:css": "npm run build:css-manifest",
|
|
47
|
+
"postfigma-export": "eslint --fix react/src/icons",
|
|
48
|
+
"prepublishOnly": "scripts/prepublish-checks.sh",
|
|
49
|
+
"serve:docs": "docusaurus serve website --dir public",
|
|
50
|
+
"start": "wireit",
|
|
51
|
+
"start:website": "wireit",
|
|
52
|
+
"start:storybook": "wireit",
|
|
53
|
+
"swizzle": "docusaurus swizzle",
|
|
54
|
+
"watch": "wireit",
|
|
55
|
+
"watch:css": "wireit",
|
|
56
|
+
"watch:js": "wireit",
|
|
57
|
+
"watch:icons": "echo 'watch icons (noop)'"
|
|
58
|
+
},
|
|
59
|
+
"wireit": {
|
|
60
|
+
"build": {
|
|
61
|
+
"dependencies": [
|
|
62
|
+
"build:css",
|
|
63
|
+
"build:js",
|
|
64
|
+
"build:manifest",
|
|
65
|
+
"build:website",
|
|
66
|
+
"build:storybook"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"build:ci": {
|
|
70
|
+
"dependencies": [
|
|
71
|
+
"build:css",
|
|
72
|
+
"build:js",
|
|
73
|
+
"build:manifest"
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
"build:css": {
|
|
77
|
+
"command": "postcss --verbose -d dist/css 'css/src/*.css'",
|
|
78
|
+
"files": [
|
|
79
|
+
"css/**",
|
|
80
|
+
"postcss.config.js"
|
|
81
|
+
],
|
|
82
|
+
"output": [
|
|
83
|
+
"dist/**/*.css{,.map}"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"build:css-manifest": {
|
|
87
|
+
"command": "node scripts/build-css-manifest.js",
|
|
88
|
+
"output": [
|
|
89
|
+
"dist/css/utilties.json"
|
|
90
|
+
],
|
|
91
|
+
"files": [
|
|
92
|
+
"dist/css",
|
|
93
|
+
"!dist/css/**/*.json"
|
|
94
|
+
],
|
|
95
|
+
"dependencies": [
|
|
96
|
+
"build:css"
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"build:docs": {
|
|
100
|
+
"command": "docusaurus build website --out-dir public",
|
|
101
|
+
"dependencies": [
|
|
102
|
+
"build:css",
|
|
103
|
+
"build:js",
|
|
104
|
+
"build:manifest"
|
|
105
|
+
],
|
|
106
|
+
"files": [
|
|
107
|
+
"website/**"
|
|
108
|
+
],
|
|
109
|
+
"output": [
|
|
110
|
+
"public"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"build:js": {
|
|
114
|
+
"command": "rollup -c",
|
|
115
|
+
"files": [
|
|
116
|
+
"{elements,icons,react}/src/**",
|
|
117
|
+
"*.config.*"
|
|
118
|
+
],
|
|
119
|
+
"output": [
|
|
120
|
+
"dist/**/*.{js,mjs}{,.map}"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"build:website-index": {
|
|
124
|
+
"command": "find public -type f | grep -v '^storybook/' | perl -pe 's#^public/#/#' | sort > public/index.txt",
|
|
125
|
+
"dependencies": [
|
|
126
|
+
"build:docs"
|
|
127
|
+
],
|
|
128
|
+
"clean": true,
|
|
129
|
+
"files": [
|
|
130
|
+
"public/**",
|
|
131
|
+
"!public/storybook"
|
|
132
|
+
],
|
|
133
|
+
"output": [
|
|
134
|
+
"public/index.txt"
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"build:manifest": {
|
|
138
|
+
"command": "scripts/manifest.mjs 'dist/**/*.{css,js,mjs,svg}'",
|
|
139
|
+
"dependencies": [
|
|
140
|
+
"build:css",
|
|
141
|
+
"build:js",
|
|
142
|
+
"build:css-manifest"
|
|
143
|
+
],
|
|
144
|
+
"output": [
|
|
145
|
+
"dist/manifest.json"
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"build:storybook": {
|
|
149
|
+
"command": "build-storybook -o public/storybook",
|
|
150
|
+
"clean": true,
|
|
151
|
+
"files": [
|
|
152
|
+
"public/storybook"
|
|
153
|
+
],
|
|
154
|
+
"dependencies": [
|
|
155
|
+
"build:css",
|
|
156
|
+
"build:js"
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
"build:urls": {
|
|
160
|
+
"command": "scripts/build-urls.sh",
|
|
161
|
+
"files": [
|
|
162
|
+
"public/index.txt"
|
|
163
|
+
],
|
|
164
|
+
"output": [
|
|
165
|
+
"public/urls.txt"
|
|
166
|
+
],
|
|
167
|
+
"dependencies": [
|
|
168
|
+
"build:docs"
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
"build:website": {
|
|
172
|
+
"dependencies": [
|
|
173
|
+
"build:docs",
|
|
174
|
+
"build:storybook",
|
|
175
|
+
"build:urls",
|
|
176
|
+
"build:favicon"
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
"lint": {
|
|
180
|
+
"dependencies": [
|
|
181
|
+
"lint:css",
|
|
182
|
+
"lint:js",
|
|
183
|
+
"lint:docs",
|
|
184
|
+
"lint:scripts",
|
|
185
|
+
"lint:website",
|
|
186
|
+
"lint:storybook"
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
"start": {
|
|
190
|
+
"dependencies": [
|
|
191
|
+
"watch",
|
|
192
|
+
"start:website",
|
|
193
|
+
"start:storybook"
|
|
194
|
+
]
|
|
195
|
+
},
|
|
196
|
+
"start:website": {
|
|
197
|
+
"command": "docusaurus start website --port=3002",
|
|
198
|
+
"service": true,
|
|
199
|
+
"files": [
|
|
200
|
+
"website/*.js",
|
|
201
|
+
"package.json"
|
|
202
|
+
],
|
|
203
|
+
"dependencies": [
|
|
204
|
+
"build:css",
|
|
205
|
+
"build:js",
|
|
206
|
+
"build:manifest"
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
"start:storybook": {
|
|
210
|
+
"command": "start-storybook --port=3001",
|
|
211
|
+
"service": true,
|
|
212
|
+
"files": [
|
|
213
|
+
".storybook/*",
|
|
214
|
+
"package.json"
|
|
215
|
+
],
|
|
216
|
+
"dependencies": [
|
|
217
|
+
"build:css",
|
|
218
|
+
"build:js"
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
"watch": {
|
|
222
|
+
"dependencies": [
|
|
223
|
+
"watch:css",
|
|
224
|
+
"watch:icons",
|
|
225
|
+
"watch:js"
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"watch:css": {
|
|
229
|
+
"command": "npm run build:css -- --watch",
|
|
230
|
+
"service": true,
|
|
231
|
+
"files": [
|
|
232
|
+
"postcss.config.js"
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
"watch:js": {
|
|
236
|
+
"command": "rollup -c --watch",
|
|
237
|
+
"service": true,
|
|
238
|
+
"files": [
|
|
239
|
+
"rollup.config.*"
|
|
240
|
+
]
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
"peerDependencies": {
|
|
244
|
+
"react": "^18.2.0",
|
|
245
|
+
"react-dom": "^18.2.0",
|
|
246
|
+
"tailwindcss": "^2.2.19"
|
|
247
|
+
},
|
|
248
|
+
"peerDependenciesMeta": {
|
|
249
|
+
"react": {
|
|
250
|
+
"optional": true
|
|
251
|
+
},
|
|
252
|
+
"react-dom": {
|
|
253
|
+
"optional": true
|
|
254
|
+
},
|
|
255
|
+
"tailwindcss": {
|
|
256
|
+
"optional": true
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
"devDependencies": {
|
|
260
|
+
"@babel/cli": "^7.20.7",
|
|
261
|
+
"@babel/core": "^7.20.12",
|
|
262
|
+
"@babel/preset-env": "^7.20.2",
|
|
263
|
+
"@babel/preset-react": "^7.18.6",
|
|
264
|
+
"@babel/preset-typescript": "^7.18.6",
|
|
265
|
+
"@docusaurus/core": "^2.2.0",
|
|
266
|
+
"@docusaurus/eslint-plugin": "^2.2.0",
|
|
267
|
+
"@docusaurus/module-type-aliases": "^2.2.0",
|
|
268
|
+
"@docusaurus/plugin-client-redirects": "^2.2.0",
|
|
269
|
+
"@docusaurus/preset-classic": "^2.2.0",
|
|
270
|
+
"@docusaurus/theme-live-codeblock": "^2.2.0",
|
|
271
|
+
"@figma-export/cli": "^4.5.0",
|
|
272
|
+
"@figma-export/output-components-as-svg": "^4.5.0",
|
|
273
|
+
"@figma-export/output-components-as-svgr": "^4.5.0",
|
|
274
|
+
"@figma-export/transform-svg-with-svgo": "^4.5.0",
|
|
275
|
+
"@figma-export/types": "^4.5.0",
|
|
276
|
+
"@mdx-js/react": "^1.6.22",
|
|
277
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
278
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
279
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
280
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
281
|
+
"@stitches/react": "^1.2.8",
|
|
282
|
+
"@storybook/addon-actions": "^6.5.15",
|
|
283
|
+
"@storybook/addon-essentials": "^6.5.15",
|
|
284
|
+
"@storybook/addon-interactions": "^6.5.15",
|
|
285
|
+
"@storybook/addon-links": "^6.5.15",
|
|
286
|
+
"@storybook/addon-storysource": "^6.5.15",
|
|
287
|
+
"@storybook/builder-webpack5": "^6.5.15",
|
|
288
|
+
"@storybook/manager-webpack5": "^6.5.15",
|
|
289
|
+
"@storybook/react": "^6.5.15",
|
|
290
|
+
"@storybook/testing-library": "^0.0.13",
|
|
291
|
+
"@tsconfig/docusaurus": "^1.0.6",
|
|
292
|
+
"@types/eslint": "^8.4.2",
|
|
293
|
+
"@types/node": "^16.18.6",
|
|
294
|
+
"@typescript-eslint/eslint-plugin": "^5.45.0",
|
|
295
|
+
"@typescript-eslint/parser": "^5.45.0",
|
|
296
|
+
"autoprefixer": "^10.4.7",
|
|
297
|
+
"babel-loader": "^8.2.5",
|
|
298
|
+
"clsx": "^1.1.0",
|
|
299
|
+
"core-js": "^3.27.1",
|
|
300
|
+
"cssnano": "^5.1.14",
|
|
301
|
+
"dedent": "^0.7.0",
|
|
302
|
+
"dotenv": "^16.0.3",
|
|
303
|
+
"env-cmd": "^10.1.0",
|
|
304
|
+
"eslint": "^8.24.0",
|
|
305
|
+
"eslint-plugin-html": "^6.2.0",
|
|
306
|
+
"eslint-plugin-import": "^2.26.0",
|
|
307
|
+
"eslint-plugin-n": "^15.5.1",
|
|
308
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
309
|
+
"eslint-plugin-react": "^7.30.0",
|
|
310
|
+
"eslint-plugin-sfgov": "^2.0.0",
|
|
311
|
+
"eslint-plugin-storybook": "^0.6.4",
|
|
312
|
+
"eslint-plugin-unicorn": "^42.0.0",
|
|
313
|
+
"filesize": "^8.0.7",
|
|
314
|
+
"fs-extra": "^11.1.0",
|
|
315
|
+
"globby": "^13.1.3",
|
|
316
|
+
"js-yaml": "^4.1.0",
|
|
317
|
+
"lodash.startcase": "^4.4.0",
|
|
318
|
+
"markdownlint-cli": "^0.31.1",
|
|
319
|
+
"postcss": "^8.4.14",
|
|
320
|
+
"postcss-cli": "^10.1.0",
|
|
321
|
+
"postcss-import": "^15.1.0",
|
|
322
|
+
"postcss-nested": "^6.0.0",
|
|
323
|
+
"prettysize": "^2.0.0",
|
|
324
|
+
"prism-react-renderer": "^1.3.1",
|
|
325
|
+
"prop-types": "^15.8.1",
|
|
326
|
+
"raw-loader": "^4.0.2",
|
|
327
|
+
"react": "^18.2.0",
|
|
328
|
+
"react-copy-to-clipboard": "^5.1.0",
|
|
329
|
+
"react-dom": "^18.2.0",
|
|
330
|
+
"react-masonry-css": "^1.0.16",
|
|
331
|
+
"react-shadow": "^19.0.3",
|
|
332
|
+
"rollup": "^3.9.1",
|
|
333
|
+
"rollup-cache": "^1.2.0",
|
|
334
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
335
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
336
|
+
"rollup-plugin-ts": "^3.1.1",
|
|
337
|
+
"shellcheck": "^1.1.0",
|
|
338
|
+
"storybook-addon-designs": "^6.3.1",
|
|
339
|
+
"storybook-source-link": "^2.0.4",
|
|
340
|
+
"stylelint": "^14.8.4",
|
|
341
|
+
"stylelint-config-standard": "^25.0.0",
|
|
342
|
+
"stylelint-config-tailwindcss": "^0.0.7",
|
|
343
|
+
"stylelint-expiring-todo-comments": "^0.0.1",
|
|
344
|
+
"svgo": "^3.0.2",
|
|
345
|
+
"tailwind-styled-components": "^2.2.0",
|
|
346
|
+
"tailwindcss": "^2.2.19",
|
|
347
|
+
"tailwindcss-interaction-variants": "^5.0.0",
|
|
348
|
+
"typescript": "^4.9.3",
|
|
349
|
+
"use-bus": "^2.5.1",
|
|
350
|
+
"wireit": "^0.9.3"
|
|
351
|
+
}
|
|
352
|
+
}
|
|
@@ -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
|
+
}
|
package/react/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: React
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## @sfgov/design-system/react
|
|
6
|
+
|
|
7
|
+
This package provides the [SF.gov Design System's][website] React components.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
You can install the package via [npm] or a similar package manager. In addition
|
|
12
|
+
to the `@sfgov/design-system/react` package, you'll also need to install its
|
|
13
|
+
[peer dependencies]. (See the `peerDependencies` field in
|
|
14
|
+
[package.json](./package.json) for version requirements.)
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @sfgov/design-system react
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Our styling library, [Stitches], exposes the `css` prop on our React components.
|
|
23
|
+
|
|
24
|
+
```jsx
|
|
25
|
+
import { ThemeProvider } from '@sfgov/design-system/react'
|
|
26
|
+
|
|
27
|
+
const MyPage = () =>
|
|
28
|
+
<TitleXl css={{ color: 'red' }}>
|
|
29
|
+
A red title
|
|
30
|
+
</TitleXl>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
[npm]: https://npmjs.com
|
|
34
|
+
[peer dependencies]: https://nodejs.org/es/blog/npm/peer-dependencies/
|
|
35
|
+
[Stitches]: https://stitches.dev/
|
|
36
|
+
[website]: https://design-system.sf.gov
|
package/react/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/react/index.js')
|
package/react/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/react/index.mjs'
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process'
|
|
2
|
+
import { writeFileSync } from 'node:fs'
|
|
3
|
+
import { createRequire } from 'node:module'
|
|
4
|
+
const require = createRequire(import.meta.url)
|
|
5
|
+
const { components } = require('../../icons/index.json')
|
|
6
|
+
|
|
7
|
+
const imports = components.map(c => {
|
|
8
|
+
return {
|
|
9
|
+
name: c.component,
|
|
10
|
+
path: c.file,
|
|
11
|
+
size: c.size
|
|
12
|
+
}
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
imports.sort((a, b) => a.name.localeCompare(b.name))
|
|
16
|
+
|
|
17
|
+
const tsx = `
|
|
18
|
+
import * as icons from '@sfgov/icons/react'
|
|
19
|
+
import { createStyledIcon as wrap } from './components'
|
|
20
|
+
|
|
21
|
+
${imports.map(({ name, size }) => `export const ${name} = wrap(icons.${name}, ${JSON.stringify(size)})`).join('\n')}
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
writeFileSync('src/icons.tsx', tsx, 'utf8')
|
|
25
|
+
execSync('npx eslint --fix src/icons.tsx')
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { VariantProps } from '@stitches/react'
|
|
3
|
+
import { styled, CSS } from '../stitches.config'
|
|
4
|
+
import { HOCUS_SELECTOR } from '../constants'
|
|
5
|
+
import { withFixedProps } from '../utils'
|
|
6
|
+
|
|
7
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'inverse' | 'link'
|
|
8
|
+
|
|
9
|
+
const baseButtonStyles: CSS = {
|
|
10
|
+
// layout
|
|
11
|
+
display: 'inline-flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyItems: 'center',
|
|
14
|
+
justifyContent: 'center',
|
|
15
|
+
borderRadius: 8,
|
|
16
|
+
gap: 8,
|
|
17
|
+
px: 20,
|
|
18
|
+
py: 8,
|
|
19
|
+
// border
|
|
20
|
+
borderColor: 'transparent',
|
|
21
|
+
borderStyle: 'solid',
|
|
22
|
+
borderWidth: 3,
|
|
23
|
+
// cursor
|
|
24
|
+
cursor: 'pointer',
|
|
25
|
+
// typography
|
|
26
|
+
fontFamily: '$body',
|
|
27
|
+
fontSize: '$body',
|
|
28
|
+
lineHeight: '$body',
|
|
29
|
+
fontWeight: '$bold',
|
|
30
|
+
textAlign: 'center',
|
|
31
|
+
textDecoration: 'none',
|
|
32
|
+
whiteSpace: 'nowrap'
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const primaryButtonStyles: CSS = {
|
|
36
|
+
color: '$white',
|
|
37
|
+
backgroundColor: '$action',
|
|
38
|
+
[HOCUS_SELECTOR]: {
|
|
39
|
+
color: '$white',
|
|
40
|
+
backgroundColor: '$blueDark'
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const inverseButtonStyles: CSS = {
|
|
45
|
+
color: '$action',
|
|
46
|
+
backgroundColor: '$white',
|
|
47
|
+
[HOCUS_SELECTOR]: {
|
|
48
|
+
color: '$blueDark',
|
|
49
|
+
backgroundColor: '$white'
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const secondaryButtonStyles: CSS = {
|
|
54
|
+
...inverseButtonStyles,
|
|
55
|
+
borderColor: 'currentcolor'
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const linkButtonStyles: CSS = {
|
|
59
|
+
...inverseButtonStyles,
|
|
60
|
+
backgroundColor: 'transparent',
|
|
61
|
+
textDecoration: 'underline'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export const Button = styled('button', {
|
|
65
|
+
...baseButtonStyles,
|
|
66
|
+
variants: {
|
|
67
|
+
variant: {
|
|
68
|
+
primary: primaryButtonStyles,
|
|
69
|
+
secondary: secondaryButtonStyles,
|
|
70
|
+
inverse: inverseButtonStyles,
|
|
71
|
+
link: linkButtonStyles
|
|
72
|
+
},
|
|
73
|
+
block: {
|
|
74
|
+
true: {
|
|
75
|
+
display: 'flex',
|
|
76
|
+
width: '100%'
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
defaultVariants: {
|
|
81
|
+
variant: 'primary'
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
export type ButtonProps = VariantProps<typeof Button>
|
|
86
|
+
|
|
87
|
+
export const PrimaryButton = createVariant('primary')
|
|
88
|
+
export const SecondaryButton = createVariant('secondary')
|
|
89
|
+
export const InverseButton = createVariant('inverse')
|
|
90
|
+
export const LinkButton = createVariant('link')
|
|
91
|
+
|
|
92
|
+
function createVariant (variant: ButtonVariant) {
|
|
93
|
+
return withFixedProps(Button, { variant })
|
|
94
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VariantProps } from '@stitches/react'
|
|
2
|
+
import { styled } from '../stitches.config'
|
|
3
|
+
import { Box } from './Box'
|
|
4
|
+
|
|
5
|
+
export const Container = styled(Box, {
|
|
6
|
+
mx: 20,
|
|
7
|
+
maxWidth: '$lg',
|
|
8
|
+
'@md': {
|
|
9
|
+
mx: 28
|
|
10
|
+
},
|
|
11
|
+
'@lg': {
|
|
12
|
+
mx: 96
|
|
13
|
+
},
|
|
14
|
+
'@xl': {
|
|
15
|
+
mx: 'auto'
|
|
16
|
+
}
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export type ContainerProps = VariantProps<typeof Container>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { styled } from '../stitches.config'
|
|
2
|
+
import { Box } from './Box'
|
|
3
|
+
import type { VariantProps } from '../utils'
|
|
4
|
+
|
|
5
|
+
export const Flex = styled(Box, {
|
|
6
|
+
display: 'flex',
|
|
7
|
+
variants: {
|
|
8
|
+
inline: {
|
|
9
|
+
true: {
|
|
10
|
+
display: 'inline-flex'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export type FlexVariant = VariantProps<typeof Flex>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { ComponentProps } from 'react'
|
|
2
|
+
import { getGoogleFontsCss } from './GoogleFonts'
|
|
3
|
+
import type { GlobalCSSProps } from '../types'
|
|
4
|
+
import { SSRStyle } from './SSRStyle'
|
|
5
|
+
|
|
6
|
+
export type GlobalStyleProps = Omit<ComponentProps<'style'>, 'dangerouslySetInnerHTML'> & GlobalCSSProps
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* This component renders a <style> tag that pulls in static
|
|
10
|
+
* global CSS, including Google Fonts CSS imports. For critical CSS rendered
|
|
11
|
+
* server-side, use <SSRStyle>.
|
|
12
|
+
*
|
|
13
|
+
* @see {SSRStyle}
|
|
14
|
+
* @see {getGlobalStaticCss}
|
|
15
|
+
* @param props
|
|
16
|
+
* @returns a global <style> "singleton"
|
|
17
|
+
*/
|
|
18
|
+
export function GlobalStaticStyles ({ fonts, ...rest }: GlobalStyleProps) {
|
|
19
|
+
return <style id='sfgov-global-css' {...rest} dangerouslySetInnerHTML={{
|
|
20
|
+
__html: getStaticGlobalCss({ fonts })
|
|
21
|
+
}} />
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* For static and non-React environments, use this function to generate CSS
|
|
26
|
+
* content for a global <style> element.
|
|
27
|
+
*
|
|
28
|
+
* @param props
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
export function getStaticGlobalCss (props?: GlobalCSSProps): string {
|
|
32
|
+
return [
|
|
33
|
+
getGoogleFontsCss(props?.fonts)
|
|
34
|
+
].join('')
|
|
35
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import React, { ComponentProps } from 'react'
|
|
2
|
+
import { defaultFonts } from '../constants'
|
|
3
|
+
import type { FontSpec, FontSpecProps, LinkProps } from '../types'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Render a <style> tag that imports the necessary Google Fonts for our typography.
|
|
7
|
+
* This can be used for client-side rendering, but will cause a flash of unstyled
|
|
8
|
+
* typography. If you have the ability to render server-side, please use
|
|
9
|
+
* {@link GoogleFontsPreloadStyles} or {@link SSRStyle} instead.
|
|
10
|
+
*
|
|
11
|
+
* @param props <style> props and FontSpecProps (including the `fonts` prop), plus
|
|
12
|
+
* additional CSS text as children (strings)
|
|
13
|
+
*/
|
|
14
|
+
export function GoogleFontsStylesheet ({ fonts, children, ...rest }: ComponentProps<'style'> & FontSpecProps) {
|
|
15
|
+
const url = getGoogleFontsURL(fonts)
|
|
16
|
+
return url
|
|
17
|
+
? <style {...rest}>{`@import url(${url});`}{children}</style>
|
|
18
|
+
: null
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function GoogleFontsPreloadStyles (props: FontSpecProps) {
|
|
22
|
+
return <>
|
|
23
|
+
{getGooglePreloadLinks(props.fonts).map((props, i) => (
|
|
24
|
+
<link key={i} {...props} />
|
|
25
|
+
))}
|
|
26
|
+
</>
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function getGooglePreloadLinks (fonts?: FontSpec[]): LinkProps[] {
|
|
30
|
+
const url = getGoogleFontsURL(fonts || defaultFonts)
|
|
31
|
+
if (!url) return []
|
|
32
|
+
return [
|
|
33
|
+
{ rel: 'preconnect', href: 'https://fonts.gstatic.com', crossOrigin: 'anonymous' },
|
|
34
|
+
{ rel: 'preload', as: 'style', href: url },
|
|
35
|
+
{ rel: 'stylesheet', href: url }
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getGoogleFontsCss (fonts?: FontSpec[]) {
|
|
40
|
+
return `@import url('${getGoogleFontsURL(fonts)}');`
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function getGoogleFontsURL (fonts?: FontSpec[]) {
|
|
44
|
+
const families = (fonts || defaultFonts)
|
|
45
|
+
.map(font => [
|
|
46
|
+
font.name,
|
|
47
|
+
formatFontWeights(font)
|
|
48
|
+
])
|
|
49
|
+
.map(([family, args]) => `family=${escape(family)}${args ? `:${args}` : ''}`)
|
|
50
|
+
.join('&')
|
|
51
|
+
return `https://fonts.googleapis.com/css2?${families}&display=swap`
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function formatFontWeights (font: FontSpec) {
|
|
55
|
+
if (font.googleFont?.optical) {
|
|
56
|
+
const weights = Object.values(font.googleFont.weights)
|
|
57
|
+
.map(([range, weight]) => `${range.join('..')},${weight}`)
|
|
58
|
+
return `opsz,wght@${weights.join(';')}`
|
|
59
|
+
} else {
|
|
60
|
+
const { weights } = font
|
|
61
|
+
return `wght@${Object.values(weights).join(';')}`
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function escape (str: string) {
|
|
66
|
+
return str.replace(/ /g, '+')
|
|
67
|
+
}
|