@vygruppen/spor-react 10.3.0 → 10.4.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/dist/index.js CHANGED
@@ -1149,6 +1149,7 @@ function Combobox({
1149
1149
  emptyContent,
1150
1150
  inputRef: externalInputRef,
1151
1151
  allowsEmptyCollection,
1152
+ variant,
1152
1153
  ...rest
1153
1154
  }) {
1154
1155
  const { contains: contains2 } = reactAria.useFilter({ sensitivity: "base" });
@@ -1202,6 +1203,7 @@ function Combobox({
1202
1203
  ref: inputRef,
1203
1204
  role: "combobox",
1204
1205
  label,
1206
+ variant,
1205
1207
  "aria-expanded": state2.isOpen,
1206
1208
  "aria-autocomplete": "list",
1207
1209
  "aria-controls": listboxId,
@@ -1243,7 +1245,8 @@ function Combobox({
1243
1245
  id: listboxId,
1244
1246
  listBoxRef,
1245
1247
  emptyContent,
1246
- maxWidth: inputWidth
1248
+ maxWidth: inputWidth,
1249
+ variant
1247
1250
  },
1248
1251
  rest.children
1249
1252
  )
@@ -1368,10 +1371,11 @@ function ListBox({
1368
1371
  listBoxRef,
1369
1372
  state: state2,
1370
1373
  maxWidth,
1374
+ variant,
1371
1375
  ...props
1372
1376
  }) {
1373
1377
  const { listBoxProps } = reactAria.useListBox(props, state2, listBoxRef);
1374
- const styles3 = react.useMultiStyleConfig("ListBox", {});
1378
+ const styles3 = react.useMultiStyleConfig("ListBox", { variant });
1375
1379
  return /* @__PURE__ */ React85__namespace.default.createElement(
1376
1380
  react.List,
1377
1381
  {
@@ -1379,7 +1383,8 @@ function ListBox({
1379
1383
  ref: listBoxRef,
1380
1384
  sx: styles3.container,
1381
1385
  "aria-busy": isLoading,
1382
- maxWidth
1386
+ maxWidth,
1387
+ variant
1383
1388
  },
1384
1389
  state2.collection.size === 0 && props.emptyContent,
1385
1390
  Array.from(state2.collection).map(
@@ -1494,16 +1499,17 @@ function InfoSelect({
1494
1499
  triggerRef
1495
1500
  );
1496
1501
  const stateStyle = "completed";
1502
+ const hasChosenValue = state2.selectedItem !== null;
1497
1503
  const styles3 = react.useMultiStyleConfig("InfoSelect", {
1498
1504
  isOpen: state2.isOpen,
1499
1505
  isLabelSrOnly,
1500
1506
  variant,
1501
- stateStyle
1507
+ stateStyle,
1508
+ hasChosenValue
1502
1509
  });
1503
1510
  const { buttonProps } = reactAria.useButton(triggerProps, triggerRef);
1504
1511
  const { t: t2 } = useTranslation();
1505
1512
  const formControl = react.useFormControlProps(props);
1506
- const hasChosenValue = state2.selectedItem !== null;
1507
1513
  return /* @__PURE__ */ React85__namespace.default.createElement(react.Box, { sx: styles3.container }, /* @__PURE__ */ React85__namespace.default.createElement(
1508
1514
  reactAria.HiddenSelect,
1509
1515
  {
@@ -1543,7 +1549,7 @@ function InfoSelect({
1543
1549
  ...valueProps,
1544
1550
  h: isLabelSrOnly ? "" : !hasChosenValue ? "0px" : "18px",
1545
1551
  hidden: !hasChosenValue,
1546
- transform: isLabelSrOnly ? "" : "scale(1) translateY(-10px)",
1552
+ transform: isLabelSrOnly ? "" : "scale(1) translateY(-12px)",
1547
1553
  transitionProperty: "var(--spor-transition-property-common)",
1548
1554
  transitionDuration: "var(--spor-transition-duration-normal)"
1549
1555
  },
@@ -1563,7 +1569,8 @@ function InfoSelect({
1563
1569
  ...menuProps,
1564
1570
  state: state2,
1565
1571
  listBoxRef: listboxRef,
1566
- borderBottomRadius: "sm"
1572
+ borderBottomRadius: "sm",
1573
+ variant
1567
1574
  },
1568
1575
  props.children
1569
1576
  )
@@ -1931,6 +1938,7 @@ var init_CountryCodeSelect = __esm({
1931
1938
  label: t2(texts4.countryCode),
1932
1939
  isLabelSrOnly: true,
1933
1940
  items: callingCodes,
1941
+ variant: props.variant,
1934
1942
  ...props
1935
1943
  },
1936
1944
  (item) => /* @__PURE__ */ React85__namespace.default.createElement(reactStately.Item, { key: item.key }, item.key)
@@ -1958,6 +1966,7 @@ var init_PhoneNumberInput = __esm({
1958
1966
  name,
1959
1967
  value: externalValue,
1960
1968
  onChange: externalOnChange,
1969
+ variant,
1961
1970
  ...boxProps
1962
1971
  }, ref) => {
1963
1972
  const { t: t2 } = useTranslation();
@@ -1980,7 +1989,8 @@ var init_PhoneNumberInput = __esm({
1980
1989
  label: t2(texts5.countryCodeLabel),
1981
1990
  width: "6.25rem",
1982
1991
  height: "100%",
1983
- value: "+47"
1992
+ value: "+47",
1993
+ variant
1984
1994
  },
1985
1995
  /* @__PURE__ */ React85__namespace.default.createElement(reactStately.Item, { key: "+47" }, "+47")
1986
1996
  )
@@ -1995,7 +2005,8 @@ var init_PhoneNumberInput = __esm({
1995
2005
  }),
1996
2006
  name: name ? `${name}-country-code` : "country-code",
1997
2007
  height: "100%",
1998
- width: "6.25rem"
2008
+ width: "6.25rem",
2009
+ variant
1999
2010
  }
2000
2011
  )
2001
2012
  ), /* @__PURE__ */ React85__namespace.default.createElement(
@@ -2014,7 +2025,8 @@ var init_PhoneNumberInput = __esm({
2014
2025
  });
2015
2026
  },
2016
2027
  position: "relative",
2017
- left: "1px"
2028
+ left: "1px",
2029
+ variant
2018
2030
  }
2019
2031
  ));
2020
2032
  }
@@ -2117,8 +2129,8 @@ exports.Switch = void 0;
2117
2129
  var init_Switch = __esm({
2118
2130
  "src/input/Switch.tsx"() {
2119
2131
  exports.Switch = react.forwardRef(
2120
- ({ size: size2 = "md", ...props }, ref) => {
2121
- return /* @__PURE__ */ React85__namespace.default.createElement(react.Switch, { size: size2, ...props, ref });
2132
+ ({ size: size2 = "md", as = "div", ...props }, ref) => {
2133
+ return /* @__PURE__ */ React85__namespace.default.createElement(react.Switch, { as, size: size2, ...props, ref });
2122
2134
  }
2123
2135
  );
2124
2136
  }
@@ -13708,6 +13720,7 @@ var init_info_select = __esm({
13708
13720
  label: {
13709
13721
  position: "relative",
13710
13722
  fontSize: ["mobile.xs", "desktop.sm"],
13723
+ marginTop: props.hasChosenValue ? 2 : 0,
13711
13724
  ...props.isLabelSrOnly ? srOnly2 : {}
13712
13725
  },
13713
13726
  innerButton: {
@@ -14086,102 +14099,146 @@ var init_info_tag = __esm({
14086
14099
  info_tag_default = config20;
14087
14100
  }
14088
14101
  });
14089
- var helpers14, config21, input_default;
14090
- var init_input2 = __esm({
14091
- "src/theme/components/input.ts"() {
14092
- init_dist4();
14102
+
14103
+ // src/theme/utils/input-utils.ts
14104
+ function inputVariant(state2, props) {
14105
+ switch (state2) {
14106
+ case "base":
14107
+ return {
14108
+ ...baseBackground("default", props),
14109
+ ...baseBorder("default", props),
14110
+ _hover: {
14111
+ ...baseBorder("hover", props)
14112
+ },
14113
+ _active: {
14114
+ ...baseBackground("active", props),
14115
+ ...baseBorder("default", props)
14116
+ },
14117
+ _selected: {
14118
+ ...baseBackground("selected", props),
14119
+ ...baseBorder("selected", props)
14120
+ }
14121
+ };
14122
+ case "floating":
14123
+ return {
14124
+ boxShadow: "sm",
14125
+ ...floatingBackground("default", props),
14126
+ ...floatingBorder("default", props),
14127
+ _hover: {
14128
+ ...floatingBorder("hover", props),
14129
+ ...floatingBackground("hover", props)
14130
+ },
14131
+ _active: {
14132
+ ...floatingBorder("active", props),
14133
+ ...floatingBackground("active", props)
14134
+ },
14135
+ _selected: {
14136
+ ...floatingBorder("selected", props),
14137
+ ...floatingBackground("selected", props)
14138
+ }
14139
+ };
14140
+ case "default":
14141
+ default:
14142
+ return {
14143
+ ...baseBackground("default", props),
14144
+ ...baseBorder("default", props),
14145
+ _hover: {
14146
+ ...baseBorder("hover", props)
14147
+ },
14148
+ _active: {
14149
+ ...baseBackground("active", props),
14150
+ ...baseBorder("default", props)
14151
+ },
14152
+ _selected: {
14153
+ ...baseBackground("selected", props),
14154
+ ...baseBorder("selected", props)
14155
+ }
14156
+ };
14157
+ }
14158
+ }
14159
+ var inputBaseStyle;
14160
+ var init_input_utils = __esm({
14161
+ "src/theme/utils/input-utils.ts"() {
14093
14162
  init_base_utils();
14163
+ init_floating_utils();
14094
14164
  init_focus_utils();
14095
14165
  init_surface_utils();
14096
- init_floating_utils();
14097
- helpers14 = react.createMultiStyleConfigHelpers(inputAnatomy.keys);
14098
- config21 = helpers14.defineMultiStyleConfig({
14099
- baseStyle: (props) => ({
14100
- field: {
14101
- appearance: "none",
14102
- width: "100%",
14103
- outline: "none",
14104
- border: 0,
14105
- borderRadius: "sm",
14106
- transitionProperty: "common",
14107
- transitionDuration: "fast",
14108
- position: "relative",
14109
- paddingX: 3,
14110
- height: 8,
14111
- fontSize: "mobile.md",
14166
+ inputBaseStyle = (props) => ({
14167
+ field: {
14168
+ appearance: "none",
14169
+ width: "100%",
14170
+ outline: "none",
14171
+ border: 0,
14172
+ borderRadius: "sm",
14173
+ transitionProperty: "common",
14174
+ transitionDuration: "fast",
14175
+ position: "relative",
14176
+ paddingX: 3,
14177
+ height: 8,
14178
+ fontSize: "mobile.md",
14179
+ _focusVisible: {
14180
+ ...focusVisibleStyles(props)._focusVisible,
14181
+ outlineOffset: 0
14182
+ },
14183
+ _disabled: {
14184
+ ...surface("disabled", props),
14185
+ ...baseBorder("disabled", props),
14186
+ pointerEvents: "none"
14187
+ },
14188
+ _invalid: {
14189
+ ...baseBorder("invalid", props),
14112
14190
  _hover: {
14113
14191
  ...baseBorder("hover", props)
14114
- },
14115
- _active: {
14116
- ...baseBackground("active", props),
14117
- ...baseBorder("default", props)
14118
- },
14119
- _focusVisible: {
14120
- ...focusVisibleStyles(props)._focusVisible,
14121
- outlineOffset: 0
14122
- },
14123
- _disabled: {
14124
- ...surface("disabled", props),
14125
- ...baseBorder("disabled", props),
14126
- pointerEvents: "none"
14127
- },
14128
- _invalid: {
14129
- ...baseBorder("invalid", props),
14130
- _hover: {
14131
- ...baseBorder("hover", props)
14132
- }
14133
- },
14134
- " + label": {
14135
- fontSize: ["mobile.sm", "desktop.sm"],
14136
- top: "2px",
14137
- left: props.paddingLeft || props.pl || 3,
14138
- zIndex: 2,
14139
- position: "absolute",
14140
- marginY: 2,
14141
- transition: ".1s ease-out",
14142
- transformOrigin: "top left",
14143
- cursor: "text"
14144
- },
14145
- "&:not(:placeholder-shown)": {
14146
- paddingTop: "1rem",
14147
- "& + label": {
14148
- transform: "scale(0.825) translateY(-10px)"
14149
- }
14150
14192
  }
14151
14193
  },
14152
- element: {
14153
- height: "100%"
14194
+ " + label": {
14195
+ fontSize: ["mobile.sm", "desktop.sm"],
14196
+ top: "2px",
14197
+ left: props.paddingLeft || props.pl || 3,
14198
+ zIndex: 2,
14199
+ position: "absolute",
14200
+ marginY: 2,
14201
+ transition: ".1s ease-out",
14202
+ transformOrigin: "top left",
14203
+ cursor: "text"
14154
14204
  },
14155
- group: {
14156
- ":has(:disabled)": {
14157
- ...baseText("disabled", props)
14205
+ "&:not(:placeholder-shown)": {
14206
+ paddingTop: "1rem",
14207
+ "& + label": {
14208
+ transform: "scale(0.825) translateY(-10px)"
14158
14209
  }
14159
14210
  }
14211
+ },
14212
+ element: {
14213
+ height: "100%"
14214
+ },
14215
+ group: {
14216
+ ":has(:disabled)": {
14217
+ ...baseText("disabled", props)
14218
+ }
14219
+ }
14220
+ });
14221
+ }
14222
+ });
14223
+ var helpers14, config21, input_default;
14224
+ var init_input2 = __esm({
14225
+ "src/theme/components/input.ts"() {
14226
+ init_dist4();
14227
+ init_input_utils();
14228
+ helpers14 = react.createMultiStyleConfigHelpers(inputAnatomy.keys);
14229
+ config21 = helpers14.defineMultiStyleConfig({
14230
+ baseStyle: (props) => ({
14231
+ ...inputBaseStyle(props)
14160
14232
  }),
14161
14233
  variants: {
14162
14234
  base: (props) => ({
14163
14235
  field: {
14164
- ...baseBackground("default", props),
14165
- ...baseBorder("default", props)
14236
+ ...inputVariant("base", props)
14166
14237
  }
14167
14238
  }),
14168
14239
  floating: (props) => ({
14169
14240
  field: {
14170
- boxShadow: "sm",
14171
- ...floatingBackground("default", props),
14172
- ...floatingBorder("default", props),
14173
- _hover: {
14174
- ...floatingBorder("hover", props),
14175
- ...floatingBackground("hover", props)
14176
- },
14177
- _active: {
14178
- ...floatingBorder("active", props),
14179
- ...floatingBackground("active", props)
14180
- },
14181
- _selected: {
14182
- ...floatingBorder("selected", props),
14183
- ...floatingBackground("selected", props)
14184
- }
14241
+ ...inputVariant("floating", props)
14185
14242
  }
14186
14243
  })
14187
14244
  },
@@ -14451,6 +14508,7 @@ var init_listbox = __esm({
14451
14508
  init_ghost_utils();
14452
14509
  init_surface_utils();
14453
14510
  init_outline_utils();
14511
+ init_floating_utils();
14454
14512
  parts11 = anatomy("ListBox").parts(
14455
14513
  "container",
14456
14514
  "item",
@@ -14467,8 +14525,7 @@ var init_listbox = __esm({
14467
14525
  maxHeight: "50vh",
14468
14526
  width: "100%",
14469
14527
  listStyle: "none",
14470
- borderBottomRadius: "sm",
14471
- ...baseBorder("default", props)
14528
+ borderBottomRadius: "sm"
14472
14529
  },
14473
14530
  item: {
14474
14531
  paddingX: 2,
@@ -14500,7 +14557,22 @@ var init_listbox = __esm({
14500
14557
  ...ghostText("selected", props)
14501
14558
  }
14502
14559
  }
14503
- })
14560
+ }),
14561
+ variants: {
14562
+ base: (props) => ({
14563
+ container: {
14564
+ ...baseBorder("default", props)
14565
+ }
14566
+ }),
14567
+ floating: (props) => ({
14568
+ container: {
14569
+ ...floatingBorder("default", props)
14570
+ }
14571
+ })
14572
+ },
14573
+ defaultProps: {
14574
+ variant: "base"
14575
+ }
14504
14576
  });
14505
14577
  listbox_default = config24;
14506
14578
  }
@@ -15186,7 +15258,7 @@ var init_select = __esm({
15186
15258
  "src/theme/components/select.ts"() {
15187
15259
  init_dist4();
15188
15260
  init_base_utils();
15189
- init_input2();
15261
+ init_input_utils();
15190
15262
  parts18 = selectAnatomy.extend("root");
15191
15263
  helpers26 = react.createMultiStyleConfigHelpers(parts18.keys);
15192
15264
  config34 = helpers26.defineMultiStyleConfig({
@@ -15197,7 +15269,7 @@ var init_select = __esm({
15197
15269
  position: "relative",
15198
15270
  "& + label": {
15199
15271
  fontSize: ["mobile.sm", "desktop.sm"],
15200
- top: "2px",
15272
+ top: "0.2rem",
15201
15273
  left: 3,
15202
15274
  zIndex: 2,
15203
15275
  position: "absolute",
@@ -15210,10 +15282,9 @@ var init_select = __esm({
15210
15282
  }
15211
15283
  },
15212
15284
  field: {
15213
- ...input_default.baseStyle(props).field,
15285
+ ...inputBaseStyle(props).field,
15214
15286
  appearance: "none",
15215
- paddingTop: "1rem",
15216
- "option, optgroup": {}
15287
+ paddingTop: "1rem"
15217
15288
  },
15218
15289
  icon: {
15219
15290
  width: 5,
@@ -15227,7 +15298,22 @@ var init_select = __esm({
15227
15298
  ...baseText("disabled", props)
15228
15299
  }
15229
15300
  }
15230
- })
15301
+ }),
15302
+ variants: {
15303
+ base: (props) => ({
15304
+ field: {
15305
+ ...inputVariant("base", props)
15306
+ }
15307
+ }),
15308
+ floating: (props) => ({
15309
+ field: {
15310
+ ...inputVariant("floating", props)
15311
+ }
15312
+ })
15313
+ },
15314
+ defaultProps: {
15315
+ variant: "base"
15316
+ }
15231
15317
  });
15232
15318
  select_default = config34;
15233
15319
  }
@@ -15779,10 +15865,10 @@ var init_tabs = __esm({
15779
15865
  var config40, textarea_default;
15780
15866
  var init_textarea = __esm({
15781
15867
  "src/theme/components/textarea.ts"() {
15782
- init_input2();
15868
+ init_input_utils();
15783
15869
  config40 = react.defineStyleConfig({
15784
15870
  baseStyle: (props) => ({
15785
- ...input_default.baseStyle(props).field,
15871
+ ...inputBaseStyle(props).field,
15786
15872
  minHeight: "5rem",
15787
15873
  verticalAlign: "top",
15788
15874
  appearance: "none",
@@ -15795,7 +15881,18 @@ var init_textarea = __esm({
15795
15881
  transform: "scale(0.825) translateY(-10px)"
15796
15882
  }
15797
15883
  }
15798
- })
15884
+ }),
15885
+ variants: {
15886
+ base: (props) => ({
15887
+ ...inputVariant("base", props)
15888
+ }),
15889
+ floating: (props) => ({
15890
+ ...inputVariant("floating", props)
15891
+ })
15892
+ },
15893
+ defaultProps: {
15894
+ variant: "base"
15895
+ }
15799
15896
  });
15800
15897
  textarea_default = config40;
15801
15898
  }
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, CardSelect, CargonetLogo, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, Collapse, 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, FullScreenDrawer, 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, Pagination, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, PressableCard, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, RadioCardGroupContext, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, StaticCard, 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, VyLogoPride, 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-5HRYDWQ5.mjs';
1
+ export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Brand, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Button, ButtonGroup, CardSelect, CargonetLogo, Center, Checkbox, CheckboxGroup, ChoiceChip, ClosableAlert, CloseButton, Code, Collapse, 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, FullScreenDrawer, 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, Pagination, PasswordInput, PhoneNumberInput, PlayPauseButton, Portal, PressableCard, ProgressBar, ProgressIndicator, ProgressLoader, Radio, RadioCard, RadioCardGroup, RadioCardGroupContext, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, Skeleton, SkeletonCircle, SkeletonText, SkipButton, Slide, SlideFade, Spacer, SporProvider, Stack, StaticAlert, StaticCard, 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, VyLogoPride, 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-T4CLCBB5.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
- "version": "10.3.0",
3
+ "version": "10.4.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -38,6 +38,7 @@ export type ComboboxProps<T> = AriaComboBoxProps<T> & {
38
38
  inputRef?: React.RefObject<HTMLInputElement>;
39
39
  /** If you want to allow an empty collection */
40
40
  allowsEmptyCollection?: boolean;
41
+ variant?: "base" | "floating";
41
42
  } & OverridableInputProps;
42
43
  /**
43
44
  * A combobox is a combination of an input and a list of suggestions.
@@ -87,6 +88,7 @@ export function Combobox<T extends object>({
87
88
  emptyContent,
88
89
  inputRef: externalInputRef,
89
90
  allowsEmptyCollection,
91
+ variant,
90
92
  ...rest
91
93
  }: ComboboxProps<T>) {
92
94
  const { contains } = useFilter({ sensitivity: "base" });
@@ -147,6 +149,7 @@ export function Combobox<T extends object>({
147
149
  ref={inputRef}
148
150
  role="combobox"
149
151
  label={label}
152
+ variant={variant}
150
153
  aria-expanded={state.isOpen}
151
154
  aria-autocomplete="list"
152
155
  aria-controls={listboxId}
@@ -196,6 +199,7 @@ export function Combobox<T extends object>({
196
199
  listBoxRef={listBoxRef}
197
200
  emptyContent={emptyContent}
198
201
  maxWidth={inputWidth}
202
+ variant={variant}
199
203
  >
200
204
  {rest.children}
201
205
  </ListBox>
@@ -26,6 +26,7 @@ type CountryCodeSelectProps = {
26
26
  name: string;
27
27
  width?: BoxProps["width"];
28
28
  height?: BoxProps["height"];
29
+ variant?: "base" | "floating";
29
30
  };
30
31
  export const CountryCodeSelect = (props: CountryCodeSelectProps) => {
31
32
  const { t } = useTranslation();
@@ -35,6 +36,7 @@ export const CountryCodeSelect = (props: CountryCodeSelectProps) => {
35
36
  label={t(texts.countryCode)}
36
37
  isLabelSrOnly={true}
37
38
  items={callingCodes as any}
39
+ variant={props.variant}
38
40
  {...props}
39
41
  >
40
42
  {(item) => <Item key={item.key}>{item.key}</Item>}
@@ -178,18 +178,19 @@ export function InfoSelect<T extends object>({
178
178
 
179
179
  const stateStyle = "completed";
180
180
 
181
+ const hasChosenValue = state.selectedItem !== null;
182
+
181
183
  const styles = useMultiStyleConfig("InfoSelect", {
182
184
  isOpen: state.isOpen,
183
185
  isLabelSrOnly,
184
186
  variant,
185
187
  stateStyle,
188
+ hasChosenValue,
186
189
  });
187
190
  const { buttonProps } = useButton(triggerProps, triggerRef);
188
191
  const { t } = useTranslation();
189
192
  const formControl = useFormControlProps(props);
190
193
 
191
- const hasChosenValue = state.selectedItem !== null;
192
-
193
194
  return (
194
195
  <Box sx={styles.container}>
195
196
  <HiddenSelect
@@ -226,7 +227,7 @@ export function InfoSelect<T extends object>({
226
227
  {...valueProps}
227
228
  h={isLabelSrOnly ? "" : !hasChosenValue ? "0px" : "18px"}
228
229
  hidden={!hasChosenValue}
229
- transform={isLabelSrOnly ? "" : "scale(1) translateY(-10px)"}
230
+ transform={isLabelSrOnly ? "" : "scale(1) translateY(-12px)"}
230
231
  transitionProperty={"var(--spor-transition-property-common)"}
231
232
  transitionDuration={"var(--spor-transition-duration-normal)"}
232
233
  >
@@ -253,6 +254,7 @@ export function InfoSelect<T extends object>({
253
254
  state={state}
254
255
  listBoxRef={listboxRef}
255
256
  borderBottomRadius="sm"
257
+ variant={variant}
256
258
  >
257
259
  {props.children}
258
260
  </ListBox>
@@ -29,6 +29,7 @@ type ListBoxProps<T> = AriaListBoxProps<T> &
29
29
  /** UI to render if the collection is empty */
30
30
  emptyContent?: React.ReactNode;
31
31
  maxWidth?: BoxProps["maxWidth"];
32
+ variant?: "base" | "floating";
32
33
  };
33
34
 
34
35
  /**
@@ -70,10 +71,11 @@ export function ListBox<T extends object>({
70
71
  listBoxRef,
71
72
  state,
72
73
  maxWidth,
74
+ variant,
73
75
  ...props
74
76
  }: ListBoxProps<T>) {
75
77
  const { listBoxProps } = useListBox(props, state, listBoxRef);
76
- const styles = useMultiStyleConfig("ListBox", {});
78
+ const styles = useMultiStyleConfig("ListBox", { variant });
77
79
 
78
80
  return (
79
81
  <List
@@ -82,6 +84,7 @@ export function ListBox<T extends object>({
82
84
  sx={styles.container}
83
85
  aria-busy={isLoading}
84
86
  maxWidth={maxWidth}
87
+ variant={variant}
85
88
  >
86
89
  {state.collection.size === 0 && props.emptyContent}
87
90
  {Array.from(state.collection).map((item) =>
@@ -24,6 +24,7 @@ type PhoneNumberInputProps = Omit<BoxProps, "onChange"> & {
24
24
  onChange?: (change: CountryCodeAndPhoneNumber) => void;
25
25
  /** The optional value of the country code and phone number */
26
26
  value?: CountryCodeAndPhoneNumber;
27
+ variant?: "base" | "floating";
27
28
  };
28
29
  /**
29
30
  * A component for entering phone numbers.
@@ -49,6 +50,7 @@ export const PhoneNumberInput = forwardRef<PhoneNumberInputProps, As>(
49
50
  name,
50
51
  value: externalValue,
51
52
  onChange: externalOnChange,
53
+ variant,
52
54
  ...boxProps
53
55
  },
54
56
  ref,
@@ -73,6 +75,7 @@ export const PhoneNumberInput = forwardRef<PhoneNumberInputProps, As>(
73
75
  width="6.25rem"
74
76
  height="100%"
75
77
  value="+47"
78
+ variant={variant}
76
79
  >
77
80
  <Item key="+47">+47</Item>
78
81
  </InfoSelect>
@@ -89,6 +92,7 @@ export const PhoneNumberInput = forwardRef<PhoneNumberInputProps, As>(
89
92
  name={name ? `${name}-country-code` : "country-code"}
90
93
  height="100%"
91
94
  width="6.25rem"
95
+ variant={variant}
92
96
  />
93
97
  </Suspense>
94
98
  <Input
@@ -107,6 +111,7 @@ export const PhoneNumberInput = forwardRef<PhoneNumberInputProps, As>(
107
111
  }}
108
112
  position="relative"
109
113
  left="1px" // Makes the borders overlap
114
+ variant={variant}
110
115
  />
111
116
  </AttachedInputs>
112
117
  );