@qasa/qds-ui 0.5.0 → 0.6.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.
@@ -10,6 +10,11 @@ interface TextFieldOptions extends InputBaseOptions {
10
10
  * The error message to display if `isInvalid` is `true`
11
11
  */
12
12
  errorMessage?: string;
13
+ /**
14
+ * If `true`, the input will display an optional indicator.
15
+ * If the `isRequired` prop is also `true`, this prop will be ignored.
16
+ */
17
+ isOptional?: boolean;
13
18
  /**
14
19
  * Text that provides additional guidance to the user
15
20
  */
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import type { LanguageCode } from './locales';
3
+ interface LocaleContextValue {
4
+ currentLanguage: LanguageCode;
5
+ }
6
+ interface LocaleProviderProps {
7
+ language: LanguageCode;
8
+ children: React.ReactNode;
9
+ }
10
+ export declare function LocaleProvider({ language, children }: LocaleProviderProps): JSX.Element;
11
+ export declare function useLocale(): LocaleContextValue;
12
+ export {};
@@ -0,0 +1,8 @@
1
+ declare const SUPPORTED_LANGUAGE_CODES: readonly ["en", "sv", "fi", "fr"];
2
+ export declare type LanguageCode = typeof SUPPORTED_LANGUAGE_CODES[number];
3
+ export interface Resource {
4
+ close: string;
5
+ optional: string;
6
+ }
7
+ export declare const locales: Record<LanguageCode, Resource>;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Resource } from './locales';
2
+ declare type I18nKey = keyof Resource;
3
+ export declare function useTranslation(): {
4
+ t: (key: I18nKey) => string;
5
+ };
6
+ export {};
@@ -1,10 +1,12 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { Options as EmotionCacheOptions } from '@emotion/cache';
3
3
  import type { ThemeOverrides } from './theme';
4
+ import type { LanguageCode } from './i18n/locales';
4
5
  interface QdsProviderProps {
5
6
  children: ReactNode;
6
7
  themeOverrides?: ThemeOverrides;
7
8
  cacheOptions?: Partial<EmotionCacheOptions>;
9
+ locale: LanguageCode;
8
10
  }
9
- export declare function QdsProvider({ children, themeOverrides, cacheOptions }: QdsProviderProps): JSX.Element;
11
+ export declare function QdsProvider({ children, themeOverrides, cacheOptions, locale }: QdsProviderProps): JSX.Element;
10
12
  export {};
package/dist/index.d.ts CHANGED
@@ -708,12 +708,16 @@ declare const overrideTheme: (overrides: ThemeOverrides) => {
708
708
  };
709
709
  };
710
710
 
711
+ declare const SUPPORTED_LANGUAGE_CODES: readonly ["en", "sv", "fi", "fr"];
712
+ declare type LanguageCode = typeof SUPPORTED_LANGUAGE_CODES[number];
713
+
711
714
  interface QdsProviderProps {
712
715
  children: ReactNode;
713
716
  themeOverrides?: ThemeOverrides;
714
717
  cacheOptions?: Partial<Options>;
718
+ locale: LanguageCode;
715
719
  }
716
- declare function QdsProvider({ children, themeOverrides, cacheOptions }: QdsProviderProps): JSX.Element;
720
+ declare function QdsProvider({ children, themeOverrides, cacheOptions, locale }: QdsProviderProps): JSX.Element;
717
721
 
718
722
  declare const SIZE_MAP: {
719
723
  xs: number;
@@ -3750,6 +3754,11 @@ interface TextFieldOptions extends InputBaseOptions {
3750
3754
  * The error message to display if `isInvalid` is `true`
3751
3755
  */
3752
3756
  errorMessage?: string;
3757
+ /**
3758
+ * If `true`, the input will display an optional indicator.
3759
+ * If the `isRequired` prop is also `true`, this prop will be ignored.
3760
+ */
3761
+ isOptional?: boolean;
3753
3762
  /**
3754
3763
  * Text that provides additional guidance to the user
3755
3764
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qasa/qds-ui",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "license": "UNLICENSED",
5
5
  "repository": {
6
6
  "type": "git",