@utilitywarehouse/hearth-react 0.28.6 → 0.29.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/README.md +34 -20
- package/SKILL.md +355 -0
- package/dist/{chunk-O7RBVBMN.cjs → chunk-LWHIBSW2.cjs} +2 -2
- package/dist/{chunk-O7RBVBMN.cjs.map → chunk-LWHIBSW2.cjs.map} +1 -1
- package/dist/{chunk-JRVYOIXR.js → chunk-MIVYZGEV.js} +2 -2
- package/dist/components/CardAccordion/CardAccordion.context.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.cjs +1 -1
- package/dist/components/Combobox/Combobox.js +1 -1
- package/dist/components/ExpandableCard/ExpandableCard.cjs +1 -1
- package/dist/components/ExpandableCard/ExpandableCard.js +1 -1
- package/dist/helpers/get-classname-styles.d.ts.map +1 -1
- package/dist/helpers/logger.d.ts.map +1 -1
- package/dist/helpers/merge-ids.d.ts.map +1 -1
- package/dist/hooks/use-ids.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +18 -12
- package/public/llms/components/accordion.md +321 -0
- package/public/llms/components/alert.md +217 -0
- package/public/llms/components/avatar.md +112 -0
- package/public/llms/components/badge.md +158 -0
- package/public/llms/components/body-text.md +200 -0
- package/public/llms/components/box.md +148 -0
- package/public/llms/components/breadcrumbs.md +97 -0
- package/public/llms/components/button.md +595 -0
- package/public/llms/components/card-accordion.md +277 -0
- package/public/llms/components/card.md +985 -0
- package/public/llms/components/checkbox-group.md +193 -0
- package/public/llms/components/checkbox-tile.md +116 -0
- package/public/llms/components/checkbox.md +108 -0
- package/public/llms/components/combobox.md +360 -0
- package/public/llms/components/container.md +162 -0
- package/public/llms/components/currency-input.md +85 -0
- package/public/llms/components/date-input.md +90 -0
- package/public/llms/components/date-picker.md +159 -0
- package/public/llms/components/description-list.md +149 -0
- package/public/llms/components/detail-text.md +89 -0
- package/public/llms/components/divider.md +88 -0
- package/public/llms/components/em.md +43 -0
- package/public/llms/components/expandable-card.md +231 -0
- package/public/llms/components/flex.md +197 -0
- package/public/llms/components/grid.md +244 -0
- package/public/llms/components/heading.md +65 -0
- package/public/llms/components/helper-text.md +27 -0
- package/public/llms/components/highlight-banner.md +94 -0
- package/public/llms/components/icon-button.md +516 -0
- package/public/llms/components/icon-container.md +247 -0
- package/public/llms/components/inline-link.md +190 -0
- package/public/llms/components/label.md +28 -0
- package/public/llms/components/link.md +236 -0
- package/public/llms/components/list.md +715 -0
- package/public/llms/components/menu.md +270 -0
- package/public/llms/components/modal.md +328 -0
- package/public/llms/components/pagination.md +138 -0
- package/public/llms/components/password-input.md +93 -0
- package/public/llms/components/progress-bar.md +139 -0
- package/public/llms/components/progress-stepper.md +147 -0
- package/public/llms/components/radio-group.md +487 -0
- package/public/llms/components/search-input.md +132 -0
- package/public/llms/components/section-header.md +82 -0
- package/public/llms/components/select.md +148 -0
- package/public/llms/components/skeleton.md +282 -0
- package/public/llms/components/spinner.md +59 -0
- package/public/llms/components/strong.md +49 -0
- package/public/llms/components/switch.md +106 -0
- package/public/llms/components/table.md +230 -0
- package/public/llms/components/tabs.md +320 -0
- package/public/llms/components/text-area.md +141 -0
- package/public/llms/components/text-input.md +228 -0
- package/public/llms/components/toast.md +323 -0
- package/public/llms/components/toggle-button-card.md +513 -0
- package/public/llms/components/tooltip.md +188 -0
- package/public/llms/components/unstyled-icon-button.md +175 -0
- package/public/llms/components/validation-text.md +29 -0
- package/public/llms/components/verification-input.md +96 -0
- package/public/llms/docs/changelog.md +1430 -0
- package/public/llms/docs/common-props/align-self.md +90 -0
- package/public/llms/docs/common-props/border.md +308 -0
- package/public/llms/docs/common-props/colour.md +221 -0
- package/public/llms/docs/common-props/flex-items.md +91 -0
- package/public/llms/docs/common-props/gap.md +111 -0
- package/public/llms/docs/common-props/grid-items.md +96 -0
- package/public/llms/docs/common-props/margin.md +105 -0
- package/public/llms/docs/common-props/opacity.md +100 -0
- package/public/llms/docs/common-props/order.md +90 -0
- package/public/llms/docs/common-props/overflow.md +89 -0
- package/public/llms/docs/common-props/padding.md +102 -0
- package/public/llms/docs/common-props/position.md +92 -0
- package/public/llms/docs/common-props/size.md +93 -0
- package/public/llms/docs/common-props/spacing.md +97 -0
- package/public/llms/docs/common-props/text.md +35 -0
- package/public/llms/docs/common-props/z-index.md +88 -0
- package/public/llms/docs/design-tokens.md +72 -0
- package/public/llms/docs/getting-started.md +117 -0
- package/public/llms/docs/layout.md +135 -0
- package/public/llms/docs/migrating.md +302 -0
- package/public/llms/docs/responsive-design/breakpoints.md +119 -0
- package/public/llms/docs/responsive-design/media-queries.md +89 -0
- package/public/llms/docs/responsive-design/responsive-props.md +37 -0
- package/public/llms.txt +97 -0
- package/scripts/init-ai.js +142 -0
- package/styles.css +2 -2
- /package/dist/{chunk-JRVYOIXR.js.map → chunk-MIVYZGEV.js.map} +0 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# IconContainer
|
|
2
|
+
|
|
3
|
+
Use the `IconContainer` when using icons that sit within a coloured container.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
<Flex direction="column" gap="500">
|
|
7
|
+
{sizes.map(size => (
|
|
8
|
+
<Flex key={size} direction="column" gap="200" alignItems="start">
|
|
9
|
+
{variants.map(variant => (
|
|
10
|
+
<Flex key={variant} gap="200" justifyContent="center" direction="row">
|
|
11
|
+
{otherColorSchemes.map(colorScheme => (
|
|
12
|
+
<IconContainer
|
|
13
|
+
key={`${size}${variant}${colorScheme}`}
|
|
14
|
+
variant={variant}
|
|
15
|
+
colorScheme={colorScheme}
|
|
16
|
+
size={size}
|
|
17
|
+
>
|
|
18
|
+
{size === 'sm' ? <PlaceholderSmallIcon /> : <PlaceholderMediumIcon />}
|
|
19
|
+
</IconContainer>
|
|
20
|
+
))}
|
|
21
|
+
{variant === 'subtle'
|
|
22
|
+
? subtleOnlyColorSchemes.map(colorScheme => (
|
|
23
|
+
<IconContainer
|
|
24
|
+
key={`${size}${variant}${colorScheme}`}
|
|
25
|
+
variant={variant}
|
|
26
|
+
colorScheme={colorScheme}
|
|
27
|
+
size={size}
|
|
28
|
+
>
|
|
29
|
+
{size === 'sm' ? <PlaceholderSmallIcon /> : <PlaceholderMediumIcon />}
|
|
30
|
+
</IconContainer>
|
|
31
|
+
))
|
|
32
|
+
: null}
|
|
33
|
+
</Flex>
|
|
34
|
+
))}
|
|
35
|
+
</Flex>
|
|
36
|
+
))}
|
|
37
|
+
</Flex>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<IconContainer {...args}>
|
|
42
|
+
{args.size === 'sm' ? <PlaceholderSmallIcon /> : <PlaceholderMediumIcon />}
|
|
43
|
+
</IconContainer>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
- [Icons](#icons)
|
|
47
|
+
- [Variants](#variants)
|
|
48
|
+
- [Sizes](#sizes)
|
|
49
|
+
- [Color schemes](#color-schemes)
|
|
50
|
+
- [Dead prop combinations](#dead-prop-combinations)
|
|
51
|
+
- [Radius none](#radius-none)
|
|
52
|
+
- [Fill](#fill)
|
|
53
|
+
- [API](#api)
|
|
54
|
+
|
|
55
|
+
## Icons
|
|
56
|
+
|
|
57
|
+
The `IconContainer` component is intended to be used with the `@utilitywarehouse/hearth-react-icons` package.
|
|
58
|
+
|
|
59
|
+
## Variants
|
|
60
|
+
|
|
61
|
+
The variant prop controls the visual appearance of the Icon container.
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
<Flex gap="200">
|
|
65
|
+
{variants.map(variant => (
|
|
66
|
+
<IconContainer key={variant} variant={variant}>
|
|
67
|
+
<PlaceholderMediumIcon />
|
|
68
|
+
</IconContainer>
|
|
69
|
+
))}
|
|
70
|
+
</Flex>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Sizes
|
|
74
|
+
|
|
75
|
+
The size prop controls the size of the Icon container. This prop is responsive.
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
<Flex gap="200">
|
|
79
|
+
{sizes.map(size => (
|
|
80
|
+
<IconContainer key={size} size={size}>
|
|
81
|
+
{size === 'sm' ? <PlaceholderSmallIcon /> : <PlaceholderMediumIcon />}
|
|
82
|
+
</IconContainer>
|
|
83
|
+
))}
|
|
84
|
+
</Flex>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If you need to render different sized icons in conjunction with the responsive
|
|
88
|
+
size prop, there are a couple of ways you can do this.
|
|
89
|
+
|
|
90
|
+
1. Using JS, with the `useMediaQuery` hook.
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
import { AddMediumIcon, AddSmallIcon } from '@utilitywarehouse/hearth-react-icons';
|
|
94
|
+
import { IconContainer, useMediaQuery, media } from '@utilitywarehouse/hearth-react';
|
|
95
|
+
|
|
96
|
+
const MyComponent = () => {
|
|
97
|
+
const showSmallIcon = useMediaQuery(media.below('tablet'));
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<IconContainer size={{ mobile: 'sm', tablet: 'md', desktop: 'lg' }}>
|
|
101
|
+
{showSmallIcon ? <AddSmallIcon /> : <AddMediumIcon />}
|
|
102
|
+
</IconContainer>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
2. Using CSS, with `Box` and style props.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
import { AddMediumIcon, AddSmallIcon } from '@utilitywarehouse/hearth-react-icons';
|
|
111
|
+
import { IconContainer, Box } from '@utilitywarehouse/hearth-react';
|
|
112
|
+
|
|
113
|
+
const MyComponent = () => (
|
|
114
|
+
<IconContainer size={{ mobile: 'sm', desktop: 'md' }}>
|
|
115
|
+
<Box asChild display={{ mobile: 'none', desktop: 'block' }}>
|
|
116
|
+
<AddMediumIcon />
|
|
117
|
+
</Box>
|
|
118
|
+
<Box asChild display={{ desktop: 'none' }}>
|
|
119
|
+
<AddSmallIcon />
|
|
120
|
+
</Box>
|
|
121
|
+
</IconContainer>
|
|
122
|
+
);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Color schemes
|
|
126
|
+
|
|
127
|
+
The `colorScheme` prop will change the Icon container colours.
|
|
128
|
+
|
|
129
|
+
```tsx
|
|
130
|
+
<Flex gap="200">
|
|
131
|
+
{colorSchemes.map(colorScheme => (
|
|
132
|
+
<IconContainer key={colorScheme} colorScheme={colorScheme}>
|
|
133
|
+
<PlaceholderMediumIcon />
|
|
134
|
+
</IconContainer>
|
|
135
|
+
))}
|
|
136
|
+
</Flex>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Dead prop combinations
|
|
140
|
+
|
|
141
|
+
Be aware there are some combinations of `colorScheme` & `variant` that do not work together (ie. `emphasis` &
|
|
142
|
+
`highlight`), and if used will render an icon container with no colours at all. You will also see a TypeScript error.
|
|
143
|
+
|
|
144
|
+
## Radius none
|
|
145
|
+
|
|
146
|
+
Use the border radius common props to remove the default `border-radius`, for
|
|
147
|
+
use when the icon container needs to sit flush against the edge of a card.
|
|
148
|
+
|
|
149
|
+
```tsx
|
|
150
|
+
<Flex direction="column" gap="500">
|
|
151
|
+
{sizes.map(size => (
|
|
152
|
+
<Flex key={size} direction="column" gap="200" alignItems="start">
|
|
153
|
+
{variants.map(variant => (
|
|
154
|
+
<Flex key={variant} gap="200" justifyContent="center" direction="row">
|
|
155
|
+
{otherColorSchemes.map(colorScheme => (
|
|
156
|
+
<IconContainer
|
|
157
|
+
key={`${size}${variant}${colorScheme}`}
|
|
158
|
+
variant={variant}
|
|
159
|
+
colorScheme={colorScheme}
|
|
160
|
+
size={size}
|
|
161
|
+
borderRadius="none"
|
|
162
|
+
>
|
|
163
|
+
{size === 'sm' ? <PlaceholderSmallIcon /> : <PlaceholderMediumIcon />}
|
|
164
|
+
</IconContainer>
|
|
165
|
+
))}
|
|
166
|
+
{variant === 'subtle'
|
|
167
|
+
? subtleOnlyColorSchemes.map(colorScheme => (
|
|
168
|
+
<IconContainer
|
|
169
|
+
key={`${size}${variant}${colorScheme}`}
|
|
170
|
+
variant={variant}
|
|
171
|
+
colorScheme={colorScheme}
|
|
172
|
+
size={size}
|
|
173
|
+
borderRadius="none"
|
|
174
|
+
>
|
|
175
|
+
{size === 'sm' ? <PlaceholderSmallIcon /> : <PlaceholderMediumIcon />}
|
|
176
|
+
</IconContainer>
|
|
177
|
+
))
|
|
178
|
+
: null}
|
|
179
|
+
</Flex>
|
|
180
|
+
))}
|
|
181
|
+
</Flex>
|
|
182
|
+
))}
|
|
183
|
+
</Flex>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Fill
|
|
187
|
+
|
|
188
|
+
The `fill` prop will remove the `border-radius` and set the size to fill it's
|
|
189
|
+
container. You can also use this in conjuntion with the Border Radius common
|
|
190
|
+
props to inherit the container border-radius as needed.
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
<Flex direction="row" gap="200">
|
|
194
|
+
<Card width="200px" height="200px" paddingNone>
|
|
195
|
+
<IconContainer fill="both" borderRadius="inherit">
|
|
196
|
+
<PlaceholderSmallIcon />
|
|
197
|
+
</IconContainer>
|
|
198
|
+
</Card>
|
|
199
|
+
<Card width="200px" height="200px" paddingNone>
|
|
200
|
+
<IconContainer
|
|
201
|
+
fill="height"
|
|
202
|
+
borderRadius="none"
|
|
203
|
+
borderTopLeftRadius="inherit"
|
|
204
|
+
borderBottomLeftRadius="inherit"
|
|
205
|
+
>
|
|
206
|
+
<PlaceholderSmallIcon />
|
|
207
|
+
</IconContainer>
|
|
208
|
+
</Card>
|
|
209
|
+
<Card width="200px" height="200px" paddingNone>
|
|
210
|
+
<IconContainer
|
|
211
|
+
fill="width"
|
|
212
|
+
borderRadius="none"
|
|
213
|
+
borderTopLeftRadius="inherit"
|
|
214
|
+
borderTopRightRadius="inherit"
|
|
215
|
+
>
|
|
216
|
+
<PlaceholderSmallIcon />
|
|
217
|
+
</IconContainer>
|
|
218
|
+
</Card>
|
|
219
|
+
</Flex>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## API
|
|
223
|
+
|
|
224
|
+
This component is based on the `span` element and supports the following common props:
|
|
225
|
+
|
|
226
|
+
- Margin
|
|
227
|
+
- Border Radius
|
|
228
|
+
- Size
|
|
229
|
+
|
|
230
|
+
| Prop | Type | Default | Description |
|
|
231
|
+
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------- |
|
|
232
|
+
| `size` | `Responsive<"sm" \| "md" \| "lg">` | `md` | Sets the container size. |
|
|
233
|
+
| `variant` | `"emphasis" \| "subtle"` | `subtle` | Sets the container's visual variant |
|
|
234
|
+
| `colorScheme` | `"mobile" \| "energy" \| "broadband" \| "insurance" \| "cashback" \| "pig" \| "highlight"` | `pig` | Sets the colour scheme. |
|
|
235
|
+
| `fill` | `"height" \| "width" \| "both"` | — | Fill the container height, width or both, rather than having a constrained size |
|
|
236
|
+
| `borderRadius` | `Responsive<"none" \| "inherit">` | — | |
|
|
237
|
+
| `borderTopLeftRadius` | `Responsive<"none" \| "inherit">` | — | |
|
|
238
|
+
| `borderTopRightRadius` | `Responsive<"none" \| "inherit">` | — | |
|
|
239
|
+
| `borderBottomRightRadius` | `Responsive<"none" \| "inherit">` | — | |
|
|
240
|
+
| `borderBottomLeftRadius` | `Responsive<"none" \| "inherit">` | — | |
|
|
241
|
+
| `margin` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
242
|
+
| `marginTop` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
243
|
+
| `marginRight` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
244
|
+
| `marginBottom` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
245
|
+
| `marginLeft` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
246
|
+
| `marginX` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
247
|
+
| `marginY` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# InlineLink
|
|
2
|
+
|
|
3
|
+
- [Alternatives](#alternatives)
|
|
4
|
+
- [Semantic HTML](#semantic-html)
|
|
5
|
+
- [Colour](#colour)
|
|
6
|
+
- [Open in new tab](#open-in-new-tab)
|
|
7
|
+
- [Usage with Next.js](#usage-with-next.js)
|
|
8
|
+
- [API](#api)
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
<Flex
|
|
12
|
+
direction="column"
|
|
13
|
+
gap="400"
|
|
14
|
+
width="500px"
|
|
15
|
+
padding="400"
|
|
16
|
+
backgroundColor="primary"
|
|
17
|
+
alignItems="center"
|
|
18
|
+
justifyContent="center"
|
|
19
|
+
>
|
|
20
|
+
<BodyText>
|
|
21
|
+
<InlineLink {...args} />
|
|
22
|
+
</BodyText>
|
|
23
|
+
<BodyText>
|
|
24
|
+
Agnes Martin was an American <InlineLink>abstract painter</InlineLink> known for her{' '}
|
|
25
|
+
<InlineLink>minimalist</InlineLink> style. Martin's art was characterized by serene
|
|
26
|
+
compositions featuring <InlineLink>grids and lines</InlineLink>. Martin's minimalist
|
|
27
|
+
approach conveyed tranquility and <InlineLink>spirituality</InlineLink>, and her paintings often
|
|
28
|
+
carried positive names reflective of her <InlineLink>philosophy</InlineLink>.
|
|
29
|
+
</BodyText>
|
|
30
|
+
</Flex>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Alternatives
|
|
34
|
+
|
|
35
|
+
- Link - For standalone links
|
|
36
|
+
|
|
37
|
+
## Semantic HTML
|
|
38
|
+
|
|
39
|
+
> If it goes somewhere it's a link, if it does something it's a button.
|
|
40
|
+
|
|
41
|
+
A semantic HTML `a` is rendered by default.
|
|
42
|
+
|
|
43
|
+
## Colour
|
|
44
|
+
|
|
45
|
+
You can override the default link colours, setting `color` to `"inverted"` when
|
|
46
|
+
used on brand backgrounds, or to `"inherit"` when the link colours need to
|
|
47
|
+
match the parent text colour.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
<Flex
|
|
51
|
+
direction="column"
|
|
52
|
+
gap="600"
|
|
53
|
+
width="500px"
|
|
54
|
+
backgroundColor="primary"
|
|
55
|
+
alignItems="center"
|
|
56
|
+
justifyContent="center"
|
|
57
|
+
>
|
|
58
|
+
<Flex direction="column" gap="400" backgroundColor="brand" padding="400">
|
|
59
|
+
<BodyText>
|
|
60
|
+
<InlineLink {...args} color="inverted">
|
|
61
|
+
Inverted color
|
|
62
|
+
</InlineLink>
|
|
63
|
+
</BodyText>
|
|
64
|
+
<BodyText color="inverted">
|
|
65
|
+
Agnes Martin was an American <InlineLink color="inverted">abstract painter</InlineLink> known
|
|
66
|
+
for her <InlineLink color="inverted">minimalist</InlineLink> style. Martin's art was
|
|
67
|
+
characterized by serene compositions featuring{' '}
|
|
68
|
+
<InlineLink color="inverted">grids and lines</InlineLink>. Martin's minimalist approach
|
|
69
|
+
conveyed tranquility and <InlineLink color="inverted">spirituality</InlineLink>, and her
|
|
70
|
+
paintings often carried positive names reflective of her{' '}
|
|
71
|
+
<InlineLink color="inverted">philosophy</InlineLink>.
|
|
72
|
+
</BodyText>
|
|
73
|
+
</Flex>
|
|
74
|
+
<Flex direction="column" gap="400" backgroundColor="secondary" padding="400">
|
|
75
|
+
<BodyText color="primary">
|
|
76
|
+
<InlineLink {...args} color="inherit">
|
|
77
|
+
Inherited color
|
|
78
|
+
</InlineLink>
|
|
79
|
+
</BodyText>
|
|
80
|
+
<BodyText color="brand">
|
|
81
|
+
Agnes Martin was an American <InlineLink color="inherit">abstract painter</InlineLink> known
|
|
82
|
+
for her <InlineLink color="inherit">minimalist</InlineLink> style. Martin's art was
|
|
83
|
+
characterized by serene compositions featuring{' '}
|
|
84
|
+
<InlineLink color="inherit">grids and lines</InlineLink>. Martin's minimalist approach
|
|
85
|
+
conveyed tranquility and <InlineLink color="inherit">spirituality</InlineLink>, and her
|
|
86
|
+
paintings often carried positive names reflective of her{' '}
|
|
87
|
+
<InlineLink color="inherit">philosophy</InlineLink>.
|
|
88
|
+
</BodyText>
|
|
89
|
+
</Flex>
|
|
90
|
+
</Flex>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Open in new tab
|
|
94
|
+
|
|
95
|
+
Avoid using `target=_blank` ([When to use target="\_blank"](https://css-tricks.com/use-target_blank/)).
|
|
96
|
+
|
|
97
|
+
If you do use it, be aware that [browsers now implicitly set rel=noopener for any "target=\_blank" link](https://mathiasbynens.github.io/rel-noopener/).
|
|
98
|
+
|
|
99
|
+
An icon will also be added to indicate that the link opens in a new tab or
|
|
100
|
+
window, improving accessibility. You can override this behaviour by setting the
|
|
101
|
+
`hideOpenIcon` prop.
|
|
102
|
+
|
|
103
|
+
```tsx
|
|
104
|
+
<Flex gap="600">
|
|
105
|
+
<InlineLink {...args}>Visit help pages</InlineLink>
|
|
106
|
+
<InlineLink {...args} hideOpenIcon>
|
|
107
|
+
Go to help
|
|
108
|
+
</InlineLink>
|
|
109
|
+
</Flex>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Next.js v13
|
|
113
|
+
|
|
114
|
+
The Next.js `Link` component behaviour has changed in v13, so that an `<a>` is
|
|
115
|
+
no longer required as a child. You can render the Web UI `InlineLink` component as a
|
|
116
|
+
Next.js `Link` component using `asChild`:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import NextLink from 'next/link';
|
|
120
|
+
import { InlineLink } from '@utilitywarehouse/hearth-react';
|
|
121
|
+
|
|
122
|
+
[...]
|
|
123
|
+
|
|
124
|
+
{/* // eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
125
|
+
<InlineLink asChild>
|
|
126
|
+
<NextLink href={href} onClick={onClick}>
|
|
127
|
+
{title}
|
|
128
|
+
</NextLink>
|
|
129
|
+
</InlineLink>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
You can also use the `legacyBehavior` prop directly on the Next.js Link component:
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
import NextLink from 'next/link';
|
|
136
|
+
import { InlineLink } from '@utilitywarehouse/hearth-react';
|
|
137
|
+
|
|
138
|
+
[...]
|
|
139
|
+
|
|
140
|
+
<NextLink href={href} passHref onClick={onClick} legacyBehavior>
|
|
141
|
+
{/* // eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
142
|
+
<InlineLink>{title}</InlineLink>
|
|
143
|
+
</NextLink>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
And if you want to set this behavior globally you can use the following Next.js
|
|
147
|
+
configuration:
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
{
|
|
151
|
+
experimental: {
|
|
152
|
+
newNextLinkBehavior: false
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Next.js before v13
|
|
158
|
+
|
|
159
|
+
```tsx
|
|
160
|
+
import NextLink from 'next/link';
|
|
161
|
+
import { InlineLink } from '@utilitywarehouse/hearth-react';
|
|
162
|
+
|
|
163
|
+
[...]
|
|
164
|
+
|
|
165
|
+
<NextLink href={href} passHref onClick={onClick}>
|
|
166
|
+
{/* // eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
167
|
+
<TextLink>{title}</TextLink>
|
|
168
|
+
</NextLink>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## API
|
|
172
|
+
|
|
173
|
+
This component is based on the `a` element and supports the following common props:
|
|
174
|
+
|
|
175
|
+
- Margin
|
|
176
|
+
- Text transform
|
|
177
|
+
|
|
178
|
+
| Prop | Type | Default | Description |
|
|
179
|
+
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
180
|
+
| `color` | `"default" \| "inverted" \| "inherit"` | — | Sets the color scheme for the InlineLink. - 'default': Uses the standard link color. - 'inverted': Uses a color suitable for dark backgrounds. Use when placing the link on a dark or colored background for better contrast. - 'inherit': Inherits the color from its parent element. Use to match the surrounding text color. |
|
|
181
|
+
| `asChild` | `boolean` | — | Change the default rendered element for the one passed as a child, merging their props and behavior. |
|
|
182
|
+
| `hideOpenIcon` | `boolean` | — | Hides the "open in new tab" icon when `target="_blank"` is set. |
|
|
183
|
+
| `margin` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
184
|
+
| `marginTop` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
185
|
+
| `marginRight` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
186
|
+
| `marginBottom` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
187
|
+
| `marginLeft` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
188
|
+
| `marginX` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
189
|
+
| `marginY` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
190
|
+
| `textTransform` | `"none" \| "uppercase" \| "lowercase" \| "capitalize"` | — | Set the text-transform on the component. |
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Label
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
<Label marginTop="300">Label</Label>
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
## API
|
|
8
|
+
|
|
9
|
+
This component is based on the `label` element, and supports the following common props:
|
|
10
|
+
|
|
11
|
+
- Margin
|
|
12
|
+
- Text transform
|
|
13
|
+
|
|
14
|
+
| Prop | Type | Default | Description |
|
|
15
|
+
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
16
|
+
| `as` | `"label" \| "span"` | `label` | Shorthand for changing the default rendered element into a semantically appropriate alternative. Cannot be used in combination with `asChild`. |
|
|
17
|
+
| `variant` | `"body" \| "heading"` | — | |
|
|
18
|
+
| `fontWeight` | `"regular" \| "semibold"` | — | |
|
|
19
|
+
| `disabled` | `boolean` | — | Set the label appearance to disabled |
|
|
20
|
+
| `disableUserSelect` | `boolean` | — | Make the text unselectable, for use when associated with input elements. |
|
|
21
|
+
| `margin` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
22
|
+
| `marginTop` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
23
|
+
| `marginRight` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
24
|
+
| `marginBottom` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
25
|
+
| `marginLeft` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
26
|
+
| `marginX` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
27
|
+
| `marginY` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
|
|
28
|
+
| `textTransform` | `"none" \| "uppercase" \| "lowercase" \| "capitalize"` | — | Set the text-transform on the component. |
|