@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,151 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
XmFileInput as XmFileInputElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../lit/components/file-input/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
|
+
/** `XmFileInput` component event */
|
|
16
|
+
export type XmFileInputElementEvent<E = Event> = TypedEvent<
|
|
17
|
+
XmFileInputElement,
|
|
18
|
+
E
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export type { XmFileInputElement, CustomEvent };
|
|
22
|
+
|
|
23
|
+
export interface XmFileInputProps 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
|
+
/** Allow selecting more than one file. */
|
|
39
|
+
multiple?: boolean;
|
|
40
|
+
|
|
41
|
+
/** undefined */
|
|
42
|
+
required?: boolean;
|
|
43
|
+
|
|
44
|
+
/** undefined */
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
|
|
47
|
+
/** undefined */
|
|
48
|
+
readOnly?: boolean;
|
|
49
|
+
|
|
50
|
+
/** undefined */
|
|
51
|
+
loading?: boolean;
|
|
52
|
+
|
|
53
|
+
/** INITIAL checked for toggle subclasses; mapped from attribute `checked`. */
|
|
54
|
+
initialChecked?: boolean;
|
|
55
|
+
|
|
56
|
+
/** Native accept filter (e.g. ".yml,.json,image/*"). */
|
|
57
|
+
accept?: XmFileInputElement["accept"];
|
|
58
|
+
|
|
59
|
+
/** undefined */
|
|
60
|
+
label?: XmFileInputElement["label"];
|
|
61
|
+
|
|
62
|
+
/** undefined */
|
|
63
|
+
helper?: XmFileInputElement["helper"];
|
|
64
|
+
|
|
65
|
+
/** Severity copy. Non-empty ⇒ the field is in error (icon + copy, never color). */
|
|
66
|
+
error?: XmFileInputElement["error"];
|
|
67
|
+
|
|
68
|
+
/** undefined */
|
|
69
|
+
size?: XmFileInputElement["size"];
|
|
70
|
+
|
|
71
|
+
/** Form-control name — mirrors native <input name>. */
|
|
72
|
+
name?: XmFileInputElement["name"];
|
|
73
|
+
|
|
74
|
+
/** INITIAL value (uncontrolled-first, AD-6): the `value` attribute seeds the
|
|
75
|
+
live state once, then never overrides user input. Mapped from attribute
|
|
76
|
+
`value` so authors write `<xm-text-field value="…">`. */
|
|
77
|
+
initialValue?: XmFileInputElement["initialValue"];
|
|
78
|
+
|
|
79
|
+
/** 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()`. */
|
|
80
|
+
className?: string;
|
|
81
|
+
|
|
82
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
83
|
+
exportparts?: string;
|
|
84
|
+
|
|
85
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
86
|
+
htmlFor?: string;
|
|
87
|
+
|
|
88
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
89
|
+
key?: number | string;
|
|
90
|
+
|
|
91
|
+
/** 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. */
|
|
92
|
+
part?: string;
|
|
93
|
+
|
|
94
|
+
/** 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. */
|
|
95
|
+
ref?: React.Ref<XmFileInputElement>;
|
|
96
|
+
|
|
97
|
+
/** 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. */
|
|
98
|
+
tabIndex?: number;
|
|
99
|
+
|
|
100
|
+
/** Public read contract (AD-6a) — the selected files. */
|
|
101
|
+
files?: XmFileInputElement["files"];
|
|
102
|
+
|
|
103
|
+
/** Fired on commit with the new value in `detail`. */
|
|
104
|
+
onChange?: (event: XmFileInputElementEvent) => void;
|
|
105
|
+
|
|
106
|
+
/** Fired on each edit with the current value in `detail` (inherited by every field). */
|
|
107
|
+
onInput?: (event: XmFileInputElementEvent) => void;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
*
|
|
113
|
+
* ## Attributes & Properties
|
|
114
|
+
*
|
|
115
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
116
|
+
*
|
|
117
|
+
* - `accept`: Native accept filter (e.g. ".yml,.json,image/*").
|
|
118
|
+
* - `multiple`: Allow selecting more than one file.
|
|
119
|
+
* - `label`: undefined
|
|
120
|
+
* - `helper`: undefined
|
|
121
|
+
* - `error`: Severity copy. Non-empty ⇒ the field is in error (icon + copy, never color).
|
|
122
|
+
* - `size`: undefined
|
|
123
|
+
* - `required`: undefined
|
|
124
|
+
* - `disabled`: undefined
|
|
125
|
+
* - `readonly`/`readOnly`: undefined
|
|
126
|
+
* - `loading`: undefined
|
|
127
|
+
* - `name`: Form-control name — mirrors native <input name>.
|
|
128
|
+
* - `value`/`initialValue`: INITIAL value (uncontrolled-first, AD-6): the `value` attribute seeds the
|
|
129
|
+
* live state once, then never overrides user input. Mapped from attribute
|
|
130
|
+
* `value` so authors write `<xm-text-field value="…">`.
|
|
131
|
+
* - `checked`/`initialChecked`: INITIAL checked for toggle subclasses; mapped from attribute `checked`.
|
|
132
|
+
* - `files`: Public read contract (AD-6a) — the selected files. (property only) (readonly)
|
|
133
|
+
* - `readonly`: undefined (property only)
|
|
134
|
+
* - `value`: Programmatic reset support — setting `value` after first paint updates live state. (property only)
|
|
135
|
+
* - `checked`: Public read contract for toggle subclasses (AD-6a). (property only)
|
|
136
|
+
*
|
|
137
|
+
* ## Events
|
|
138
|
+
*
|
|
139
|
+
* Events that will be emitted by the component.
|
|
140
|
+
*
|
|
141
|
+
* - `change`: Fired on commit with the new value in `detail`.
|
|
142
|
+
* - `input`: Fired on each edit with the current value in `detail` (inherited by every field).
|
|
143
|
+
*
|
|
144
|
+
* ## Methods
|
|
145
|
+
*
|
|
146
|
+
* Methods that can be called to access component functionality.
|
|
147
|
+
*
|
|
148
|
+
* - `setFormDisabled(disabled: boolean) => void`: Down-propagation hook: xm-form (Story 2.10) sets this; it OR's with the
|
|
149
|
+
* field's own disabled and can never re-enable a self-disabled field.
|
|
150
|
+
*/
|
|
151
|
+
export const XmFileInput: React.ForwardRefExoticComponent<XmFileInputProps>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/file-input/index.js";
|
|
3
|
+
import {
|
|
4
|
+
useEventListener,
|
|
5
|
+
useProperties,
|
|
6
|
+
createForwardedRefHandler,
|
|
7
|
+
} from "./react-utils.js";
|
|
8
|
+
|
|
9
|
+
export const XmFileInput = forwardRef((props, forwardedRef) => {
|
|
10
|
+
const ref = useRef(null);
|
|
11
|
+
const {
|
|
12
|
+
multiple,
|
|
13
|
+
required,
|
|
14
|
+
disabled,
|
|
15
|
+
readOnly,
|
|
16
|
+
loading,
|
|
17
|
+
initialChecked,
|
|
18
|
+
accept,
|
|
19
|
+
label,
|
|
20
|
+
helper,
|
|
21
|
+
error,
|
|
22
|
+
size,
|
|
23
|
+
name,
|
|
24
|
+
initialValue,
|
|
25
|
+
className,
|
|
26
|
+
exportparts,
|
|
27
|
+
htmlFor,
|
|
28
|
+
part,
|
|
29
|
+
tabIndex,
|
|
30
|
+
files,
|
|
31
|
+
...restProps
|
|
32
|
+
} = props;
|
|
33
|
+
|
|
34
|
+
/** Event listeners - run once */
|
|
35
|
+
useEventListener(ref, "change", props.onChange);
|
|
36
|
+
useEventListener(ref, "input", props.onInput);
|
|
37
|
+
|
|
38
|
+
/** Properties - run whenever a property has changed */
|
|
39
|
+
useProperties(ref, "files", files);
|
|
40
|
+
|
|
41
|
+
return React.createElement(
|
|
42
|
+
"xm-file-input",
|
|
43
|
+
{
|
|
44
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
45
|
+
...restProps,
|
|
46
|
+
accept: accept,
|
|
47
|
+
label: label,
|
|
48
|
+
helper: helper,
|
|
49
|
+
error: error,
|
|
50
|
+
size: size,
|
|
51
|
+
name: name,
|
|
52
|
+
value: initialValue ?? props["value"],
|
|
53
|
+
class: className,
|
|
54
|
+
exportparts: exportparts,
|
|
55
|
+
for: htmlFor ?? props["for"],
|
|
56
|
+
part: part,
|
|
57
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
58
|
+
multiple: multiple ? true : undefined,
|
|
59
|
+
required: required ? true : undefined,
|
|
60
|
+
disabled: disabled ? true : undefined,
|
|
61
|
+
readonly: readOnly ? true : undefined,
|
|
62
|
+
loading: loading ? true : undefined,
|
|
63
|
+
checked: initialChecked ? true : undefined,
|
|
64
|
+
style: { ...props.style },
|
|
65
|
+
},
|
|
66
|
+
props.children,
|
|
67
|
+
);
|
|
68
|
+
});
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
XmFileValidationBlock as XmFileValidationBlockElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../lit/components/validation/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
|
+
/** `XmFileValidationBlock` component event */
|
|
16
|
+
export type XmFileValidationBlockElementEvent<E = Event> = TypedEvent<
|
|
17
|
+
XmFileValidationBlockElement,
|
|
18
|
+
E
|
|
19
|
+
>;
|
|
20
|
+
|
|
21
|
+
export type { XmFileValidationBlockElement, CustomEvent };
|
|
22
|
+
|
|
23
|
+
export interface XmFileValidationBlockProps 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
|
+
state?: XmFileValidationBlockElement["state"];
|
|
40
|
+
|
|
41
|
+
/** undefined */
|
|
42
|
+
hint?: XmFileValidationBlockElement["hint"];
|
|
43
|
+
|
|
44
|
+
/** undefined */
|
|
45
|
+
fileCsv?: XmFileValidationBlockElement["fileCsv"];
|
|
46
|
+
|
|
47
|
+
/** undefined */
|
|
48
|
+
errorJson?: XmFileValidationBlockElement["errorJson"];
|
|
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<XmFileValidationBlockElement>;
|
|
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
|
+
/** undefined */
|
|
72
|
+
onName?: (event: XmFileValidationBlockElementEvent) => void;
|
|
73
|
+
|
|
74
|
+
/** Fired when the user requests to pick a file. */
|
|
75
|
+
onFilePick?: (event: XmFileValidationBlockElementEvent) => void;
|
|
76
|
+
|
|
77
|
+
/** Fired when a file is dropped (`detail.file`). */
|
|
78
|
+
onFileDrop?: (event: XmFileValidationBlockElementEvent) => void;
|
|
79
|
+
|
|
80
|
+
/** Fired when the file path is copied (`detail.path`). */
|
|
81
|
+
onCopyPath?: (event: XmFileValidationBlockElementEvent) => void;
|
|
82
|
+
|
|
83
|
+
/** Fired when the validation error is dismissed. */
|
|
84
|
+
onErrorDismiss?: (event: XmFileValidationBlockElementEvent) => 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
|
+
* - `state`: undefined
|
|
95
|
+
* - `hint`: undefined
|
|
96
|
+
* - `file-csv`/`fileCsv`: undefined
|
|
97
|
+
* - `error-json`/`errorJson`: undefined
|
|
98
|
+
* - `file`: undefined (property only)
|
|
99
|
+
* - `error`: undefined (property only)
|
|
100
|
+
*
|
|
101
|
+
* ## Events
|
|
102
|
+
*
|
|
103
|
+
* Events that will be emitted by the component.
|
|
104
|
+
*
|
|
105
|
+
* - `name`: undefined
|
|
106
|
+
* - `file-pick`: Fired when the user requests to pick a file.
|
|
107
|
+
* - `file-drop`: Fired when a file is dropped (`detail.file`).
|
|
108
|
+
* - `copy-path`: Fired when the file path is copied (`detail.path`).
|
|
109
|
+
* - `error-dismiss`: Fired when the validation error is dismissed.
|
|
110
|
+
*/
|
|
111
|
+
export const XmFileValidationBlock: React.ForwardRefExoticComponent<XmFileValidationBlockProps>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/validation/index.js";
|
|
3
|
+
import { useEventListener, createForwardedRefHandler } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const XmFileValidationBlock = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const {
|
|
8
|
+
state,
|
|
9
|
+
hint,
|
|
10
|
+
fileCsv,
|
|
11
|
+
errorJson,
|
|
12
|
+
className,
|
|
13
|
+
exportparts,
|
|
14
|
+
htmlFor,
|
|
15
|
+
part,
|
|
16
|
+
tabIndex,
|
|
17
|
+
...restProps
|
|
18
|
+
} = props;
|
|
19
|
+
|
|
20
|
+
/** Event listeners - run once */
|
|
21
|
+
useEventListener(ref, "name", props.onName);
|
|
22
|
+
useEventListener(ref, "file-pick", props.onFilePick);
|
|
23
|
+
useEventListener(ref, "file-drop", props.onFileDrop);
|
|
24
|
+
useEventListener(ref, "copy-path", props.onCopyPath);
|
|
25
|
+
useEventListener(ref, "error-dismiss", props.onErrorDismiss);
|
|
26
|
+
|
|
27
|
+
return React.createElement(
|
|
28
|
+
"xm-file-validation-block",
|
|
29
|
+
{
|
|
30
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
31
|
+
...restProps,
|
|
32
|
+
state: state,
|
|
33
|
+
hint: hint,
|
|
34
|
+
"file-csv": fileCsv ?? props["file-csv"],
|
|
35
|
+
"error-json": errorJson ?? props["error-json"],
|
|
36
|
+
class: className,
|
|
37
|
+
exportparts: exportparts,
|
|
38
|
+
for: htmlFor ?? props["for"],
|
|
39
|
+
part: part,
|
|
40
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
41
|
+
style: { ...props.style },
|
|
42
|
+
},
|
|
43
|
+
props.children,
|
|
44
|
+
);
|
|
45
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
XmForm as XmFormElement,
|
|
4
|
+
CustomEvent,
|
|
5
|
+
} from "../lit/components/form/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
|
+
/** `XmForm` component event */
|
|
16
|
+
export type XmFormElementEvent<E = Event> = TypedEvent<XmFormElement, E>;
|
|
17
|
+
|
|
18
|
+
export type { XmFormElement, CustomEvent };
|
|
19
|
+
|
|
20
|
+
export interface XmFormProps 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
|
+
disabled?: boolean;
|
|
37
|
+
|
|
38
|
+
/** undefined */
|
|
39
|
+
readOnly?: boolean;
|
|
40
|
+
|
|
41
|
+
/** 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()`. */
|
|
42
|
+
className?: string;
|
|
43
|
+
|
|
44
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
45
|
+
exportparts?: string;
|
|
46
|
+
|
|
47
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
48
|
+
htmlFor?: string;
|
|
49
|
+
|
|
50
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
51
|
+
key?: number | string;
|
|
52
|
+
|
|
53
|
+
/** 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. */
|
|
54
|
+
part?: string;
|
|
55
|
+
|
|
56
|
+
/** 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. */
|
|
57
|
+
ref?: React.Ref<XmFormElement>;
|
|
58
|
+
|
|
59
|
+
/** 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. */
|
|
60
|
+
tabIndex?: number;
|
|
61
|
+
|
|
62
|
+
/** Fired when the form is submitted with its values in `detail`. */
|
|
63
|
+
onSubmit?: (event: XmFormElementEvent) => void;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
*
|
|
69
|
+
* ## Attributes & Properties
|
|
70
|
+
*
|
|
71
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
72
|
+
*
|
|
73
|
+
* - `disabled`: undefined
|
|
74
|
+
* - `readonly`/`readOnly`: undefined
|
|
75
|
+
* - `readonly`: undefined (property only)
|
|
76
|
+
*
|
|
77
|
+
* ## Events
|
|
78
|
+
*
|
|
79
|
+
* Events that will be emitted by the component.
|
|
80
|
+
*
|
|
81
|
+
* - `submit`: Fired when the form is submitted with its values in `detail`.
|
|
82
|
+
*
|
|
83
|
+
* ## Methods
|
|
84
|
+
*
|
|
85
|
+
* Methods that can be called to access component functionality.
|
|
86
|
+
*
|
|
87
|
+
* - `validate() => FormResult`: Public read contract: pull each child's live value at read time (children
|
|
88
|
+
* are uncontrolled — the form does not drive their renders, AD-6).
|
|
89
|
+
* - `submit() => FormResult`: Imperative submit — same path the submit button / Enter take.
|
|
90
|
+
*/
|
|
91
|
+
export const XmForm: React.ForwardRefExoticComponent<XmFormProps>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/form/index.js";
|
|
3
|
+
import { useEventListener, createForwardedRefHandler } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const XmForm = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const {
|
|
8
|
+
disabled,
|
|
9
|
+
readOnly,
|
|
10
|
+
className,
|
|
11
|
+
exportparts,
|
|
12
|
+
htmlFor,
|
|
13
|
+
part,
|
|
14
|
+
tabIndex,
|
|
15
|
+
...restProps
|
|
16
|
+
} = props;
|
|
17
|
+
|
|
18
|
+
/** Event listeners - run once */
|
|
19
|
+
useEventListener(ref, "submit", props.onSubmit);
|
|
20
|
+
|
|
21
|
+
return React.createElement(
|
|
22
|
+
"xm-form",
|
|
23
|
+
{
|
|
24
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
25
|
+
...restProps,
|
|
26
|
+
class: className,
|
|
27
|
+
exportparts: exportparts,
|
|
28
|
+
for: htmlFor ?? props["for"],
|
|
29
|
+
part: part,
|
|
30
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
31
|
+
disabled: disabled ? true : undefined,
|
|
32
|
+
readonly: readOnly ? true : undefined,
|
|
33
|
+
style: { ...props.style },
|
|
34
|
+
},
|
|
35
|
+
props.children,
|
|
36
|
+
);
|
|
37
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XmGrid as XmGridElement } from "../lit/components/grid/index.js";
|
|
3
|
+
|
|
4
|
+
export type { XmGridElement };
|
|
5
|
+
|
|
6
|
+
export interface XmGridProps extends Pick<
|
|
7
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
8
|
+
| "children"
|
|
9
|
+
| "dir"
|
|
10
|
+
| "hidden"
|
|
11
|
+
| "id"
|
|
12
|
+
| "lang"
|
|
13
|
+
| "slot"
|
|
14
|
+
| "style"
|
|
15
|
+
| "title"
|
|
16
|
+
| "translate"
|
|
17
|
+
| "onClick"
|
|
18
|
+
| "onFocus"
|
|
19
|
+
| "onBlur"
|
|
20
|
+
> {
|
|
21
|
+
/** undefined */
|
|
22
|
+
columns?: XmGridElement["columns"];
|
|
23
|
+
|
|
24
|
+
/** undefined */
|
|
25
|
+
gap?: XmGridElement["gap"];
|
|
26
|
+
|
|
27
|
+
/** 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()`. */
|
|
28
|
+
className?: string;
|
|
29
|
+
|
|
30
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
31
|
+
exportparts?: string;
|
|
32
|
+
|
|
33
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
34
|
+
htmlFor?: string;
|
|
35
|
+
|
|
36
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
37
|
+
key?: number | string;
|
|
38
|
+
|
|
39
|
+
/** 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. */
|
|
40
|
+
part?: string;
|
|
41
|
+
|
|
42
|
+
/** 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. */
|
|
43
|
+
ref?: React.Ref<XmGridElement>;
|
|
44
|
+
|
|
45
|
+
/** 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. */
|
|
46
|
+
tabIndex?: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
*
|
|
52
|
+
* ## Attributes & Properties
|
|
53
|
+
*
|
|
54
|
+
* Component attributes and properties that can be applied to the element or by using JavaScript.
|
|
55
|
+
*
|
|
56
|
+
* - `columns`: undefined
|
|
57
|
+
* - `gap`: undefined
|
|
58
|
+
*/
|
|
59
|
+
export const XmGrid: React.ForwardRefExoticComponent<XmGridProps>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/grid/index.js";
|
|
3
|
+
import { createForwardedRefHandler } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const XmGrid = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const {
|
|
8
|
+
columns,
|
|
9
|
+
gap,
|
|
10
|
+
className,
|
|
11
|
+
exportparts,
|
|
12
|
+
htmlFor,
|
|
13
|
+
part,
|
|
14
|
+
tabIndex,
|
|
15
|
+
...restProps
|
|
16
|
+
} = props;
|
|
17
|
+
|
|
18
|
+
return React.createElement(
|
|
19
|
+
"xm-grid",
|
|
20
|
+
{
|
|
21
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
22
|
+
...restProps,
|
|
23
|
+
columns: columns,
|
|
24
|
+
gap: gap,
|
|
25
|
+
class: className,
|
|
26
|
+
exportparts: exportparts,
|
|
27
|
+
for: htmlFor ?? props["for"],
|
|
28
|
+
part: part,
|
|
29
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
30
|
+
style: { ...props.style },
|
|
31
|
+
},
|
|
32
|
+
props.children,
|
|
33
|
+
);
|
|
34
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XmKbd as XmKbdElement } from "../lit/components/kbd/index.js";
|
|
3
|
+
|
|
4
|
+
export type { XmKbdElement };
|
|
5
|
+
|
|
6
|
+
export interface XmKbdProps extends Pick<
|
|
7
|
+
React.AllHTMLAttributes<HTMLElement>,
|
|
8
|
+
| "children"
|
|
9
|
+
| "dir"
|
|
10
|
+
| "hidden"
|
|
11
|
+
| "id"
|
|
12
|
+
| "lang"
|
|
13
|
+
| "slot"
|
|
14
|
+
| "style"
|
|
15
|
+
| "title"
|
|
16
|
+
| "translate"
|
|
17
|
+
| "onClick"
|
|
18
|
+
| "onFocus"
|
|
19
|
+
| "onBlur"
|
|
20
|
+
> {
|
|
21
|
+
/** 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()`. */
|
|
22
|
+
className?: string;
|
|
23
|
+
|
|
24
|
+
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
|
|
25
|
+
exportparts?: string;
|
|
26
|
+
|
|
27
|
+
/** Used for labels to link them with their inputs (using input id). */
|
|
28
|
+
htmlFor?: string;
|
|
29
|
+
|
|
30
|
+
/** Used to help React identify which items have changed, are added, or are removed within a list. */
|
|
31
|
+
key?: number | string;
|
|
32
|
+
|
|
33
|
+
/** 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. */
|
|
34
|
+
part?: string;
|
|
35
|
+
|
|
36
|
+
/** 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. */
|
|
37
|
+
ref?: React.Ref<XmKbdElement>;
|
|
38
|
+
|
|
39
|
+
/** 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. */
|
|
40
|
+
tabIndex?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
*/
|
|
46
|
+
export const XmKbd: React.ForwardRefExoticComponent<XmKbdProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { forwardRef, useRef } from "react";
|
|
2
|
+
import "../lit/components/kbd/index.js";
|
|
3
|
+
import { createForwardedRefHandler } from "./react-utils.js";
|
|
4
|
+
|
|
5
|
+
export const XmKbd = forwardRef((props, forwardedRef) => {
|
|
6
|
+
const ref = useRef(null);
|
|
7
|
+
const { className, exportparts, htmlFor, part, tabIndex, ...restProps } =
|
|
8
|
+
props;
|
|
9
|
+
|
|
10
|
+
return React.createElement(
|
|
11
|
+
"xm-kbd",
|
|
12
|
+
{
|
|
13
|
+
ref: createForwardedRefHandler(ref, forwardedRef),
|
|
14
|
+
...restProps,
|
|
15
|
+
class: className,
|
|
16
|
+
exportparts: exportparts,
|
|
17
|
+
for: htmlFor ?? props["for"],
|
|
18
|
+
part: part,
|
|
19
|
+
tabindex: tabIndex ?? props["tabindex"],
|
|
20
|
+
style: { ...props.style },
|
|
21
|
+
},
|
|
22
|
+
props.children,
|
|
23
|
+
);
|
|
24
|
+
});
|