@greenharness/greenrack-ui 7.1.1 → 7.1.2
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/components/Button/Button.stories.d.ts +7 -0
- package/dist/components/Button/Button.stories.d.ts.map +1 -1
- package/dist/components/Button/styles.css.d.ts +1 -0
- package/dist/components/Button/styles.css.d.ts.map +1 -1
- package/dist/components/LinkButton/styles.css.d.ts +1 -0
- package/dist/components/LinkButton/styles.css.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +21 -19
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Button/Button.stories.tsx +37 -0
- package/src/components/Button/styles.css.ts +4 -0
- package/src/components/LinkButton/styles.css.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@greenharness/greenrack-ui",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@tanstack/react-virtual": "^3.14.13",
|
|
94
94
|
"qrcode": "^1.5.4",
|
|
95
|
-
"@greenharness/greenrack-tokens": "^7.1.
|
|
95
|
+
"@greenharness/greenrack-tokens": "^7.1.2"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@babel/preset-typescript": "^7.28.0",
|
|
@@ -6,6 +6,11 @@ import {Button} from './Button'
|
|
|
6
6
|
import {Icon} from '../Icon/Icon'
|
|
7
7
|
import {RADII_PX} from '@greenharness/greenrack-tokens/keys'
|
|
8
8
|
import {spacing} from '@greenharness/greenrack-tokens/tokens/spacing.css'
|
|
9
|
+
import {sizes} from '@greenharness/greenrack-tokens/tokens/sizes.css'
|
|
10
|
+
import {Inline} from '../Inline/Inline'
|
|
11
|
+
import {Input} from '../Input/Input'
|
|
12
|
+
import {Field} from '../Field/Field'
|
|
13
|
+
import {withCoarsePointer, withFinePointer} from '../../docs/coarsePointer'
|
|
9
14
|
|
|
10
15
|
const meta: Meta<typeof Button> = {
|
|
11
16
|
title: 'Components/Button',
|
|
@@ -196,3 +201,35 @@ export const Ghost: Story = {
|
|
|
196
201
|
await expect(getComputedStyle(button).borderTopWidth).toBe('0px')
|
|
197
202
|
},
|
|
198
203
|
}
|
|
204
|
+
|
|
205
|
+
const crowded = css.create({row: {width: sizes.gridColSm}})
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* A Button beside a long field in a narrow row keeps its label inside its
|
|
209
|
+
* padding, with a mouse and under a coarse pointer. The touch target's
|
|
210
|
+
* `min-width` replaces the flex item's `min-width: auto`, so without
|
|
211
|
+
* `flexShrink: 0` the row squeezed the button below its label (5.45 to 7.1.0).
|
|
212
|
+
*/
|
|
213
|
+
export const CrowdedRow: Story = {
|
|
214
|
+
render: () => (
|
|
215
|
+
<html.div style={crowded.row}>
|
|
216
|
+
<Inline gap="sm" align="end">
|
|
217
|
+
<Field.Root name="title">
|
|
218
|
+
<Field.Label>Task title</Field.Label>
|
|
219
|
+
<Input name="title" defaultValue="feat/a-very-long-branch-name-to-check-wrapping" />
|
|
220
|
+
<Field.Description>
|
|
221
|
+
Future sessions on feat/a-very-long-branch-name-to-check-wrapping attach automatically.
|
|
222
|
+
</Field.Description>
|
|
223
|
+
</Field.Root>
|
|
224
|
+
<Button type="submit">New task</Button>
|
|
225
|
+
</Inline>
|
|
226
|
+
</html.div>
|
|
227
|
+
),
|
|
228
|
+
play: async ({canvas}) => {
|
|
229
|
+
const button = canvas.getByRole('button', {name: 'New task'})
|
|
230
|
+
const fits = () => expect(button.scrollWidth).toBeLessThanOrEqual(button.clientWidth)
|
|
231
|
+
await withFinePointer()
|
|
232
|
+
await fits()
|
|
233
|
+
await withCoarsePointer(fits)
|
|
234
|
+
},
|
|
235
|
+
}
|
|
@@ -28,6 +28,10 @@ export const styles = css.create({
|
|
|
28
28
|
// A touch screen gets the 44px target, as Toggle and the triggers do; a
|
|
29
29
|
// mouse keeps the compact control (5.6, the person's decision).
|
|
30
30
|
minWidth: {default: null, '@media (pointer: coarse)': sizes.touchTarget},
|
|
31
|
+
// That min-width replaces the flex item's `min-width: auto`, so in a
|
|
32
|
+
// crowded row the button would shrink below its nowrap label. It never
|
|
33
|
+
// shrinks: the row wraps or the field gives way.
|
|
34
|
+
flexShrink: 0,
|
|
31
35
|
// Tactile press feedback. The scale is suppressed under reduced motion (and
|
|
32
36
|
// duration.fast collapses to 0ms there too), so it's inert for those users.
|
|
33
37
|
transform: {
|
|
@@ -24,6 +24,8 @@ export const styles = css.create({
|
|
|
24
24
|
transitionTimingFunction: easing.standard,
|
|
25
25
|
// Matches Button: the 44px target under a coarse pointer (5.6).
|
|
26
26
|
minWidth: {default: null, '@media (pointer: coarse)': sizes.touchTarget},
|
|
27
|
+
// As Button: the min-width above would let a crowded row squeeze the label.
|
|
28
|
+
flexShrink: 0,
|
|
27
29
|
},
|
|
28
30
|
sizeDefault: {
|
|
29
31
|
paddingTop: spacing.sm,
|