@4alldigital/foundation-ui--core 3.6.3 → 3.7.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.
@@ -0,0 +1,43 @@
1
+ import { MouseEventHandler, ReactNode } from 'react';
2
+
3
+ export enum BTN_TYPES {
4
+ SUBMIT = 'submit',
5
+ RESET = 'reset',
6
+ BUTTON = 'button',
7
+ }
8
+
9
+ export enum BTN_VARIANTS {
10
+ PRIMARY = 'primary',
11
+ SECONDARY = 'secondary',
12
+ TERTIARY = 'tertiary',
13
+ LINK = 'link',
14
+ }
15
+
16
+ export enum BTN_SIZES {
17
+ SMALL = 'small',
18
+ MEDIUM = 'medium',
19
+ LARGE = 'large',
20
+ }
21
+ export interface Props {
22
+ variant?: BTN_VARIANTS;
23
+ size?: BTN_SIZES;
24
+ uppercase?: boolean;
25
+ children?: ReactNode;
26
+ type?: BTN_TYPES;
27
+ disabled?: boolean;
28
+ ariaLabel?: string;
29
+ onClick?: MouseEventHandler<HTMLButtonElement>;
30
+ icon?: string;
31
+ external?: boolean;
32
+ iconFirst?: boolean;
33
+ raised?: boolean;
34
+ outline?: boolean;
35
+ wide?: boolean;
36
+ rounded?: boolean;
37
+ id?: string;
38
+ testID?: string;
39
+ className?: string;
40
+ isLoading?: boolean;
41
+ iconOnly?: boolean;
42
+ offsetFont?: boolean;
43
+ }
@@ -0,0 +1 @@
1
+ export { default } from './Button';
@@ -3,7 +3,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
3
3
  import { cn } from '../../utils';
4
4
  import { ProductCardProps } from './ProductCard.types';
5
5
  import Image from '../Image';
6
- import { ShadcnButton } from '../ShadcnButton';
6
+ import { Button } from '../Button';
7
7
 
