@loadsmart/miranda-react 3.0.0-beta.2 → 3.0.0-beta.21

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;
@@ -0,0 +1,13 @@
1
+ import type { ComponentProps } from 'react';
2
+ import { DotsLoader as WCDotsLoader } from '@loadsmart/miranda-wc';
3
+ import type { WebComponentProps } from '@lit/react';
4
+ declare global {
5
+ namespace JSX {
6
+ interface IntrinsicElements {
7
+ 'm-dots-loader': WebComponentProps<WCDotsLoader>;
8
+ }
9
+ }
10
+ }
11
+ declare const DotsLoader: import("@lit/react").ReactWebComponent<WCDotsLoader, {}>;
12
+ export type DotsLoaderProps = ComponentProps<typeof DotsLoader>;
13
+ export default DotsLoader;
@@ -0,0 +1,2 @@
1
+ export { default as DotsLoader } from './DotsLoader';
2
+ export type { DotsLoaderProps } from './DotsLoader';
@@ -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
  };
@@ -0,0 +1,31 @@
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';
5
+ declare global {
6
+ namespace JSX {
7
+ interface IntrinsicElements {
8
+ 'm-select': WebComponentProps<WCSelect>;
9
+ }
10
+ }
11
+ }
12
+ declare const WiredSelect: import("@lit/react").ReactWebComponent<WCSelect, {
13
+ onExpand: EventName<CustomEvent<any>>;
14
+ onCollapse: EventName<CustomEvent<any>>;
15
+ onChange: EventName<MirandaChangeEvent<WCSelect>>;
16
+ }>;
17
+ export type SelectOption = {
18
+ value: string;
19
+ label?: string;
20
+ leading?: ReactNode;
21
+ trailing?: ReactNode;
22
+ disabled?: boolean;
23
+ };
24
+ export type SelectProps = ComponentProps<typeof WiredSelect> & {
25
+ options?: SelectOption[];
26
+ };
27
+ export declare function Select(props: SelectProps): import("react/jsx-runtime").JSX.Element;
28
+ export declare namespace Select {
29
+ var Option: import("react").ForwardRefExoticComponent<Omit<import("./SelectOption").SelectOptionProps, "ref"> & import("react").RefAttributes<import("@loadsmart/miranda-wc").SelectOption>>;
30
+ }
31
+ export {};
@@ -0,0 +1,16 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ import type { WebComponentProps } from '@lit/react';
3
+ import { SelectOption as WCSelectOption } from '@loadsmart/miranda-wc';
4
+ declare global {
5
+ namespace JSX {
6
+ interface IntrinsicElements {
7
+ 'm-option': WebComponentProps<WCSelectOption>;
8
+ }
9
+ }
10
+ }
11
+ export declare const WiredSelectOption: import("@lit/react").ReactWebComponent<WCSelectOption, {}>;
12
+ export interface SelectOptionProps extends ComponentProps<typeof WiredSelectOption> {
13
+ leading?: ReactNode;
14
+ trailing?: ReactNode;
15
+ }
16
+ export declare const SelectOption: import("react").ForwardRefExoticComponent<Omit<SelectOptionProps, "ref"> & import("react").RefAttributes<WCSelectOption>>;
@@ -0,0 +1,2 @@
1
+ export { Select } from './Select';
2
+ export type { SelectProps, SelectOption } from './Select';
@@ -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
@@ -21,6 +21,7 @@ export * from './components/ProgressBar';
21
21
  export * from './components/ProgressBarCountdown';
22
22
  export * from './components/RadioGroup';
23
23
  export * from './components/Section';
24
+ export * from './components/Select';
24
25
  export * from './components/SpinnerWheel';
25
26
  export * from './components/Steps';
26
27
  export * from './components/Switch';
@@ -34,6 +35,8 @@ export * from './components/Timeline';
34
35
  export * from './components/ToggleGroup';
35
36
  export * from './components/Tooltip';
36
37
  export * from './components/LogoLoader';
38
+ export * from './components/DotsLoader';
39
+ export type { MirandaChangeEvent } from './utils/types';
37
40
  export type { TypographyVariant } from '@loadsmart/miranda-wc';
38
41
  export { Accordion as WCAccordion, AccordionTitle as WCAccordionTitle, AccordionContent as WCAccordionContent, } from '@loadsmart/miranda-wc';
