@vygruppen/spor-react 8.0.1 → 8.1.1

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.0.1 build
2
+ > @vygruppen/spor-react@8.1.1 build
3
3
  > tsup src/index.tsx --dts --treeshake --format cjs,esm
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -8,15 +8,15 @@
8
8
  CLI Target: node16
9
9
  CJS Build start
10
10
  ESM Build start
11
- "Collapse" is imported from external module "@chakra-ui/react" but never used in "dist/chunk-5VZ5S46A.mjs".
12
11
  "Collapse" is imported from external module "@chakra-ui/react" but never used in "dist/index.js".
13
12
  DTS Build start
13
+ "Collapse" is imported from external module "@chakra-ui/react" but never used in "dist/chunk-RKXDHLUI.mjs".
14
+ CJS dist/index.js 503.36 KB
15
+ CJS ⚡️ Build success in 2174ms
14
16
  ESM dist/index.mjs 2.01 KB
15
- ESM dist/CountryCodeSelect-SCMCRKY4.mjs 1.19 KB
16
- ESM dist/chunk-5VZ5S46A.mjs 393.00 KB
17
- ESM ⚡️ Build success in 2110ms
18
- CJS dist/index.js 500.11 KB
19
- CJS ⚡️ Build success in 2110ms
20
- DTS ⚡️ Build success in 10383ms
21
- DTS dist/index.d.ts 268.53 KB
22
- DTS dist/index.d.mts 268.53 KB
17
+ ESM dist/CountryCodeSelect-SJXGMMQ7.mjs 1.19 KB
18
+ ESM dist/chunk-RKXDHLUI.mjs 395.62 KB
19
+ ESM ⚡️ Build success in 2176ms
20
+ DTS ⚡️ Build success in 10811ms
21
+ DTS dist/index.d.ts 271.53 KB
22
+ DTS dist/index.d.mts 271.53 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @vygruppen/spor-react
2
2
 
3
+ ## 8.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 5c87f0c: ListBox: Fix focus styles for listbox
8
+ - 7011328: TextLink: Updated colors for primary and secondary variants to align with Figma
9
+
10
+ ## 8.1.0
11
+
12
+ ### Minor Changes
13
+
14
+ - 3c599d7: Combobox: Add inputRef prop
15
+
16
+ ### Patch Changes
17
+
18
+ - c084847: ExpandableAlerts: added new hover and active styling for this component
19
+
3
20
  ## 8.0.1
4
21
 
5
22
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { createTexts, useTranslation, InfoSelect, Item } from './chunk-5VZ5S46A.mjs';
1
+ import { createTexts, useTranslation, InfoSelect, Item } from './chunk-RKXDHLUI.mjs';
2
2
  import React from 'react';
3
3
  import { getSupportedCallingCodes } from 'awesome-phonenumber';
4
4
 
