@xmesh/system-design 0.0.4 → 0.0.5
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.
- package/README.md +2 -1
- package/custom-elements.json +18382 -0
- package/dist/lit/components/alert/index.d.ts +5 -0
- package/dist/lit/components/alert/index.js +8 -2
- package/dist/lit/components/alert/index.styles.js +215 -0
- package/dist/lit/components/app-bar/index.d.ts +1 -0
- package/dist/lit/components/app-bar/index.js +4 -2
- package/dist/lit/components/app-bar/index.styles.js +94 -0
- package/dist/lit/components/artifact/index.d.ts +5 -0
- package/dist/lit/components/artifact/index.js +14 -10
- package/dist/lit/components/artifact/index.styles.js +180 -0
- package/dist/lit/components/autocomplete/index.d.ts +5 -0
- package/dist/lit/components/autocomplete/index.js +11 -2
- package/dist/lit/components/autocomplete/index.styles.js +185 -0
- package/dist/lit/components/avatar/index.d.ts +1 -0
- package/dist/lit/components/avatar/index.js +4 -2
- package/dist/lit/components/avatar/index.styles.js +76 -0
- package/dist/lit/components/avatar-group/index.d.ts +1 -0
- package/dist/lit/components/avatar-group/index.js +4 -2
- package/dist/lit/components/avatar-group/index.styles.js +74 -0
- package/dist/lit/components/badge/index.d.ts +1 -0
- package/dist/lit/components/badge/index.js +4 -2
- package/dist/lit/components/badge/index.styles.js +86 -0
- package/dist/lit/components/brand-mark/index.js +8 -9
- package/dist/lit/components/brand-mark/index.styles.js +123 -0
- package/dist/lit/components/breadcrumbs/index.d.ts +1 -0
- package/dist/lit/components/breadcrumbs/index.js +5 -4
- package/dist/lit/components/breadcrumbs/index.styles.js +105 -0
- package/dist/lit/components/bubble/index.d.ts +4 -0
- package/dist/lit/components/bubble/index.js +14 -11
- package/dist/lit/components/bubble/index.styles.js +196 -0
- package/dist/lit/components/button/index.d.ts +1 -0
- package/dist/lit/components/button/index.js +6 -13
- package/dist/lit/components/button/index.styles.js +356 -0
- package/dist/lit/components/card/index.d.ts +1 -0
- package/dist/lit/components/card/index.js +4 -2
- package/dist/lit/components/card/index.styles.js +113 -0
- package/dist/lit/components/chat/index.d.ts +6 -0
- package/dist/lit/components/chat/index.js +15 -10
- package/dist/lit/components/chat/index.styles.js +306 -0
- package/dist/lit/components/checkbox/index.d.ts +1 -0
- package/dist/lit/components/checkbox/index.js +7 -4
- package/dist/lit/components/checkbox/index.styles.js +140 -0
- package/dist/lit/components/chip/index.d.ts +5 -0
- package/dist/lit/components/chip/index.js +8 -2
- package/dist/lit/components/chip/index.styles.js +159 -0
- package/dist/lit/components/chip-group/index.d.ts +4 -0
- package/dist/lit/components/chip-group/index.js +7 -2
- package/dist/lit/components/chip-group/index.styles.js +33 -0
- package/dist/lit/components/code/index.d.ts +1 -0
- package/dist/lit/components/code/index.js +4 -3
- package/dist/lit/components/code/index.styles.js +56 -0
- package/dist/lit/components/composer/index.d.ts +6 -0
- package/dist/lit/components/composer/index.js +15 -10
- package/dist/lit/components/composer/index.styles.js +562 -0
- package/dist/lit/components/data-table/index.css +18 -0
- package/dist/lit/components/data-table/index.d.ts +30 -0
- package/dist/lit/components/data-table/index.js +120 -34
- package/dist/lit/components/data-table/index.styles.js +198 -0
- package/dist/lit/components/date-range/index.d.ts +4 -0
- package/dist/lit/components/date-range/index.js +7 -2
- package/dist/lit/components/date-range/index.styles.js +338 -0
- package/dist/lit/components/dialog/index.d.ts +4 -0
- package/dist/lit/components/dialog/index.js +7 -2
- package/dist/lit/components/dialog/index.styles.js +138 -0
- package/dist/lit/components/divider/index.d.ts +1 -0
- package/dist/lit/components/divider/index.js +4 -2
- package/dist/lit/components/divider/index.styles.js +41 -0
- package/dist/lit/components/empty-state/index.d.ts +1 -0
- package/dist/lit/components/empty-state/index.js +4 -2
- package/dist/lit/components/empty-state/index.styles.js +83 -0
- package/dist/lit/components/expansion-panel/index.d.ts +5 -0
- package/dist/lit/components/expansion-panel/index.js +8 -2
- package/dist/lit/components/expansion-panel/index.styles.js +134 -0
- package/dist/lit/components/field/index.d.ts +4 -0
- package/dist/lit/components/field/index.js +9 -4
- package/dist/lit/components/field/index.styles.js +237 -0
- package/dist/lit/components/file-input/index.d.ts +4 -0
- package/dist/lit/components/file-input/index.js +10 -4
- package/dist/lit/components/file-input/index.styles.js +271 -0
- package/dist/lit/components/form/index.d.ts +4 -0
- package/dist/lit/components/form/index.js +7 -2
- package/dist/lit/components/form/index.styles.js +43 -0
- package/dist/lit/components/grid/index.d.ts +1 -0
- package/dist/lit/components/grid/index.js +4 -2
- package/dist/lit/components/grid/index.styles.js +67 -0
- package/dist/lit/components/kbd/index.d.ts +1 -0
- package/dist/lit/components/kbd/index.js +4 -2
- package/dist/lit/components/kbd/index.styles.js +49 -0
- package/dist/lit/components/list/index.d.ts +4 -0
- package/dist/lit/components/list/index.js +7 -2
- package/dist/lit/components/list/index.styles.js +29 -0
- package/dist/lit/components/list-item/index.d.ts +1 -0
- package/dist/lit/components/list-item/index.js +4 -2
- package/dist/lit/components/list-item/index.styles.js +133 -0
- package/dist/lit/components/menu/index.d.ts +8 -0
- package/dist/lit/components/menu/index.js +11 -3
- package/dist/lit/components/menu/index.styles.js +108 -0
- package/dist/lit/components/multi-select/index.css +156 -0
- package/dist/lit/components/multi-select/index.d.ts +70 -0
- package/dist/lit/components/multi-select/index.js +497 -0
- package/dist/lit/components/multi-select/index.styles.js +170 -0
- package/dist/lit/components/navigation-drawer/index.d.ts +4 -0
- package/dist/lit/components/navigation-drawer/index.js +7 -2
- package/dist/lit/components/navigation-drawer/index.styles.js +128 -0
- package/dist/lit/components/overlay/index.d.ts +5 -0
- package/dist/lit/components/overlay/index.js +8 -2
- package/dist/lit/components/overlay/index.styles.js +185 -0
- package/dist/lit/components/pagination/index.d.ts +17 -0
- package/dist/lit/components/pagination/index.js +53 -8
- package/dist/lit/components/pagination/index.styles.js +116 -0
- package/dist/lit/components/popover/index.d.ts +5 -0
- package/dist/lit/components/popover/index.js +8 -2
- package/dist/lit/components/popover/index.styles.js +48 -0
- package/dist/lit/components/primitives/index.js +8 -9
- package/dist/lit/components/primitives/index.styles.js +518 -0
- package/dist/lit/components/progress/index.d.ts +1 -0
- package/dist/lit/components/progress/index.js +4 -2
- package/dist/lit/components/progress/index.styles.js +157 -0
- package/dist/lit/components/radio-group/index.d.ts +5 -0
- package/dist/lit/components/radio-group/index.js +10 -6
- package/dist/lit/components/radio-group/index.styles.js +192 -0
- package/dist/lit/components/select/index.d.ts +4 -0
- package/dist/lit/components/select/index.js +10 -2
- package/dist/lit/components/select/index.styles.js +165 -0
- package/dist/lit/components/sidebar-item/index.js +8 -9
- package/dist/lit/components/sidebar-item/index.styles.js +147 -0
- package/dist/lit/components/skeleton/index.d.ts +1 -0
- package/dist/lit/components/skeleton/index.js +4 -2
- package/dist/lit/components/skeleton/index.styles.js +95 -0
- package/dist/lit/components/slider/index.d.ts +5 -0
- package/dist/lit/components/slider/index.js +11 -4
- package/dist/lit/components/slider/index.styles.js +185 -0
- package/dist/lit/components/snackbar/index.d.ts +4 -0
- package/dist/lit/components/snackbar/index.js +14 -10
- package/dist/lit/components/snackbar/index.styles.js +293 -0
- package/dist/lit/components/stack/index.d.ts +1 -0
- package/dist/lit/components/stack/index.js +4 -2
- package/dist/lit/components/stack/index.styles.js +55 -0
- package/dist/lit/components/switch/index.d.ts +1 -0
- package/dist/lit/components/switch/index.js +7 -4
- package/dist/lit/components/switch/index.styles.js +140 -0
- package/dist/lit/components/table/index.d.ts +1 -0
- package/dist/lit/components/table/index.js +4 -2
- package/dist/lit/components/table/index.styles.js +99 -0
- package/dist/lit/components/tabs/index.d.ts +4 -0
- package/dist/lit/components/tabs/index.js +8 -4
- package/dist/lit/components/tabs/index.styles.js +130 -0
- package/dist/lit/components/text-field/index.d.ts +1 -0
- package/dist/lit/components/text-field/index.js +7 -2
- package/dist/lit/components/text-field/index.styles.js +104 -0
- package/dist/lit/components/textarea/index.d.ts +1 -0
- package/dist/lit/components/textarea/index.js +7 -2
- package/dist/lit/components/textarea/index.styles.js +69 -0
- package/dist/lit/components/tooltip/index.d.ts +1 -0
- package/dist/lit/components/tooltip/index.js +4 -2
- package/dist/lit/components/tooltip/index.styles.js +51 -0
- package/dist/lit/components/validation/index.d.ts +6 -0
- package/dist/lit/components/validation/index.js +15 -10
- package/dist/lit/components/validation/index.styles.js +400 -0
- package/dist/lit/index.d.ts +1 -0
- package/dist/lit/index.js +1 -0
- package/dist/react/XmAlert.d.ts +99 -0
- package/dist/react/XmAlert.js +45 -0
- package/dist/react/XmAppBar.d.ts +59 -0
- package/dist/react/XmAppBar.js +34 -0
- package/dist/react/XmArtifact.d.ts +113 -0
- package/dist/react/XmArtifact.js +45 -0
- package/dist/react/XmArtifactChip.d.ts +56 -0
- package/dist/react/XmArtifactChip.js +32 -0
- package/dist/react/XmAutocomplete.d.ts +153 -0
- package/dist/react/XmAutocomplete.js +68 -0
- package/dist/react/XmAvatar.d.ts +71 -0
- package/dist/react/XmAvatar.js +40 -0
- package/dist/react/XmAvatarGroup.d.ts +59 -0
- package/dist/react/XmAvatarGroup.js +34 -0
- package/dist/react/XmBadge.d.ts +67 -0
- package/dist/react/XmBadge.js +38 -0
- package/dist/react/XmBrandGlyph.d.ts +46 -0
- package/dist/react/XmBrandGlyph.js +24 -0
- package/dist/react/XmBrandMark.d.ts +71 -0
- package/dist/react/XmBrandMark.js +40 -0
- package/dist/react/XmBreadcrumbs.d.ts +56 -0
- package/dist/react/XmBreadcrumbs.js +32 -0
- package/dist/react/XmBubble.d.ts +69 -0
- package/dist/react/XmBubble.js +38 -0
- package/dist/react/XmBubbleActions.d.ts +59 -0
- package/dist/react/XmBubbleActions.js +34 -0
- package/dist/react/XmBubbleGroup.d.ts +82 -0
- package/dist/react/XmBubbleGroup.js +36 -0
- package/dist/react/XmButton.d.ts +89 -0
- package/dist/react/XmButton.js +48 -0
- package/dist/react/XmCard.d.ts +59 -0
- package/dist/react/XmCard.js +34 -0
- package/dist/react/XmChatShell.d.ts +110 -0
- package/dist/react/XmChatShell.js +44 -0
- package/dist/react/XmCheckbox.d.ts +145 -0
- package/dist/react/XmCheckbox.js +58 -0
- package/dist/react/XmChip.d.ts +99 -0
- package/dist/react/XmChip.js +46 -0
- package/dist/react/XmChipGroup.d.ts +79 -0
- package/dist/react/XmChipGroup.js +35 -0
- package/dist/react/XmCode.d.ts +55 -0
- package/dist/react/XmCode.js +32 -0
- package/dist/react/XmComposer.d.ts +123 -0
- package/dist/react/XmComposer.js +52 -0
- package/dist/react/XmDataTable.d.ts +125 -0
- package/dist/react/XmDataTable.js +65 -0
- package/dist/react/XmDateRange.d.ts +93 -0
- package/dist/react/XmDateRange.js +41 -0
- package/dist/react/XmDialog.d.ts +87 -0
- package/dist/react/XmDialog.js +40 -0
- package/dist/react/XmDivider.d.ts +55 -0
- package/dist/react/XmDivider.js +32 -0
- package/dist/react/XmEmptyState.d.ts +61 -0
- package/dist/react/XmEmptyState.js +34 -0
- package/dist/react/XmExpansionPanel.d.ts +101 -0
- package/dist/react/XmExpansionPanel.js +48 -0
- package/dist/react/XmFileInput.d.ts +151 -0
- package/dist/react/XmFileInput.js +68 -0
- package/dist/react/XmFileValidationBlock.d.ts +111 -0
- package/dist/react/XmFileValidationBlock.js +45 -0
- package/dist/react/XmForm.d.ts +91 -0
- package/dist/react/XmForm.js +37 -0
- package/dist/react/XmGrid.d.ts +59 -0
- package/dist/react/XmGrid.js +34 -0
- package/dist/react/XmKbd.d.ts +46 -0
- package/dist/react/XmKbd.js +24 -0
- package/dist/react/XmList.d.ts +83 -0
- package/dist/react/XmList.js +37 -0
- package/dist/react/XmListItem.d.ts +67 -0
- package/dist/react/XmListItem.js +38 -0
- package/dist/react/XmMenu.d.ts +98 -0
- package/dist/react/XmMenu.js +42 -0
- package/dist/react/XmMenuItem.d.ts +63 -0
- package/dist/react/XmMenuItem.js +36 -0
- package/dist/react/XmMultiSelect.d.ts +161 -0
- package/dist/react/XmMultiSelect.js +72 -0
- package/dist/react/XmNavigationDrawer.d.ts +93 -0
- package/dist/react/XmNavigationDrawer.js +41 -0
- package/dist/react/XmOverlay.d.ts +120 -0
- package/dist/react/XmOverlay.js +54 -0
- package/dist/react/XmPagination.d.ts +117 -0
- package/dist/react/XmPagination.js +57 -0
- package/dist/react/XmPopover.d.ts +90 -0
- package/dist/react/XmPopover.js +40 -0
- package/dist/react/XmProgress.d.ts +75 -0
- package/dist/react/XmProgress.js +42 -0
- package/dist/react/XmRadio.d.ts +88 -0
- package/dist/react/XmRadio.js +41 -0
- package/dist/react/XmRadioGroup.d.ts +139 -0
- package/dist/react/XmRadioGroup.js +56 -0
- package/dist/react/XmSelect.d.ts +152 -0
- package/dist/react/XmSelect.js +68 -0
- package/dist/react/XmSidebarItem.d.ts +75 -0
- package/dist/react/XmSidebarItem.js +42 -0
- package/dist/react/XmSkeleton.d.ts +71 -0
- package/dist/react/XmSkeleton.js +40 -0
- package/dist/react/XmSlider.d.ts +160 -0
- package/dist/react/XmSlider.js +74 -0
- package/dist/react/XmSnackbar.d.ts +110 -0
- package/dist/react/XmSnackbar.js +49 -0
- package/dist/react/XmStack.d.ts +71 -0
- package/dist/react/XmStack.js +40 -0
- package/dist/react/XmSwitch.d.ts +136 -0
- package/dist/react/XmSwitch.js +56 -0
- package/dist/react/XmTab.d.ts +79 -0
- package/dist/react/XmTab.js +37 -0
- package/dist/react/XmTabPanel.d.ts +55 -0
- package/dist/react/XmTabPanel.js +32 -0
- package/dist/react/XmTable.d.ts +57 -0
- package/dist/react/XmTable.js +32 -0
- package/dist/react/XmTabs.d.ts +82 -0
- package/dist/react/XmTabs.js +37 -0
- package/dist/react/XmTextField.d.ts +147 -0
- package/dist/react/XmTextField.js +60 -0
- package/dist/react/XmTextarea.d.ts +155 -0
- package/dist/react/XmTextarea.js +64 -0
- package/dist/react/XmTooltip.d.ts +67 -0
- package/dist/react/XmTooltip.js +38 -0
- package/dist/react/index.d.ts +59 -0
- package/dist/react/index.js +59 -0
- package/dist/react/react-utils.js +67 -0
- package/package.json +37 -9
- package/styles/_base-typography.css +86 -0
- package/styles/_primitives.css +54 -0
- package/styles/_reset.css +58 -0
- package/styles/base.css +23 -0
- package/vscode.css-custom-data.json +6 -0
- package/vscode.html-custom-data.json +979 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/multi-select/index.js";
|
|
3
|
+
import {
|
|
4
|
+
useEventListener,
|
|
5
|
+
useProperties,
|
|
6
|
+
createForwardedRefHandler,
|
|
7
|
+
} from "./react-utils.js";
|
|
8
|
+
|
|
9
|
+
export const XmMultiSelect = forwardRef((props, forwardedRef) => {
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
const {
|
|
12
|
+
searchable,
|
|
13
|
+
required,
|
|
14
|
+
disabled,
|
|
15
|
+
readOnly,
|
|
16
|
+
loading,
|
|
17
|
+
initialChecked,
|
|
18
|
+
placeholder,
|
|
19
|
+
max,
|
|
20
|
+
label,
|
|
21
|
+
helper,
|
|
22
|
+
error,
|
|
23
|
+
size,
|
|
24
|
+
name,
|
|
25
|
+
initialValue,
|
|
26
|
+
className,
|
|
27
|
+
exportparts,
|
|
28
|
+
htmlFor,
|
|
29
|
+
part,
|
|
30
|
+
tabIndex,
|
|
31
|
+
options,
|
|
32
|
+
selectedValues,
|
|
33
|
+
...restProps
|
|
34
|
+
} = props;
|
|
35
|
+
|
|
36
|
+
/** Event listeners - run once */
|
|
37
|
+
useEventListener(ref, "change", props.onChange);
|
|
38
|
+
useEventListener(ref, "input", props.onInput);
|
|
39
|
+
|
|
40
|
+
/** Properties - run whenever a property has changed */
|
|
41
|
+
useProperties(ref, "options", options);
|
|
42
|
+
useProperties(ref, "selectedValues", selectedValues);
|
|
43
|
+
|
|
44
|
+
return React.createElement(
|
|
45
|
+
"xm-multi-select",
|
|
46
|
+
{
|
|
47
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
48
|
+
...restProps,
|
|
49
|
+
placeholder: placeholder,
|
|
50
|
+
max: max,
|
|
51
|
+
label: label,
|
|
52
|
+
helper: helper,
|
|
53
|
+
error: error,
|
|
54
|
+
size: size,
|
|
55
|
+
name: name,
|
|
56
|
+
value: initialValue ?? props["value"],
|
|
57
|
+
class: className,
|
|
58
|
+
exportparts: exportparts,
|
|
59
|
+
for: htmlFor ?? props["for"],
|
|
60
|
+
part: part,
|
|
61
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
62
|
+
searchable: searchable ? true : undefined,
|
|
63
|
+
required: required ? true : undefined,
|
|
64
|
+
disabled: disabled ? true : undefined,
|
|
65
|
+
readonly: readOnly ? true : undefined,
|
|
66
|
+
loading: loading ? true : undefined,
|
|
67
|
+
checked: initialChecked ? true : undefined,
|
|
68
|
+
style: { ...props.style },
|
|
69
|
+
},
|
|
70
|
+
props.children,
|
|
71
|
+
);
|
|
72
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
XmNavigationDrawer as XmNavigationDrawerElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../lit/components/navigation-drawer/index.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A generic type for strongly typing custom events with their targets
|
|
9
|
+
* @template T - The type of the event target (extends EventTarget)
|
|
10
|
+
* @template D - The type of the detail payload for the custom event
|
|
11
|
+
*/
|
|
12
|
+
type TypedEvent<T extends EventTarget, E = Event> = E & {
|
|
13
|
+
target: T;
|
|
14
|
+
};
|
|
15
|
+
/** `XmNavigationDrawer` component event */
|
|
16
|
+
export type XmNavigationDrawerElementEvent<E = Event> = TypedEvent<
|
|
17
|
+
XmNavigationDrawerElement,
|
|
18
|
+
E
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export type { XmNavigationDrawerElement, CustomEvent };
|
|
22
|
+
|
|
23
|
+
export interface XmNavigationDrawerProps extends Pick<
|
|
24
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
25
|
+
| "children"
|
|
26
|
+
| "dir"
|
|
27
|
+
| "hidden"
|
|
28
|
+
| "id"
|
|
29
|
+
| "lang"
|
|
30
|
+
| "slot"
|
|
31
|
+
| "style"
|
|
32
|
+
| "title"
|
|
33
|
+
| "translate"
|
|
34
|
+
| "onClick"
|
|
35
|
+
| "onFocus"
|
|
36
|
+
| "onBlur"
|
|
37
|
+
> {
|
|
38
|
+
/** undefined */
|
|
39
|
+
open?: boolean;
|
|
40
|
+
|
|
41
|
+
/** undefined */
|
|
42
|
+
collapsed?: boolean;
|
|
43
|
+
|
|
44
|
+
/** undefined */
|
|
45
|
+
modal?: boolean;
|
|
46
|
+
|
|
47
|
+
/** undefined */
|
|
48
|
+
label?: XmNavigationDrawerElement["label"];
|
|
49
|
+
|
|
50
|
+
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
51
|
+
className?: string;
|
|
52
|
+
|
|
53
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
54
|
+
exportparts?: string;
|
|
55
|
+
|
|
56
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
57
|
+
htmlFor?: string;
|
|
58
|
+
|
|
59
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
60
|
+
key?: number | string;
|
|
61
|
+
|
|
62
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
63
|
+
part?: string;
|
|
64
|
+
|
|
65
|
+
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
66
|
+
ref?: React.Ref<XmNavigationDrawerElement>;
|
|
67
|
+
|
|
68
|
+
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
69
|
+
tabIndex?: number;
|
|
70
|
+
|
|
71
|
+
/** Fired when the element requests to close. */
|
|
72
|
+
onClose?: (event: XmNavigationDrawerElementEvent) => void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
*
|
|
78
|
+
* ## Attributes & Properties
|
|
79
|
+
*
|
|
80
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
81
|
+
*
|
|
82
|
+
* - `open`: undefined
|
|
83
|
+
* - `collapsed`: undefined
|
|
84
|
+
* - `modal`: undefined
|
|
85
|
+
* - `label`: undefined
|
|
86
|
+
*
|
|
87
|
+
* ## Events
|
|
88
|
+
*
|
|
89
|
+
* Events that will be emitted by the component.
|
|
90
|
+
*
|
|
91
|
+
* - `close`: Fired when the element requests to close.
|
|
92
|
+
*/
|
|
93
|
+
export const XmNavigationDrawer: React.ForwardRefExoticComponent<XmNavigationDrawerProps>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/navigation-drawer/index.js";
|
|
3
|
+
import { useEventListener, createForwardedRefHandler } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const XmNavigationDrawer = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const {
|
|
8
|
+
open,
|
|
9
|
+
collapsed,
|
|
10
|
+
modal,
|
|
11
|
+
label,
|
|
12
|
+
className,
|
|
13
|
+
exportparts,
|
|
14
|
+
htmlFor,
|
|
15
|
+
part,
|
|
16
|
+
tabIndex,
|
|
17
|
+
...restProps
|
|
18
|
+
} = props;
|
|
19
|
+
|
|
20
|
+
/** Event listeners - run once */
|
|
21
|
+
useEventListener(ref, "close", props.onClose);
|
|
22
|
+
|
|
23
|
+
return React.createElement(
|
|
24
|
+
"xm-navigation-drawer",
|
|
25
|
+
{
|
|
26
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
27
|
+
...restProps,
|
|
28
|
+
label: label,
|
|
29
|
+
class: className,
|
|
30
|
+
exportparts: exportparts,
|
|
31
|
+
for: htmlFor ?? props["for"],
|
|
32
|
+
part: part,
|
|
33
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
34
|
+
open: open ? true : undefined,
|
|
35
|
+
collapsed: collapsed ? true : undefined,
|
|
36
|
+
modal: modal ? true : undefined,
|
|
37
|
+
style: { ...props.style },
|
|
38
|
+
},
|
|
39
|
+
props.children,
|
|
40
|
+
);
|
|
41
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
XmOverlay as XmOverlayElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../lit/components/overlay/index.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A generic type for strongly typing custom events with their targets
|
|
9
|
+
* @template T - The type of the event target (extends EventTarget)
|
|
10
|
+
* @template D - The type of the detail payload for the custom event
|
|
11
|
+
*/
|
|
12
|
+
type TypedEvent<T extends EventTarget, E = Event> = E & {
|
|
13
|
+
target: T;
|
|
14
|
+
};
|
|
15
|
+
/** `XmOverlay` component event */
|
|
16
|
+
export type XmOverlayElementEvent<E = Event> = TypedEvent<XmOverlayElement, E>;
|
|
17
|
+
|
|
18
|
+
export type { XmOverlayElement, CustomEvent };
|
|
19
|
+
|
|
20
|
+
export interface XmOverlayProps extends Pick<
|
|
21
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
22
|
+
| "children"
|
|
23
|
+
| "dir"
|
|
24
|
+
| "hidden"
|
|
25
|
+
| "id"
|
|
26
|
+
| "lang"
|
|
27
|
+
| "slot"
|
|
28
|
+
| "style"
|
|
29
|
+
| "title"
|
|
30
|
+
| "translate"
|
|
31
|
+
| "onClick"
|
|
32
|
+
| "onFocus"
|
|
33
|
+
| "onBlur"
|
|
34
|
+
> {
|
|
35
|
+
/** undefined */
|
|
36
|
+
open?: boolean;
|
|
37
|
+
|
|
38
|
+
/** undefined */
|
|
39
|
+
mode?: XmOverlayElement["mode"];
|
|
40
|
+
|
|
41
|
+
/** undefined */
|
|
42
|
+
tier?: XmOverlayElement["tier"];
|
|
43
|
+
|
|
44
|
+
/** undefined */
|
|
45
|
+
placement?: XmOverlayElement["placement"];
|
|
46
|
+
|
|
47
|
+
/** undefined */
|
|
48
|
+
label?: XmOverlayElement["label"];
|
|
49
|
+
|
|
50
|
+
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
51
|
+
className?: string;
|
|
52
|
+
|
|
53
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
54
|
+
exportparts?: string;
|
|
55
|
+
|
|
56
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
57
|
+
htmlFor?: string;
|
|
58
|
+
|
|
59
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
60
|
+
key?: number | string;
|
|
61
|
+
|
|
62
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
63
|
+
part?: string;
|
|
64
|
+
|
|
65
|
+
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
66
|
+
ref?: React.Ref<XmOverlayElement>;
|
|
67
|
+
|
|
68
|
+
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
69
|
+
tabIndex?: number;
|
|
70
|
+
|
|
71
|
+
/** Trigger element to anchor a non-modal overlay against (CSS anchor()).
|
|
72
|
+
A property, not an attribute — it is an element reference, possibly from
|
|
73
|
+
another shadow root. */
|
|
74
|
+
anchor?: XmOverlayElement["anchor"];
|
|
75
|
+
|
|
76
|
+
/** Element focus is restored to on close. Defaults to `anchor`, else the
|
|
77
|
+
document's deepest activeElement at open time. */
|
|
78
|
+
opener?: XmOverlayElement["opener"];
|
|
79
|
+
|
|
80
|
+
/** Fired when the overlay opens. */
|
|
81
|
+
onXmOverlayOpen?: (event: XmOverlayElementEvent) => void;
|
|
82
|
+
|
|
83
|
+
/** Fired when the overlay closes. */
|
|
84
|
+
onXmOverlayClose?: (event: XmOverlayElementEvent) => void;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
*
|
|
90
|
+
* ## Attributes & Properties
|
|
91
|
+
*
|
|
92
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
93
|
+
*
|
|
94
|
+
* - `open`: undefined
|
|
95
|
+
* - `mode`: undefined
|
|
96
|
+
* - `tier`: undefined
|
|
97
|
+
* - `placement`: undefined
|
|
98
|
+
* - `label`: undefined
|
|
99
|
+
* - `anchor`: Trigger element to anchor a non-modal overlay against (CSS anchor()).
|
|
100
|
+
* A property, not an attribute — it is an element reference, possibly from
|
|
101
|
+
* another shadow root. (property only)
|
|
102
|
+
* - `opener`: Element focus is restored to on close. Defaults to `anchor`, else the
|
|
103
|
+
* document's deepest activeElement at open time. (property only)
|
|
104
|
+
*
|
|
105
|
+
* ## Events
|
|
106
|
+
*
|
|
107
|
+
* Events that will be emitted by the component.
|
|
108
|
+
*
|
|
109
|
+
* - `xm-overlay-open`: Fired when the overlay opens.
|
|
110
|
+
* - `xm-overlay-close`: Fired when the overlay closes.
|
|
111
|
+
*
|
|
112
|
+
* ## Methods
|
|
113
|
+
*
|
|
114
|
+
* Methods that can be called to access component functionality.
|
|
115
|
+
*
|
|
116
|
+
* - `show() => void`: undefined
|
|
117
|
+
* - `hide(reason: OverlayCloseReason = "api") => void`: undefined
|
|
118
|
+
* - `toggle() => void`: undefined
|
|
119
|
+
*/
|
|
120
|
+
export const XmOverlay: React.ForwardRefExoticComponent<XmOverlayProps>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/overlay/index.js";
|
|
3
|
+
import {
|
|
4
|
+
useEventListener,
|
|
5
|
+
useProperties,
|
|
6
|
+
createForwardedRefHandler,
|
|
7
|
+
} from "./react-utils.js";
|
|
8
|
+
|
|
9
|
+
export const XmOverlay = forwardRef((props, forwardedRef) => {
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
const {
|
|
12
|
+
open,
|
|
13
|
+
mode,
|
|
14
|
+
tier,
|
|
15
|
+
placement,
|
|
16
|
+
label,
|
|
17
|
+
className,
|
|
18
|
+
exportparts,
|
|
19
|
+
htmlFor,
|
|
20
|
+
part,
|
|
21
|
+
tabIndex,
|
|
22
|
+
anchor,
|
|
23
|
+
opener,
|
|
24
|
+
...restProps
|
|
25
|
+
} = props;
|
|
26
|
+
|
|
27
|
+
/** Event listeners - run once */
|
|
28
|
+
useEventListener(ref, "xm-overlay-open", props.onXmOverlayOpen);
|
|
29
|
+
useEventListener(ref, "xm-overlay-close", props.onXmOverlayClose);
|
|
30
|
+
|
|
31
|
+
/** Properties - run whenever a property has changed */
|
|
32
|
+
useProperties(ref, "anchor", anchor);
|
|
33
|
+
useProperties(ref, "opener", opener);
|
|
34
|
+
|
|
35
|
+
return React.createElement(
|
|
36
|
+
"xm-overlay",
|
|
37
|
+
{
|
|
38
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
39
|
+
...restProps,
|
|
40
|
+
mode: mode,
|
|
41
|
+
tier: tier,
|
|
42
|
+
placement: placement,
|
|
43
|
+
label: label,
|
|
44
|
+
class: className,
|
|
45
|
+
exportparts: exportparts,
|
|
46
|
+
for: htmlFor ?? props["for"],
|
|
47
|
+
part: part,
|
|
48
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
49
|
+
open: open ? true : undefined,
|
|
50
|
+
style: { ...props.style },
|
|
51
|
+
},
|
|
52
|
+
props.children,
|
|
53
|
+
);
|
|
54
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
XmPagination as XmPaginationElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../lit/components/pagination/index.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A generic type for strongly typing custom events with their targets
|
|
9
|
+
* @template T - The type of the event target (extends EventTarget)
|
|
10
|
+
* @template D - The type of the detail payload for the custom event
|
|
11
|
+
*/
|
|
12
|
+
type TypedEvent<T extends EventTarget, E = Event> = E & {
|
|
13
|
+
target: T;
|
|
14
|
+
};
|
|
15
|
+
/** `XmPagination` component event */
|
|
16
|
+
export type XmPaginationElementEvent<E = Event> = TypedEvent<
|
|
17
|
+
XmPaginationElement,
|
|
18
|
+
E
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export type { XmPaginationElement, CustomEvent };
|
|
22
|
+
|
|
23
|
+
export interface XmPaginationProps extends Pick<
|
|
24
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
25
|
+
| "children"
|
|
26
|
+
| "dir"
|
|
27
|
+
| "hidden"
|
|
28
|
+
| "id"
|
|
29
|
+
| "lang"
|
|
30
|
+
| "slot"
|
|
31
|
+
| "style"
|
|
32
|
+
| "title"
|
|
33
|
+
| "translate"
|
|
34
|
+
| "onClick"
|
|
35
|
+
| "onFocus"
|
|
36
|
+
| "onBlur"
|
|
37
|
+
> {
|
|
38
|
+
/** undefined */
|
|
39
|
+
page?: XmPaginationElement["page"];
|
|
40
|
+
|
|
41
|
+
/** undefined */
|
|
42
|
+
total?: XmPaginationElement["total"];
|
|
43
|
+
|
|
44
|
+
/** undefined */
|
|
45
|
+
siblings?: XmPaginationElement["siblings"];
|
|
46
|
+
|
|
47
|
+
/** undefined */
|
|
48
|
+
size?: XmPaginationElement["size"];
|
|
49
|
+
|
|
50
|
+
/** Offset/limit mode (AD-18): set `limit` + `total-items` (+ `offset`) instead
|
|
51
|
+
of `page` + `total`. The page-based API stays available and unchanged; in
|
|
52
|
+
this mode the control ALSO emits xm-pagination-offset-change. */
|
|
53
|
+
offset?: XmPaginationElement["offset"];
|
|
54
|
+
|
|
55
|
+
/** undefined */
|
|
56
|
+
limit?: XmPaginationElement["limit"];
|
|
57
|
+
|
|
58
|
+
/** undefined */
|
|
59
|
+
totalItems?: XmPaginationElement["totalItems"];
|
|
60
|
+
|
|
61
|
+
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
62
|
+
className?: string;
|
|
63
|
+
|
|
64
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
65
|
+
exportparts?: string;
|
|
66
|
+
|
|
67
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
68
|
+
htmlFor?: string;
|
|
69
|
+
|
|
70
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
71
|
+
key?: number | string;
|
|
72
|
+
|
|
73
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
74
|
+
part?: string;
|
|
75
|
+
|
|
76
|
+
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
77
|
+
ref?: React.Ref<XmPaginationElement>;
|
|
78
|
+
|
|
79
|
+
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
80
|
+
tabIndex?: number;
|
|
81
|
+
|
|
82
|
+
/** Fired when the page changes (`detail.page`). */
|
|
83
|
+
onXmPaginationPageChange?: (event: XmPaginationElementEvent) => void;
|
|
84
|
+
|
|
85
|
+
/** Fired on commit with the new value in `detail`. */
|
|
86
|
+
onChange?: (event: XmPaginationElementEvent) => void;
|
|
87
|
+
|
|
88
|
+
/** Fired in offset/limit mode (`detail.offset`, `detail.limit`). */
|
|
89
|
+
onXmPaginationOffsetChange?: (event: XmPaginationElementEvent) => void;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
*
|
|
95
|
+
* ## Attributes & Properties
|
|
96
|
+
*
|
|
97
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
98
|
+
*
|
|
99
|
+
* - `page`: undefined
|
|
100
|
+
* - `total`: undefined
|
|
101
|
+
* - `siblings`: undefined
|
|
102
|
+
* - `size`: undefined
|
|
103
|
+
* - `offset`: Offset/limit mode (AD-18): set `limit` + `total-items` (+ `offset`) instead
|
|
104
|
+
* of `page` + `total`. The page-based API stays available and unchanged; in
|
|
105
|
+
* this mode the control ALSO emits xm-pagination-offset-change.
|
|
106
|
+
* - `limit`: undefined
|
|
107
|
+
* - `total-items`/`totalItems`: undefined
|
|
108
|
+
*
|
|
109
|
+
* ## Events
|
|
110
|
+
*
|
|
111
|
+
* Events that will be emitted by the component.
|
|
112
|
+
*
|
|
113
|
+
* - `xm-pagination-page-change`: Fired when the page changes (`detail.page`).
|
|
114
|
+
* - `change`: Fired on commit with the new value in `detail`.
|
|
115
|
+
* - `xm-pagination-offset-change`: Fired in offset/limit mode (`detail.offset`, `detail.limit`).
|
|
116
|
+
*/
|
|
117
|
+
export const XmPagination: React.ForwardRefExoticComponent<XmPaginationProps>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/pagination/index.js";
|
|
3
|
+
import { useEventListener, createForwardedRefHandler } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const XmPagination = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const {
|
|
8
|
+
page,
|
|
9
|
+
total,
|
|
10
|
+
siblings,
|
|
11
|
+
size,
|
|
12
|
+
offset,
|
|
13
|
+
limit,
|
|
14
|
+
totalItems,
|
|
15
|
+
className,
|
|
16
|
+
exportparts,
|
|
17
|
+
htmlFor,
|
|
18
|
+
part,
|
|
19
|
+
tabIndex,
|
|
20
|
+
...restProps
|
|
21
|
+
} = props;
|
|
22
|
+
|
|
23
|
+
/** Event listeners - run once */
|
|
24
|
+
useEventListener(
|
|
25
|
+
ref,
|
|
26
|
+
"xm-pagination-page-change",
|
|
27
|
+
props.onXmPaginationPageChange,
|
|
28
|
+
);
|
|
29
|
+
useEventListener(ref, "change", props.onChange);
|
|
30
|
+
useEventListener(
|
|
31
|
+
ref,
|
|
32
|
+
"xm-pagination-offset-change",
|
|
33
|
+
props.onXmPaginationOffsetChange,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
return React.createElement(
|
|
37
|
+
"xm-pagination",
|
|
38
|
+
{
|
|
39
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
40
|
+
...restProps,
|
|
41
|
+
page: page,
|
|
42
|
+
total: total,
|
|
43
|
+
siblings: siblings,
|
|
44
|
+
size: size,
|
|
45
|
+
offset: offset,
|
|
46
|
+
limit: limit,
|
|
47
|
+
"total-items": totalItems ?? props["total-items"],
|
|
48
|
+
class: className,
|
|
49
|
+
exportparts: exportparts,
|
|
50
|
+
for: htmlFor ?? props["for"],
|
|
51
|
+
part: part,
|
|
52
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
53
|
+
style: { ...props.style },
|
|
54
|
+
},
|
|
55
|
+
props.children,
|
|
56
|
+
);
|
|
57
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
XmPopover as XmPopoverElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../lit/components/popover/index.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A generic type for strongly typing custom events with their targets
|
|
9
|
+
* @template T - The type of the event target (extends EventTarget)
|
|
10
|
+
* @template D - The type of the detail payload for the custom event
|
|
11
|
+
*/
|
|
12
|
+
type TypedEvent<T extends EventTarget, E = Event> = E & {
|
|
13
|
+
target: T;
|
|
14
|
+
};
|
|
15
|
+
/** `XmPopover` component event */
|
|
16
|
+
export type XmPopoverElementEvent<E = Event> = TypedEvent<XmPopoverElement, E>;
|
|
17
|
+
|
|
18
|
+
export type { XmPopoverElement, CustomEvent };
|
|
19
|
+
|
|
20
|
+
export interface XmPopoverProps extends Pick<
|
|
21
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
22
|
+
| "children"
|
|
23
|
+
| "dir"
|
|
24
|
+
| "hidden"
|
|
25
|
+
| "id"
|
|
26
|
+
| "lang"
|
|
27
|
+
| "slot"
|
|
28
|
+
| "style"
|
|
29
|
+
| "title"
|
|
30
|
+
| "translate"
|
|
31
|
+
| "onClick"
|
|
32
|
+
| "onFocus"
|
|
33
|
+
| "onBlur"
|
|
34
|
+
> {
|
|
35
|
+
/** undefined */
|
|
36
|
+
open?: boolean;
|
|
37
|
+
|
|
38
|
+
/** undefined */
|
|
39
|
+
placement?: XmPopoverElement["placement"];
|
|
40
|
+
|
|
41
|
+
/** undefined */
|
|
42
|
+
label?: XmPopoverElement["label"];
|
|
43
|
+
|
|
44
|
+
/** A space-separated list of the classes of the element. Classes allows CSS and JavaScript to select and access specific elements via the class selectors or functions like the method `Document.getElementsByClassName()`. */
|
|
45
|
+
className?: string;
|
|
46
|
+
|
|
47
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
48
|
+
exportparts?: string;
|
|
49
|
+
|
|
50
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
51
|
+
htmlFor?: string;
|
|
52
|
+
|
|
53
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
54
|
+
key?: number | string;
|
|
55
|
+
|
|
56
|
+
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
|
|
57
|
+
part?: string;
|
|
58
|
+
|
|
59
|
+
/** A mutable ref object whose `.current` property is initialized to the passed argument (`initialValue`). The returned object will persist for the full lifetime of the component. */
|
|
60
|
+
ref?: React.Ref<XmPopoverElement>;
|
|
61
|
+
|
|
62
|
+
/** Allows developers to make HTML elements focusable, allow or prevent them from being sequentially focusable (usually with the `Tab` key, hence the name) and determine their relative ordering for sequential focus navigation. */
|
|
63
|
+
tabIndex?: number;
|
|
64
|
+
|
|
65
|
+
/** Fired when the popover opens. */
|
|
66
|
+
onXmPopoverOpen?: (event: XmPopoverElementEvent) => void;
|
|
67
|
+
|
|
68
|
+
/** Fired when the popover closes. */
|
|
69
|
+
onXmPopoverClose?: (event: XmPopoverElementEvent) => void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
*
|
|
74
|
+
*
|
|
75
|
+
* ## Attributes & Properties
|
|
76
|
+
*
|
|
77
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
78
|
+
*
|
|
79
|
+
* - `open`: undefined
|
|
80
|
+
* - `placement`: undefined
|
|
81
|
+
* - `label`: undefined
|
|
82
|
+
*
|
|
83
|
+
* ## Events
|
|
84
|
+
*
|
|
85
|
+
* Events that will be emitted by the component.
|
|
86
|
+
*
|
|
87
|
+
* - `xm-popover-open`: Fired when the popover opens.
|
|
88
|
+
* - `xm-popover-close`: Fired when the popover closes.
|
|
89
|
+
*/
|
|
90
|
+
export const XmPopover: React.ForwardRefExoticComponent<XmPopoverProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/popover/index.js";
|
|
3
|
+
import { useEventListener, createForwardedRefHandler } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const XmPopover = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const {
|
|
8
|
+
open,
|
|
9
|
+
placement,
|
|
10
|
+
label,
|
|
11
|
+
className,
|
|
12
|
+
exportparts,
|
|
13
|
+
htmlFor,
|
|
14
|
+
part,
|
|
15
|
+
tabIndex,
|
|
16
|
+
...restProps
|
|
17
|
+
} = props;
|
|
18
|
+
|
|
19
|
+
/** Event listeners - run once */
|
|
20
|
+
useEventListener(ref, "xm-popover-open", props.onXmPopoverOpen);
|
|
21
|
+
useEventListener(ref, "xm-popover-close", props.onXmPopoverClose);
|
|
22
|
+
|
|
23
|
+
return React.createElement(
|
|
24
|
+
"xm-popover",
|
|
25
|
+
{
|
|
26
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
27
|
+
...restProps,
|
|
28
|
+
placement: placement,
|
|
29
|
+
label: label,
|
|
30
|
+
class: className,
|
|
31
|
+
exportparts: exportparts,
|
|
32
|
+
for: htmlFor ?? props["for"],
|
|
33
|
+
part: part,
|
|
34
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
35
|
+
open: open ? true : undefined,
|
|
36
|
+
style: { ...props.style },
|
|
37
|
+
},
|
|
38
|
+
props.children,
|
|
39
|
+
);
|
|
40
|
+
});
|