@faststore/ui 1.4.6 → 1.4.10

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": "@faststore/ui",
3
- "version": "1.4.6",
3
+ "version": "1.4.10",
4
4
  "description": "A lightweight, framework agnostic component library for React",
5
5
  "author": "emersonlaurentino",
6
6
  "license": "MIT",
@@ -76,7 +76,7 @@
76
76
  "@types/jest-axe": "^3.5.3",
77
77
  "@types/tabbable": "^3.1.1",
78
78
  "@types/testing-library__jest-dom": "^5.9.5",
79
- "@vtex/theme-b2c-tailwind": "^1.4.6",
79
+ "@vtex/theme-b2c-tailwind": "^1.4.10",
80
80
  "@vtex/tsconfig": "^0.5.0",
81
81
  "chalk": "^5.0.0",
82
82
  "jest-axe": "^5.0.1",
@@ -89,5 +89,5 @@
89
89
  "tsdx": "^0.14.1",
90
90
  "typescript": "^4.2.4"
91
91
  },
92
- "gitHead": "183c5ad3677543bab20d89a8614d031edb2fb165"
92
+ "gitHead": "2310100f8fa6098e8ce4a54c7485e10957268ef3"
93
93
  }
@@ -18,14 +18,19 @@ const CheckboxTemplate: Story<CheckboxProps> = ({
18
18
  }, [checked])
19
19
 
20
20
  return (
21
- <Component
22
- {...otherProps}
23
- checked={localChecked}
24
- onClick={(e) => {
25
- onClick?.(e)
26
- setLocalChecked(!localChecked)
27
- }}
28
- />
21
+ <>
22
+ <Component
23
+ {...otherProps}
24
+ checked={localChecked}
25
+ onClick={(e) => {
26
+ onClick?.(e)
27
+ setLocalChecked(!localChecked)
28
+ }}
29
+ id="checkbox"
30
+ />
31
+
32
+ <label htmlFor="checkbox">Checkbox</label>
33
+ </>
29
34
  )
30
35
  }
31
36
 
@@ -6,7 +6,12 @@ import type { RadioProps } from '../Radio'
6
6
  import Component from '../Radio'
7
7
  import mdx from './Radio.mdx'
8
8
 
9
- const RadioTemplate: Story<RadioProps> = (props) => <Component {...props} />
9
+ const RadioTemplate: Story<RadioProps> = (props) => (
10
+ <>
11
+ <Component {...props} id="radio" />
12
+ <label htmlFor="radio">Radio</label>
13
+ </>
14
+ )
10
15
 
11
16
  export const Radio = RadioTemplate.bind({})
12
17
 
@@ -9,15 +9,18 @@ import mdx from './Select.mdx'
9
9
  type SelectStoryProps = SelectProps & { options: string[][] }
10
10
  const SelectTemplate: Story<SelectStoryProps> = ({ options, ...props }) => {
11
11
  return (
12
- <Component {...props}>
13
- {options.map(([value, label]) => {
14
- return (
15
- <option key={value} value={value}>
16
- {label}
17
- </option>
18
- )
19
- })}
20
- </Component>
12
+ <>
13
+ <label htmlFor="select">Select:</label>
14
+ <Component {...props} name="select" id="select">
15
+ {options.map(([value, label]) => {
16
+ return (
17
+ <option key={value} value={value}>
18
+ {label}
19
+ </option>
20
+ )
21
+ })}
22
+ </Component>
23
+ </>
21
24
  )
22
25
  }
23
26
 
@@ -7,7 +7,7 @@ import mdx from './TextArea.mdx'
7
7
  import type { ComponentArgTypes } from '../../../typings/utils'
8
8
 
9
9
  const TextAreaTemplate: Story<TextAreaProps> = (props) => (
10
- <Component {...props} />
10
+ <Component {...props} aria-label="Textarea" />
11
11
  )
12
12
 
13
13
  export const Textarea = TextAreaTemplate.bind({})
