@ornikar/bumper 3.14.1 → 4.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/CHANGELOG.md +10 -0
- package/dist/definitions/index.d.ts +4 -4
- package/dist/definitions/system/{actions → buttons}/Button/Button.d.ts.map +1 -1
- package/dist/definitions/system/{actions → buttons}/Button/components/ButtonBadge.d.ts.map +1 -1
- package/dist/definitions/system/{actions → buttons}/Button/components/ButtonIcon.d.ts.map +1 -1
- package/dist/definitions/system/{actions → buttons}/Button/components/ButtonText.d.ts.map +1 -1
- package/dist/definitions/system/{actions → buttons}/Button/context.d.ts.map +1 -1
- package/dist/definitions/system/{actions → buttons}/Button/types.d.ts.map +1 -1
- package/dist/definitions/system/{actions → buttons}/Button/utils/contentColor.d.ts.map +1 -1
- package/dist/definitions/system/{actions/IconButton/IconButton.d.ts → buttons/ButtonIcon/ButtonIcon.d.ts} +8 -8
- package/dist/definitions/system/buttons/ButtonIcon/ButtonIcon.d.ts.map +1 -0
- package/dist/index-metro.es.android.js +10 -10
- package/dist/index-metro.es.android.js.map +1 -1
- package/dist/index-metro.es.ios.js +10 -10
- package/dist/index-metro.es.ios.js.map +1 -1
- package/dist/index-node-22.22.cjs.js +10 -10
- package/dist/index-node-22.22.cjs.js.map +1 -1
- package/dist/index-node-22.22.cjs.web.js +10 -10
- package/dist/index-node-22.22.cjs.web.js.map +1 -1
- package/dist/index-node-22.22.es.mjs +10 -10
- package/dist/index-node-22.22.es.mjs.map +1 -1
- package/dist/index-node-22.22.es.web.mjs +10 -10
- package/dist/index-node-22.22.es.web.mjs.map +1 -1
- package/dist/index.es.js +10 -10
- package/dist/index.es.js.map +1 -1
- package/dist/index.es.web.js +10 -10
- package/dist/index.es.web.js.map +1 -1
- package/dist/tsbuildinfo +1 -1
- package/docs/migration/Button.md +2 -2
- package/package.json +1 -1
- package/src/Bumper.mdx +3 -3
- package/src/index.ts +5 -5
- package/src/system/{actions → buttons}/Button/Button.features.stories.tsx +1 -1
- package/src/system/{actions → buttons}/Button/Button.mdx +1 -1
- package/src/system/{actions → buttons}/Button/Button.stories.tsx +1 -1
- package/src/system/{actions → buttons}/Button/__snapshots__/Button.features.stories.tsx.snap +12 -12
- package/src/system/{actions → buttons}/Button/__snapshots__/Button.stories.tsx.snap +1 -1
- package/src/system/{actions → buttons}/Button/__snapshots_web__/Button.features.stories.tsx.snap +12 -12
- package/src/system/{actions → buttons}/Button/__snapshots_web__/Button.stories.tsx.snap +1 -1
- package/src/system/buttons/ButtonIcon/ButtonIcon.features.stories.tsx +194 -0
- package/src/system/{actions/IconButton/IconButton.mdx → buttons/ButtonIcon/ButtonIcon.mdx} +16 -16
- package/src/system/{actions/IconButton/IconButton.stories.tsx → buttons/ButtonIcon/ButtonIcon.stories.tsx} +7 -7
- package/src/system/{actions/IconButton/IconButton.tsx → buttons/ButtonIcon/ButtonIcon.tsx} +10 -10
- package/src/system/{actions/IconButton/__snapshots__/IconButton.features.stories.tsx.snap → buttons/ButtonIcon/__snapshots__/ButtonIcon.features.stories.tsx.snap} +10 -10
- package/src/system/{actions/IconButton/__snapshots__/IconButton.stories.tsx.snap → buttons/ButtonIcon/__snapshots__/ButtonIcon.stories.tsx.snap} +1 -1
- package/src/system/{actions/IconButton/__snapshots_web__/IconButton.features.stories.tsx.snap → buttons/ButtonIcon/__snapshots_web__/ButtonIcon.features.stories.tsx.snap} +10 -10
- package/src/system/{actions/IconButton/__snapshots_web__/IconButton.stories.tsx.snap → buttons/ButtonIcon/__snapshots_web__/ButtonIcon.stories.tsx.snap} +1 -1
- package/dist/definitions/system/actions/IconButton/IconButton.d.ts.map +0 -1
- package/src/system/actions/IconButton/IconButton.features.stories.tsx +0 -194
- /package/dist/definitions/system/{actions → buttons}/Button/Button.d.ts +0 -0
- /package/dist/definitions/system/{actions → buttons}/Button/components/ButtonBadge.d.ts +0 -0
- /package/dist/definitions/system/{actions → buttons}/Button/components/ButtonIcon.d.ts +0 -0
- /package/dist/definitions/system/{actions → buttons}/Button/components/ButtonText.d.ts +0 -0
- /package/dist/definitions/system/{actions → buttons}/Button/context.d.ts +0 -0
- /package/dist/definitions/system/{actions → buttons}/Button/types.d.ts +0 -0
- /package/dist/definitions/system/{actions → buttons}/Button/utils/contentColor.d.ts +0 -0
- /package/src/system/{actions → buttons}/Button/Button.tsx +0 -0
- /package/src/system/{actions → buttons}/Button/components/ButtonBadge.tsx +0 -0
- /package/src/system/{actions → buttons}/Button/components/ButtonIcon.tsx +0 -0
- /package/src/system/{actions → buttons}/Button/components/ButtonText.tsx +0 -0
- /package/src/system/{actions → buttons}/Button/context.ts +0 -0
- /package/src/system/{actions → buttons}/Button/types.ts +0 -0
- /package/src/system/{actions → buttons}/Button/utils/contentColor.ts +0 -0
package/docs/migration/Button.md
CHANGED
|
@@ -143,7 +143,7 @@ If the source Button has only an `icon` prop and no `children`, use only `Button
|
|
|
143
143
|
</Button>
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
**Note**: Consider migrating icon-only buttons to `
|
|
146
|
+
**Note**: Consider migrating icon-only buttons to `ButtonIcon` from bumper instead, depending on design intent.
|
|
147
147
|
|
|
148
148
|
## Icon Migration
|
|
149
149
|
|
|
@@ -497,6 +497,6 @@ Apply these rules in order for each `<Button>` usage:
|
|
|
497
497
|
- **Dynamic `stretch` variables**: When `stretch` receives a runtime variable (not an object literal), ask the user on how to proceed.
|
|
498
498
|
- **`InternalLink as={Button}` wrappers**: The `as` polymorphic pattern may not be compatible with bumper's compound children model. Each InternalLink/InternalLinkButton wrapper needs manual verification.
|
|
499
499
|
- **`Actions.Button`**: Shares ButtonProps but lives in a different component tree. Migrate separately as part of Actions component migration.
|
|
500
|
-
- **Icon-only buttons**: Don't do anything. Migrate separatly as part of the
|
|
500
|
+
- **Icon-only buttons**: Don't do anything. Migrate separatly as part of the ButtonIcon component migration.
|
|
501
501
|
- **`style` prop usage**: Any custom styles passed via `style` prop need manual conversion to Tamagui style props.
|
|
502
502
|
- **Components extending `ButtonProps`**: Proceed with the changes, only ask for user input if the linting is failing.
|
package/package.json
CHANGED
package/src/Bumper.mdx
CHANGED
|
@@ -27,10 +27,10 @@ spacing, color, radius, and typography.
|
|
|
27
27
|
- [TypographyLink](?path=/docs/bumper-content-typographylink--docs) — Interactive link with underline and disabled states.
|
|
28
28
|
- [Icon](?path=/docs/bumper-content-icon--docs) — Standalone icon wrapper. Color and size via tokens.
|
|
29
29
|
|
|
30
|
-
##
|
|
30
|
+
## Buttons
|
|
31
31
|
|
|
32
|
-
- [Button](?path=/docs/bumper-
|
|
33
|
-
- [
|
|
32
|
+
- [Button](?path=/docs/bumper-buttons-button--docs) — Primary action component with text, icon, and badge slots.
|
|
33
|
+
- [ButtonIcon](?path=/docs/bumper-buttons-buttonicon--docs) — Square icon-only button for toolbar actions and compact layouts.
|
|
34
34
|
|
|
35
35
|
## Data Displays
|
|
36
36
|
|
package/src/index.ts
CHANGED
|
@@ -14,11 +14,11 @@ export { HStack, Stack, VStack } from './system/core/primitives/Stack';
|
|
|
14
14
|
export type { ViewProps } from './system/core/primitives/View';
|
|
15
15
|
export { View } from './system/core/primitives/View';
|
|
16
16
|
|
|
17
|
-
//
|
|
18
|
-
export { Button } from './system/
|
|
19
|
-
export type { ButtonProps } from './system/
|
|
20
|
-
export type {
|
|
21
|
-
export {
|
|
17
|
+
// Buttons
|
|
18
|
+
export { Button } from './system/buttons/Button/Button';
|
|
19
|
+
export type { ButtonProps } from './system/buttons/Button/types';
|
|
20
|
+
export type { ButtonIconProps } from './system/buttons/ButtonIcon/ButtonIcon';
|
|
21
|
+
export { ButtonIcon } from './system/buttons/ButtonIcon/ButtonIcon';
|
|
22
22
|
|
|
23
23
|
// Typography
|
|
24
24
|
export { Typography } from './system/content/typography';
|
|
@@ -6,7 +6,7 @@ import { View } from '../../core/primitives/View';
|
|
|
6
6
|
import { Button, InternalButtonFrame } from './Button';
|
|
7
7
|
|
|
8
8
|
const meta: Meta<typeof Button> = {
|
|
9
|
-
title: 'Bumper/
|
|
9
|
+
title: 'Bumper/Buttons/Button/Features',
|
|
10
10
|
component: Button,
|
|
11
11
|
};
|
|
12
12
|
|
package/src/system/{actions → buttons}/Button/__snapshots__/Button.features.stories.tsx.snap
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
2
|
|
|
3
|
-
exports[`Bumper/
|
|
3
|
+
exports[`Bumper/Buttons/Button/Features Disabled 1`] = `
|
|
4
4
|
<RNCSafeAreaProvider
|
|
5
5
|
onInsetsChange={[Function]}
|
|
6
6
|
style={
|
|
@@ -293,7 +293,7 @@ exports[`Bumper/Actions/Button/Features Disabled 1`] = `
|
|
|
293
293
|
</RNCSafeAreaProvider>
|
|
294
294
|
`;
|
|
295
295
|
|
|
296
|
-
exports[`Bumper/
|
|
296
|
+
exports[`Bumper/Buttons/Button/Features Loading 1`] = `
|
|
297
297
|
<RNCSafeAreaProvider
|
|
298
298
|
onInsetsChange={[Function]}
|
|
299
299
|
style={
|
|
@@ -1296,7 +1296,7 @@ exports[`Bumper/Actions/Button/Features Loading 1`] = `
|
|
|
1296
1296
|
</RNCSafeAreaProvider>
|
|
1297
1297
|
`;
|
|
1298
1298
|
|
|
1299
|
-
exports[`Bumper/
|
|
1299
|
+
exports[`Bumper/Buttons/Button/Features OnContrasted 1`] = `
|
|
1300
1300
|
<RNCSafeAreaProvider
|
|
1301
1301
|
onInsetsChange={[Function]}
|
|
1302
1302
|
style={
|
|
@@ -1655,7 +1655,7 @@ exports[`Bumper/Actions/Button/Features OnContrasted 1`] = `
|
|
|
1655
1655
|
</RNCSafeAreaProvider>
|
|
1656
1656
|
`;
|
|
1657
1657
|
|
|
1658
|
-
exports[`Bumper/
|
|
1658
|
+
exports[`Bumper/Buttons/Button/Features Responsive 1`] = `
|
|
1659
1659
|
<RNCSafeAreaProvider
|
|
1660
1660
|
onInsetsChange={[Function]}
|
|
1661
1661
|
style={
|
|
@@ -1821,7 +1821,7 @@ exports[`Bumper/Actions/Button/Features Responsive 1`] = `
|
|
|
1821
1821
|
</RNCSafeAreaProvider>
|
|
1822
1822
|
`;
|
|
1823
1823
|
|
|
1824
|
-
exports[`Bumper/
|
|
1824
|
+
exports[`Bumper/Buttons/Button/Features Sizes 1`] = `
|
|
1825
1825
|
<RNCSafeAreaProvider
|
|
1826
1826
|
onInsetsChange={[Function]}
|
|
1827
1827
|
style={
|
|
@@ -1988,7 +1988,7 @@ exports[`Bumper/Actions/Button/Features Sizes 1`] = `
|
|
|
1988
1988
|
</RNCSafeAreaProvider>
|
|
1989
1989
|
`;
|
|
1990
1990
|
|
|
1991
|
-
exports[`Bumper/
|
|
1991
|
+
exports[`Bumper/Buttons/Button/Features StateFocusVisible 1`] = `
|
|
1992
1992
|
<RNCSafeAreaProvider
|
|
1993
1993
|
onInsetsChange={[Function]}
|
|
1994
1994
|
style={
|
|
@@ -2307,7 +2307,7 @@ exports[`Bumper/Actions/Button/Features StateFocusVisible 1`] = `
|
|
|
2307
2307
|
</RNCSafeAreaProvider>
|
|
2308
2308
|
`;
|
|
2309
2309
|
|
|
2310
|
-
exports[`Bumper/
|
|
2310
|
+
exports[`Bumper/Buttons/Button/Features StateHover 1`] = `
|
|
2311
2311
|
<RNCSafeAreaProvider
|
|
2312
2312
|
onInsetsChange={[Function]}
|
|
2313
2313
|
style={
|
|
@@ -2626,7 +2626,7 @@ exports[`Bumper/Actions/Button/Features StateHover 1`] = `
|
|
|
2626
2626
|
</RNCSafeAreaProvider>
|
|
2627
2627
|
`;
|
|
2628
2628
|
|
|
2629
|
-
exports[`Bumper/
|
|
2629
|
+
exports[`Bumper/Buttons/Button/Features StatePress 1`] = `
|
|
2630
2630
|
<RNCSafeAreaProvider
|
|
2631
2631
|
onInsetsChange={[Function]}
|
|
2632
2632
|
style={
|
|
@@ -2945,7 +2945,7 @@ exports[`Bumper/Actions/Button/Features StatePress 1`] = `
|
|
|
2945
2945
|
</RNCSafeAreaProvider>
|
|
2946
2946
|
`;
|
|
2947
2947
|
|
|
2948
|
-
exports[`Bumper/
|
|
2948
|
+
exports[`Bumper/Buttons/Button/Features Stretch 1`] = `
|
|
2949
2949
|
<RNCSafeAreaProvider
|
|
2950
2950
|
onInsetsChange={[Function]}
|
|
2951
2951
|
style={
|
|
@@ -3289,7 +3289,7 @@ exports[`Bumper/Actions/Button/Features Stretch 1`] = `
|
|
|
3289
3289
|
</RNCSafeAreaProvider>
|
|
3290
3290
|
`;
|
|
3291
3291
|
|
|
3292
|
-
exports[`Bumper/
|
|
3292
|
+
exports[`Bumper/Buttons/Button/Features Types 1`] = `
|
|
3293
3293
|
<RNCSafeAreaProvider
|
|
3294
3294
|
onInsetsChange={[Function]}
|
|
3295
3295
|
style={
|
|
@@ -3608,7 +3608,7 @@ exports[`Bumper/Actions/Button/Features Types 1`] = `
|
|
|
3608
3608
|
</RNCSafeAreaProvider>
|
|
3609
3609
|
`;
|
|
3610
3610
|
|
|
3611
|
-
exports[`Bumper/
|
|
3611
|
+
exports[`Bumper/Buttons/Button/Features WithBadge 1`] = `
|
|
3612
3612
|
<RNCSafeAreaProvider
|
|
3613
3613
|
onInsetsChange={[Function]}
|
|
3614
3614
|
style={
|
|
@@ -3963,7 +3963,7 @@ exports[`Bumper/Actions/Button/Features WithBadge 1`] = `
|
|
|
3963
3963
|
</RNCSafeAreaProvider>
|
|
3964
3964
|
`;
|
|
3965
3965
|
|
|
3966
|
-
exports[`Bumper/
|
|
3966
|
+
exports[`Bumper/Buttons/Button/Features WithIcon 1`] = `
|
|
3967
3967
|
<RNCSafeAreaProvider
|
|
3968
3968
|
onInsetsChange={[Function]}
|
|
3969
3969
|
style={
|
package/src/system/{actions → buttons}/Button/__snapshots_web__/Button.features.stories.tsx.snap
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
2
|
|
|
3
|
-
exports[`Bumper/
|
|
3
|
+
exports[`Bumper/Buttons/Button/Features Disabled 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
5
|
<div
|
|
6
6
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -99,7 +99,7 @@ exports[`Bumper/Actions/Button/Features Disabled 1`] = `
|
|
|
99
99
|
</DocumentFragment>
|
|
100
100
|
`;
|
|
101
101
|
|
|
102
|
-
exports[`Bumper/
|
|
102
|
+
exports[`Bumper/Buttons/Button/Features Loading 1`] = `
|
|
103
103
|
<DocumentFragment>
|
|
104
104
|
<div
|
|
105
105
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -386,7 +386,7 @@ exports[`Bumper/Actions/Button/Features Loading 1`] = `
|
|
|
386
386
|
</DocumentFragment>
|
|
387
387
|
`;
|
|
388
388
|
|
|
389
|
-
exports[`Bumper/
|
|
389
|
+
exports[`Bumper/Buttons/Button/Features OnContrasted 1`] = `
|
|
390
390
|
<DocumentFragment>
|
|
391
391
|
<div
|
|
392
392
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -494,7 +494,7 @@ exports[`Bumper/Actions/Button/Features OnContrasted 1`] = `
|
|
|
494
494
|
</DocumentFragment>
|
|
495
495
|
`;
|
|
496
496
|
|
|
497
|
-
exports[`Bumper/
|
|
497
|
+
exports[`Bumper/Buttons/Button/Features Responsive 1`] = `
|
|
498
498
|
<DocumentFragment>
|
|
499
499
|
<div
|
|
500
500
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -554,7 +554,7 @@ exports[`Bumper/Actions/Button/Features Responsive 1`] = `
|
|
|
554
554
|
</DocumentFragment>
|
|
555
555
|
`;
|
|
556
556
|
|
|
557
|
-
exports[`Bumper/
|
|
557
|
+
exports[`Bumper/Buttons/Button/Features Sizes 1`] = `
|
|
558
558
|
<DocumentFragment>
|
|
559
559
|
<div
|
|
560
560
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -614,7 +614,7 @@ exports[`Bumper/Actions/Button/Features Sizes 1`] = `
|
|
|
614
614
|
</DocumentFragment>
|
|
615
615
|
`;
|
|
616
616
|
|
|
617
|
-
exports[`Bumper/
|
|
617
|
+
exports[`Bumper/Buttons/Button/Features StateFocusVisible 1`] = `
|
|
618
618
|
<DocumentFragment>
|
|
619
619
|
<div
|
|
620
620
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -709,7 +709,7 @@ exports[`Bumper/Actions/Button/Features StateFocusVisible 1`] = `
|
|
|
709
709
|
</DocumentFragment>
|
|
710
710
|
`;
|
|
711
711
|
|
|
712
|
-
exports[`Bumper/
|
|
712
|
+
exports[`Bumper/Buttons/Button/Features StateHover 1`] = `
|
|
713
713
|
<DocumentFragment>
|
|
714
714
|
<div
|
|
715
715
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -804,7 +804,7 @@ exports[`Bumper/Actions/Button/Features StateHover 1`] = `
|
|
|
804
804
|
</DocumentFragment>
|
|
805
805
|
`;
|
|
806
806
|
|
|
807
|
-
exports[`Bumper/
|
|
807
|
+
exports[`Bumper/Buttons/Button/Features StatePress 1`] = `
|
|
808
808
|
<DocumentFragment>
|
|
809
809
|
<div
|
|
810
810
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -899,7 +899,7 @@ exports[`Bumper/Actions/Button/Features StatePress 1`] = `
|
|
|
899
899
|
</DocumentFragment>
|
|
900
900
|
`;
|
|
901
901
|
|
|
902
|
-
exports[`Bumper/
|
|
902
|
+
exports[`Bumper/Buttons/Button/Features Stretch 1`] = `
|
|
903
903
|
<DocumentFragment>
|
|
904
904
|
<div
|
|
905
905
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -999,7 +999,7 @@ exports[`Bumper/Actions/Button/Features Stretch 1`] = `
|
|
|
999
999
|
</DocumentFragment>
|
|
1000
1000
|
`;
|
|
1001
1001
|
|
|
1002
|
-
exports[`Bumper/
|
|
1002
|
+
exports[`Bumper/Buttons/Button/Features Types 1`] = `
|
|
1003
1003
|
<DocumentFragment>
|
|
1004
1004
|
<div
|
|
1005
1005
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -1094,7 +1094,7 @@ exports[`Bumper/Actions/Button/Features Types 1`] = `
|
|
|
1094
1094
|
</DocumentFragment>
|
|
1095
1095
|
`;
|
|
1096
1096
|
|
|
1097
|
-
exports[`Bumper/
|
|
1097
|
+
exports[`Bumper/Buttons/Button/Features WithBadge 1`] = `
|
|
1098
1098
|
<DocumentFragment>
|
|
1099
1099
|
<div
|
|
1100
1100
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -1203,7 +1203,7 @@ exports[`Bumper/Actions/Button/Features WithBadge 1`] = `
|
|
|
1203
1203
|
</DocumentFragment>
|
|
1204
1204
|
`;
|
|
1205
1205
|
|
|
1206
|
-
exports[`Bumper/
|
|
1206
|
+
exports[`Bumper/Buttons/Button/Features WithIcon 1`] = `
|
|
1207
1207
|
<DocumentFragment>
|
|
1208
1208
|
<div
|
|
1209
1209
|
class="css-view-g5y9jx r-flex-13awgt0"
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { StarIcon } from '@ornikar/kitt-icons/ornicons';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
import { Typography } from '../../content/typography';
|
|
4
|
+
import { HStack, VStack } from '../../core/primitives/Stack';
|
|
5
|
+
import { View } from '../../core/primitives/View';
|
|
6
|
+
import { ButtonIcon, InternalButtonIconFrame } from './ButtonIcon';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof ButtonIcon> = {
|
|
9
|
+
title: 'Bumper/Buttons/ButtonIcon/Features',
|
|
10
|
+
component: ButtonIcon,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
|
|
16
|
+
export const Types: Story = {
|
|
17
|
+
render: () => (
|
|
18
|
+
<HStack gap="$space.16" alignItems="center" flexWrap="wrap">
|
|
19
|
+
<ButtonIcon type="primary">
|
|
20
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
21
|
+
</ButtonIcon>
|
|
22
|
+
<ButtonIcon type="secondary">
|
|
23
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
24
|
+
</ButtonIcon>
|
|
25
|
+
<ButtonIcon type="tertiary">
|
|
26
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
27
|
+
</ButtonIcon>
|
|
28
|
+
<ButtonIcon type="danger">
|
|
29
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
30
|
+
</ButtonIcon>
|
|
31
|
+
</HStack>
|
|
32
|
+
),
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Sizes: Story = {
|
|
36
|
+
render: () => (
|
|
37
|
+
<HStack gap="$space.16" alignItems="center">
|
|
38
|
+
<ButtonIcon size="large">
|
|
39
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
40
|
+
</ButtonIcon>
|
|
41
|
+
<ButtonIcon size="small">
|
|
42
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
43
|
+
</ButtonIcon>
|
|
44
|
+
</HStack>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const WithBadge: Story = {
|
|
49
|
+
render: () => (
|
|
50
|
+
<HStack gap="$space.16" alignItems="center">
|
|
51
|
+
<ButtonIcon type="primary">
|
|
52
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
53
|
+
<ButtonIcon.Badge count={3} />
|
|
54
|
+
</ButtonIcon>
|
|
55
|
+
<ButtonIcon type="primary">
|
|
56
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
57
|
+
<ButtonIcon.Badge />
|
|
58
|
+
</ButtonIcon>
|
|
59
|
+
<ButtonIcon type="secondary">
|
|
60
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
61
|
+
<ButtonIcon.Badge count={99} maxCount={99} />
|
|
62
|
+
</ButtonIcon>
|
|
63
|
+
</HStack>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Disabled: Story = {
|
|
68
|
+
render: () => (
|
|
69
|
+
<HStack gap="$space.16" alignItems="center" flexWrap="wrap">
|
|
70
|
+
<ButtonIcon disabled type="primary">
|
|
71
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
72
|
+
</ButtonIcon>
|
|
73
|
+
<ButtonIcon disabled type="secondary">
|
|
74
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
75
|
+
</ButtonIcon>
|
|
76
|
+
<ButtonIcon disabled type="tertiary">
|
|
77
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
78
|
+
</ButtonIcon>
|
|
79
|
+
<ButtonIcon disabled type="danger">
|
|
80
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
81
|
+
</ButtonIcon>
|
|
82
|
+
</HStack>
|
|
83
|
+
),
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const Loading: Story = {
|
|
87
|
+
render: () => (
|
|
88
|
+
<HStack gap="$space.16" alignItems="center" flexWrap="wrap">
|
|
89
|
+
<ButtonIcon isLoading type="primary">
|
|
90
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
91
|
+
</ButtonIcon>
|
|
92
|
+
<ButtonIcon isLoading type="secondary">
|
|
93
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
94
|
+
</ButtonIcon>
|
|
95
|
+
<ButtonIcon isLoading type="tertiary">
|
|
96
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
97
|
+
</ButtonIcon>
|
|
98
|
+
<ButtonIcon isLoading type="danger">
|
|
99
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
100
|
+
</ButtonIcon>
|
|
101
|
+
</HStack>
|
|
102
|
+
),
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const OnContrasted: Story = {
|
|
106
|
+
render: () => (
|
|
107
|
+
<View backgroundColor="$bg.accent.default" padding="$space.16" borderRadius="$radius.m">
|
|
108
|
+
<VStack gap="$space.16">
|
|
109
|
+
<Typography.Text variant="label-l" color="$content.base.onContrasted.hi">
|
|
110
|
+
On contrasted background
|
|
111
|
+
</Typography.Text>
|
|
112
|
+
<HStack gap="$space.16" alignItems="center" flexWrap="wrap">
|
|
113
|
+
<ButtonIcon isOnContrasted type="primary">
|
|
114
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
115
|
+
</ButtonIcon>
|
|
116
|
+
<ButtonIcon isOnContrasted type="secondary">
|
|
117
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
118
|
+
</ButtonIcon>
|
|
119
|
+
<ButtonIcon isOnContrasted type="tertiary">
|
|
120
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
121
|
+
</ButtonIcon>
|
|
122
|
+
<ButtonIcon isOnContrasted type="danger">
|
|
123
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
124
|
+
</ButtonIcon>
|
|
125
|
+
</HStack>
|
|
126
|
+
</VStack>
|
|
127
|
+
</View>
|
|
128
|
+
),
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
export const StateHover: Story = {
|
|
132
|
+
render: () => (
|
|
133
|
+
<HStack gap="$space.16" alignItems="center" flexWrap="wrap">
|
|
134
|
+
<InternalButtonIconFrame type="primary" forceStyle="hover">
|
|
135
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
136
|
+
</InternalButtonIconFrame>
|
|
137
|
+
<InternalButtonIconFrame type="secondary" forceStyle="hover">
|
|
138
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
139
|
+
</InternalButtonIconFrame>
|
|
140
|
+
<InternalButtonIconFrame type="tertiary" forceStyle="hover">
|
|
141
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
142
|
+
</InternalButtonIconFrame>
|
|
143
|
+
<InternalButtonIconFrame type="danger" forceStyle="hover">
|
|
144
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
145
|
+
</InternalButtonIconFrame>
|
|
146
|
+
</HStack>
|
|
147
|
+
),
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export const StatePress: Story = {
|
|
151
|
+
render: () => (
|
|
152
|
+
<HStack gap="$space.16" alignItems="center" flexWrap="wrap">
|
|
153
|
+
<InternalButtonIconFrame type="primary" forceStyle="press">
|
|
154
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
155
|
+
</InternalButtonIconFrame>
|
|
156
|
+
<InternalButtonIconFrame type="secondary" forceStyle="press">
|
|
157
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
158
|
+
</InternalButtonIconFrame>
|
|
159
|
+
<InternalButtonIconFrame type="tertiary" forceStyle="press">
|
|
160
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
161
|
+
</InternalButtonIconFrame>
|
|
162
|
+
<InternalButtonIconFrame type="danger" forceStyle="press">
|
|
163
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
164
|
+
</InternalButtonIconFrame>
|
|
165
|
+
</HStack>
|
|
166
|
+
),
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const StateFocusVisible: Story = {
|
|
170
|
+
render: () => (
|
|
171
|
+
<HStack gap="$space.16" alignItems="center" flexWrap="wrap">
|
|
172
|
+
<InternalButtonIconFrame type="primary" forceStyle="focusVisible">
|
|
173
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
174
|
+
</InternalButtonIconFrame>
|
|
175
|
+
<InternalButtonIconFrame type="secondary" forceStyle="focusVisible">
|
|
176
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
177
|
+
</InternalButtonIconFrame>
|
|
178
|
+
<InternalButtonIconFrame type="tertiary" forceStyle="focusVisible">
|
|
179
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
180
|
+
</InternalButtonIconFrame>
|
|
181
|
+
<InternalButtonIconFrame type="danger" forceStyle="focusVisible">
|
|
182
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
183
|
+
</InternalButtonIconFrame>
|
|
184
|
+
</HStack>
|
|
185
|
+
),
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const Responsive: Story = {
|
|
189
|
+
render: () => (
|
|
190
|
+
<ButtonIcon size="small" $medium={{ size: 'large' }}>
|
|
191
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
192
|
+
</ButtonIcon>
|
|
193
|
+
),
|
|
194
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Meta, Title, Subtitle, Primary, Controls, Canvas } from '@storybook/blocks';
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
2
|
+
import * as ButtonIconStories from './ButtonIcon.stories';
|
|
3
|
+
import * as ButtonIconFeatures from './ButtonIcon.features.stories';
|
|
4
4
|
|
|
5
|
-
<Meta of={
|
|
5
|
+
<Meta of={ButtonIconStories} />
|
|
6
6
|
<Title />
|
|
7
7
|
<Subtitle />
|
|
8
8
|
|
|
@@ -11,63 +11,63 @@ import * as IconButtonFeatures from './IconButton.features.stories';
|
|
|
11
11
|
|
|
12
12
|
## Overview
|
|
13
13
|
|
|
14
|
-
`
|
|
14
|
+
`ButtonIcon` is a square button that contains only an icon — no text label. It extends `Button` internally but removes the `stretch` prop and adjusts padding to produce a square hit target. Use it for toolbar actions, close buttons, or anywhere a label would add unnecessary noise. Compose with `ButtonIcon.Icon` and optionally `ButtonIcon.Badge`.
|
|
15
15
|
|
|
16
16
|
## Types
|
|
17
17
|
|
|
18
18
|
Use `type` to set the visual intent: `primary`, `secondary` (default), `tertiary`, or `danger`.
|
|
19
19
|
|
|
20
|
-
<Canvas of={
|
|
20
|
+
<Canvas of={ButtonIconFeatures.Types} />
|
|
21
21
|
|
|
22
22
|
## Sizes
|
|
23
23
|
|
|
24
|
-
`
|
|
24
|
+
`ButtonIcon` comes in `large` (48px, default) and `small` (36px). Both produce a square button with equal horizontal and vertical padding.
|
|
25
25
|
|
|
26
|
-
<Canvas of={
|
|
26
|
+
<Canvas of={ButtonIconFeatures.Sizes} />
|
|
27
27
|
|
|
28
28
|
## With badge
|
|
29
29
|
|
|
30
|
-
Append `
|
|
30
|
+
Append `ButtonIcon.Badge` to overlay a count or dot indicator on the button. Pass `count` for a number, or omit it for a simple dot.
|
|
31
31
|
|
|
32
|
-
<Canvas of={
|
|
32
|
+
<Canvas of={ButtonIconFeatures.WithBadge} />
|
|
33
33
|
|
|
34
34
|
## Disabled
|
|
35
35
|
|
|
36
36
|
Set `disabled` to prevent interaction. Pointer events and focus are removed, and `aria-disabled` is set.
|
|
37
37
|
|
|
38
|
-
<Canvas of={
|
|
38
|
+
<Canvas of={ButtonIconFeatures.Disabled} />
|
|
39
39
|
|
|
40
40
|
## Loading
|
|
41
41
|
|
|
42
42
|
Set `isLoading` to replace the icon with a `Loader` spinner. The button preserves its dimensions to prevent layout shifts.
|
|
43
43
|
|
|
44
|
-
<Canvas of={
|
|
44
|
+
<Canvas of={ButtonIconFeatures.Loading} />
|
|
45
45
|
|
|
46
46
|
## On contrasted backgrounds
|
|
47
47
|
|
|
48
48
|
Set `isOnContrasted` when the button sits on a dark or accent background to switch to `onContrasted` token variants.
|
|
49
49
|
|
|
50
|
-
<Canvas of={
|
|
50
|
+
<Canvas of={ButtonIconFeatures.OnContrasted} />
|
|
51
51
|
|
|
52
52
|
## Interaction states
|
|
53
53
|
|
|
54
54
|
### Hover
|
|
55
55
|
|
|
56
|
-
<Canvas of={
|
|
56
|
+
<Canvas of={ButtonIconFeatures.StateHover} />
|
|
57
57
|
|
|
58
58
|
### Press
|
|
59
59
|
|
|
60
|
-
<Canvas of={
|
|
60
|
+
<Canvas of={ButtonIconFeatures.StatePress} />
|
|
61
61
|
|
|
62
62
|
### Focus visible
|
|
63
63
|
|
|
64
|
-
<Canvas of={
|
|
64
|
+
<Canvas of={ButtonIconFeatures.StateFocusVisible} />
|
|
65
65
|
|
|
66
66
|
## Responsive
|
|
67
67
|
|
|
68
68
|
All props support responsive overrides via Tamagui media query props (`$medium`, `$large`, etc.).
|
|
69
69
|
|
|
70
|
-
<Canvas of={
|
|
70
|
+
<Canvas of={ButtonIconFeatures.Responsive} />
|
|
71
71
|
|
|
72
72
|
## Related
|
|
73
73
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { StarIcon } from '@ornikar/kitt-icons/ornicons';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
4
|
-
import {
|
|
4
|
+
import { ButtonIcon } from './ButtonIcon';
|
|
5
5
|
|
|
6
|
-
const meta: Meta<typeof
|
|
7
|
-
title: 'Bumper/
|
|
8
|
-
component:
|
|
6
|
+
const meta: Meta<typeof ButtonIcon> = {
|
|
7
|
+
title: 'Bumper/Buttons/ButtonIcon',
|
|
8
|
+
component: ButtonIcon,
|
|
9
9
|
argTypes: {
|
|
10
10
|
type: {
|
|
11
11
|
control: 'select',
|
|
@@ -47,8 +47,8 @@ export const Default: Story = {
|
|
|
47
47
|
isLoading: false,
|
|
48
48
|
},
|
|
49
49
|
render: (args) => (
|
|
50
|
-
<
|
|
51
|
-
<
|
|
52
|
-
</
|
|
50
|
+
<ButtonIcon {...args}>
|
|
51
|
+
<ButtonIcon.Icon icon={<StarIcon />} />
|
|
52
|
+
</ButtonIcon>
|
|
53
53
|
),
|
|
54
54
|
};
|