@sfgov/design-system 0.0.0-53b7e30 → 0.0.0-9aae5fe
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/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/manifest.json +1 -1
- 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/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/tailwind/details.js +14 -0
- package/package.json +9 -4
- package/react/README.md +36 -0
- package/react/index.js +1 -0
- package/react/index.mjs +1 -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/tailwind.preset.js +1 -1
- package/babel.config.js +0 -16
- package/postcss.config.js +0 -17
- package/rollup.config.mjs +0 -72
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { CSS } from '@stitches/react'
|
|
2
|
+
import { defaultFonts } from '../constants'
|
|
3
|
+
|
|
4
|
+
export const fonts = {
|
|
5
|
+
body: '$sans',
|
|
6
|
+
sans: '$RobotoFlex',
|
|
7
|
+
slab: '$RobotoSlab',
|
|
8
|
+
monospace: '$RobotoMono',
|
|
9
|
+
chinese: '$NotoSansTC',
|
|
10
|
+
...Object.fromEntries(
|
|
11
|
+
defaultFonts.map(font => [
|
|
12
|
+
font.name.replace(/ +/g, ''),
|
|
13
|
+
`${[font.name, ...font.fallbacks
|
|
14
|
+
].join(', ')}`])
|
|
15
|
+
)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const textStyles: Record<string, CSS> = {
|
|
19
|
+
body: {
|
|
20
|
+
fontFamily: '$body',
|
|
21
|
+
fontSize: '16px',
|
|
22
|
+
fontWeight: '$normal',
|
|
23
|
+
lineHeight: '24px'
|
|
24
|
+
},
|
|
25
|
+
small: {
|
|
26
|
+
fontFamily: '$body',
|
|
27
|
+
fontSize: '14px',
|
|
28
|
+
lineHeight: '18px'
|
|
29
|
+
},
|
|
30
|
+
bigDesc: {
|
|
31
|
+
fontFamily: '$body',
|
|
32
|
+
fontSize: '20px',
|
|
33
|
+
fontWeight: '$bold',
|
|
34
|
+
lineHeight: '28px'
|
|
35
|
+
},
|
|
36
|
+
bigDescDesktop: {
|
|
37
|
+
fontFamily: '$body',
|
|
38
|
+
fontSize: '24px',
|
|
39
|
+
fontWeight: '$bold',
|
|
40
|
+
lineHeight: '32px'
|
|
41
|
+
},
|
|
42
|
+
titleXs: {
|
|
43
|
+
fontFamily: '$sans',
|
|
44
|
+
fontSize: '20px',
|
|
45
|
+
fontWeight: '$bold',
|
|
46
|
+
lineHeight: '24px'
|
|
47
|
+
},
|
|
48
|
+
titleSm: {
|
|
49
|
+
fontFamily: '$sans',
|
|
50
|
+
fontSize: '24px',
|
|
51
|
+
fontWeight: '$bold',
|
|
52
|
+
lineHeight: '28px'
|
|
53
|
+
},
|
|
54
|
+
titleMd: {
|
|
55
|
+
fontFamily: '$slab',
|
|
56
|
+
fontSize: '24px',
|
|
57
|
+
fontWeight: '$bold',
|
|
58
|
+
lineHeight: '28px'
|
|
59
|
+
},
|
|
60
|
+
titleLg: {
|
|
61
|
+
fontFamily: '$slab',
|
|
62
|
+
fontSize: '28px',
|
|
63
|
+
fontWeight: '$bold',
|
|
64
|
+
lineHeight: '32px'
|
|
65
|
+
},
|
|
66
|
+
titleXl: {
|
|
67
|
+
fontFamily: '$slab',
|
|
68
|
+
fontSize: '32px',
|
|
69
|
+
fontWeight: '$bold',
|
|
70
|
+
lineHeight: '36px'
|
|
71
|
+
},
|
|
72
|
+
displaySm: {
|
|
73
|
+
fontFamily: '$slab',
|
|
74
|
+
fontSize: '36px',
|
|
75
|
+
fontWeight: '$light',
|
|
76
|
+
lineHeight: '40px'
|
|
77
|
+
},
|
|
78
|
+
displayLg: {
|
|
79
|
+
fontFamily: '$slab',
|
|
80
|
+
fontSize: '44px',
|
|
81
|
+
fontWeight: '$light',
|
|
82
|
+
lineHeight: '48px'
|
|
83
|
+
},
|
|
84
|
+
titleMdDesktop: {
|
|
85
|
+
fontFamily: '$slab',
|
|
86
|
+
fontSize: '32px',
|
|
87
|
+
fontWeight: '$bold',
|
|
88
|
+
lineHeight: '36px'
|
|
89
|
+
},
|
|
90
|
+
titleLgDesktop: {
|
|
91
|
+
fontFamily: '$slab',
|
|
92
|
+
fontSize: '44px',
|
|
93
|
+
fontWeight: '$bold',
|
|
94
|
+
lineHeight: '52px'
|
|
95
|
+
},
|
|
96
|
+
titleXlDesktop: {
|
|
97
|
+
fontFamily: '$slab',
|
|
98
|
+
fontSize: '60px',
|
|
99
|
+
fontWeight: '$bold',
|
|
100
|
+
lineHeight: '64px'
|
|
101
|
+
},
|
|
102
|
+
displaySmDesktop: {
|
|
103
|
+
fontFamily: '$slab',
|
|
104
|
+
fontSize: '48px',
|
|
105
|
+
fontWeight: '$light',
|
|
106
|
+
lineHeight: '52px'
|
|
107
|
+
},
|
|
108
|
+
displayLgDesktop: {
|
|
109
|
+
fontFamily: '$slab',
|
|
110
|
+
fontSize: '72px',
|
|
111
|
+
fontWeight: '$light',
|
|
112
|
+
lineHeight: '76px'
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const fontWeights = {
|
|
117
|
+
light: 300,
|
|
118
|
+
normal: 400,
|
|
119
|
+
bold: 700,
|
|
120
|
+
boldChinese: 500,
|
|
121
|
+
...collect('fontWeight')
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const fontSizes = collect('fontSize')
|
|
125
|
+
export const lineHeights = collect('lineHeight')
|
|
126
|
+
export const letterSpacings = collect('letterSpacing')
|
|
127
|
+
|
|
128
|
+
function collect (prop: keyof CSS) {
|
|
129
|
+
const map = {}
|
|
130
|
+
for (const [name, style] of Object.entries(textStyles)) {
|
|
131
|
+
if (prop in style) {
|
|
132
|
+
map[name] = style[prop]
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return map
|
|
136
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react'
|
|
2
|
+
|
|
3
|
+
export type LinkProps = ComponentProps<'link'>
|
|
4
|
+
|
|
5
|
+
export type FontWeightName = 'light' | 'normal' | 'bold' | 'semibold'
|
|
6
|
+
export type FixedFontWeightMap = Partial<Record<FontWeightName, number>>
|
|
7
|
+
|
|
8
|
+
// "8..144,300;8..144,400;8..144,700"
|
|
9
|
+
type OpticalWeights = Partial<Record<FontWeightName, [number[], number]>>
|
|
10
|
+
|
|
11
|
+
export type OpticalGoogleFont = {
|
|
12
|
+
optical: true
|
|
13
|
+
weights: OpticalWeights
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type GoogleFontOptions = {
|
|
17
|
+
optical: false
|
|
18
|
+
} | OpticalGoogleFont
|
|
19
|
+
|
|
20
|
+
export type FontSpec = {
|
|
21
|
+
name: string
|
|
22
|
+
fallbacks?: string[]
|
|
23
|
+
weights: FixedFontWeightMap
|
|
24
|
+
googleFont?: GoogleFontOptions
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type FontSpecProps = {
|
|
28
|
+
fonts?: FontSpec[]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type GlobalCSSProps = FontSpecProps
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { Component, ComponentProps, ComponentType } from 'react'
|
|
2
|
+
|
|
3
|
+
export function identity (v: any) {
|
|
4
|
+
return v
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function pxMap (values: number[]): Record<number, string> {
|
|
8
|
+
return values.reduce((o, n) => Object.assign(o, { [n]: px(n) }), {})
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function px (n: number | string) {
|
|
12
|
+
return (typeof n === 'string') ? n : n === 0 ? '0' : `${n}px`
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function withFixedProps (
|
|
16
|
+
Component: ComponentType<any>,
|
|
17
|
+
fixed: Partial<ComponentProps<typeof Component>>
|
|
18
|
+
) {
|
|
19
|
+
type Unfixed = Omit<ComponentProps<typeof Component>, keyof typeof fixed>
|
|
20
|
+
return function FixedProps (props: Unfixed) {
|
|
21
|
+
return <Component {...fixed} {...props} />
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export type VariantProps<T, P extends {} = T extends ComponentType ? ComponentProps<T> : T> = T & JSX.IntrinsicAttributes
|
package/tailwind.preset.js
CHANGED
package/babel.config.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/** @type {import('@babel/core').} */
|
|
2
|
-
module.exports = {
|
|
3
|
-
exclude: [
|
|
4
|
-
'**/node_modules/**'
|
|
5
|
-
],
|
|
6
|
-
presets: [
|
|
7
|
-
'@babel/preset-typescript',
|
|
8
|
-
'@babel/preset-react',
|
|
9
|
-
['@babel/preset-env', {
|
|
10
|
-
useBuiltIns: 'usage',
|
|
11
|
-
corejs: {
|
|
12
|
-
version: '3'
|
|
13
|
-
}
|
|
14
|
-
}]
|
|
15
|
-
]
|
|
16
|
-
}
|
package/postcss.config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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/rollup.config.mjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
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
|
-
]
|