@@ -208,16 +208,16 @@ function Carousel({
208
208
  {showNavigationArrows && (
209
209
  <div data-carousel-controls>
210
210
  <IconButton
211
+ aria-label="previous"
211
212
  data-arrow="left"
212
213
  aria-controls={id}
213
- aria-label="previous"
214
214
  onClick={slidePrevious}
215
215
  icon={<LeftArrowIcon />}
216
216
  />
217
217
  <IconButton
218
+ aria-label="next"
218
219
  data-arrow="right"
219
220
  aria-controls={id}
220
- aria-label="next"
221
221
  onClick={slideNext}
222
222
  icon={<RightArrowIcon />}
223
223
  />
@@ -8,7 +8,7 @@ describe('IconButton', () => {
8
8
 
9
9
  it('data-store-icon-button is present', () => {
10
10
  const { getByTestId } = render(
11
- <IconButton testId={testId} icon={<div>foo</div>} />
11
+ <IconButton testId={testId} aria-label="foo" icon={<div>foo</div>} />
12
12
  )
13
13
 
14
14
  const iconButton = getByTestId(testId)
@@ -19,7 +19,11 @@ describe('IconButton', () => {
19
19
 
20
20
  it('icon is present', () => {
21
21
  const { getByTestId } = render(
22
- <IconButton testId={testId} icon={<div data-testid="icon">foo</div>} />
22
+ <IconButton
23
+ testId={testId}
24
+ aria-label="foo"
25
+ icon={<div data-testid="icon">foo</div>}
26
+ />
23
27
  )
24
28
 
25
29
  expect(getByTestId('icon')).toBeInTheDocument()
@@ -5,7 +5,7 @@ import Button from '../../atoms/Button'
5
5
  import type { ButtonProps } from '../../atoms/Button'
6
6
  import Icon from '../../atoms/Icon'
7
7
 
8
- export interface Props extends Omit<ButtonProps, 'children'> {
8
+ export interface Props extends Omit<ButtonProps, 'children' | 'aria-label'> {
9
9
  /**
10
10
  * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
11
11
  */
@@ -14,6 +14,11 @@ export interface Props extends Omit<ButtonProps, 'children'> {
14
14
  * A React component that will be rendered as an icon.
15
15
  */
16
16
  icon: ReactNode
17
+
18
+ /**
19
+ * Label to be required for accessibility.
20
+ */
21
+ 'aria-label': string
17
22
  }
18
23
 
19
24
  const IconButton = forwardRef<HTMLButtonElement, Props>(function IconButton(
@@ -7,14 +7,19 @@ import ShoppingCartIcon from '../../../atoms/Icon/stories/assets/ShoppingCart'
7
7
  import mdx from './IconButton.mdx'
8
8
 
9
9
  const IconButtonTemplate: Story<IconButtonProps> = (props) => (
10
- <Component {...props} icon={<ShoppingCartIcon />} />
10
+ <Component {...props} icon={<ShoppingCartIcon />} aria-label="Buy" />
11
11
  )
12
12
 
13
13
  export const Default = IconButtonTemplate.bind({})
14
14
 
15
15
  const IconButtonCustomTemplate: Story<IconButtonProps> = (props) => {
16
16
  return (
17
- <Component {...props} className="iconButton" icon={<ShoppingCartIcon />} />
17
+ <Component
18
+ {...props}
19
+ className="iconButton"
20
+ icon={<ShoppingCartIcon />}
21
+ aria-label="Buy"
22
+ />
18
23
  )
19
24
  }
20
25
 
@@ -16,7 +16,7 @@ export interface QuantitySelectorProps
16
16
  /**
17
17
  * Object with properties that will be passed forward the inner IconButton atom at the left of the input.
18
18
  */
19
- leftButtonProps: IconButtonProps
19
+ leftButtonProps: Omit<IconButtonProps, 'aria-label'>
20
20
 
21
21
  /**
22
22
  * Object with properties that will be passed forward the inner Input atom between the two buttons.
@@ -26,7 +26,7 @@ export interface QuantitySelectorProps
26
26
  /**
27
27
  * Object with properties that will be passed forward the inner IconButton atom at the right of the input.
28
28
  */
29
- rightButtonProps: IconButtonProps
29
+ rightButtonProps: Omit<IconButtonProps, 'aria-label'>
30
30
 
31
31
  /**
32
32
  * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).