@vygruppen/spor-react 3.1.2 → 3.2.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@3.1.2 build
2
+ > @vygruppen/spor-react@3.2.0 build
3
3
  > tsup src/index.tsx --dts --treeshake --format cjs,esm
4
4
 
5
5
  CLI Building entry: src/index.tsx
@@ -9,13 +9,13 @@
9
9
  CJS Build start
10
10
  ESM Build start
11
11
  DTS Build start
12
+ "toZoned" and "toTime" are imported from external module "@internationalized/date" but never used in "dist/chunk-QOZMDFH3.mjs".
12
13
  "toZoned" and "toTime" are imported from external module "@internationalized/date" but never used in "dist/index.js".
13
- "toZoned" and "toTime" are imported from external module "@internationalized/date" but never used in "dist/chunk-GIRK7GTN.mjs".
14
- CJS dist/index.js 901.12 KB
15
- CJS ⚡️ Build success in 4689ms
16
14
  ESM dist/index.mjs 2.01 KB
17
- ESM dist/CountryCodeSelect-PU2FEIUH.mjs 350.82 KB
18
- ESM dist/chunk-GIRK7GTN.mjs 418.55 KB
19
- ESM ⚡️ Build success in 4689ms
20
- DTS ⚡️ Build success in 18196ms
21
- DTS dist/index.d.ts 251.63 KB
15
+ ESM dist/CountryCodeSelect-YGXVIC6H.mjs 350.82 KB
16
+ ESM dist/chunk-QOZMDFH3.mjs 418.96 KB
17
+ ESM ⚡️ Build success in 4811ms
18
+ CJS dist/index.js 901.54 KB
19
+ CJS ⚡️ Build success in 4811ms
20
+ DTS ⚡️ Build success in 17792ms
21
+ DTS dist/index.d.ts 251.71 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vygruppen/spor-react
2
2
 
3
+ ## 3.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 37b40a9b: Adds withInput prop to numericStepper
8
+
3
9
  ## 3.1.2
4
10
 
5
11
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { createTexts, useTranslation, InfoSelect, Item } from './chunk-GIRK7GTN.mjs';
1
+ import { createTexts, useTranslation, InfoSelect, Item } from './chunk-QOZMDFH3.mjs';
2
2
  import React from 'react';
3
3
 
4
4
  // ../../node_modules/awesome-phonenumber/index-esm.mjs
