@devopness/ui-react 2.145.1 → 2.147.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/README.md +9 -3
- package/dist/colors/getColor.d.ts +21 -2
- package/dist/colors/index.d.ts +0 -1
- package/dist/colors/types.d.ts +19 -1
- package/dist/components/Buttons/Button/Button.d.ts +2 -2
- package/dist/components/Primitives/Dropdown/Dropdown.d.ts +165 -0
- package/dist/components/Primitives/Dropdown/Dropdown.styled.d.ts +17 -0
- package/dist/components/Primitives/Dropdown/index.d.ts +1 -0
- package/dist/components/Primitives/Icon/Icon.d.ts +44 -0
- package/dist/components/Primitives/Icon/index.d.ts +1 -0
- package/dist/components/Primitives/Link/Link.d.ts +51 -0
- package/dist/components/Primitives/Link/Link.styled.d.ts +6 -0
- package/dist/components/Primitives/Link/index.d.ts +1 -0
- package/dist/components/Primitives/Tooltip/Tooltip.d.ts +4 -2
- package/dist/components/Primitives/index.d.ts +4 -0
- package/dist/components/helpers.d.ts +10 -0
- package/dist/components/types.d.ts +27 -0
- package/dist/ui-react.cjs +459 -0
- package/dist/ui-react.js +7793 -5476
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
The official Devopness UI components for React
|
|
4
4
|
|
|
5
|
-
<!-- TODO: enable this section once package is available in npm registry
|
|
6
|
-
|
|
7
5
|
## Usage
|
|
8
6
|
|
|
9
7
|
### Install/Upgrade
|
|
@@ -18,7 +16,15 @@ npm install @devopness/ui-react
|
|
|
18
16
|
yarn add @devopness/ui-react
|
|
19
17
|
```
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
## ✍️ <a id="contributing"></a>Contributing
|
|
20
|
+
|
|
21
|
+
Improvements and contributions are highly encouraged! 🙏👊
|
|
22
|
+
|
|
23
|
+
See the [contributing guide](../../../CONTRIBUTING.md) for details on how to participate.
|
|
24
|
+
|
|
25
|
+
All communication and contributions to Devopness projects are subject to the [Devopness Code of Conduct](../../../CODE_OF_CONDUCT.md).
|
|
26
|
+
|
|
27
|
+
Not yet ready to contribute but do like the project? Support Devopness with a ⭐!
|
|
22
28
|
|
|
23
29
|
## Dependencies
|
|
24
30
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Flatten } from './types';
|
|
1
|
+
import { Flatten, OpacityFromFloatToHex } from './types';
|
|
2
2
|
declare const colors: {
|
|
3
3
|
readonly amber: {
|
|
4
4
|
readonly 800: "#a39015";
|
|
@@ -123,5 +123,24 @@ type Color = keyof ColorToHexMapper;
|
|
|
123
123
|
* @param name Color name on format <color>.<shade>
|
|
124
124
|
*/
|
|
125
125
|
declare const getColor: <TColor extends Color>(name: TColor) => ColorToHexMapper[TColor];
|
|
126
|
+
/**
|
|
127
|
+
* Adds opacity suffix to colors
|
|
128
|
+
*
|
|
129
|
+
* @param color string in hexadecimal format #rrggbb
|
|
130
|
+
*
|
|
131
|
+
* @param opacity number in range 0.0 to 1.0
|
|
132
|
+
*
|
|
133
|
+
* This methods transform opacity from number to a hexadecimal (16) color alpha component, meaning
|
|
134
|
+
* a number between 0 and ff (255) in base 16
|
|
135
|
+
*
|
|
136
|
+
* @returns color with added opacity information #rrggbbaa
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
*
|
|
140
|
+
* > getOpacity(#fff1e0, 0.5) // => #fff1e07f, 7f == 0.5
|
|
141
|
+
*
|
|
142
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color#a}
|
|
143
|
+
*/
|
|
144
|
+
declare const getOpacity: <HexColor extends ColorToHexMapper[Color], Opacity extends number>(color: HexColor, opacity: Opacity) => Exclude<HexColor, `#${string}`> | `${Extract<HexColor, `#${string}`>}${Opacity extends keyof OpacityFromFloatToHex ? OpacityFromFloatToHex[Opacity] : "00" | "19" | "33" | "4c" | "66" | "7f" | "99" | "b2" | "cc" | "e5" | "ff" | "01" | "02" | "03" | "04" | "05" | "06" | "07" | "08" | "09" | "0a" | "0b" | "0c" | "0d" | "0e" | "0f" | "10" | "11" | "12" | "13" | "14" | "15" | "16" | "17" | "18" | "1a" | "1b" | "1c" | "1d" | "1e" | "1f" | "20" | "21" | "22" | "23" | "24" | "25" | "26" | "27" | "28" | "29" | "2a" | "2b" | "2c" | "2d" | "2e" | "2f" | "30" | "31" | "32" | "34" | "35" | "36" | "37" | "38" | "39" | "3a" | "3b" | "3c" | "3d" | "3e" | "3f" | "40" | "41" | "42" | "43" | "44" | "45" | "46" | "47" | "48" | "49" | "4a" | "4b" | "4d" | "4e" | "4f" | "50" | "51" | "52" | "53" | "54" | "55" | "56" | "57" | "58" | "59" | "5a" | "5b" | "5c" | "5d" | "5e" | "5f" | "60" | "61" | "62" | "63" | "64" | "65" | "67" | "68" | "69" | "6a" | "6b" | "6c" | "6d" | "6e" | "6f" | "70" | "71" | "72" | "73" | "74" | "75" | "76" | "77" | "78" | "79" | "7a" | "7b" | "7c" | "7d" | "7e" | "80" | "81" | "82" | "83" | "84" | "85" | "86" | "87" | "88" | "89" | "8a" | "8b" | "8c" | "8d" | "8e" | "8f" | "90" | "91" | "92" | "93" | "94" | "95" | "96" | "97" | "98" | "9a" | "9b" | "9c" | "9d" | "9e" | "9f" | "a0" | "a1" | "a2" | "a3" | "a4" | "a5" | "a6" | "a7" | "a8" | "a9" | "aa" | "ab" | "ac" | "ad" | "ae" | "af" | "b0" | "b1" | "b3" | "b4" | "b5" | "b6" | "b7" | "b8" | "b9" | "ba" | "bb" | "bc" | "bd" | "be" | "bf" | "c0" | "c1" | "c2" | "c3" | "c4" | "c5" | "c6" | "c7" | "c8" | "c9" | "ca" | "cb" | "cd" | "ce" | "cf" | "d0" | "d1" | "d2" | "d3" | "d4" | "d5" | "d6" | "d7" | "d8" | "d9" | "da" | "db" | "dc" | "dd" | "de" | "df" | "e0" | "e1" | "e2" | "e3" | "e4" | "e6" | "e7" | "e8" | "e9" | "ea" | "eb" | "ec" | "ed" | "ee" | "ef" | "f0" | "f1" | "f2" | "f3" | "f4" | "f5" | "f6" | "f7" | "f8" | "f9" | "fa" | "fb" | "fc" | "fd" | "fe"}`;
|
|
126
145
|
export type { Color };
|
|
127
|
-
export { getColor };
|
|
146
|
+
export { getColor, getOpacity };
|
package/dist/colors/index.d.ts
CHANGED
package/dist/colors/types.d.ts
CHANGED
|
@@ -20,4 +20,22 @@ type Flatten<T extends object> = object extends T ? object : {
|
|
|
20
20
|
} extends Record<keyof T, (y: infer O) => void> ? O extends infer _ ? {
|
|
21
21
|
[K in keyof O]: O[K];
|
|
22
22
|
} : never : never;
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Maps opacity values in range [begin=0,end=1,step=0.1] to Hexadecimal
|
|
25
|
+
*/
|
|
26
|
+
type OpacityFromFloatToHex = {
|
|
27
|
+
0: '00';
|
|
28
|
+
0.1: '19';
|
|
29
|
+
0.2: '33';
|
|
30
|
+
0.3: '4c';
|
|
31
|
+
0.4: '66';
|
|
32
|
+
0.5: '7f';
|
|
33
|
+
0.6: '99';
|
|
34
|
+
0.7: 'b2';
|
|
35
|
+
0.8: 'cc';
|
|
36
|
+
0.9: 'e5';
|
|
37
|
+
1: 'ff';
|
|
38
|
+
};
|
|
39
|
+
/** Represents a digit of a Hexadecimal value, base 16 */
|
|
40
|
+
type HexDigit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 'a' | 'b' | 'c' | 'd' | 'e' | 'f';
|
|
41
|
+
export type { Flatten, OpacityFromFloatToHex, HexDigit };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
-
import { getColor } from '
|
|
3
|
-
import { Icon } from '
|
|
2
|
+
import { getColor } from '../../../colors';
|
|
3
|
+
import { Icon } from '../../../icons';
|
|
4
4
|
type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
5
5
|
/**
|
|
6
6
|
* By default the button component is 34px high, the "typeSize" property contains
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PopoverOrigin } from '@mui/material/Popover';
|
|
3
|
+
import { InjectedProps as PopupStateProps } from 'material-ui-popup-state';
|
|
4
|
+
import { Color } from '../../../colors';
|
|
5
|
+
import { ButtonProps } from '../../Buttons';
|
|
6
|
+
import { IconProps } from '../Icon';
|
|
7
|
+
import { TooltipProps } from '../Tooltip';
|
|
8
|
+
import { Unwrap } from '../../types';
|
|
9
|
+
type DropdownOptionIcon = Unwrap<Partial<Pick<IconProps, 'name' | 'size'>> & Pick<React.CSSProperties, 'backgroundColor' | 'color'>> & {
|
|
10
|
+
icon: true;
|
|
11
|
+
};
|
|
12
|
+
type DropdownOptionLetter = Unwrap<Pick<React.CSSProperties, 'backgroundColor' | 'color'>> & {
|
|
13
|
+
icon?: never;
|
|
14
|
+
};
|
|
15
|
+
type DropdownOption = {
|
|
16
|
+
/**
|
|
17
|
+
* Add separator from previous options
|
|
18
|
+
*/
|
|
19
|
+
brokenSequence?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Option Badge configuration
|
|
22
|
+
*
|
|
23
|
+
* An option badge can be an icon or the label's first letter
|
|
24
|
+
*/
|
|
25
|
+
badge?: DropdownOptionIcon | DropdownOptionLetter;
|
|
26
|
+
/**
|
|
27
|
+
* Option description
|
|
28
|
+
*/
|
|
29
|
+
label?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Highlight option
|
|
32
|
+
*/
|
|
33
|
+
isActive?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Background Color to use when option is active
|
|
36
|
+
*/
|
|
37
|
+
activeBackgroundColor?: Color;
|
|
38
|
+
/**
|
|
39
|
+
* Event handler called when this option is clicked.
|
|
40
|
+
*/
|
|
41
|
+
onClick?: () => null;
|
|
42
|
+
/**
|
|
43
|
+
* Transforms label to a Link and point user to this url
|
|
44
|
+
*
|
|
45
|
+
* @see {Link}
|
|
46
|
+
*/
|
|
47
|
+
url?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Disables option
|
|
50
|
+
*/
|
|
51
|
+
isDisabled?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Tooltip's title
|
|
54
|
+
*
|
|
55
|
+
* @see {Tooltip}
|
|
56
|
+
*/
|
|
57
|
+
tooltip?: TooltipProps['title'];
|
|
58
|
+
/**
|
|
59
|
+
* Label text color
|
|
60
|
+
*
|
|
61
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/color}
|
|
62
|
+
*/
|
|
63
|
+
color?: Color;
|
|
64
|
+
};
|
|
65
|
+
type DropdownSharedProps = {
|
|
66
|
+
/**
|
|
67
|
+
* This is the point on the anchor where the popover's
|
|
68
|
+
* `anchorEl` will attach to. This is not used when the
|
|
69
|
+
* anchorReference is 'anchorPosition'.
|
|
70
|
+
*
|
|
71
|
+
* Options:
|
|
72
|
+
* vertical: [top, center, bottom];
|
|
73
|
+
* horizontal: [left, center, right].
|
|
74
|
+
*
|
|
75
|
+
* help: https://mui.com/material-ui/react-popover/#anchor-playground
|
|
76
|
+
*/
|
|
77
|
+
anchorOrigin?: PopoverOrigin;
|
|
78
|
+
/**
|
|
79
|
+
* This is the point on the popover which
|
|
80
|
+
* will attach to the anchor's origin.
|
|
81
|
+
*
|
|
82
|
+
* Options:
|
|
83
|
+
* vertical: [top, center, bottom, x(px)];
|
|
84
|
+
* horizontal: [left, center, right, x(px)].
|
|
85
|
+
*
|
|
86
|
+
* help: https://mui.com/material-ui/react-popover/#anchor-playground
|
|
87
|
+
*/
|
|
88
|
+
transformOrigin?: PopoverOrigin;
|
|
89
|
+
/**
|
|
90
|
+
* The unique id to identify the dropdown anchor element.
|
|
91
|
+
*/
|
|
92
|
+
id: string;
|
|
93
|
+
/**
|
|
94
|
+
* Options listed in the Dropdown menu popup.
|
|
95
|
+
*
|
|
96
|
+
* @see {DropdownOption}
|
|
97
|
+
*/
|
|
98
|
+
options: DropdownOption[] | undefined;
|
|
99
|
+
/**
|
|
100
|
+
* Event handler called when the dropdown is opened or closed.
|
|
101
|
+
*/
|
|
102
|
+
onToggle?: (popupState: PopupStateProps) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Event handler called when a dropdown option is selected.
|
|
105
|
+
*
|
|
106
|
+
* This prop can be overriden using option.onClick
|
|
107
|
+
*
|
|
108
|
+
* @see {DropdownOption}
|
|
109
|
+
*/
|
|
110
|
+
onSelect?: (itemClicked: DropdownOption) => void;
|
|
111
|
+
/**
|
|
112
|
+
* Tooltip's title
|
|
113
|
+
*
|
|
114
|
+
* @see {Tooltip}
|
|
115
|
+
*/
|
|
116
|
+
tooltip?: TooltipProps['title'];
|
|
117
|
+
};
|
|
118
|
+
type DropdownVariationButtonProps = DropdownSharedProps & {
|
|
119
|
+
/**
|
|
120
|
+
* Anchors dropdown to Button
|
|
121
|
+
*
|
|
122
|
+
* @see {Button}
|
|
123
|
+
*/
|
|
124
|
+
anchorType: 'button';
|
|
125
|
+
/**
|
|
126
|
+
* Hide dropdown arrow icon
|
|
127
|
+
*/
|
|
128
|
+
hideDropdownIcon?: boolean;
|
|
129
|
+
/**
|
|
130
|
+
* Hide dropdown label text
|
|
131
|
+
*/
|
|
132
|
+
hideLabel?: boolean;
|
|
133
|
+
/**
|
|
134
|
+
* Button properties
|
|
135
|
+
*
|
|
136
|
+
* @see {Button}
|
|
137
|
+
*/
|
|
138
|
+
buttonProps?: ButtonProps;
|
|
139
|
+
/**
|
|
140
|
+
* Button label
|
|
141
|
+
*
|
|
142
|
+
* Default value: 'Open Popover'
|
|
143
|
+
*/
|
|
144
|
+
label?: string | React.JSX.Element;
|
|
145
|
+
content?: never;
|
|
146
|
+
};
|
|
147
|
+
type DropdownVariationContainerProps = DropdownSharedProps & {
|
|
148
|
+
/**
|
|
149
|
+
* Anchors dropdown to React.ReactNode content element
|
|
150
|
+
*
|
|
151
|
+
* @see {React.ReactNode}
|
|
152
|
+
*/
|
|
153
|
+
anchorType: 'content';
|
|
154
|
+
/**
|
|
155
|
+
* Element to be used as anchor, to toggle dropdown when clicked.
|
|
156
|
+
*/
|
|
157
|
+
content: React.ReactNode;
|
|
158
|
+
};
|
|
159
|
+
type DropdownProps = DropdownVariationContainerProps | DropdownVariationButtonProps;
|
|
160
|
+
/**
|
|
161
|
+
* Display a menu with a list of options
|
|
162
|
+
*/
|
|
163
|
+
declare const Dropdown: ({ onToggle, onSelect, content, anchorType, ...props }: DropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
164
|
+
export type { DropdownOption, DropdownProps };
|
|
165
|
+
export { Dropdown };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { DropdownOption } from './Dropdown';
|
|
2
|
+
import { Color } from '../../../colors';
|
|
3
|
+
type StyledProps = {
|
|
4
|
+
brokenSequence?: boolean;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
color?: Color;
|
|
9
|
+
} & Partial<Pick<DropdownOption, 'activeBackgroundColor'>>;
|
|
10
|
+
declare const MenuContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProps>> & string;
|
|
11
|
+
declare const MenuOption: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProps>> & string;
|
|
12
|
+
declare const Text: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, StyledProps>> & string;
|
|
13
|
+
declare const ContentBadge: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, StyledProps>> & string;
|
|
14
|
+
declare const ClickableContainer: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProps>> & string;
|
|
15
|
+
declare const Grid: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProps>> & string;
|
|
16
|
+
declare const Wrapper: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, StyledProps>> & string;
|
|
17
|
+
export { MenuContainer, MenuOption, Text, ContentBadge, ClickableContainer, Grid, Wrapper, };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Dropdown';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { Color } from '../../../colors';
|
|
3
|
+
import { Icon as IconName } from '../../../icons';
|
|
4
|
+
type IconProps = {
|
|
5
|
+
/**
|
|
6
|
+
* Defines which icon to render from Devopness UI Icons
|
|
7
|
+
*
|
|
8
|
+
* @see iconLoader
|
|
9
|
+
*/
|
|
10
|
+
name: IconName | undefined;
|
|
11
|
+
/** Defines element height and width */
|
|
12
|
+
size?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Defines element foreground/fill color
|
|
15
|
+
*
|
|
16
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/color
|
|
17
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/fill
|
|
18
|
+
*
|
|
19
|
+
* @see {getColor}
|
|
20
|
+
*/
|
|
21
|
+
color?: Color;
|
|
22
|
+
/**
|
|
23
|
+
* Defines the degree to which content behind an element is hidden; is a number in the range 0.0 to 1.0
|
|
24
|
+
*
|
|
25
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/CSS/opacity}
|
|
26
|
+
*/
|
|
27
|
+
opacity?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Defines a string value that labels the current element
|
|
30
|
+
*
|
|
31
|
+
* Uses name as fallback, if prop is undefined
|
|
32
|
+
*
|
|
33
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label}
|
|
34
|
+
*/
|
|
35
|
+
ariaLabel?: HTMLAttributes<HTMLOrSVGImageElement>['aria-label'];
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Loads icon from iconLoader
|
|
39
|
+
*
|
|
40
|
+
* @see {@link src/icons/iconLoader.tsx:iconLoader}
|
|
41
|
+
*/
|
|
42
|
+
declare const Icon: (props: IconProps) => import("react").JSX.Element;
|
|
43
|
+
export type { IconProps };
|
|
44
|
+
export { Icon };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Icon';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { HTMLProps, default as React } from 'react';
|
|
2
|
+
import { Color } from '../../../colors';
|
|
3
|
+
import { IconProps } from '../Icon';
|
|
4
|
+
import { Unwrap } from '../../types';
|
|
5
|
+
type LinkProps = Omit<HTMLProps<HTMLAnchorElement>, 'href' | 'target' | 'color' | 'ref' | 'as'> & {
|
|
6
|
+
/**
|
|
7
|
+
* Defines element foreground color
|
|
8
|
+
*
|
|
9
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/color
|
|
10
|
+
* https://developer.mozilla.org/en-US/docs/Web/CSS/fill
|
|
11
|
+
*
|
|
12
|
+
* @see {getColor}
|
|
13
|
+
*/
|
|
14
|
+
color?: Color;
|
|
15
|
+
/**
|
|
16
|
+
* The URL that the hyperlink points to.
|
|
17
|
+
*
|
|
18
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#href
|
|
19
|
+
*/
|
|
20
|
+
to?: HTMLProps<HTMLAnchorElement>['href'];
|
|
21
|
+
/**
|
|
22
|
+
* Where to display the linked URL.
|
|
23
|
+
*
|
|
24
|
+
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#target
|
|
25
|
+
*/
|
|
26
|
+
target?: '_blank' | '_self';
|
|
27
|
+
/**
|
|
28
|
+
* Icon's Props
|
|
29
|
+
*
|
|
30
|
+
* @see {Icon}
|
|
31
|
+
*/
|
|
32
|
+
iconProps?: Unwrap<Omit<IconProps, 'name'>>;
|
|
33
|
+
/**
|
|
34
|
+
* Hides default underline when the element is visible
|
|
35
|
+
*/
|
|
36
|
+
hideUnderline?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Hides underline when hovering the element
|
|
39
|
+
*/
|
|
40
|
+
hideUnderlineOnHover?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Hides External URL Icon
|
|
43
|
+
*/
|
|
44
|
+
hideExternalUrlIcon?: boolean;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Display a hyperlink to other application pages or external resources
|
|
48
|
+
*/
|
|
49
|
+
declare const Link: ({ target, children, color, rel, to: href, hideUnderline, hideUnderlineOnHover, hideExternalUrlIcon, iconProps, ...props }: React.PropsWithChildren<LinkProps>) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export type { LinkProps };
|
|
51
|
+
export { Link };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type StyledLinkProps = {
|
|
2
|
+
$showUnderline: boolean;
|
|
3
|
+
$showUnderlineOnHover: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const StyledLink: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, StyledLinkProps>> & string;
|
|
6
|
+
export { StyledLink };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Link';
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TooltipProps } from '@mui/material/Tooltip';
|
|
2
|
+
import { Unwrap } from '../../types';
|
|
2
3
|
type Nullable<T extends object> = {
|
|
3
4
|
[K in keyof T]: T[K] | null | undefined;
|
|
4
5
|
};
|
|
5
|
-
type TooltipComponentProps = {
|
|
6
|
+
type TooltipComponentProps = Unwrap<{
|
|
6
7
|
/**
|
|
7
8
|
* Tooltip reference element.
|
|
8
9
|
*/
|
|
@@ -35,7 +36,8 @@ type TooltipComponentProps = {
|
|
|
35
36
|
* in the controlled way
|
|
36
37
|
*/
|
|
37
38
|
open?: boolean;
|
|
38
|
-
} & Omit<TooltipProps, 'title' | 'children'> & Nullable<Pick<TooltipProps, 'title'
|
|
39
|
+
} & Omit<TooltipProps, 'title' | 'children'> & Nullable<Pick<TooltipProps, 'title'>>>;
|
|
39
40
|
/** Display informative text when users hover over a child element */
|
|
40
41
|
declare const Tooltip: ({ disableHover, enableOnlyWithEllipsisPoints, title, children, ...props }: TooltipComponentProps) => import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export type { TooltipComponentProps as TooltipProps };
|
|
41
43
|
export { Tooltip };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type ConditionalWrapperProps = {
|
|
2
|
+
condition: boolean;
|
|
3
|
+
wrapper: (children: React.ReactNode) => React.ReactNode;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Wraps children if a condition is met
|
|
8
|
+
*/
|
|
9
|
+
declare const ConditionalWrapper: ({ condition, wrapper, children, }: ConditionalWrapperProps) => import('react').ReactNode;
|
|
10
|
+
export { ConditionalWrapper };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unwrap<T>
|
|
3
|
+
*
|
|
4
|
+
* Construct a type with the all properties of T without intersections.
|
|
5
|
+
* This makes the hover overlay and the story generated type description more readable.
|
|
6
|
+
*
|
|
7
|
+
* @example Both types below are equivalent
|
|
8
|
+
*
|
|
9
|
+
* type Intersected = { a: string; } & { b: number; } & { c: boolean; }
|
|
10
|
+
* // ^? { a: string; } & { b: number; } & { c: boolean; }
|
|
11
|
+
* type UnwrappedIntersected = Unwrap<Intersected>
|
|
12
|
+
* // ^? { a: string; b: number; c: boolean; }
|
|
13
|
+
*
|
|
14
|
+
* @example Both types below are equivalent
|
|
15
|
+
*
|
|
16
|
+
* type PickFromTwoTypes = Pick<Intersected, 'a' | 'b'> & Pick<Intersected, 'c'>
|
|
17
|
+
* // ^? Pick<Intersected, 'a' | 'b'> & Pick<Intersected, 'c'>
|
|
18
|
+
* type UnwrappedPickFromTwoTypes = Unwrap<PickFromTwoTypes>
|
|
19
|
+
* // ^? { a: string; b: number; c: boolean; }
|
|
20
|
+
*
|
|
21
|
+
* Code obtained from Total TypeScript: https://www.totaltypescript.com/concepts/the-prettify-helper
|
|
22
|
+
* Source code from mattpocock @ https://github.com/mattpocock
|
|
23
|
+
*/
|
|
24
|
+
type Unwrap<T> = {
|
|
25
|
+
[K in keyof T]: T[K];
|
|
26
|
+
} & {};
|
|
27
|
+
export type { Unwrap };
|