@midas-ds/components 7.1.0 → 8.1.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/accordion/Accordion.d.ts +1 -1
  3. package/accordion/AccordionItem.d.ts +5 -2
  4. package/breadcrumbs/Breadcrumbs.d.ts +5 -6
  5. package/character-counter/CharacterCounter.d.ts +4 -1
  6. package/checkbox/CheckboxGroup.d.ts +2 -1
  7. package/color-scheme-switch/ColorSchemeSwitch.d.ts +13 -0
  8. package/color-scheme-switch/index.d.ts +1 -0
  9. package/combobox/ComboBox.d.ts +4 -1
  10. package/combobox/index.d.ts +2 -1
  11. package/combobox/types.d.ts +3 -0
  12. package/combobox/utils.d.ts +8 -0
  13. package/date-field/DateField.d.ts +2 -1
  14. package/date-picker/DatePicker.d.ts +4 -2
  15. package/field-error/index.d.ts +1 -1
  16. package/heading/Heading.d.ts +1 -2
  17. package/index.cjs +44 -29
  18. package/index.css +1 -1
  19. package/index.d.ts +11 -9
  20. package/index.js +8499 -8050
  21. package/label/Label.d.ts +1 -2
  22. package/layout/Layout.d.ts +6 -0
  23. package/layout/components/Navbar.d.ts +1 -0
  24. package/layout/context/LayoutContext.d.ts +3 -2
  25. package/layout/index.d.ts +1 -0
  26. package/link/Link.d.ts +3 -0
  27. package/link/index.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/radio/Radio.d.ts +2 -1
  30. package/search-field/SearchField.d.ts +1 -0
  31. package/select/Select.d.ts +2 -1
  32. package/select/useMultiSelectState.d.ts +3 -10
  33. package/select/utils.d.ts +7 -0
  34. package/spinner/Spinner.d.ts +8 -3
  35. package/table/Table.d.ts +6 -1
  36. package/table/index.d.ts +1 -1
  37. package/tabs/Tabs.d.ts +18 -8
  38. package/tabs/index.d.ts +1 -1
  39. package/text/Text.d.ts +1 -2
  40. package/textfield/TextFieldBase.d.ts +2 -1
  41. package/theme/index.d.ts +32 -28
  42. package/theme/tokens.d.ts +32 -28
  43. package/theme.cjs +1 -1
  44. package/theme.js +7 -6
  45. package/toggle-button/ToggleButton.d.ts +2 -0
  46. package/toggle-button/ToggleButtonGroup.d.ts +3 -0
  47. package/toggle-button/index.d.ts +2 -0
  48. package/tokens-B0IQe84F.cjs +1 -0
  49. package/{tokens-XrriCAqI.js → tokens-BWq37Xsh.js} +62 -57
  50. package/utils/useObserveElement.d.ts +17 -1
  51. package/tokens-CG8BaZyJ.cjs +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,56 @@