@@ -1509,6 +1509,7 @@ var ExpandableAlert = ({
1509
1509
  },
1510
1510
  ...boxProps
1511
1511
  }) => {
1512
+ const styles3 = useMultiStyleConfig("AlertExpandable", { variant });
1512
1513
  return /* @__PURE__ */ React69__default.createElement(BaseAlert, { variant, ...boxProps, paddingX: 0, paddingY: 0 }, /* @__PURE__ */ React69__default.createElement(
1513
1514
  Accordion$1,
1514
1515
  {
@@ -1517,7 +1518,7 @@ var ExpandableAlert = ({
1517
1518
  allowToggle: true,
1518
1519
  flexGrow: "1"
1519
1520
  },
1520
- /* @__PURE__ */ React69__default.createElement(AccordionItem, null, /* @__PURE__ */ React69__default.createElement(AccordionButton, { paddingX: 3, paddingY: 2, fontSize: "inherit" }, /* @__PURE__ */ React69__default.createElement(
1521
+ /* @__PURE__ */ React69__default.createElement(AccordionItem, null, /* @__PURE__ */ React69__default.createElement(AccordionButton, { sx: styles3.container }, /* @__PURE__ */ React69__default.createElement(
1521
1522
  Flex,
1522
1523
  {
1523
1524
  justifyContent: "space-between",
@@ -2667,19 +2668,22 @@ function Combobox({
2667
2668
  paddingX,
2668
2669
  paddingY,
2669
2670
  emptyContent,
2671
+ inputRef: externalInputRef,
2672
+ allowsEmptyCollection,
2670
2673
  ...rest
2671
2674
  }) {
2672
2675
  const { contains: contains2 } = useFilter({ sensitivity: "base" });
2673
- const inputRef = useRef(null);
2676
+ const fallbackInputRef = useRef(null);
2677
+ const inputRef = externalInputRef ?? fallbackInputRef;
2674
2678
  const listBoxRef = useRef(null);
2675
2679
  const popoverRef = useRef(null);
2676
2680
  const inputWidth = useInputWidth(inputRef);
2677
2681
  const state2 = useComboBoxState({
2678
- ...rest,
2679
- defaultFilter: contains2,
2680
2682
  allowsEmptyCollection: Boolean(emptyContent),
2683
+ defaultFilter: contains2,
2681
2684
  shouldCloseOnBlur: true,
2682
- label
2685
+ label,
2686
+ ...rest
2683
2687
  });
2684
2688
  const {
2685
2689
  inputProps: { size: size2, ...inputProps },
@@ -3429,7 +3433,7 @@ var texts14 = createTexts({
3429
3433
  sv: "Telefonnummer"
3430
3434
  }
3431
3435
  });
3432
- var LazyCountryCodeSelect = React69__default.lazy(() => import('./CountryCodeSelect-SCMCRKY4.mjs'));
3436
+ var LazyCountryCodeSelect = React69__default.lazy(() => import('./CountryCodeSelect-SJXGMMQ7.mjs'));
3433
3437
  var Radio = forwardRef((props, ref) => {
3434
3438
  return /* @__PURE__ */ React69__default.createElement(Radio$1, { ...props, ref });
3435
3439
  });
@@ -6246,16 +6250,16 @@ Object.assign({}, space, layout, flexbox, grid, position);
6246
6250
  function defineStyle(styles3) {
6247
6251
  return styles3;
6248
6252
  }
6249
- function defineStyleConfig(config38) {
6250
- return config38;
6253
+ function defineStyleConfig(config39) {
6254
+ return config39;
6251
6255
  }
6252
- function createMultiStyleConfigHelpers(parts15) {
6256
+ function createMultiStyleConfigHelpers(parts16) {
6253
6257
  return {
6254
- definePartsStyle(config38) {
6255
- return config38;
6258
+ definePartsStyle(config39) {
6259
+ return config39;
6256
6260
  },
6257
- defineMultiStyleConfig(config38) {
6258
- return { parts: parts15, ...config38 };
6261
+ defineMultiStyleConfig(config39) {
6262
+ return { parts: parts16, ...config39 };
6259
6263
  }
6260
6264
  };
6261
6265
  }
@@ -6418,7 +6422,7 @@ function anatomy(name, map = {}) {
6418
6422
  "[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?"
6419
6423
  );
6420
6424
  }
6421
- function parts15(...values) {
6425
+ function parts16(...values) {
6422
6426
  assert();
6423
6427
  for (const part of values) {
6424
6428
  map[part] = toPart(part);
@@ -6458,7 +6462,7 @@ function anatomy(name, map = {}) {
6458
6462
  }
6459
6463
  const __type = {};
6460
6464
  return {
6461
- parts: parts15,
6465
+ parts: parts16,
6462
6466
  toPart,
6463
6467
  extend,
6464
6468
  selectors,
@@ -9512,6 +9516,7 @@ var components_exports = {};
9512
9516
  __export(components_exports, {
9513
9517
  Accordion: () => accordion_default,
9514
9518
  Alert: () => alert_default,
9519
+ AlertExpandable: () => alert_expandable_default,
9515
9520
  Badge: () => badge_default,
9516
9521
  Breadcrumb: () => breadcrumb_default,
9517
9522
  Button: () => button_default,
@@ -10099,6 +10104,23 @@ function accentText(state2, props) {
10099
10104
  };
10100
10105
  }
10101
10106
  }
10107
+ function brandText(state2, props) {
10108
+ switch (state2) {
10109
+ case "hover":
10110
+ return {
10111
+ color: mode("white", "darkTeal")(props)
10112
+ };
10113
+ case "active":
10114
+ return {
10115
+ color: mode("white", "darkTeal")(props)
10116
+ };
10117
+ case "default":
10118
+ default:
10119
+ return {
10120
+ color: mode("pine", "coralGreen")(props)
10121
+ };
10122
+ }
10123
+ }
10102
10124
 
10103
10125
  // src/theme/components/accordion.ts
10104
10126
  var helpers = createMultiStyleConfigHelpers(accordionAnatomy.keys);
@@ -12334,25 +12356,34 @@ var config23 = defineStyleConfig$1({
12334
12356
  }),
12335
12357
  variants: {
12336
12358
  primary: (props) => ({
12337
- color: mode("pine", "coralGreen")(props),
12359
+ ...brandText("default", props),
12338
12360
  _hover: {
12339
- color: mode("darkTeal", "white")(props),
12340
- backgroundColor: mode("coralGreen", "whiteAlpha.200")(props)
12361
+ ...brandText("hover", props),
12362
+ ...brandBackground("hover", props)
12341
12363
  },
12342
12364
  _active: {
12343
- color: mode("pine", "white")(props),
12344
- backgroundColor: mode("mint", "whiteAlpha.100")(props)
12365
+ ...brandText("active", props),
12366
+ ...brandBackground("active", props)
12345
12367
  }
12346
12368
  }),
12347
12369
  secondary: (props) => ({
12348
- color: mode("darkGrey", "white")(props),
12370
+ backgroundImage: `linear-gradient(${mode(
12371
+ "blackAlpha.400",
12372
+ "whiteAlpha.400"
12373
+ )(props)}, ${mode("blackAlpha.400", "whiteAlpha.400")(props)})`,
12374
+ ...baseText("default", props),
12375
+ "&:focus, &:focus-visible, &:active, &:hover": {
12376
+ outline: "solid",
12377
+ outlineWidth: "1px"
12378
+ },
12379
+ ...baseBackground("default", props),
12349
12380
  _hover: {
12350
- backgroundColor: mode("blackAlpha.100", "whiteAlpha.200")(props),
12351
- color: mode("darkGrey", "white")(props)
12381
+ outlineColor: mode("darkGrey", "white")(props),
12382
+ ...baseBackground("hover", props)
12352
12383
  },
12353
12384
  _active: {
12354
- backgroundColor: mode("mint", "whiteAlpha.100")(props),
12355
- color: mode("darkGrey", "white")(props)
12385
+ outlineColor: mode("blackAlpha.400", "whiteAlpha.400")(props),
12386
+ ...baseBackground("active", props)
12356
12387
  }
12357
12388
  })
12358
12389
  },
@@ -12417,7 +12448,10 @@ var config24 = helpers15.defineMultiStyleConfig({
12417
12448
  _hover: {
12418
12449
  ...ghostBackground("hover", props)
12419
12450
  },
12420
- ...focusVisibleStyles(props),
12451
+ _focus: {
12452
+ ...ghostBackground("selected", props),
12453
+ ...focusVisibleStyles(props)._focusVisible
12454
+ },
12421
12455
  _selected: {
12422
12456
  ...ghostBackground("selected", props)
12423
12457
  }
@@ -13581,6 +13615,93 @@ var config37 = defineStyleConfig$1({
13581
13615
  }
13582
13616
  });
13583
13617
  var toast_default = config37;
13618
+
13619
+ // src/theme/components/alert-expandable.ts
13620
+ var parts15 = anatomy("alertExpandable").parts("container");
13621
+ var helpers26 = createMultiStyleConfigHelpers(parts15.keys);
13622
+ var config38 = helpers26.defineMultiStyleConfig({
13623
+ baseStyle: {
13624
+ container: {
13625
+ paddingX: 3,
13626
+ paddingY: 2,
13627
+ fontSize: "inherit",
13628
+ _expanded: {
13629
+ borderBottomRadius: "none"
13630
+ }
13631
+ }
13632
+ },
13633
+ variants: {
13634
+ info: {
13635
+ container: {
13636
+ _hover: {
13637
+ boxShadow: getBoxShadowString({
13638
+ borderColor: "sky",
13639
+ borderWidth: 2
13640
+ })
13641
+ },
13642
+ _active: {
13643
+ backgroundColor: "icyBlue"
13644
+ }
13645
+ }
13646
+ },
13647
+ success: {
13648
+ container: {
13649
+ _hover: {
13650
+ boxShadow: getBoxShadowString({
13651
+ borderColor: "blueGreen",
13652
+ borderWidth: 2
13653
+ })
13654
+ },
13655
+ _active: {
13656
+ backgroundColor: "mint"
13657
+ }
13658
+ }
13659
+ },
13660
+ warning: {
13661
+ container: {
13662
+ _hover: {
13663
+ boxShadow: getBoxShadowString({
13664
+ borderColor: "sunshine",
13665
+ borderWidth: 2
13666
+ })
13667
+ },
13668
+ _active: {
13669
+ backgroundColor: "cornSilk"
13670
+ }
13671
+ }
13672
+ },
13673
+ "alt-transport": {
13674
+ container: {
13675
+ _hover: {
13676
+ boxShadow: getBoxShadowString({
13677
+ borderColor: "golden",
13678
+ borderWidth: 2
13679
+ })
13680
+ },
13681
+ _active: {
13682
+ backgroundColor: "sunshine"
13683
+ }
13684
+ }
13685
+ },
13686
+ error: {
13687
+ container: {
13688
+ _hover: {
13689
+ boxShadow: getBoxShadowString({
13690
+ borderColor: "apricot",
13691
+ borderWidth: 2
13692
+ })
13693
+ },
13694
+ _active: {
13695
+ backgroundColor: "pink"
13696
+ }
13697
+ }
13698
+ }
13699
+ },
13700
+ defaultProps: {
13701
+ variant: "info"
13702
+ }
13703
+ });
13704
+ var alert_expandable_default = config38;
13584
13705
  var fontFaces = `
13585
13706
  @font-face {
13586
13707
  font-family: ${tokens10__default.asset.font["vy-sans"]["light"].name};
package/dist/index.d.mts CHANGED
@@ -774,6 +774,10 @@ type ComboboxProps<T> = AriaComboBoxProps<T> & {
774
774
  isLoading?: boolean;
775
775
  /** Optional UI to show when there are no matching items */
776
776
  emptyContent?: React.ReactNode;
777
+ /** A ref to the input field */
778
+ inputRef?: React.RefObject<HTMLInputElement>;
779
+ /** If you want to allow an empty collection */
780
+ allowsEmptyCollection?: boolean;
777
781
  } & Pick<InputProps, "marginTop" | "marginBottom" | "marginRight" | "marginLeft" | "marginY" | "marginX" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingY" | "paddingX" | "leftIcon" | "rightIcon" | "borderTopRightRadius" | "borderTopLeftRadius" | "borderBottomRightRadius" | "borderBottomLeftRadius" | "onFocus">;
778
782
  /**
779
783
  * A combobox is a combination of an input and a list of suggestions.
@@ -798,7 +802,7 @@ type ComboboxProps<T> = AriaComboBoxProps<T> & {
798
802
  * </Combobox>
799
803
  * ```
800
804
  */
801
- declare function Combobox<T extends object>({ label, isLoading, leftIcon, rightIcon, borderBottomLeftRadius, borderBottomRightRadius, borderTopLeftRadius, borderTopRightRadius, marginBottom, marginTop, marginX, marginY, marginRight, marginLeft, paddingBottom, paddingRight, paddingTop, paddingLeft, paddingX, paddingY, emptyContent, ...rest }: ComboboxProps<T>): React.JSX.Element;
805
+ declare function Combobox<T extends object>({ label, isLoading, leftIcon, rightIcon, borderBottomLeftRadius, borderBottomRightRadius, borderTopLeftRadius, borderTopRightRadius, marginBottom, marginTop, marginX, marginY, marginRight, marginLeft, paddingBottom, paddingRight, paddingTop, paddingLeft, paddingX, paddingY, emptyContent, inputRef: externalInputRef, allowsEmptyCollection, ...rest }: ComboboxProps<T>): React.JSX.Element;
802
806
 
803
807
  type FormControlProps = FormControlProps$1;
804
808
  declare const FormControl: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", FormControlProps$1>;
@@ -4250,26 +4254,32 @@ declare const theme: {
4250
4254
  } | undefined;
4251
4255
  variants?: {
4252
4256
  primary: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
4253
- color: string;
4254
4257
  _hover: {
4255
- color: string;
4256
4258
  backgroundColor: string;
4259
+ color: string;
4257
4260
  };
4258
4261
  _active: {
4259
- color: string;
4260
4262
  backgroundColor: string;
4263
+ color: string;
4261
4264
  };
4265
+ color: string;
4262
4266
  };
4263
4267
  secondary: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
4264
- color: string;
4265
4268
  _hover: {
4266
4269
  backgroundColor: string;
4267
- color: string;
4270
+ outlineColor: string;
4268
4271
  };
4269
4272
  _active: {
4270
4273
  backgroundColor: string;
4271
- color: string;
4274
+ outlineColor: string;
4275
+ };
4276
+ backgroundColor: string;
4277
+ "&:focus, &:focus-visible, &:active, &:hover": {
4278
+ outline: string;
4279
+ outlineWidth: string;
4272
4280
  };
4281
+ color: string;
4282
+ backgroundImage: string;
4273
4283
  };
4274
4284
  } | undefined;
4275
4285
  defaultProps?: {
@@ -4321,15 +4331,6 @@ declare const theme: {
4321
4331
  borderBottomRadius: string;
4322
4332
  };
4323
4333
  item: {
4324
- _selected: {
4325
- backgroundColor: string;
4326
- };
4327
- _focusVisible: {
4328
- outlineWidth: string;
4329
- outlineColor: string;
4330
- outlineStyle: string;
4331
- outlineOffset: string;
4332
- };
4333
4334
  paddingX: number;
4334
4335
  paddingY: number;
4335
4336
  marginY: number;
@@ -4344,6 +4345,16 @@ declare const theme: {
4344
4345
  _hover: {
4345
4346
  backgroundColor: string;
4346
4347
  };
4348
+ _focus: {
4349
+ outlineWidth: string;
4350
+ outlineColor: string;
4351
+ outlineStyle: string;
4352
+ outlineOffset: string;
4353
+ backgroundColor: string;
4354
+ };
4355
+ _selected: {
4356
+ backgroundColor: string;
4357
+ };
4347
4358
  };
4348
4359
  label: {};
4349
4360
  description: {
@@ -5807,6 +5818,81 @@ declare const theme: {
5807
5818
  } | undefined;
5808
5819
  parts: ("title" | "container" | "icon" | "description" | "iconContainer" | "textContainer" | "deviationIcon")[];
5809
5820
  };
5821
+ AlertExpandable: {
5822
+ baseStyle?: {
5823
+ container: {
5824
+ paddingX: number;
5825
+ paddingY: number;
5826
+ fontSize: string;
5827
+ _expanded: {
5828
+ borderBottomRadius: string;
5829
+ };
5830
+ };
5831
+ } | undefined;
5832
+ sizes?: {
5833
+ [key: string]: _chakra_ui_styled_system.PartsStyleInterpolation<{
5834
+ keys: "container"[];
5835
+ }>;
5836
+ } | undefined;
5837
+ variants?: {
5838
+ info: {
5839
+ container: {
5840
+ _hover: {
5841
+ boxShadow: string;
5842
+ };
5843
+ _active: {
5844
+ backgroundColor: string;
5845
+ };
5846
+ };
5847
+ };
5848
+ success: {
5849
+ container: {
5850
+ _hover: {
5851
+ boxShadow: string;
5852
+ };
5853
+ _active: {
5854
+ backgroundColor: string;
5855
+ };
5856
+ };
5857
+ };
5858
+ warning: {
5859
+ container: {
5860
+ _hover: {
5861
+ boxShadow: string;
5862
+ };
5863
+ _active: {
5864
+ backgroundColor: string;
5865
+ };
5866
+ };
5867
+ };
5868
+ "alt-transport": {
5869
+ container: {
5870
+ _hover: {
5871
+ boxShadow: string;
5872
+ };
5873
+ _active: {
5874
+ backgroundColor: string;
5875
+ };
5876
+ };
5877
+ };
5878
+ error: {
5879
+ container: {
5880
+ _hover: {
5881
+ boxShadow: string;
5882
+ };
5883
+ _active: {
5884
+ backgroundColor: string;
5885
+ };
5886
+ };
5887
+ };
5888
+ } | undefined;
5889
+ defaultProps?: {
5890
+ size?: string | number | undefined;
5891
+ variant?: "error" | "info" | "success" | "warning" | "alt-transport" | undefined;
5892
+ colorScheme?: string | undefined;
5893
+ } | undefined;
5894
+ parts: "container"[];
5895
+ };
5810
5896
  Avatar: {
5811
5897
  baseStyle?: ((props: _chakra_ui_styled_system.StyleFunctionProps) => {
5812
5898
  badge: {
package/dist/index.d.ts CHANGED
@@ -774,6 +774,10 @@ type ComboboxProps<T> = AriaComboBoxProps<T> & {
774
774
  isLoading?: boolean;
775
775
  /** Optional UI to show when there are no matching items */
776
776
  emptyContent?: React.ReactNode;
777
+ /** A ref to the input field */
778
+ inputRef?: React.RefObject<HTMLInputElement>;
779
+ /** If you want to allow an empty collection */
780
+ allowsEmptyCollection?: boolean;
777
781
  } & Pick<InputProps, "marginTop" | "marginBottom" | "marginRight" | "marginLeft" | "marginY" | "marginX" | "paddingTop" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingY" | "paddingX" | "leftIcon" | "rightIcon" | "borderTopRightRadius" | "borderTopLeftRadius" | "borderBottomRightRadius" | "borderBottomLeftRadius" | "onFocus">;
778
782
  /**
779
783
  * A combobox is a combination of an input and a list of suggestions.
@@ -798,7 +802,7 @@ type ComboboxProps<T> = AriaComboBoxProps<T> & {
798
802
  * </Combobox>
799
803
  * ```
800
804
  */
801
- declare function Combobox<T extends object>({ label, isLoading, leftIcon, rightIcon, borderBottomLeftRadius, borderBottomRightRadius, borderTopLeftRadius, borderTopRightRadius, marginBottom, marginTop, marginX, marginY, marginRight, marginLeft, paddingBottom, paddingRight, paddingTop, paddingLeft, paddingX, paddingY, emptyContent, ...rest }: ComboboxProps<T>): React.JSX.Element;
805
+ declare function Combobox<T extends object>({ label, isLoading, leftIcon, rightIcon, borderBottomLeftRadius, borderBottomRightRadius, borderTopLeftRadius, borderTopRightRadius, marginBottom, marginTop, marginX, marginY, marginRight, marginLeft, paddingBottom, paddingRight, paddingTop, paddingLeft, paddingX, paddingY, emptyContent, inputRef: externalInputRef, allowsEmptyCollection, ...rest }: ComboboxProps<T>): React.JSX.Element;
802
806
 
803
807
  type FormControlProps = FormControlProps$1;
804
808
  declare const FormControl: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", FormControlProps$1>;
@@ -4250,26 +4254,32 @@ declare const theme: {
4250
4254
  } | undefined;
4251
4255
  variants?: {
4252
4256
  primary: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
4253
- color: string;
4254
4257
  _hover: {
4255
- color: string;
4256
4258
  backgroundColor: string;
4259
+ color: string;
4257
4260
  };
4258
4261
  _active: {
4259
- color: string;
4260
4262
  backgroundColor: string;
4263
+ color: string;
4261
4264
  };
4265
+ color: string;
4262
4266
  };
4263
4267
  secondary: (props: _chakra_ui_styled_system.StyleFunctionProps) => {
4264
- color: string;
4265
4268
  _hover: {
4266
4269
  backgroundColor: string;
4267
- color: string;
4270
+ outlineColor: string;
4268
4271
  };
4269
4272
  _active: {
4270
4273
  backgroundColor: string;
4271
- color: string;
4274
+ outlineColor: string;
4275
+ };
4276
+ backgroundColor: string;
4277
+ "&:focus, &:focus-visible, &:active, &:hover": {
4278
+ outline: string;
4279
+ outlineWidth: string;
4272
4280
  };
4281
+ color: string;
4282
+ backgroundImage: string;
4273
4283
  };
4274
4284
  } | undefined;
4275
4285
  defaultProps?: {
@@ -4321,15 +4331,6 @@ declare const theme: {
4321
4331
  borderBottomRadius: string;
4322
4332
  };
4323
4333
  item: {
4324
- _selected: {
4325
- backgroundColor: string;
4326
- };
4327
- _focusVisible: {
4328
- outlineWidth: string;
4329
- outlineColor: string;
4330
- outlineStyle: string;
4331
- outlineOffset: string;
4332
- };
4333
4334
  paddingX: number;
4334
4335
  paddingY: number;
4335
4336
  marginY: number;
@@ -4344,6 +4345,16 @@ declare const theme: {
4344
4345
  _hover: {
4345
4346
  backgroundColor: string;
4346
4347
  };
4348
+ _focus: {
4349
+ outlineWidth: string;
4350
+ outlineColor: string;
4351
+ outlineStyle: string;
4352
+ outlineOffset: string;
4353
+ backgroundColor: string;
4354
+ };
4355
+ _selected: {
4356
+ backgroundColor: string;
4357
+ };
4347
4358
  };
4348
4359
  label: {};
4349
4360
  description: {
@@ -5807,6 +5818,81 @@ declare const theme: {
5807
5818
  } | undefined;
5808
5819
  parts: ("title" | "container" | "icon" | "description" | "iconContainer" | "textContainer" | "deviationIcon")[];
5809
5820
  };
5821
+ AlertExpandable: {
5822
+ baseStyle?: {
5823
+ container: {
5824
+ paddingX: number;
5825
+ paddingY: number;
5826
+ fontSize: string;
5827
+ _expanded: {
5828
+ borderBottomRadius: string;
5829
+ };
5830
+ };
5831
+ } | undefined;
5832
+ sizes?: {
5833
+ [key: string]: _chakra_ui_styled_system.PartsStyleInterpolation<{
5834
+ keys: "container"[];
5835
+ }>;
5836
+ } | undefined;
5837
+ variants?: {
5838
+ info: {
5839
+ container: {
5840
+ _hover: {
5841
+ boxShadow: string;
5842
+ };
5843
+ _active: {
5844
+ backgroundColor: string;
5845
+ };
5846
+ };
5847
+ };
5848
+ success: {
5849
+ container: {
5850
+ _hover: {
5851
+ boxShadow: string;
5852
+ };
5853
+ _active: {
5854
+ backgroundColor: string;
5855
+ };
5856
+ };
5857
+ };
5858
+ warning: {
5859
+ container: {
5860
+ _hover: {
5861
+ boxShadow: string;
5862
+ };
5863
+ _active: {
5864
+ backgroundColor: string;
5865
+ };
5866
+ };
5867
+ };
5868
+ "alt-transport": {
5869
+ container: {
5870
+ _hover: {
5871
+ boxShadow: string;
5872
+ };
5873
+ _active: {
5874
+ backgroundColor: string;
5875
+ };
5876
+ };
5877
+ };
5878
+ error: {
5879
+ container: {
5880
+ _hover: {
5881
+ boxShadow: string;
5882
+ };
5883
+ _active: {
5884
+ backgroundColor: string;
5885
+ };
5886
+ };
5887
+ };
5888
+ } | undefined;
5889
+ defaultProps?: {
5890
+ size?: string | number | undefined;
5891
+ variant?: "error" | "info" | "success" | "warning" | "alt-transport" | undefined;
5892
+ colorScheme?: string | undefined;
5893
+ } | undefined;
5894
+ parts: "container"[];
5895
+ };
5810
5896
  Avatar: {
5811
5897
  baseStyle?: ((props: _chakra_ui_styled_system.StyleFunctionProps) => {
5812
5898
  badge: {
package/dist/index.js CHANGED
@@ -1046,6 +1046,7 @@ var init_ExpandableAlert = __esm({
1046
1046
  },
1047
1047
  ...boxProps
1048
1048
  }) => {
1049
+ const styles3 = react.useMultiStyleConfig("AlertExpandable", { variant });
1049
1050
  return /* @__PURE__ */ React69__namespace.default.createElement(BaseAlert, { variant, ...boxProps, paddingX: 0, paddingY: 0 }, /* @__PURE__ */ React69__namespace.default.createElement(
1050
1051
  react.Accordion,
1051
1052
  {
@@ -1054,7 +1055,7 @@ var init_ExpandableAlert = __esm({
1054
1055
  allowToggle: true,
1055
1056
  flexGrow: "1"
1056
1057
  },
1057
- /* @__PURE__ */ React69__namespace.default.createElement(react.AccordionItem, null, /* @__PURE__ */ React69__namespace.default.createElement(react.AccordionButton, { paddingX: 3, paddingY: 2, fontSize: "inherit" }, /* @__PURE__ */ React69__namespace.default.createElement(
1058
+ /* @__PURE__ */ React69__namespace.default.createElement(react.AccordionItem, null, /* @__PURE__ */ React69__namespace.default.createElement(react.AccordionButton, { sx: styles3.container }, /* @__PURE__ */ React69__namespace.default.createElement(
1058
1059
  react.Flex,
1059
1060
  {
1060
1061
  justifyContent: "space-between",
@@ -3171,19 +3172,22 @@ function Combobox({
3171
3172
  paddingX,
3172
3173
  paddingY,
3173
3174
  emptyContent,
3175
+ inputRef: externalInputRef,
3176
+ allowsEmptyCollection,
3174
3177
  ...rest
3175
3178
  }) {
3176
3179
  const { contains: contains2 } = reactAria.useFilter({ sensitivity: "base" });
3177
- const inputRef = React69.useRef(null);
3180
+ const fallbackInputRef = React69.useRef(null);
3181
+ const inputRef = externalInputRef ?? fallbackInputRef;
3178
3182
  const listBoxRef = React69.useRef(null);
3179
3183
  const popoverRef = React69.useRef(null);
3180
3184
  const inputWidth = useInputWidth(inputRef);
3181
3185
  const state2 = reactStately.useComboBoxState({
3182
- ...rest,
3183
- defaultFilter: contains2,
3184
3186
  allowsEmptyCollection: Boolean(emptyContent),
3187
+ defaultFilter: contains2,
3185
3188
  shouldCloseOnBlur: true,
3186
- label
3189
+ label,
3190
+ ...rest
3187
3191
  });
3188
3192
  const {
3189
3193
  inputProps: { size: size2, ...inputProps },
@@ -6081,16 +6085,16 @@ function defineCssVars(scope, keys2) {
6081
6085
  function defineStyle(styles3) {
6082
6086
  return styles3;
6083
6087
  }
6084
- function defineStyleConfig(config38) {
6085
- return config38;
6088
+ function defineStyleConfig(config39) {
6089
+ return config39;
6086
6090
  }
6087
- function createMultiStyleConfigHelpers(parts15) {
6091
+ function createMultiStyleConfigHelpers(parts16) {
6088
6092
  return {
6089
- definePartsStyle(config38) {
6090
- return config38;
6093
+ definePartsStyle(config39) {
6094
+ return config39;
6091
6095
  },
6092
- defineMultiStyleConfig(config38) {
6093
- return { parts: parts15, ...config38 };
6096
+ defineMultiStyleConfig(config39) {
6097
+ return { parts: parts16, ...config39 };
6094
6098
  }
6095
6099
  };
6096
6100
  }
@@ -7413,7 +7417,7 @@ function anatomy(name, map = {}) {
7413
7417
  "[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?"
7414
7418
  );
7415
7419
  }
7416
- function parts15(...values) {
7420
+ function parts16(...values) {
7417
7421
  assert();
7418
7422
  for (const part of values) {
7419
7423
  map[part] = toPart(part);
@@ -7453,7 +7457,7 @@ function anatomy(name, map = {}) {
7453
7457
  }
7454
7458
  const __type = {};
7455
7459
  return {
7456
- parts: parts15,
7460
+ parts: parts16,
7457
7461
  toPart,
7458
7462
  extend,
7459
7463
  selectors,
@@ -11511,6 +11515,23 @@ function accentText(state2, props) {
11511
11515
  };
11512
11516
  }
11513
11517
  }
11518
+ function brandText(state2, props) {
11519
+ switch (state2) {
11520
+ case "hover":
11521
+ return {
11522
+ color: themeTools.mode("white", "darkTeal")(props)
11523
+ };
11524
+ case "active":
11525
+ return {
11526
+ color: themeTools.mode("white", "darkTeal")(props)
11527
+ };
11528
+ case "default":
11529
+ default:
11530
+ return {
11531
+ color: themeTools.mode("pine", "coralGreen")(props)
11532
+ };
11533
+ }
11534
+ }
11514
11535
  var init_text_utils = __esm({
11515
11536
  "src/theme/utils/text-utils.ts"() {
11516
11537
  init_foundations();
@@ -13881,6 +13902,8 @@ var config23, link_default;
13881
13902
  var init_link2 = __esm({
13882
13903
  "src/theme/components/link.ts"() {
13883
13904
  init_focus_util();
13905
+ init_background_utils();
13906
+ init_text_utils();
13884
13907
  config23 = react.defineStyleConfig({
13885
13908
  baseStyle: (props) => ({
13886
13909
  transitionProperty: "common",
@@ -13914,25 +13937,34 @@ var init_link2 = __esm({
13914
13937
  }),
13915
13938
  variants: {
13916
13939
  primary: (props) => ({
13917
- color: themeTools.mode("pine", "coralGreen")(props),
13940
+ ...brandText("default", props),
13918
13941
  _hover: {
13919
- color: themeTools.mode("darkTeal", "white")(props),
13920
- backgroundColor: themeTools.mode("coralGreen", "whiteAlpha.200")(props)
13942
+ ...brandText("hover", props),
13943
+ ...brandBackground("hover", props)
13921
13944
  },
13922
13945
  _active: {
13923
- color: themeTools.mode("pine", "white")(props),
13924
- backgroundColor: themeTools.mode("mint", "whiteAlpha.100")(props)
13946
+ ...brandText("active", props),
13947
+ ...brandBackground("active", props)
13925
13948
  }
13926
13949
  }),
13927
13950
  secondary: (props) => ({
13928
- color: themeTools.mode("darkGrey", "white")(props),
13951
+ backgroundImage: `linear-gradient(${themeTools.mode(
13952
+ "blackAlpha.400",
13953
+ "whiteAlpha.400"
13954
+ )(props)}, ${themeTools.mode("blackAlpha.400", "whiteAlpha.400")(props)})`,
13955
+ ...baseText("default", props),
13956
+ "&:focus, &:focus-visible, &:active, &:hover": {
13957
+ outline: "solid",
13958
+ outlineWidth: "1px"
13959
+ },
13960
+ ...baseBackground("default", props),
13929
13961
  _hover: {
13930
- backgroundColor: themeTools.mode("blackAlpha.100", "whiteAlpha.200")(props),
13931
- color: themeTools.mode("darkGrey", "white")(props)
13962
+ outlineColor: themeTools.mode("darkGrey", "white")(props),
13963
+ ...baseBackground("hover", props)
13932
13964
  },
13933
13965
  _active: {
13934
- backgroundColor: themeTools.mode("mint", "whiteAlpha.100")(props),
13935
- color: themeTools.mode("darkGrey", "white")(props)
13966
+ outlineColor: themeTools.mode("blackAlpha.400", "whiteAlpha.400")(props),
13967
+ ...baseBackground("active", props)
13936
13968
  }
13937
13969
  })
13938
13970
  },
@@ -14013,7 +14045,10 @@ var init_listbox = __esm({
14013
14045
  _hover: {
14014
14046
  ...ghostBackground("hover", props)
14015
14047
  },
14016
- ...focusVisibleStyles(props),
14048
+ _focus: {
14049
+ ...ghostBackground("selected", props),
14050
+ ...focusVisibleStyles(props)._focusVisible
14051
+ },
14017
14052
  _selected: {
14018
14053
  ...ghostBackground("selected", props)
14019
14054
  }
@@ -15276,11 +15311,107 @@ var init_toast = __esm({
15276
15311
  }
15277
15312
  });
15278
15313
 
15314
+ // src/theme/components/alert-expandable.ts
15315
+ var parts15, helpers26, config38, alert_expandable_default;
15316
+ var init_alert_expandable = __esm({
15317
+ "src/theme/components/alert-expandable.ts"() {
15318
+ init_dist4();
15319
+ init_dist3();
15320
+ init_box_shadow_utils();
15321
+ parts15 = anatomy("alertExpandable").parts("container");
15322
+ helpers26 = createMultiStyleConfigHelpers(parts15.keys);
15323
+ config38 = helpers26.defineMultiStyleConfig({
15324
+ baseStyle: {
15325
+ container: {
15326
+ paddingX: 3,
15327
+ paddingY: 2,
15328
+ fontSize: "inherit",
15329
+ _expanded: {
15330
+ borderBottomRadius: "none"
15331
+ }
15332
+ }
15333
+ },
15334
+ variants: {
15335
+ info: {
15336
+ container: {
15337
+ _hover: {
15338
+ boxShadow: getBoxShadowString({
15339
+ borderColor: "sky",
15340
+ borderWidth: 2
15341
+ })
15342
+ },
15343
+ _active: {
15344
+ backgroundColor: "icyBlue"
15345
+ }
15346
+ }
15347
+ },
15348
+ success: {
15349
+ container: {
15350
+ _hover: {
15351
+ boxShadow: getBoxShadowString({
15352
+ borderColor: "blueGreen",
15353
+ borderWidth: 2
15354
+ })
15355
+ },
15356
+ _active: {
15357
+ backgroundColor: "mint"
15358
+ }
15359
+ }
15360
+ },
15361
+ warning: {
15362
+ container: {
15363
+ _hover: {
15364
+ boxShadow: getBoxShadowString({
15365
+ borderColor: "sunshine",
15366
+ borderWidth: 2
15367
+ })
15368
+ },
15369
+ _active: {
15370
+ backgroundColor: "cornSilk"
15371
+ }
15372
+ }
15373
+ },
15374
+ "alt-transport": {
15375
+ container: {
15376
+ _hover: {
15377
+ boxShadow: getBoxShadowString({
15378
+ borderColor: "golden",
15379
+ borderWidth: 2
15380
+ })
15381
+ },
15382
+ _active: {
15383
+ backgroundColor: "sunshine"
15384
+ }
15385
+ }
15386
+ },
15387
+ error: {
15388
+ container: {
15389
+ _hover: {
15390
+ boxShadow: getBoxShadowString({
15391
+ borderColor: "apricot",
15392
+ borderWidth: 2
15393
+ })
15394
+ },
15395
+ _active: {
15396
+ backgroundColor: "pink"
15397
+ }
15398
+ }
15399
+ }
15400
+ },
15401
+ defaultProps: {
15402
+ variant: "info"
15403
+ }
15404
+ });
15405
+ alert_expandable_default = config38;
15406
+ }
15407
+ });
15408
+
15279
15409
  // src/theme/components/index.ts
15280
15410
  var components_exports = {};
15281
15411
  __export(components_exports, {
15282
15412
  Accordion: () => accordion_default,
15283
15413
  Alert: () => alert_default,
15414
+ AlertExpandable: () => alert_expandable_default,
15284
15415
  Badge: () => badge_default,
15285
15416
  Breadcrumb: () => breadcrumb_default,
15286
15417
  Button: () => button_default,
@@ -15358,6 +15489,7 @@ var init_components = __esm({
15358
15489
  init_textarea();
15359
15490
  init_toast();
15360
15491
  init_travel_tag();
15492
+ init_alert_expandable();
15361
15493
  }
15362
15494
  });
15363
15495
  exports.fontFaces = void 0;
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-5VZ5S46A.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-RKXDHLUI.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
- "version": "8.0.1",
3
+ "version": "8.1.1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -6,6 +6,7 @@ import {
6
6
  AccordionPanel,
7
7
  Box,
8
8
  Flex,
9
+ useMultiStyleConfig,
9
10
  } from "@chakra-ui/react";
10
11
  import React from "react";
11
12
  import { AlertIcon } from "./AlertIcon";
@@ -44,6 +45,7 @@ export const ExpandableAlert = ({
44
45
  onToggle = () => {},
45
46
  ...boxProps
46
47
  }: ExpandableAlertProps) => {
48
+ const styles = useMultiStyleConfig("AlertExpandable", { variant });
47
49
  return (
48
50
  <BaseAlert variant={variant} {...boxProps} paddingX={0} paddingY={0}>
49
51
  <Accordion
@@ -53,7 +55,7 @@ export const ExpandableAlert = ({
53
55
  flexGrow="1"
54
56
  >
55
57
  <AccordionItem>
56
- <AccordionButton paddingX={3} paddingY={2} fontSize="inherit">
58
+ <AccordionButton sx={styles.container}>
57
59
  <Flex
58
60
  justifyContent="space-between"
59
61
  alignItems="center"
@@ -11,6 +11,10 @@ export type ComboboxProps<T> = AriaComboBoxProps<T> & {
11
11
  isLoading?: boolean;
12
12
  /** Optional UI to show when there are no matching items */
13
13
  emptyContent?: React.ReactNode;
14
+ /** A ref to the input field */
15
+ inputRef?: React.RefObject<HTMLInputElement>;
16
+ /** If you want to allow an empty collection */
17
+ allowsEmptyCollection?: boolean;
14
18
  } & Pick<
15
19
  InputProps,
16
20
  | "marginTop"
@@ -78,22 +82,25 @@ export function Combobox<T extends object>({
78
82
  paddingX,
79
83
  paddingY,
80
84
  emptyContent,
85
+ inputRef: externalInputRef,
86
+ allowsEmptyCollection,
81
87
  ...rest
82
88
  }: ComboboxProps<T>) {
83
89
  const { contains } = useFilter({ sensitivity: "base" });
84
90
 
85
- const inputRef = useRef<HTMLInputElement>(null);
91
+ const fallbackInputRef = useRef<HTMLInputElement>(null);
92
+ const inputRef = externalInputRef ?? fallbackInputRef;
86
93
  const listBoxRef = useRef(null);
87
94
  const popoverRef = useRef(null);
88
95
 
89
96
  const inputWidth = useInputWidth(inputRef);
90
97
 
91
98
  const state = useComboBoxState({
92
- ...rest,
93
- defaultFilter: contains,
94
99
  allowsEmptyCollection: Boolean(emptyContent),
100
+ defaultFilter: contains,
95
101
  shouldCloseOnBlur: true,
96
102
  label,
103
+ ...rest,
97
104
  });
98
105
 
99
106
  const {
@@ -0,0 +1,91 @@
1
+ import { anatomy } from "@chakra-ui/anatomy";
2
+ import { createMultiStyleConfigHelpers } from "@chakra-ui/styled-system";
3
+ import { getBoxShadowString } from "../utils/box-shadow-utils";
4
+
5
+ const parts = anatomy("alertExpandable").parts("container");
6
+ const helpers = createMultiStyleConfigHelpers(parts.keys);
7
+
8
+ const config = helpers.defineMultiStyleConfig({
9
+ baseStyle: {
10
+ container: {
11
+ paddingX: 3,
12
+ paddingY: 2,
13
+ fontSize: "inherit",
14
+ _expanded: {
15
+ borderBottomRadius: "none",
16
+ },
17
+ },
18
+ },
19
+ variants: {
20
+ info: {
21
+ container: {
22
+ _hover: {
23
+ boxShadow: getBoxShadowString({
24
+ borderColor: "sky",
25
+ borderWidth: 2,
26
+ }),
27
+ },
28
+ _active: {
29
+ backgroundColor: "icyBlue",
30
+ },
31
+ },
32
+ },
33
+ success: {
34
+ container: {
35
+ _hover: {
36
+ boxShadow: getBoxShadowString({
37
+ borderColor: "blueGreen",
38
+ borderWidth: 2,
39
+ }),
40
+ },
41
+ _active: {
42
+ backgroundColor: "mint",
43
+ },
44
+ },
45
+ },
46
+ warning: {
47
+ container: {
48
+ _hover: {
49
+ boxShadow: getBoxShadowString({
50
+ borderColor: "sunshine",
51
+ borderWidth: 2,
52
+ }),
53
+ },
54
+ _active: {
55
+ backgroundColor: "cornSilk",
56
+ },
57
+ },
58
+ },
59
+ "alt-transport": {
60
+ container: {
61
+ _hover: {
62
+ boxShadow: getBoxShadowString({
63
+ borderColor: "golden",
64
+ borderWidth: 2,
65
+ }),
66
+ },
67
+ _active: {
68
+ backgroundColor: "sunshine",
69
+ },
70
+ },
71
+ },
72
+ error: {
73
+ container: {
74
+ _hover: {
75
+ boxShadow: getBoxShadowString({
76
+ borderColor: "apricot",
77
+ borderWidth: 2,
78
+ }),
79
+ },
80
+ _active: {
81
+ backgroundColor: "pink",
82
+ },
83
+ },
84
+ },
85
+ },
86
+ defaultProps: {
87
+ variant: "info",
88
+ },
89
+ });
90
+
91
+ export default config;
@@ -36,3 +36,4 @@ export { default as Tabs } from "./tabs";
36
36
  export { default as Textarea } from "./textarea";
37
37
  export { default as Toast } from "./toast";
38
38
  export { default as TravelTag } from "./travel-tag";
39
+ export { default as AlertExpandable } from "./alert-expandable";
@@ -1,6 +1,8 @@
1
1
  import { defineStyleConfig } from "@chakra-ui/react";
2
2
  import { mode } from "@chakra-ui/theme-tools";
3
3
  import { focusVisibleStyles } from "../utils/focus-util";
4
+ import { baseBackground, brandBackground } from "../utils/background-utils";
5
+ import { baseText, brandText } from "../utils/text-utils";
4
6
 
5
7
  const config = defineStyleConfig({
6
8
  baseStyle: (props) => ({
@@ -38,25 +40,34 @@ const config = defineStyleConfig({
38
40
  }),
39
41
  variants: {
40
42
  primary: (props) => ({
41
- color: mode("pine", "coralGreen")(props),
43
+ ...brandText("default", props),
42
44
  _hover: {
43
- color: mode("darkTeal", "white")(props),
44
- backgroundColor: mode("coralGreen", "whiteAlpha.200")(props),
45
+ ...brandText("hover", props),
46
+ ...brandBackground("hover", props),
45
47
  },
46
48
  _active: {
47
- color: mode("pine", "white")(props),
48
- backgroundColor: mode("mint", "whiteAlpha.100")(props),
49
+ ...brandText("active", props),
50
+ ...brandBackground("active", props),
49
51
  },
50
52
  }),
51
53
  secondary: (props) => ({
52
- color: mode("darkGrey", "white")(props),
54
+ backgroundImage: `linear-gradient(${mode(
55
+ "blackAlpha.400",
56
+ "whiteAlpha.400",
57
+ )(props)}, ${mode("blackAlpha.400", "whiteAlpha.400")(props)})`,
58
+ ...baseText("default", props),
59
+ "&:focus, &:focus-visible, &:active, &:hover": {
60
+ outline: "solid",
61
+ outlineWidth: "1px",
62
+ },
63
+ ...baseBackground("default", props),
53
64
  _hover: {
54
- backgroundColor: mode("blackAlpha.100", "whiteAlpha.200")(props),
55
- color: mode("darkGrey", "white")(props),
65
+ outlineColor: mode("darkGrey", "white")(props),
66
+ ...baseBackground("hover", props),
56
67
  },
57
68
  _active: {
58
- backgroundColor: mode("mint", "whiteAlpha.100")(props),
59
- color: mode("darkGrey", "white")(props),
69
+ outlineColor: mode("blackAlpha.400", "whiteAlpha.400")(props),
70
+ ...baseBackground("active", props),
60
71
  },
61
72
  }),
62
73
  },
@@ -44,7 +44,10 @@ const config = helpers.defineMultiStyleConfig({
44
44
  _hover: {
45
45
  ...ghostBackground("hover", props),
46
46
  },
47
- ...focusVisibleStyles(props),
47
+ _focus: {
48
+ ...ghostBackground("selected", props),
49
+ ...focusVisibleStyles(props)._focusVisible,
50
+ },
48
51
  _selected: {
49
52
  ...ghostBackground("selected", props),
50
53
  },
@@ -38,3 +38,23 @@ export function accentText(state: AccentTextState, props: StyleFunctionProps) {
38
38
  };
39
39
  }
40
40
  }
41
+
42
+ type BrandTextState = Subset<State, "hover" | "active" | "default">;
43
+
44
+ export function brandText(state: BrandTextState, props: StyleFunctionProps) {
45
+ switch (state) {
46
+ case "hover":
47
+ return {
48
+ color: mode("white", "darkTeal")(props),
49
+ };
50
+ case "active":
51
+ return {
52
+ color: mode("white", "darkTeal")(props),
53
+ };
54
+ case "default":
55
+ default:
56
+ return {
57
+ color: mode("pine", "coralGreen")(props),
58
+ };
59
+ }
60
+ }