@vygruppen/spor-react 8.2.0 → 8.3.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @vygruppen/spor-react@8.2.0 build
2
+ > @vygruppen/spor-react@8.3.0 build
3
3
  > tsup src/index.tsx --dts --treeshake --format cjs,esm
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -10,13 +10,13 @@
10
10
  ESM Build start
11
11
  "Collapse" is imported from external module "@chakra-ui/react" but never used in "dist/index.js".
12
12
  DTS Build start
13
- "Collapse" is imported from external module "@chakra-ui/react" but never used in "dist/chunk-D4IHIS3H.mjs".
14
- CJS dist/index.js 503.28 KB
15
- CJS ⚡️ Build success in 2095ms
13
+ "Collapse" is imported from external module "@chakra-ui/react" but never used in "dist/chunk-42ZK3WXN.mjs".
14
+ CJS dist/index.js 504.82 KB
15
+ CJS ⚡️ Build success in 2190ms
16
16
  ESM dist/index.mjs 2.01 KB
17
- ESM dist/CountryCodeSelect-POM47KR5.mjs 1.19 KB
18
- ESM dist/chunk-D4IHIS3H.mjs 395.57 KB
19
- ESM ⚡️ Build success in 2097ms
20
- DTS ⚡️ Build success in 10536ms
21
- DTS dist/index.d.ts 271.35 KB
22
- DTS dist/index.d.mts 271.35 KB
17
+ ESM dist/CountryCodeSelect-DYAFPSID.mjs 1.19 KB
18
+ ESM dist/chunk-42ZK3WXN.mjs 396.72 KB
19
+ ESM ⚡️ Build success in 2192ms
20
+ DTS ⚡️ Build success in 10757ms
21
+ DTS dist/index.d.ts 271.82 KB
22
+ DTS dist/index.d.mts 271.82 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @vygruppen/spor-react
2
2
 
3
+ ## 8.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f984752: Expandable: Add defaultOpen, isOpen and onChange props, and remove undocumented defaultIndex and index props.
8
+
9
+ This might be breaking if you were using these props, so make sure to double check while updating.
10
+
11
+ ## 8.2.1
12
+
13
+ ### Patch Changes
14
+
15
+ - 6c2a831: Fixes bug where Button component did not have a default type.
16
+ - f259d1d: Checkbox: Facelift and dark mode support
17
+ Radio: Facelift and dark mode support
18
+
3
19
  ## 8.2.0
4
20
 
5
21
  ### Minor Changes
@@ -1,4 +1,4 @@
1
- import { createTexts, useTranslation, InfoSelect, Item } from './chunk-D4IHIS3H.mjs';
1
+ import { createTexts, useTranslation, InfoSelect, Item } from './chunk-42ZK3WXN.mjs';
2
2
  import React from 'react';
3
3
  import { getSupportedCallingCodes } from 'awesome-phonenumber';
4
4
 
@@ -814,17 +814,32 @@ var Expandable = ({
814
814
  title,
815
815
  leftIcon,
816
816
  size: size2 = "md",
817
+ defaultOpen,
818
+ isOpen,
819
+ onChange = () => {
820
+ },
817
821
  ...rest
818
822
  }) => {
819
- return /* @__PURE__ */ React69__default.createElement(Accordion, { ...rest, size: size2 }, /* @__PURE__ */ React69__default.createElement(
820
- ExpandableItem,
823
+ return /* @__PURE__ */ React69__default.createElement(
824
+ Accordion,
821
825
  {
822
- headingLevel,
823
- title,
824
- leftIcon
826
+ ...rest,
827
+ index: isOpen ? 0 : void 0,
828
+ defaultIndex: defaultOpen ? 0 : void 0,
829
+ allowMultiple: true,
830
+ size: size2,
831
+ onChange: (expandedIndex) => onChange(expandedIndex === 0)
825
832
  },
826
- children
827
- ));
833
+ /* @__PURE__ */ React69__default.createElement(
834
+ ExpandableItem,
835
+ {
836
+ headingLevel,
837
+ title,
838
+ leftIcon
839
+ },
840
+ children
841
+ )
842
+ );
828
843
  };