39
42
  export type { AccordionProps as WCAccordionProps, AccordionToggleEventDetails, } from '@loadsmart/miranda-wc';
@@ -68,6 +71,7 @@ export { Link as WCLink } from '@loadsmart/miranda-wc';
68
71
  export { PageContent as WCPageContent } from '@loadsmart/miranda-wc';
69
72
  export { Pagination as WCPagination } from '@loadsmart/miranda-wc';
70
73
  export type { PaginationProps as WCPaginationProps, PaginationChangeEventDetails, } from '@loadsmart/miranda-wc';
74
+ export type { PopoverPlacement, PopoverPosition, PopoverRepositionEventDetail, } from '@loadsmart/miranda-wc';
71
75
  export { ProgressBar as WCProgressBar } from '@loadsmart/miranda-wc';
72
76
  export type { ProgressBarProps as WCProgressBarProps } from '@loadsmart/miranda-wc';
73
77
  export { ProgressBarCountdown as WCProgressBarCountdown } from '@loadsmart/miranda-wc';
@@ -79,7 +83,7 @@ export type { SectionProps as WCSectionProps } from '@loadsmart/miranda-wc';
79
83
  export { SpinnerWheel as WCSpinnerWheel } from '@loadsmart/miranda-wc';
80
84
  export type { SpinnerWheelProps as WCSpinnerWheelProps } from '@loadsmart/miranda-wc';
81
85
  export { Step as WCStep, Steps as WCSteps } from '@loadsmart/miranda-wc';
82
- export type { StepProps as WCStepProps, NavigateStepEventDetail, } from '@loadsmart/miranda-wc';
86
+ export type { StepProps as WCStepProps, StepChangeEventDetail, StepNavigateEventDetail, } from '@loadsmart/miranda-wc';
83
87
  export { Switch as WCSwitch } from '@loadsmart/miranda-wc';
84
88
  export type { SwitchProps as WCSwitchProps, SwitchSize, } from '@loadsmart/miranda-wc';
85
89
  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';
@@ -87,7 +91,7 @@ export type { TableProps as WCTableProps, TableCellProps as WCTableCellProps, Ta
87
91
  export { Tabs as WCTabs, Tab as WCTab, TabPanel as WCTabPanel, } from '@loadsmart/miranda-wc';
88
92
  export type { TabsProps as WCTabsProps, TabProps as WCTabProps, TabPanelProps as WCTabPanelProps, TabChangeEventDetail, } from '@loadsmart/miranda-wc';
89
93
  export { Tag as WCTag, ActionableTag as WCActionableTag, } from '@loadsmart/miranda-wc';
90
- export type { TagProps as WCTagProps, ActionableTagProps as WCActionableTagProps, TagVariant, TagSize, ActionableTagChangeEventDetail, } from '@loadsmart/miranda-wc';
94
+ export type { TagProps as WCTagProps, ActionableTagProps as WCActionableTagProps, TagVariant, TagSize, } from '@loadsmart/miranda-wc';
91
95
  export { Text as WCText } from '@loadsmart/miranda-wc';
92
96
  export type { TextProps as WCTextProps } from '@loadsmart/miranda-wc';
93
97
  export { TextArea as WCTextArea } from '@loadsmart/miranda-wc';
package/dist/index.js CHANGED
@@ -1,8 +1,9 @@
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, 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';
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, DotsLoader as DotsLoader$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
 
@@ -835,6 +836,39 @@ const Section = createComponent({
835
836
  },
836
837
  });
837
838
 
