@oztix/roadie-components 1.2.0 → 2.0.0
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/dist/Accordion.d.ts +37 -0
- package/dist/Accordion.js +3 -0
- package/dist/Accordion.js.map +1 -0
- package/dist/Autocomplete.d.ts +131 -0
- package/dist/Autocomplete.js +3 -0
- package/dist/Autocomplete.js.map +1 -0
- package/dist/Badge.d.ts +22 -0
- package/dist/Badge.js +2 -0
- package/dist/Badge.js.map +1 -0
- package/dist/Breadcrumb.d.ts +43 -0
- package/dist/Breadcrumb.js +2 -0
- package/dist/Breadcrumb.js.map +1 -0
- package/dist/Button-DagX1D_q.d.ts +19 -0
- package/dist/Button.d.ts +11 -15
- package/dist/Button.js +1 -1
- package/dist/Card.d.ts +51 -0
- package/dist/Card.js +2 -0
- package/dist/Card.js.map +1 -0
- package/dist/Code.d.ts +14 -24
- package/dist/Code.js +1 -1
- package/dist/Combobox.d.ts +137 -0
- package/dist/Combobox.js +3 -0
- package/dist/Combobox.js.map +1 -0
- package/dist/Field.d.ts +71 -0
- package/dist/Field.js +3 -0
- package/dist/Field.js.map +1 -0
- package/dist/Fieldset.d.ts +36 -0
- package/dist/Fieldset.js +3 -0
- package/dist/Fieldset.js.map +1 -0
- package/dist/Highlight.d.ts +14 -36
- package/dist/Highlight.js +1 -1
- package/dist/Indicator.d.ts +17 -0
- package/dist/Indicator.js +2 -0
- package/dist/Indicator.js.map +1 -0
- package/dist/Input.d.ts +18 -0
- package/dist/Input.js +3 -0
- package/dist/Input.js.map +1 -0
- package/dist/Label.d.ts +11 -0
- package/dist/Label.js +2 -0
- package/dist/Label.js.map +1 -0
- package/dist/LinkButton.d.ts +35 -0
- package/dist/LinkButton.js +2 -0
- package/dist/LinkButton.js.map +1 -0
- package/dist/Mark.d.ts +15 -26
- package/dist/Mark.js +1 -1
- package/dist/Marquee.d.ts +21 -0
- package/dist/Marquee.js +3 -0
- package/dist/Marquee.js.map +1 -0
- package/dist/Prose.d.ts +22 -0
- package/dist/Prose.js +2 -0
- package/dist/Prose.js.map +1 -0
- package/dist/RadioGroup.d.ts +59 -0
- package/dist/RadioGroup.js +3 -0
- package/dist/RadioGroup.js.map +1 -0
- package/dist/Select.d.ts +144 -0
- package/dist/Select.js +3 -0
- package/dist/Select.js.map +1 -0
- package/dist/Separator.d.ts +16 -0
- package/dist/Separator.js +2 -0
- package/dist/Separator.js.map +1 -0
- package/dist/SpotIllustration.d.ts +59 -24
- package/dist/SpotIllustration.js +2 -1
- package/dist/SpotIllustration.js.map +1 -1
- package/dist/Steps.d.ts +105 -0
- package/dist/Steps.js +3 -0
- package/dist/Steps.js.map +1 -0
- package/dist/Textarea.d.ts +19 -0
- package/dist/Textarea.js +3 -0
- package/dist/Textarea.js.map +1 -0
- package/dist/_chunks/chunk-2MBFDJ6K.js +3 -0
- package/dist/_chunks/chunk-2MBFDJ6K.js.map +1 -0
- package/dist/_chunks/chunk-3HWPLULJ.js +2 -0
- package/dist/_chunks/chunk-3HWPLULJ.js.map +1 -0
- package/dist/_chunks/chunk-3NU36NBL.js +3 -0
- package/dist/_chunks/chunk-3NU36NBL.js.map +1 -0
- package/dist/_chunks/chunk-42UB7PQB.js +3 -0
- package/dist/_chunks/chunk-42UB7PQB.js.map +1 -0
- package/dist/_chunks/chunk-4LGCF3SN.js +3 -0
- package/dist/_chunks/chunk-4LGCF3SN.js.map +1 -0
- package/dist/_chunks/chunk-A6JSYXKN.js +2 -0
- package/dist/_chunks/chunk-A6JSYXKN.js.map +1 -0
- package/dist/_chunks/chunk-AFSDN4WI.js +2 -0
- package/dist/_chunks/chunk-AFSDN4WI.js.map +1 -0
- package/dist/_chunks/chunk-DRVUAPKN.js +2 -0
- package/dist/_chunks/chunk-DRVUAPKN.js.map +1 -0
- package/dist/_chunks/chunk-EKOEXSAP.js +2 -0
- package/dist/_chunks/chunk-EKOEXSAP.js.map +1 -0
- package/dist/_chunks/chunk-FQNVMKKV.js +7 -0
- package/dist/_chunks/chunk-FQNVMKKV.js.map +1 -0
- package/dist/_chunks/chunk-FSO4EAAY.js +3 -0
- package/dist/_chunks/chunk-FSO4EAAY.js.map +1 -0
- package/dist/_chunks/chunk-IEDKSZAQ.js +3 -0
- package/dist/_chunks/chunk-IEDKSZAQ.js.map +1 -0
- package/dist/_chunks/chunk-JBHYUOI2.js +3 -0
- package/dist/_chunks/chunk-JBHYUOI2.js.map +1 -0
- package/dist/_chunks/chunk-JGTZ3GCR.js +2 -0
- package/dist/_chunks/chunk-JGTZ3GCR.js.map +1 -0
- package/dist/_chunks/chunk-LHNOY24C.js +2 -0
- package/dist/_chunks/chunk-LHNOY24C.js.map +1 -0
- package/dist/_chunks/chunk-LMV3JECI.js +3 -0
- package/dist/_chunks/chunk-LMV3JECI.js.map +1 -0
- package/dist/_chunks/chunk-M4FEKBLW.js +2 -0
- package/dist/_chunks/chunk-M4FEKBLW.js.map +1 -0
- package/dist/_chunks/chunk-MDRAL676.js +3 -0
- package/dist/_chunks/chunk-MDRAL676.js.map +1 -0
- package/dist/_chunks/chunk-N2HGY7W7.js +3 -0
- package/dist/_chunks/chunk-N2HGY7W7.js.map +1 -0
- package/dist/_chunks/chunk-OIAETOZT.js +3 -0
- package/dist/_chunks/chunk-OIAETOZT.js.map +1 -0
- package/dist/_chunks/chunk-RXMWFJ6W.js +3 -0
- package/dist/_chunks/chunk-RXMWFJ6W.js.map +1 -0
- package/dist/_chunks/chunk-VSKUGXQG.js +3 -0
- package/dist/_chunks/chunk-VSKUGXQG.js.map +1 -0
- package/dist/_chunks/chunk-WOU2B425.js +3 -0
- package/dist/_chunks/chunk-WOU2B425.js.map +1 -0
- package/dist/_chunks/chunk-Y6TDYPCZ.js +3 -0
- package/dist/_chunks/chunk-Y6TDYPCZ.js.map +1 -0
- package/dist/_chunks/chunk-ZXR32FYA.js +2 -0
- package/dist/_chunks/chunk-ZXR32FYA.js.map +1 -0
- package/dist/index.d.ts +60 -15
- package/dist/index.js +34 -1
- package/dist/index.js.map +1 -1
- package/package.json +18 -22
- package/dist/Container.d.ts +0 -34
- package/dist/Container.js +0 -2
- package/dist/Container.js.map +0 -1
- package/dist/Heading.d.ts +0 -45
- package/dist/Heading.js +0 -2
- package/dist/Heading.js.map +0 -1
- package/dist/Text.d.ts +0 -47
- package/dist/Text.js +0 -2
- package/dist/Text.js.map +0 -1
- package/dist/View.d.ts +0 -12
- package/dist/View.js +0 -2
- package/dist/View.js.map +0 -1
- package/dist/_chunks/chunk-AZZHYO2A.js +0 -3
- package/dist/_chunks/chunk-AZZHYO2A.js.map +0 -1
- package/dist/_chunks/chunk-JOQJCXYF.js +0 -2
- package/dist/_chunks/chunk-JOQJCXYF.js.map +0 -1
- package/dist/_chunks/chunk-NMGF2AP6.js +0 -2
- package/dist/_chunks/chunk-NMGF2AP6.js.map +0 -1
- package/dist/_chunks/chunk-OH4JYS35.js +0 -3
- package/dist/_chunks/chunk-OH4JYS35.js.map +0 -1
- package/dist/_chunks/chunk-P5L5LN6E.js +0 -2
- package/dist/_chunks/chunk-P5L5LN6E.js.map +0 -1
- package/dist/_chunks/chunk-RJEJUZ3O.js +0 -2
- package/dist/_chunks/chunk-RJEJUZ3O.js.map +0 -1
- package/dist/_chunks/chunk-SUDUTP6A.js +0 -3
- package/dist/_chunks/chunk-SUDUTP6A.js.map +0 -1
- package/dist/_chunks/chunk-YNF56IUK.js +0 -2
- package/dist/_chunks/chunk-YNF56IUK.js.map +0 -1
- package/dist/_chunks/chunk-ZXS7U3VJ.js +0 -2
- package/dist/_chunks/chunk-ZXS7U3VJ.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -27
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/index.js.map +0 -1
- package/src/components/Button/Button.test.tsx +0 -156
- package/src/components/Button/Button.tsx +0 -12
- package/src/components/Button/IconButton.test.tsx +0 -234
- package/src/components/Button/IconButton.tsx +0 -14
- package/src/components/Button/index.tsx +0 -2
- package/src/components/Code/Code.test.tsx +0 -85
- package/src/components/Code/index.tsx +0 -37
- package/src/components/Container/Container.test.tsx +0 -241
- package/src/components/Container/index.tsx +0 -34
- package/src/components/Heading/Heading.test.tsx +0 -128
- package/src/components/Heading/index.tsx +0 -49
- package/src/components/Highlight/Highlight.test.tsx +0 -113
- package/src/components/Highlight/index.tsx +0 -96
- package/src/components/Mark/Mark.test.tsx +0 -82
- package/src/components/Mark/index.tsx +0 -33
- package/src/components/SpotIllustration/ArrowUpRight.tsx +0 -9
- package/src/components/SpotIllustration/CowboyHat.tsx +0 -6
- package/src/components/SpotIllustration/Cursor.tsx +0 -6
- package/src/components/SpotIllustration/FlowerSpiral.tsx +0 -9
- package/src/components/SpotIllustration/Football.tsx +0 -6
- package/src/components/SpotIllustration/Hand.tsx +0 -6
- package/src/components/SpotIllustration/Heart.tsx +0 -6
- package/src/components/SpotIllustration/HighFive.tsx +0 -6
- package/src/components/SpotIllustration/MapPin.tsx +0 -6
- package/src/components/SpotIllustration/NoteMusic.tsx +0 -6
- package/src/components/SpotIllustration/README.md +0 -280
- package/src/components/SpotIllustration/SpotIllustration.test.tsx +0 -179
- package/src/components/SpotIllustration/SpotIllustration.tsx +0 -96
- package/src/components/SpotIllustration/Ticket.tsx +0 -6
- package/src/components/SpotIllustration/WineGlass.tsx +0 -6
- package/src/components/SpotIllustration/createSpotIllustration.tsx +0 -46
- package/src/components/SpotIllustration/index.tsx +0 -42
- package/src/components/SpotIllustration/json/arrow-up-right.json +0 -34
- package/src/components/SpotIllustration/json/cowboy-hat.json +0 -34
- package/src/components/SpotIllustration/json/cursor.json +0 -34
- package/src/components/SpotIllustration/json/flower-spiral.json +0 -38
- package/src/components/SpotIllustration/json/football.json +0 -46
- package/src/components/SpotIllustration/json/hand.json +0 -22
- package/src/components/SpotIllustration/json/heart.json +0 -26
- package/src/components/SpotIllustration/json/high-five.json +0 -62
- package/src/components/SpotIllustration/json/map-pin.json +0 -26
- package/src/components/SpotIllustration/json/note-music.json +0 -42
- package/src/components/SpotIllustration/json/ticket.json +0 -42
- package/src/components/SpotIllustration/json/wine-glass.json +0 -34
- package/src/components/SpotIllustration/svgs/arrow-up-right.svg +0 -9
- package/src/components/SpotIllustration/svgs/cowboy-hat.svg +0 -9
- package/src/components/SpotIllustration/svgs/cursor.svg +0 -9
- package/src/components/SpotIllustration/svgs/flower-spiral.svg +0 -10
- package/src/components/SpotIllustration/svgs/football.svg +0 -12
- package/src/components/SpotIllustration/svgs/hand.svg +0 -6
- package/src/components/SpotIllustration/svgs/heart.svg +0 -7
- package/src/components/SpotIllustration/svgs/high-five.svg +0 -16
- package/src/components/SpotIllustration/svgs/map-pin.svg +0 -7
- package/src/components/SpotIllustration/svgs/note-music.svg +0 -11
- package/src/components/SpotIllustration/svgs/ticket.svg +0 -11
- package/src/components/SpotIllustration/svgs/wine-glass.svg +0 -9
- package/src/components/Text/Text.test.tsx +0 -121
- package/src/components/Text/index.tsx +0 -51
- package/src/components/View/View.test.tsx +0 -161
- package/src/components/View/index.tsx +0 -12
- package/src/components/index.ts +0 -17
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useColorMode.ts +0 -37
- package/src/index.test.tsx +0 -37
- package/src/index.tsx +0 -9
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import userEvent from '@testing-library/user-event'
|
|
3
|
-
import { describe, expect, it, vi } from 'vitest'
|
|
4
|
-
|
|
5
|
-
import { IconButton } from './IconButton'
|
|
6
|
-
|
|
7
|
-
describe('IconButton', () => {
|
|
8
|
-
it('renders with default props', () => {
|
|
9
|
-
const { getByRole } = render(<IconButton aria-label='Icon'>+</IconButton>)
|
|
10
|
-
const button = getByRole('button')
|
|
11
|
-
expect(button).toBeInTheDocument()
|
|
12
|
-
expect(button.tagName.toLowerCase()).toBe('button')
|
|
13
|
-
expect(button).toHaveClass(
|
|
14
|
-
'button',
|
|
15
|
-
'button--emphasis_default',
|
|
16
|
-
'button--size_md'
|
|
17
|
-
)
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
it('applies zero padding to create square button', () => {
|
|
21
|
-
const { getByRole } = render(<IconButton aria-label='Icon'>+</IconButton>)
|
|
22
|
-
const button = getByRole('button')
|
|
23
|
-
// The component should have px="0" and py="0" applied
|
|
24
|
-
expect(button).toBeInTheDocument()
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('renders with different emphasis', () => {
|
|
28
|
-
const { rerender, getByRole } = render(
|
|
29
|
-
<IconButton emphasis='strong' colorPalette='accent' aria-label='Strong'>
|
|
30
|
-
+
|
|
31
|
-
</IconButton>
|
|
32
|
-
)
|
|
33
|
-
let button = getByRole('button')
|
|
34
|
-
expect(button).toHaveClass(
|
|
35
|
-
'button--emphasis_strong',
|
|
36
|
-
'color-palette_accent'
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
rerender(
|
|
40
|
-
<IconButton emphasis='default' aria-label='Default'>
|
|
41
|
-
+
|
|
42
|
-
</IconButton>
|
|
43
|
-
)
|
|
44
|
-
button = getByRole('button')
|
|
45
|
-
expect(button).toHaveClass('button--emphasis_default')
|
|
46
|
-
|
|
47
|
-
rerender(
|
|
48
|
-
<IconButton emphasis='subtle' aria-label='Subtle'>
|
|
49
|
-
+
|
|
50
|
-
</IconButton>
|
|
51
|
-
)
|
|
52
|
-
button = getByRole('button')
|
|
53
|
-
expect(button).toHaveClass('button--emphasis_subtle')
|
|
54
|
-
|
|
55
|
-
rerender(
|
|
56
|
-
<IconButton emphasis='subtler' aria-label='Subtler'>
|
|
57
|
-
+
|
|
58
|
-
</IconButton>
|
|
59
|
-
)
|
|
60
|
-
button = getByRole('button')
|
|
61
|
-
expect(button).toHaveClass('button--emphasis_subtler')
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
it('renders with different sizes', () => {
|
|
65
|
-
const { rerender, getByRole } = render(
|
|
66
|
-
<IconButton size='xs' aria-label='Extra small'>
|
|
67
|
-
+
|
|
68
|
-
</IconButton>
|
|
69
|
-
)
|
|
70
|
-
let button = getByRole('button')
|
|
71
|
-
expect(button).toHaveClass('button--size_xs')
|
|
72
|
-
|
|
73
|
-
rerender(
|
|
74
|
-
<IconButton size='sm' aria-label='Small'>
|
|
75
|
-
+
|
|
76
|
-
</IconButton>
|
|
77
|
-
)
|
|
78
|
-
button = getByRole('button')
|
|
79
|
-
expect(button).toHaveClass('button--size_sm')
|
|
80
|
-
|
|
81
|
-
rerender(
|
|
82
|
-
<IconButton size='md' aria-label='Medium'>
|
|
83
|
-
+
|
|
84
|
-
</IconButton>
|
|
85
|
-
)
|
|
86
|
-
button = getByRole('button')
|
|
87
|
-
expect(button).toHaveClass('button--size_md')
|
|
88
|
-
|
|
89
|
-
rerender(
|
|
90
|
-
<IconButton size='lg' aria-label='Large'>
|
|
91
|
-
+
|
|
92
|
-
</IconButton>
|
|
93
|
-
)
|
|
94
|
-
button = getByRole('button')
|
|
95
|
-
expect(button).toHaveClass('button--size_lg')
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
it('renders with different color palettes', () => {
|
|
99
|
-
const { rerender, getByRole } = render(
|
|
100
|
-
<IconButton emphasis='strong' colorPalette='accent' aria-label='Accent'>
|
|
101
|
-
+
|
|
102
|
-
</IconButton>
|
|
103
|
-
)
|
|
104
|
-
let button = getByRole('button')
|
|
105
|
-
expect(button).toHaveClass('color-palette_accent')
|
|
106
|
-
|
|
107
|
-
rerender(
|
|
108
|
-
<IconButton emphasis='strong' colorPalette='success' aria-label='Success'>
|
|
109
|
-
+
|
|
110
|
-
</IconButton>
|
|
111
|
-
)
|
|
112
|
-
button = getByRole('button')
|
|
113
|
-
expect(button).toHaveClass('color-palette_success')
|
|
114
|
-
|
|
115
|
-
rerender(
|
|
116
|
-
<IconButton emphasis='strong' colorPalette='warning' aria-label='Warning'>
|
|
117
|
-
+
|
|
118
|
-
</IconButton>
|
|
119
|
-
)
|
|
120
|
-
button = getByRole('button')
|
|
121
|
-
expect(button).toHaveClass('color-palette_warning')
|
|
122
|
-
|
|
123
|
-
rerender(
|
|
124
|
-
<IconButton emphasis='strong' colorPalette='danger' aria-label='Danger'>
|
|
125
|
-
+
|
|
126
|
-
</IconButton>
|
|
127
|
-
)
|
|
128
|
-
button = getByRole('button')
|
|
129
|
-
expect(button).toHaveClass('color-palette_danger')
|
|
130
|
-
})
|
|
131
|
-
|
|
132
|
-
it('handles disabled state', () => {
|
|
133
|
-
const { getByRole } = render(
|
|
134
|
-
<IconButton disabled aria-label='Disabled'>
|
|
135
|
-
+
|
|
136
|
-
</IconButton>
|
|
137
|
-
)
|
|
138
|
-
const button = getByRole('button')
|
|
139
|
-
expect(button).toBeDisabled()
|
|
140
|
-
expect(button).toHaveClass('button')
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
it('calls onClick when clicked', async () => {
|
|
144
|
-
const handleClick = vi.fn()
|
|
145
|
-
const user = userEvent.setup()
|
|
146
|
-
|
|
147
|
-
const { getByRole } = render(
|
|
148
|
-
<IconButton onClick={handleClick} aria-label='Click me'>
|
|
149
|
-
+
|
|
150
|
-
</IconButton>
|
|
151
|
-
)
|
|
152
|
-
const button = getByRole('button')
|
|
153
|
-
|
|
154
|
-
await user.click(button)
|
|
155
|
-
expect(handleClick).toHaveBeenCalledTimes(1)
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
it('does not call onClick when disabled', async () => {
|
|
159
|
-
const handleClick = vi.fn()
|
|
160
|
-
const user = userEvent.setup()
|
|
161
|
-
|
|
162
|
-
const { getByRole } = render(
|
|
163
|
-
<IconButton disabled onClick={handleClick} aria-label='Disabled'>
|
|
164
|
-
+
|
|
165
|
-
</IconButton>
|
|
166
|
-
)
|
|
167
|
-
const button = getByRole('button')
|
|
168
|
-
|
|
169
|
-
await user.click(button)
|
|
170
|
-
expect(handleClick).not.toHaveBeenCalled()
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
it('applies custom className', () => {
|
|
174
|
-
const { getByRole } = render(
|
|
175
|
-
<IconButton className='custom-class' aria-label='Custom'>
|
|
176
|
-
+
|
|
177
|
-
</IconButton>
|
|
178
|
-
)
|
|
179
|
-
const button = getByRole('button')
|
|
180
|
-
expect(button).toHaveClass('custom-class')
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
it('combines multiple props', () => {
|
|
184
|
-
const { getByRole } = render(
|
|
185
|
-
<IconButton
|
|
186
|
-
emphasis='strong'
|
|
187
|
-
size='lg'
|
|
188
|
-
colorPalette='accent'
|
|
189
|
-
className='custom-class'
|
|
190
|
-
aria-label='Combined'
|
|
191
|
-
>
|
|
192
|
-
+
|
|
193
|
-
</IconButton>
|
|
194
|
-
)
|
|
195
|
-
const button = getByRole('button')
|
|
196
|
-
expect(button).toHaveClass(
|
|
197
|
-
'button',
|
|
198
|
-
'button--emphasis_strong',
|
|
199
|
-
'button--size_lg',
|
|
200
|
-
'color-palette_accent',
|
|
201
|
-
'custom-class'
|
|
202
|
-
)
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
it('renders icon content correctly', () => {
|
|
206
|
-
const { getByRole } = render(
|
|
207
|
-
<IconButton aria-label='Add item'>
|
|
208
|
-
<svg
|
|
209
|
-
width='16'
|
|
210
|
-
height='16'
|
|
211
|
-
viewBox='0 0 16 16'
|
|
212
|
-
fill='currentColor'
|
|
213
|
-
data-testid='icon'
|
|
214
|
-
>
|
|
215
|
-
<path d='M8 0L8 16M0 8L16 8' />
|
|
216
|
-
</svg>
|
|
217
|
-
</IconButton>
|
|
218
|
-
)
|
|
219
|
-
const button = getByRole('button')
|
|
220
|
-
const icon = button.querySelector('[data-testid="icon"]')
|
|
221
|
-
expect(icon).toBeInTheDocument()
|
|
222
|
-
})
|
|
223
|
-
|
|
224
|
-
it('allows padding override', () => {
|
|
225
|
-
const { getByRole } = render(
|
|
226
|
-
<IconButton px='200' aria-label='Custom padding'>
|
|
227
|
-
+
|
|
228
|
-
</IconButton>
|
|
229
|
-
)
|
|
230
|
-
const button = getByRole('button')
|
|
231
|
-
// Should allow override of default px="0"
|
|
232
|
-
expect(button).toBeInTheDocument()
|
|
233
|
-
})
|
|
234
|
-
})
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ComponentProps } from 'react'
|
|
2
|
-
|
|
3
|
-
import { Button } from './Button'
|
|
4
|
-
|
|
5
|
-
export interface IconButtonProps
|
|
6
|
-
extends Omit<ComponentProps<typeof Button>, 'aria-label'> {
|
|
7
|
-
'aria-label': string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export const IconButton = (props: IconButtonProps) => {
|
|
11
|
-
return <Button px='0' py='0' _icon={{ fontSize: '1.2em' }} {...props} />
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
IconButton.displayName = 'IconButton'
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import { describe, expect, it } from 'vitest'
|
|
3
|
-
|
|
4
|
-
import { Code } from './index'
|
|
5
|
-
|
|
6
|
-
describe('Code', () => {
|
|
7
|
-
it('renders with default props', () => {
|
|
8
|
-
const { getByText } = render(<Code>const x = 42;</Code>)
|
|
9
|
-
const code = getByText('const x = 42;')
|
|
10
|
-
expect(code).toBeInTheDocument()
|
|
11
|
-
expect(code.tagName.toLowerCase()).toBe('code')
|
|
12
|
-
expect(code).toHaveClass('code', 'code--emphasis_default')
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
it('renders with different emphasis', () => {
|
|
16
|
-
const { rerender, getByText } = render(
|
|
17
|
-
<Code emphasis='strong'>strong code</Code>
|
|
18
|
-
)
|
|
19
|
-
let code = getByText('strong code')
|
|
20
|
-
expect(code).toHaveClass('code--emphasis_strong')
|
|
21
|
-
|
|
22
|
-
rerender(<Code emphasis='subtle'>subtle code</Code>)
|
|
23
|
-
code = getByText('subtle code')
|
|
24
|
-
expect(code).toHaveClass('code--emphasis_subtle')
|
|
25
|
-
|
|
26
|
-
rerender(<Code emphasis='subtler'>subtler code</Code>)
|
|
27
|
-
code = getByText('subtler code')
|
|
28
|
-
expect(code).toHaveClass('code--emphasis_subtler')
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('renders with different color palettes', () => {
|
|
32
|
-
const { rerender, getByText } = render(
|
|
33
|
-
<Code colorPalette='accent'>accent code</Code>
|
|
34
|
-
)
|
|
35
|
-
let code = getByText('accent code')
|
|
36
|
-
expect(code).toBeInTheDocument()
|
|
37
|
-
|
|
38
|
-
rerender(<Code colorPalette='success'>success code</Code>)
|
|
39
|
-
code = getByText('success code')
|
|
40
|
-
expect(code).toBeInTheDocument()
|
|
41
|
-
|
|
42
|
-
rerender(<Code colorPalette='danger'>danger code</Code>)
|
|
43
|
-
code = getByText('danger code')
|
|
44
|
-
expect(code).toBeInTheDocument()
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('applies custom font size', () => {
|
|
48
|
-
const { getByText } = render(<Code fontSize='lg'>Large code</Code>)
|
|
49
|
-
const code = getByText('Large code')
|
|
50
|
-
expect(code).toHaveClass('fs_lg')
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
it('inherits Text props', () => {
|
|
54
|
-
const { getByText } = render(<Code color='accent.fg'>Colored code</Code>)
|
|
55
|
-
const code = getByText('Colored code')
|
|
56
|
-
expect(code).toHaveClass('c_accent.fg')
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
it('applies line clamp', () => {
|
|
60
|
-
const { getByText } = render(<Code lineClamp={2}>Clamped code</Code>)
|
|
61
|
-
const code = getByText('Clamped code')
|
|
62
|
-
expect(code).toHaveClass('lc_2')
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it('combines multiple props', () => {
|
|
66
|
-
const { getByText } = render(
|
|
67
|
-
<Code
|
|
68
|
-
emphasis='subtler'
|
|
69
|
-
colorPalette='accent'
|
|
70
|
-
fontSize='lg'
|
|
71
|
-
className='custom-class'
|
|
72
|
-
>
|
|
73
|
-
Combined styles
|
|
74
|
-
</Code>
|
|
75
|
-
)
|
|
76
|
-
const code = getByText('Combined styles')
|
|
77
|
-
expect(code).toHaveClass(
|
|
78
|
-
'code',
|
|
79
|
-
'code--emphasis_subtler',
|
|
80
|
-
'color-palette_accent',
|
|
81
|
-
'fs_lg',
|
|
82
|
-
'custom-class'
|
|
83
|
-
)
|
|
84
|
-
})
|
|
85
|
-
})
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react'
|
|
2
|
-
|
|
3
|
-
import { ark } from '@ark-ui/react/factory'
|
|
4
|
-
|
|
5
|
-
import type { ColorPalette } from '@oztix/roadie-core'
|
|
6
|
-
import { styled } from '@oztix/roadie-core/jsx'
|
|
7
|
-
import type { HTMLStyledProps } from '@oztix/roadie-core/jsx'
|
|
8
|
-
import { type CodeVariantProps, code } from '@oztix/roadie-core/recipes'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A code component that inherits from Text and renders as a code element
|
|
12
|
-
*/
|
|
13
|
-
export interface CodeProps extends HTMLStyledProps<'code'> {
|
|
14
|
-
/**
|
|
15
|
-
* The appearance of the code block
|
|
16
|
-
* @default 'default'
|
|
17
|
-
*/
|
|
18
|
-
emphasis?: CodeVariantProps['emphasis']
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* The color palette to use for the code
|
|
22
|
-
* @default 'neutral'
|
|
23
|
-
*/
|
|
24
|
-
colorPalette?: ColorPalette
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The content to display
|
|
28
|
-
*/
|
|
29
|
-
children?: ReactNode
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const Code = styled(
|
|
33
|
-
ark.code,
|
|
34
|
-
code
|
|
35
|
-
) as React.ForwardRefExoticComponent<CodeProps>
|
|
36
|
-
|
|
37
|
-
Code.displayName = 'Code'
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
import { render } from '@testing-library/react'
|
|
2
|
-
import { describe, expect, it } from 'vitest'
|
|
3
|
-
|
|
4
|
-
import { Container } from './index'
|
|
5
|
-
|
|
6
|
-
describe('Container', () => {
|
|
7
|
-
it('renders with default props', () => {
|
|
8
|
-
const { getByTestId } = render(
|
|
9
|
-
<Container data-testid='container'>Content</Container>
|
|
10
|
-
)
|
|
11
|
-
const container = getByTestId('container')
|
|
12
|
-
expect(container).toBeInTheDocument()
|
|
13
|
-
expect(container.tagName.toLowerCase()).toBe('div')
|
|
14
|
-
expect(container).toHaveClass(
|
|
15
|
-
'd_flex',
|
|
16
|
-
'pos_relative',
|
|
17
|
-
'flex-d_column',
|
|
18
|
-
'flex-wrap_nowrap',
|
|
19
|
-
'ai_stretch',
|
|
20
|
-
'ac_flex-start',
|
|
21
|
-
'jc_flex-start',
|
|
22
|
-
'min-h_0',
|
|
23
|
-
'min-w_0',
|
|
24
|
-
'w_full',
|
|
25
|
-
'mx_auto',
|
|
26
|
-
'max-w_8xl'
|
|
27
|
-
)
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
it('applies responsive padding by default', () => {
|
|
31
|
-
const { getByTestId } = render(
|
|
32
|
-
<Container data-testid='container'>Content</Container>
|
|
33
|
-
)
|
|
34
|
-
const container = getByTestId('container')
|
|
35
|
-
// Should have responsive padding classes
|
|
36
|
-
expect(container.className).toMatch(/px_/)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('renders with contain true by default (constrained width)', () => {
|
|
40
|
-
const { getByTestId } = render(
|
|
41
|
-
<Container data-testid='container'>Constrained Content</Container>
|
|
42
|
-
)
|
|
43
|
-
const container = getByTestId('container')
|
|
44
|
-
expect(container).toHaveClass('max-w_8xl')
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('renders with contain=false (full width)', () => {
|
|
48
|
-
const { getByTestId } = render(
|
|
49
|
-
<Container contain={false} data-testid='container'>
|
|
50
|
-
Full Width Content
|
|
51
|
-
</Container>
|
|
52
|
-
)
|
|
53
|
-
const container = getByTestId('container')
|
|
54
|
-
expect(container).toHaveClass('max-w_full')
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('renders with contain prop explicitly set to true', () => {
|
|
58
|
-
const { getByTestId } = render(
|
|
59
|
-
<Container contain data-testid='container'>
|
|
60
|
-
Constrained Content
|
|
61
|
-
</Container>
|
|
62
|
-
)
|
|
63
|
-
const container = getByTestId('container')
|
|
64
|
-
expect(container).toHaveClass('max-w_8xl')
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
it('renders with different HTML elements', () => {
|
|
68
|
-
const elements: Array<'section' | 'article' | 'aside' | 'main'> = [
|
|
69
|
-
'section',
|
|
70
|
-
'article',
|
|
71
|
-
'aside',
|
|
72
|
-
'main'
|
|
73
|
-
]
|
|
74
|
-
|
|
75
|
-
elements.forEach((element) => {
|
|
76
|
-
const { rerender, getByTestId } = render(
|
|
77
|
-
<Container as={element} data-testid='container'>
|
|
78
|
-
{element} content
|
|
79
|
-
</Container>
|
|
80
|
-
)
|
|
81
|
-
const container = getByTestId('container')
|
|
82
|
-
expect(container.tagName.toLowerCase()).toBe(element)
|
|
83
|
-
expect(container).toHaveClass(
|
|
84
|
-
'd_flex',
|
|
85
|
-
'pos_relative',
|
|
86
|
-
'flex-d_column',
|
|
87
|
-
'flex-wrap_nowrap',
|
|
88
|
-
'ai_stretch',
|
|
89
|
-
'ac_flex-start',
|
|
90
|
-
'jc_flex-start',
|
|
91
|
-
'min-h_0',
|
|
92
|
-
'min-w_0',
|
|
93
|
-
'w_full',
|
|
94
|
-
'mx_auto'
|
|
95
|
-
)
|
|
96
|
-
rerender(<></>)
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
it('applies layout properties', () => {
|
|
101
|
-
const { getByTestId } = render(
|
|
102
|
-
<Container
|
|
103
|
-
data-testid='container'
|
|
104
|
-
display='inline-flex'
|
|
105
|
-
position='absolute'
|
|
106
|
-
flexDirection='row'
|
|
107
|
-
flexWrap='wrap'
|
|
108
|
-
alignItems='center'
|
|
109
|
-
alignContent='center'
|
|
110
|
-
justifyContent='center'
|
|
111
|
-
>
|
|
112
|
-
Styled Container
|
|
113
|
-
</Container>
|
|
114
|
-
)
|
|
115
|
-
const container = getByTestId('container')
|
|
116
|
-
expect(container).toHaveClass(
|
|
117
|
-
'd_inline-flex',
|
|
118
|
-
'pos_absolute',
|
|
119
|
-
'flex-d_row',
|
|
120
|
-
'flex-wrap_wrap',
|
|
121
|
-
'ai_center',
|
|
122
|
-
'ac_center',
|
|
123
|
-
'jc_center',
|
|
124
|
-
'min-h_0',
|
|
125
|
-
'min-w_0'
|
|
126
|
-
)
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
it('applies custom styles and attributes', () => {
|
|
130
|
-
const { getByTestId } = render(
|
|
131
|
-
<Container
|
|
132
|
-
data-testid='container'
|
|
133
|
-
backgroundColor='neutral.bg.subtle'
|
|
134
|
-
padding='200'
|
|
135
|
-
title='tooltip'
|
|
136
|
-
aria-label='Accessible container'
|
|
137
|
-
>
|
|
138
|
-
Custom Container
|
|
139
|
-
</Container>
|
|
140
|
-
)
|
|
141
|
-
const container = getByTestId('container')
|
|
142
|
-
expect(container).toHaveClass('bg-c_neutral.bg.subtle', 'p_200')
|
|
143
|
-
expect(container).toHaveAttribute('title', 'tooltip')
|
|
144
|
-
expect(container).toHaveAttribute('aria-label', 'Accessible container')
|
|
145
|
-
})
|
|
146
|
-
|
|
147
|
-
it('renders nested containers', () => {
|
|
148
|
-
const { getByTestId } = render(
|
|
149
|
-
<Container data-testid='parent'>
|
|
150
|
-
<Container data-testid='child'>Nested Content</Container>
|
|
151
|
-
</Container>
|
|
152
|
-
)
|
|
153
|
-
const parent = getByTestId('parent')
|
|
154
|
-
const child = getByTestId('child')
|
|
155
|
-
expect(parent).toContainElement(child)
|
|
156
|
-
expect(child).toHaveTextContent('Nested Content')
|
|
157
|
-
expect(parent).toHaveClass(
|
|
158
|
-
'd_flex',
|
|
159
|
-
'pos_relative',
|
|
160
|
-
'flex-d_column',
|
|
161
|
-
'flex-wrap_nowrap',
|
|
162
|
-
'ai_stretch',
|
|
163
|
-
'ac_flex-start',
|
|
164
|
-
'jc_flex-start',
|
|
165
|
-
'min-h_0',
|
|
166
|
-
'min-w_0',
|
|
167
|
-
'w_full',
|
|
168
|
-
'mx_auto'
|
|
169
|
-
)
|
|
170
|
-
expect(child).toHaveClass(
|
|
171
|
-
'd_flex',
|
|
172
|
-
'pos_relative',
|
|
173
|
-
'flex-d_column',
|
|
174
|
-
'flex-wrap_nowrap',
|
|
175
|
-
'ai_stretch',
|
|
176
|
-
'ac_flex-start',
|
|
177
|
-
'jc_flex-start',
|
|
178
|
-
'min-h_0',
|
|
179
|
-
'min-w_0',
|
|
180
|
-
'w_full',
|
|
181
|
-
'mx_auto'
|
|
182
|
-
)
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
it('combines multiple props including contain', () => {
|
|
186
|
-
const { getByTestId } = render(
|
|
187
|
-
<Container
|
|
188
|
-
as='section'
|
|
189
|
-
contain
|
|
190
|
-
display='grid'
|
|
191
|
-
gap='200'
|
|
192
|
-
padding='400'
|
|
193
|
-
backgroundColor='neutral.bg.subtle'
|
|
194
|
-
className='custom-class'
|
|
195
|
-
data-testid='container'
|
|
196
|
-
>
|
|
197
|
-
Combined styles
|
|
198
|
-
</Container>
|
|
199
|
-
)
|
|
200
|
-
const container = getByTestId('container')
|
|
201
|
-
expect(container.tagName.toLowerCase()).toBe('section')
|
|
202
|
-
expect(container).toHaveClass(
|
|
203
|
-
'd_grid',
|
|
204
|
-
'gap_200',
|
|
205
|
-
'p_400',
|
|
206
|
-
'bg-c_neutral.bg.subtle',
|
|
207
|
-
'max-w_8xl',
|
|
208
|
-
'custom-class'
|
|
209
|
-
)
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
it('can override default padding', () => {
|
|
213
|
-
const { getByTestId } = render(
|
|
214
|
-
<Container data-testid='container' px='800'>
|
|
215
|
-
Custom Padding
|
|
216
|
-
</Container>
|
|
217
|
-
)
|
|
218
|
-
const container = getByTestId('container')
|
|
219
|
-
expect(container).toHaveClass('px_800')
|
|
220
|
-
})
|
|
221
|
-
|
|
222
|
-
it('can override default width', () => {
|
|
223
|
-
const { getByTestId } = render(
|
|
224
|
-
<Container data-testid='container' width='auto'>
|
|
225
|
-
Custom Width
|
|
226
|
-
</Container>
|
|
227
|
-
)
|
|
228
|
-
const container = getByTestId('container')
|
|
229
|
-
expect(container).toHaveClass('w_auto')
|
|
230
|
-
})
|
|
231
|
-
|
|
232
|
-
it('can set contain=false for full width', () => {
|
|
233
|
-
const { getByTestId } = render(
|
|
234
|
-
<Container contain={false} data-testid='container'>
|
|
235
|
-
Full Width
|
|
236
|
-
</Container>
|
|
237
|
-
)
|
|
238
|
-
const container = getByTestId('container')
|
|
239
|
-
expect(container).toHaveClass('max-w_full')
|
|
240
|
-
})
|
|
241
|
-
})
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Container as ContainerPattern } from '@oztix/roadie-core/jsx'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* A foundational layout component that provides a centered container with responsive padding
|
|
5
|
-
* and a constrained max-width by default. Perfect for page layouts and content sections.
|
|
6
|
-
*
|
|
7
|
-
* By default, Container has:
|
|
8
|
-
* - Centered content with `mx: auto`
|
|
9
|
-
* - Responsive horizontal padding (300 on mobile, 400 on tablet, 600 on desktop)
|
|
10
|
-
* - Max-width constraint of 7xl (80rem)
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```tsx
|
|
14
|
-
* // Basic usage - constrained width by default
|
|
15
|
-
* <Container>
|
|
16
|
-
* <h1>Page Title</h1>
|
|
17
|
-
* <p>Content with readable max-width</p>
|
|
18
|
-
* </Container>
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* // Full-width container
|
|
24
|
-
* <Container contain={false}>
|
|
25
|
-
* <h1>Hero Section</h1>
|
|
26
|
-
* <p>This content spans the full width</p>
|
|
27
|
-
* </Container>
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export const Container = ContainerPattern
|
|
31
|
-
|
|
32
|
-
export type ContainerProps = React.ComponentProps<typeof ContainerPattern>
|
|
33
|
-
|
|
34
|
-
Container.displayName = 'Container'
|