8
8
  const productCardVariants = cva(
9
9
  'group relative flex flex-col overflow-hidden rounded-lg border border-border bg-card transition-all hover:shadow-lg',
@@ -89,14 +89,14 @@ const ProductCard = React.forwardRef<HTMLDivElement, ProductCardVariantProps>(
89
89
  <span className="text-xl font-bold text-foreground">
90
90
  {formatPrice(product.price, product.currency)}
91
91
  </span>
92
- <ShadcnButton
93
- variant="outline"
92
+ <Button
93
+ // variant="outline"
94
94
  size="sm"
95
95
  onClick={handleClick}
96
- className="transition-colors hover:bg-primary hover:text-primary-foreground"
96
+ className="transition-colors"
97
97
  >
98
98
  View Details
99
- </ShadcnButton>
99
+ </Button>
100
100
  </div>
101
101
  </div>
102
102
  </div>
@@ -4,7 +4,7 @@ import { cn } from '../../utils';
4
4
  import { ProductDetailProps, ProductDetailState } from './ProductDetail.types';
5
5
  import { VariantSelector } from '../VariantSelector';
6
6
  import type { VariantOption } from '../VariantSelector';
7
- import { ShadcnButton } from '../ShadcnButton';
7
+ import { Button } from '../Button';
8
8
  import {
9
9
  ShadcnCarousel,
10
10
  ShadcnCarouselContent,
@@ -186,17 +186,17 @@ export const ProductDetail = React.forwardRef<HTMLDivElement, ProductDetailProps
186
186
  <div className="space-y-2">
187
187
  <label className="text-sm font-medium">Quantity</label>
188
188
  <div className="flex items-center gap-3">
189
- <ShadcnButton
189
+ <Button
190
190
  variant="outline"
191
191
  size="icon"
192
192
  onClick={() => handleQuantityChange(-1)}
193
193
  disabled={quantity <= 1 || isLoading}>
194
194
  <Minus className="h-4 w-4" />
195
- </ShadcnButton>
195
+ </Button>
196
196
  <span className="w-12 text-center text-lg font-medium">{quantity}</span>
197
- <ShadcnButton variant="outline" size="icon" onClick={() => handleQuantityChange(1)} disabled={isLoading}>
197
+ <Button variant="outline" size="icon" onClick={() => handleQuantityChange(1)} disabled={isLoading}>
198
198
  <Plus className="h-4 w-4" />
199
- </ShadcnButton>
199
+ </Button>
200
200
  </div>
201
201
  </div>
202
202
 
@@ -232,7 +232,7 @@ export const ProductDetail = React.forwardRef<HTMLDivElement, ProductDetailProps
232
232
  </div>
233
233
  ) : (
234
234
  <>
235
- <ShadcnButton size="lg" className="w-full" onClick={handlePurchase} disabled={!canPurchase}>
235
+ <Button size="lg" className="w-full" onClick={handlePurchase} disabled={!canPurchase}>
236
236
  {isLoading ? (
237
237
  'Processing...'
238
238
  ) : (
@@ -241,7 +241,7 @@ export const ProductDetail = React.forwardRef<HTMLDivElement, ProductDetailProps
241
241
  Buy Now
242
242
  </>
243
243
  )}
244
- </ShadcnButton>
244
+ </Button>
245
245
 
246
246
  {/* Validation Messages */}
247
247
  {!canPurchase && !isLoading && (
@@ -5,7 +5,7 @@ import useEmblaCarousel, {
5
5
  import { ArrowLeft, ArrowRight } from "lucide-react"
6
6
 
7
7
  import { cn } from "../../utils"
8
- import { ShadcnButton } from "../ShadcnButton"
8
+ import { Button } from "../Button"
9
9
 
10
10
  type CarouselApi = UseEmblaCarouselType[1]
11
11
  type UseCarouselParameters = Parameters<typeof useEmblaCarousel>
@@ -194,12 +194,12 @@ ShadcnCarouselItem.displayName = "ShadcnCarouselItem"
194
194
 
195
195
  const ShadcnCarouselPrevious = React.forwardRef<
196
196
  HTMLButtonElement,
197
- React.ComponentProps<typeof ShadcnButton>
197
+ React.ComponentProps<typeof Button>
198
198
  >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
199
199
  const { orientation, scrollPrev, canScrollPrev } = useCarousel()
200
200
 
201
201
  return (
202
- <ShadcnButton
202
+ <Button
203
203
  ref={ref}
204
204
  variant={variant}
205
205
  size={size}
@@ -216,19 +216,19 @@ const ShadcnCarouselPrevious = React.forwardRef<
216
216
  >
217
217
  <ArrowLeft className="h-4 w-4" />
218
218
  <span className="sr-only">Previous slide</span>
219
- </ShadcnButton>
219
+ </Button>
220
220
  )
221
221
  })
222
222
  ShadcnCarouselPrevious.displayName = "ShadcnCarouselPrevious"
223
223
 
224
224
  const ShadcnCarouselNext = React.forwardRef<
225
225
  HTMLButtonElement,
226
- React.ComponentProps<typeof ShadcnButton>
226
+ React.ComponentProps<typeof Button>
227
227
  >(({ className, variant = "outline", size = "icon", ...props }, ref) => {
228
228
  const { orientation, scrollNext, canScrollNext } = useCarousel()
229
229
 
230
230
  return (
231
- <ShadcnButton
231
+ <Button
232
232
  ref={ref}
233
233
  variant={variant}
234
234
  size={size}
@@ -245,7 +245,7 @@ const ShadcnCarouselNext = React.forwardRef<
245
245
  >
246
246
  <ArrowRight className="h-4 w-4" />
247
247
  <span className="sr-only">Next slide</span>
248
- </ShadcnButton>
248
+ </Button>
249
249
  )
250
250
  })
251
251
  ShadcnCarouselNext.displayName = "ShadcnCarouselNext"
@@ -1,7 +1,8 @@
1
1
  // ATOMS
2
2
  export { default as AnimationCounter } from './AnimationCounter';
3
3
  export { default as Blockquote } from './Blockquote';
4
- export { default as Button } from './Button';
4
+ export { Button, buttonVariants } from './Button';
5
+ export { default as ButtonDeprecated } from './ButtonDeprecated';
5
6
  export { default as Checkbox } from './Checkbox';
6
7
  export { default as Chip } from './Chip';
7
8
  export { default as Calendar } from './Calendar';
@@ -72,7 +73,6 @@ export { default as Cart } from './Cart';
72
73
  export { default as FullContentBackgroundImage } from './FullContentBackgroundImage';
73
74
 
74
75
  // SHADCN UI COMPONENTS
75
- export { ShadcnButton, buttonVariants } from './ShadcnButton';
76
76
  export { ShadcnCarousel } from './ShadcnCarousel';
77
77
 
78
78
  // PRODUCT COMPONENTS
@@ -82,8 +82,9 @@ export { ProductDetail } from './ProductDetail';
82
82
 
83
83
  // TYPES
84
84
  export type { Props as BlockquoteProps } from './Blockquote/Blockquote.types';
85
- export type { Props as ButtonProps } from './Button/Button.types';
85
+ export type { ButtonProps } from './Button/Button.types';
86
86
  export { BTN_TYPES, BTN_VARIANTS, BTN_SIZES } from './Button/Button.types';
87
+ export type { Props as ButtonDeprecatedProps } from './ButtonDeprecated/Button.types';
87
88
  export type { Props as CopyProps } from './Copy/Copy.types';
88
89
  export { COPY_ALIGN, COPY_TRANSFORM, COPY_CONTEXTUAL, COPY_SIZE, COPY_TAG } from './Copy/Copy.types';
89
90
  export type { Props as HeadingProps } from './Heading/Heading.types';
@@ -153,7 +154,6 @@ export type { Props as FullContentBackgroundImageProps } from './FullContentBack
153
154
  export type { Props as HeaderProps } from './Header/Header.types';
154
155
 
155
156
  // SHADCN UI TYPES
156
- export type { ShadcnButtonProps } from './ShadcnButton';
157
157
 
158
158
  // PRODUCT COMPONENT TYPES
159
159
  export type { AddressFormProps, ShippingAddress } from './AddressForm';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import Screen from '../../components/Screen';
3
2
  import { Copy, DisplayHeading, Heading, HEADING_TAGS, Icon, List, ListItem, ListTag } from '../../components';
4
3
  import { Props } from './NotFoundScreen.types';
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import Screen from '../../components/Screen';
3
2
  import DisplayHeading from '../../components/DisplayHeading';
4
3
  import { ProductCard } from '../../components/ProductCard';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import Screen from '../../components/Screen';
3
3
  import { Props } from './PurchaseConfirmationScreen.types';
4
- import { ShadcnButton } from '../../components/ShadcnButton';
4
+ import { Button } from '../../components/Button';
5
5
  import { CheckCircle } from 'lucide-react';
6
6
 
7
7
  const PurchaseConfirmationScreen = ({
@@ -100,35 +100,35 @@ const PurchaseConfirmationScreen = ({
100
100
  {/* Action Buttons */}
101
101
  <div className="flex flex-col gap-4 sm:flex-row sm:justify-center">
102
102
  {onContinueShopping && (
103
- <ShadcnButton
103
+ <Button
104
104
  size="lg"
105
105
  onClick={onContinueShopping}
106
106
  className="w-full sm:w-auto"
107
107
  >
108
108
  Continue Shopping
109
- </ShadcnButton>
109
+ </Button>
110
110
  )}
111
111
 
112
112
  {onViewOrders && (
113
- <ShadcnButton
113
+ <Button
114
114
  size="lg"
115
115
  variant="outline"
116
116
  onClick={onViewOrders}
117
117
  className="w-full sm:w-auto"
118
118
  >
119
119
  View Orders
120
- </ShadcnButton>
120
+ </Button>
121
121
  )}
122
122
 
123
123
  {onGoToDashboard && (
124
- <ShadcnButton
124
+ <Button
125
125
  size="lg"
126
126
  variant="outline"
127
127
  onClick={onGoToDashboard}
128
128
  className="w-full sm:w-auto"
129
129
  >
130
130
  Go to Dashboard
131
- </ShadcnButton>
131
+ </Button>
132
132
  )}
133
133
  </div>
134
134
  </div>
@@ -1,152 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { ShadcnButton } from './ShadcnButton';
3
- import { ChevronRight, Mail, Loader2 } from 'lucide-react';
4
-
5
- const meta: Meta<typeof ShadcnButton> = {
6
- title: 'Components/ShadcnButton',
7
- component: ShadcnButton,
8
- tags: ['autodocs'],
9
- argTypes: {
10
- variant: {
11
- control: 'select',
12
- options: ['default', 'destructive', 'outline', 'secondary', 'ghost', 'link'],
13
- description: 'Button visual variant',
14
- },
15
- size: {
16
- control: 'select',
17
- options: ['default', 'sm', 'lg', 'icon'],
18
- description: 'Button size',
19
- },
20
- disabled: {
21
- control: 'boolean',
22
- description: 'Disabled state',
23
- },
24
- asChild: {
25
- control: 'boolean',
26
- description: 'Merge props with child element',
27
- },
28
- },
29
- };
30
-
31
- export default meta;
32
- type Story = StoryObj<typeof ShadcnButton>;
33
-
34
- export const Default: Story = {
35
- args: {
36
- children: 'Button',
37
- variant: 'default',
38
- size: 'default',
39
- },
40
- };
41
-
42
- export const Destructive: Story = {
43
- args: {
44
- children: 'Delete',
45
- variant: 'destructive',
46
- },
47
- };
48
-
49
- export const Outline: Story = {
50
- args: {
51
- children: 'Outline',
52
- variant: 'outline',
53
- },
54
- };
55
-
56
- export const Secondary: Story = {
57
- args: {
58
- children: 'Secondary',
59
- variant: 'secondary',
60
- },
61
- };
62
-
63
- export const Ghost: Story = {
64
- args: {
65
- children: 'Ghost',
66
- variant: 'ghost',
67
- },
68
- };
69
-
70
- export const Link: Story = {
71
- args: {
72
- children: 'Link',
73
- variant: 'link',
74
- },
75
- };
76
-
77
- export const Small: Story = {
78
- args: {
79
- children: 'Small Button',
80
- size: 'sm',
81
- },
82
- };
83
-
84
- export const Large: Story = {
85
- args: {
86
- children: 'Large Button',
87
- size: 'lg',
88
- },
89
- };
90
-
91
- export const Icon: Story = {
92
- args: {
93
- size: 'icon',
94
- children: <ChevronRight className="h-4 w-4" />,
95
- },
96
- };
97
-
98
- export const WithIcon: Story = {
99
- args: {
100
- children: (
101
- <>
102
- <Mail className="mr-2 h-4 w-4" />
103
- Login with Email
104
- </>
105
- ),
106
- },
107
- };
108
-
109
- export const Loading: Story = {
110
- args: {
111
- disabled: true,
112
- children: (
113
- <>
114
- <Loader2 className="mr-2 h-4 w-4 animate-spin" />
115
- Please wait
116
- </>
117
- ),
118
- },
119
- };
120
-
121
- export const Disabled: Story = {
122
- args: {
123
- children: 'Disabled',
124
- disabled: true,
125
- },
126
- };
127
-
128
- export const AllVariants: Story = {
129
- render: () => (
130
- <div className="flex flex-wrap gap-4">
131
- <ShadcnButton variant="default">Default</ShadcnButton>
132
- <ShadcnButton variant="destructive">Destructive</ShadcnButton>
133
- <ShadcnButton variant="outline">Outline</ShadcnButton>
134
- <ShadcnButton variant="secondary">Secondary</ShadcnButton>
135
- <ShadcnButton variant="ghost">Ghost</ShadcnButton>
136
- <ShadcnButton variant="link">Link</ShadcnButton>
137
- </div>
138
- ),
139
- };
140
-
141
- export const AllSizes: Story = {
142
- render: () => (
143
- <div className="flex flex-wrap items-center gap-4">
144
- <ShadcnButton size="sm">Small</ShadcnButton>
145
- <ShadcnButton size="default">Default</ShadcnButton>
146
- <ShadcnButton size="lg">Large</ShadcnButton>
147
- <ShadcnButton size="icon">
148
- <ChevronRight className="h-4 w-4" />
149
- </ShadcnButton>
150
- </div>
151
- ),
152
- };
@@ -1,57 +0,0 @@
1
- import * as React from "react"
2
- import { Slot } from "@radix-ui/react-slot"
3
- import { cva, type VariantProps } from "class-variance-authority"
4
-
5
- import { cn } from "../../utils"
6
-
7
- const buttonVariants = cva(
8
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9
- {
10
- variants: {
11
- variant: {
12
- default:
13
- "bg-white/20 text-primary-foreground shadow hover:bg-primary/90 border-2 border-red",
14
- destructive:
15
- "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
16
- outline:
17
- "border border-input bg-background shadow-sm hover:bg-accent hover:bg-primary",
18
- secondary:
19
- "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
20
- ghost: "hover:bg-transparent hover:bg-transparent",
21
- link: "text-primary underline-offset-4 hover:underline",
22
- },
23
- size: {
24
- default: "h-9 px-4 py-2",
25
- sm: "h-8 rounded-md px-3 text-xs",
26
- lg: "h-10 rounded-md px-8",
27
- icon: "h-9 w-9",
28
- },
29
- },
30
- defaultVariants: {
31
- variant: "default",
32
- size: "default",
33
- },
34
- }
35
- )
36
-
37
- export interface ShadcnButtonProps
38
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
39
- VariantProps<typeof buttonVariants> {
40
- asChild?: boolean
41
- }
42
-
43
- const ShadcnButton = React.forwardRef<HTMLButtonElement, ShadcnButtonProps>(
44
- ({ className, variant, size, asChild = false, ...props }, ref) => {
45
- const Comp = asChild ? Slot : "button"
46
- return (
47
- <Comp
48
- className={cn(buttonVariants({ variant, size, className }))}
49
- ref={ref}
50
- {...props}
51
- />
52
- )
53
- }
54
- )
55
- ShadcnButton.displayName = "ShadcnButton"
56
-
57
- export { ShadcnButton, buttonVariants }
@@ -1,2 +0,0 @@
1
- export { ShadcnButton, buttonVariants } from './ShadcnButton';
2
- export type { ShadcnButtonProps } from './ShadcnButton';