@stack-spot/citric-react 0.2.0 → 0.3.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/dist/citric.css +9 -3
- package/dist/components/Accordion.d.ts +1 -1
- package/dist/components/Accordion.d.ts.map +1 -1
- package/dist/components/Avatar.d.ts +1 -1
- package/dist/components/Avatar.d.ts.map +1 -1
- package/dist/components/AvatarGroup.d.ts +1 -1
- package/dist/components/AvatarGroup.d.ts.map +1 -1
- package/dist/components/Breadcrumb.d.ts +1 -1
- package/dist/components/Breadcrumb.d.ts.map +1 -1
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.d.ts.map +1 -1
- package/dist/components/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox.d.ts.map +1 -1
- package/dist/components/CheckboxGroup.d.ts +1 -1
- package/dist/components/CheckboxGroup.d.ts.map +1 -1
- package/dist/components/Favorite.d.ts +1 -1
- package/dist/components/Favorite.d.ts.map +1 -1
- package/dist/components/Input.d.ts +1 -1
- package/dist/components/Input.d.ts.map +1 -1
- package/dist/components/MenuOverlay/types.d.ts +1 -1
- package/dist/components/MenuOverlay/types.d.ts.map +1 -1
- package/dist/components/Overlay/types.d.ts +1 -1
- package/dist/components/Overlay/types.d.ts.map +1 -1
- package/dist/components/Pagination.d.ts +1 -1
- package/dist/components/Pagination.d.ts.map +1 -1
- package/dist/components/RadioGroup.d.ts +1 -1
- package/dist/components/RadioGroup.d.ts.map +1 -1
- package/dist/components/Rating.d.ts +1 -1
- package/dist/components/Rating.d.ts.map +1 -1
- package/dist/components/Select/RichSelect.d.ts.map +1 -1
- package/dist/components/Select/RichSelect.js +5 -3
- package/dist/components/Select/RichSelect.js.map +1 -1
- package/dist/components/Select/SimpleSelect.d.ts.map +1 -1
- package/dist/components/Select/SimpleSelect.js +3 -4
- package/dist/components/Select/SimpleSelect.js.map +1 -1
- package/dist/components/Select/types.d.ts +3 -3
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/SelectBox.d.ts +1 -1
- package/dist/components/SelectBox.d.ts.map +1 -1
- package/dist/components/Skeleton.d.ts +1 -1
- package/dist/components/Skeleton.d.ts.map +1 -1
- package/dist/components/Slider.d.ts +1 -1
- package/dist/components/Slider.d.ts.map +1 -1
- package/dist/components/Stepper.d.ts +1 -1
- package/dist/components/Stepper.d.ts.map +1 -1
- package/dist/components/Switch.d.ts +1 -1
- package/dist/components/Switch.d.ts.map +1 -1
- package/dist/components/Tabs/types.d.ts +1 -1
- package/dist/components/Tabs/types.d.ts.map +1 -1
- package/dist/components/Text.d.ts +1 -1
- package/dist/components/Text.d.ts.map +1 -1
- package/dist/components/Textarea.d.ts +1 -1
- package/dist/components/Textarea.d.ts.map +1 -1
- package/dist/components/Tooltip.d.ts +8 -2
- package/dist/components/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip.js +2 -2
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/types.d.ts +32 -32
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/options.d.ts.map +1 -1
- package/dist/utils/options.js +2 -1
- package/dist/utils/options.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Accordion.tsx +1 -1
- package/src/components/Avatar.tsx +1 -1
- package/src/components/AvatarGroup.tsx +1 -1
- package/src/components/Breadcrumb.tsx +1 -1
- package/src/components/Button.tsx +1 -1
- package/src/components/Checkbox.tsx +1 -1
- package/src/components/CheckboxGroup.tsx +1 -1
- package/src/components/Favorite.tsx +1 -1
- package/src/components/Input.tsx +1 -1
- package/src/components/MenuOverlay/types.ts +1 -1
- package/src/components/Overlay/types.ts +1 -1
- package/src/components/Pagination.tsx +1 -1
- package/src/components/RadioGroup.tsx +1 -1
- package/src/components/Rating.tsx +1 -1
- package/src/components/Select/RichSelect.tsx +5 -4
- package/src/components/Select/SimpleSelect.tsx +3 -8
- package/src/components/Select/types.ts +3 -3
- package/src/components/SelectBox.tsx +1 -1
- package/src/components/Skeleton.tsx +1 -1
- package/src/components/Slider.tsx +1 -1
- package/src/components/Stepper.tsx +1 -1
- package/src/components/Switch.tsx +1 -1
- package/src/components/Tabs/types.ts +1 -1
- package/src/components/Textarea.tsx +1 -1
- package/src/components/Tooltip.tsx +9 -3
- package/src/types.ts +31 -32
- package/src/utils/options.ts +3 -1
|
@@ -3,6 +3,6 @@ export interface BaseTextareaProps extends WithColorScheme {
|
|
|
3
3
|
value?: string;
|
|
4
4
|
onChange?: (value: string) => void;
|
|
5
5
|
}
|
|
6
|
-
export type TextareaProps = HTMLExtension<'textarea', BaseTextareaProps
|
|
6
|
+
export type TextareaProps = HTMLExtension<'textarea', BaseTextareaProps>;
|
|
7
7
|
export declare const Textarea: ({ value, onChange, ...props }: TextareaProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
//# sourceMappingURL=Textarea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAGzD,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,UAAU,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/components/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAGzD,MAAM,WAAW,iBAAkB,SAAQ,eAAe;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAA;AAExE,eAAO,MAAM,QAAQ,GAAI,+BAA+B,aAAa,4CACwD,CAAA"}
|
|
@@ -19,7 +19,13 @@ export interface BaseTooltipProps extends Omit<BaseOverlayProps<'div'>, 'tag' |
|
|
|
19
19
|
* @default true
|
|
20
20
|
*/
|
|
21
21
|
compact?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether or not to disable the tooltip, i.e. not show it.
|
|
24
|
+
*
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
22
28
|
}
|
|
23
|
-
export type TooltipProps = HTMLExtension<'div', BaseTooltipProps
|
|
24
|
-
export declare const Tooltip: ({ tooltipId, children, showArrow, compact, attributes, colorScheme, colorPalette, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export type TooltipProps = HTMLExtension<'div', BaseTooltipProps>;
|
|
30
|
+
export declare const Tooltip: ({ tooltipId, children, showArrow, compact, attributes, colorScheme, colorPalette, disabled, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
31
|
//# sourceMappingURL=Tooltip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/components/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,WAAW,gBAAiB,SAChC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,eAAe,GAAG,WAAW,CAAC,EAAE,gBAAgB,EAAE,eAAe;IACvG;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/components/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElD,MAAM,WAAW,gBAAiB,SAChC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,eAAe,GAAG,WAAW,CAAC,EAAE,gBAAgB,EAAE,eAAe;IACvG;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAA;AAEjE,eAAO,MAAM,OAAO,GAClB,wGAAsH,YAAY,4CAqBnI,CAAA"}
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { listToClass } from '@stack-spot/portal-theme';
|
|
3
3
|
import { useRef } from 'react';
|
|
4
4
|
import { Overlay } from './Overlay/index.js';
|
|
5
|
-
export const Tooltip = ({ tooltipId, children, showArrow = true, compact = true, attributes, colorScheme, colorPalette, ...props }) => {
|
|
5
|
+
export const Tooltip = ({ tooltipId, children, showArrow = true, compact = true, attributes, colorScheme, colorPalette, disabled, ...props }) => {
|
|
6
6
|
const id = useRef(tooltipId || `${Math.random()}`);
|
|
7
|
-
return (_jsx(Overlay, { attributes: {
|
|
7
|
+
return disabled ? children : (_jsx(Overlay, { attributes: {
|
|
8
8
|
className: listToClass([attributes?.className, showArrow && 'with-arrow', compact && 'compact']),
|
|
9
9
|
style: { margin: '6px', ...attributes?.style },
|
|
10
10
|
role: 'tooltip',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../src/components/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../src/components/Tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAiCnC,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,GAAG,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAClI,EAAE;IACF,MAAM,EAAE,GAAG,MAAM,CAAC,SAAS,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;IAClD,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC3B,KAAC,OAAO,IACN,UAAU,EAAE;YACV,SAAS,EAAE,WAAW,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,IAAI,YAAY,EAAE,OAAO,IAAI,SAAS,CAAC,CAAC;YAChG,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,KAAK,EAAE;YAC9C,IAAI,EAAE,SAAS;YACf,EAAE,EAAE,EAAE,CAAC,OAAO;YACd,aAAa,EAAE,SAAS;YACxB,mBAAmB,EAAE,WAAW;YAChC,oBAAoB,EAAE,YAAY;YAClC,GAAG,UAAU;SACd,EACD,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC,OAAO,CAAC,KAC9D,KAAK,YAER,QAAQ,GACD,CACX,CAAA;AACH,CAAC,CAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -13,38 +13,38 @@ export type WithDataAttributes = {
|
|
|
13
13
|
[key: `data-${string}`]: string | undefined;
|
|
14
14
|
};
|
|
15
15
|
export type TextAppearance = 'body1' | 'body2' | 'code1' | 'code2' | 'display1' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'microtext1' | 'overheader1' | 'overheader2' | 'subtitle1' | 'subtitle2' | 'subtitle3' | 'subtitle4';
|
|
16
|
-
export
|
|
17
|
-
a: React.
|
|
18
|
-
blockquote: React.
|
|
19
|
-
button: React.
|
|
20
|
-
div: React.
|
|
21
|
-
form: React.
|
|
22
|
-
h1: React.
|
|
23
|
-
h2: React.
|
|
24
|
-
h3: React.
|
|
25
|
-
h4: React.
|
|
26
|
-
h5: React.
|
|
27
|
-
h6: React.
|
|
28
|
-
hr: React.
|
|
29
|
-
i: React.
|
|
30
|
-
image: React.
|
|
31
|
-
input: React.
|
|
32
|
-
label: React.
|
|
33
|
-
li: React.
|
|
34
|
-
nav: React.
|
|
35
|
-
p: React.
|
|
36
|
-
pre: React.
|
|
37
|
-
select: React.
|
|
38
|
-
small: React.
|
|
39
|
-
span: React.
|
|
40
|
-
table: React.
|
|
41
|
-
td: React.
|
|
42
|
-
th: React.
|
|
43
|
-
tr: React.
|
|
44
|
-
textarea: React.
|
|
45
|
-
ul: React.
|
|
46
|
-
}
|
|
47
|
-
export type HTMLExtension<K extends keyof HTMLTag, Props
|
|
16
|
+
export type HTMLTag = {
|
|
17
|
+
a: React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
18
|
+
blockquote: React.BlockquoteHTMLAttributes<HTMLQuoteElement>;
|
|
19
|
+
button: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
20
|
+
div: React.HTMLAttributes<HTMLDivElement>;
|
|
21
|
+
form: React.FormHTMLAttributes<HTMLFormElement>;
|
|
22
|
+
h1: React.HTMLAttributes<HTMLHeadingElement>;
|
|
23
|
+
h2: React.HTMLAttributes<HTMLHeadingElement>;
|
|
24
|
+
h3: React.HTMLAttributes<HTMLHeadingElement>;
|
|
25
|
+
h4: React.HTMLAttributes<HTMLHeadingElement>;
|
|
26
|
+
h5: React.HTMLAttributes<HTMLHeadingElement>;
|
|
27
|
+
h6: React.HTMLAttributes<HTMLHeadingElement>;
|
|
28
|
+
hr: React.HTMLAttributes<HTMLHRElement>;
|
|
29
|
+
i: React.HTMLAttributes<HTMLElement>;
|
|
30
|
+
image: React.ImgHTMLAttributes<HTMLImageElement>;
|
|
31
|
+
input: React.InputHTMLAttributes<HTMLInputElement>;
|
|
32
|
+
label: React.LabelHTMLAttributes<HTMLLabelElement>;
|
|
33
|
+
li: React.LiHTMLAttributes<HTMLLIElement>;
|
|
34
|
+
nav: React.HTMLAttributes<HTMLElement>;
|
|
35
|
+
p: React.HTMLAttributes<HTMLParagraphElement>;
|
|
36
|
+
pre: React.HTMLAttributes<HTMLPreElement>;
|
|
37
|
+
select: React.SelectHTMLAttributes<HTMLSelectElement>;
|
|
38
|
+
small: React.HTMLAttributes<HTMLElement>;
|
|
39
|
+
span: React.HTMLAttributes<HTMLSpanElement>;
|
|
40
|
+
table: React.TableHTMLAttributes<HTMLTableElement>;
|
|
41
|
+
td: React.TdHTMLAttributes<HTMLTableCellElement>;
|
|
42
|
+
th: React.ThHTMLAttributes<HTMLTableCellElement>;
|
|
43
|
+
tr: React.HTMLAttributes<HTMLTableRowElement>;
|
|
44
|
+
textarea: React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
45
|
+
ul: React.HTMLAttributes<HTMLUListElement>;
|
|
46
|
+
};
|
|
47
|
+
export type HTMLExtension<K extends keyof HTMLTag, Props> = Omit<HTMLTag[K], keyof Props> & Props;
|
|
48
48
|
export interface WithStyleShortcuts {
|
|
49
49
|
/**
|
|
50
50
|
* Sets a theme color for the background.
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACtF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAA;AAEhF,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACjC;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,QAAQ,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAAE,CAAC,GAAG,EAAE,QAAQ,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,CAAA;AAEhF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,YAAY,GACtI,aAAa,GAAG,aAAa,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAA;AAGvF,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACtF,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAA;AAEhF,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B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BAAgB,CAAC,CAAC;IACvD;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC/C;;OAEG;IACH,GAAG,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,YAAY,CAAC;IACvE;;;;OAIG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACzF;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IACvF;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,KAAK,CAAC,YAAY,CAAC;IACjD;;;;;;;OAOG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CAChC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/utils/options.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/utils/options.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,GAAG,UAE7C;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,GAAG,sBAE3C"}
|
package/dist/utils/options.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { isNil } from 'lodash';
|
|
1
2
|
export function defaultRenderLabel(option) {
|
|
2
|
-
return `${option}`;
|
|
3
|
+
return isNil(option) ? '' : `${option}`;
|
|
3
4
|
}
|
|
4
5
|
export function defaultRenderKey(option) {
|
|
5
6
|
return ['string', 'number'].includes(typeof option) ? `${option}` : undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/utils/options.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,kBAAkB,CAAC,MAAW;IAC5C,OAAO,GAAG,MAAM,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/utils/options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAE9B,MAAM,UAAU,kBAAkB,CAAC,MAAW;IAC5C,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAA;AACzC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAW;IAC1C,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AAC/E,CAAC"}
|
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@ export interface BaseAccordionProps {
|
|
|
34
34
|
maxHeight?: number,
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
export type AccordionProps = HTMLExtension<'div', BaseAccordionProps
|
|
37
|
+
export type AccordionProps = HTMLExtension<'div', BaseAccordionProps>
|
|
38
38
|
|
|
39
39
|
export const Accordion = (
|
|
40
40
|
{ id, appearance, expanded, onChange, header, maxHeight = 300, className, style, children, ...props }: AccordionProps,
|
|
@@ -21,7 +21,7 @@ export interface BaseAvatarProps extends WithColorPalette {
|
|
|
21
21
|
image?: string,
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export type AvatarProps = HTMLExtension<'div', BaseAvatarProps
|
|
24
|
+
export type AvatarProps = HTMLExtension<'div', BaseAvatarProps>
|
|
25
25
|
|
|
26
26
|
export const Avatar = ({ size, name, appearance, className, image, ...props }: AvatarProps) => {
|
|
27
27
|
const parts = name?.split(' ') ?? ['']
|
|
@@ -22,7 +22,7 @@ export interface BaseAvatarGroupProps extends WithColorPalette {
|
|
|
22
22
|
maxItems?: number,
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export type AvatarGroupProps = HTMLExtension<'div', BaseAvatarGroupProps
|
|
25
|
+
export type AvatarGroupProps = HTMLExtension<'div', BaseAvatarGroupProps>
|
|
26
26
|
|
|
27
27
|
export const AvatarGroup = ({ size, items, appearance, maxItems, className, ...props }: AvatarGroupProps) => {
|
|
28
28
|
const avatars = items.map(({ name, image }) => <Avatar key={name} name={name} image={image} />, [items])
|
|
@@ -11,7 +11,7 @@ export interface BaseBreadcrumbProps {
|
|
|
11
11
|
items: BreadCrumbItem[],
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export type BreadcrumbProps = HTMLExtension<'nav', BaseBreadcrumbProps
|
|
14
|
+
export type BreadcrumbProps = HTMLExtension<'nav', BaseBreadcrumbProps>
|
|
15
15
|
|
|
16
16
|
export const Breadcrumb = ({ items, ...props }: BreadcrumbProps) => {
|
|
17
17
|
const children = useMemo(
|
|
@@ -44,7 +44,7 @@ export interface BaseButtonProps extends WithColorScheme {
|
|
|
44
44
|
analytics?: boolean,
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export type ButtonProps = HTMLExtension<'button', BaseButtonProps
|
|
47
|
+
export type ButtonProps = HTMLExtension<'button', BaseButtonProps>
|
|
48
48
|
|
|
49
49
|
export const Button = (
|
|
50
50
|
{ appearance, size, feedback, loading, disabled, onClick, className, children, type = 'button', analytics, ...props }: ButtonProps,
|
|
@@ -12,7 +12,7 @@ export interface BaseCheckboxProps extends WithColorScheme {
|
|
|
12
12
|
children?: React.ReactNode,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export type CheckboxProps = HTMLExtension<'input', BaseCheckboxProps
|
|
15
|
+
export type CheckboxProps = HTMLExtension<'input', BaseCheckboxProps>
|
|
16
16
|
|
|
17
17
|
export const Checkbox = (
|
|
18
18
|
{ appearance = 'checkbox', value, onChange, colorScheme, children, className, style, ...props }: CheckboxProps,
|
|
@@ -55,7 +55,7 @@ export interface BaseCheckboxGroupProps<T = any> extends WithColorScheme {
|
|
|
55
55
|
isDisabled?: (option: T) => boolean,
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
export type CheckboxGroupProps<T> = HTMLExtension<'div', BaseCheckboxGroupProps<T
|
|
58
|
+
export type CheckboxGroupProps<T> = HTMLExtension<'div', BaseCheckboxGroupProps<T>>
|
|
59
59
|
|
|
60
60
|
export function CheckboxGroup<T>({
|
|
61
61
|
appearance = 'checkbox',
|
|
@@ -22,7 +22,7 @@ export interface BaseFavoriteProps {
|
|
|
22
22
|
isLoading?: boolean,
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export type FavoriteProps = HTMLExtension<'input', BaseFavoriteProps
|
|
25
|
+
export type FavoriteProps = HTMLExtension<'input', BaseFavoriteProps>
|
|
26
26
|
|
|
27
27
|
export const Favorite = ({ value, size, appearance, onChange, isLoading, className, ...props }: FavoriteProps) =>
|
|
28
28
|
<CitricComponent
|
package/src/components/Input.tsx
CHANGED
|
@@ -14,7 +14,7 @@ export interface BaseInputProps<T extends SupportedInputType> extends WithColorS
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export type InputProps<T extends SupportedInputType = 'text'> =
|
|
17
|
-
HTMLExtension<'input', BaseInputProps<T> & { type?: T }
|
|
17
|
+
HTMLExtension<'input', BaseInputProps<T> & { type?: T }>
|
|
18
18
|
|
|
19
19
|
export function Input<T extends SupportedInputType = 'text'>({ type, value, onChange, ...props }: InputProps<T>) {
|
|
20
20
|
function handleChange(e: React.ChangeEvent<HTMLInputElement>) {
|
|
@@ -165,7 +165,7 @@ export interface BaseMenuProps {
|
|
|
165
165
|
menuStyle?: React.CSSProperties,
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
export type MenuProps = HTMLExtension<'div', BaseMenuProps
|
|
168
|
+
export type MenuProps = HTMLExtension<'div', BaseMenuProps>
|
|
169
169
|
|
|
170
170
|
export interface BaseMenuOverlayProps extends
|
|
171
171
|
BaseMenuProps, Omit<BaseOverlayProps<'div'>, 'tag' | 'onRenderChild' | 'content' | 'triggerOn' | 'reference'> {
|
|
@@ -64,7 +64,7 @@ export interface BaseOverlayProps<T extends keyof HTMLTag> extends Omit<OverlayO
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
export type OverlayProps<T extends keyof HTMLTag> =
|
|
67
|
-
HTMLExtension<'div', BaseOverlayProps<T
|
|
67
|
+
HTMLExtension<'div', BaseOverlayProps<T>>
|
|
68
68
|
|
|
69
69
|
export interface OverlayController {
|
|
70
70
|
close: () => Promise<void>,
|
|
@@ -29,7 +29,7 @@ export interface BasePaginationProps {
|
|
|
29
29
|
onChange: (page: number, size: number) => void,
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export type PaginationProps = HTMLExtension<'div', BasePaginationProps
|
|
32
|
+
export type PaginationProps = HTMLExtension<'div', BasePaginationProps>
|
|
33
33
|
|
|
34
34
|
export const Pagination = (
|
|
35
35
|
{ pageSizeOptions = [10, 20, 30], pageSize, totalPages, page, onChange, ...props }: PaginationProps,
|
|
@@ -50,7 +50,7 @@ export interface BaseRadioGroupProps<T> extends WithColorScheme {
|
|
|
50
50
|
isDisabled?: (option: T) => boolean,
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
export type RadioGroupProps<T> = HTMLExtension<'div', BaseRadioGroupProps<T
|
|
53
|
+
export type RadioGroupProps<T> = HTMLExtension<'div', BaseRadioGroupProps<T>>
|
|
54
54
|
|
|
55
55
|
export function RadioGroup<T>({
|
|
56
56
|
name,
|
|
@@ -12,7 +12,7 @@ export interface BaseRatingProps {
|
|
|
12
12
|
name?: string,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export type RatingProps = HTMLExtension<'div', BaseRatingProps
|
|
15
|
+
export type RatingProps = HTMLExtension<'div', BaseRatingProps>
|
|
16
16
|
|
|
17
17
|
export const Rating = ({ value, onChange, name, ...props }: RatingProps) => (
|
|
18
18
|
<CitricComponent tag="div" component="rating" {...props}>
|
|
@@ -41,7 +41,7 @@ export function RichSelect<T>({
|
|
|
41
41
|
}, [])
|
|
42
42
|
|
|
43
43
|
const renderedOptions = useMemo(() => {
|
|
44
|
-
const items = required ? [] : [<li key="" className="empty" onClick={change(undefined)}>{t.empty}</li>]
|
|
44
|
+
const items = required ? [] : [<li key="" className="empty" onClick={change(undefined)}>{renderLabel(undefined) || t.empty}</li>]
|
|
45
45
|
options.forEach((o) => {
|
|
46
46
|
const key = renderKey(o)
|
|
47
47
|
const label = renderLabel(o)
|
|
@@ -112,8 +112,9 @@ export function RichSelect<T>({
|
|
|
112
112
|
setTimeout(() => getCurrent()?.click(), 0)
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
|
|
116
|
-
|
|
115
|
+
// below, we wait 20ms so the same click that opened the select doesn't close it. Removing it will cause problems with selects under
|
|
116
|
+
// labels.
|
|
117
|
+
setTimeout(() => document.addEventListener('click', listenToMouse), 20)
|
|
117
118
|
document.addEventListener('keydown', listenToKeyboard)
|
|
118
119
|
return () => {
|
|
119
120
|
document.removeEventListener('click', listenToMouse)
|
|
@@ -188,7 +189,7 @@ export function RichSelect<T>({
|
|
|
188
189
|
}}
|
|
189
190
|
aria-hidden
|
|
190
191
|
>
|
|
191
|
-
{renderHeader?.(value) ??
|
|
192
|
+
{renderHeader?.(value) ?? renderOption?.(value) ?? renderLabel(value)}
|
|
192
193
|
{loading && <ProgressCircular size="xs" className="loader" />}
|
|
193
194
|
</header>
|
|
194
195
|
<div className="selection-panel" aria-hidden>
|
|
@@ -26,7 +26,7 @@ export function SimpleSelect<T>({
|
|
|
26
26
|
|
|
27
27
|
const renderedOptions = useMemo(() => {
|
|
28
28
|
const valueKey = value ? renderKey(value) : undefined
|
|
29
|
-
const items = (!value || !required) ? [<option key=""
|
|
29
|
+
const items = (!value || !required) ? [<option key="">{renderLabel(undefined)}</option>] : []
|
|
30
30
|
options.forEach((o) => {
|
|
31
31
|
const key = renderKey(o)
|
|
32
32
|
items.push(
|
|
@@ -38,11 +38,6 @@ export function SimpleSelect<T>({
|
|
|
38
38
|
return items
|
|
39
39
|
}, [options, value, required])
|
|
40
40
|
|
|
41
|
-
const children = <>
|
|
42
|
-
{required ? undefined : <option></option>}
|
|
43
|
-
{renderedOptions}
|
|
44
|
-
</>
|
|
45
|
-
|
|
46
41
|
return wrap === false ? (
|
|
47
42
|
<CitricComponent
|
|
48
43
|
required={required}
|
|
@@ -53,12 +48,12 @@ export function SimpleSelect<T>({
|
|
|
53
48
|
onFocus={onFocus}
|
|
54
49
|
onBlur={onBlur}
|
|
55
50
|
>
|
|
56
|
-
{
|
|
51
|
+
{renderedOptions}
|
|
57
52
|
</CitricComponent>
|
|
58
53
|
) : (
|
|
59
54
|
<CitricComponent tag="div" component="select" aria-busy={loading} {...props}>
|
|
60
55
|
<select required={required} onChange={handleChange} disabled={disabled || loading} onFocus={onFocus} onBlur={onBlur}>
|
|
61
|
-
{
|
|
56
|
+
{renderedOptions}
|
|
62
57
|
</select>
|
|
63
58
|
{loading && <ProgressCircular className="loader" size="xs" />}
|
|
64
59
|
</CitricComponent>
|
|
@@ -23,7 +23,7 @@ interface CommonSelectProps<T> extends WithColorScheme {
|
|
|
23
23
|
* @param option the item to render.
|
|
24
24
|
* @returns a React Node to render.
|
|
25
25
|
*/
|
|
26
|
-
renderLabel?: (value: T) => string,
|
|
26
|
+
renderLabel?: (value: T | undefined) => string,
|
|
27
27
|
/**
|
|
28
28
|
* A function to render the item value, a unique identifier for the option.
|
|
29
29
|
* @example
|
|
@@ -94,7 +94,7 @@ export interface RichSelectProps<T> extends CommonSelectProps<T> {
|
|
|
94
94
|
* @param value the option.
|
|
95
95
|
* @returns the React Node.
|
|
96
96
|
*/
|
|
97
|
-
renderOption?: (value: T) => React.ReactNode,
|
|
97
|
+
renderOption?: (value: T | undefined) => React.ReactNode,
|
|
98
98
|
/**
|
|
99
99
|
* A function to render the selected option in the header.
|
|
100
100
|
*
|
|
@@ -118,4 +118,4 @@ export interface RichSelectProps<T> extends CommonSelectProps<T> {
|
|
|
118
118
|
|
|
119
119
|
export type BaseSelectProps<T> = SimpleSelectProps<T> | RichSelectProps<T>
|
|
120
120
|
|
|
121
|
-
export type SelectProps<T> = HTMLExtension<'div', BaseSelectProps<T
|
|
121
|
+
export type SelectProps<T> = HTMLExtension<'div', BaseSelectProps<T>>
|
|
@@ -70,7 +70,7 @@ interface RadioProps<T> extends CommonSelectBoxProps<T> {
|
|
|
70
70
|
|
|
71
71
|
export type BaseSelectBoxProps<T> = RadioProps<T> | CheckboxProps<T>
|
|
72
72
|
|
|
73
|
-
export type SelectBoxProps<T> = HTMLExtension<'div', BaseSelectBoxProps<T
|
|
73
|
+
export type SelectBoxProps<T> = HTMLExtension<'div', BaseSelectBoxProps<T>>
|
|
74
74
|
|
|
75
75
|
export function SelectBox<T>({
|
|
76
76
|
multiple,
|
|
@@ -29,7 +29,7 @@ export interface BaseSkeletonProps {
|
|
|
29
29
|
bgLevel?: 400 | 500 | 600,
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
export type SkeletonProps = HTMLExtension<'div', BaseSkeletonProps
|
|
32
|
+
export type SkeletonProps = HTMLExtension<'div', BaseSkeletonProps>
|
|
33
33
|
|
|
34
34
|
export const Skeleton = ({ appearance, className, style, width, height, bgLevel, ...props }: SkeletonProps) =>
|
|
35
35
|
<CitricComponent
|
|
@@ -32,7 +32,7 @@ export interface BaseSliderProps extends WithColorScheme, WithColorPalette {
|
|
|
32
32
|
renderValue?: (value: number) => string,
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export type SliderProps = HTMLExtension<'input', BaseSliderProps
|
|
35
|
+
export type SliderProps = HTMLExtension<'input', BaseSliderProps>
|
|
36
36
|
|
|
37
37
|
export const Slider = (
|
|
38
38
|
{ value, onChange, min, max, style, showValue, renderValue, colorPalette, colorScheme, className, ...props }: SliderProps,
|
|
@@ -57,7 +57,7 @@ export interface BaseStepperProps<Key extends string> extends BaseTabsProps<Key>
|
|
|
57
57
|
},
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
export type StepperProps<Key extends string> = HTMLExtension<'div', BaseStepperProps<Key
|
|
60
|
+
export type StepperProps<Key extends string> = HTMLExtension<'div', BaseStepperProps<Key>>
|
|
61
61
|
|
|
62
62
|
function getTabsWithDisabled<Key extends string>(tabs: Tab<Key>[], value: Key | undefined) {
|
|
63
63
|
let index = findSelectedIndex(tabs, value ?? '')
|
|
@@ -7,7 +7,7 @@ interface Props extends WithColorScheme {
|
|
|
7
7
|
children?: React.ReactNode,
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export type SwitchProps = HTMLExtension<'input', Props
|
|
10
|
+
export type SwitchProps = HTMLExtension<'input', Props>
|
|
11
11
|
|
|
12
12
|
export const Switch = ({ value, onChange, children, className, style, ...props }: SwitchProps) => {
|
|
13
13
|
const handleChange = onChange ? () => onChange(!value) : undefined
|
|
@@ -45,4 +45,4 @@ export interface BaseTabsProps<Key extends string> extends WithColorScheme, With
|
|
|
45
45
|
controller?: TabController<Key>,
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export type TabsProps<Key extends string> = HTMLExtension<'div', BaseTabsProps<Key
|
|
48
|
+
export type TabsProps<Key extends string> = HTMLExtension<'div', BaseTabsProps<Key>>
|
|
@@ -6,7 +6,7 @@ export interface BaseTextareaProps extends WithColorScheme {
|
|
|
6
6
|
onChange?: (value: string) => void,
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export type TextareaProps = HTMLExtension<'textarea', BaseTextareaProps
|
|
9
|
+
export type TextareaProps = HTMLExtension<'textarea', BaseTextareaProps>
|
|
10
10
|
|
|
11
11
|
export const Textarea = ({ value, onChange, ...props }: TextareaProps) =>
|
|
12
12
|
<CitricComponent tag="textarea" component="textarea" value={value} onChange={e => onChange?.(e.target.value)} {...props} />
|
|
@@ -24,15 +24,21 @@ export interface BaseTooltipProps extends
|
|
|
24
24
|
* @default true
|
|
25
25
|
*/
|
|
26
26
|
compact?: boolean,
|
|
27
|
+
/**
|
|
28
|
+
* Whether or not to disable the tooltip, i.e. not show it.
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
disabled?: boolean,
|
|
27
33
|
}
|
|
28
34
|
|
|
29
|
-
export type TooltipProps = HTMLExtension<'div', BaseTooltipProps
|
|
35
|
+
export type TooltipProps = HTMLExtension<'div', BaseTooltipProps>
|
|
30
36
|
|
|
31
37
|
export const Tooltip = (
|
|
32
|
-
{ tooltipId, children, showArrow = true, compact = true, attributes, colorScheme, colorPalette, ...props }: TooltipProps,
|
|
38
|
+
{ tooltipId, children, showArrow = true, compact = true, attributes, colorScheme, colorPalette, disabled, ...props }: TooltipProps,
|
|
33
39
|
) => {
|
|
34
40
|
const id = useRef(tooltipId || `${Math.random()}`)
|
|
35
|
-
return (
|
|
41
|
+
return disabled ? children : (
|
|
36
42
|
<Overlay
|
|
37
43
|
attributes={{
|
|
38
44
|
className: listToClass([attributes?.className, showArrow && 'with-arrow', compact && 'compact']),
|
package/src/types.ts
CHANGED
|
@@ -19,40 +19,39 @@ export type TextAppearance = 'body1' | 'body2' | 'code1' | 'code2' | 'display1'
|
|
|
19
19
|
'overheader1' | 'overheader2' | 'subtitle1' | 'subtitle2' | 'subtitle3' | 'subtitle4'
|
|
20
20
|
|
|
21
21
|
// increase this list as needed. Generic uses of `JSX.IntrinsicElements` may lead to expensive operations.
|
|
22
|
-
export
|
|
23
|
-
a: React.
|
|
24
|
-
blockquote: React.
|
|
25
|
-
button: React.
|
|
26
|
-
div: React.
|
|
27
|
-
form: React.
|
|
28
|
-
h1: React.
|
|
29
|
-
h2: React.
|
|
30
|
-
h3: React.
|
|
31
|
-
h4: React.
|
|
32
|
-
h5: React.
|
|
33
|
-
h6: React.
|
|
34
|
-
hr: React.
|
|
35
|
-
i: React.
|
|
36
|
-
image: React.
|
|
37
|
-
input: React.
|
|
38
|
-
label: React.
|
|
39
|
-
li: React.
|
|
40
|
-
nav: React.
|
|
41
|
-
p: React.
|
|
42
|
-
pre: React.
|
|
43
|
-
select: React.
|
|
44
|
-
small: React.
|
|
45
|
-
span: React.
|
|
46
|
-
table: React.
|
|
47
|
-
td: React.
|
|
48
|
-
th: React.
|
|
49
|
-
tr: React.
|
|
50
|
-
textarea: React.
|
|
51
|
-
ul: React.
|
|
22
|
+
export type HTMLTag = {
|
|
23
|
+
a: React.AnchorHTMLAttributes<HTMLAnchorElement>,
|
|
24
|
+
blockquote: React.BlockquoteHTMLAttributes<HTMLQuoteElement>,
|
|
25
|
+
button: React.ButtonHTMLAttributes<HTMLButtonElement>,
|
|
26
|
+
div: React.HTMLAttributes<HTMLDivElement>,
|
|
27
|
+
form: React.FormHTMLAttributes<HTMLFormElement>,
|
|
28
|
+
h1: React.HTMLAttributes<HTMLHeadingElement>,
|
|
29
|
+
h2: React.HTMLAttributes<HTMLHeadingElement>,
|
|
30
|
+
h3: React.HTMLAttributes<HTMLHeadingElement>,
|
|
31
|
+
h4: React.HTMLAttributes<HTMLHeadingElement>,
|
|
32
|
+
h5: React.HTMLAttributes<HTMLHeadingElement>,
|
|
33
|
+
h6: React.HTMLAttributes<HTMLHeadingElement>,
|
|
34
|
+
hr: React.HTMLAttributes<HTMLHRElement>,
|
|
35
|
+
i: React.HTMLAttributes<HTMLElement>,
|
|
36
|
+
image: React.ImgHTMLAttributes<HTMLImageElement>,
|
|
37
|
+
input: React.InputHTMLAttributes<HTMLInputElement>,
|
|
38
|
+
label: React.LabelHTMLAttributes<HTMLLabelElement>,
|
|
39
|
+
li: React.LiHTMLAttributes<HTMLLIElement>,
|
|
40
|
+
nav: React.HTMLAttributes<HTMLElement>,
|
|
41
|
+
p: React.HTMLAttributes<HTMLParagraphElement>,
|
|
42
|
+
pre: React.HTMLAttributes<HTMLPreElement>,
|
|
43
|
+
select: React.SelectHTMLAttributes<HTMLSelectElement>,
|
|
44
|
+
small: React.HTMLAttributes<HTMLElement>,
|
|
45
|
+
span: React.HTMLAttributes<HTMLSpanElement>,
|
|
46
|
+
table: React.TableHTMLAttributes<HTMLTableElement>,
|
|
47
|
+
td: React.TdHTMLAttributes<HTMLTableCellElement>,
|
|
48
|
+
th: React.ThHTMLAttributes<HTMLTableCellElement>,
|
|
49
|
+
tr: React.HTMLAttributes<HTMLTableRowElement>,
|
|
50
|
+
textarea: React.TextareaHTMLAttributes<HTMLTextAreaElement>,
|
|
51
|
+
ul: React.HTMLAttributes<HTMLUListElement>,
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export type HTMLExtension<K extends keyof HTMLTag, Props
|
|
55
|
-
(Omitted extends '' ? HTMLTag[K] : Omit<HTMLTag[K], Omitted>) & Props
|
|
54
|
+
export type HTMLExtension<K extends keyof HTMLTag, Props> = Omit<HTMLTag[K], keyof Props> & Props
|
|
56
55
|
|
|
57
56
|
export interface WithStyleShortcuts {
|
|
58
57
|
/**
|