@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.
Files changed (104) hide show
  1. package/README.md +34 -20
  2. package/SKILL.md +355 -0
  3. package/dist/{chunk-O7RBVBMN.cjs → chunk-LWHIBSW2.cjs} +2 -2
  4. package/dist/{chunk-O7RBVBMN.cjs.map → chunk-LWHIBSW2.cjs.map} +1 -1
  5. package/dist/{chunk-JRVYOIXR.js → chunk-MIVYZGEV.js} +2 -2
  6. package/dist/components/CardAccordion/CardAccordion.context.d.ts.map +1 -1
  7. package/dist/components/Combobox/Combobox.cjs +1 -1
  8. package/dist/components/Combobox/Combobox.js +1 -1
  9. package/dist/components/ExpandableCard/ExpandableCard.cjs +1 -1
  10. package/dist/components/ExpandableCard/ExpandableCard.js +1 -1
  11. package/dist/helpers/get-classname-styles.d.ts.map +1 -1
  12. package/dist/helpers/logger.d.ts.map +1 -1
  13. package/dist/helpers/merge-ids.d.ts.map +1 -1
  14. package/dist/hooks/use-ids.d.ts.map +1 -1
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.js +1 -1
  18. package/package.json +18 -12
  19. package/public/llms/components/accordion.md +321 -0
  20. package/public/llms/components/alert.md +217 -0
  21. package/public/llms/components/avatar.md +112 -0
  22. package/public/llms/components/badge.md +158 -0
  23. package/public/llms/components/body-text.md +200 -0
  24. package/public/llms/components/box.md +148 -0
  25. package/public/llms/components/breadcrumbs.md +97 -0
  26. package/public/llms/components/button.md +595 -0
  27. package/public/llms/components/card-accordion.md +277 -0
  28. package/public/llms/components/card.md +985 -0
  29. package/public/llms/components/checkbox-group.md +193 -0
  30. package/public/llms/components/checkbox-tile.md +116 -0
  31. package/public/llms/components/checkbox.md +108 -0
  32. package/public/llms/components/combobox.md +360 -0
  33. package/public/llms/components/container.md +162 -0
  34. package/public/llms/components/currency-input.md +85 -0
  35. package/public/llms/components/date-input.md +90 -0
  36. package/public/llms/components/date-picker.md +159 -0
  37. package/public/llms/components/description-list.md +149 -0
  38. package/public/llms/components/detail-text.md +89 -0
  39. package/public/llms/components/divider.md +88 -0
  40. package/public/llms/components/em.md +43 -0
  41. package/public/llms/components/expandable-card.md +231 -0
  42. package/public/llms/components/flex.md +197 -0
  43. package/public/llms/components/grid.md +244 -0
  44. package/public/llms/components/heading.md +65 -0
  45. package/public/llms/components/helper-text.md +27 -0
  46. package/public/llms/components/highlight-banner.md +94 -0
  47. package/public/llms/components/icon-button.md +516 -0
  48. package/public/llms/components/icon-container.md +247 -0
  49. package/public/llms/components/inline-link.md +190 -0
  50. package/public/llms/components/label.md +28 -0
  51. package/public/llms/components/link.md +236 -0
  52. package/public/llms/components/list.md +715 -0
  53. package/public/llms/components/menu.md +270 -0
  54. package/public/llms/components/modal.md +328 -0
  55. package/public/llms/components/pagination.md +138 -0
  56. package/public/llms/components/password-input.md +93 -0
  57. package/public/llms/components/progress-bar.md +139 -0
  58. package/public/llms/components/progress-stepper.md +147 -0
  59. package/public/llms/components/radio-group.md +487 -0
  60. package/public/llms/components/search-input.md +132 -0
  61. package/public/llms/components/section-header.md +82 -0
  62. package/public/llms/components/select.md +148 -0
  63. package/public/llms/components/skeleton.md +282 -0
  64. package/public/llms/components/spinner.md +59 -0
  65. package/public/llms/components/strong.md +49 -0
  66. package/public/llms/components/switch.md +106 -0
  67. package/public/llms/components/table.md +230 -0
  68. package/public/llms/components/tabs.md +320 -0
  69. package/public/llms/components/text-area.md +141 -0
  70. package/public/llms/components/text-input.md +228 -0
  71. package/public/llms/components/toast.md +323 -0
  72. package/public/llms/components/toggle-button-card.md +513 -0
  73. package/public/llms/components/tooltip.md +188 -0
  74. package/public/llms/components/unstyled-icon-button.md +175 -0
  75. package/public/llms/components/validation-text.md +29 -0
  76. package/public/llms/components/verification-input.md +96 -0
  77. package/public/llms/docs/changelog.md +1430 -0
  78. package/public/llms/docs/common-props/align-self.md +90 -0
  79. package/public/llms/docs/common-props/border.md +308 -0
  80. package/public/llms/docs/common-props/colour.md +221 -0
  81. package/public/llms/docs/common-props/flex-items.md +91 -0
  82. package/public/llms/docs/common-props/gap.md +111 -0
  83. package/public/llms/docs/common-props/grid-items.md +96 -0
  84. package/public/llms/docs/common-props/margin.md +105 -0
  85. package/public/llms/docs/common-props/opacity.md +100 -0
  86. package/public/llms/docs/common-props/order.md +90 -0
  87. package/public/llms/docs/common-props/overflow.md +89 -0
  88. package/public/llms/docs/common-props/padding.md +102 -0
  89. package/public/llms/docs/common-props/position.md +92 -0
  90. package/public/llms/docs/common-props/size.md +93 -0
  91. package/public/llms/docs/common-props/spacing.md +97 -0
  92. package/public/llms/docs/common-props/text.md +35 -0
  93. package/public/llms/docs/common-props/z-index.md +88 -0
  94. package/public/llms/docs/design-tokens.md +72 -0
  95. package/public/llms/docs/getting-started.md +117 -0
  96. package/public/llms/docs/layout.md +135 -0
  97. package/public/llms/docs/migrating.md +302 -0
  98. package/public/llms/docs/responsive-design/breakpoints.md +119 -0
  99. package/public/llms/docs/responsive-design/media-queries.md +89 -0
  100. package/public/llms/docs/responsive-design/responsive-props.md +37 -0
  101. package/public/llms.txt +97 -0
  102. package/scripts/init-ai.js +142 -0
  103. package/styles.css +2 -2
  104. /package/dist/{chunk-JRVYOIXR.js.map → chunk-MIVYZGEV.js.map} +0 -0
