@loadsmart/miranda-react 3.0.0-beta.4 → 3.0.0-beta.6

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,6 +1,7 @@
1
- import type { ReactNode, ComponentProps } from 'react';
2
1
  import { Checkbox as WCCheckbox } from '@loadsmart/miranda-wc';
3
- import type { WebComponentProps } from '@lit/react';
2
+ import type { EventName, WebComponentProps } from '@lit/react';
3
+ import type { ReactNode, ComponentProps } from 'react';
4
+ import type { MirandaChangeEvent } from '../../utils/types';
4
5
  declare global {
5
6
  namespace JSX {
6
7
  interface IntrinsicElements {
@@ -9,7 +10,7 @@ declare global {
9
10
  }
10
11
  }
11
12
  declare const WiredCheckbox: import("@lit/react").ReactWebComponent<WCCheckbox, {
12
- onChange: string;
13
+ onChange: EventName<MirandaChangeEvent<WCCheckbox>>;
13
14
  }>;
14
15
  export type CheckboxProps = ComponentProps<typeof WiredCheckbox> & {
15
16
  leading?: ReactNode;
@@ -1,6 +1,7 @@
1
- import type { WebComponentProps } from '@lit/react';
2
1
  import { RadioGroup as WCRadioGroup } from '@loadsmart/miranda-wc';
3
2
  import type { ComponentProps } from 'react';
3
+ import type { EventName, WebComponentProps } from '@lit/react';
4
+ import type { MirandaChangeEvent } from '../../utils/types';
4
5
  declare global {
5
6
  namespace JSX {
6
7
  interface IntrinsicElements {
@@ -9,7 +10,7 @@ declare global {
9
10
  }
10
11
  }
11
12
  declare const RadioGroup: import("@lit/react").ReactWebComponent<WCRadioGroup, {
12
- onChange: string;
13
+ onChange: EventName<MirandaChangeEvent<WCRadioGroup>>;
13
14
  }> & {
14
15
  Radio: import("react").ForwardRefExoticComponent<Omit<import("./Radio").RadioProps, "ref"> & import("react").RefAttributes<import("@loadsmart/miranda-wc").Radio>>;
15
16
  };
@@ -1,6 +1,7 @@
1
- import type { ReactNode, ComponentProps } from 'react';
2
- import type { EventName, WebComponentProps } from '@lit/react';
3
1
  import { Select as WCSelect } from '@loadsmart/miranda-wc';
2
+ import type { EventName, WebComponentProps } from '@lit/react';
3
+ import type { ReactNode, ComponentProps } from 'react';
4
+ import type { MirandaChangeEvent } from '../../utils/types';
4
5
  declare global {
5
6
  namespace JSX {
6
7
  interface IntrinsicElements {
@@ -11,7 +12,7 @@ declare global {
11
12
  declare const WiredSelect: import("@lit/react").ReactWebComponent<WCSelect, {
12
13
  onExpand: EventName<CustomEvent<any>>;
13
14
  onCollapse: EventName<CustomEvent<any>>;
14
- onChange: string;
15
+ onChange: EventName<MirandaChangeEvent<WCSelect>>;
15
16
  }>;
16
17
  export type SelectOption = {
17
18
  value: string;
@@ -1,5 +1,6 @@
1
1
  import type { ComponentProps } from 'react';
2
2
  import type { EventName, WebComponentProps } from '@lit/react';
3
+ import type { StepChangeEventDetail, StepNavigateEventDetail } from '@loadsmart/miranda-wc';
3
4
  import { Steps as WCSteps } from '@loadsmart/miranda-wc';
4
5
  declare global {
5
6
  namespace JSX {
@@ -9,9 +10,9 @@ declare global {
9
10
  }
10
11
  }
11
12
  export declare const Steps: import("@lit/react").ReactWebComponent<WCSteps, {
12
- onChange: EventName<CustomEvent<any>>;
13
+ onChange: EventName<CustomEvent<StepChangeEventDetail>>;
13
14
  onComplete: EventName<CustomEvent<any>>;
14
- onNavigate: EventName<CustomEvent<any>>;
15
+ onNavigate: EventName<CustomEvent<StepNavigateEventDetail>>;
15
16
  onNext: EventName<CustomEvent<any>>;
16
17
  onPrevious: EventName<CustomEvent<any>>;
17
18
  }> & {
@@ -1,5 +1,5 @@
1
1
  import type { LiteralUnion } from '../../utils/types';
2
- export declare function createCustomEvent(eventName: string, detail?: unknown): CustomEvent<unknown>;
2
+ export declare function createCustomEvent<T>(eventName: string, detail?: T): CustomEvent<T>;
3
3
  export declare function useSteps(): {
4
4
  elementRef: HTMLElement | null;
5
5
  registerSteps: () => {
@@ -1,6 +1,7 @@
1
- import type { ComponentProps } from 'react';
2
- import type { WebComponentProps } from '@lit/react';
3
1
  import { Switch as WCSwitch } from '@loadsmart/miranda-wc';
2
+ import type { ComponentProps } from 'react';
3
+ import type { EventName, WebComponentProps } from '@lit/react';
4
+ import type { MirandaChangeEvent } from '../../utils/types';
4
5
  declare global {
5
6
  namespace JSX {
6
7
  interface IntrinsicElements {
@@ -9,6 +10,6 @@ declare global {
9
10
  }
10
11
  }
11
12
  export declare const Switch: import("@lit/react").ReactWebComponent<WCSwitch, {
12
- onChange: string;
13
+ onChange: EventName<MirandaChangeEvent<WCSwitch>>;
13
14
  }>;
14
15
  export type SwitchProps = ComponentProps<typeof Switch>;
@@ -1,7 +1,7 @@
1
- import type { ReactNode, ComponentProps } from 'react';
2
- import type { EventName, WebComponentProps } from '@lit/react';
3
1
  import { ActionableTag as WCActionableTag } from '@loadsmart/miranda-wc';
4
- import type { ActionableTagChangeEventDetail } from '@loadsmart/miranda-wc';
2
+ import type { EventName, WebComponentProps } from '@lit/react';
3
+ import type { ReactNode, ComponentProps } from 'react';
4
+ import type { MirandaChangeEvent } from '../../utils/types';
5
5
  declare global {
6
6
  namespace JSX {
7
7
  interface IntrinsicElements {
@@ -10,7 +10,7 @@ declare global {
10
10
  }
11
11
  }
12
12
  declare const WiredActionableTag: import("@lit/react").ReactWebComponent<WCActionableTag, {
13
- onChange: EventName<CustomEvent<ActionableTagChangeEventDetail>>;
13
+ onChange: EventName<MirandaChangeEvent<WCActionableTag>>;
14
14
  onRemove: EventName<CustomEvent<any>>;
15
15
  }>;
16
16
  export type ActionableTagProps = ComponentProps<typeof WiredActionableTag> & {
@@ -1,7 +1,8 @@
1
+ import { TextArea as WCTextArea } from '@loadsmart/miranda-wc';
1
2
  import type { ComponentProps } from 'react';
2
- import type { WebComponentProps } from '@lit/react';
3
+ import type { EventName, WebComponentProps } from '@lit/react';
3
4
  import type { TextAreaProps as WCTextAreaProps } from '@loadsmart/miranda-wc';
4
- import { TextArea as WCTextArea } from '@loadsmart/miranda-wc';
5
+ import type { MirandaChangeEvent } from '../../utils/types';
5
6
  declare global {
6
7
  namespace JSX {
7
8
  interface IntrinsicElements {
@@ -10,8 +11,8 @@ declare global {
10
11
  }
11
12
  }
12
13
  declare const WiredTextArea: import("@lit/react").ReactWebComponent<WCTextArea, {
13
- onInput: string;
14
- onChange: string;
14
+ onInput: EventName<MirandaChangeEvent<WCTextArea>>;
15
+ onChange: EventName<MirandaChangeEvent<WCTextArea>>;
15
16
  }>;
16
17
  export type TextAreaProps = ComponentProps<typeof WiredTextArea>;
17
18
  declare function TextArea(props: TextAreaProps): import("react/jsx-runtime").JSX.Element;
@@ -1,17 +1,17 @@
1
- import type { ReactNode, ComponentProps } from 'react';
2
- import type { EventName, WebComponentProps } from '@lit/react';
3
- import type { TextFieldProps as WCTextFieldProps } from '@loadsmart/miranda-wc';
4
1
  import { TextField as WCTextField } from '@loadsmart/miranda-wc';
2
+ import type { EventName, WebComponentProps } from '@lit/react';
3
+ import type { ReactNode, ComponentProps } from 'react';
4
+ import type { MirandaChangeEvent } from '../../utils/types';
5
5
  declare global {
6
6
  namespace JSX {
7
7
  interface IntrinsicElements {
8
- 'm-text-field': WebComponentProps<WCTextField> & WCTextFieldProps;
8
+ 'm-text-field': WebComponentProps<WCTextField>;
9
9
  }
10
10
  }
11
11
  }
12
12
  declare const WiredTextField: import("@lit/react").ReactWebComponent<WCTextField, {
13
- onInput: string;
14
- onChange: string;
13
+ onInput: EventName<MirandaChangeEvent<WCTextField>>;
14
+ onChange: EventName<MirandaChangeEvent<WCTextField>>;
15
15
  onClear: EventName<CustomEvent<any>>;
16
16
  }>;
17
17
  export type TextFieldProps = ComponentProps<typeof WiredTextField> & {
@@ -1,6 +1,7 @@
1
- import type { ReactNode, ComponentProps } from 'react';
2
- import type { WebComponentProps } from '@lit/react';
3
1
  import { ToggleGroup as WCToggleGroup } from '@loadsmart/miranda-wc';
2
+ import type { EventName, WebComponentProps } from '@lit/react';
3
+ import type { ReactNode, ComponentProps } from 'react';
4
+ import type { MirandaChangeEvent } from '../../utils/types';
4
5
  declare global {
5
6
  namespace JSX {
6
7
  interface IntrinsicElements {
@@ -9,7 +10,7 @@ declare global {
9
10
  }
10
11
  }
11
12
  declare const WiredToggleGroup: import("@lit/react").ReactWebComponent<WCToggleGroup, {
12
- onChange: string;
13
+ onChange: EventName<MirandaChangeEvent<WCToggleGroup>>;
13
14
  }>;
14
15
  export type ToggleGroupOption = {
15
16
  value: string;
package/dist/index.d.ts CHANGED
@@ -35,6 +35,7 @@ export * from './components/Timeline';
35
35
  export * from './components/ToggleGroup';
36
36
  export * from './components/Tooltip';
37
37
  export * from './components/LogoLoader';
38
+ export type { MirandaChangeEvent } from './utils/types';
38
39
  export type { TypographyVariant } from '@loadsmart/miranda-wc';
39
40
  export { Accordion as WCAccordion, AccordionTitle as WCAccordionTitle, AccordionContent as WCAccordionContent, } from '@loadsmart/miranda-wc';
40
41
  export type { AccordionProps as WCAccordionProps, AccordionToggleEventDetails, } from '@loadsmart/miranda-wc';
@@ -69,6 +70,7 @@ export { Link as WCLink } from '@loadsmart/miranda-wc';
69
70
  export { PageContent as WCPageContent } from '@loadsmart/miranda-wc';
70
71
  export { Pagination as WCPagination } from '@loadsmart/miranda-wc';
71
72
  export type { PaginationProps as WCPaginationProps, PaginationChangeEventDetails, } from '@loadsmart/miranda-wc';
73
+ export type { PopoverPlacement, PopoverPosition, PopoverRepositionEventDetail, } from '@loadsmart/miranda-wc';
72
74
  export { ProgressBar as WCProgressBar } from '@loadsmart/miranda-wc';
73
75
  export type { ProgressBarProps as WCProgressBarProps } from '@loadsmart/miranda-wc';
74
76
  export { ProgressBarCountdown as WCProgressBarCountdown } from '@loadsmart/miranda-wc';
@@ -80,7 +82,7 @@ export type { SectionProps as WCSectionProps } from '@loadsmart/miranda-wc';
80
82
  export { SpinnerWheel as WCSpinnerWheel } from '@loadsmart/miranda-wc';
81
83
  export type { SpinnerWheelProps as WCSpinnerWheelProps } from '@loadsmart/miranda-wc';
82
84
  export { Step as WCStep, Steps as WCSteps } from '@loadsmart/miranda-wc';
83
- export type { StepProps as WCStepProps, NavigateStepEventDetail, } from '@loadsmart/miranda-wc';
85
+ export type { StepProps as WCStepProps, StepChangeEventDetail, StepNavigateEventDetail, } from '@loadsmart/miranda-wc';
84
86
  export { Switch as WCSwitch } from '@loadsmart/miranda-wc';
85
87
  export type { SwitchProps as WCSwitchProps, SwitchSize, } from '@loadsmart/miranda-wc';
86
88
  export { Table as WCTable, TableHead as WCTableHead, TableHeadCell as WCTableHeadCell, TableBody as WCTableBody, TableFoot as WCTableFoot, TableRow as WCTableRow, TableCell as WCTableCell, TableToolbar as WCTableToolbar, TableFeedback as WCTableFeedback, TableActions as WCTableActions, } from '@loadsmart/miranda-wc';
@@ -88,7 +90,7 @@ export type { TableProps as WCTableProps, TableCellProps as WCTableCellProps, Ta
88
90
  export { Tabs as WCTabs, Tab as WCTab, TabPanel as WCTabPanel, } from '@loadsmart/miranda-wc';
89
91
  export type { TabsProps as WCTabsProps, TabProps as WCTabProps, TabPanelProps as WCTabPanelProps, TabChangeEventDetail, } from '@loadsmart/miranda-wc';
90
92
  export { Tag as WCTag, ActionableTag as WCActionableTag, } from '@loadsmart/miranda-wc';
91
- export type { TagProps as WCTagProps, ActionableTagProps as WCActionableTagProps, TagVariant, TagSize, ActionableTagChangeEventDetail, } from '@loadsmart/miranda-wc';
93
+ export type { TagProps as WCTagProps, ActionableTagProps as WCActionableTagProps, TagVariant, TagSize, } from '@loadsmart/miranda-wc';
92
94
  export { Text as WCText } from '@loadsmart/miranda-wc';
93
95
  export type { TextProps as WCTextProps } from '@loadsmart/miranda-wc';
94
96
  export { TextArea as WCTextArea } from '@loadsmart/miranda-wc';
package/dist/index.js CHANGED
@@ -142,7 +142,7 @@ const Accordion = createComponent({
142
142
  elementClass: Accordion$1,
143
143
  displayName: 'Accordion',
144
144
  events: {
145
- onToggle: 'm-toggle',
145
+ onToggle: 'toggle',
146
146
  },
147
147
  subComponents: {
148
148
  Title: AccordionTitle,
@@ -204,7 +204,7 @@ const Banner = createComponent({
204
204
  tagName: 'm-banner',
205
205
  elementClass: Banner$1,
206
206
  events: {
207
- onDismiss: 'm-dismiss',
207
+ onDismiss: 'dismiss',
208
208
  },
209
209
  displayName: 'Banner',
210
210
  subComponents: {
@@ -295,7 +295,7 @@ const Card = createComponent({
295
295
  elementClass: Card$1,
296
296
  displayName: 'Card',
297
297
  events: {
298
- onToggle: 'm-toggle',
298
+ onToggle: 'toggle',
299
299
  },
300
300
  subComponents: {
301
301
  Title: CardTitle,
@@ -389,11 +389,11 @@ const Dialog = createComponent({
389
389
  tagName: 'm-dialog',
390
390
  elementClass: Dialog$1,
391
391
  events: {
392
- onClose: 'm-close',
393
- onOpening: 'm-opening',
394
- onOpened: 'm-opened',
395
- onClosing: 'm-closing',
396
- onClosed: 'm-closed',
392
+ onClose: 'close',
393
+ onOpening: 'opening',
394
+ onOpened: 'opened',
395
+ onClosing: 'closing',
396
+ onClosed: 'closed',
397
397
  },
398
398
  displayName: 'Dialog',
399
399
  subComponents: {
@@ -475,11 +475,11 @@ const Drawer = createComponent({
475
475
  tagName: 'm-drawer',
476
476
  elementClass: Drawer$1,
477
477
  events: {
478
- onClose: 'm-close',
479
- onOpening: 'm-opening',
480
- onOpened: 'm-opened',
481
- onClosing: 'm-closing',
482
- onClosed: 'm-closed',
478
+ onClose: 'close',
479
+ onOpening: 'opening',
480
+ onOpened: 'opened',
481
+ onClosing: 'closing',
482
+ onClosed: 'closed',
483
483
  },
484
484
  displayName: 'Drawer',
485
485
  subComponents: {
@@ -529,8 +529,8 @@ const Dropdown = createComponent({
529
529
  Trigger: DropdownTrigger,
530
530
  },
531
531
  events: {
532
- onExpand: 'm-expand',
533
- onCollapse: 'm-collapse',
532
+ onExpand: 'expand',
533
+ onCollapse: 'collapse',
534
534
  },
535
535
  });
536
536
 
@@ -566,7 +566,7 @@ const EmptyState = createComponent({
566
566
  tagName: 'm-empty-state',
567
567
  elementClass: EmptyState$1,
568
568
  events: {
569
- onAction: 'm-action',
569
+ onAction: 'action',
570
570
  },
571
571
  displayName: 'EmptyState',
572
572
  subComponents: {
@@ -779,7 +779,7 @@ const Pagination = createComponent({
779
779
  elementClass: Pagination$1,
780
780
  displayName: 'Pagination',
781
781
  events: {
782
- onChange: 'm-change',
782
+ onChange: 'paginationchange',
783
783
  },
784
784
  });
785
785
 
@@ -851,8 +851,8 @@ const WiredSelect = createComponent({
851
851
  tagName: 'm-select',
852
852
  elementClass: Select$1,
853
853
  events: {
854
- onExpand: 'm-expand',
855
- onCollapse: 'm-collapse',
854
+ onExpand: 'expand',
855
+ onCollapse: 'collapse',
856
856
  onChange: 'change',
857
857
  },
858
858
  displayName: 'Select',
@@ -885,11 +885,11 @@ const Steps = createComponent({
885
885
  elementClass: Steps$1,
886
886
  displayName: 'Steps',
887
887
  events: {
888
- onChange: 'm-change',
889
- onComplete: 'm-complete',
890
- onNavigate: 'm-navigate',
891
- onNext: 'm-next',
892
- onPrevious: 'm-previous',
888
+ onChange: 'stepchange',
889
+ onComplete: 'stepcomplete',
890
+ onNavigate: 'navigate',
891
+ onNext: 'navigatenext',
892
+ onPrevious: 'navigateprevious',
893
893
  },
894
894
  subComponents: {
895
895
  Step,
@@ -924,10 +924,10 @@ function useSteps() {
924
924
  return;
925
925
  }
926
926
  const navigateToNextStep = () => {
927
- return createCustomEvent('m-next');
927
+ return createCustomEvent('navigatenext');
928
928
  };
929
929
  const navigateToPreviousStep = () => {
930
- return createCustomEvent('m-previous');
930
+ return createCustomEvent('navigateprevious');
931
931
  };
932
932
  let event;
933
933
  switch (step) {
@@ -938,7 +938,9 @@ function useSteps() {
938
938
  event = navigateToPreviousStep();
939
939
  break;
940
940
  default:
941
- event = createCustomEvent('m-navigate', step);
941
+ event = createCustomEvent('navigate', {
942
+ step,
943
+ });
942
944
  }
943
945
  stepsElement.dispatchEvent(event);
944
946
  }, [stepsElement]);
@@ -946,7 +948,7 @@ function useSteps() {
946
948
  if (stepsElement == null) {
947
949
  return;
948
950
  }
949
- const event = createCustomEvent('m-complete');
951
+ const event = createCustomEvent('stepcomplete');
950
952
  stepsElement.dispatchEvent(event);
951
953
  }, [stepsElement]);
952
954
  return {
@@ -1007,7 +1009,7 @@ const TableHeadCell = createComponent({
1007
1009
  elementClass: TableHeadCell$1,
1008
1010
  displayName: 'TableHeadCell',
1009
1011
  events: {
1010
- onSort: 'm-sort',
1012
+ onSort: 'columnsort',
1011
1013
  },
1012
1014
  });
1013
1015
 
@@ -1059,7 +1061,7 @@ const Tabs = createComponent({
1059
1061
  tagName: 'm-tabs',
1060
1062
  elementClass: Tabs$1,
1061
1063
  events: {
1062
- onTabChange: 'm-tab-change',
1064
+ onTabChange: 'tabchange',
1063
1065
  },
1064
1066
  displayName: 'Tabs',
1065
1067
  subComponents: {
@@ -1083,8 +1085,8 @@ const WiredActionableTag = createComponent({
1083
1085
  elementClass: ActionableTag$1,
1084
1086
  displayName: 'ActionableTag',
1085
1087
  events: {
1086
- onChange: 'm-change',
1087
- onRemove: 'm-remove',
1088
+ onChange: 'change',
1089
+ onRemove: 'remove',
1088
1090
  },
1089
1091
  });
1090
1092
  const ActionableTag = forwardRef((props, ref) => {
@@ -1117,7 +1119,7 @@ const WiredTextField = createComponent({
1117
1119
  events: {
1118
1120
  onInput: 'input',
1119
1121
  onChange: 'change',
1120
- onClear: 'm-clear',
1122
+ onClear: 'clear',
1121
1123
  },
1122
1124
  displayName: 'TextField',
1123
1125
  });
@@ -1,3 +1,4 @@
1
+ import type { ChangeEvent } from 'react';
1
2
  export type Mutable<T> = {
2
3
  -readonly [P in keyof T]: T[P] extends ReadonlyArray<infer U> ? U[] : T[P];
3
4
  };
@@ -7,3 +8,8 @@ export type Primitive = null | undefined | string | number | boolean | symbol |
7
8
  * in IDEs for the literal type part of the union.
8
9
  */
9
10
  export type LiteralUnion<LiteralType, BaseType extends Primitive> = LiteralType | (BaseType & Record<never, never>);
11
+ /**
12
+ * This is a patch type to make our components compatible to React's
13
+ * synthetic event types.
14
+ */
15
+ export type MirandaChangeEvent<T = Element> = ChangeEvent<T> & Event;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loadsmart/miranda-react",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.0.0-beta.6",
4
4
  "description": "React component library based on Miranda Web Components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -40,8 +40,8 @@
40
40
  "access": "public"
41
41
  },
42
42
  "dependencies": {
43
- "@loadsmart/miranda-tokens": "4.0.0-beta.4",
44
- "@loadsmart/miranda-wc": "3.0.0-beta.4",
43
+ "@loadsmart/miranda-tokens": "4.0.0-beta.6",
44
+ "@loadsmart/miranda-wc": "3.0.0-beta.6",
45
45
  "@lit/react": "^1.0.5"
46
46
  },
47
47
  "directories": {