839
+ const WiredSelectOption = createComponent({
840
+ tagName: 'm-option',
841
+ elementClass: SelectOption$1,
842
+ displayName: 'SelectOption',
843
+ });
844
+ const SLOTTED_STYLE$1 = { display: 'contents' };
845
+ const SelectOption = forwardRef((props, ref) => {
846
+ const { leading, trailing, children, ...rest } = props;
847
+ return (jsxs(WiredSelectOption, { ...rest, ref: ref, children: [leading != null && (jsx("span", { style: SLOTTED_STYLE$1, slot: "leading", children: leading })), children, trailing != null && (jsx("span", { style: SLOTTED_STYLE$1, slot: "trailing", children: trailing }))] }));
848
+ });
849
+ SelectOption.displayName = 'SelectOption';
850
+
851
+ const WiredSelect = createComponent({
852
+ tagName: 'm-select',
853
+ elementClass: Select$1,
854
+ events: {
855
+ onExpand: 'expand',
856
+ onCollapse: 'collapse',
857
+ onChange: 'change',
858
+ },
859
+ displayName: 'Select',
860
+ });
861
+ const SLOTTED_STYLE = { display: 'contents' };
862
+ function Select(props) {
863
+ const { options, children, ...rest } = props;
864
+ return (jsx(WiredSelect, { ...rest, children: children ||
865
+ (options || []).map(function renderOption(option) {
866
+ const { label, leading, trailing, value: optionValue, ...others } = option;
867
+ return (jsxs(SelectOption, { ...others, value: optionValue, children: [leading != null && (jsx("span", { style: SLOTTED_STYLE, slot: "leading", children: leading })), label, trailing != null && (jsx("span", { style: SLOTTED_STYLE, slot: "trailing", children: trailing }))] }, optionValue));
868
+ }) }));
869
+ }
870
+ Select.Option = SelectOption;
871
+
838
872
  const SpinnerWheel = createComponent({
839
873
  tagName: 'm-spinner-wheel',
840
874
  elementClass: SpinnerWheel$1,
@@ -852,11 +886,11 @@ const Steps = createComponent({
852
886
  elementClass: Steps$1,
853
887
  displayName: 'Steps',
854
888
  events: {
855
- onChange: 'm-change',
856
- onComplete: 'm-complete',
857
- onNavigate: 'm-navigate',
858
- onNext: 'm-next',
859
- onPrevious: 'm-previous',
889
+ onChange: 'stepchange',
890
+ onComplete: 'stepcomplete',
891
+ onNavigate: 'navigate',
892
+ onNext: 'navigatenext',
893
+ onPrevious: 'navigateprevious',
860
894
  },
861
895
  subComponents: {
862
896
  Step,
@@ -891,10 +925,10 @@ function useSteps() {
891
925
  return;
892
926
  }
893
927
  const navigateToNextStep = () => {
894
- return createCustomEvent('m-next');
928
+ return createCustomEvent('navigatenext');
895
929
  };
896
930
  const navigateToPreviousStep = () => {
897
- return createCustomEvent('m-previous');
931
+ return createCustomEvent('navigateprevious');
898
932
  };
899
933
  let event;
900
934
  switch (step) {
@@ -905,7 +939,9 @@ function useSteps() {
905
939
  event = navigateToPreviousStep();
906
940
  break;
907
941
  default:
908
- event = createCustomEvent('m-navigate', step);
942
+ event = createCustomEvent('navigate', {
943
+ step,
944
+ });
909
945
  }
910
946
  stepsElement.dispatchEvent(event);
911
947
  }, [stepsElement]);
@@ -913,7 +949,7 @@ function useSteps() {
913
949
  if (stepsElement == null) {
914
950
  return;
915
951
  }
916
- const event = createCustomEvent('m-complete');
952
+ const event = createCustomEvent('stepcomplete');
917
953
  stepsElement.dispatchEvent(event);
918
954
  }, [stepsElement]);
919
955
  return {
@@ -974,7 +1010,7 @@ const TableHeadCell = createComponent({
974
1010
  elementClass: TableHeadCell$1,
975
1011
  displayName: 'TableHeadCell',
976
1012
  events: {
977
- onSort: 'm-sort',
1013
+ onSort: 'columnsort',
978
1014
  },
979
1015
  });
980
1016
 
@@ -1026,7 +1062,7 @@ const Tabs = createComponent({
1026
1062
  tagName: 'm-tabs',
1027
1063
  elementClass: Tabs$1,
1028
1064
  events: {
1029
- onTabChange: 'm-tab-change',
1065
+ onTabChange: 'tabchange',
1030
1066
  },
1031
1067
  displayName: 'Tabs',
1032
1068
  subComponents: {
@@ -1050,8 +1086,8 @@ const WiredActionableTag = createComponent({
1050
1086
  elementClass: ActionableTag$1,
1051
1087
  displayName: 'ActionableTag',
1052
1088
  events: {
1053
- onChange: 'm-change',
1054
- onRemove: 'm-remove',
1089
+ onChange: 'change',
1090
+ onRemove: 'remove',
1055
1091
  },
1056
1092
  });
1057
1093
  const ActionableTag = forwardRef((props, ref) => {
@@ -1084,7 +1120,7 @@ const WiredTextField = createComponent({
1084
1120
  events: {
1085
1121
  onInput: 'input',
1086
1122
  onChange: 'change',
1087
- onClear: 'm-clear',
1123
+ onClear: 'clear',
1088
1124
  },
1089
1125
  displayName: 'TextField',
1090
1126
  });
@@ -1188,9 +1224,55 @@ const WiredTooltip = createComponent({
1188
1224
  elementClass: Tooltip$1,
1189
1225
  displayName: 'Tooltip',
1190
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 '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
+ */
1191
1254
  function Tooltip(props) {
1192
1255
  const { children, message, ...rest } = props;
1193
- 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] }));
1194
1276
  }
1195
1277
 
1196
1278
  const LogoLoader = createComponent({
@@ -1199,4 +1281,10 @@ const LogoLoader = createComponent({
1199
1281
  displayName: 'LogoLoader',
1200
1282
  });
1201
1283
 
1202
- export { Accordion, ActionableTag, Badge, Banner, Box, Button, Card, Checkbox, Column, Container, Dialog, Divider, Drawer, Dropdown, DropdownItem, DropdownMenu, DropdownTrigger, EmptyState, Field, Grid, Group, Header, HeaderActions, HeaderTitle, Icon, LabeledValue, LabeledValueLabel, LabeledValueValue, Layout, Link, LogoLoader, PageContent, Pagination, ProgressBar, ProgressBarCountdown, Radio, RadioGroup, Row, Section, Sidebar, SpinnerWheel, Stack, Step, Steps, SubHeader, Switch, Switcher, Tab, TabPanel, Table, TableActions, TableBody, TableCell, TableFeedback, TableFoot, TableHead, TableHeadCell, TableRow, TableToolbar, Tabs, Tag, Text, TextArea, TextField, Timeline, TimelineExpandableItem, TimelineItem, TimelineItemBody, TimelineItemFooter, TimelineItemHeader, TimelineItemHeaderSubtitle, TimelineItemHeaderTitle, TimelineItemIcon, Toggle, ToggleGroup, Tooltip, useSteps };
1284
+ const DotsLoader = createComponent({
1285
+ tagName: 'm-dots-loader',
1286
+ elementClass: DotsLoader$1,
1287
+ displayName: 'DotsLoader',
1288
+ });
1289
+
1290
+ export { Accordion, ActionableTag, Badge, Banner, Box, Button, Card, Checkbox, Column, Container, Dialog, Divider, DotsLoader, Drawer, Dropdown, DropdownItem, DropdownMenu, DropdownTrigger, EmptyState, Field, Grid, Group, Header, HeaderActions, HeaderTitle, Icon, LabeledValue, LabeledValueLabel, LabeledValueValue, Layout, Link, LogoLoader, PageContent, Pagination, ProgressBar, ProgressBarCountdown, Radio, RadioGroup, Row, Section, Select, Sidebar, SpinnerWheel, Stack, Step, Steps, SubHeader, Switch, Switcher, Tab, TabPanel, Table, TableActions, TableBody, TableCell, TableFeedback, TableFoot, TableHead, TableHeadCell, TableRow, TableToolbar, Tabs, Tag, Text, TextArea, TextField, Timeline, TimelineExpandableItem, TimelineItem, TimelineItemBody, TimelineItemFooter, TimelineItemHeader, TimelineItemHeaderSubtitle, TimelineItemHeaderTitle, TimelineItemIcon, Toggle, ToggleGroup, Tooltip, useSteps };
@@ -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.2",
3
+ "version": "3.0.0-beta.21",
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.2",
44
- "@loadsmart/miranda-wc": "3.0.0-beta.2",
45
- "@lit/react": "^1.0.5"
44
+ "@loadsmart/miranda-tokens": "4.0.0-beta.21",
45
+ "@loadsmart/miranda-wc": "3.0.0-beta.21",
46
+ "@lit/react": "^1.0.5",
47
+ "react-is": "^18.3.1"
46
48
  },
47
49
  "directories": {
48
50
  "test": "tests"