@loadsmart/miranda-wc 3.0.0-beta.32 → 3.0.0-beta.33

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,17 +1,18 @@
1
1
  import type { PropertyValues } from 'lit';
2
2
  import { Component } from '../component';
3
3
  import { fromAttribute } from '../../controllers/selection';
4
- import type { AcceptedType, SelectionType } from '../../controllers/selection';
4
+ import type { SelectionType } from '../../controllers/selection';
5
5
  import '../layout/group';
6
+ import type { SelectionValue } from '../../utils/selection/selection-strategy.types';
6
7
  export type ToggleSize = 'small' | 'default';
7
8
  export interface ToggleGroupProps {
8
- initialValue?: AcceptedType | AcceptedType[];
9
+ initialValue?: SelectionValue;
9
10
  disabled?: boolean;
10
11
  name?: string;
11
12
  showCheck?: boolean;
12
13
  size?: ToggleSize;
13
- type: SelectionType;
14
- value?: AcceptedType | AcceptedType[] | null;
14
+ type?: SelectionType;
15
+ value?: SelectionValue;
15
16
  onchange?: GlobalEventHandlers['onchange'];
16
17
  }
17
18
  declare const ToggleGroup_base: import("../../utils/types").Constructor<import("../../controllers/selection/selection-control.mixin").WithSelectionControlMixinInterface> & typeof Component;
@@ -58,25 +59,29 @@ export declare class ToggleGroup extends ToggleGroup_base implements ToggleGroup
58
59
  };
59
60
  /**
60
61
  * Should the toggle group be disabled.
62
+ * @default false
61
63
  */
62
64
  disabled: ToggleGroupProps['disabled'];
63
65
  /**
64
66
  * Should show the check icon when selected.
65
67
  * The check icon is the default content for the `leading` slot.
68
+ * @default false
66
69
  */
67
70
  showCheck: ToggleGroupProps['showCheck'];
68
71
  /**
69
72
  * Strategy for toggling.
73
+ * @default 'single'
70
74
  */
71
- type: ToggleGroupProps['type'];
75
+ type: NonNullable<ToggleGroupProps['type']>;
72
76
  /**
73
- * Button size.
77
+ * The size of each toggle.
78
+ * @default 'default'
74
79
  */
75
- size: ToggleGroupProps['size'];
80
+ size: NonNullable<ToggleGroupProps['size']>;
76
81
  /**
77
82
  * Name that will represent this toggle group in the form.
78
83
  */
79
- name: ToggleGroupProps['name'];
84
+ name?: ToggleGroupProps['name'];
80
85
  /**
81
86
  * Value that will be selected by default on initialization and form reset.
82
87
  */
@@ -91,8 +96,8 @@ export declare class ToggleGroup extends ToggleGroup_base implements ToggleGroup
91
96
  disconnectedCallback(): void;
92
97
  protected update(changedProperties: PropertyValues<this>): void;
93
98
  render(): import("lit-html").TemplateResult<1>;
94
- get value(): string | string[] | null;
95
- set value(value: string | string[] | null);
99
+ get value(): SelectionValue;
100
+ set value(value: SelectionValue);
96
101
  protected handleFormReset: () => void;
97
102
  }
