@vygruppen/spor-react 2.3.0 → 2.3.3
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/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +20 -0
- package/dist/{CountryCodeSelect-B2GP2C3U.mjs → CountryCodeSelect-WGG2Z3VI.mjs} +1 -1
- package/dist/{chunk-NYC3Z75S.mjs → chunk-QXVLVC2K.mjs} +296 -276
- package/dist/index.d.ts +78 -19
- package/dist/index.js +404 -382
- package/dist/index.mjs +1 -1
- package/package.json +6 -7
- package/src/i18n/index.tsx +100 -9
- package/src/input/{Counter.tsx → NumericStepper.tsx} +13 -10
- package/src/input/index.tsx +1 -1
- package/src/provider/SporProvider.tsx +1 -1
package/dist/index.d.ts
CHANGED
@@ -10,7 +10,6 @@ import { DateValue } from '@internationalized/date';
|
|
10
10
|
export { Time } from '@internationalized/date';
|
11
11
|
import { AriaDatePickerProps, AriaDateRangePickerProps, AriaPositionProps, AriaListBoxOptions } from 'react-aria';
|
12
12
|
import { TimeValue } from '@react-types/datepicker';
|
13
|
-
import * as _leile_lobo_t from '@leile/lobo-t';
|
14
13
|
import { SelectState, ListState } from 'react-stately';
|
15
14
|
export { Item as SelectItem } from 'react-stately';
|
16
15
|
import * as _chakra_ui_theme_tools_dist_component from '@chakra-ui/theme-tools/dist/component';
|
@@ -505,17 +504,69 @@ declare enum Language {
|
|
505
504
|
Swedish = "sv",
|
506
505
|
English = "en"
|
507
506
|
}
|
508
|
-
|
509
|
-
|
510
|
-
t: _leile_lobo_t.TFunc<typeof Language>;
|
511
|
-
language: Language;
|
512
|
-
};
|
513
|
-
type LanguageObject = {
|
514
|
-
[key in Language]: string;
|
507
|
+
type TranslationObject = {
|
508
|
+
[key in Language]: string | React__default.ReactElement;
|
515
509
|
};
|
516
|
-
type
|
510
|
+
type TranslationFunction = (...args: Array<string | number>) => TranslationObject;
|
511
|
+
type Translation = TranslationObject | TranslationFunction;
|
517
512
|
type Translations = {
|
518
|
-
[key: string]:
|
513
|
+
[key: string]: Translation | Translations;
|
514
|
+
};
|
515
|
+
type LanguageProviderProps = {
|
516
|
+
language: Language;
|
517
|
+
children: React__default.ReactElement;
|
518
|
+
};
|
519
|
+
/**
|
520
|
+
* A language provider component.
|
521
|
+
*
|
522
|
+
* This component should wrap your entire application. It will provide the language to all components that use it.
|
523
|
+
*
|
524
|
+
* This is done by the SporProvider component, so most likely, you won't need to use it directly, unless you want to use a specific language for a specific part of your application.
|
525
|
+
*
|
526
|
+
* ```tsx
|
527
|
+
* import { LanguageProvider, Language } from "@vygruppen/spor-react";
|
528
|
+
*
|
529
|
+
* const App = () => {
|
530
|
+
* return (
|
531
|
+
* <LanguageProvider language={Language.NorwegianBokmal}>
|
532
|
+
* <Routes />
|
533
|
+
* </LanguageProvider>
|
534
|
+
* );
|
535
|
+
* }
|
536
|
+
* ```
|
537
|
+
*
|
538
|
+
*/
|
539
|
+
declare function LanguageProvider({ language, children, }: LanguageProviderProps): React__default.JSX.Element;
|
540
|
+
/**
|
541
|
+
* A hook that returns translation utilities. Typically used to translate text.
|
542
|
+
*
|
543
|
+
* ```tsx
|
544
|
+
* const Example = () => {
|
545
|
+
* const { t } = useTranslation();
|
546
|
+
* return <p>{t(texts.greeting)}</p>;
|
547
|
+
* }
|
548
|
+
* const texts = {
|
549
|
+
* greeting: {
|
550
|
+
* nb: "Hei",
|
551
|
+
* nn: "Hei",
|
552
|
+
* sv: "Hej",
|
553
|
+
* en: "Hello",
|
554
|
+
* }
|
555
|
+
* }
|
556
|
+
* ```
|
557
|
+
*
|
558
|
+
* You can also use it to fetch the current language:
|
559
|
+
*
|
560
|
+
* ```tsx
|
561
|
+
* const Example = () => {
|
562
|
+
* const { language } = useTranslation();
|
563
|
+
* return <p>{language}</p>;
|
564
|
+
* };
|
565
|
+
* ```
|
566
|
+
*/
|
567
|
+
declare function useTranslation(): {
|
568
|
+
readonly t: (text: TranslationObject) => string;
|
569
|
+
readonly language: Language;
|
519
570
|
};
|
520
571
|
/** Utility function that creates type safe text objects with useTranslation
|
521
572
|
*
|
@@ -526,6 +577,14 @@ type Translations = {
|
|
526
577
|
* nn: "Døme",
|
527
578
|
* sv: "Exempel",
|
528
579
|
* en: "Example",
|
580
|
+
* },
|
581
|
+
* another: {
|
582
|
+
* example: {
|
583
|
+
* nb: <strong>Eksempel</strong>,
|
584
|
+
* nn: <strong>Døme</strong>,
|
585
|
+
* sv: <strong>Exempel</strong>,
|
586
|
+
* en: <strong>Example</strong>,
|
587
|
+
* }
|
529
588
|
* }
|
530
589
|
* })
|
531
590
|
* ```
|
@@ -677,7 +736,7 @@ type ChoiceChipProps = {
|
|
677
736
|
*/
|
678
737
|
declare const ChoiceChip: _chakra_ui_system_dist_system_types.ComponentWithAs<_chakra_ui_system_dist_system_types.As, ChoiceChipProps>;
|
679
738
|
|
680
|
-
type
|
739
|
+
type NumericStepperProps = {
|
681
740
|
/** The name of the input field */
|
682
741
|
name?: string;
|
683
742
|
/** The current value */
|
@@ -690,34 +749,34 @@ type CounterProps = {
|
|
690
749
|
minValue?: number;
|
691
750
|
/** Optional maximum value. Defaults to 99 */
|
692
751
|
maxValue?: number;
|
693
|
-
/** Whether the
|
752
|
+
/** Whether the stepper is disabled or not */
|
694
753
|
isDisabled?: boolean;
|
695
754
|
} & BoxProps;
|
696
|
-
/** A simple
|
755
|
+
/** A simple stepper component for integer values
|
697
756
|
*
|
698
757
|
* Allows you to choose a given integer value, like for example the number of
|
699
758
|
* adults on your journey.
|
700
759
|
*
|
701
760
|
* ```tsx
|
702
|
-
* <
|
761
|
+
* <NumericStepper value={value} onChange={setValue} />
|
703
762
|
* ```
|
704
763
|
*
|
705
764
|
* You can also set a minimum and/or maximum value:
|
706
765
|
*
|
707
766
|
* ```tsx
|
708
|
-
* <
|
767
|
+
* <NumericStepper value={value} onChange={setValue} minValue={1} maxValue={10} />
|
709
768
|
* ```
|
710
769
|
*
|
711
|
-
* You can use the
|
770
|
+
* You can use the NumericStepper inside of a FormControl component to get IDs etc linked up automatically:
|
712
771
|
*
|
713
772
|
* ```tsx
|
714
773
|
* <FormControl>
|
715
774
|
* <FormLabel>Number of adults</FormLabel>
|
716
|
-
* <
|
775
|
+
* <NumericStepper />
|
717
776
|
* </FormControl>
|
718
777
|
* ```
|
719
778
|
*/
|
720
|
-
declare function
|
779
|
+
declare function NumericStepper({ name: nameProp, id: idProp, value: valueProp, defaultValue, onChange: onChangeProp, minValue, maxValue, isDisabled, ...boxProps }: NumericStepperProps): React__default.JSX.Element;
|
721
780
|
|
722
781
|
type FormControlProps = FormControlProps$1;
|
723
782
|
declare const FormControl: _chakra_ui_system_dist_system_types.ComponentWithAs<"div", FormControlProps$1>;
|
@@ -6868,4 +6927,4 @@ type TextProps = Omit<TextProps$1, "textStyle"> & {
|
|
6868
6927
|
*/
|
6869
6928
|
declare const Text: _chakra_ui_system_dist_system_types.ComponentWithAs<"p", TextProps>;
|
6870
6929
|
|
6871
|
-
export { Accordion, AccordionProps, AttachedInputs, Badge, BadgeProps, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Card, CardProps, CardSelect, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChoiceChip, ChoiceChipProps, ClosableAlert, CloseButton, CloseButtonProps, Code, CodeProps, ColorInlineLoader, ColorInlineLoaderProps, ColorSpinner, ColorSpinnerProps, ContentLoader, ContentLoaderProps,
|
6930
|
+
export { Accordion, AccordionProps, AttachedInputs, Badge, BadgeProps, Button, ButtonGroup, ButtonGroupProps, ButtonProps, Card, CardProps, CardSelect, Checkbox, CheckboxGroup, CheckboxGroupProps, CheckboxProps, ChoiceChip, ChoiceChipProps, ClosableAlert, CloseButton, CloseButtonProps, Code, CodeProps, ColorInlineLoader, ColorInlineLoaderProps, ColorSpinner, ColorSpinnerProps, ContentLoader, ContentLoaderProps, DarkFullScreenLoader, DarkInlineLoader, DarkInlineLoaderProps, DarkSpinner, DarkSpinnerProps, DatePicker, DateRangePicker, Divider, DividerProps, Drawer, DrawerContent, ModalHeader as DrawerHeader, Expandable, ExpandableAlert, ExpandableItem, ExpandableItemProps, FloatingActionButton, FormControl, FormControlProps, FormErrorMessage, FormErrorMessageProps, FormLabel, FormLabelProps, Heading, HeadingProps, IconButton, IconButtonProps, InfoSelect, InfoTag, InfoTagProps, Input, InputElementProps, InputLeftElement, InputProps, InputRightElement, JumpButton, Language, LanguageProvider, LightFullScreenLoader, LightInlineLoader, LightInlineLoaderProps, LightSpinner, LightSpinnerProps, LineIcon, LineIconProps, ListBox, ModalHeader, ModalHeaderProps, NativeSelect, NativeSelectProps, NumericStepper, PasswordInput, PasswordInputProps, PhoneNumberInput, PlayPauseButton, PopoverWizardBody, PopoverWizardProps, ProgressBar, ProgressLoader, Radio, RadioGroup, RadioGroupProps, RadioProps, SearchInput, SearchInputProps, SelectItemDescription, SelectItemLabel, SimpleDrawer, SimpleDrawerProps, SimplePopover, Skeleton, SkeletonCircle, SkeletonCircleProps, SkeletonProps, SkeletonText, SkeletonTextProps, SkipButton, SpinnerProps, SporProvider, Stack, StackProps, StaticAlert, Stepper, StepperStep, Switch, SwitchProps, Table, TableProps, Tabs, TabsProps, Text, TextLink, TextProps, Textarea, TextareaProps, TimePicker, ToastOptions, Translations, TravelTag, TravelTagProps, VyLogo, VyLogoProps, WizardPopover, WizardPopoverProps, createTexts, fontFaces, theme, useToast, useTranslation };
|