1
+ ## 8.1.0
2
+
3
+ ### 🚀 Features
4
+
5
+ - **accordion:** accordion status ✅ / 🚨 ([#485](https://github.com/migrationsverket/midas/pull/485))
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - **theme:** add dark mode focus ([#483](https://github.com/migrationsverket/midas/pull/483))
10
+ - **modal:** make text in modal selectable ([#490](https://github.com/migrationsverket/midas/pull/490))
11
+ - **accordion:** rename invalid token ([e4b13c928](https://github.com/migrationsverket/midas/commit/e4b13c928))
12
+ - **select:** remove explicit size for indeterminate symbol ([5f805c134](https://github.com/migrationsverket/midas/commit/5f805c134))
13
+ - **select:** change checkbox size to prevent disappearing border ([3ab520633](https://github.com/migrationsverket/midas/commit/3ab520633))
14
+
15
+ # 8.0.0
16
+
17
+ ### 🚀 Features
18
+
19
+ - **spinner:** change prop `dark` to `isOnColor` ([#443](https://github.com/migrationsverket/midas/pull/443))
20
+ - ✨ add errorPosition to form fields ([#416](https://github.com/migrationsverket/midas/pull/416))
21
+ - **layout:** new navbar component and external variant of layout ([ad54f5955](https://github.com/migrationsverket/midas/commit/ad54f5955))
22
+ - ✨💄 add semantic z-index tokens ([#401](https://github.com/migrationsverket/midas/pull/401))
23
+
24
+ ### 🩹 Fixes
25
+
26
+ - **calendar:** add high contrast styling for selected date ([a5af1cafe](https://github.com/migrationsverket/midas/commit/a5af1cafe))
27
+ - **calendar:** sync calendars ([3e7b4fb06](https://github.com/migrationsverket/midas/commit/3e7b4fb06))
28
+ - **calendar:** add border for high contrast mode ([7ed989df8](https://github.com/migrationsverket/midas/commit/7ed989df8))
29
+ - **radio:** add support for horizontal orientation ([e5c9ad3eb](https://github.com/migrationsverket/midas/commit/e5c9ad3eb))
30
+ - **link:** remove active styling in disabled state ([71c1e1400](https://github.com/migrationsverket/midas/commit/71c1e1400))
31
+ - **heading:** set correct styles for heading and affected components ([#394](https://github.com/migrationsverket/midas/pull/394))
32
+ - **accordion:** fix responsive content hiding when changing screen size ([#446](https://github.com/migrationsverket/midas/pull/446))
33
+ - **button:** add cursor styling for disabled state ([1ab3f6c55](https://github.com/migrationsverket/midas/commit/1ab3f6c55))
34
+ - **date-picker:** add missing disabled styles ([492a1b789](https://github.com/migrationsverket/midas/commit/492a1b789))
35
+ - **combobox:** fix background color to input ([6ec2c1d3e](https://github.com/migrationsverket/midas/commit/6ec2c1d3e))
36
+ - **theme:** replace invalid text and border colors in dark mode ([a6259f46c](https://github.com/migrationsverket/midas/commit/a6259f46c))
37
+
38
+ ### Documentation Changes
39
+
40
+ - **calendar:** update docs ([#469](https://github.com/migrationsverket/midas/pull/469))
41
+ - **link-button:** remove live-code from docs ([#451](https://github.com/migrationsverket/midas/pull/451))
42
+ - **heading:** expose ElementType ([79b85f4e4](https://github.com/migrationsverket/midas/commit/79b85f4e4))
43
+ - **tabs:** remove generic in prop interface ([d8bcf2b92](https://github.com/migrationsverket/midas/commit/d8bcf2b92))
44
+ - **tabs:** remove live code and update documentation ([c4b2c2e47](https://github.com/migrationsverket/midas/commit/c4b2c2e47))
45
+ - **tooltip:** update tooltip documentation 🔧 ([#439](https://github.com/migrationsverket/midas/pull/439))
46
+ - **label:** remove live code and update documentation ([1803a3ee1](https://github.com/migrationsverket/midas/commit/1803a3ee1))
47
+ - **table:** add prop comment ([6089593a4](https://github.com/migrationsverket/midas/commit/6089593a4))
48
+ - new page explaining tokens and use of color + removed and updated tokens ([c970f0eb5](https://github.com/migrationsverket/midas/commit/c970f0eb5))
49
+ - **text:** remove union type for documentation visibility ([675b94795](https://github.com/migrationsverket/midas/commit/675b94795))
50
+ - define error types at component level ([14dc2b8da](https://github.com/migrationsverket/midas/commit/14dc2b8da))
51
+ - update link docs with new code and examples ([a25a2def3](https://github.com/migrationsverket/midas/commit/a25a2def3))
52
+ - use markdown links ([f1fb5714b](https://github.com/migrationsverket/midas/commit/f1fb5714b))
53
+
1
54
  ## 7.1.0
2
55
 
3
56
  ### 🚀 Features
@@ -4,7 +4,7 @@ export declare const ACCORDION_TEST_ID = "accordion";
4
4
  interface MidasAccordion extends DisclosureGroupProps {
5
5
  /** Display either the larger contained variant or a smaller uncontained variant */
6
6
  variant?: 'uncontained' | 'contained';
7
- /** Weither to allow the user to have multiple accordions open at the same time */
7
+ /** @deprecated Use 'allowsMultipleExpanded' instead */
8
8
  type?: 'single' | 'multiple';
9
9
  }
10
10
  /**
@@ -1,11 +1,14 @@
1
- import { DisclosureProps, HeadingProps } from 'react-aria-components';
1
+ import { DisclosureProps } from 'react-aria-components';
2
+ import { HeadingProps } from '../heading';
2
3
  import * as React from 'react';
3
4
  interface MidasAccordionItem extends Omit<DisclosureProps, 'children'> {
4
5
  /** The text displayed in the collapsed state. If a ReactNode is proveded we're not adding a heading and you have to provide one yourself. */
5
6
  title?: string | React.ReactNode;
6
7
  children?: React.ReactNode;
7
8
  /** Adjust the titles heading level to your heading tag structure */
8
- headingLevel?: HeadingProps['level'];
9
+ headingLevel?: HeadingProps['elementType'];
10
+ /** Display an accordion item in different status states */
11
+ type?: 'default' | 'success' | 'warning';
9
12
  }
10
13
  export declare const AccordionItem: React.FC<MidasAccordionItem>;
11
14
  export {};
@@ -1,9 +1,8 @@
1
1
  export interface BreadcrumbProps {
2
- items: MidasBreadcrumb[];
3
- }
4
- export interface MidasBreadcrumb {
5
- href: string;
6
- title: string;
7
- isDisabled?: boolean;
2
+ items: {
3
+ href: string;
4
+ title: string;
5
+ isDisabled?: boolean;
6
+ }[];
8
7
  }
9
8
  export declare const Breadcrumbs: React.FC<BreadcrumbProps>;
@@ -1,3 +1,6 @@
1
1
  import { InputProps } from 'react-aria-components';
2
2
  import * as React from 'react';
3
- export declare const CharacterCounter: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
3
+ export interface CharacterCounterProps extends InputProps {
4
+ isLonely?: boolean;
5
+ }
6
+ export declare const CharacterCounter: React.ForwardRefExoticComponent<CharacterCounterProps & React.RefAttributes<HTMLInputElement>>;
@@ -6,5 +6,6 @@ export interface CheckboxGroupProps extends Omit<AriaCheckboxGroupProps, 'childr
6
6
  description?: string;
7
7
  showSelectAll?: boolean;
8
8
  errorMessage?: string | ((validation: ValidationResult) => string);
9
+ errorPosition?: 'top' | 'bottom';
9
10
  }
10
- export declare const CheckboxGroup: ({ label, description, errorMessage, showSelectAll, children, ...props }: CheckboxGroupProps) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const CheckboxGroup: ({ label, description, errorMessage, showSelectAll, children, errorPosition, ...props }: CheckboxGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,13 @@
1
+ import * as React from 'react';
2
+ export interface ColorSchemeSwitchProps {
3
+ /** Choose what element that should be affected by the scheme switch.
4
+ * @default body
5
+ */
6
+ selector?: string;
7
+ /** Set the default value for the color scheme. Default is "light dark" meaning follow system settings
8
+ *
9
+ * @default new Set(['light dark'])
10
+ */
11
+ defaultValue?: Set<'light' | 'dark' | 'light dark'>;
12
+ }
13
+ export declare const ColorSchemeSwitch: React.FC<ColorSchemeSwitchProps>;
@@ -0,0 +1 @@
1
+ export * from './ColorSchemeSwitch';
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { ComboBoxProps as AriaComboBoxProps, ListBoxItemProps, ValidationResult } from 'react-aria-components';
3
+ import { Item, Section } from './types';
3
4
  export interface ComboBoxProps<T extends object> extends Omit<AriaComboBoxProps<T>, 'children'> {
4
5
  label?: string;
5
6
  description?: string;
@@ -7,6 +8,8 @@ export interface ComboBoxProps<T extends object> extends Omit<AriaComboBoxProps<
7
8
  items?: Iterable<T>;
8
9
  children: React.ReactNode | ((item: T) => React.ReactNode);
9
10
  placeholder?: string;
11
+ errorPosition?: 'top' | 'bottom';
10
12
  }
11
- export declare function ComboBox<T extends object>({ label, description, errorMessage, children, items, className, ...props }: ComboBoxProps<T>): import("react/jsx-runtime").JSX.Element;
13
+ export declare function ComboBox<T extends object>({ label, description, errorMessage, children, items, className, errorPosition, ...props }: ComboBoxProps<T>): import("react/jsx-runtime").JSX.Element;
12
14
  export declare function ComboBoxItem(props: ListBoxItemProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function ComboBoxSelection(props: Section<Item>): import("react/jsx-runtime").JSX.Element;
@@ -1 +1,2 @@
1
- export { ComboBox, ComboBoxItem } from './ComboBox';
1
+ export { ComboBox, ComboBoxItem, ComboBoxSelection } from './ComboBox';
2
+ export type { Section, Item } from './types';
@@ -2,3 +2,6 @@ export type Item = {
2
2
  id: number;
3
3
  name: string;
4
4
  };
5
+ export type Section<T> = Item & {
6
+ children?: Iterable<T>;
7
+ };
@@ -1,2 +1,10 @@
1
1
  import { Item } from './types';
2
2
  export declare function generateMockOptions(count: number): Iterable<Item>;
3
+ export declare const optionsWithSections: {
4
+ name: string;
5
+ id: number;
6
+ children: {
7
+ name: string;
8
+ id: number;
9
+ }[];
10
+ }[];
@@ -3,6 +3,7 @@ interface DateFieldProps<T extends DateValue> extends AriaDateFieldProps<T> {
3
3
  label?: string;
4
4
  description?: string;
5
5
  errorMessage?: string | ((validation: ValidationResult) => string);
6
+ errorPosition?: 'top' | 'bottom';
6
7
  }
7
- export declare function DateField<T extends DateValue>({ label, description, errorMessage, className, ...props }: DateFieldProps<T>): import("react/jsx-runtime").JSX.Element;
8
+ export declare function DateField<T extends DateValue>({ label, description, errorMessage, className, errorPosition, ...props }: DateFieldProps<T>): import("react/jsx-runtime").JSX.Element;
8
9
  export {};
@@ -3,12 +3,14 @@ interface MidasDateRangePickerProps<T extends DateValue> extends DateRangePicker
3
3
  label?: string;
4
4
  description?: string;
5
5
  errorMessage?: string | ((validation: ValidationResult) => string);
6
+ errorPosition?: 'top' | 'bottom';
6
7
  }
7
- export declare const DateRangePicker: <T extends DateValue>({ label, description, errorMessage, ...props }: MidasDateRangePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const DateRangePicker: <T extends DateValue>({ label, description, errorMessage, errorPosition, ...props }: MidasDateRangePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
8
9
  interface MidasDatePickerProps<T extends DateValue> extends DatePickerProps<T> {
9
10
  label?: string;
10
11
  description?: string;
11
12
  errorMessage?: string | ((validation: ValidationResult) => string);
13
+ errorPosition?: 'top' | 'bottom';
12
14
  }
13
- export declare const DatePicker: <T extends DateValue>({ label, description, errorMessage, ...props }: MidasDatePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
15
+ export declare const DatePicker: <T extends DateValue>({ label, description, errorMessage, errorPosition, ...props }: MidasDatePickerProps<T>) => import("react/jsx-runtime").JSX.Element;
14
16
  export {};
@@ -1 +1 @@
1
- export { FieldError } from './FieldError';
1
+ export * from './FieldError';
@@ -1,11 +1,10 @@
1
1
  import { HeadingProps as AriaHeadingProps } from 'react-aria-components';
2
2
  import * as React from 'react';
3
- export type ElementType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
4
3
  export interface HeadingProps extends AriaHeadingProps {
5
4
  /**
6
5
  * Override the semantic element of the component but keep the look of the level property
7
6
  */
8
- elementType?: ElementType;
7
+ elementType?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
9
8
  /**
10
9
  * Use the external/expressive look
11
10
  */