@lumx/react 3.0.5 → 3.0.6-alpha.0
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/_internal/types.d.ts +18 -2
- package/index.d.ts +48 -15
- package/index.js +562 -492
- package/index.js.map +1 -1
- package/package.json +4 -4
- package/src/components/autocomplete/Autocomplete.tsx +7 -4
- package/src/components/badge/Badge.tsx +2 -2
- package/src/components/button/Button.stories.tsx +27 -1
- package/src/components/button/Button.tsx +3 -3
- package/src/components/button/ButtonRoot.tsx +2 -2
- package/src/components/chip/Chip.tsx +2 -2
- package/src/components/dropdown/Dropdown.tsx +5 -2
- package/src/components/icon/Icon.tsx +2 -2
- package/src/components/index.ts +0 -1
- package/src/components/link/Link.tsx +2 -2
- package/src/components/popover/Popover.stories.tsx +70 -0
- package/src/components/popover/Popover.tsx +34 -9
- package/src/components/popover-dialog/PopoverDialog.stories.tsx +75 -0
- package/src/components/popover-dialog/PopoverDialog.test.tsx +65 -0
- package/src/components/popover-dialog/PopoverDialog.tsx +65 -0
- package/src/components/popover-dialog/index.tsx +1 -0
- package/src/index.ts +1 -0
- package/src/stories/generated/PopoverDialog/Demos.stories.tsx +6 -0
- package/src/utils/type.ts +20 -0
package/src/utils/type.ts
CHANGED
|
@@ -91,3 +91,23 @@ export const isComponentType = (type: ReactElement['type']) => (node: ReactNode)
|
|
|
91
91
|
* (excluding `NaN` as it can't be distinguished from `number`)
|
|
92
92
|
*/
|
|
93
93
|
export type Falsy = false | undefined | null | 0 | '';
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Require either `aria-label` or `arial-labelledby` prop.
|
|
97
|
+
* If none are set, the order will prioritize `aria-labelledby` over `aria-label` as it
|
|
98
|
+
* needs a visible element.
|
|
99
|
+
*/
|
|
100
|
+
export type HasAriaLabelOrLabelledBy<T = string | undefined> = T extends string
|
|
101
|
+
? {
|
|
102
|
+
/**
|
|
103
|
+
* The id of the element to use as title of the dialog. Can be within or out of the dialog.
|
|
104
|
+
* Although it is not recommended, aria-label can be used instead if no visible element is available.
|
|
105
|
+
*/
|
|
106
|
+
'aria-labelledby': T;
|
|
107
|
+
/** The label of the dialog. */
|
|
108
|
+
'aria-label'?: undefined;
|
|
109
|
+
}
|
|
110
|
+
: {
|
|
111
|
+
'aria-label': string;
|
|
112
|
+
'aria-labelledby'?: undefined;
|
|
113
|
+
};
|