@vygruppen/spor-react 12.3.0 → 12.3.2

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.
@@ -45,39 +45,41 @@ export type SwitchProps = Exclude<
45
45
  * ```
46
46
  */
47
47
 
48
- export const Switch = forwardRef<HTMLInputElement, SwitchProps>((props) => {
49
- const {
50
- rootRef,
51
- size = "md",
52
- label,
53
- invalid,
54
- errorText,
55
- helperText,
56
- ...rest
57
- } = props;
58
- const recipe = useSlotRecipe({ key: "switch" });
59
- const styles = recipe({ size });
48
+ export const Switch = forwardRef<HTMLInputElement, SwitchProps>(
49
+ (props, ref) => {
50
+ const {
51
+ rootRef,
52
+ size = "md",
53
+ label,
54
+ invalid,
55
+ errorText,
56
+ helperText,
57
+ ...rest
58
+ } = props;
59
+ const recipe = useSlotRecipe({ key: "switch" });
60
+ const styles = recipe({ size });
60
61
 
61
- return (
62
- <Field
63
- style={{ width: "auto" }}
64
- invalid={invalid}
65
- errorText={errorText}
66
- helperText={helperText}
67
- >
68
- <ChakraSwitch.Root
69
- ref={rootRef}
70
- {...rest}
71
- checked={props.checked}
72
- css={styles.root}
62
+ return (
63
+ <Field
64
+ style={{ width: "auto" }}
65
+ invalid={invalid}
66
+ errorText={errorText}
67
+ helperText={helperText}
73
68
  >
74
- <ChakraSwitch.Label>{label}</ChakraSwitch.Label>
75
- <ChakraSwitch.HiddenInput />
76
- <ChakraSwitch.Control css={styles.control}>
77
- <ChakraSwitch.Thumb />
78
- </ChakraSwitch.Control>
79
- </ChakraSwitch.Root>
80
- </Field>
81
- );
82
- });
69
+ <ChakraSwitch.Root
70
+ ref={rootRef}
71
+ {...rest}
72
+ checked={props.checked}
73
+ css={styles.root}
74
+ >
75
+ <ChakraSwitch.Label>{label}</ChakraSwitch.Label>
76
+ <ChakraSwitch.HiddenInput ref={ref} />
77
+ <ChakraSwitch.Control css={styles.control}>
78
+ <ChakraSwitch.Thumb />
79
+ </ChakraSwitch.Control>
80
+ </ChakraSwitch.Root>
81
+ </Field>
82
+ );
83
+ },
84
+ );
83
85
  Switch.displayName = "Switch";
@@ -63,17 +63,20 @@ export type LineIconProps = Exclude<BoxProps, "variant"> &
63
63
  */
64
64
 
65
65
  export const LineIcon = forwardRef<HTMLDivElement, LineIconProps>(
66
- function LineIcon({
67
- variant,
68
- size = "md",
69
- foregroundColor,
66
+ function LineIcon(
67
+ {
68
+ variant,
69
+ size = "md",
70
+ foregroundColor,
70
71
 
71
- disabled,
72
- style,
73
- target = "lineIcon",
74
- label,
75
- ...rest
76
- }) {
72
+ disabled,
73
+ style,
74
+ target = "lineIcon",
75
+ label,
76
+ ...rest
77
+ },
78
+ ref,
79
+ ) {
77
80
  const recipe = useSlotRecipe({ key: "lineIcon" });
78
81
  const styles = recipe({ variant, size, ...rest });
79
82
 
@@ -112,6 +115,7 @@ export const LineIcon = forwardRef<HTMLDivElement, LineIconProps>(
112
115
  borderWidth={borderContainer()}
113
116
  borderColor={variant === "walk" ? "core.outline" : "transparent"}
114
117
  aria-label={label}
118
+ ref={ref}
115
119
  >
116
120
  <Icon css={styles.icon} />
117
121
  </Box>
@@ -88,14 +88,17 @@ const ProgressLoaderWrapper = chakra("div", progressLoaderRecipe);
88
88
  */
89
89
 
90
90
  export const ProgressLoader = forwardRef<HTMLDivElement, ProgressLoaderProps>(
91
- ({
92
- value,
93
- label,
94
- labelRotationDelay = 5000,
95
- "aria-label": ariaLabel,
96
- width,
97
- ...rest
98
- }: ProgressLoaderProps) => {
91
+ (
92
+ {
93
+ value,
94
+ label,
95
+ labelRotationDelay = 5000,
96
+ "aria-label": ariaLabel,
97
+ width,
98
+ ...rest
99
+ },
100
+ ref,
101
+ ) => {
99
102
  const { t } = useTranslation();
100
103
  const currentLoadingText = useRotatingLabel({
101
104
  label,
@@ -124,6 +127,7 @@ export const ProgressLoader = forwardRef<HTMLDivElement, ProgressLoaderProps>(
124
127
  aria-valuemax={100}
125
128
  aria-label={ariaLabel ?? t(texts.fallbackLabel(value ?? "?"))}
126
129
  {...rest}
130
+ ref={ref}
127
131
  >
128
132
  <chakra.svg as="svg" viewBox="0 0 246 78" fill="none">
129
133
  <path
@@ -35,7 +35,7 @@ export type ProgressIndicatorProps = BoxProps &
35
35
  export const ProgressIndicator = forwardRef<
36
36
  HTMLDivElement,
37
37
  ProgressIndicatorProps
38
- >(({ numberOfSteps, activeStep }) => {
38
+ >(({ numberOfSteps, activeStep }, ref) => {
39
39
  const { t } = useTranslation();
40
40
  const recipe = useSlotRecipe({
41
41
  key: "progressIndicator",
@@ -51,6 +51,7 @@ export const ProgressIndicator = forwardRef<
51
51
  aria-valuemax={numberOfSteps}
52
52
  aria-valuenow={activeStep}
53
53
  aria-valuetext={t(texts.stepsOf(activeStep, numberOfSteps))}
54
+ ref={ref}
54
55
  >
55
56
  <Box css={styles.container}>
56
57
  {Array.from({ length: numberOfSteps }, (_, i) => (
@@ -37,6 +37,7 @@ export const tableSlotRecipe = defineSlotRecipe({
37
37
  ...numericStyles,
38
38
  paddingX: 1.5,
39
39
  paddingY: 1,
40
+ width: "100%",
40
41
  },
41
42
  footer: {
42
43
  fontWeight: "medium",