agroptima-design-system 0.31.3 → 0.31.4-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agroptima-design-system",
3
- "version": "0.31.3",
3
+ "version": "0.31.4-beta.1",
4
4
  "scripts": {
5
5
  "dev": "npm run storybook",
6
6
  "storybook": "storybook dev -p 6006 --ci",
@@ -1,15 +1,13 @@
1
- import NextLink, { type LinkProps } from 'next/link'
2
- import type { AnchorHTMLAttributes, ButtonHTMLAttributes } from 'react'
1
+ import NextLink from 'next/link'
3
2
 
4
3
  interface CommonProps {
5
4
  disabled?: boolean
6
5
  visible?: boolean
7
- prefetch?: boolean
8
6
  }
9
7
 
10
- type HtmlButtonProps = ButtonHTMLAttributes<HTMLButtonElement>
8
+ type HtmlButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>
11
9
 
12
- type AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & LinkProps
10
+ type AnchorProps = React.AnchorHTMLAttributes<HTMLAnchorElement>
13
11
 
14
12
  export type BaseButtonProps =
15
13
  | (HtmlButtonProps & CommonProps)
@@ -21,18 +19,17 @@ const hasHref = (props: HtmlButtonProps | AnchorProps): props is AnchorProps =>
21
19
  export function BaseButton({
22
20
  children,
23
21
  visible = true,
24
- prefetch = false,
25
22
  ...props
26
23
  }: BaseButtonProps) {
27
24
  if (!visible) return null
28
25
  const isLink = !props.disabled && hasHref(props)
29
26
  if (isLink) {
30
- const { href, ...restProps } = props
31
27
  return (
32
- <NextLink href={href} {...restProps} prefetch={prefetch}>
28
+ <NextLink href={props.href || ''} {...props}>
33
29
  {children}
34
30
  </NextLink>
35
31
  )
36
32
  }
33
+
37
34
  return <button {...(props as HtmlButtonProps)}>{children}</button>
38
35
  }
@@ -5,7 +5,6 @@
5
5
 
6
6
  a.card {
7
7
  text-decoration: none;
8
-
9
8
  &:hover {
10
9
  background-color: color_alias.$primary-color-50;
11
10
  }
@@ -17,11 +16,9 @@ a.card {
17
16
  gap: config.$space-2x;
18
17
  padding: config.$space-3x;
19
18
  width: 100%;
20
-
21
19
  p {
22
20
  margin: 0;
23
21
  }
24
-
25
22
  .actions {
26
23
  display: flex;
27
24
  gap: config.$space-4x;
@@ -37,7 +34,6 @@ a.card {
37
34
  flex-direction: row;
38
35
  justify-content: space-between;
39
36
  gap: config.$space-1x;
40
-
41
37
  .title {
42
38
  overflow: hidden;
43
39
  text-overflow: ellipsis;
@@ -45,7 +41,6 @@ a.card {
45
41
  -webkit-box-orient: vertical;
46
42
  display: -webkit-box;
47
43
  }
48
-
49
44
  > .bold {
50
45
  @include typography.body-bold;
51
46
  }
@@ -56,12 +51,8 @@ a.card {
56
51
  }
57
52
 
58
53
  .footer {
59
- display: flex;
60
- flex-direction: column;
61
- gap: config.$space-2x;
62
54
  margin-top: auto;
63
-
64
- > .button {
55
+ .button {
65
56
  width: 100%;
66
57
  }
67
58
  }
@@ -74,7 +65,6 @@ a.card {
74
65
  &.disabled {
75
66
  @include typography.body-regular-disabled;
76
67
  background: color_alias.$neutral-color-50;
77
-
78
68
  .header .bold {
79
69
  color: color_alias.$neutral-color-400;
80
70
  }
@@ -1,21 +1,21 @@
1
1
  import './Card.scss'
2
- import Link, { type LinkProps } from 'next/link'
2
+ import Link from 'next/link'
3
3
  import React from 'react'
4
4
  import { classNames } from '../../utils/classNames'
5
5
 
6
6
  export type Variant = 'primary'
7
7
 
8
- export interface CardProps extends Omit<LinkProps, 'href'> {
8
+ export interface CardProps {
9
9
  visible?: boolean
10
10
  className?: string
11
11
  variant?: Variant
12
12
  isDisabled?: boolean
13
13
  isActive?: boolean
14
14
  error?: boolean
15
+ href?: string
15
16
  onClick?: () => void
16
17
  role?: string
17
18
  children: React.ReactNode
18
- href?: string
19
19
  }
20
20
 
21
21
  export function Card({
@@ -25,7 +25,6 @@ export function Card({
25
25
  isDisabled = false,
26
26
  isActive = false,
27
27
  error = false,
28
- prefetch = false,
29
28
  children,
30
29
  href,
31
30
  ...props
@@ -41,7 +40,7 @@ export function Card({
41
40
 
42
41
  if (href && !isDisabled) {
43
42
  return (
44
- <Link href={href} className={cssClasses} prefetch={prefetch} {...props}>
43
+ <Link href={href} className={cssClasses} {...props}>
45
44
  {children}
46
45
  </Link>
47
46
  )
@@ -31,7 +31,6 @@ export function CardMenuOption({
31
31
  href,
32
32
  active,
33
33
  error,
34
- prefetch = false,
35
34
  ...props
36
35
  }: CardMenuOptionProps): React.JSX.Element {
37
36
  const cssClasses = classNames('card-menu-option', variant, className, {
@@ -46,7 +45,6 @@ export function CardMenuOption({
46
45
  className={cssClasses}
47
46
  href={disabled ? '#' : href}
48
47
  aria-disabled={disabled}
49
- prefetch={prefetch}
50
48
  {...props}
51
49
  >
52
50
  <div className="left">
@@ -174,7 +174,7 @@
174
174
  }
175
175
  }
176
176
 
177
- &.with-title td:not(.actions):has(.cell .badge) {
177
+ &.with-title td:not(.actions):nth-child(2) {
178
178
  margin-top: config.$space-2x;
179
179
  }
180
180
 
@@ -10,6 +10,19 @@
10
10
  .rdp-root {
11
11
  width: 309px;
12
12
  --rdp-accent-color: #{color_alias.$primary-color-600};
13
+ }
14
+ .rdp-caption_label {
15
+ text-transform: capitalize;
16
+ }
17
+
18
+ .single {
19
+ .rdp-selected .rdp-day_button {
20
+ background-color: #{color_alias.$primary-color-600} !important;
21
+ color: white !important;
22
+ }
23
+ }
24
+
25
+ .range {
13
26
  --rdp-accent-background-color: #{color_alias.$primary-color-50};
14
27
  }
15
28
  }
@@ -39,20 +39,36 @@ type DatePickerProps = (DateSinglePickerProps | DateRangePickerProps) &
39
39
  DatePickerBaseProps
40
40
 
41
41
  export function DatePicker(props: DatePickerProps): React.JSX.Element {
42
- const { variant, className, type, lng, onSelect, selected } = props
43
-
42
+ const {
43
+ variant = 'primary',
44
+ className,
45
+ type,
46
+ lng,
47
+ onSelect,
48
+ selected,
49
+ } = props
44
50
  const cssClasses = classNames('date-picker', variant, className)
45
51
 
46
52
  if (type === 'single') {
47
53
  return (
48
54
  <div className={cssClasses}>
49
- <DateSinglePicker lng={lng} selected={selected} onSelect={onSelect} />
55
+ <DateSinglePicker
56
+ lng={lng}
57
+ selected={selected}
58
+ onSelect={onSelect}
59
+ className="single"
60
+ />
50
61
  </div>
51
62
  )
52
63
  }
53
64
  return (
54
65
  <div className={cssClasses}>
55
- <DateRangePicker lng={lng} selected={selected} onSelect={onSelect} />
66
+ <DateRangePicker
67
+ lng={lng}
68
+ selected={selected}
69
+ onSelect={onSelect}
70
+ className="range"
71
+ />
56
72
  </div>
57
73
  )
58
74
  }
@@ -1,6 +1,6 @@
1
1
  import 'react-day-picker/style.css'
2
2
  import { useEffect, useState } from 'react'
3
- import { type DateRange, DayPicker, type Locale } from 'react-day-picker'
3
+ import { type DateRange, DayPicker } from 'react-day-picker'
4
4
  import { enGB, es } from 'react-day-picker/locale'
5
5
  import { formatDatePickerFooterDate } from '../../utils/dateHelpers'
6
6
  import type { AvailableLocale } from './DatePicker'
@@ -15,12 +15,14 @@ export interface DateRangePickerProps {
15
15
  onSelect: (dateRange: DateRange | undefined) => void
16
16
  selected?: DateRange
17
17
  lng: keyof typeof availableLocales
18
+ className: string
18
19
  }
19
20
 
20
21
  export function DateRangePicker({
21
22
  onSelect = () => {},
22
23
  selected: preselected,
23
24
  lng,
25
+ className,
24
26
  }: DateRangePickerProps): React.JSX.Element {
25
27
  const manageFooterText = (): string => {
26
28
  const hasDatesFilter = selected && selected.from && selected.to
@@ -52,16 +54,15 @@ export function DateRangePicker({
52
54
  }
53
55
 
54
56
  return (
55
- <>
56
- <DayPicker
57
- locale={availableLocales[lng]}
58
- mode="range"
59
- min={1}
60
- selected={selected}
61
- onSelect={(dateRange) => selectDate(dateRange)}
62
- footer={footer}
63
- defaultMonth={selected?.from}
64
- />
65
- </>
57
+ <DayPicker
58
+ className={className}
59
+ locale={availableLocales[lng]}
60
+ mode="range"
61
+ min={1}
62
+ selected={selected}
63
+ onSelect={(dateRange) => selectDate(dateRange)}
64
+ footer={footer}
65
+ defaultMonth={selected?.from}
66
+ />
66
67
  )
67
68
  }
@@ -15,12 +15,14 @@ export interface DateSinglePickerProps {
15
15
  onSelect: (date: Date | undefined) => void
16
16
  selected?: Date
17
17
  lng: keyof typeof availableLocales
18
+ className: string
18
19
  }
19
20
 
20
21
  export function DateSinglePicker({
21
22
  onSelect = () => {},
22
23
  selected: preselected,
23
24
  lng,
25
+ className,
24
26
  }: DateSinglePickerProps): React.JSX.Element {
25
27
  const manageFooterText = (): string => {
26
28
  if (!selected) return translations[lng].pickSingleDate
@@ -51,17 +53,17 @@ export function DateSinglePicker({
51
53
  }
52
54
 
53
55
  return (
54
- <>
55
- <DayPicker
56
- locale={availableLocales[lng]}
57
- mode="single"
58
- selected={selected}
59
- onSelect={(date) => selectDate(date)}
60
- footer={footer}
61
- required
62
- month={month}
63
- onMonthChange={(date) => setMonth(date)}
64
- />
65
- </>
56
+ <DayPicker
57
+ className={className}
58
+ locale={availableLocales[lng]}
59
+ mode="single"
60
+ selected={selected}
61
+ onSelect={(date) => selectDate(date)}
62
+ footer={footer}
63
+ required
64
+ month={month}
65
+ onMonthChange={(date) => setMonth(date)}
66
+ defaultMonth={selected}
67
+ />
66
68
  )
67
69
  }
@@ -1,19 +1,19 @@
1
1
  import './Menu.scss'
2
- import Link, { type LinkProps } from 'next/link'
3
- import React, { type AnchorHTMLAttributes } from 'react'
2
+ import Link from 'next/link'
3
+ import React from 'react'
4
4
  import { classNames } from '../../utils/classNames'
5
5
  import type { IconType } from '../Icon'
6
6
  import { Icon } from '../Icon'
7
7
 
8
8
  export type Variant = 'primary'
9
9
 
10
- type AnchorProps = AnchorHTMLAttributes<HTMLAnchorElement> & LinkProps
11
-
12
- export interface MenuLinkProps extends AnchorProps {
10
+ export interface MenuLinkProps
11
+ extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
13
12
  title: string
14
13
  variant?: Variant
15
14
  icon?: IconType
16
15
  isActive?: boolean
16
+ href: string
17
17
  }
18
18
 
19
19
  export function MenuLink({
@@ -22,7 +22,7 @@ export function MenuLink({
22
22
  className,
23
23
  icon,
24
24
  title,
25
- prefetch = false,
25
+ href,
26
26
  ...props
27
27
  }: MenuLinkProps): React.JSX.Element {
28
28
  const cssClasses = classNames('menu-item', variant, className, {
@@ -31,7 +31,7 @@ export function MenuLink({
31
31
 
32
32
  return (
33
33
  <li tabIndex={0} role="menuitem">
34
- <Link {...props} prefetch={prefetch} className={cssClasses}>
34
+ <Link href={href} {...props} className={cssClasses}>
35
35
  {icon && <Icon name={icon} size="3" />}
36
36
  <span className="title">{title}</span>
37
37
  </Link>
@@ -1,5 +1,4 @@
1
1
  import './Pagination.scss'
2
- import type { LinkProps } from 'next/link'
3
2
  import React from 'react'
4
3
  import { classNames } from '../../utils/classNames'
5
4
  import type { IconButtonProps } from '../Button'
@@ -7,7 +6,7 @@ import { IconButton } from '../Button'
7
6
 
8
7
  export type Variant = 'primary'
9
8
 
10
- export interface CustomProps extends LinkProps {
9
+ export interface CustomProps {
11
10
  href: string
12
11
  accessibilityLabel?: string
13
12
  variant?: Variant
@@ -21,7 +20,6 @@ export function PaginationArrow({
21
20
  href,
22
21
  className,
23
22
  disabled,
24
- prefetch = false,
25
23
  ...props
26
24
  }: PaginationArrowProps): React.JSX.Element {
27
25
  const cssClasses = classNames('pagination-button', variant, className, {
@@ -34,7 +32,6 @@ export function PaginationArrow({
34
32
  href={disabled ? '#' : href}
35
33
  className={cssClasses}
36
34
  accessibilityLabel={accessibilityLabel}
37
- prefetch={prefetch}
38
35
  {...props}
39
36
  />
40
37
  )
@@ -1,5 +1,4 @@
1
1
  import './Pagination.scss'
2
- import type { LinkProps } from 'next/link'
3
2
  import React from 'react'
4
3
  import { classNames } from '../../utils/classNames'
5
4
  import type { ButtonProps } from '../Button'
@@ -15,7 +14,7 @@ export interface CustomProps {
15
14
  variant?: Variant
16
15
  }
17
16
 
18
- export type PaginationNumberProps = CustomProps & ButtonProps & LinkProps
17
+ export type PaginationNumberProps = CustomProps & ButtonProps
19
18
 
20
19
  export function PaginationNumber({
21
20
  label,
@@ -25,7 +24,6 @@ export function PaginationNumber({
25
24
  className,
26
25
  disabled,
27
26
  selected = false,
28
- prefetch = false,
29
27
  ...props
30
28
  }: PaginationNumberProps): React.JSX.Element {
31
29
  const cssClasses = classNames('pagination-button', variant, className, {
@@ -40,7 +38,6 @@ export function PaginationNumber({
40
38
  href={disabled ? '#' : href}
41
39
  className={cssClasses}
42
40
  aria-current={selected}
43
- prefetch={prefetch}
44
41
  {...props}
45
42
  />
46
43
  )
@@ -1,12 +1,11 @@
1
1
  import './Popover.scss'
2
2
  import type { LinkProps as NextLinkProps } from 'next/link'
3
3
  import Link from 'next/link'
4
- import React, { type AnchorHTMLAttributes } from 'react'
5
4
  import { classNames } from '../../utils/classNames'
6
5
 
7
6
  export type Variant = 'primary'
8
7
 
9
- type LinkProps = NextLinkProps & AnchorHTMLAttributes<HTMLAnchorElement>
8
+ type LinkProps = NextLinkProps & React.AnchorHTMLAttributes<HTMLAnchorElement>
10
9
  export interface PopoverMenuOptionProps extends LinkProps {
11
10
  variant?: Variant
12
11
  title: string
@@ -22,7 +21,6 @@ export function PopoverMenuOption({
22
21
  disabled,
23
22
  href,
24
23
  active,
25
- prefetch = false,
26
24
  ...props
27
25
  }: PopoverMenuOptionProps): React.JSX.Element {
28
26
  const cssClasses = classNames('popover-menu-option', variant, className, {
@@ -36,7 +34,6 @@ export function PopoverMenuOption({
36
34
  className={cssClasses}
37
35
  href={disabled ? '#' : href}
38
36
  aria-disabled={disabled}
39
- prefetch={prefetch}
40
37
  {...props}
41
38
  >
42
39
  <span className="title">{title}</span>
@@ -62,7 +62,3 @@
62
62
  white-space: nowrap;
63
63
  width: 1px;
64
64
  }
65
-
66
- .absolute {
67
- position: absolute;
68
- }
@@ -1,7 +1,6 @@
1
1
  import { IconButton } from '../atoms/Button'
2
2
  import { Button } from '../atoms/Button'
3
3
  import { Card, CardContent, CardFooter, CardHeader } from '../atoms/Card'
4
- import { QuantitySelector } from '../atoms/QuantitySelector'
5
4
 
6
5
  const figmaPrimaryDesign = {
7
6
  design: {
@@ -102,18 +101,6 @@ export const ProductCard = {
102
101
  </div>
103
102
  </CardContent>
104
103
  <CardFooter>
105
- <QuantitySelector
106
- accessibilityLabel="Quantity of items to wishlist"
107
- defaultValue={1}
108
- hideLabel
109
- id="quantity"
110
- label="Quantity"
111
- max={10}
112
- min={1}
113
- name="quantity"
114
- required
115
- step={0.0001}
116
- />
117
104
  <Button variant="primary-outlined" label="Buy" />
118
105
  </CardFooter>
119
106
  </Card>
@@ -4,17 +4,12 @@ import { Meta } from "@storybook/blocks";
4
4
 
5
5
  # Changelog
6
6
 
7
- ## 0.31.3
8
-
9
- * Add `margin-top` to all cells containing Badges on mobile on CardsTable component.
10
-
11
- ## 0.31.2
12
-
13
- * Manage footer buttons width and position on Card component
14
-
15
7
  ## 0.31.1
16
8
 
17
- * Add NextLink props and prefetch to false to the Button, Card, CardMenuOption, MenuLink, PopoverMenuOption PaginationArrow and PaginationNumber components
9
+ * Capitalized characters in month DatePicker for spanish version.
10
+ * Change the day selection style for DateSinglePicker.
11
+ * Colors in DateRangePicker in filters in Drawer component.
12
+
18
13
 
19
14
  ## 0.31.0
20
15
 
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import { CheckableTag, CheckableTagGroup } from '../atoms/CheckableTag'
3
3
  import { Collapsible } from '../atoms/Collapsible'
4
- import { DateRangePicker } from '../atoms/DatePicker/DateRangePicker'
4
+ import { DatePicker } from '../atoms/DatePicker/DatePicker'
5
5
  import { Drawer } from '../atoms/Drawer'
6
6
 
7
7
  const figmaPrimaryDesign = {
@@ -130,9 +130,10 @@ export const Filters = {
130
130
  </Collapsible>
131
131
  <Collapsible noHorizontalPadding open title="Date">
132
132
  <div style={{ display: 'flex', justifyContent: 'center' }}>
133
- <DateRangePicker
133
+ <DatePicker
134
134
  selected={{ from: new Date(2025, 0, 1), to: new Date(2025, 0, 15) }}
135
135
  onSelect={(date) => console.log('date: ', date)}
136
+ type="range"
136
137
  lng="en"
137
138
  />
138
139
  </div>