@loadsmart/miranda-react 3.0.0-beta.5 → 3.0.0-beta.7

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;
@@ -1,6 +1,6 @@
1
- import type { ReactNode, ComponentProps } from 'react';
2
- import type { WebComponentProps } from '@lit/react';
3
1
  import { Tooltip as WCTooltip } from '@loadsmart/miranda-wc';
2
+ import type { ReactElement, ReactNode, ComponentProps } from 'react';
3
+ import type { WebComponentProps } from '@lit/react';
4
4
  import type { TooltipPlacement, TooltipTrigger } from '@loadsmart/miranda-wc';
5
5
  declare global {
6
6
  namespace JSX {
@@ -11,7 +11,14 @@ declare global {
11
11
  }
12
12
  declare const WiredTooltip: import("@lit/react").ReactWebComponent<WCTooltip, {}>;
13
13
  export type TooltipProps = ComponentProps<typeof WiredTooltip> & {
14
- message?: ReactNode;
14
+ message: ReactNode;
15
+ children: ReactElement;
15
16
  };
16
- export declare function Tooltip(props: TooltipProps): import("react/jsx-runtime").JSX.Element;
17
+ /**
18
+ * Render the tooltip component.
19
+ *
20
+ * **Warning**: This component will throw if the provided `children` is not a single child,
21
+ * and will not render if the children is not valid or is a fragment.
22
+ */
23
+ export declare function Tooltip(props: TooltipProps): import("react/jsx-runtime").JSX.Element | null;
17
24
  export type { TooltipPlacement, TooltipTrigger };
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
@@ -1,8 +1,9 @@
1
1
  import { AccordionTitle as AccordionTitle$1, AccordionContent as AccordionContent$1, Accordion as Accordion$1, Badge as Badge$1, BannerActionPrimary as BannerActionPrimary$1, BannerActions as BannerActions$1, BannerActionSecondary as BannerActionSecondary$1, BannerDescription as BannerDescription$1, BannerIcon as BannerIcon$1, BannerTitle as BannerTitle$1, Banner as Banner$1, Button as Button$1, CardTitle as CardTitle$1, CardSubtitle as CardSubtitle$1, CardBody as CardBody$1, CardDivider as CardDivider$1, CardActionPrimary as CardActionPrimary$1, CardActionSecondary as CardActionSecondary$1, CardActionTertiary as CardActionTertiary$1, CardFooter as CardFooter$1, Card as Card$1, Checkbox as Checkbox$1, DialogActionPrimary as DialogActionPrimary$1, DialogActionSecondary as DialogActionSecondary$1, DialogActionTertiary as DialogActionTertiary$1, DialogActions as DialogActions$1, DialogBody as DialogBody$1, DialogClose as DialogClose$1, DialogFooter as DialogFooter$1, DialogHeader as DialogHeader$1, Dialog as Dialog$1, Divider as Divider$1, DrawerActionPrimary as DrawerActionPrimary$1, DrawerActionSecondary as DrawerActionSecondary$1, DrawerActionTertiary as DrawerActionTertiary$1, DrawerActions as DrawerActions$1, DrawerBody as DrawerBody$1, DrawerClose as DrawerClose$1, DrawerHeader as DrawerHeader$1, Drawer as Drawer$1, DropdownItem as DropdownItem$1, DropdownMenu as DropdownMenu$1, DropdownTrigger as DropdownTrigger$1, Dropdown as Dropdown$1, EmptyStateIllustration as EmptyStateIllustration$1, EmptyStateHeader as EmptyStateHeader$1, EmptyStateMessage as EmptyStateMessage$1, EmptyStateAction as EmptyStateAction$1, EmptyState as EmptyState$1, FieldLabel as FieldLabel$1, FieldHint as FieldHint$1, Field as Field$1, HeaderActions as HeaderActions$1, HeaderContent as HeaderContent$1, HeaderTitle as HeaderTitle$1, SubHeader as SubHeader$1, BackButton, Header as Header$1, Icon as Icon$1, LabeledValueLabel as LabeledValueLabel$1, LabeledValueValue as LabeledValueValue$1, LabeledValue as LabeledValue$1, Box as Box$1, Group as Group$1, Stack as Stack$1, Grid as Grid$1, Sidebar as Sidebar$1, Switcher as Switcher$1, Container as Container$1, Row as Row$1, Column as Column$1, Link as Link$1, Body as Body$1, PageContent as PageContent$1, Pagination as Pagination$1, ProgressBar as ProgressBar$1, ProgressBarCountdown as ProgressBarCountdown$1, Radio as Radio$1, RadioGroup as RadioGroup$1, SectionTitle as SectionTitle$1, Section as Section$1, SelectOption as SelectOption$1, Select as Select$1, SpinnerWheel as SpinnerWheel$1, Step as Step$1, Steps as Steps$1, Switch as Switch$1, TableHead as TableHead$1, TableBody as TableBody$1, TableFoot as TableFoot$1, TableRow as TableRow$1, TableCell as TableCell$1, TableToolbar as TableToolbar$1, TableHeadCell as TableHeadCell$1, TableFeedback as TableFeedback$1, TableActions as TableActions$1, Table as Table$1, Tab as Tab$1, TabPanel as TabPanel$1, Tabs as Tabs$1, Tag as Tag$1, ActionableTag as ActionableTag$1, Text as Text$1, TextArea as TextArea$1, TextField as TextField$1, TimelineItem as TimelineItem$1, TimelineExpandableItem as TimelineExpandableItem$1, TimelineItemBody as TimelineItemBody$1, TimelineItemFooter as TimelineItemFooter$1, TimelineItemHeader as TimelineItemHeader$1, TimelineItemHeaderSubtitle as TimelineItemHeaderSubtitle$1, TimelineItemHeaderTitle as TimelineItemHeaderTitle$1, TimelineItemIcon as TimelineItemIcon$1, Timeline as Timeline$1, Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, Tooltip as Tooltip$1, LogoLoader as LogoLoader$1 } from '@loadsmart/miranda-wc';
2
2
  export { DIALOG_SIZES, DIALOG_VARIANTS, DRAWER_SIZES, EMPTY_STATE_VARIANTS, Accordion as WCAccordion, AccordionContent as WCAccordionContent, AccordionTitle as WCAccordionTitle, ActionableTag as WCActionableTag, Badge as WCBadge, Banner as WCBanner, BannerActionPrimary as WCBannerActionPrimary, BannerActionSecondary as WCBannerActionSecondary, BannerActions as WCBannerActions, BannerDescription as WCBannerDescription, BannerIcon as WCBannerIcon, BannerTitle as WCBannerTitle, Box as WCBox, Button as WCButton, Card as WCCard, CardActionPrimary as WCCardActionPrimary, CardActionSecondary as WCCardActionSecondary, CardActionTertiary as WCCardActionTertiary, CardBody as WCCardBody, CardDivider as WCCardDivider, CardFooter as WCCardFooter, CardSubtitle as WCCardSubtitle, CardTitle as WCCardTitle, Checkbox as WCCheckbox, Column as WCColumn, Container as WCContainer, Dialog as WCDialog, DialogActionPrimary as WCDialogActionPrimary, DialogActionSecondary as WCDialogActionSecondary, DialogActionTertiary as WCDialogActionTertiary, DialogActions as WCDialogActions, DialogBody as WCDialogBody, DialogClose as WCDialogClose, DialogFooter as WCDialogFooter, DialogHeader as WCDialogHeader, Divider as WCDivider, Drawer as WCDrawer, DrawerActionPrimary as WCDrawerActionPrimary, DrawerActionSecondary as WCDrawerActionSecondary, DrawerActionTertiary as WCDrawerActionTertiary, DrawerActions as WCDrawerActions, DrawerBody as WCDrawerBody, DrawerClose as WCDrawerClose, DrawerHeader as WCDrawerHeader, Dropdown as WCDropdown, DropdownItem as WCDropdownItem, DropdownMenu as WCDropdownMenu, DropdownTrigger as WCDropdownTrigger, EmptyState as WCEmptyState, EmptyStateAction as WCEmptyStateAction, EmptyStateHeader as WCEmptyStateHeader, EmptyStateIllustration as WCEmptyStateIllustration, EmptyStateMessage as WCEmptyStateMessage, Field as WCField, FieldHint as WCFieldHint, FieldLabel as WCFieldLabel, Grid as WCGrid, Group as WCGroup, Header as WCHeader, HeaderActions as WCHeaderActions, HeaderContent as WCHeaderContent, HeaderTitle as WCHeaderTitle, Icon as WCIcon, LabeledValue as WCLabeledValue, LabeledValueLabel as WCLabeledValueLabel, LabeledValueValue as WCLabeledValueValue, Link as WCLink, LogoLoader as WCLogoLoader, PageContent as WCPageContent, Pagination as WCPagination, ProgressBar as WCProgressBar, ProgressBarCountdown as WCProgressBarCountdown, Radio as WCRadio, RadioGroup as WCRadioGroup, Row as WCRow, Section as WCSection, SectionTitle as WCSectionTitle, Sidebar as WCSidebar, SpinnerWheel as WCSpinnerWheel, Stack as WCStack, Step as WCStep, Steps as WCSteps, SubHeader as WCSubHeader, Switch as WCSwitch, Switcher as WCSwitcher, Tab as WCTab, TabPanel as WCTabPanel, Table as WCTable, TableActions as WCTableActions, TableBody as WCTableBody, TableCell as WCTableCell, TableFeedback as WCTableFeedback, TableFoot as WCTableFoot, TableHead as WCTableHead, TableHeadCell as WCTableHeadCell, TableRow as WCTableRow, TableToolbar as WCTableToolbar, Tabs as WCTabs, Tag as WCTag, Text as WCText, TextArea as WCTextArea, TextField as WCTextField, Timeline as WCTimeline, TimelineExpandableItem as WCTimelineExpandableItem, TimelineItem as WCTimelineItem, TimelineItemBody as WCTimelineItemBody, TimelineItemFooter as WCTimelineItemFooter, TimelineItemHeader as WCTimelineItemHeader, TimelineItemHeaderSubtitle as WCTimelineItemHeaderSubtitle, TimelineItemHeaderTitle as WCTimelineItemHeaderTitle, TimelineItemIcon as WCTimelineItemIcon, Toggle as WCToggle, ToggleGroup as WCToggleGroup, Tooltip as WCTooltip } from '@loadsmart/miranda-wc';
3
3
  import * as React from 'react';
4
- import { forwardRef, useState, useCallback } from 'react';
5
- import { jsxs, jsx } from 'react/jsx-runtime';
4
+ import { forwardRef, useState, useCallback, Children, isValidElement, cloneElement } from 'react';
5
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
6
+ import { isFragment } from 'react-is';
6
7
 
7
8
  function _extends() {
8
9
  _extends = Object.assign ? Object.assign.bind() : function (target) {
@@ -142,7 +143,7 @@ const Accordion = createComponent({
142
143
  elementClass: Accordion$1,
143
144
  displayName: 'Accordion',
144
145
  events: {
145
- onToggle: 'm-toggle',
146
+ onToggle: 'toggle',
146
147
  },
147
148
  subComponents: {
148
149
  Title: AccordionTitle,
@@ -204,7 +205,7 @@ const Banner = createComponent({
204
205
  tagName: 'm-banner',
205
206
  elementClass: Banner$1,
206
207
  events: {
207
- onDismiss: 'm-dismiss',
208
+ onDismiss: 'dismiss',
208
209
  },
209
210
  displayName: 'Banner',
210
211
  subComponents: {
@@ -295,7 +296,7 @@ const Card = createComponent({
295
296
  elementClass: Card$1,
296
297
  displayName: 'Card',
297
298
  events: {
298
- onToggle: 'm-toggle',
299
+ onToggle: 'toggle',
299
300
  },
300
301
  subComponents: {
301
302
  Title: CardTitle,
@@ -389,11 +390,11 @@ const Dialog = createComponent({
389
390
  tagName: 'm-dialog',
390
391
  elementClass: Dialog$1,
391
392
  events: {
392
- onClose: 'm-close',
393
- onOpening: 'm-opening',
394
- onOpened: 'm-opened',
395
- onClosing: 'm-closing',
396
- onClosed: 'm-closed',
393
+ onClose: 'close',
394
+ onOpening: 'opening',
395
+ onOpened: 'opened',
396
+ onClosing: 'closing',
397
+ onClosed: 'closed',
397
398
  },
398
399
  displayName: 'Dialog',
399
400
  subComponents: {
@@ -475,11 +476,11 @@ const Drawer = createComponent({
475
476
  tagName: 'm-drawer',
476
477
  elementClass: Drawer$1,
477
478
  events: {
478
- onClose: 'm-close',
479
- onOpening: 'm-opening',
480
- onOpened: 'm-opened',
481
- onClosing: 'm-closing',
482
- onClosed: 'm-closed',
479
+ onClose: 'close',
480
+ onOpening: 'opening',
481
+ onOpened: 'opened',
482
+ onClosing: 'closing',
483
+ onClosed: 'closed',
483
484
  },
484
485
  displayName: 'Drawer',
485
486
  subComponents: {
@@ -529,8 +530,8 @@ const Dropdown = createComponent({
529
530
  Trigger: DropdownTrigger,
530
531
  },
531
532
  events: {
532
- onExpand: 'm-expand',
533
- onCollapse: 'm-collapse',
533
+ onExpand: 'expand',
534
+ onCollapse: 'collapse',
534
535
  },
535
536
  });
536
537
 
@@ -566,7 +567,7 @@ const EmptyState = createComponent({
566
567
  tagName: 'm-empty-state',
567
568
  elementClass: EmptyState$1,
568
569
  events: {
569
- onAction: 'm-action',
570
+ onAction: 'action',
570
571
  },
571
572
  displayName: 'EmptyState',
572
573
  subComponents: {
@@ -779,7 +780,7 @@ const Pagination = createComponent({
779
780
  elementClass: Pagination$1,
780
781
  displayName: 'Pagination',
781
782
  events: {
782
- onChange: 'm-change',
783
+ onChange: 'paginationchange',
783
784
  },
784
785
  });
785
786
 
@@ -851,8 +852,8 @@ const WiredSelect = createComponent({
851
852
  tagName: 'm-select',
852
853
  elementClass: Select$1,
853
854
  events: {
854
- onExpand: 'm-expand',
855
- onCollapse: 'm-collapse',
855
+ onExpand: 'expand',
856
+ onCollapse: 'collapse',
856
857
  onChange: 'change',
857
858
  },
858
859
  displayName: 'Select',
@@ -885,11 +886,11 @@ const Steps = createComponent({
885
886
  elementClass: Steps$1,
886
887
  displayName: 'Steps',
887
888
  events: {
888
- onChange: 'm-change',
889
- onComplete: 'm-complete',
890
- onNavigate: 'm-navigate',
891
- onNext: 'm-next',
892
- onPrevious: 'm-previous',
889
+ onChange: 'stepchange',
890
+ onComplete: 'stepcomplete',
891
+ onNavigate: 'navigate',
892
+ onNext: 'navigatenext',
893
+ onPrevious: 'navigateprevious',
893
894
  },
894
895
  subComponents: {
895
896
  Step,
@@ -924,10 +925,10 @@ function useSteps() {
924
925
  return;
925
926
  }
926
927
  const navigateToNextStep = () => {
927
- return createCustomEvent('m-next');
928
+ return createCustomEvent('navigatenext');
928
929
  };
929
930
  const navigateToPreviousStep = () => {
930
- return createCustomEvent('m-previous');
931
+ return createCustomEvent('navigateprevious');
931
932
  };
932
933
  let event;
933
934
  switch (step) {
@@ -938,7 +939,9 @@ function useSteps() {
938
939
  event = navigateToPreviousStep();
939
940
  break;
940
941
  default:
941
- event = createCustomEvent('m-navigate', step);
942
+ event = createCustomEvent('navigate', {
943
+ step,
944
+ });
942
945
  }
943
946
  stepsElement.dispatchEvent(event);
944
947
  }, [stepsElement]);
@@ -946,7 +949,7 @@ function useSteps() {
946
949
  if (stepsElement == null) {
947
950
  return;
948
951
  }
949
- const event = createCustomEvent('m-complete');
952
+ const event = createCustomEvent('stepcomplete');
950
953
  stepsElement.dispatchEvent(event);
951
954
  }, [stepsElement]);
952
955
  return {
@@ -1007,7 +1010,7 @@ const TableHeadCell = createComponent({
1007
1010
  elementClass: TableHeadCell$1,
1008
1011
  displayName: 'TableHeadCell',
1009
1012
  events: {
1010
- onSort: 'm-sort',
1013
+ onSort: 'columnsort',
1011
1014
  },
1012
1015
  });
1013
1016
 
@@ -1059,7 +1062,7 @@ const Tabs = createComponent({
1059
1062
  tagName: 'm-tabs',
1060
1063
  elementClass: Tabs$1,
1061
1064
  events: {
1062
- onTabChange: 'm-tab-change',
1065
+ onTabChange: 'tabchange',
1063
1066
  },
1064
1067
  displayName: 'Tabs',
1065
1068
  subComponents: {
@@ -1083,8 +1086,8 @@ const WiredActionableTag = createComponent({
1083
1086
  elementClass: ActionableTag$1,
1084
1087
  displayName: 'ActionableTag',
1085
1088
  events: {
1086
- onChange: 'm-change',
1087
- onRemove: 'm-remove',
1089
+ onChange: 'change',
1090
+ onRemove: 'remove',
1088
1091
  },
1089
1092
  });
1090
1093
  const ActionableTag = forwardRef((props, ref) => {
@@ -1117,7 +1120,7 @@ const WiredTextField = createComponent({
1117
1120
  events: {
1118
1121
  onInput: 'input',
1119
1122
  onChange: 'change',
1120
- onClear: 'm-clear',
1123
+ onClear: 'clear',
1121
1124
  },
1122
1125
  displayName: 'TextField',
1123
1126
  });
@@ -1221,9 +1224,55 @@ const WiredTooltip = createComponent({
1221
1224
  elementClass: Tooltip$1,
1222
1225
  displayName: 'Tooltip',
1223
1226
  });
1227
+ let counter = 0;
1228
+ /**
1229
+ * Generates a unique id for our elements, prepending the given `prefix`.
1230
+ * @param prefix - Id prefix. Defaults to 'm-tt-anchor'
1231
+ */
1232
+ function generateId(prefix = 'tt-anchor') {
1233
+ counter += 1;
1234
+ /**
1235
+ * prefixing with 'm' to ensure we always start with a letter.
1236
+ * https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id
1237
+ */
1238
+ const id = `m-${prefix}-${counter}`;
1239
+ /**
1240
+ * Embracing the unlikelyhood of having 9007199254740991 elements we id-d with this approach
1241
+ * at the same time in the document (in which case we would have a collision).
1242
+ */
1243
+ if (counter === Number.MAX_SAFE_INTEGER) {
1244
+ counter = 0;
1245
+ }
1246
+ return id;
1247
+ }
1248
+ /**
1249
+ * Render the tooltip component.
1250
+ *
1251
+ * **Warning**: This component will throw if the provided `children` is not a single child,
1252
+ * and will not render if the children is not valid or is a fragment.
1253
+ */
1224
1254
  function Tooltip(props) {
1225
1255
  const { children, message, ...rest } = props;
1226
- return jsx(WiredTooltip, { ...rest, children: message !== null && message !== void 0 ? message : children });
1256
+ const child = Children.only(children);
1257
+ if (isFragment(child) || !isValidElement(child)) {
1258
+ console.error('Tooltip must wrap a single and valid child element (Fragment is not accepted).');
1259
+ return null; // do not render the tooltip if the children are not valid or a fragment
1260
+ }
1261
+ const [anchorId, childWithId] = (() => {
1262
+ const elementWithID = child;
1263
+ const { id } = elementWithID.props;
1264
+ if (id) {
1265
+ return [id, elementWithID];
1266
+ }
1267
+ const generatedAnchorId = generateId();
1268
+ return [
1269
+ generatedAnchorId,
1270
+ cloneElement(elementWithID, {
1271
+ id: generatedAnchorId,
1272
+ }),
1273
+ ];
1274
+ })();
1275
+ return (jsxs(Fragment, { children: [jsx(WiredTooltip, { anchor: anchorId, ...rest, children: message }), childWithId] }));
1227
1276
  }
1228
1277
 
1229
1278
  const LogoLoader = createComponent({
@@ -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.5",
3
+ "version": "3.0.0-beta.7",
4
4
  "description": "React component library based on Miranda Web Components",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -26,6 +26,7 @@
26
26
  "@testing-library/cypress": "^10.0.1",
27
27
  "@types/react": "^17.0.79",
28
28
  "@types/react-dom": "^17.0.25",
29
+ "@types/react-is": "^18.3.0",
29
30
  "cypress": "^13.2.0",
30
31
  "cypress-plugin-tab": "^1.0.5",
31
32
  "react": "^17.0.2",
@@ -40,9 +41,10 @@
40
41
  "access": "public"
41
42
  },
42
43
  "dependencies": {
43
- "@loadsmart/miranda-tokens": "4.0.0-beta.5",
44
- "@loadsmart/miranda-wc": "3.0.0-beta.5",
45
- "@lit/react": "^1.0.5"
44
+ "@loadsmart/miranda-tokens": "4.0.0-beta.7",
45
+ "@loadsmart/miranda-wc": "3.0.0-beta.7",
46
+ "@lit/react": "^1.0.5",
47
+ "react-is": "^18.3.1"
46
48
  },
47
49
  "directories": {
48
50
  "test": "tests"