@@ -0,0 +1,236 @@
1
+ # Link
2
+
3
+ Links are used to navigate a user to another page or website, another place on the same page, or to open a link in a new tab.
4
+
5
+ - [Alternatives](#alternatives)
6
+ - [Semantic HTML](#semantic-html)
7
+ - [Open in new tab](#open-in-new-tab)
8
+ - [Icons](#icons)
9
+ - [Inverted colours](#inverted-colours)
10
+ - [Usage with Next.js](#usage-with-next.js)
11
+ - [API](#api)
12
+
13
+ ```tsx
14
+ <Link href="#">Link</Link>
15
+ ```
16
+
17
+ ## Alternatives
18
+
19
+ - InlineLink - For links within a body of
20
+ text
21
+
22
+ ## Semantic HTML
23
+
24
+ > If it goes somewhere it's a link, if it does something it's a button.
25
+
26
+ A semantic HTML `a` is rendered by default, however you can change the
27
+ underlying HTML element by using the `asChild` prop.
28
+
29
+ When `asChild` is set to true, we will not render a default DOM element,
30
+ instead cloning the child and passing it the props and behaviour required to
31
+ make it functional.
32
+
33
+ Read more about this idea in the [Radix UI composition docs](https://www.radix-ui.com/primitives/docs/guides/composition).
34
+
35
+ ```tsx
36
+ <Link asChild>
37
+ <button type="button" onClick={onClick}>
38
+ View UW services
39
+ <ChevronRightSmallIcon />
40
+ </button>
41
+ </Link>
42
+ ```
43
+
44
+ ```tsx
45
+ <Flex direction="column" gap="300">
46
+ <Link asChild>
47
+ <button onClick={() => alert('Hello world!')}>
48
+ View UW services
49
+ <ChevronRightSmallIcon />
50
+ </button>
51
+ </Link>
52
+ <Link asChild>
53
+ <button aria-disabled onClick={e => e.preventDefault()}>
54
+ View UW services
55
+ <ChevronRightSmallIcon />
56
+ </button>
57
+ </Link>
58
+ </Flex>
59
+ ```
60
+
61
+ ## Open in new tab
62
+
63
+ Avoid using `target=_blank` ([When to use target="\_blank"](https://css-tricks.com/use-target_blank/)).
64
+
65
+ 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/).
66
+
67
+ An icon will also be added to indicate that the link opens in a new tab or
68
+ window, improving accessibility. You can override this behaviour by setting the
69
+ `hideOpenIcon` prop.
70
+
71
+ ```tsx
72
+ <Flex gap="600">
73
+ <Link {...args}>Visit help pages</Link>
74
+ <Link {...args} hideOpenIcon>
75
+ Go to help
76
+ <ChevronRightSmallIcon />
77
+ </Link>
78
+ </Flex>
79
+ ```
80
+
81
+ ## Icons
82
+
83
+ Icons can be added to Link to make the action easier to understand. You can add
84
+ an Icon to the left or right of a Link.
85
+
86
+ You can nest icons directly inside the `Link`. An appropriate gap is provided
87
+ automatically, and the icon will inherit the appropriate colours.
88
+
89
+ This component is intended to be used with the Hearth Icons packages.
90
+ `Link` should use small, 20px, icons.
91
+
92
+ ```tsx
93
+ <Link>
94
+ <SettingsSmallIcon />
95
+ Edit account
96
+ </Link>
97
+ ```
98
+
99
+ ```tsx
100
+ <Flex gap="600">
101
+ <Link {...args}>
102
+ Download Bill
103
+ <DownloadSmallIcon />
104
+ </Link>
105
+ <Link {...args}>
106
+ <ChevronLeftSmallIcon />
107
+ Back to Dashboard
108
+ </Link>
109
+ </Flex>
110
+ ```
111
+
112
+ Icons from the UW icons packages have `aria-hidden="true"` set by default. If
113
+ you are using an icon, in the `Link` component, from outside these
114
+ packages, and for purely decorative reasons, please ensure it has this
115
+ attribute set so that the icon is hidden from screen readers.
116
+
117
+ When using anything other than an icon from the Hearth Icons library, you
118
+ should add the `data-icon` attribute to your icon so that it renders the
119
+ appropriate styles.
120
+
121
+ ```tsx
122
+ <Link>
123
+ <MyFontIcon aria-hidden="true" data-icon />
124
+ Edit account
125
+ </Link>
126
+ ```
127
+
128
+ ```tsx
129
+ import { Link } from "@utilitywarehouse/heart-react";
130
+ import Image from 'next/image';
131
+
132
+ [...]
133
+
134
+ <Link>
135
+ <Image
136
+ aria-hidden
137
+ data-icon
138
+ src="/globe.svg"
139
+ alt="Globe icon"
140
+ width={16}
141
+ height={16}
142
+ />
143
+ Edit account
144
+ </Link>
145
+ ```
146
+
147
+ ## Inverted colours
148
+
149
+ The `inverted` prop should be used when using a `Link` on darker surface
150
+ colours, specifically the UW Purple and Dark Purple colours.
151
+
152
+ ```tsx
153
+ <Flex gap="400" backgroundColor="brand" padding="400">
154
+ <Link {...args} inverted>
155
+ Inverted Link
156
+ </Link>
157
+ </Flex>
158
+ ```
159
+
160
+ ### Next.js v13 and above
161
+
162
+ The Next.js `Link` component behaviour has changed in v13, so that an `<a>` is
163
+ no longer required as a child. You can render the Hearth React `Link` component
164
+ as a Next.js `Link` component using `asChild`:
165
+
166
+ ```tsx
167
+ import NextLink from 'next/link';
168
+ import { Link } from '@utilitywarehouse/hearth-react';
169
+
170
+ [...]
171
+
172
+ <Link asChild>
173
+ <NextLink href={href} onClick={onClick}>
174
+ {title}
175
+ </NextLink>
176
+ </Link>
177
+ ```
178
+
179
+ You can also use the `legacyBehavior` prop directly on the Next.js Link component:
180
+
181
+ ```tsx
182
+ import NextLink from 'next/link';
183
+ import { Link } from '@utilitywarehouse/hearth-react';
184
+
185
+ [...]
186
+
187
+ <NextLink href={href} passHref onClick={onClick} legacyBehavior>
188
+ <Link>{title}</Link>
189
+ </NextLink>
190
+ ```
191
+
192
+ And if you want to set this behavior globally you can use the following Next.js
193
+ configuration:
194
+
195
+ ```
196
+ {
197
+ experimental: {
198
+ newNextLinkBehavior: false
199
+ }
200
+ }
201
+ ```
202
+
203
+ ### Next.js before v13
204
+
205
+ ```tsx
206
+ import NextLink from 'next/link';
207
+ import { Link } from '@utilitywarehouse/hearth-react';
208
+
209
+ [...]
210
+
211
+ <NextLink href={href} passHref onClick={onClick}>
212
+ {/* // eslint-disable-next-line jsx-a11y/anchor-is-valid */}
213
+ <Link>{title}</Link>
214
+ </NextLink>
215
+ ```
216
+
217
+ ## API
218
+
219
+ This component is based on the `a` element and supports the following common props:
220
+
221
+ - Margin
222
+ - Text transform
223
+
224
+ | Prop | Type | Default | Description |
225
+ | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------- |
226
+ | `asChild` | `boolean` | — | Change the default rendered element for the one passed as a child, merging their props and behavior. |
227
+ | `inverted` | `boolean` | — | Inverts the component colours, for use on darker surface colours. |
228
+ | `hideOpenIcon` | `boolean` | — | Hides the "open in new tab" icon when `target="_blank"` is set. |
229
+ | `margin` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
230
+ | `marginTop` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
231
+ | `marginRight` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
232
+ | `marginBottom` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
233
+ | `marginLeft` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
234
+ | `marginX` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
235
+ | `marginY` | `Responsive<"auto" \| "0" \| "25" \| "50" \| "75" \| "100" \| "150" \| "175" \| "200" \| "250" \| "300" \| "350" \| "400" \| "500" \| "600" \| "700" \| "800" \| "900" \| "1000" \| `var(--h-${string})`>` | — | |
236
+ | `textTransform` | `"none" \| "uppercase" \| "lowercase" \| "capitalize"` | — | Set the text-transform on the component. |