829
844
  var ExpandableItem = ({
830
845
  children,
@@ -1163,6 +1178,7 @@ var SkeletonText = (props) => /* @__PURE__ */ React69__default.createElement(Ske
1163
1178
  var Button = forwardRef((props, ref) => {
1164
1179
  const {
1165
1180
  as = "button",
1181
+ type = "button",
1166
1182
  fontWeight,
1167
1183
  size: size2,
1168
1184
  children,
@@ -1191,6 +1207,7 @@ var Button = forwardRef((props, ref) => {
1191
1207
  {
1192
1208
  ...rest,
1193
1209
  as,
1210
+ type,
1194
1211
  sx: { ...styles3, ...sx },
1195
1212
  ref,
1196
1213
  "aria-label": ariaLabel,
@@ -3433,7 +3450,7 @@ var texts14 = createTexts({
3433
3450
  sv: "Telefonnummer"
3434
3451
  }
3435
3452
  });
3436
- var LazyCountryCodeSelect = React69__default.lazy(() => import('./CountryCodeSelect-POM47KR5.mjs'));
3453
+ var LazyCountryCodeSelect = React69__default.lazy(() => import('./CountryCodeSelect-DYAFPSID.mjs'));
3437
3454
  var Radio = forwardRef((props, ref) => {
3438
3455
  return /* @__PURE__ */ React69__default.createElement(Radio$1, { ...props, ref });
3439
3456
  });
@@ -9802,7 +9819,7 @@ function baseBackground(state2, props) {
9802
9819
  };
9803
9820
  case "disabled":
9804
9821
  return {
9805
- backgroundColor: mode("silver", "whiteAlpha.100")(props)
9822
+ backgroundColor: mode("blackAlpha.100", "whiteAlpha.100")(props)
9806
9823
  };
9807
9824
  case "hover":
9808
9825
  return {
@@ -10872,16 +10889,16 @@ var config9 = helpers4.defineMultiStyleConfig({
10872
10889
  container: {
10873
10890
  _hover: {
10874
10891
  "input:enabled:not([aria-invalid]) + .chakra-checkbox__control": {
10875
- backgroundColor: "white",
10876
- borderColor: "primaryGreen"
10892
+ ...baseBackground("hover", props),
10893
+ borderColor: mode("darkGrey", "white")(props)
10877
10894
  },
10878
10895
  "input:enabled[aria-invalid] + .chakra-checkbox__control": {
10879
- backgroundColor: "white",
10896
+ backgroundColor: mode("white", "inherit")(props),
10880
10897
  borderColor: "brightRed"
10881
10898
  },
10882
10899
  "input:enabled:checked:not([aria-invalid]) + .chakra-checkbox__control": {
10883
- backgroundColor: "darkTeal",
10884
- borderColor: "darkTeal"
10900
+ backgroundColor: mode("darkTeal", "blueGreen")(props),
10901
+ borderColor: mode("darkTeal", "blueGreen")(props)
10885
10902
  },
10886
10903
  "input:enabled:checked[aria-invalid] + .chakra-checkbox__control": {
10887
10904
  backgroundColor: "brightRed",
@@ -10901,20 +10918,21 @@ var config9 = helpers4.defineMultiStyleConfig({
10901
10918
  height: 4,
10902
10919
  transitionProperty: "background, border-color",
10903
10920
  transitionDuration: "normal",
10904
- backgroundColor: "white",
10905
10921
  border: "2px solid",
10906
- borderColor: "darkTeal",
10922
+ borderColor: mode("blackAlpha.400", "whiteAlpha.400")(props),
10907
10923
  borderRadius: "xs",
10908
- color: "white",
10924
+ color: mode("white", "darkTeal")(props),
10925
+ ...baseBackground("default", props),
10909
10926
  _checked: {
10910
- backgroundColor: "primaryGreen",
10911
- borderColor: "primaryGreen",
10912
- color: "white",
10927
+ ...baseBackground("selected", props),
10928
+ borderColor: mode("pine", "coralGreen")(props),
10929
+ ...baseText("default", props),
10930
+ color: mode("white", "darkTeal")(props),
10913
10931
  ...focusVisibleStyles(props),
10914
10932
  _disabled: {
10915
- backgroundColor: "lightGrey",
10916
- borderColor: "steel",
10917
- color: "steel"
10933
+ ...baseBackground("disabled", props),
10934
+ borderColor: mode("blackAlpha.200", "whiteAlpha.200")(props),
10935
+ color: mode("blackAlpha.200", "whiteAlpha.200")(props)
10918
10936
  },
10919
10937
  _invalid: {
10920
10938
  backgroundColor: "brightRed",
@@ -10922,11 +10940,11 @@ var config9 = helpers4.defineMultiStyleConfig({
10922
10940
  }
10923
10941
  },
10924
10942
  _disabled: {
10925
- backgroundColor: "lightGrey",
10926
- borderColor: "steel"
10943
+ ...baseBackground("disabled", props),
10944
+ borderColor: mode("blackAlpha.200", "whiteAlpha.200")(props)
10927
10945
  },
10928
10946
  _invalid: {
10929
- backgroundColor: "white",
10947
+ ...baseBackground("default", props),
10930
10948
  borderColor: "brightRed"
10931
10949
  }
10932
10950
  },
@@ -12735,11 +12753,12 @@ var config29 = helpers20.defineMultiStyleConfig({
12735
12753
  container: {
12736
12754
  _hover: {
12737
12755
  "input:enabled + .chakra-radio__control": {
12738
- backgroundColor: "white",
12739
- borderColor: "primaryGreen"
12756
+ backgroundColor: "inherit",
12757
+ borderColor: mode("darkGrey", "white")(props)
12740
12758
  },
12741
12759
  "input:enabled:checked + .chakra-radio__control": {
12742
- color: "darkTeal"
12760
+ color: mode("darkTeal", "blueGreen")(props),
12761
+ borderColor: mode("darkTeal", "blueGreen")(props)
12743
12762
  }
12744
12763
  }
12745
12764
  },
@@ -12750,18 +12769,19 @@ var config29 = helpers20.defineMultiStyleConfig({
12750
12769
  control: {
12751
12770
  width: 4,
12752
12771
  height: 4,
12753
- backgroundColor: "white",
12772
+ backgroundColor: "inherit",
12754
12773
  border: "2px solid",
12755
- borderColor: "primaryGreen",
12774
+ borderColor: mode("blackAlpha.400", "whiteAlpha.400")(props),
12756
12775
  borderRadius: "50%",
12757
12776
  ...focusVisibleStyles(props),
12758
12777
  _disabled: {
12759
- backgroundColor: "lightGrey",
12760
- borderColor: "steel"
12778
+ backgroundColor: mode("blackAlpha.100", "whiteAlpha.100")(props),
12779
+ borderColor: mode("blackAlpha.200", "whiteAlpha.200")(props),
12780
+ color: mode("blackAlpha.200", "whiteAlpha.300")(props)
12761
12781
  },
12762
12782
  _checked: {
12763
- borderColor: "currentColor",
12764
- color: "primaryGreen",
12783
+ borderColor: mode("pine", "coralGreen")(props),
12784
+ color: mode("pine", "coralGreen")(props),
12765
12785
  _before: {
12766
12786
  content: `""`,
12767
12787
  display: "inline-block",
@@ -12772,8 +12792,9 @@ var config29 = helpers20.defineMultiStyleConfig({
12772
12792
  background: "currentColor"
12773
12793
  },
12774
12794
  _disabled: {
12775
- backgroundColor: "lightGrey",
12776
- borderColor: "steel"
12795
+ backgroundColor: mode("blackAlpha.100", "whiteAlpha.100")(props),
12796
+ borderColor: mode("blackAlpha.200", "whiteAlpha.200")(props),
12797
+ color: mode("blackAlpha.200", "whiteAlpha.300")(props)
12777
12798
  }
12778
12799
  }
12779
12800
  }
package/dist/index.d.mts CHANGED
@@ -81,7 +81,7 @@ type AccordionProps = Omit<AccordionProps$1, "variant" | "size"> & {
81
81
  declare const Accordion: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", AccordionProps>;
82
82
 
83
83
  type HeadingLevel = "h2" | "h3" | "h4" | "h5" | "h6";
84
- type ExpandableProps = Omit<AccordionProps, "title"> & {
84
+ type ExpandableProps = Omit<AccordionProps, "title" | "index" | "defaultIndex" | "onChange"> & {
85
85
  /** The hidden content */
86
86
  children: React.ReactNode;
87
87
  /** The title that's shown inside the toggle button */
@@ -97,6 +97,12 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
97
97
  * If the size is set to `lg`, the icon should be 30px.
98
98
  */
99
99
  leftIcon?: React.ReactNode;
100
+ /** Controlled value of whether the accordion is open or not */
101
+ isOpen?: boolean;
102
+ /** Default value of when the accordion is open or not */
103
+ defaultOpen?: boolean;
104
+ /** Callback for when the expandable opens or closes */
105
+ onChange?: (isOpen: boolean) => void;
100
106
  };
101
107
  /**
102
108
  * A standalone expandable component.
@@ -110,7 +116,7 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
110
116
  * </Expandable>
111
117
  * ```
112
118
  */
113
- declare const Expandable: ({ children, headingLevel, title, leftIcon, size, ...rest }: ExpandableProps) => React.JSX.Element;
119
+ declare const Expandable: ({ children, headingLevel, title, leftIcon, size, defaultOpen, isOpen, onChange, ...rest }: ExpandableProps) => React.JSX.Element;
114
120
  type ExpandableItemProps = Omit<AccordionItemProps, "title"> & {
115
121
  /** The hidden content */
116
122
  children: React.ReactNode;
@@ -2791,8 +2797,8 @@ declare const theme: {
2791
2797
  container: {
2792
2798
  _hover: {
2793
2799
  "input:enabled:not([aria-invalid]) + .chakra-checkbox__control": {
2794
- backgroundColor: string;
2795
2800
  borderColor: string;
2801
+ backgroundColor: string;
2796
2802
  };
2797
2803
  "input:enabled[aria-invalid] + .chakra-checkbox__control": {
2798
2804
  backgroundColor: string;
@@ -2815,20 +2821,11 @@ declare const theme: {
2815
2821
  strokeWidth: string;
2816
2822
  };
2817
2823
  control: {
2818
- width: number;
2819
- height: number;
2820
- transitionProperty: string;
2821
- transitionDuration: string;
2822
- backgroundColor: string;
2823
- border: string;
2824
- borderColor: string;
2825
- borderRadius: string;
2826
- color: string;
2827
2824
  _checked: {
2828
2825
  _disabled: {
2829
- backgroundColor: string;
2830
2826
  borderColor: string;
2831
2827
  color: string;
2828
+ backgroundColor: string;
2832
2829
  };
2833
2830
  _invalid: {
2834
2831
  backgroundColor: string;
@@ -2840,18 +2837,27 @@ declare const theme: {
2840
2837
  outlineStyle: string;
2841
2838
  outlineOffset: string;
2842
2839
  };
2843
- backgroundColor: string;
2844
- borderColor: string;
2845
2840
  color: string;
2841
+ borderColor: string;
2842
+ backgroundColor: string;
2846
2843
  };
2847
2844
  _disabled: {
2848
- backgroundColor: string;
2849
2845
  borderColor: string;
2846
+ backgroundColor: string;
2850
2847
  };
2851
2848
  _invalid: {
2852
- backgroundColor: string;
2853
2849
  borderColor: string;
2850
+ backgroundColor: string;
2854
2851
  };
2852
+ backgroundColor: string;
2853
+ width: number;
2854
+ height: number;
2855
+ transitionProperty: string;
2856
+ transitionDuration: string;
2857
+ border: string;
2858
+ borderColor: string;
2859
+ borderRadius: string;
2860
+ color: string;
2855
2861
  };
2856
2862
  label: {
2857
2863
  userSelect: string;
@@ -4666,6 +4672,7 @@ declare const theme: {
4666
4672
  };
4667
4673
  "input:enabled:checked + .chakra-radio__control": {
4668
4674
  color: string;
4675
+ borderColor: string;
4669
4676
  };
4670
4677
  };
4671
4678
  };
@@ -4679,6 +4686,7 @@ declare const theme: {
4679
4686
  _disabled: {
4680
4687
  backgroundColor: string;
4681
4688
  borderColor: string;
4689
+ color: string;
4682
4690
  };
4683
4691
  _checked: {
4684
4692
  borderColor: string;
@@ -4695,6 +4703,7 @@ declare const theme: {
4695
4703
  _disabled: {
4696
4704
  backgroundColor: string;
4697
4705
  borderColor: string;
4706
+ color: string;
4698
4707
  };
4699
4708
  };
4700
4709
  _focusVisible: {
package/dist/index.d.ts CHANGED
@@ -81,7 +81,7 @@ type AccordionProps = Omit<AccordionProps$1, "variant" | "size"> & {
81
81
  declare const Accordion: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", AccordionProps>;
82
82
 
83
83
  type HeadingLevel = "h2" | "h3" | "h4" | "h5" | "h6";
84
- type ExpandableProps = Omit<AccordionProps, "title"> & {
84
+ type ExpandableProps = Omit<AccordionProps, "title" | "index" | "defaultIndex" | "onChange"> & {
85
85
  /** The hidden content */
86
86
  children: React.ReactNode;
87
87
  /** The title that's shown inside the toggle button */
@@ -97,6 +97,12 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
97
97
  * If the size is set to `lg`, the icon should be 30px.
98
98
  */
99
99
  leftIcon?: React.ReactNode;
100
+ /** Controlled value of whether the accordion is open or not */
101
+ isOpen?: boolean;
102
+ /** Default value of when the accordion is open or not */
103
+ defaultOpen?: boolean;
104
+ /** Callback for when the expandable opens or closes */
105
+ onChange?: (isOpen: boolean) => void;
100
106
  };
101
107
  /**
102
108
  * A standalone expandable component.
@@ -110,7 +116,7 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
110
116
  * </Expandable>
111
117
  * ```
112
118
  */
113
- declare const Expandable: ({ children, headingLevel, title, leftIcon, size, ...rest }: ExpandableProps) => React.JSX.Element;
119
+ declare const Expandable: ({ children, headingLevel, title, leftIcon, size, defaultOpen, isOpen, onChange, ...rest }: ExpandableProps) => React.JSX.Element;
114
120
  type ExpandableItemProps = Omit<AccordionItemProps, "title"> & {
115
121
  /** The hidden content */
116
122
  children: React.ReactNode;
@@ -2791,8 +2797,8 @@ declare const theme: {
2791
2797
  container: {
2792
2798
  _hover: {
2793
2799
  "input:enabled:not([aria-invalid]) + .chakra-checkbox__control": {
2794
- backgroundColor: string;
2795
2800
  borderColor: string;
2801
+ backgroundColor: string;
2796
2802
  };
2797
2803
  "input:enabled[aria-invalid] + .chakra-checkbox__control": {
2798
2804
  backgroundColor: string;
@@ -2815,20 +2821,11 @@ declare const theme: {
2815
2821
  strokeWidth: string;
2816
2822
  };
2817
2823
  control: {
2818
- width: number;
2819
- height: number;
2820
- transitionProperty: string;
2821
- transitionDuration: string;
2822
- backgroundColor: string;
2823
- border: string;
2824
- borderColor: string;
2825
- borderRadius: string;
2826
- color: string;
2827
2824
  _checked: {
2828
2825
  _disabled: {
2829
- backgroundColor: string;
2830
2826
  borderColor: string;
2831
2827
  color: string;
2828
+ backgroundColor: string;
2832
2829
  };
2833
2830
  _invalid: {
2834
2831
  backgroundColor: string;
@@ -2840,18 +2837,27 @@ declare const theme: {
2840
2837
  outlineStyle: string;
2841
2838
  outlineOffset: string;
2842
2839
  };
2843
- backgroundColor: string;
2844
- borderColor: string;
2845
2840
  color: string;
2841
+ borderColor: string;
2842
+ backgroundColor: string;
2846
2843
  };
2847
2844
  _disabled: {
2848
- backgroundColor: string;
2849
2845
  borderColor: string;
2846
+ backgroundColor: string;
2850
2847
  };
2851
2848
  _invalid: {
2852
- backgroundColor: string;
2853
2849
  borderColor: string;
2850
+ backgroundColor: string;
2854
2851
  };
2852
+ backgroundColor: string;
2853
+ width: number;
2854
+ height: number;
2855
+ transitionProperty: string;
2856
+ transitionDuration: string;
2857
+ border: string;
2858
+ borderColor: string;
2859
+ borderRadius: string;
2860
+ color: string;
2855
2861
  };
2856
2862
  label: {
2857
2863
  userSelect: string;
@@ -4666,6 +4672,7 @@ declare const theme: {
4666
4672
  };
4667
4673
  "input:enabled:checked + .chakra-radio__control": {
4668
4674
  color: string;
4675
+ borderColor: string;
4669
4676
  };
4670
4677
  };
4671
4678
  };
@@ -4679,6 +4686,7 @@ declare const theme: {
4679
4686
  _disabled: {
4680
4687
  backgroundColor: string;
4681
4688
  borderColor: string;
4689
+ color: string;
4682
4690
  };
4683
4691
  _checked: {
4684
4692
  borderColor: string;
@@ -4695,6 +4703,7 @@ declare const theme: {
4695
4703
  _disabled: {
4696
4704
  backgroundColor: string;
4697
4705
  borderColor: string;
4706
+ color: string;
4698
4707
  };
4699
4708
  };
4700
4709
  _focusVisible: {
package/dist/index.js CHANGED
@@ -149,17 +149,32 @@ var init_Expandable = __esm({
149
149
  title,
150
150
  leftIcon,
151
151
  size: size2 = "md",
152
+ defaultOpen,
153
+ isOpen,
154
+ onChange = () => {
155
+ },
152
156
  ...rest
153
157
  }) => {
154
- return /* @__PURE__ */ React69__namespace.default.createElement(exports.Accordion, { ...rest, size: size2 }, /* @__PURE__ */ React69__namespace.default.createElement(
155
- exports.ExpandableItem,
158
+ return /* @__PURE__ */ React69__namespace.default.createElement(
159
+ exports.Accordion,
156
160
  {
157
- headingLevel,
158
- title,
159
- leftIcon
161
+ ...rest,
162
+ index: isOpen ? 0 : void 0,
163
+ defaultIndex: defaultOpen ? 0 : void 0,
164
+ allowMultiple: true,
165
+ size: size2,
166
+ onChange: (expandedIndex) => onChange(expandedIndex === 0)
160
167
  },
161
- children
162
- ));
168
+ /* @__PURE__ */ React69__namespace.default.createElement(
169
+ exports.ExpandableItem,
170
+ {
171
+ headingLevel,
172
+ title,
173
+ leftIcon
174
+ },
175
+ children
176
+ )
177
+ );
163
178
  };
164
179
  exports.ExpandableItem = ({
165
180
  children,
@@ -663,6 +678,7 @@ var init_Button = __esm({
663
678
  exports.Button = react.forwardRef((props, ref) => {
664
679
  const {
665
680
  as = "button",
681
+ type = "button",
666
682
  fontWeight,
667
683
  size: size2,
668
684
  children,
@@ -691,6 +707,7 @@ var init_Button = __esm({
691
707
  {
692
708
  ...rest,
693
709
  as,
710
+ type,
694
711
  sx: { ...styles3, ...sx },
695
712
  ref,
696
713
  "aria-label": ariaLabel,
@@ -11198,7 +11215,7 @@ function baseBackground(state2, props) {
11198
11215
  };
11199
11216
  case "disabled":
11200
11217
  return {
11201
- backgroundColor: themeTools.mode("silver", "whiteAlpha.100")(props)
11218
+ backgroundColor: themeTools.mode("blackAlpha.100", "whiteAlpha.100")(props)
11202
11219
  };
11203
11220
  case "hover":
11204
11221
  return {
@@ -12344,22 +12361,24 @@ var init_checkbox = __esm({
12344
12361
  "src/theme/components/checkbox.ts"() {
12345
12362
  init_dist4();
12346
12363
  init_focus_util();
12364
+ init_background_utils();
12365
+ init_text_utils();
12347
12366
  helpers4 = react.createMultiStyleConfigHelpers(checkboxAnatomy.keys);
12348
12367
  config9 = helpers4.defineMultiStyleConfig({
12349
12368
  baseStyle: (props) => ({
12350
12369
  container: {
12351
12370
  _hover: {
12352
12371
  "input:enabled:not([aria-invalid]) + .chakra-checkbox__control": {
12353
- backgroundColor: "white",
12354
- borderColor: "primaryGreen"
12372
+ ...baseBackground("hover", props),
12373
+ borderColor: themeTools.mode("darkGrey", "white")(props)
12355
12374
  },
12356
12375
  "input:enabled[aria-invalid] + .chakra-checkbox__control": {
12357
- backgroundColor: "white",
12376
+ backgroundColor: themeTools.mode("white", "inherit")(props),
12358
12377
  borderColor: "brightRed"
12359
12378
  },
12360
12379
  "input:enabled:checked:not([aria-invalid]) + .chakra-checkbox__control": {
12361
- backgroundColor: "darkTeal",
12362
- borderColor: "darkTeal"
12380
+ backgroundColor: themeTools.mode("darkTeal", "blueGreen")(props),
12381
+ borderColor: themeTools.mode("darkTeal", "blueGreen")(props)
12363
12382
  },
12364
12383
  "input:enabled:checked[aria-invalid] + .chakra-checkbox__control": {
12365
12384
  backgroundColor: "brightRed",
@@ -12379,20 +12398,21 @@ var init_checkbox = __esm({
12379
12398
  height: 4,
12380
12399
  transitionProperty: "background, border-color",
12381
12400
  transitionDuration: "normal",
12382
- backgroundColor: "white",
12383
12401
  border: "2px solid",
12384
- borderColor: "darkTeal",
12402
+ borderColor: themeTools.mode("blackAlpha.400", "whiteAlpha.400")(props),
12385
12403
  borderRadius: "xs",
12386
- color: "white",
12404
+ color: themeTools.mode("white", "darkTeal")(props),
12405
+ ...baseBackground("default", props),
12387
12406
  _checked: {
12388
- backgroundColor: "primaryGreen",
12389
- borderColor: "primaryGreen",
12390
- color: "white",
12407
+ ...baseBackground("selected", props),
12408
+ borderColor: themeTools.mode("pine", "coralGreen")(props),
12409
+ ...baseText("default", props),
12410
+ color: themeTools.mode("white", "darkTeal")(props),
12391
12411
  ...focusVisibleStyles(props),
12392
12412
  _disabled: {
12393
- backgroundColor: "lightGrey",
12394
- borderColor: "steel",
12395
- color: "steel"
12413
+ ...baseBackground("disabled", props),
12414
+ borderColor: themeTools.mode("blackAlpha.200", "whiteAlpha.200")(props),
12415
+ color: themeTools.mode("blackAlpha.200", "whiteAlpha.200")(props)
12396
12416
  },
12397
12417
  _invalid: {
12398
12418
  backgroundColor: "brightRed",
@@ -12400,11 +12420,11 @@ var init_checkbox = __esm({
12400
12420
  }
12401
12421
  },
12402
12422
  _disabled: {
12403
- backgroundColor: "lightGrey",
12404
- borderColor: "steel"
12423
+ ...baseBackground("disabled", props),
12424
+ borderColor: themeTools.mode("blackAlpha.200", "whiteAlpha.200")(props)
12405
12425
  },
12406
12426
  _invalid: {
12407
- backgroundColor: "white",
12427
+ ...baseBackground("default", props),
12408
12428
  borderColor: "brightRed"
12409
12429
  }
12410
12430
  },
@@ -14362,11 +14382,12 @@ var init_radio = __esm({
14362
14382
  container: {
14363
14383
  _hover: {
14364
14384
  "input:enabled + .chakra-radio__control": {
14365
- backgroundColor: "white",
14366
- borderColor: "primaryGreen"
14385
+ backgroundColor: "inherit",
14386
+ borderColor: themeTools.mode("darkGrey", "white")(props)
14367
14387
  },
14368
14388
  "input:enabled:checked + .chakra-radio__control": {
14369
- color: "darkTeal"
14389
+ color: themeTools.mode("darkTeal", "blueGreen")(props),
14390
+ borderColor: themeTools.mode("darkTeal", "blueGreen")(props)
14370
14391
  }
14371
14392
  }
14372
14393
  },
@@ -14377,18 +14398,19 @@ var init_radio = __esm({
14377
14398
  control: {
14378
14399
  width: 4,
14379
14400
  height: 4,
14380
- backgroundColor: "white",
14401
+ backgroundColor: "inherit",
14381
14402
  border: "2px solid",
14382
- borderColor: "primaryGreen",
14403
+ borderColor: themeTools.mode("blackAlpha.400", "whiteAlpha.400")(props),
14383
14404
  borderRadius: "50%",
14384
14405
  ...focusVisibleStyles(props),
14385
14406
  _disabled: {
14386
- backgroundColor: "lightGrey",
14387
- borderColor: "steel"
14407
+ backgroundColor: themeTools.mode("blackAlpha.100", "whiteAlpha.100")(props),
14408
+ borderColor: themeTools.mode("blackAlpha.200", "whiteAlpha.200")(props),
14409
+ color: themeTools.mode("blackAlpha.200", "whiteAlpha.300")(props)
14388
14410
  },
14389
14411
  _checked: {
14390
- borderColor: "currentColor",
14391
- color: "primaryGreen",
14412
+ borderColor: themeTools.mode("pine", "coralGreen")(props),
14413
+ color: themeTools.mode("pine", "coralGreen")(props),
14392
14414
  _before: {
14393
14415
  content: `""`,
14394
14416
  display: "inline-block",
@@ -14399,8 +14421,9 @@ var init_radio = __esm({
14399
14421
  background: "currentColor"
14400
14422
  },
14401
14423
  _disabled: {
14402
- backgroundColor: "lightGrey",
14403
- borderColor: "steel"
14424
+ backgroundColor: themeTools.mode("blackAlpha.100", "whiteAlpha.100")(props),
14425
+ borderColor: themeTools.mode("blackAlpha.200", "whiteAlpha.200")(props),
14426
+ color: themeTools.mode("blackAlpha.200", "whiteAlpha.300")(props)
14404
14427
  }
14405
14428
  }
14406
14429
  }
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, Card, CardSelect, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, ColorInlineLoader, ColorSpinner, Combobox, Container, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkMode, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, ModalHeader as DrawerHeader, DrawerOverlay, Expandable, ExpandableAlert, ExpandableItem, Fade, Flex, FloatingActionButton, FormControl, FormErrorMessage, FormHelperText, FormLabel, Grid, GridItem, HStack, Heading, IconButton, Image, Img, InfoSelect, InfoTag, Input, InputGroup, InputLeftElement, InputRightElement, Item, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightMode, LightSpinner, LineIcon, ListBox, ListItem, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, Nudge, NumericStepper, OrderedList, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tooltip, Tr, TravelTag, UnorderedList, VStack, VyLogo, WizardNudge, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, slugify, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useSize, useTheme, useToast, useToken, useTranslation } from './chunk-D4IHIS3H.mjs';
1
+ export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, Card, CardSelect, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, ColorInlineLoader, ColorSpinner, Combobox, Container, ContentLoader, DarkFullScreenLoader, DarkInlineLoader, DarkMode, DarkSpinner, DatePicker, DateRangePicker, Divider, Drawer, DrawerBody, DrawerCloseButton, DrawerContent, DrawerFooter, ModalHeader as DrawerHeader, DrawerOverlay, Expandable, ExpandableAlert, ExpandableItem, Fade, Flex, FloatingActionButton, FormControl, FormErrorMessage, FormHelperText, FormLabel, Grid, GridItem, HStack, Heading, IconButton, Image, Img, InfoSelect, InfoTag, Input, InputGroup, InputLeftElement, InputRightElement, Item, ItemDescription, ItemLabel, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightMode, LightSpinner, LineIcon, ListBox, ListItem, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, Nudge, NumericStepper, OrderedList, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, Stepper, StepperStep, Switch, Tab, TabList, TabPanel, TabPanels, Table, TableCaption, Tabs, Tbody, Td, Text, TextLink, Textarea, Tfoot, Th, Thead, Time, TimePicker, Tooltip, Tr, TravelTag, UnorderedList, VStack, VyLogo, WizardNudge, Wrap, WrapItem, brandTheme, createTexts, defineStyleConfig, extendTheme, fontFaces, slugify, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useSize, useTheme, useToast, useToken, useTranslation } from './chunk-42ZK3WXN.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
- "version": "8.2.0",
3
+ "version": "8.3.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -12,7 +12,10 @@ import { Accordion, AccordionProps } from "./Accordion";
12
12
  import { useAccordionContext } from "./AccordionContext";
13
13
 
14
14
  type HeadingLevel = "h2" | "h3" | "h4" | "h5" | "h6";
15
- type ExpandableProps = Omit<AccordionProps, "title"> & {
15
+ type ExpandableProps = Omit<
16
+ AccordionProps,
17
+ "title" | "index" | "defaultIndex" | "onChange"
18
+ > & {
16
19
  /** The hidden content */
17
20
  children: React.ReactNode;
18
21
  /** The title that's shown inside the toggle button */
@@ -28,6 +31,13 @@ type ExpandableProps = Omit<AccordionProps, "title"> & {
28
31
  * If the size is set to `lg`, the icon should be 30px.
29
32
  */
30
33
  leftIcon?: React.ReactNode;
34
+
35
+ /** Controlled value of whether the accordion is open or not */
36
+ isOpen?: boolean;
37
+ /** Default value of when the accordion is open or not */
38
+ defaultOpen?: boolean;
39
+ /** Callback for when the expandable opens or closes */
40
+ onChange?: (isOpen: boolean) => void;
31
41
  };
32
42
  /**
33
43
  * A standalone expandable component.
@@ -47,10 +57,20 @@ export const Expandable = ({
47
57
  title,
48
58
  leftIcon,
49
59
  size = "md",
60
+ defaultOpen,
61
+ isOpen,
62
+ onChange = () => {},
50
63
  ...rest
51
64
  }: ExpandableProps) => {
52
65
  return (
53
- <Accordion {...rest} size={size}>
66
+ <Accordion
67
+ {...rest}
68
+ index={isOpen ? 0 : undefined}
69
+ defaultIndex={defaultOpen ? 0 : undefined}
70
+ allowMultiple={true}
71
+ size={size}
72
+ onChange={(expandedIndex) => onChange(expandedIndex === 0)}
73
+ >
54
74
  <ExpandableItem
55
75
  headingLevel={headingLevel}
56
76
  title={title}
@@ -65,6 +65,7 @@ export type ButtonProps = Exclude<
65
65
  export const Button = forwardRef<ButtonProps, "button">((props, ref) => {
66
66
  const {
67
67
  as = "button",
68
+ type = "button",
68
69
  fontWeight,
69
70
  size,
70
71
  children,
@@ -97,6 +98,7 @@ export const Button = forwardRef<ButtonProps, "button">((props, ref) => {
97
98
  <Box
98
99
  {...rest}
99
100
  as={as}
101
+ type={type}
100
102
  sx={{ ...styles, ...sx }}
101
103
  ref={ref}
102
104
  aria-label={ariaLabel}
@@ -1,6 +1,9 @@
1
1
  import { checkboxAnatomy as parts } from "@chakra-ui/anatomy";
2
2
  import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
3
3
  import { focusVisibleStyles } from "../utils/focus-util";
4
+ import { mode } from "@chakra-ui/theme-tools";
5
+ import { baseBackground } from "../utils/background-utils";
6
+ import { baseText } from "../utils/text-utils";
4
7
 
5
8
  const helpers = createMultiStyleConfigHelpers(parts.keys);
6
9
 
@@ -9,17 +12,17 @@ const config = helpers.defineMultiStyleConfig({
9
12
  container: {
10
13
  _hover: {
11
14
  "input:enabled:not([aria-invalid]) + .chakra-checkbox__control": {
12
- backgroundColor: "white",
13
- borderColor: "primaryGreen",
15
+ ...baseBackground("hover", props),
16
+ borderColor: mode("darkGrey", "white")(props),
14
17
  },
15
18
  "input:enabled[aria-invalid] + .chakra-checkbox__control": {
16
- backgroundColor: "white",
19
+ backgroundColor: mode("white", "inherit")(props),
17
20
  borderColor: "brightRed",
18
21
  },
19
22
  "input:enabled:checked:not([aria-invalid]) + .chakra-checkbox__control":
20
23
  {
21
- backgroundColor: "darkTeal",
22
- borderColor: "darkTeal",
24
+ backgroundColor: mode("darkTeal", "blueGreen")(props),
25
+ borderColor: mode("darkTeal", "blueGreen")(props),
23
26
  },
24
27
  "input:enabled:checked[aria-invalid] + .chakra-checkbox__control": {
25
28
  backgroundColor: "brightRed",
@@ -38,23 +41,24 @@ const config = helpers.defineMultiStyleConfig({
38
41
  height: 4,
39
42
  transitionProperty: "background, border-color",
40
43
  transitionDuration: "normal",
41
- backgroundColor: "white",
42
44
  border: "2px solid",
43
- borderColor: "darkTeal",
45
+ borderColor: mode("blackAlpha.400", "whiteAlpha.400")(props),
44
46
  borderRadius: "xs",
45
- color: "white",
47
+ color: mode("white", "darkTeal")(props),
48
+ ...baseBackground("default", props),
46
49
 
47
50
  _checked: {
48
- backgroundColor: "primaryGreen",
49
- borderColor: "primaryGreen",
50
- color: "white",
51
+ ...baseBackground("selected", props),
52
+ borderColor: mode("pine", "coralGreen")(props),
53
+ ...baseText("default", props),
54
+ color: mode("white", "darkTeal")(props),
51
55
 
52
56
  ...focusVisibleStyles(props),
53
57
 
54
58
  _disabled: {
55
- backgroundColor: "lightGrey",
56
- borderColor: "steel",
57
- color: "steel",
59
+ ...baseBackground("disabled", props),
60
+ borderColor: mode("blackAlpha.200", "whiteAlpha.200")(props),
61
+ color: mode("blackAlpha.200", "whiteAlpha.200")(props),
58
62
  },
59
63
 
60
64
  _invalid: {
@@ -64,11 +68,11 @@ const config = helpers.defineMultiStyleConfig({
64
68
  },
65
69
 
66
70
  _disabled: {
67
- backgroundColor: "lightGrey",
68
- borderColor: "steel",
71
+ ...baseBackground("disabled", props),
72
+ borderColor: mode("blackAlpha.200", "whiteAlpha.200")(props),
69
73
  },
70
74
  _invalid: {
71
- backgroundColor: "white",
75
+ ...baseBackground("default", props),
72
76
  borderColor: "brightRed",
73
77
  },
74
78
  },
@@ -1,6 +1,7 @@
1
1
  import { radioAnatomy as parts } from "@chakra-ui/anatomy";
2
2
  import { createMultiStyleConfigHelpers } from "@chakra-ui/react";
3
3
  import { focusVisibleStyles } from "../utils/focus-util";
4
+ import { mode } from "@chakra-ui/theme-tools";
4
5
 
5
6
  const helpers = createMultiStyleConfigHelpers(parts.keys);
6
7
 
@@ -9,11 +10,12 @@ const config = helpers.defineMultiStyleConfig({
9
10
  container: {
10
11
  _hover: {
11
12
  "input:enabled + .chakra-radio__control": {
12
- backgroundColor: "white",
13
- borderColor: "primaryGreen",
13
+ backgroundColor: "inherit",
14
+ borderColor: mode("darkGrey", "white")(props),
14
15
  },
15
16
  "input:enabled:checked + .chakra-radio__control": {
16
- color: "darkTeal",
17
+ color: mode("darkTeal", "blueGreen")(props),
18
+ borderColor: mode("darkTeal", "blueGreen")(props),
17
19
  },
18
20
  },
19
21
  },
@@ -24,20 +26,21 @@ const config = helpers.defineMultiStyleConfig({
24
26
  control: {
25
27
  width: 4,
26
28
  height: 4,
27
- backgroundColor: "white",
29
+ backgroundColor: "inherit",
28
30
  border: "2px solid",
29
- borderColor: "primaryGreen",
31
+ borderColor: mode("blackAlpha.400", "whiteAlpha.400")(props),
30
32
  borderRadius: "50%",
31
33
 
32
34
  ...focusVisibleStyles(props),
33
35
 
34
36
  _disabled: {
35
- backgroundColor: "lightGrey",
36
- borderColor: "steel",
37
+ backgroundColor: mode("blackAlpha.100", "whiteAlpha.100")(props),
38
+ borderColor: mode("blackAlpha.200", "whiteAlpha.200")(props),
39
+ color: mode("blackAlpha.200", "whiteAlpha.300")(props),
37
40
  },
38
41
  _checked: {
39
- borderColor: "currentColor",
40
- color: "primaryGreen",
42
+ borderColor: mode("pine", "coralGreen")(props),
43
+ color: mode("pine", "coralGreen")(props),
41
44
  _before: {
42
45
  content: `""`,
43
46
  display: "inline-block",
@@ -48,8 +51,9 @@ const config = helpers.defineMultiStyleConfig({
48
51
  background: "currentColor",
49
52
  },
50
53
  _disabled: {
51
- backgroundColor: "lightGrey",
52
- borderColor: "steel",
54
+ backgroundColor: mode("blackAlpha.100", "whiteAlpha.100")(props),
55
+ borderColor: mode("blackAlpha.200", "whiteAlpha.200")(props),
56
+ color: mode("blackAlpha.200", "whiteAlpha.300")(props),
53
57
  },
54
58
  },
55
59
  },
@@ -21,7 +21,7 @@ export function baseBackground(
21
21
  };
22
22
  case "disabled":
23
23
  return {
24
- backgroundColor: mode("silver", "whiteAlpha.100")(props),
24
+ backgroundColor: mode("blackAlpha.100", "whiteAlpha.100")(props),
25
25
  };
26
26
  case "hover":
27
27
  return {