Skip to content

Commit 699b9b0

Browse files
committed
feat: add key to components
1 parent 46b5a0a commit 699b9b0

File tree

31 files changed

+119
-9
lines changed

31 files changed

+119
-9
lines changed

src/components/button/button.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classNames from 'clsx'
22

3+
import { generateKeyId } from '../../lib/utils'
34
import { Flexbox, Icon, Loader } from '../..'
45

56
import './button.sass'
@@ -52,6 +53,7 @@ export function Button({
5253

5354
return (
5455
<button
56+
key={`aurora-button_${generateKeyId()}`}
5557
type={type}
5658
name={name}
5759
value={value}

src/components/card/card.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import classNames from 'clsx'
22

3+
import { generateKeyId } from '../../lib/utils'
4+
35
import './card.sass'
46

57
export interface CardProps {
@@ -12,6 +14,7 @@ export interface CardProps {
1214
export function Card({ children, fullWidth }: CardProps) {
1315
return (
1416
<div
17+
key={`aurora-card_${generateKeyId()}`}
1518
className={classNames('aurora-card', {
1619
'aurora-card--full-width': fullWidth
1720
})}

src/components/checkbox/checkbox.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
} from '@ark-ui/react'
99

1010
import { Icon } from '../icon'
11+
import { generateKeyId } from '../../lib/utils'
1112

1213
import './checkbox.sass'
1314

@@ -40,6 +41,7 @@ export function Checkbox({
4041

4142
return (
4243
<ArkCheckbox
44+
key={`aurora-checkbox_${generateKeyId()}`}
4345
className="aurora-checkbox"
4446
name={name}
4547
value={value}

src/components/circular-progress/circular-progress.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import classNames from 'clsx'
22

3+
import { generateKeyId } from '../../lib/utils'
4+
35
import './circular-progress.sass'
46

57
export interface CircularProgressProps {
@@ -19,6 +21,7 @@ export function CircularProgress({
1921

2022
return (
2123
<div
24+
key={`aurora-circular-progress_${generateKeyId()}`}
2225
className={classNames('aurora-circular-progress', {
2326
[`aurora-circular-progress--${size}`]: size
2427
})}

src/components/flexbox/flexbox.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'clsx'
22

33
import { type Size } from '../../lib/types'
4+
import { generateKeyId } from '../../lib/utils'
45

56
import './flexbox.sass'
67

@@ -44,6 +45,7 @@ export function Flexbox({
4445
}: FlexboxProps) {
4546
return (
4647
<div
48+
key={`aurora-flexbox_${generateKeyId()}`}
4749
className={classNames('aurora-flexbox', {
4850
'aurora-flexbox--full-width': fullWidth,
4951
'aurora-flexbox--padding': padding,

src/components/form/form.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { generateKeyId } from '../../lib/utils'
2+
13
import './form.sass'
24

35
export interface FormProps {
@@ -37,7 +39,12 @@ export function Form({ children, onSubmit }: FormProps) {
3739
}
3840

3941
return (
40-
<form autoComplete="off" className="aurora-form" onSubmit={handleSubmit}>
42+
<form
43+
autoComplete="off"
44+
className="aurora-form"
45+
onSubmit={handleSubmit}
46+
key={`aurora-form_${generateKeyId()}`}
47+
>
4148
{children}
4249
</form>
4350
)

src/components/icon-button/icon-button.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import classNames from 'clsx'
33

44
import { Icon, Loader } from '../..'
55
import { type IconProps } from '../icon'
6+
import { generateKeyId } from '../../lib/utils'
67

78
import './icon-button.sass'
89

@@ -55,6 +56,7 @@ export function IconButton({
5556

5657
return (
5758
<button
59+
key={`aurora-icon-button_${generateKeyId()}`}
5860
type={type}
5961
name={name}
6062
value={value}

src/components/icon/icon.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'clsx'
22

33
import type { Color, Size, IconType } from '../../lib/types'
4+
import { generateKeyId } from '../../lib/utils'
45

56
import './icon.sass'
67

@@ -47,6 +48,7 @@ export function Icon({
4748

4849
return (
4950
<span
51+
key={`aurora-icon_${generateKeyId()}`}
5052
className={classNames('aurora-icon', {
5153
[`aurora-icon--${size}`]: size,
5254
[`aurora-icon--${bgShape}`]: bgShape,

src/components/image/image.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import classNames from 'clsx'
22

3+
import { generateKeyId } from '../../lib/utils'
4+
35
import './image.sass'
46

57
export interface ImageProps {
@@ -31,6 +33,7 @@ export function Image({
3133
}: ImageProps) {
3234
return (
3335
<div
36+
key={`aurora-image_${generateKeyId()}`}
3437
className={classNames('aurora-image', {
3538
[`aurora-image--${shape}`]: shape,
3639
[`aurora-image--${borderColor}-border`]: borderColor,

src/components/input/input.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useState } from 'react'
22
import classNames from 'clsx'
33

44
import { Text, Icon } from '../..'
5+
import { generateKeyId } from '../../lib/utils'
56

67
import './input.sass'
78

@@ -68,7 +69,10 @@ export function Input({
6869
}
6970

7071
return (
71-
<div className="aurora-input-container">
72+
<div
73+
className="aurora-input-container"
74+
key={`aurora-input_${generateKeyId()}`}
75+
>
7276
{multiline ? (
7377
<textarea
7478
name={name}

src/components/link/link.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import classNames from 'clsx'
22

33
import { Text } from '../..'
44
import { type Size } from '../../lib/types'
5+
import { generateKeyId } from '../../lib/utils'
56

67
import './link.sass'
78

@@ -15,7 +16,12 @@ export interface LinkProps {
1516

1617
export function Link({ href, children, fontSize }: LinkProps) {
1718
return (
18-
<a className={classNames('aurora-link')} href={href} target="_blank">
19+
<a
20+
className={classNames('aurora-link')}
21+
href={href}
22+
target="_blank"
23+
key={`aurora-link_${generateKeyId()}`}
24+
>
1925
<Text fontSize={fontSize}>{children}</Text>
2026
</a>
2127
)

src/components/lists/list-header/list-header.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import classNames from 'clsx'
22

33
import { Text } from '../../..'
4+
import { generateKeyId } from '../../../lib/utils'
45

56
export interface ListHeaderProps {
67
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -12,6 +13,7 @@ export interface ListHeaderProps {
1213
export function ListHeader({ children, align }: ListHeaderProps) {
1314
return (
1415
<div
16+
key={`aurora-list-header_${generateKeyId()}`}
1517
className={classNames('aurora-list-header', {
1618
[`aurora-list-header--${align}`]: align
1719
})}

src/components/lists/list-item/list-item.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import classNames from 'clsx'
22

3+
import { generateKeyId } from '../../../lib/utils'
34
import { Icon } from '../../..'
45

56
interface ListItemOnClickData {
@@ -32,6 +33,7 @@ export function ListItem({
3233

3334
return (
3435
<li
36+
key={`aurora-list-item_${generateKeyId()}`}
3537
data-aurora-name={name}
3638
value={value}
3739
className={classNames('aurora-list-item', {

src/components/lists/list/list.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { generateKeyId } from '../../../lib/utils'
2+
13
import './list.sass'
24

35
export interface ListProps {
@@ -7,5 +9,9 @@ export interface ListProps {
79
}
810

911
export function List({ children }: ListProps) {
10-
return <ul className="aurora-list">{children}</ul>
12+
return (
13+
<ul className="aurora-list" key={`aurora-list_${generateKeyId()}`}>
14+
{children}
15+
</ul>
16+
)
1117
}

src/components/loader/loader.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { generateKeyId } from '../../lib/utils'
2+
13
import './loader.sass'
24

35
// interface Props {
@@ -8,7 +10,10 @@ export interface LoaderProps {}
810

911
export function Loader() {
1012
return (
11-
<span className="aurora-loader" />
13+
<span
14+
className="aurora-loader"
15+
key={`aurora-loader_${generateKeyId()}`}
16+
/>
1217
/*<span
1318
className={classNames('aurora-loader', {
1419
[`aurora-loader--${size}`]: size

src/components/progress/progress.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import classNames from 'clsx'
22

3+
import { generateKeyId } from '../../lib/utils'
4+
35
import './progress.sass'
46

57
export interface ProgressProps {
@@ -15,6 +17,7 @@ export function Progress({
1517
}: ProgressProps) {
1618
return (
1719
<div
20+
key={`aurora-progress_${generateKeyId()}`}
1821
className={classNames('aurora-progress', {
1922
[`aurora-progress--${orientation}`]: orientation,
2023
[`aurora-progress--${size}`]: size

src/components/radios/radio-group/radio-group.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {
33
type RadioGroupProps as ArkRadioGroupProps
44
} from '@ark-ui/react'
55

6+
import { generateKeyId } from '../../../lib/utils'
7+
68
import './radio-group.sass'
79

810
interface RadioGroupOnChangeData {
@@ -29,6 +31,7 @@ export function RadioGroup({
2931
}: RadioGroupProps) {
3032
return (
3133
<ArkRadioGroup
34+
key={`aurora-radio-group_${generateKeyId()}`}
3235
className="aurora-radio-group"
3336
name={name}
3437
defaultValue={defaultValue}

src/components/radios/radio/radio.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@ import {
66
type RadioProps as ArkRadioProps
77
} from '@ark-ui/react'
88

9+
import { generateKeyId } from '../../../lib/utils'
10+
911
export interface RadioProps extends Pick<ArkRadioProps, 'value' | 'disabled'> {
1012
label: string
1113
}
1214

1315
export function Radio({ label, value, disabled }: RadioProps) {
1416
return (
15-
<ArkRadio className="aurora-radio" value={value} disabled={disabled}>
17+
<ArkRadio
18+
key={`aurora-radio_${generateKeyId()}`}
19+
className="aurora-radio"
20+
value={value}
21+
disabled={disabled}
22+
>
1623
<RadioInput />
1724
<RadioControl className="aurora-radio-control" />
1825
<RadioLabel className="aurora-radio-label">{label}</RadioLabel>

src/components/range-slider/range-slider.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import {
99
type SliderProps as ArkSliderProps
1010
} from '@ark-ui/react'
1111

12+
import { generateKeyId } from '../../lib/utils'
13+
1214
import './range-slider.sass'
1315

1416
interface RangeSliderOnChangeData {
@@ -54,6 +56,7 @@ export function RangeSlider({
5456

5557
return (
5658
<div
59+
key={`aurora-range-slider_${generateKeyId()}`}
5760
className="aurora-range-slider-container"
5861
style={{
5962
width,

src/components/scroll-container/scroll-container.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import classNames from 'clsx'
22

3+
import { generateKeyId } from '../../lib/utils'
4+
35
import './scroll-container.sass'
46

57
export interface ScrollContainerProps {
@@ -18,6 +20,7 @@ export function ScrollContainer({
1820
}: ScrollContainerProps) {
1921
return (
2022
<div
23+
key={`aurora-scroll-container_${generateKeyId()}`}
2124
className={classNames(
2225
'aurora-scroll-container',
2326
`aurora-scroll-container--${orientation}`

src/components/selects/select-option/select-option.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import {
33
type SelectOptionProps as ArkSelectOptionProps
44
} from '@ark-ui/react'
55

6+
import { generateKeyId } from '../../../lib/utils'
7+
68
export interface SelectOptionProps
79
extends Pick<ArkSelectOptionProps, 'label' | 'value'> {
810
disabled?: boolean
@@ -17,6 +19,7 @@ export function SelectOption({
1719
}: SelectOptionProps) {
1820
return (
1921
<ArkSelectOption
22+
key={`aurora-select-option_${generateKeyId()}`}
2023
className="aurora-select-option"
2124
label={label}
2225
value={value}

src/components/selects/select/select.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
import classNames from 'clsx'
1010

1111
import { Flexbox, Icon } from '../../..'
12+
import { generateKeyId } from '../../../lib/utils'
1213

1314
import './select.sass'
1415

@@ -42,6 +43,7 @@ export function Select({
4243
}: SelectProps) {
4344
return (
4445
<ArkSelect
46+
key={`aurora-select_${generateKeyId()}`}
4547
closeOnSelect
4648
selectedOption={selectedOption}
4749
defaultValue={defaultValue}

src/components/status/status.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import classNames from 'clsx'
22

33
import type { IconType } from '../../lib/types'
44
import { Icon, Flexbox } from '../..'
5+
import { generateKeyId } from '../../lib/utils'
56

67
import './status.sass'
78

@@ -21,6 +22,7 @@ export function Status({
2122
}: StatusProps) {
2223
return (
2324
<div
25+
key={`aurora-status_${generateKeyId()}`}
2426
className={classNames('aurora-status', {
2527
[`aurora-status--${color}`]: color
2628
})}

0 commit comments

Comments
 (0)