@@ -4969,6 +4969,7 @@ function NumericStepper({
4969
4969
  minValue = 0,
4970
4970
  maxValue = 99,
4971
4971
  isDisabled,
4972
+ withInput = true,
4972
4973
  ...boxProps
4973
4974
  }) {
4974
4975
  const { t: t2 } = useTranslation();
@@ -4990,7 +4991,7 @@ function NumericStepper({
4990
4991
  visibility: value <= minValue ? "hidden" : "visible",
4991
4992
  isDisabled: formControlProps.disabled
4992
4993
  }
4993
- ), /* @__PURE__ */ React49__default.createElement(
4994
+ ), withInput ? /* @__PURE__ */ React49__default.createElement(
4994
4995
  chakra.input,
4995
4996
  {
4996
4997
  type: "number",
@@ -5040,6 +5041,21 @@ function NumericStepper({
5040
5041
  onChange(numericInput);
5041
5042
  }
5042
5043
  }
5044
+ ) : /* @__PURE__ */ React49__default.createElement(
5045
+ chakra.text,
5046
+ {
5047
+ fontSize: "sm",
5048
+ fontWeight: "bold",
5049
+ width: "3ch",
5050
+ marginX: 1,
5051
+ paddingX: 1,
5052
+ textAlign: "center",
5053
+ color: textColor,
5054
+ transition: "box-shadow .1s ease-out",
5055
+ visibility: value === 0 ? "hidden" : "visible",
5056
+ "aria-label": value.toString()
5057
+ },
5058
+ value
5043
5059
  ), /* @__PURE__ */ React49__default.createElement(
5044
5060
  VerySmallButton,
5045
5061
  {
@@ -5253,7 +5269,7 @@ var texts13 = createTexts({
5253
5269
  sv: "Telefonnummer"
5254
5270
  }
5255
5271
  });
5256
- var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-PU2FEIUH.mjs'));
5272
+ var LazyCountryCodeSelect = React49__default.lazy(() => import('./CountryCodeSelect-YGXVIC6H.mjs'));
5257
5273
  var Radio = forwardRef((props, ref) => {
5258
5274
  return /* @__PURE__ */ React49__default.createElement(Radio$1, { ...props, ref });
5259
5275
  });
package/dist/index.d.ts CHANGED
@@ -1096,6 +1096,8 @@ type NumericStepperProps = {
1096
1096
  maxValue?: number;
1097
1097
  /** Whether the stepper is disabled or not */
1098
1098
  isDisabled?: boolean;
1099
+ /** Whether to show input field or not */
1100
+ withInput?: boolean;
1099
1101
  } & Omit<BoxProps, "onChange">;
1100
1102
  /** A simple stepper component for integer values
1101
1103
  *
@@ -1121,7 +1123,7 @@ type NumericStepperProps = {
1121
1123
  * </FormControl>
1122
1124
  * ```
1123
1125
  */
1124
- declare function NumericStepper({ name: nameProp, id: idProp, value: valueProp, defaultValue, onChange: onChangeProp, minValue, maxValue, isDisabled, ...boxProps }: NumericStepperProps): React__default.JSX.Element;
1126
+ declare function NumericStepper({ name: nameProp, id: idProp, value: valueProp, defaultValue, onChange: onChangeProp, minValue, maxValue, isDisabled, withInput, ...boxProps }: NumericStepperProps): React__default.JSX.Element;
1125
1127
 
1126
1128
  type PasswordInputProps = InputProps;
1127
1129
  declare const PasswordInput: _chakra_ui_system_dist_system_types.ComponentWithAs<"input", InputProps>;
package/dist/index.js CHANGED
@@ -5626,6 +5626,7 @@ function NumericStepper({
5626
5626
  minValue = 0,
5627
5627
  maxValue = 99,
5628
5628
  isDisabled,
5629
+ withInput = true,
5629
5630
  ...boxProps
5630
5631
  }) {
5631
5632
  const { t: t2 } = useTranslation();
@@ -5647,7 +5648,7 @@ function NumericStepper({
5647
5648
  visibility: value <= minValue ? "hidden" : "visible",
5648
5649
  isDisabled: formControlProps.disabled
5649
5650
  }
5650
- ), /* @__PURE__ */ React49__namespace.default.createElement(
5651
+ ), withInput ? /* @__PURE__ */ React49__namespace.default.createElement(
5651
5652
  react.chakra.input,
5652
5653
  {
5653
5654
  type: "number",
@@ -5697,6 +5698,21 @@ function NumericStepper({
5697
5698
  onChange(numericInput);
5698
5699
  }
5699
5700
  }
5701
+ ) : /* @__PURE__ */ React49__namespace.default.createElement(
5702
+ react.chakra.text,
5703
+ {
5704
+ fontSize: "sm",
5705
+ fontWeight: "bold",
5706
+ width: "3ch",
5707
+ marginX: 1,
5708
+ paddingX: 1,
5709
+ textAlign: "center",
5710
+ color: textColor,
5711
+ transition: "box-shadow .1s ease-out",
5712
+ visibility: value === 0 ? "hidden" : "visible",
5713
+ "aria-label": value.toString()
5714
+ },
5715
+ value
5700
5716
  ), /* @__PURE__ */ React49__namespace.default.createElement(
5701
5717
  VerySmallButton,
5702
5718
  {
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Button, ButtonGroup, Card, CardSelect, 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, 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, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, NumericStepper, PasswordInput, PhoneNumberInput, PlayPauseButton, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, PopoverWizardBody, ProgressBar, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, SimplePopover, 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, Tr, TravelTag, VStack, VyLogo, WizardPopover, Wrap, WrapItem, createTexts, extendTheme, fontFaces, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useTheme, useToast, useToken, useTranslation } from './chunk-GIRK7GTN.mjs';
1
+ export { Accordion, AccordionButton, AccordionIcon, AccordionItem, AccordionPanel, AttachedInputs, Badge, Box, Button, ButtonGroup, Card, CardSelect, 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, 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, Modal, ModalBody, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalOverlay, NativeSelect, NumericStepper, PasswordInput, PhoneNumberInput, PlayPauseButton, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, PopoverWizardBody, ProgressBar, ProgressLoader, Radio, RadioGroup, ScaleFade, SearchInput, Section, SimpleDrawer, SimpleGrid, SimplePopover, 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, Tr, TravelTag, VStack, VyLogo, WizardPopover, Wrap, WrapItem, createTexts, extendTheme, fontFaces, theme, tokens, useBreakpointValue, useClipboard, useColorMode, useColorModePreference, useColorModeValue, useControllableProp, useDisclosure, useMediaQuery, useMergeRefs, useOutsideClick, usePrefersReducedMotion, useTheme, useToast, useToken, useTranslation } from './chunk-QOZMDFH3.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vygruppen/spor-react",
3
- "version": "3.1.2",
3
+ "version": "3.2.0",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -31,6 +31,8 @@ type NumericStepperProps = {
31
31
  maxValue?: number;
32
32
  /** Whether the stepper is disabled or not */
33
33
  isDisabled?: boolean;
34
+ /** Whether to show input field or not */
35
+ withInput?: boolean;
34
36
  } & Omit<BoxProps, "onChange">;
35
37
  /** A simple stepper component for integer values
36
38
  *
@@ -65,6 +67,7 @@ export function NumericStepper({
65
67
  minValue = 0,
66
68
  maxValue = 99,
67
69
  isDisabled,
70
+ withInput = true,
68
71
  ...boxProps
69
72
  }: NumericStepperProps) {
70
73
  const { t } = useTranslation();
@@ -87,54 +90,71 @@ export function NumericStepper({
87
90
  visibility={value <= minValue ? "hidden" : "visible"}
88
91
  isDisabled={formControlProps.disabled}
89
92
  />
90
- <chakra.input
91
- type="number"
92
- min={minValue}
93
- max={maxValue}
94
- name={nameProp}
95
- value={value}
96
- {...formControlProps}
97
- id={value !== 0 ? formControlProps.id : undefined}
98
- fontSize="sm"
99
- fontWeight="bold"
100
- width="3ch"
101
- marginX={1}
102
- paddingX={1}
103
- borderRadius="xs"
104
- textAlign="center"
105
- backgroundColor={backgroundColor}
106
- color={textColor}
107
- transition="box-shadow .1s ease-out"
108
- visibility={value === 0 ? "hidden" : "visible"}
109
- aria-live="assertive"
110
- aria-label={value.toString()}
111
- _hover={{
112
- boxShadow: getBoxShadowString({
113
- borderColor: "currentColor",
114
- borderWidth: 1,
115
- }),
116
- _disabled: {
117
- boxShadow: "none",
118
- },
119
- }}
120
- _disabled={{
121
- opacity: 0.5,
122
- }}
123
- _focus={{
124
- outline: "none",
125
- boxShadow: getBoxShadowString({
126
- borderColor: focusColor,
127
- borderWidth: 1,
128
- }),
129
- }}
130
- onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
131
- const numericInput = Number(e.target.value);
132
- if (Number.isNaN(numericInput)) {
133
- return;
134
- }
135
- onChange(numericInput);
136
- }}
137
- />
93
+ {withInput ? (
94
+ <chakra.input
95
+ type="number"
96
+ min={minValue}
97
+ max={maxValue}
98
+ name={nameProp}
99
+ value={value}
100
+ {...formControlProps}
101
+ id={value !== 0 ? formControlProps.id : undefined}
102
+ fontSize="sm"
103
+ fontWeight="bold"
104
+ width="3ch"
105
+ marginX={1}
106
+ paddingX={1}
107
+ borderRadius="xs"
108
+ textAlign="center"
109
+ backgroundColor={backgroundColor}
110
+ color={textColor}
111
+ transition="box-shadow .1s ease-out"
112
+ visibility={value === 0 ? "hidden" : "visible"}
113
+ aria-live="assertive"
114
+ aria-label={value.toString()}
115
+ _hover={{
116
+ boxShadow: getBoxShadowString({
117
+ borderColor: "currentColor",
118
+ borderWidth: 1,
119
+ }),
120
+ _disabled: {
121
+ boxShadow: "none",
122
+ },
123
+ }}
124
+ _disabled={{
125
+ opacity: 0.5,
126
+ }}
127
+ _focus={{
128
+ outline: "none",
129
+ boxShadow: getBoxShadowString({
130
+ borderColor: focusColor,
131
+ borderWidth: 1,
132
+ }),
133
+ }}
134
+ onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
135
+ const numericInput = Number(e.target.value);
136
+ if (Number.isNaN(numericInput)) {
137
+ return;
138
+ }
139
+ onChange(numericInput);
140
+ }}
141
+ />
142
+ ) : (
143
+ <chakra.text
144
+ fontSize="sm"
145
+ fontWeight="bold"
146
+ width="3ch"
147
+ marginX={1}
148
+ paddingX={1}
149
+ textAlign="center"
150
+ color={textColor}
151
+ transition="box-shadow .1s ease-out"
152
+ visibility={value === 0 ? "hidden" : "visible"}
153
+ aria-label={value.toString()}
154
+ >
155
+ {value}
156
+ </chakra.text>
157
+ )}
138
158
  <VerySmallButton
139
159
  icon={<AddIcon color="white" />}
140
160
  aria-label={t(texts.incrementButtonAriaLabel)}
@@ -242,4 +262,4 @@ const texts = createTexts({
242
262
  nn: "Legg til 1",
243
263
  sv: "Lägg till 1",
244
264
  },
245
- });
265
+ });