98
103
  declare global {
@@ -1,5 +1,5 @@
1
1
  export { SelectionController } from './selection.controller';
2
2
  export { SelectionControl } from './selection-control';
3
3
  export { WithSelectionControlMixin, fromAttribute, toAttribute, hasValueChanged, } from './selection-control.mixin';
4
- export type { SelectionType, SelectionState, AcceptedType, } from '../../utils/selection';
4
+ export type { SelectionType, SelectionState, AcceptedType, SelectionValue, } from '../../utils/selection';
5
5
  export { default as LegacySelectionController } from './legacy-selection.controller';
@@ -1,13 +1,13 @@
1
1
  import type { SelectionType } from '../../utils/selection';
2
2
  import type { Component } from '../../components/component';
3
3
  import type { Constructor } from '../../utils/types';
4
- export declare function fromAttribute(value?: string | string[] | null): string[] | null;
5
- export declare function toAttribute(value?: string | string[] | null): string;
6
- export declare function hasValueChanged(value1?: string | string[] | null, value2?: string | string[] | null): boolean;
4
+ export declare function fromAttribute(value?: string | string[] | ReadonlyArray<string> | null): string[] | null;
5
+ export declare function toAttribute(value?: string | string[] | ReadonlyArray<string> | null): string;
6
+ export declare function hasValueChanged(value1?: string | string[] | ReadonlyArray<string> | null, value2?: string | string[] | ReadonlyArray<string> | null): boolean;
7
7
  export declare class WithSelectionControlMixinInterface {
8
8
  form: HTMLFormElement | null;
9
9
  getSelectionType(): SelectionType;
10
- getRawValue(value?: string | string[] | null): string[];
10
+ getRawValue(value?: string | string[] | ReadonlyArray<string> | null): string[];
11
11
  protected handleFormReset(): void;
12
12
  }
13
13
  export declare const WithSelectionControlMixin: <T extends Constructor<Component>>(superClass: T) => Constructor<WithSelectionControlMixinInterface> & T;
package/dist/index.d.ts CHANGED
@@ -44,3 +44,4 @@ export { typographyVariants } from './styles';
44
44
  export type { TypographyVariant } from './styles';
45
45
  export type { FormComponentProps } from './components/component';
46
46
  export type { PopoverPlacement, PopoverPosition, PopoverRepositionEventDetail, } from './components/popover';
47
+ export type { SelectionState, SelectionType, SelectionValue, } from './controllers/selection';
@@ -1,2 +1,2 @@
1
1
  export { default, SELECTION_TYPES } from './selection-strategy';
2
- export type { AcceptedType, SelectionState, SelectionStrategy, SelectionType, } from './selection-strategy';
2
+ export type { AcceptedType, SelectionState, SelectionStrategy, SelectionType, SelectionValue, } from './selection-strategy';
@@ -1,4 +1,5 @@
1
1
  export type AcceptedType = string;
2
+ export type SelectionValue<T extends string = string> = T | Array<T> | ReadonlyArray<T> | null;
2
3
  export declare const SELECTION_TYPES: readonly ["single", "single-strict", "multiple"];
3
4
  export type SelectionType = (typeof SELECTION_TYPES)[number];
4
5
  export type SelectionState = Set<AcceptedType>;
@@ -45,7 +46,7 @@ export type SelectionStrategy = {
45
46
  * Return selection as a value, based on the `AcceptedType`.
46
47
  * @param {SelectionState} selection
47
48
  */
48
- value: (selection?: SelectionState) => AcceptedType | AcceptedType[] | null;
49
+ value: (selection?: SelectionState) => SelectionValue;
49
50
  };
50
51
  export type SelectionStrategyCreationProps = {
51
52
  type?: SelectionType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loadsmart/miranda-wc",
3
- "version": "3.0.0-beta.32",
3
+ "version": "3.0.0-beta.33",
4
4
  "description": "Miranda Web Components component library",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -46,8 +46,8 @@
46
46
  "dependencies": {
47
47
  "@floating-ui/dom": "^1.6.3",
48
48
  "@lit/context": "^1.1.1",
49
- "@loadsmart/miranda-icons": "3.0.0-beta.32",
50
- "@loadsmart/miranda-tokens": "4.0.0-beta.32",
49
+ "@loadsmart/miranda-icons": "3.0.0-beta.33",
50
+ "@loadsmart/miranda-tokens": "4.0.0-beta.33",
51
51
  "autosize": "^6.0.1",
52
52
  "composed-offset-position": "^0.0.4",
53
53
  "lit": "^3.1.3"