@vygruppen/spor-react 12.24.15 → 13.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/.turbo/turbo-build.log +10 -10
- package/.turbo/turbo-postinstall.log +4 -3
- package/CHANGELOG.md +25 -0
- package/dist/index.cjs +2888 -2534
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +921 -572
- package/dist/index.d.ts +921 -572
- package/dist/index.mjs +2860 -2517
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -8
- package/src/accordion/Accordion.tsx +34 -29
- package/src/accordion/Expandable.tsx +20 -21
- package/src/alert/Alert.tsx +7 -5
- package/src/alert/AlertIcon.tsx +19 -20
- package/src/alert/ExpandableAlert.tsx +65 -64
- package/src/alert/ServiceAlert.tsx +78 -78
- package/src/breadcrumb/Breadcrumb.tsx +37 -34
- package/src/button/Button.tsx +64 -57
- package/src/button/ButtonGroup.tsx +12 -10
- package/src/button/Clipboard.tsx +21 -18
- package/src/button/CloseButton.tsx +19 -17
- package/src/button/FloatingActionButton.tsx +41 -47
- package/src/button/IconButton.tsx +20 -18
- package/src/calendar/CalendarContext.tsx +1 -1
- package/src/color-mode/color-mode.tsx +7 -5
- package/src/datepicker/CalendarTriggerButton.tsx +11 -7
- package/src/datepicker/DateField.tsx +53 -51
- package/src/datepicker/DatePicker.tsx +127 -134
- package/src/datepicker/DateTimeSegment.tsx +44 -40
- package/src/datepicker/StyledField.tsx +39 -36
- package/src/dialog/Dialog.tsx +14 -11
- package/src/dialog/Drawer.tsx +74 -67
- package/src/input/AttachedInputs.tsx +35 -41
- package/src/input/Autocomplete.tsx +118 -129
- package/src/input/CardSelect.tsx +67 -65
- package/src/input/Checkbox.tsx +19 -17
- package/src/input/CheckboxGroup.tsx +0 -2
- package/src/input/ChoiceChip.tsx +42 -38
- package/src/input/Combobox.tsx +4 -4
- package/src/input/CountryCodeSelect.tsx +8 -8
- package/src/input/Field.tsx +78 -75
- package/src/input/FloatingLabel.tsx +6 -8
- package/src/input/Input.tsx +87 -92
- package/src/input/ListBox.tsx +3 -4
- package/src/input/Menu.tsx +241 -0
- package/src/input/NativeSelect.tsx +7 -5
- package/src/input/NumericStepper.tsx +15 -12
- package/src/input/PasswordInput.tsx +65 -61
- package/src/input/PhoneNumberInput.tsx +7 -7
- package/src/input/Popover.tsx +52 -55
- package/src/input/Radio.tsx +16 -11
- package/src/input/SearchInput.tsx +32 -31
- package/src/input/Select.tsx +106 -96
- package/src/input/Switch.tsx +43 -41
- package/src/input/Textarea.tsx +68 -66
- package/src/input/index.ts +1 -0
- package/src/layout/PressableCard.tsx +11 -10
- package/src/layout/RadioCard.tsx +57 -53
- package/src/layout/Separator.tsx +8 -7
- package/src/layout/StaticCard.tsx +11 -10
- package/src/linjetag/LineIcon.tsx +48 -54
- package/src/linjetag/TravelTag.tsx +57 -59
- package/src/link/TextLink.tsx +50 -40
- package/src/loader/ProgressBar.tsx +41 -46
- package/src/loader/ProgressLoader.tsx +83 -86
- package/src/loader/Skeleton.tsx +56 -48
- package/src/logo/CargonetLogo.tsx +88 -87
- package/src/logo/VyLogo.tsx +80 -77
- package/src/logo/VyLogoPride.tsx +137 -135
- package/src/media-controller/JumpButton.tsx +30 -28
- package/src/media-controller/PlayPauseButton.tsx +8 -7
- package/src/media-controller/SkipButton.tsx +28 -26
- package/src/nudge/Nudge.tsx +66 -70
- package/src/pagination/Pagination.tsx +52 -46
- package/src/popover/index.tsx +46 -41
- package/src/progress-indicator/ProgressIndicator.tsx +10 -7
- package/src/stepper/Stepper.tsx +84 -81
- package/src/tab/Tabs.tsx +8 -4
- package/src/table/Table.tsx +89 -109
- package/src/theme/slot-recipes/anatomy.ts +14 -0
- package/src/theme/slot-recipes/index.ts +2 -0
- package/src/theme/slot-recipes/menu.ts +111 -0
- package/src/tooltip.tsx +26 -22
- package/src/typography/Badge.tsx +8 -5
- package/src/typography/Code.tsx +8 -5
- package/src/typography/Heading.tsx +22 -23
- package/src/typography/Text.tsx +11 -9
- package/tsconfig.json +1 -0
package/src/link/TextLink.tsx
CHANGED
|
@@ -8,7 +8,12 @@ import {
|
|
|
8
8
|
LinkOutOutline18Icon,
|
|
9
9
|
LinkOutOutline24Icon,
|
|
10
10
|
} from "@vygruppen/spor-icon-react";
|
|
11
|
-
import React, {
|
|
11
|
+
import React, {
|
|
12
|
+
cloneElement,
|
|
13
|
+
isValidElement,
|
|
14
|
+
PropsWithChildren,
|
|
15
|
+
ReactNode,
|
|
16
|
+
} from "react";
|
|
12
17
|
|
|
13
18
|
import { createTexts, useTranslation } from "@/i18n";
|
|
14
19
|
|
|
@@ -46,43 +51,25 @@ const ExternalIcon = ({
|
|
|
46
51
|
</>
|
|
47
52
|
);
|
|
48
53
|
|
|
49
|
-
export const TextLink =
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
export const TextLink = ({
|
|
55
|
+
ref,
|
|
56
|
+
children,
|
|
57
|
+
external,
|
|
58
|
+
href,
|
|
59
|
+
...props
|
|
60
|
+
}: LinkProps & {
|
|
61
|
+
ref?: React.RefObject<HTMLAnchorElement>;
|
|
62
|
+
}) => {
|
|
63
|
+
const { t } = useTranslation();
|
|
52
64
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
65
|
+
const isExternal =
|
|
66
|
+
external ??
|
|
67
|
+
Boolean(href?.startsWith("http://") || href?.startsWith("https://"));
|
|
56
68
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// If asChild is true, we need to clone the children and add the external icon
|
|
60
|
-
if (props.asChild && isValidElement(children)) {
|
|
61
|
-
return (
|
|
62
|
-
<ChakraLink
|
|
63
|
-
href={href}
|
|
64
|
-
{...props}
|
|
65
|
-
ref={ref}
|
|
66
|
-
{...(isExternal && {
|
|
67
|
-
target: "_blank",
|
|
68
|
-
rel: "noopener noreferrer",
|
|
69
|
-
})}
|
|
70
|
-
>
|
|
71
|
-
{cloneElement(children as React.ReactElement, {
|
|
72
|
-
...children.props,
|
|
73
|
-
children: (
|
|
74
|
-
<>
|
|
75
|
-
{children.props.children}
|
|
76
|
-
{isExternal && (
|
|
77
|
-
<ExternalIcon label={externalLabel} size={props.size} />
|
|
78
|
-
)}
|
|
79
|
-
</>
|
|
80
|
-
),
|
|
81
|
-
})}
|
|
82
|
-
</ChakraLink>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
69
|
+
const externalLabel = t ? t(texts.externalLink) : texts.externalLink.en;
|
|
85
70
|
|
|
71
|
+
// If asChild is true, we need to clone the children and add the external icon
|
|
72
|
+
if (props.asChild && isValidElement(children)) {
|
|
86
73
|
return (
|
|
87
74
|
<ChakraLink
|
|
88
75
|
href={href}
|
|
@@ -93,13 +80,36 @@ export const TextLink = forwardRef<HTMLAnchorElement, LinkProps>(
|
|
|
93
80
|
rel: "noopener noreferrer",
|
|
94
81
|
})}
|
|
95
82
|
>
|
|
96
|
-
{children}
|
|
97
|
-
|
|
83
|
+
{cloneElement(children as React.ReactElement<{ children: ReactNode }>, {
|
|
84
|
+
...(children.props as object),
|
|
85
|
+
children: (
|
|
86
|
+
<>
|
|
87
|
+
{(children.props as PropsWithChildren).children}
|
|
88
|
+
{isExternal && (
|
|
89
|
+
<ExternalIcon label={externalLabel} size={props.size} />
|
|
90
|
+
)}
|
|
91
|
+
</>
|
|
92
|
+
),
|
|
93
|
+
})}
|
|
98
94
|
</ChakraLink>
|
|
99
95
|
);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<ChakraLink
|
|
100
|
+
href={href}
|
|
101
|
+
{...props}
|
|
102
|
+
ref={ref}
|
|
103
|
+
{...(isExternal && {
|
|
104
|
+
target: "_blank",
|
|
105
|
+
rel: "noopener noreferrer",
|
|
106
|
+
})}
|
|
107
|
+
>
|
|
108
|
+
{children}
|
|
109
|
+
{isExternal && <ExternalIcon label={externalLabel} size={props.size} />}
|
|
110
|
+
</ChakraLink>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
103
113
|
|
|
104
114
|
const texts = createTexts({
|
|
105
115
|
externalLink: {
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
UseProgressProps,
|
|
7
7
|
useSlotRecipe,
|
|
8
8
|
} from "@chakra-ui/react";
|
|
9
|
-
import React, {
|
|
9
|
+
import React, { PropsWithChildren } from "react";
|
|
10
10
|
|
|
11
11
|
import { progressBarRecipe } from "../theme/slot-recipes/progress-bar";
|
|
12
12
|
import { useRotatingLabel } from "./useRotatingLabel";
|
|
@@ -75,50 +75,45 @@ export type ProgressBarProps = BoxProps &
|
|
|
75
75
|
* ```
|
|
76
76
|
*/
|
|
77
77
|
|
|
78
|
-
export const ProgressBar =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
});
|
|
78
|
+
export const ProgressBar = ({
|
|
79
|
+
ref,
|
|
80
|
+
value,
|
|
81
|
+
label,
|
|
82
|
+
labelRotationDelay = 5000,
|
|
83
|
+
isActive = true,
|
|
84
|
+
showValueText = false,
|
|
85
|
+
height = "0.5rem",
|
|
86
|
+
css,
|
|
87
|
+
...rest
|
|
88
|
+
}: ProgressBarProps & {
|
|
89
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
90
|
+
}) => {
|
|
91
|
+
const recipe = useSlotRecipe({ key: "progressbar" });
|
|
92
|
+
const styles = recipe({});
|
|
93
|
+
const currentLoadingText = useRotatingLabel({
|
|
94
|
+
label,
|
|
95
|
+
delay: labelRotationDelay,
|
|
96
|
+
});
|
|
98
97
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
return (
|
|
99
|
+
<Progress.Root
|
|
100
|
+
css={{ ...styles.container, ...css }}
|
|
101
|
+
ref={ref}
|
|
102
|
+
value={value}
|
|
103
|
+
{...rest}
|
|
104
|
+
>
|
|
105
|
+
<Progress.Track
|
|
106
|
+
height={height}
|
|
107
|
+
css={isActive ? styles.background : styles.disabledBackground}
|
|
105
108
|
>
|
|
106
|
-
<Progress.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
>
|
|
110
|
-
|
|
111
|
-
</Progress.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
)}
|
|
118
|
-
|
|
119
|
-
{showValueText && <Progress.ValueText>{value}%</Progress.ValueText>}
|
|
120
|
-
</Progress.Root>
|
|
121
|
-
);
|
|
122
|
-
},
|
|
123
|
-
);
|
|
124
|
-
ProgressBar.displayName = "ProgressBar";
|
|
109
|
+
<Progress.Range css={styles.progress} />
|
|
110
|
+
</Progress.Track>
|
|
111
|
+
{label && (
|
|
112
|
+
<Progress.Label css={styles.description}>
|
|
113
|
+
{currentLoadingText}
|
|
114
|
+
</Progress.Label>
|
|
115
|
+
)}
|
|
116
|
+
{showValueText && <Progress.ValueText>{value}%</Progress.ValueText>}
|
|
117
|
+
</Progress.Root>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { BoxProps, chakra, RecipeVariantProps, Text } from "@chakra-ui/react";
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useEffect, useId, useRef, useState } from "react";
|
|
4
4
|
import { useProgressBar } from "react-aria";
|
|
5
5
|
|
|
6
6
|
import { createTexts, useTranslation } from "..";
|
|
@@ -87,93 +87,90 @@ const ProgressLoaderWrapper = chakra("div", progressLoaderRecipe);
|
|
|
87
87
|
* ```
|
|
88
88
|
*/
|
|
89
89
|
|
|
90
|
-
export const ProgressLoader =
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
} = usePathLength(value);
|
|
90
|
+
export const ProgressLoader = ({
|
|
91
|
+
ref,
|
|
92
|
+
value,
|
|
93
|
+
label,
|
|
94
|
+
labelRotationDelay = 5000,
|
|
95
|
+
"aria-label": ariaLabel,
|
|
96
|
+
width,
|
|
97
|
+
...rest
|
|
98
|
+
}: ProgressLoaderProps & {
|
|
99
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
100
|
+
}) => {
|
|
101
|
+
const { t } = useTranslation();
|
|
102
|
+
const currentLoadingText = useRotatingLabel({
|
|
103
|
+
label,
|
|
104
|
+
delay: labelRotationDelay,
|
|
105
|
+
});
|
|
106
|
+
const { labelProps, progressBarProps } = useProgressBar({
|
|
107
|
+
isIndeterminate: value === undefined,
|
|
108
|
+
value,
|
|
109
|
+
"aria-label": ariaLabel ?? t(texts.fallbackLabel(value ?? "?")),
|
|
110
|
+
});
|
|
111
|
+
const {
|
|
112
|
+
pathRef,
|
|
113
|
+
pathLength: progressPathLength,
|
|
114
|
+
progressOffset,
|
|
115
|
+
} = usePathLength(value);
|
|
117
116
|
|
|
118
|
-
|
|
117
|
+
const id = useId();
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
);
|
|
176
|
-
ProgressLoader.displayName = "ProgressLoader";
|
|
119
|
+
return (
|
|
120
|
+
<ProgressLoaderWrapper
|
|
121
|
+
{...progressBarProps}
|
|
122
|
+
width={width}
|
|
123
|
+
role="progressbar"
|
|
124
|
+
aria-valuenow={value}
|
|
125
|
+
aria-valuemin={0}
|
|
126
|
+
aria-valuemax={100}
|
|
127
|
+
aria-label={ariaLabel ?? t(texts.fallbackLabel(value ?? "?"))}
|
|
128
|
+
{...rest}
|
|
129
|
+
ref={ref}
|
|
130
|
+
>
|
|
131
|
+
<chakra.svg as="svg" viewBox="0 0 246 78" fill="none">
|
|
132
|
+
<path
|
|
133
|
+
id={`${id}-start-dot`}
|
|
134
|
+
d="M14.0479 44.8251C19.4332 44.8251 23.7988 40.5242 23.7988 35.2187C23.7988 29.9133 19.4332 25.6124 14.0479 25.6124C8.66254 25.6124 4.29688 29.9133 4.29688 35.2187C4.29688 40.5242 8.66254 44.8251 14.0479 44.8251Z"
|
|
135
|
+
fill="#FFB466"
|
|
136
|
+
/>
|
|
137
|
+
<path
|
|
138
|
+
id={`${id}-track`}
|
|
139
|
+
d="M204.911 39.1156C204.911 39.1156 175.012 46.8319 157.651 30.4354C140.29 14.0388 121 21.7547 110.391 47.6529C103.22 65.157 78.9634 67.0859 67.9533 47.6529C59.8376 33.3287 36.125 37.1866 36.125 37.1866"
|
|
140
|
+
strokeWidth="13.6469"
|
|
141
|
+
strokeLinecap="round"
|
|
142
|
+
strokeLinejoin="round"
|
|
143
|
+
/>
|
|
144
|
+
<path
|
|
145
|
+
id={`${id}-progress`}
|
|
146
|
+
d="M204.911 39.1156C204.911 39.1156 175.012 46.8319 157.651 30.4354C140.29 14.0388 121 21.7547 110.391 47.6529C103.22 65.157 78.9634 67.0859 67.9533 47.6529C59.8376 33.3287 36.125 37.1866 36.125 37.1866"
|
|
147
|
+
strokeWidth="13.6469"
|
|
148
|
+
strokeLinecap="round"
|
|
149
|
+
strokeLinejoin="round"
|
|
150
|
+
strokeDasharray={progressPathLength}
|
|
151
|
+
strokeDashoffset={progressOffset}
|
|
152
|
+
style={{ transition: "stroke-dashoffset .2s ease-out" }}
|
|
153
|
+
ref={pathRef}
|
|
154
|
+
/>
|
|
155
|
+
<path
|
|
156
|
+
id={`${id}-end-dot`}
|
|
157
|
+
d="M226.025 44.8251C231.411 44.8251 235.776 40.5242 235.776 35.2187C235.776 29.9133 231.411 25.6124 226.025 25.6124C220.64 25.6124 216.274 29.9133 216.274 35.2187C216.274 40.5242 220.64 44.8251 226.025 44.8251Z"
|
|
158
|
+
fill="#688CBA"
|
|
159
|
+
/>
|
|
160
|
+
</chakra.svg>
|
|
161
|
+
{currentLoadingText && (
|
|
162
|
+
<Text
|
|
163
|
+
textAlign="center"
|
|
164
|
+
marginTop={2}
|
|
165
|
+
fontWeight="bold"
|
|
166
|
+
{...labelProps}
|
|
167
|
+
>
|
|
168
|
+
{currentLoadingText}
|
|
169
|
+
</Text>
|
|
170
|
+
)}
|
|
171
|
+
</ProgressLoaderWrapper>
|
|
172
|
+
);
|
|
173
|
+
};
|
|
177
174
|
|
|
178
175
|
const texts = createTexts({
|
|
179
176
|
fallbackLabel: (value) => ({
|
package/src/loader/Skeleton.tsx
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
useRecipe,
|
|
12
12
|
} from "@chakra-ui/react";
|
|
13
13
|
import * as React from "react";
|
|
14
|
-
import { forwardRef } from "react";
|
|
15
14
|
|
|
16
15
|
import { skeletonRecipe } from "@/theme/recipes/skeleton";
|
|
17
16
|
|
|
@@ -22,10 +21,12 @@ export type SkeletonCircleProps = ChakraSkeletonProps &
|
|
|
22
21
|
size?: CircleProps["size"];
|
|
23
22
|
};
|
|
24
23
|
|
|
25
|
-
export const SkeletonCircle =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
export const SkeletonCircle = function SkeletonCircle({
|
|
25
|
+
ref,
|
|
26
|
+
...props
|
|
27
|
+
}: SkeletonCircleProps & {
|
|
28
|
+
ref?: React.RefObject<HTMLDivElement>;
|
|
29
|
+
}) {
|
|
29
30
|
const recipe = useRecipe({ key: "skeleton" });
|
|
30
31
|
|
|
31
32
|
const [recipeProps, restProps] = recipe.splitVariantProps({
|
|
@@ -41,58 +42,65 @@ export const SkeletonCircle = React.forwardRef<
|
|
|
41
42
|
<ChakraSkeleton css={{ ...recipe(recipeProps), ...css }} {...rest} />
|
|
42
43
|
</Circle>
|
|
43
44
|
);
|
|
44
|
-
}
|
|
45
|
+
};
|
|
45
46
|
|
|
46
47
|
export type SkeletonTextProps = ChakraSkeletonProps &
|
|
47
48
|
SkeletonVariantProps & {
|
|
48
49
|
noOfLines?: number;
|
|
49
50
|
};
|
|
50
51
|
|
|
51
|
-
export const SkeletonText =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
export const SkeletonText = function SkeletonText(
|
|
53
|
+
props: SkeletonTextProps & { ref?: React.Ref<HTMLDivElement> },
|
|
54
|
+
) {
|
|
55
|
+
const recipe = useRecipe({ key: "skeleton" });
|
|
56
|
+
const [recipeProps, restProps] = recipe.splitVariantProps({
|
|
57
|
+
loading: true,
|
|
58
|
+
variant: "pulse",
|
|
59
|
+
...props,
|
|
60
|
+
});
|
|
60
61
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{...rest}
|
|
70
|
-
/>
|
|
71
|
-
))}
|
|
72
|
-
</Stack>
|
|
73
|
-
);
|
|
74
|
-
},
|
|
75
|
-
);
|
|
62
|
+
const {
|
|
63
|
+
noOfLines = 3,
|
|
64
|
+
height = "0.5rem",
|
|
65
|
+
gap,
|
|
66
|
+
css,
|
|
67
|
+
ref,
|
|
68
|
+
...rest
|
|
69
|
+
} = restProps;
|
|
76
70
|
|
|
71
|
+
return (
|
|
72
|
+
<Stack gap={gap} width="full" ref={ref}>
|
|
73
|
+
{Array.from({ length: noOfLines }).map((_, index) => (
|
|
74
|
+
<ChakraSkeleton
|
|
75
|
+
key={index}
|
|
76
|
+
height={height}
|
|
77
|
+
css={{ ...recipe(recipeProps), ...css }}
|
|
78
|
+
_last={{ maxW: "80%" }}
|
|
79
|
+
{...rest}
|
|
80
|
+
/>
|
|
81
|
+
))}
|
|
82
|
+
</Stack>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
77
85
|
export type SkeletonProps = ChakraSkeletonProps & SkeletonVariantProps;
|
|
78
86
|
|
|
79
|
-
export const Skeleton =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
export const Skeleton = function Skeleton(
|
|
88
|
+
props: SkeletonProps & { ref?: React.Ref<HTMLDivElement> },
|
|
89
|
+
) {
|
|
90
|
+
const recipe = useRecipe({ key: "skeleton" });
|
|
91
|
+
const [recipeProps, restProps] = recipe.splitVariantProps({
|
|
92
|
+
loading: true,
|
|
93
|
+
variant: "pulse",
|
|
94
|
+
...props,
|
|
95
|
+
});
|
|
87
96
|
|
|
88
|
-
|
|
97
|
+
const { css, ref, ...rest } = restProps;
|
|
89
98
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
);
|
|
99
|
+
return (
|
|
100
|
+
<ChakraSkeleton
|
|
101
|
+
ref={ref}
|
|
102
|
+
css={{ ...recipe(recipeProps), ...css }}
|
|
103
|
+
{...rest}
|
|
104
|
+
/>
|
|
105
|
+
);
|
|
106
|
+
};
|