@arbor-education/design-system.components 0.0.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/.checkov.yml +10 -0
- package/.github/CODEOWNERS +7 -0
- package/.github/workflows/chromatic.yml +52 -0
- package/.github/workflows/pr-checks.yml +18 -0
- package/.github/workflows/pr-housekeeping.yaml +16 -0
- package/.husky/pre-commit +2 -0
- package/.nvmrc +1 -0
- package/.pre-commit-config.yaml +28 -0
- package/.storybook/main.ts +21 -0
- package/.storybook/preview.ts +23 -0
- package/.storybook/vitest.setup.ts +7 -0
- package/.tflint.hcl +13 -0
- package/CODEOWNERS +5 -0
- package/README.md +21 -0
- package/bin/createComponent.sh +96 -0
- package/dist/components/button/Button.d.ts +10 -0
- package/dist/components/button/Button.d.ts.map +1 -0
- package/dist/components/button/Button.js +8 -0
- package/dist/components/button/Button.js.map +1 -0
- package/dist/components/card/Card.d.ts +18 -0
- package/dist/components/card/Card.d.ts.map +1 -0
- package/dist/components/card/Card.js +31 -0
- package/dist/components/card/Card.js.map +1 -0
- package/dist/components/card/Card.stories.d.ts +86 -0
- package/dist/components/card/Card.stories.d.ts.map +1 -0
- package/dist/components/card/Card.stories.js +89 -0
- package/dist/components/card/Card.stories.js.map +1 -0
- package/dist/components/heading/Heading.d.ts +393 -0
- package/dist/components/heading/Heading.d.ts.map +1 -0
- package/dist/components/heading/Heading.js +12 -0
- package/dist/components/heading/Heading.js.map +1 -0
- package/dist/components/heading/Heading.stories.d.ts +35 -0
- package/dist/components/heading/Heading.stories.d.ts.map +1 -0
- package/dist/components/heading/Heading.stories.js +50 -0
- package/dist/components/heading/Heading.stories.js.map +1 -0
- package/dist/components/heading/HeadingInnerContainer.d.ts +5 -0
- package/dist/components/heading/HeadingInnerContainer.d.ts.map +1 -0
- package/dist/components/heading/HeadingInnerContainer.js +7 -0
- package/dist/components/heading/HeadingInnerContainer.js.map +1 -0
- package/dist/components/icon/Icon.d.ts +13 -0
- package/dist/components/icon/Icon.d.ts.map +1 -0
- package/dist/components/icon/Icon.js +10 -0
- package/dist/components/icon/Icon.js.map +1 -0
- package/dist/components/icon/Icon.stories.d.ts +11 -0
- package/dist/components/icon/Icon.stories.d.ts.map +1 -0
- package/dist/components/icon/Icon.stories.js +13 -0
- package/dist/components/icon/Icon.stories.js.map +1 -0
- package/dist/components/icon/allowedIcons.d.ts +110 -0
- package/dist/components/icon/allowedIcons.d.ts.map +1 -0
- package/dist/components/icon/allowedIcons.js +117 -0
- package/dist/components/icon/allowedIcons.js.map +1 -0
- package/dist/components/icon/customIcons/AskArbor.d.ts +3 -0
- package/dist/components/icon/customIcons/AskArbor.d.ts.map +1 -0
- package/dist/components/icon/customIcons/AskArbor.js +6 -0
- package/dist/components/icon/customIcons/AskArbor.js.map +1 -0
- package/dist/components/icon/customIcons/CheckSolid.d.ts +3 -0
- package/dist/components/icon/customIcons/CheckSolid.d.ts.map +1 -0
- package/dist/components/icon/customIcons/CheckSolid.js +9 -0
- package/dist/components/icon/customIcons/CheckSolid.js.map +1 -0
- package/dist/components/icon/customIcons/Google.d.ts +3 -0
- package/dist/components/icon/customIcons/Google.d.ts.map +1 -0
- package/dist/components/icon/customIcons/Google.js +7 -0
- package/dist/components/icon/customIcons/Google.js.map +1 -0
- package/dist/components/icon/customIcons/XSolid.d.ts +3 -0
- package/dist/components/icon/customIcons/XSolid.d.ts.map +1 -0
- package/dist/components/icon/customIcons/XSolid.js +8 -0
- package/dist/components/icon/customIcons/XSolid.js.map +1 -0
- package/dist/components/icon/types.d.ts +8 -0
- package/dist/components/icon/types.d.ts.map +1 -0
- package/dist/components/icon/types.js +2 -0
- package/dist/components/icon/types.js.map +1 -0
- package/dist/components/pill/Pill.d.ts +8 -0
- package/dist/components/pill/Pill.d.ts.map +1 -0
- package/dist/components/pill/Pill.js +6 -0
- package/dist/components/pill/Pill.js.map +1 -0
- package/dist/components/pill/Pill.stories.d.ts +8 -0
- package/dist/components/pill/Pill.stories.d.ts.map +1 -0
- package/dist/components/pill/Pill.stories.js +10 -0
- package/dist/components/pill/Pill.stories.js.map +1 -0
- package/dist/index.css +1557 -0
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/generateUuid.d.ts +2 -0
- package/dist/utils/generateUuid.d.ts.map +1 -0
- package/dist/utils/generateUuid.js +10 -0
- package/dist/utils/generateUuid.js.map +1 -0
- package/dist/utils/hooks/useMemoGenerateUuid.d.ts +8 -0
- package/dist/utils/hooks/useMemoGenerateUuid.d.ts.map +1 -0
- package/dist/utils/hooks/useMemoGenerateUuid.js +8 -0
- package/dist/utils/hooks/useMemoGenerateUuid.js.map +1 -0
- package/dist/utils/keyboardConstants.d.ts +13 -0
- package/dist/utils/keyboardConstants.d.ts.map +1 -0
- package/dist/utils/keyboardConstants.js +13 -0
- package/dist/utils/keyboardConstants.js.map +1 -0
- package/dist/utils/waitForElement.d.ts +2 -0
- package/dist/utils/waitForElement.d.ts.map +1 -0
- package/dist/utils/waitForElement.js +18 -0
- package/dist/utils/waitForElement.js.map +1 -0
- package/eslint.config.mts +30 -0
- package/package.json +76 -0
- package/src/components/button/Button.story.tsx +116 -0
- package/src/components/button/Button.test.tsx +49 -0
- package/src/components/button/Button.tsx +37 -0
- package/src/components/button/button.scss +181 -0
- package/src/components/card/Card.stories.tsx +99 -0
- package/src/components/card/Card.test.tsx +231 -0
- package/src/components/card/Card.tsx +96 -0
- package/src/components/card/card.scss +68 -0
- package/src/components/heading/Heading.stories.tsx +85 -0
- package/src/components/heading/Heading.test.tsx +29 -0
- package/src/components/heading/Heading.tsx +17 -0
- package/src/components/heading/HeadingInnerContainer.tsx +18 -0
- package/src/components/heading/heading.scss +48 -0
- package/src/components/icon/Icon.stories.tsx +16 -0
- package/src/components/icon/Icon.test.tsx +17 -0
- package/src/components/icon/Icon.tsx +27 -0
- package/src/components/icon/allowedIcons.tsx +208 -0
- package/src/components/icon/customIcons/AskArbor.tsx +28 -0
- package/src/components/icon/customIcons/CheckSolid.tsx +43 -0
- package/src/components/icon/customIcons/Google.tsx +33 -0
- package/src/components/icon/customIcons/XSolid.tsx +32 -0
- package/src/components/icon/types.ts +8 -0
- package/src/components/pill/Pill.stories.tsx +14 -0
- package/src/components/pill/Pill.test.tsx +21 -0
- package/src/components/pill/Pill.tsx +24 -0
- package/src/components/pill/pill.scss +51 -0
- package/src/global.scss +19 -0
- package/src/index.scss +7 -0
- package/src/index.ts +6 -0
- package/src/tokens.scss +1249 -0
- package/src/utils/generateUuid.ts +9 -0
- package/src/utils/hooks/useMemoGenerateUuid.ts +13 -0
- package/src/utils/keyboardConstants.ts +12 -0
- package/src/utils/waitForElement.ts +22 -0
- package/stylelint.config.mjs +10 -0
- package/tsconfig.json +49 -0
- package/vitest.config.ts +26 -0
- package/vitest.shims.d.ts +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react-vite';
|
|
2
|
+
import { Icon } from './Icon';
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof Icon> = {
|
|
5
|
+
title: 'Components/Icon',
|
|
6
|
+
component: Icon,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const Default = {
|
|
10
|
+
args: {
|
|
11
|
+
name: '3-dot',
|
|
12
|
+
size: 16,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default meta;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { Icon } from './Icon';
|
|
4
|
+
import '@testing-library/jest-dom/vitest';
|
|
5
|
+
|
|
6
|
+
describe('Icon', () => {
|
|
7
|
+
test('Icon renders', () => {
|
|
8
|
+
render(<Icon name="archive" />);
|
|
9
|
+
expect(screen.getByRole('img', { hidden: true })).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('Screen reader text', () => {
|
|
13
|
+
render(<Icon name="arrow-right" screenReaderText="foobar" />);
|
|
14
|
+
expect(screen.getByText('foobar')).toBeInTheDocument();
|
|
15
|
+
expect(screen.getByText('foobar')).toHaveClass('sr-only');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { IconSize } from './types';
|
|
2
|
+
import { allowedIcons } from './allowedIcons';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
type IconProps = {
|
|
6
|
+
size?: IconSize;
|
|
7
|
+
color?: string;
|
|
8
|
+
screenReaderText?: string;
|
|
9
|
+
name: keyof typeof allowedIcons;
|
|
10
|
+
className?: string;
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const Icon = (props: IconProps) => {
|
|
15
|
+
const { size = 16, color = 'currentColor', name, screenReaderText, className } = props;
|
|
16
|
+
const Component = allowedIcons[name];
|
|
17
|
+
const classes = classNames(className, `ds-icon ds-icon-${name}`);
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
{/* why aria-hidden? https://gomakethings.com/revisting-aria-label-versus-a-visually-hidden-class/ */}
|
|
21
|
+
<Component size={size} color={color} className={classes} role="img" aria-hidden="true" />
|
|
22
|
+
{!!screenReaderText && (
|
|
23
|
+
<span className="sr-only">{screenReaderText}</span>
|
|
24
|
+
)}
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Archive,
|
|
3
|
+
ArrowDown,
|
|
4
|
+
ArrowDownUp,
|
|
5
|
+
ArrowLeft,
|
|
6
|
+
ArrowRight,
|
|
7
|
+
ArrowRightFromLine,
|
|
8
|
+
ArrowUp,
|
|
9
|
+
ArrowUpRight,
|
|
10
|
+
BookOpen,
|
|
11
|
+
CalendarFold,
|
|
12
|
+
Camera,
|
|
13
|
+
ChartColumnIncreasing,
|
|
14
|
+
ChartSpline,
|
|
15
|
+
Check,
|
|
16
|
+
ChevronDown,
|
|
17
|
+
ChevronLeft,
|
|
18
|
+
ChevronRight,
|
|
19
|
+
ChevronsLeft,
|
|
20
|
+
ChevronsRight,
|
|
21
|
+
ChevronUp,
|
|
22
|
+
CircleAlert,
|
|
23
|
+
CircleCheck,
|
|
24
|
+
CircleCheckBig,
|
|
25
|
+
CirclePercent,
|
|
26
|
+
CirclePlus,
|
|
27
|
+
CircleQuestionMark,
|
|
28
|
+
CircleX,
|
|
29
|
+
Clipboard,
|
|
30
|
+
ClipboardList,
|
|
31
|
+
Clock3,
|
|
32
|
+
Copy,
|
|
33
|
+
CornerDownLeft,
|
|
34
|
+
Dot,
|
|
35
|
+
Download,
|
|
36
|
+
Ellipsis,
|
|
37
|
+
EllipsisVertical,
|
|
38
|
+
Expand,
|
|
39
|
+
ExternalLink,
|
|
40
|
+
Eye,
|
|
41
|
+
EyeOff,
|
|
42
|
+
File,
|
|
43
|
+
Files,
|
|
44
|
+
Flag,
|
|
45
|
+
Funnel,
|
|
46
|
+
GraduationCap,
|
|
47
|
+
Grid3x3,
|
|
48
|
+
GripVertical,
|
|
49
|
+
History,
|
|
50
|
+
House,
|
|
51
|
+
Info,
|
|
52
|
+
IterationCcw,
|
|
53
|
+
LayoutList,
|
|
54
|
+
Lightbulb,
|
|
55
|
+
Link,
|
|
56
|
+
List,
|
|
57
|
+
ListFilterPlus,
|
|
58
|
+
Lock,
|
|
59
|
+
LockOpen,
|
|
60
|
+
LogOut, type LucideProps,
|
|
61
|
+
Mail,
|
|
62
|
+
Menu,
|
|
63
|
+
MessageSquareMore,
|
|
64
|
+
Mic,
|
|
65
|
+
Minimize2,
|
|
66
|
+
Minus,
|
|
67
|
+
Monitor,
|
|
68
|
+
PaintBucket,
|
|
69
|
+
Paperclip,
|
|
70
|
+
PartyPopper,
|
|
71
|
+
Pencil,
|
|
72
|
+
Percent,
|
|
73
|
+
Phone,
|
|
74
|
+
Pin,
|
|
75
|
+
Plus,
|
|
76
|
+
Projector,
|
|
77
|
+
Redo2,
|
|
78
|
+
Save,
|
|
79
|
+
Search,
|
|
80
|
+
Send,
|
|
81
|
+
Settings,
|
|
82
|
+
Share,
|
|
83
|
+
Sheet,
|
|
84
|
+
SlidersHorizontal,
|
|
85
|
+
Smartphone,
|
|
86
|
+
Sparkles,
|
|
87
|
+
Star, SwitchCamera, Table, Trash2, TrendingDown, TrendingUp, TriangleAlert, Undo2, Upload, User,
|
|
88
|
+
Users,
|
|
89
|
+
UsersRound, X,
|
|
90
|
+
} from 'lucide-react';
|
|
91
|
+
import { AskArbor } from './customIcons/AskArbor';
|
|
92
|
+
import type { CustomIconProps } from './types';
|
|
93
|
+
import { CheckSolid } from './customIcons/CheckSolid';
|
|
94
|
+
import { Google } from './customIcons/Google';
|
|
95
|
+
import { XSolid } from './customIcons/XSolid';
|
|
96
|
+
|
|
97
|
+
export const allowedIcons = {
|
|
98
|
+
// lucide icons
|
|
99
|
+
'3-dot': EllipsisVertical,
|
|
100
|
+
'archive': Archive,
|
|
101
|
+
'arrow-down': ArrowDown,
|
|
102
|
+
'arrow-left': ArrowLeft,
|
|
103
|
+
'arrow-right-from-line': ArrowRightFromLine,
|
|
104
|
+
'arrow-right': ArrowRight,
|
|
105
|
+
'arrow-up-right': ArrowUpRight,
|
|
106
|
+
'arrow-up': ArrowUp,
|
|
107
|
+
'book-open': BookOpen,
|
|
108
|
+
'camera': Camera,
|
|
109
|
+
'chart-column-increasing': ChartColumnIncreasing,
|
|
110
|
+
'chart-spline': ChartSpline,
|
|
111
|
+
'check': Check,
|
|
112
|
+
'chevron-down': ChevronDown,
|
|
113
|
+
'chevron-left': ChevronLeft,
|
|
114
|
+
'chevron-right': ChevronRight,
|
|
115
|
+
'chevron-up': ChevronUp,
|
|
116
|
+
'chevrons-left': ChevronsLeft,
|
|
117
|
+
'chevrons-right': ChevronsRight,
|
|
118
|
+
'circle-alert': CircleAlert,
|
|
119
|
+
'circle-check-big': CircleCheckBig,
|
|
120
|
+
'circle-check': CircleCheck,
|
|
121
|
+
'circle-help': CircleQuestionMark,
|
|
122
|
+
'circle-percent': CirclePercent,
|
|
123
|
+
'circle-plus': CirclePlus,
|
|
124
|
+
'circle-x': CircleX,
|
|
125
|
+
'clipboard-list': ClipboardList,
|
|
126
|
+
'clipboard': Clipboard,
|
|
127
|
+
'clock-3': Clock3,
|
|
128
|
+
'copy': Copy,
|
|
129
|
+
'corner-down-left': CornerDownLeft,
|
|
130
|
+
'date': CalendarFold,
|
|
131
|
+
'dot': Dot,
|
|
132
|
+
'download': Download,
|
|
133
|
+
'ellipsis-vertical': EllipsisVertical,
|
|
134
|
+
'ellipsis': Ellipsis,
|
|
135
|
+
'expand': Expand,
|
|
136
|
+
'external-link': ExternalLink,
|
|
137
|
+
'eye-off': EyeOff,
|
|
138
|
+
'eye': Eye,
|
|
139
|
+
'favourite-outline': Star,
|
|
140
|
+
'file': File,
|
|
141
|
+
'files': Files,
|
|
142
|
+
'flag': Flag,
|
|
143
|
+
'funnel': Funnel,
|
|
144
|
+
'grab': GripVertical,
|
|
145
|
+
'graduation-cap': GraduationCap,
|
|
146
|
+
'grid-3x3': Grid3x3,
|
|
147
|
+
'group': UsersRound,
|
|
148
|
+
'guardians': Users,
|
|
149
|
+
'history': History,
|
|
150
|
+
'house': House,
|
|
151
|
+
'info': Info,
|
|
152
|
+
'iteration-ccw': IterationCcw,
|
|
153
|
+
'layout-list': LayoutList,
|
|
154
|
+
'lightbulb': Lightbulb,
|
|
155
|
+
'link': Link,
|
|
156
|
+
'list-filter-plus': ListFilterPlus,
|
|
157
|
+
'list': List,
|
|
158
|
+
'lock-open': LockOpen,
|
|
159
|
+
'lock': Lock,
|
|
160
|
+
'log-out': LogOut,
|
|
161
|
+
'mail': Mail,
|
|
162
|
+
'menu': Menu,
|
|
163
|
+
'message-square-more': MessageSquareMore,
|
|
164
|
+
'mic': Mic,
|
|
165
|
+
'minus': Minus,
|
|
166
|
+
'monitor': Monitor,
|
|
167
|
+
'paint-bucket': PaintBucket,
|
|
168
|
+
'paperclip': Paperclip,
|
|
169
|
+
'party-popper': PartyPopper,
|
|
170
|
+
'pencil': Pencil,
|
|
171
|
+
'percent': Percent,
|
|
172
|
+
'phone': Phone,
|
|
173
|
+
'pin': Pin,
|
|
174
|
+
'plus': Plus,
|
|
175
|
+
'projector': Projector,
|
|
176
|
+
'redo': Redo2,
|
|
177
|
+
'save': Save,
|
|
178
|
+
'search': Search,
|
|
179
|
+
'send': Send,
|
|
180
|
+
'settings': Settings,
|
|
181
|
+
'share': Share,
|
|
182
|
+
'sheet': Sheet,
|
|
183
|
+
'shrink': Minimize2,
|
|
184
|
+
'sliders-horizontal': SlidersHorizontal,
|
|
185
|
+
'smartphone': Smartphone,
|
|
186
|
+
'sorting': ArrowDownUp,
|
|
187
|
+
'sparkles': Sparkles,
|
|
188
|
+
'staff': GraduationCap,
|
|
189
|
+
'switch-camera': SwitchCamera,
|
|
190
|
+
'table': Table,
|
|
191
|
+
'trash': Trash2,
|
|
192
|
+
'trending-down': TrendingDown,
|
|
193
|
+
'trending-up': TrendingUp,
|
|
194
|
+
'triangle-alert': TriangleAlert,
|
|
195
|
+
'undo': Undo2,
|
|
196
|
+
'upload': Upload,
|
|
197
|
+
'user': User,
|
|
198
|
+
'x': X,
|
|
199
|
+
// custom icons
|
|
200
|
+
'ask-arbor': AskArbor,
|
|
201
|
+
'google': Google,
|
|
202
|
+
// solid icons
|
|
203
|
+
'check-solid': (props: CustomIconProps) => <CheckSolid {...props} />,
|
|
204
|
+
'favourite-filled': (props: LucideProps) => (
|
|
205
|
+
<Star {...props} fill={props.color} />
|
|
206
|
+
),
|
|
207
|
+
'x-solid': (props: CustomIconProps) => <XSolid {...props} />,
|
|
208
|
+
} as const;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CustomIconProps } from '../types';
|
|
2
|
+
|
|
3
|
+
export const AskArbor = (props: CustomIconProps) => {
|
|
4
|
+
const { size, color, ...rest } = props;
|
|
5
|
+
return (
|
|
6
|
+
<svg
|
|
7
|
+
width={size}
|
|
8
|
+
height={size}
|
|
9
|
+
viewBox="0 0 24 24"
|
|
10
|
+
fill="none"
|
|
11
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
12
|
+
{...rest}
|
|
13
|
+
>
|
|
14
|
+
<path
|
|
15
|
+
d="M19.012 7.25127L22.1143 8.18122C22.4097 8.26883 22.6088 8.55186 22.6088 8.86858C22.6088 9.18531 22.4097 9.46834 22.1143 9.55594L19.012 10.4859L18.1257 13.7407C18.0422 14.0507 17.7724 14.2596 17.4705 14.2596C17.1687 14.2596 16.8989 14.0507 16.8154 13.7407L15.9291 10.4859L12.8268 9.55594C12.5314 9.46834 12.3323 9.18531 12.3323 8.86858C12.3323 8.55186 12.5314 8.26883 12.8268 8.18122L15.9291 7.25127L16.8154 3.99643C16.8989 3.68644 17.1687 3.47754 17.4705 3.47754C17.7724 3.47754 18.0422 3.68644 18.1257 3.99643L19.012 7.25127Z"
|
|
16
|
+
fill={color}
|
|
17
|
+
/>
|
|
18
|
+
<path
|
|
19
|
+
d="M11.1167 2.31293L13.0181 2.8829C13.1992 2.9366 13.3212 3.11007 13.3212 3.30419C13.3212 3.49831 13.1992 3.67178 13.0181 3.72547L11.1167 4.29544L10.5735 6.29035C10.5223 6.48034 10.357 6.60838 10.172 6.60838C9.98695 6.60838 9.82161 6.48034 9.77044 6.29035L9.22719 4.29544L7.32582 3.72547C7.14474 3.67178 7.02271 3.49831 7.02271 3.30419C7.02271 3.11007 7.14474 2.9366 7.32582 2.8829L9.22719 2.31293L9.77044 0.318028C9.82161 0.128037 9.98695 0 10.172 0C10.357 0 10.5223 0.128037 10.5735 0.318028L11.1167 2.31293Z"
|
|
20
|
+
fill={color}
|
|
21
|
+
/>
|
|
22
|
+
<path
|
|
23
|
+
d="M10.6567 14.2787L14.9598 15.5687C15.3696 15.6902 15.6458 16.0828 15.6458 16.5221C15.6458 16.9614 15.3696 17.354 14.9598 17.4755L10.6567 18.7655L9.42724 23.2802C9.31142 23.7102 8.93724 24 8.51851 24C8.09979 24 7.72561 23.7102 7.60979 23.2802L6.38033 18.7655L2.07724 17.4755C1.66742 17.354 1.39124 16.9614 1.39124 16.5221C1.39124 16.0828 1.66742 15.6902 2.07724 15.5687L6.38033 14.2787L7.60979 9.76394C7.72561 9.33396 8.09979 9.04419 8.51851 9.04419C8.93724 9.04419 9.31142 9.33396 9.42724 9.76394L10.6567 14.2787Z"
|
|
24
|
+
fill={color}
|
|
25
|
+
/>
|
|
26
|
+
</svg>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { CustomIconProps } from '../types';
|
|
2
|
+
import { useMemoGenerateUuid } from '../../../utils/hooks/useMemoGenerateUuid';
|
|
3
|
+
|
|
4
|
+
export const CheckSolid = (props: CustomIconProps) => {
|
|
5
|
+
const { size, color, ...rest } = props;
|
|
6
|
+
const maskId = useMemoGenerateUuid({ prefix: 'mask' });
|
|
7
|
+
const clipId = useMemoGenerateUuid({ prefix: 'clip' });
|
|
8
|
+
return (
|
|
9
|
+
<svg
|
|
10
|
+
width={size}
|
|
11
|
+
height={size}
|
|
12
|
+
viewBox="0 0 12 12"
|
|
13
|
+
fill="none"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
{...rest}
|
|
16
|
+
>
|
|
17
|
+
<defs>
|
|
18
|
+
<clipPath id={clipId}>
|
|
19
|
+
<rect width="12" height="12" fill="white" />
|
|
20
|
+
</clipPath>
|
|
21
|
+
<mask id={maskId} maskUnits="userSpaceOnUse">
|
|
22
|
+
<rect width="100%" height="100%" fill="white"></rect>
|
|
23
|
+
<path
|
|
24
|
+
d="M3.75 6L5.25 7.5L8.25 4.5"
|
|
25
|
+
stroke="black"
|
|
26
|
+
strokeLinecap="round"
|
|
27
|
+
strokeLinejoin="round"
|
|
28
|
+
/>
|
|
29
|
+
</mask>
|
|
30
|
+
</defs>
|
|
31
|
+
<g clipPath={`url(#${clipId})`} mask={`url(#${maskId})`}>
|
|
32
|
+
<rect
|
|
33
|
+
x="0.75"
|
|
34
|
+
y="0.75"
|
|
35
|
+
width="10.5"
|
|
36
|
+
height="10.5"
|
|
37
|
+
rx="5.25"
|
|
38
|
+
fill={color}
|
|
39
|
+
/>
|
|
40
|
+
</g>
|
|
41
|
+
</svg>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { CustomIconProps } from '../types';
|
|
2
|
+
|
|
3
|
+
export const Google = (props: CustomIconProps) => {
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
+
const { size, color, ...rest } = props;
|
|
6
|
+
return (
|
|
7
|
+
<svg
|
|
8
|
+
width={size}
|
|
9
|
+
height={size}
|
|
10
|
+
viewBox="0 0 24 24"
|
|
11
|
+
fill="none"
|
|
12
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
+
{...rest}
|
|
14
|
+
>
|
|
15
|
+
<path
|
|
16
|
+
d="M18.1963 18.0438C20.2182 16.1567 21.1167 13.0117 20.5776 10.0013H12.5352V13.3262H17.118C16.9383 14.4045 16.3092 15.303 15.4107 15.8872L18.1963 18.0438Z"
|
|
17
|
+
fill="#4285F4"
|
|
18
|
+
/>
|
|
19
|
+
<path
|
|
20
|
+
d="M4.89648 15.393C4.97011 15.5379 5.04773 15.6807 5.12936 15.8212C5.21105 15.9618 5.29661 16.1 5.38605 16.2357C5.47555 16.3714 5.56873 16.5045 5.66573 16.635C5.76273 16.7655 5.8633 16.893 5.96755 17.0178C6.07173 17.1426 6.17936 17.2643 6.29048 17.383C6.40155 17.5017 6.51592 17.6172 6.63355 17.7294C6.75117 17.8416 6.87186 17.9504 6.99561 18.0558C7.11936 18.1612 7.24598 18.263 7.37555 18.3613C7.50505 18.4595 7.63723 18.554 7.77211 18.6448C7.90698 18.7355 8.0443 18.8224 8.18411 18.9054C8.32386 18.9884 8.46586 19.0674 8.61011 19.1424C8.75436 19.2173 8.90061 19.2882 9.04886 19.3549C9.19711 19.4216 9.34711 19.4841 9.49892 19.5423C9.65067 19.6005 9.80398 19.6544 9.9588 19.704C10.1136 19.7535 10.2697 19.7987 10.4271 19.8394C10.5845 19.8802 10.7429 19.9164 10.9023 19.9482C11.0617 19.98 11.2219 20.0072 11.3829 20.03C11.5439 20.0527 11.7054 20.0708 11.8674 20.0844C12.0294 20.098 12.1916 20.107 12.3541 20.1114C12.5166 20.1158 12.6791 20.1157 12.8416 20.1109C13.0041 20.1062 13.1663 20.0968 13.3283 20.0828C13.4902 20.0689 13.6517 20.0504 13.8126 20.0273C13.9735 20.0043 14.1337 19.9767 14.293 19.9445C14.4524 19.9124 14.6107 19.8758 14.768 19.8348C14.9253 19.7937 15.0813 19.7482 15.236 19.6983C15.3907 19.6485 15.5439 19.5942 15.6956 19.5357C15.8472 19.4771 15.9971 19.4143 16.1452 19.3473C16.2934 19.2803 16.4394 19.2092 16.5835 19.1338C16.7276 19.0586 16.8694 18.9793 17.009 18.896C17.1486 18.8127 17.2857 18.7255 17.4204 18.6345C17.5551 18.5434 17.6871 18.4486 17.8164 18.3501C17.9457 18.2516 18.0722 18.1495 18.1957 18.0438L15.41 15.8872C13.0288 17.4597 9.07498 16.8757 7.72705 13.1914L4.89648 15.393Z"
|
|
21
|
+
fill="#34A853"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M7.72739 13.1914C7.36795 12.0681 7.36795 11.0348 7.72739 9.91152L4.89683 7.70996C3.86345 9.77677 3.54895 12.6971 4.89683 15.393L7.72739 13.1914Z"
|
|
25
|
+
fill="#FBBC02"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
d="M7.72705 9.91146C8.71555 6.81134 12.9389 5.01415 15.7695 7.66496L18.2406 5.23877C14.7361 1.86908 7.9068 2.00383 4.89648 7.7099L7.72705 9.91146Z"
|
|
29
|
+
fill="#EA4335"
|
|
30
|
+
/>
|
|
31
|
+
</svg>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CustomIconProps } from '../types';
|
|
2
|
+
import { useMemoGenerateUuid } from '../../../utils/hooks/useMemoGenerateUuid';
|
|
3
|
+
|
|
4
|
+
export const XSolid = (props: CustomIconProps) => {
|
|
5
|
+
const { size, color, ...rest } = props;
|
|
6
|
+
const maskId = useMemoGenerateUuid({ prefix: 'mask' });
|
|
7
|
+
return (
|
|
8
|
+
<svg
|
|
9
|
+
width={size}
|
|
10
|
+
height={size}
|
|
11
|
+
viewBox="0 0 12 12"
|
|
12
|
+
fill="none"
|
|
13
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
14
|
+
{...rest}
|
|
15
|
+
>
|
|
16
|
+
<defs>
|
|
17
|
+
<mask id={maskId} maskUnits="userSpaceOnUse">
|
|
18
|
+
<rect width="100%" height="100%" fill="white"></rect>
|
|
19
|
+
<path
|
|
20
|
+
d="M8 4L4 8M4 4L8 8"
|
|
21
|
+
stroke="black"
|
|
22
|
+
strokeLinecap="round"
|
|
23
|
+
strokeLinejoin="round"
|
|
24
|
+
/>
|
|
25
|
+
</mask>
|
|
26
|
+
</defs>
|
|
27
|
+
<g mask={`url(#${maskId})`}>
|
|
28
|
+
<rect x="1" y="1" width="10" height="10" rx="5" fill={color} />
|
|
29
|
+
</g>
|
|
30
|
+
</svg>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
import { render, screen } from '@testing-library/react';
|
|
3
|
+
import { Pill } from './Pill';
|
|
4
|
+
import '@testing-library/jest-dom/vitest';
|
|
5
|
+
|
|
6
|
+
describe('Pill', () => {
|
|
7
|
+
test('Pill says hello', () => {
|
|
8
|
+
render(<Pill text="Hello I'm a Pill!" />);
|
|
9
|
+
expect(screen.getByText("Hello I'm a Pill!")).toBeInTheDocument();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('Pill has default color green', () => {
|
|
13
|
+
render(<Pill text="Hello I'm a Pill!" />);
|
|
14
|
+
expect(screen.getByText("Hello I'm a Pill!")).toHaveClass('ds-pill--green');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('Pill has custom color', () => {
|
|
18
|
+
render(<Pill text="Hello I'm a Pill!" color="blue" />);
|
|
19
|
+
expect(screen.getByText("Hello I'm a Pill!")).toHaveClass('ds-pill--blue');
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import classNames from 'classnames';
|
|
2
|
+
|
|
3
|
+
export type PillColor = 'orange'
|
|
4
|
+
| 'blue'
|
|
5
|
+
| 'green'
|
|
6
|
+
| 'purple'
|
|
7
|
+
| 'teal'
|
|
8
|
+
| 'salmon'
|
|
9
|
+
| 'yellow';
|
|
10
|
+
|
|
11
|
+
type PillProps = {
|
|
12
|
+
text: string;
|
|
13
|
+
color?: PillColor;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const Pill = ({ text, color = 'green' }: PillProps) => {
|
|
17
|
+
return (
|
|
18
|
+
<span
|
|
19
|
+
className={classNames('ds-pill', `ds-pill--${color}`)}
|
|
20
|
+
>
|
|
21
|
+
{text}
|
|
22
|
+
</span>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.ds-pill {
|
|
2
|
+
display: flex;
|
|
3
|
+
padding: var(--tag-spacing-x, 8px) var(--tag-spacing-y, 12px);
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: var(--tag-spacing-gap-y, 8px);
|
|
6
|
+
border-radius: var(--tag-radius, 99px);
|
|
7
|
+
flex-grow: 0;
|
|
8
|
+
width: fit-content;
|
|
9
|
+
|
|
10
|
+
/* typography/body/p1-reg */
|
|
11
|
+
font-family: var(--type-body-p-family, Inter);
|
|
12
|
+
font-size: var(--type-body-p-size, 13px);
|
|
13
|
+
font-style: normal;
|
|
14
|
+
font-weight: var(--type-body-p-weight, 400);
|
|
15
|
+
line-height: 150%; /* 19.5px */
|
|
16
|
+
|
|
17
|
+
&--orange {
|
|
18
|
+
color: var(--tag-category-orange-color-text, #7E3E00);
|
|
19
|
+
background: var(--tag-category-orange-color-background, #F7EED8);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
&--blue {
|
|
23
|
+
color: var(--tag-category-blue-color-text);
|
|
24
|
+
background: var(--tag-category-blue-color-background);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&--green {
|
|
28
|
+
color: var(--tag-category-green-color-text);
|
|
29
|
+
background: var(--tag-category-green-color-background);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&--purple {
|
|
33
|
+
color: var(--tag-category-purple-color-text);
|
|
34
|
+
background: var(--tag-category-purple-color-background);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&--teal {
|
|
38
|
+
color: var(--tag-category-teal-color-text);
|
|
39
|
+
background: var(--tag-category-teal-color-background);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&--salmon {
|
|
43
|
+
color: var(--tag-category-salmon-color-text);
|
|
44
|
+
background: var(--tag-category-salmon-color-background);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&--yellow {
|
|
48
|
+
color: var(--tag-category-yellow-color-text);
|
|
49
|
+
background: var(--tag-category-yellow-color-background);
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/global.scss
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.sr-only {
|
|
2
|
+
clip: rect(0 0 0 0); /* stylelint-disable-line property-no-deprecated */
|
|
3
|
+
clip-path: inset(50%);
|
|
4
|
+
height: 1px;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
position: absolute;
|
|
7
|
+
white-space: nowrap;
|
|
8
|
+
width: 1px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.medium-spacing-gap {
|
|
12
|
+
gap: var(--button-medium-spacing-gap-y);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
* {
|
|
16
|
+
-webkit-font-smoothing: antialiased;
|
|
17
|
+
-moz-osx-font-smoothing: grayscale;
|
|
18
|
+
text-rendering: optimizeLegibility;
|
|
19
|
+
}
|
package/src/index.scss
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
@use "./tokens.scss";
|
|
2
|
+
@use "./global.scss";
|
|
3
|
+
@use "./components/button/button.scss";
|
|
4
|
+
@use "./components/heading/heading.scss";
|
|
5
|
+
@use "./components/card/card.scss";
|
|
6
|
+
@use "./components/pill/pill.scss";
|
|
7
|
+
@import "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { Button } from './components/button/Button';
|
|
2
|
+
export { Heading } from './components/heading/Heading';
|
|
3
|
+
export { HeadingInnerContainer } from './components/heading/HeadingInnerContainer';
|
|
4
|
+
export { Icon } from './components/icon/Icon';
|
|
5
|
+
export { Card } from './components/card/Card';
|
|
6
|
+
export { Pill } from './components/pill/Pill';
|