@jobber/components 2.85.8 → 2.86.1
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/CHANGELOG.md +19 -0
- package/dist/Autocomplete/Autocomplete.d.ts +47 -47
- package/dist/Autocomplete/Menu.d.ts +9 -9
- package/dist/Autocomplete/Option.d.ts +15 -15
- package/dist/Autocomplete/index.d.ts +2 -2
- package/dist/Autocomplete/index.js +215 -211
- package/dist/Avatar/Avatar.d.ts +37 -37
- package/dist/Avatar/index.d.ts +1 -1
- package/dist/Avatar/index.js +7 -74
- package/dist/Avatar/utilities.d.ts +1 -1
- package/dist/Avatar-cfd04e86.js +82 -0
- package/dist/Banner/Banner.d.ts +19 -19
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +67 -65
- package/dist/Button/Button.d.ts +64 -64
- package/dist/Button/index.d.ts +1 -1
- package/dist/Button/index.js +9 -53
- package/dist/Button-5b2f1636.js +60 -0
- package/dist/ButtonDismiss/ButtonDismiss.d.ts +7 -7
- package/dist/ButtonDismiss/index.d.ts +1 -1
- package/dist/ButtonDismiss/index.js +10 -15
- package/dist/ButtonDismiss-4cde8f7c.js +15 -0
- package/dist/Card/Card.d.ts +31 -31
- package/dist/Card/CardClickable.d.ts +12 -12
- package/dist/Card/index.d.ts +1 -1
- package/dist/Card/index.js +7 -61
- package/dist/Card-368e01a3.js +68 -0
- package/dist/Checkbox/Checkbox.d.ts +52 -52
- package/dist/Checkbox/index.d.ts +1 -1
- package/dist/Checkbox/index.js +34 -32
- package/dist/Chips/Chip.d.ts +8 -8
- package/dist/Chips/ChipDismissible.d.ts +7 -7
- package/dist/Chips/ChipTypes.d.ts +59 -59
- package/dist/Chips/Chips.d.ts +2 -2
- package/dist/Chips/ChipsTypes.d.ts +82 -82
- package/dist/Chips/InternalChip.d.ts +2 -2
- package/dist/Chips/InternalChipAffix.d.ts +10 -10
- package/dist/Chips/InternalChipButton.d.ts +10 -10
- package/dist/Chips/InternalChipDismissible/InternalChipDismissible.d.ts +2 -2
- package/dist/Chips/InternalChipDismissible/InternalChipDismissibleInput.d.ts +2 -2
- package/dist/Chips/InternalChipDismissible/InternalChipDismissibleTypes.d.ts +13 -13
- package/dist/Chips/InternalChipDismissible/hooks/index.d.ts +5 -5
- package/dist/Chips/InternalChipDismissible/hooks/useInView.d.ts +5 -5
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissible.d.ts +15 -15
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +28 -28
- package/dist/Chips/InternalChipDismissible/hooks/useRepositionMenu.d.ts +16 -16
- package/dist/Chips/InternalChipDismissible/hooks/useScrollToActive.d.ts +2 -2
- package/dist/Chips/InternalChipDismissible/index.d.ts +1 -1
- package/dist/Chips/InternalChipMultiSelect.d.ts +4 -4
- package/dist/Chips/InternalChipSingleSelect.d.ts +4 -4
- package/dist/Chips/index.d.ts +3 -3
- package/dist/Chips/index.js +493 -491
- package/dist/Chips/utils/mdxUtils.d.ts +9 -9
- package/dist/ConfirmationModal/ConfirmationModal.d.ts +62 -62
- package/dist/ConfirmationModal/index.d.ts +1 -1
- package/dist/ConfirmationModal/index.js +20 -109
- package/dist/ConfirmationModal-b7ef110f.js +103 -0
- package/dist/Content/Content.d.ts +13 -13
- package/dist/Content/index.d.ts +1 -1
- package/dist/Content/index.js +5 -19
- package/dist/Content-18de5fbb.js +26 -0
- package/dist/Countdown/Countdown.d.ts +31 -31
- package/dist/Countdown/computeTimeUnit.d.ts +3 -3
- package/dist/Countdown/index.d.ts +1 -1
- package/dist/Countdown/index.js +63 -61
- package/dist/DataDump/DataDump.d.ts +20 -20
- package/dist/DataDump/index.d.ts +1 -1
- package/dist/DataDump/index.js +18 -17
- package/dist/DatePicker/DatePicker.d.ts +50 -50
- package/dist/DatePicker/DatePickerActivator.d.ts +12 -12
- package/dist/DatePicker/DatePickerCustomHeader.d.ts +2 -2
- package/dist/DatePicker/index.d.ts +1 -1
- package/dist/DatePicker/index.js +13 -97
- package/dist/DatePicker/useFocusOnSelectedDate.d.ts +5 -5
- package/dist/DatePicker-ad6f8630.js +103 -0
- package/dist/DescriptionList/DescriptionList.d.ts +10 -10
- package/dist/DescriptionList/index.d.ts +1 -1
- package/dist/DescriptionList/index.js +16 -15
- package/dist/Disclosure/Disclosure.d.ts +20 -20
- package/dist/Disclosure/index.d.ts +1 -1
- package/dist/Disclosure/index.js +32 -31
- package/dist/Divider/Divider.d.ts +16 -16
- package/dist/Divider/index.d.ts +1 -1
- package/dist/Divider/index.js +19 -17
- package/dist/Drawer/Drawer.d.ts +13 -13
- package/dist/Drawer/DrawerGrid.d.ts +6 -6
- package/dist/Drawer/index.d.ts +2 -2
- package/dist/Drawer/index.js +39 -37
- package/dist/Emphasis/Emphasis.d.ts +11 -11
- package/dist/Emphasis/index.d.ts +1 -1
- package/dist/Emphasis/index.js +7 -17
- package/dist/Emphasis-fd845639.js +21 -0
- package/dist/FeatureSwitch/FeatureSwitch.d.ts +51 -51
- package/dist/FeatureSwitch/index.d.ts +1 -1
- package/dist/FeatureSwitch/index.js +57 -55
- package/dist/Form/Form.d.ts +18 -18
- package/dist/Form/index.d.ts +1 -1
- package/dist/Form/index.js +58 -57
- package/dist/FormField/FormField.d.ts +2 -2
- package/dist/FormField/FormFieldAffix.d.ts +13 -13
- package/dist/FormField/FormFieldDescription.d.ts +6 -6
- package/dist/FormField/FormFieldPostFix.d.ts +5 -5
- package/dist/FormField/FormFieldTypes.d.ts +160 -160
- package/dist/FormField/FormFieldWrapper.d.ts +9 -9
- package/dist/FormField/index.d.ts +2 -2
- package/dist/FormField/index.js +15 -208
- package/dist/FormField-a92c7bac.js +213 -0
- package/dist/FormatDate/FormatDate.d.ts +12 -12
- package/dist/FormatDate/index.d.ts +1 -1
- package/dist/FormatDate/index.js +24 -23
- package/dist/FormatEmail/FormatEmail.d.ts +8 -8
- package/dist/FormatEmail/index.d.ts +1 -1
- package/dist/FormatEmail/index.js +12 -10
- package/dist/FormatFile/FormatFile.d.ts +30 -30
- package/dist/FormatFile/FormatFileDeleteButton.d.ts +6 -6
- package/dist/FormatFile/InternalThumbnail.d.ts +9 -9
- package/dist/FormatFile/index.d.ts +1 -1
- package/dist/FormatFile/index.js +21 -112
- package/dist/FormatFile-5391d4cf.js +112 -0
- package/dist/FormatRelativeDateTime/FormatRelativeDateTime.d.ts +11 -11
- package/dist/FormatRelativeDateTime/index.d.ts +1 -1
- package/dist/FormatRelativeDateTime/index.js +64 -63
- package/dist/FormatTime/FormatTime.d.ts +15 -15
- package/dist/FormatTime/index.d.ts +1 -1
- package/dist/FormatTime/index.js +28 -27
- package/dist/Gallery/Gallery.d.ts +2 -2
- package/dist/Gallery/GalleryTypes.d.ts +31 -31
- package/dist/Gallery/index.d.ts +1 -1
- package/dist/Gallery/index.js +82 -80
- package/dist/Heading/Heading.d.ts +14 -14
- package/dist/Heading/index.d.ts +1 -1
- package/dist/Heading/index.js +7 -53
- package/dist/Heading-56750113.js +57 -0
- package/dist/Icon/Icon.d.ts +22 -22
- package/dist/Icon/index.d.ts +1 -1
- package/dist/Icon/index.js +4 -35
- package/dist/Icon-d5ad1a6d.js +41 -0
- package/dist/InlineLabel/InlineLabel.d.ts +17 -17
- package/dist/InlineLabel/index.d.ts +1 -1
- package/dist/InlineLabel/index.js +20 -18
- package/dist/InputAvatar/InputAvatar.d.ts +22 -22
- package/dist/InputAvatar/index.d.ts +1 -1
- package/dist/InputAvatar/index.js +57 -56
- package/dist/InputDate/InputDate.d.ts +19 -19
- package/dist/InputDate/index.d.ts +1 -1
- package/dist/InputDate/index.js +34 -33
- package/dist/InputEmail/InputEmail.d.ts +5 -5
- package/dist/InputEmail/index.d.ts +1 -1
- package/dist/InputEmail/index.js +29 -28
- package/dist/InputFile/InputFile.d.ts +121 -121
- package/dist/InputFile/index.d.ts +1 -1
- package/dist/InputFile/index.js +15 -168
- package/dist/InputFile-b5cf90c3.js +174 -0
- package/dist/InputGroup/InputGroup.d.ts +11 -11
- package/dist/InputGroup/index.d.ts +1 -1
- package/dist/InputGroup/index.js +24 -22
- package/dist/InputNumber/InputNumber.d.ts +11 -11
- package/dist/InputNumber/index.d.ts +1 -1
- package/dist/InputNumber/index.js +52 -51
- package/dist/InputPassword/InputPassword.d.ts +12 -12
- package/dist/InputPassword/index.d.ts +1 -1
- package/dist/InputPassword/index.js +28 -27
- package/dist/InputText/InputText.d.ts +29 -29
- package/dist/InputText/index.d.ts +1 -1
- package/dist/InputText/index.js +15 -95
- package/dist/InputText-cb3be15c.js +91 -0
- package/dist/InputTime/InputTime.d.ts +2 -2
- package/dist/InputTime/InputTimeProps.d.ts +18 -18
- package/dist/InputTime/InputTimeSafari.d.ts +2 -2
- package/dist/InputTime/civilTimeConversions.d.ts +3 -3
- package/dist/InputTime/index.d.ts +1 -1
- package/dist/InputTime/index.js +402 -257
- package/dist/InputValidation/InputValidation.d.ts +8 -8
- package/dist/InputValidation/index.d.ts +1 -1
- package/dist/InputValidation/index.js +8 -24
- package/dist/InputValidation-24d3621a.js +28 -0
- package/dist/LightBox/LightBox.d.ts +37 -37
- package/dist/LightBox/index.d.ts +1 -1
- package/dist/LightBox/index.js +6 -34
- package/dist/LightBox-b893b656.js +42 -0
- package/dist/List/List.d.ts +11 -11
- package/dist/List/ListItem.d.ts +54 -54
- package/dist/List/index.d.ts +1 -1
- package/dist/List/index.js +76 -74
- package/dist/Markdown/Markdown.d.ts +17 -17
- package/dist/Markdown/index.d.ts +1 -1
- package/dist/Markdown/index.js +12 -64
- package/dist/Markdown-69986c49.js +68 -0
- package/dist/Menu/Menu.d.ts +46 -46
- package/dist/Menu/index.d.ts +1 -1
- package/dist/Menu/index.js +13 -128
- package/dist/Menu-6a392af6.js +134 -0
- package/dist/Modal/Modal.d.ts +22 -22
- package/dist/Modal/index.d.ts +1 -1
- package/dist/Modal/index.js +14 -127
- package/dist/Modal/useFocusTrap.d.ts +10 -10
- package/dist/Modal-aaaaf2df.js +132 -0
- package/dist/Page/Page.d.ts +59 -59
- package/dist/Page/index.d.ts +1 -1
- package/dist/Page/index.js +63 -61
- package/dist/Popover/Popover.d.ts +26 -26
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +49 -48
- package/dist/ProgressBar/ProgressBar.d.ts +18 -18
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/ProgressBar/index.js +5 -22
- package/dist/ProgressBar-e9a49129.js +29 -0
- package/dist/RadioGroup/RadioGroup.d.ts +27 -27
- package/dist/RadioGroup/RadioOption.d.ts +34 -34
- package/dist/RadioGroup/index.d.ts +2 -2
- package/dist/RadioGroup/index.js +38 -37
- package/dist/RecurringSelect/CurrentRecurrenceComponent.d.ts +8 -8
- package/dist/RecurringSelect/RecurringSelect.d.ts +8 -8
- package/dist/RecurringSelect/components/DayOfMonthSelect.d.ts +8 -8
- package/dist/RecurringSelect/components/MonthlyDayOfWeekSelect.d.ts +8 -8
- package/dist/RecurringSelect/components/MonthlySelect.d.ts +8 -8
- package/dist/RecurringSelect/components/WeeklySelect.d.ts +8 -8
- package/dist/RecurringSelect/components/index.d.ts +4 -4
- package/dist/RecurringSelect/index.d.ts +2 -2
- package/dist/RecurringSelect/types.d.ts +65 -65
- package/dist/Select/Option.d.ts +17 -17
- package/dist/Select/Select.d.ts +10 -10
- package/dist/Select/index.d.ts +2 -2
- package/dist/Select/index.js +20 -19
- package/dist/Spinner/Spinner.d.ts +15 -15
- package/dist/Spinner/index.d.ts +1 -1
- package/dist/Spinner/index.js +5 -19
- package/dist/Spinner-18d3dee6.js +26 -0
- package/dist/StatusLabel/StatusLabel.d.ts +25 -25
- package/dist/StatusLabel/index.d.ts +1 -1
- package/dist/StatusLabel/index.js +21 -19
- package/dist/Switch/Switch.d.ts +14 -14
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +7 -53
- package/dist/Switch-d2bec677.js +60 -0
- package/dist/Table/Body.d.ts +6 -6
- package/dist/Table/Cells/Cell.d.ts +7 -7
- package/dist/Table/Cells/CellCurrency.d.ts +8 -8
- package/dist/Table/Cells/CellNumeric.d.ts +4 -4
- package/dist/Table/Footer.d.ts +6 -6
- package/dist/Table/Header.d.ts +6 -6
- package/dist/Table/Row.d.ts +6 -6
- package/dist/Table/Table.d.ts +6 -6
- package/dist/Table/index.d.ts +8 -8
- package/dist/Table/index.js +41 -39
- package/dist/Tabs/Tabs.d.ts +19 -19
- package/dist/Tabs/index.d.ts +1 -1
- package/dist/Tabs/index.js +69 -67
- package/dist/Text/Text.d.ts +9 -9
- package/dist/Text/index.d.ts +1 -1
- package/dist/Text/index.js +7 -29
- package/dist/Text-9bc093e9.js +32 -0
- package/dist/Toast/Toast.d.ts +17 -17
- package/dist/Toast/index.d.ts +1 -1
- package/dist/Toast/index.js +93 -93
- package/dist/Toast/showToast.d.ts +2 -2
- package/dist/Tooltip/Tooltip.d.ts +10 -10
- package/dist/Tooltip/index.d.ts +1 -1
- package/dist/Tooltip/index.js +11 -110
- package/dist/Tooltip/useTooltipPositioning.d.ts +18 -18
- package/dist/Tooltip-4396164d.js +116 -0
- package/dist/Typography/Typography.d.ts +38 -38
- package/dist/Typography/index.d.ts +1 -1
- package/dist/Typography/index.js +6 -57
- package/dist/Typography-7e542a72.js +64 -0
- package/dist/{chunk-17e02351.js → style-inject.es-dcee06b6.js} +0 -0
- package/dist/{chunk-b67af3cb.js → tslib.es6-5b50eb8e.js} +0 -0
- package/package.json +6 -8
- package/rollup.config.js +28 -3
package/dist/Avatar/Avatar.d.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { XOR } from "ts-xor";
|
|
2
|
-
declare type AvatarSize = "base" | "large" | "small";
|
|
3
|
-
interface AvatarFoundationProps {
|
|
4
|
-
/**
|
|
5
|
-
* A url for the image that will be displayed
|
|
6
|
-
*/
|
|
7
|
-
readonly imageUrl?: string;
|
|
8
|
-
/**
|
|
9
|
-
* A users name to be used for assistive technology
|
|
10
|
-
*/
|
|
11
|
-
readonly name?: string;
|
|
12
|
-
/**
|
|
13
|
-
* The initials that will be displayed if no image is set.\
|
|
14
|
-
*/
|
|
15
|
-
readonly initials?: string;
|
|
16
|
-
/**
|
|
17
|
-
* The background and border color that represents the user. This should be
|
|
18
|
-
* represented as a value that can be read by CSS
|
|
19
|
-
*/
|
|
20
|
-
readonly color?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Change the size of the avatar
|
|
23
|
-
* @property "large" - Make avatar to be the focal point
|
|
24
|
-
* @property "small" - For higher-density/compact places or components
|
|
25
|
-
* @default "base"
|
|
26
|
-
*/
|
|
27
|
-
readonly size?: AvatarSize;
|
|
28
|
-
}
|
|
29
|
-
interface AvatarWithImageProps extends AvatarFoundationProps {
|
|
30
|
-
readonly imageUrl: string;
|
|
31
|
-
}
|
|
32
|
-
interface AvatarWithInitialsProps extends AvatarFoundationProps {
|
|
33
|
-
readonly initials: string;
|
|
34
|
-
}
|
|
35
|
-
export declare type AvatarProps = XOR<AvatarWithImageProps, AvatarWithInitialsProps>;
|
|
36
|
-
export declare function Avatar({ imageUrl, name, initials, size, color, }: AvatarProps): JSX.Element;
|
|
37
|
-
export {};
|
|
1
|
+
import { XOR } from "ts-xor";
|
|
2
|
+
declare type AvatarSize = "base" | "large" | "small";
|
|
3
|
+
interface AvatarFoundationProps {
|
|
4
|
+
/**
|
|
5
|
+
* A url for the image that will be displayed
|
|
6
|
+
*/
|
|
7
|
+
readonly imageUrl?: string;
|
|
8
|
+
/**
|
|
9
|
+
* A users name to be used for assistive technology
|
|
10
|
+
*/
|
|
11
|
+
readonly name?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The initials that will be displayed if no image is set.\
|
|
14
|
+
*/
|
|
15
|
+
readonly initials?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The background and border color that represents the user. This should be
|
|
18
|
+
* represented as a value that can be read by CSS
|
|
19
|
+
*/
|
|
20
|
+
readonly color?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Change the size of the avatar
|
|
23
|
+
* @property "large" - Make avatar to be the focal point
|
|
24
|
+
* @property "small" - For higher-density/compact places or components
|
|
25
|
+
* @default "base"
|
|
26
|
+
*/
|
|
27
|
+
readonly size?: AvatarSize;
|
|
28
|
+
}
|
|
29
|
+
interface AvatarWithImageProps extends AvatarFoundationProps {
|
|
30
|
+
readonly imageUrl: string;
|
|
31
|
+
}
|
|
32
|
+
interface AvatarWithInitialsProps extends AvatarFoundationProps {
|
|
33
|
+
readonly initials: string;
|
|
34
|
+
}
|
|
35
|
+
export declare type AvatarProps = XOR<AvatarWithImageProps, AvatarWithInitialsProps>;
|
|
36
|
+
export declare function Avatar({ imageUrl, name, initials, size, color, }: AvatarProps): JSX.Element;
|
|
37
|
+
export {};
|
package/dist/Avatar/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Avatar, AvatarProps } from "./Avatar";
|
|
1
|
+
export { Avatar, AvatarProps } from "./Avatar";
|
package/dist/Avatar/index.js
CHANGED
|
@@ -2,81 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
var Avatar = require('../Avatar-cfd04e86.js');
|
|
6
|
+
require('react');
|
|
7
|
+
require('classnames');
|
|
8
|
+
require('../style-inject.es-dcee06b6.js');
|
|
9
|
+
require('color');
|
|
10
|
+
require('../Icon-d5ad1a6d.js');
|
|
11
11
|
require('@jobber/design');
|
|
12
|
-
var index$2 = require('../Icon/index.js');
|
|
13
|
-
var Color = _interopDefault(require('color'));
|
|
14
|
-
|
|
15
|
-
var css = ":root {\n --avatar-size: calc(var(--base-unit) * 2);\n --avatar-border-size: var(--border-base);\n}\n\n._32nXNk9U4V8Tn_oqzj-1Vv {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n width: calc(var(--base-unit) * 2);\n width: calc(var(--base-unit) * 2);\n width: var(--avatar-size);\n height: calc(var(--base-unit) * 2);\n height: calc(var(--base-unit) * 2);\n height: var(--avatar-size);\n min-width: calc(var(--base-unit) * 2);\n min-width: calc(var(--base-unit) * 2);\n min-width: var(--avatar-size);\n min-height: calc(var(--base-unit) * 2);\n min-height: calc(var(--base-unit) * 2);\n min-height: var(--avatar-size);\n border-radius: var(--radius-circle);\n color: var(--color-heading);\n font-size: calc(var(--base-unit) * 2);\n font-size: calc(var(--base-unit) * 2);\n font-size: var(--avatar-size);\n -webkit-font-smoothing: antialiased;\n background: no-repeat center center var(--color-greyBlue);\n background-size: cover;\n}\n\n._32nXNk9U4V8Tn_oqzj-1Vv:focus {\n box-shadow: var(--shadow-focus);\n outline: none;\n}\n\n._3JfcxzHXbxVujP9Nwwsm8d {\n --avatar-size: calc(var(--base-unit) * 4.5);\n --avatar-border-size: var(--border-thick);\n}\n\n._1gInQYSeS220Gh9DnVEr5W {\n --avatar-size: calc(var(--base-unit) * 1.5);\n}\n\n._2jL6zuod0FYzAcQ9jHlwr0 {\n color: var(--color-text--reverse);\n}\n\n._1EBgtTAVncoq5YcW-R48zh {\n font-size: calc(calc(var(--base-unit) * 2) / 2);\n font-size: calc(calc(var(--base-unit) * 2) / 2);\n font-size: calc(var(--avatar-size) / 2);\n text-transform: uppercase;\n}\n\n._3w35jLfoUs-eucNNL23qUF {\n font-size: calc(calc(var(--base-unit) * 2) / 2.25);\n font-size: calc(calc(var(--base-unit) * 2) / 2.25);\n font-size: calc(var(--avatar-size) / 2.25);\n}\n\n.cAt2tRNytCx33iuuBj2aM {\n width: calc(calc(var(--base-unit) * 2) - (var(--border-base) * 2));\n width: calc(calc(var(--base-unit) * 2) - (var(--border-base) * 2));\n width: calc(var(--avatar-size) - (var(--avatar-border-size) * 2));\n height: calc(calc(var(--base-unit) * 2) - (var(--border-base) * 2));\n height: calc(calc(var(--base-unit) * 2) - (var(--border-base) * 2));\n height: calc(var(--avatar-size) - (var(--avatar-border-size) * 2));\n box-shadow: 0 0 0 var(--border-thick) var(--color-white) inset;\n border-style: solid;\n border-width: var(--border-base);\n border-width: var(--border-base);\n border-width: var(--avatar-border-size);\n}\n";
|
|
16
|
-
var styles = {"avatar":"_32nXNk9U4V8Tn_oqzj-1Vv","large":"_3JfcxzHXbxVujP9Nwwsm8d","small":"_1gInQYSeS220Gh9DnVEr5W","isDark":"_2jL6zuod0FYzAcQ9jHlwr0","initials":"_1EBgtTAVncoq5YcW-R48zh","smallInitials":"_3w35jLfoUs-eucNNL23qUF","hasBorder":"cAt2tRNytCx33iuuBj2aM"};
|
|
17
|
-
__chunk_2.styleInject(css);
|
|
18
12
|
|
|
19
|
-
function isDark(colorToCheck) {
|
|
20
|
-
if (colorToCheck == undefined) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
if (colorToCheck) {
|
|
24
|
-
try {
|
|
25
|
-
return Color(deconstructCssCustomProperty(colorToCheck)).isDark();
|
|
26
|
-
}
|
|
27
|
-
catch (err) {
|
|
28
|
-
console.log(err);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
32
|
-
}
|
|
33
|
-
function deconstructCssCustomProperty(color) {
|
|
34
|
-
if (!color) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (!color.toLowerCase().startsWith("var(")) {
|
|
38
|
-
return color;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Rips apart the `var(--custom-property)` into just `--custom-property`.
|
|
42
|
-
*/
|
|
43
|
-
var customProperty = color
|
|
44
|
-
.replace("var(", "")
|
|
45
|
-
.slice(0, -1)
|
|
46
|
-
.split(" ")
|
|
47
|
-
.join("");
|
|
48
|
-
return getComputedStyle(document.documentElement)
|
|
49
|
-
.getPropertyValue(customProperty)
|
|
50
|
-
.trim();
|
|
51
|
-
}
|
|
52
13
|
|
|
53
|
-
function Avatar(_a) {
|
|
54
|
-
var _b;
|
|
55
|
-
var imageUrl = _a.imageUrl, name = _a.name, initials = _a.initials, _c = _a.size, size = _c === void 0 ? "base" : _c, color = _a.color;
|
|
56
|
-
var style = {
|
|
57
|
-
backgroundColor: color,
|
|
58
|
-
borderColor: color,
|
|
59
|
-
};
|
|
60
|
-
if (imageUrl) {
|
|
61
|
-
style.backgroundImage = "url(" + imageUrl + ")";
|
|
62
|
-
}
|
|
63
|
-
var shouldBeDark = color == undefined || isDark(color);
|
|
64
|
-
var className = classnames(styles.avatar, size !== "base" && styles[size], (_b = {},
|
|
65
|
-
_b[styles.hasBorder] = imageUrl && color,
|
|
66
|
-
_b[styles.isDark] = shouldBeDark,
|
|
67
|
-
_b));
|
|
68
|
-
return (React__default.createElement("div", { className: className, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React__default.createElement(Initials, { initials: initials, dark: shouldBeDark, iconSize: size }))));
|
|
69
|
-
}
|
|
70
|
-
function Initials(_a) {
|
|
71
|
-
var _b;
|
|
72
|
-
var initials = _a.initials, _c = _a.dark, dark = _c === void 0 ? false : _c, _d = _a.iconSize, iconSize = _d === void 0 ? "base" : _d;
|
|
73
|
-
if (!initials) {
|
|
74
|
-
return (React__default.createElement(index$2.Icon, { name: "person", color: dark ? "white" : "blue", size: iconSize }));
|
|
75
|
-
}
|
|
76
|
-
var className = classnames(styles.initials, (_b = {},
|
|
77
|
-
_b[styles.smallInitials] = initials.length > 2,
|
|
78
|
-
_b));
|
|
79
|
-
return React__default.createElement("span", { className: className }, initials.substr(0, 3));
|
|
80
|
-
}
|
|
81
14
|
|
|
82
|
-
exports.Avatar = Avatar;
|
|
15
|
+
exports.Avatar = Avatar.Avatar;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function isDark(colorToCheck?: string): boolean;
|
|
1
|
+
export declare function isDark(colorToCheck?: string): boolean;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classnames = require('classnames');
|
|
5
|
+
var styleInject_es = require('./style-inject.es-dcee06b6.js');
|
|
6
|
+
var Color = require('color');
|
|
7
|
+
var Icon = require('./Icon-d5ad1a6d.js');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
12
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
13
|
+
var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
|
|
14
|
+
|
|
15
|
+
var css = ":root {\n --avatar-size: calc(var(--base-unit) * 2);\n --avatar-border-size: var(--border-base);\n}\n\n._32nXNk9U4V8Tn_oqzj-1Vv {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n width: calc(var(--base-unit) * 2);\n width: calc(var(--base-unit) * 2);\n width: var(--avatar-size);\n height: calc(var(--base-unit) * 2);\n height: calc(var(--base-unit) * 2);\n height: var(--avatar-size);\n min-width: calc(var(--base-unit) * 2);\n min-width: calc(var(--base-unit) * 2);\n min-width: var(--avatar-size);\n min-height: calc(var(--base-unit) * 2);\n min-height: calc(var(--base-unit) * 2);\n min-height: var(--avatar-size);\n border-radius: var(--radius-circle);\n color: var(--color-heading);\n font-size: calc(var(--base-unit) * 2);\n font-size: calc(var(--base-unit) * 2);\n font-size: var(--avatar-size);\n -webkit-font-smoothing: antialiased;\n background: no-repeat center center var(--color-greyBlue);\n background-size: cover;\n}\n\n._32nXNk9U4V8Tn_oqzj-1Vv:focus {\n box-shadow: var(--shadow-focus);\n outline: none;\n}\n\n._3JfcxzHXbxVujP9Nwwsm8d {\n --avatar-size: calc(var(--base-unit) * 4.5);\n --avatar-border-size: var(--border-thick);\n}\n\n._1gInQYSeS220Gh9DnVEr5W {\n --avatar-size: calc(var(--base-unit) * 1.5);\n}\n\n._2jL6zuod0FYzAcQ9jHlwr0 {\n color: var(--color-text--reverse);\n}\n\n._1EBgtTAVncoq5YcW-R48zh {\n font-size: calc(calc(var(--base-unit) * 2) / 2);\n font-size: calc(calc(var(--base-unit) * 2) / 2);\n font-size: calc(var(--avatar-size) / 2);\n text-transform: uppercase;\n}\n\n._3w35jLfoUs-eucNNL23qUF {\n font-size: calc(calc(var(--base-unit) * 2) / 2.25);\n font-size: calc(calc(var(--base-unit) * 2) / 2.25);\n font-size: calc(var(--avatar-size) / 2.25);\n}\n\n.cAt2tRNytCx33iuuBj2aM {\n width: calc(calc(var(--base-unit) * 2) - (var(--border-base) * 2));\n width: calc(calc(var(--base-unit) * 2) - (var(--border-base) * 2));\n width: calc(var(--avatar-size) - (var(--avatar-border-size) * 2));\n height: calc(calc(var(--base-unit) * 2) - (var(--border-base) * 2));\n height: calc(calc(var(--base-unit) * 2) - (var(--border-base) * 2));\n height: calc(var(--avatar-size) - (var(--avatar-border-size) * 2));\n box-shadow: 0 0 0 var(--border-thick) var(--color-white) inset;\n border-style: solid;\n border-width: var(--border-base);\n border-width: var(--border-base);\n border-width: var(--avatar-border-size);\n}\n";
|
|
16
|
+
var styles = {"avatar":"_32nXNk9U4V8Tn_oqzj-1Vv","large":"_3JfcxzHXbxVujP9Nwwsm8d","small":"_1gInQYSeS220Gh9DnVEr5W","isDark":"_2jL6zuod0FYzAcQ9jHlwr0","initials":"_1EBgtTAVncoq5YcW-R48zh","smallInitials":"_3w35jLfoUs-eucNNL23qUF","hasBorder":"cAt2tRNytCx33iuuBj2aM"};
|
|
17
|
+
styleInject_es.styleInject(css);
|
|
18
|
+
|
|
19
|
+
function isDark(colorToCheck) {
|
|
20
|
+
if (colorToCheck == undefined) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
if (colorToCheck) {
|
|
24
|
+
try {
|
|
25
|
+
return Color__default["default"](deconstructCssCustomProperty(colorToCheck)).isDark();
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
console.log(err);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
function deconstructCssCustomProperty(color) {
|
|
34
|
+
if (!color) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!color.toLowerCase().startsWith("var(")) {
|
|
38
|
+
return color;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Rips apart the `var(--custom-property)` into just `--custom-property`.
|
|
42
|
+
*/
|
|
43
|
+
var customProperty = color
|
|
44
|
+
.replace("var(", "")
|
|
45
|
+
.slice(0, -1)
|
|
46
|
+
.split(" ")
|
|
47
|
+
.join("");
|
|
48
|
+
return getComputedStyle(document.documentElement)
|
|
49
|
+
.getPropertyValue(customProperty)
|
|
50
|
+
.trim();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function Avatar(_a) {
|
|
54
|
+
var _b;
|
|
55
|
+
var imageUrl = _a.imageUrl, name = _a.name, initials = _a.initials, _c = _a.size, size = _c === void 0 ? "base" : _c, color = _a.color;
|
|
56
|
+
var style = {
|
|
57
|
+
backgroundColor: color,
|
|
58
|
+
borderColor: color,
|
|
59
|
+
};
|
|
60
|
+
if (imageUrl) {
|
|
61
|
+
style.backgroundImage = "url(" + imageUrl + ")";
|
|
62
|
+
}
|
|
63
|
+
var shouldBeDark = color == undefined || isDark(color);
|
|
64
|
+
var className = classnames__default["default"](styles.avatar, size !== "base" && styles[size], (_b = {},
|
|
65
|
+
_b[styles.hasBorder] = imageUrl && color,
|
|
66
|
+
_b[styles.isDark] = shouldBeDark,
|
|
67
|
+
_b));
|
|
68
|
+
return (React__default["default"].createElement("div", { className: className, style: style, role: imageUrl && "img", "aria-label": name }, !imageUrl && (React__default["default"].createElement(Initials, { initials: initials, dark: shouldBeDark, iconSize: size }))));
|
|
69
|
+
}
|
|
70
|
+
function Initials(_a) {
|
|
71
|
+
var _b;
|
|
72
|
+
var initials = _a.initials, _c = _a.dark, dark = _c === void 0 ? false : _c, _d = _a.iconSize, iconSize = _d === void 0 ? "base" : _d;
|
|
73
|
+
if (!initials) {
|
|
74
|
+
return (React__default["default"].createElement(Icon.Icon, { name: "person", color: dark ? "white" : "blue", size: iconSize }));
|
|
75
|
+
}
|
|
76
|
+
var className = classnames__default["default"](styles.initials, (_b = {},
|
|
77
|
+
_b[styles.smallInitials] = initials.length > 2,
|
|
78
|
+
_b));
|
|
79
|
+
return React__default["default"].createElement("span", { className: className }, initials.substr(0, 3));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
exports.Avatar = Avatar;
|
package/dist/Banner/Banner.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { ButtonProps } from "../Button";
|
|
3
|
-
export declare type BannerType = "notice" | "success" | "warning" | "error";
|
|
4
|
-
interface BannerProps {
|
|
5
|
-
readonly children: ReactNode;
|
|
6
|
-
readonly type: BannerType;
|
|
7
|
-
/**
|
|
8
|
-
* The default cta variation should be a 'work' variation. If the banner
|
|
9
|
-
* 'type' is set to 'notice' we change the cta variation to 'learning'
|
|
10
|
-
*/
|
|
11
|
-
readonly primaryAction?: ButtonProps;
|
|
12
|
-
/**
|
|
13
|
-
* @default true
|
|
14
|
-
*/
|
|
15
|
-
readonly dismissible?: boolean;
|
|
16
|
-
onDismiss?(): void;
|
|
17
|
-
}
|
|
18
|
-
export declare function Banner({ children, type, primaryAction, dismissible, onDismiss, }: BannerProps): JSX.Element;
|
|
19
|
-
export {};
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { ButtonProps } from "../Button";
|
|
3
|
+
export declare type BannerType = "notice" | "success" | "warning" | "error";
|
|
4
|
+
interface BannerProps {
|
|
5
|
+
readonly children: ReactNode;
|
|
6
|
+
readonly type: BannerType;
|
|
7
|
+
/**
|
|
8
|
+
* The default cta variation should be a 'work' variation. If the banner
|
|
9
|
+
* 'type' is set to 'notice' we change the cta variation to 'learning'
|
|
10
|
+
*/
|
|
11
|
+
readonly primaryAction?: ButtonProps;
|
|
12
|
+
/**
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
readonly dismissible?: boolean;
|
|
16
|
+
onDismiss?(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare function Banner({ children, type, primaryAction, dismissible, onDismiss, }: BannerProps): JSX.Element;
|
|
19
|
+
export {};
|
package/dist/Banner/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Banner, BannerType } from "./Banner";
|
|
1
|
+
export { Banner, BannerType } from "./Banner";
|
package/dist/Banner/index.js
CHANGED
|
@@ -2,79 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __chunk_1 = require('../chunk-b67af3cb.js');
|
|
5
|
+
var tslib_es6 = require('../tslib.es6-5b50eb8e.js');
|
|
8
6
|
var React = require('react');
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
require('../
|
|
13
|
-
var
|
|
7
|
+
var classnames = require('classnames');
|
|
8
|
+
var hooks = require('@jobber/hooks');
|
|
9
|
+
var styleInject_es = require('../style-inject.es-dcee06b6.js');
|
|
10
|
+
var Icon = require('../Icon-d5ad1a6d.js');
|
|
11
|
+
var Text = require('../Text-9bc093e9.js');
|
|
12
|
+
var Button = require('../Button-5b2f1636.js');
|
|
14
13
|
require('@jobber/design');
|
|
15
|
-
|
|
14
|
+
require('../Typography-7e542a72.js');
|
|
16
15
|
require('react-router-dom');
|
|
17
|
-
var index$5 = require('../Button/index.js');
|
|
18
|
-
var hooks = require('@jobber/hooks');
|
|
19
16
|
|
|
20
|
-
|
|
17
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
|
+
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
20
|
+
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
21
|
+
|
|
22
|
+
var css$1 = ":root {\n --flash--inset: var(--space-base);\n --flash--inset--small: var(--space-small);\n}\n\n._364vcgV1m5AeWxKbtAvmwW {\n display: -ms-flexbox;\n display: flex;\n position: relative;\n box-shadow: var(--shadow-base);\n padding: var(--space-base);\n padding: var(--space-base);\n padding: var(--flash--inset);\n color: var(--color-black);\n background-color: var(--color-grey--lightest);\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n._3vGMT9on-QbjXBlSaiNcgm {\n display: -ms-flexbox;\n display: flex;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n._3GnUCvx5Y7mFbH2Z7IN5U- {\n padding-top: var(--space-smallest);\n padding-right: var(--space-base);\n padding-right: var(--space-base);\n padding-right: var(--flash--inset);\n}\n\n._3vGMT9on-QbjXBlSaiNcgm > * {\n margin-top: var(--space-small);\n margin-top: var(--space-small);\n margin-top: var(--flash--inset--small);\n margin-bottom: var(--space-small);\n margin-bottom: var(--space-small);\n margin-bottom: var(--flash--inset--small);\n}\n\n._3vGMT9on-QbjXBlSaiNcgm > *:first-child {\n margin-top: 0;\n margin-right: var(--space-base);\n}\n\n._3vGMT9on-QbjXBlSaiNcgm > *:last-child {\n margin-bottom: 0;\n}\n\n._1S5EoHZng2ePaBlNMXhUYb ._3vGMT9on-QbjXBlSaiNcgm {\n -ms-flex-wrap: nowrap;\n flex-wrap: nowrap;\n}\n\n._1S5EoHZng2ePaBlNMXhUYb ._3vGMT9on-QbjXBlSaiNcgm > * {\n margin-top: 0;\n margin-bottom: 0;\n}\n\n._12QzEnq3z7-XCpLmgYARp {\n display: -ms-flexbox;\n display: flex;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n}\n\n._2MtsHfzp46XdG3BZQtOLm- {\n padding: var(--space-smallest);\n border: none;\n background-color: transparent;\n cursor: pointer;\n -webkit-appearance: none;\n -moz-appearance: none;\n appearance: none;\n -ms-flex: 0;\n flex: 0;\n}\n\n._2MtsHfzp46XdG3BZQtOLm-:hover {\n background: rgba(0, 0, 0, 0.025);\n}\n\n._2MtsHfzp46XdG3BZQtOLm-:focus {\n box-shadow: var(--shadow-focus);\n outline: none;\n background: rgba(0, 0, 0, 0.05);\n}\n";
|
|
21
23
|
var styles = {"flash":"_364vcgV1m5AeWxKbtAvmwW","bannerContent":"_3vGMT9on-QbjXBlSaiNcgm","dismissibleSpacing":"_3GnUCvx5Y7mFbH2Z7IN5U-","medium":"_1S5EoHZng2ePaBlNMXhUYb","bannerAction":"_12QzEnq3z7-XCpLmgYARp","closeButton":"_2MtsHfzp46XdG3BZQtOLm-"};
|
|
22
|
-
|
|
24
|
+
styleInject_es.styleInject(css$1);
|
|
23
25
|
|
|
24
|
-
var css
|
|
26
|
+
var css = ".nw7Tf4jicBNmfENtxh7tG {\n background-color: var(--color-informative--surface);\n}\n\n/* Our Banner \"surface\" colors should be lighter than they are so we're leaving the following alone for now */\n\n.myY4eq0vr_r4Twz0QcBwu {\n background-color: var(--color-green--lighter);\n}\n\n.eExwEf69eCfam2C6Ekk5D {\n background-color: var(--color-yellow--lighter);\n}\n\n._1U_-uPZepxvaZPO5hh8G4O {\n background-color: var(--color-red--lighter);\n}\n";
|
|
25
27
|
var types = {"notice":"nw7Tf4jicBNmfENtxh7tG","success":"myY4eq0vr_r4Twz0QcBwu","warning":"eExwEf69eCfam2C6Ekk5D","error":"_1U_-uPZepxvaZPO5hh8G4O"};
|
|
26
|
-
|
|
28
|
+
styleInject_es.styleInject(css);
|
|
27
29
|
|
|
28
|
-
function Banner(_a) {
|
|
29
|
-
var _b, _c;
|
|
30
|
-
var children = _a.children, type = _a.type, primaryAction = _a.primaryAction, _d = _a.dismissible, dismissible = _d === void 0 ? true : _d, onDismiss = _a.onDismiss;
|
|
31
|
-
var _e =
|
|
32
|
-
var bannerWidths = {
|
|
33
|
-
small: 320,
|
|
34
|
-
medium: 480,
|
|
35
|
-
};
|
|
36
|
-
var _f =
|
|
37
|
-
widths: bannerWidths,
|
|
38
|
-
}), 2), bannerRef = _f[0], _g = _f[1].width, bannerWidth = _g === void 0 ? bannerWidths.small : _g;
|
|
39
|
-
var iconColors = {
|
|
40
|
-
notice: "lightBlue",
|
|
41
|
-
success: "green",
|
|
42
|
-
warning: "yellow",
|
|
43
|
-
error: "red",
|
|
44
|
-
};
|
|
45
|
-
if (primaryAction != undefined) {
|
|
46
|
-
primaryAction = Object.assign({
|
|
47
|
-
size: "small",
|
|
48
|
-
type: "tertiary",
|
|
49
|
-
variation: type === "notice" ? "learning" : "work",
|
|
50
|
-
}, primaryAction);
|
|
51
|
-
}
|
|
52
|
-
var flashClassNames =
|
|
53
|
-
_b[styles.medium] = bannerWidth >= bannerWidths.medium,
|
|
54
|
-
_b));
|
|
55
|
-
var contentClassNames =
|
|
56
|
-
_c[styles.dismissibleSpacing] = dismissible,
|
|
57
|
-
_c));
|
|
58
|
-
return (React__default.createElement(React__default.Fragment, null, showFlash && (React__default.createElement("div", { className: flashClassNames, ref: bannerRef, role: type === "error" ? "alert" : "status" },
|
|
59
|
-
React__default.createElement("div", { className: contentClassNames },
|
|
60
|
-
React__default.createElement(BannerChildren, null, children),
|
|
61
|
-
primaryAction && (React__default.createElement("div", { className: styles.bannerAction },
|
|
62
|
-
React__default.createElement(
|
|
63
|
-
dismissible && (React__default.createElement("button", { className: styles.closeButton, onClick: handleClose, "aria-label": "Close this notification" },
|
|
64
|
-
React__default.createElement(
|
|
65
|
-
function handleClose() {
|
|
66
|
-
setShowFlash(!showFlash);
|
|
67
|
-
onDismiss && onDismiss();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function BannerChildren(_a) {
|
|
71
|
-
var children = _a.children;
|
|
72
|
-
if (!children)
|
|
73
|
-
return React__default.createElement(React__default.Fragment, null);
|
|
74
|
-
if (children && typeof children === "string") {
|
|
75
|
-
return React__default.createElement(
|
|
76
|
-
}
|
|
77
|
-
return React__default.createElement(React__default.Fragment, null, children);
|
|
30
|
+
function Banner(_a) {
|
|
31
|
+
var _b, _c;
|
|
32
|
+
var children = _a.children, type = _a.type, primaryAction = _a.primaryAction, _d = _a.dismissible, dismissible = _d === void 0 ? true : _d, onDismiss = _a.onDismiss;
|
|
33
|
+
var _e = tslib_es6.__read(React.useState(true), 2), showFlash = _e[0], setShowFlash = _e[1];
|
|
34
|
+
var bannerWidths = {
|
|
35
|
+
small: 320,
|
|
36
|
+
medium: 480,
|
|
37
|
+
};
|
|
38
|
+
var _f = tslib_es6.__read(hooks.useResizeObserver({
|
|
39
|
+
widths: bannerWidths,
|
|
40
|
+
}), 2), bannerRef = _f[0], _g = _f[1].width, bannerWidth = _g === void 0 ? bannerWidths.small : _g;
|
|
41
|
+
var iconColors = {
|
|
42
|
+
notice: "lightBlue",
|
|
43
|
+
success: "green",
|
|
44
|
+
warning: "yellow",
|
|
45
|
+
error: "red",
|
|
46
|
+
};
|
|
47
|
+
if (primaryAction != undefined) {
|
|
48
|
+
primaryAction = Object.assign({
|
|
49
|
+
size: "small",
|
|
50
|
+
type: "tertiary",
|
|
51
|
+
variation: type === "notice" ? "learning" : "work",
|
|
52
|
+
}, primaryAction);
|
|
53
|
+
}
|
|
54
|
+
var flashClassNames = classnames__default["default"](styles.flash, types[type], (_b = {},
|
|
55
|
+
_b[styles.medium] = bannerWidth >= bannerWidths.medium,
|
|
56
|
+
_b));
|
|
57
|
+
var contentClassNames = classnames__default["default"](styles.bannerContent, (_c = {},
|
|
58
|
+
_c[styles.dismissibleSpacing] = dismissible,
|
|
59
|
+
_c));
|
|
60
|
+
return (React__default["default"].createElement(React__default["default"].Fragment, null, showFlash && (React__default["default"].createElement("div", { className: flashClassNames, ref: bannerRef, role: type === "error" ? "alert" : "status" },
|
|
61
|
+
React__default["default"].createElement("div", { className: contentClassNames },
|
|
62
|
+
React__default["default"].createElement(BannerChildren, null, children),
|
|
63
|
+
primaryAction && (React__default["default"].createElement("div", { className: styles.bannerAction },
|
|
64
|
+
React__default["default"].createElement(Button.Button, tslib_es6.__assign({}, primaryAction))))),
|
|
65
|
+
dismissible && (React__default["default"].createElement("button", { className: styles.closeButton, onClick: handleClose, "aria-label": "Close this notification" },
|
|
66
|
+
React__default["default"].createElement(Icon.Icon, { name: "cross", color: iconColors[type] })))))));
|
|
67
|
+
function handleClose() {
|
|
68
|
+
setShowFlash(!showFlash);
|
|
69
|
+
onDismiss && onDismiss();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function BannerChildren(_a) {
|
|
73
|
+
var children = _a.children;
|
|
74
|
+
if (!children)
|
|
75
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null);
|
|
76
|
+
if (children && typeof children === "string") {
|
|
77
|
+
return React__default["default"].createElement(Text.Text, null, children);
|
|
78
|
+
}
|
|
79
|
+
return React__default["default"].createElement(React__default["default"].Fragment, null, children);
|
|
78
80
|
}
|
|
79
81
|
|
|
80
82
|
exports.Banner = Banner;
|
package/dist/Button/Button.d.ts
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { XOR } from "ts-xor";
|
|
3
|
-
import { IconNames } from "@jobber/design";
|
|
4
|
-
interface ButtonFoundationProps {
|
|
5
|
-
/**
|
|
6
|
-
* Used for screen readers. Will override label on screen
|
|
7
|
-
* reader if present.
|
|
8
|
-
*/
|
|
9
|
-
readonly ariaLabel?: string;
|
|
10
|
-
readonly ariaControls?: string;
|
|
11
|
-
readonly ariaHaspopup?: boolean;
|
|
12
|
-
readonly ariaExpanded?: boolean;
|
|
13
|
-
readonly disabled?: boolean;
|
|
14
|
-
readonly external?: boolean;
|
|
15
|
-
readonly fullWidth?: boolean;
|
|
16
|
-
readonly icon?: IconNames;
|
|
17
|
-
readonly iconOnRight?: boolean;
|
|
18
|
-
readonly id?: string;
|
|
19
|
-
readonly label?: string;
|
|
20
|
-
readonly loading?: boolean;
|
|
21
|
-
readonly size?: "small" | "base" | "large";
|
|
22
|
-
onClick?(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>): void;
|
|
23
|
-
onMouseDown?(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>): void;
|
|
24
|
-
}
|
|
25
|
-
interface ButtonIconProps extends ButtonFoundationProps {
|
|
26
|
-
readonly icon: IconNames;
|
|
27
|
-
readonly ariaLabel: string;
|
|
28
|
-
}
|
|
29
|
-
interface ButtonLabelProps extends ButtonFoundationProps {
|
|
30
|
-
readonly label: string;
|
|
31
|
-
}
|
|
32
|
-
interface ButtonAnchorProps extends ButtonFoundationProps {
|
|
33
|
-
/**
|
|
34
|
-
* Used to create an 'href' on an anchor tag.
|
|
35
|
-
*/
|
|
36
|
-
readonly url?: string;
|
|
37
|
-
}
|
|
38
|
-
interface ButtonLinkProps extends ButtonFoundationProps {
|
|
39
|
-
/**
|
|
40
|
-
* Used for client side routing. Only use when inside a routed component.
|
|
41
|
-
*/
|
|
42
|
-
readonly to?: string;
|
|
43
|
-
}
|
|
44
|
-
interface BaseActionProps extends ButtonFoundationProps {
|
|
45
|
-
readonly variation?: "work" | "learning" | "subtle" | "destructive";
|
|
46
|
-
readonly type?: "primary" | "secondary" | "tertiary";
|
|
47
|
-
}
|
|
48
|
-
interface DestructiveActionProps extends ButtonFoundationProps {
|
|
49
|
-
readonly variation: "destructive";
|
|
50
|
-
readonly type?: "primary" | "secondary" | "tertiary";
|
|
51
|
-
}
|
|
52
|
-
interface SubmitActionProps extends Omit<ButtonFoundationProps, "external" | "onClick"> {
|
|
53
|
-
readonly type?: "primary";
|
|
54
|
-
readonly submit: boolean;
|
|
55
|
-
}
|
|
56
|
-
interface SubmitButtonProps extends Omit<ButtonFoundationProps, "external" | "onClick"> {
|
|
57
|
-
/**
|
|
58
|
-
* Allows the button to submit a form
|
|
59
|
-
*/
|
|
60
|
-
submit: boolean;
|
|
61
|
-
}
|
|
62
|
-
export declare type ButtonProps = XOR<BaseActionProps, XOR<DestructiveActionProps, SubmitActionProps>> & XOR<SubmitButtonProps, XOR<ButtonLinkProps, ButtonAnchorProps>> & XOR<ButtonIconProps, ButtonLabelProps>;
|
|
63
|
-
export declare function Button(props: ButtonProps): JSX.Element;
|
|
64
|
-
export {};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { XOR } from "ts-xor";
|
|
3
|
+
import { IconNames } from "@jobber/design";
|
|
4
|
+
interface ButtonFoundationProps {
|
|
5
|
+
/**
|
|
6
|
+
* Used for screen readers. Will override label on screen
|
|
7
|
+
* reader if present.
|
|
8
|
+
*/
|
|
9
|
+
readonly ariaLabel?: string;
|
|
10
|
+
readonly ariaControls?: string;
|
|
11
|
+
readonly ariaHaspopup?: boolean;
|
|
12
|
+
readonly ariaExpanded?: boolean;
|
|
13
|
+
readonly disabled?: boolean;
|
|
14
|
+
readonly external?: boolean;
|
|
15
|
+
readonly fullWidth?: boolean;
|
|
16
|
+
readonly icon?: IconNames;
|
|
17
|
+
readonly iconOnRight?: boolean;
|
|
18
|
+
readonly id?: string;
|
|
19
|
+
readonly label?: string;
|
|
20
|
+
readonly loading?: boolean;
|
|
21
|
+
readonly size?: "small" | "base" | "large";
|
|
22
|
+
onClick?(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>): void;
|
|
23
|
+
onMouseDown?(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>): void;
|
|
24
|
+
}
|
|
25
|
+
interface ButtonIconProps extends ButtonFoundationProps {
|
|
26
|
+
readonly icon: IconNames;
|
|
27
|
+
readonly ariaLabel: string;
|
|
28
|
+
}
|
|
29
|
+
interface ButtonLabelProps extends ButtonFoundationProps {
|
|
30
|
+
readonly label: string;
|
|
31
|
+
}
|
|
32
|
+
interface ButtonAnchorProps extends ButtonFoundationProps {
|
|
33
|
+
/**
|
|
34
|
+
* Used to create an 'href' on an anchor tag.
|
|
35
|
+
*/
|
|
36
|
+
readonly url?: string;
|
|
37
|
+
}
|
|
38
|
+
interface ButtonLinkProps extends ButtonFoundationProps {
|
|
39
|
+
/**
|
|
40
|
+
* Used for client side routing. Only use when inside a routed component.
|
|
41
|
+
*/
|
|
42
|
+
readonly to?: string;
|
|
43
|
+
}
|
|
44
|
+
interface BaseActionProps extends ButtonFoundationProps {
|
|
45
|
+
readonly variation?: "work" | "learning" | "subtle" | "destructive";
|
|
46
|
+
readonly type?: "primary" | "secondary" | "tertiary";
|
|
47
|
+
}
|
|
48
|
+
interface DestructiveActionProps extends ButtonFoundationProps {
|
|
49
|
+
readonly variation: "destructive";
|
|
50
|
+
readonly type?: "primary" | "secondary" | "tertiary";
|
|
51
|
+
}
|
|
52
|
+
interface SubmitActionProps extends Omit<ButtonFoundationProps, "external" | "onClick"> {
|
|
53
|
+
readonly type?: "primary";
|
|
54
|
+
readonly submit: boolean;
|
|
55
|
+
}
|
|
56
|
+
interface SubmitButtonProps extends Omit<ButtonFoundationProps, "external" | "onClick"> {
|
|
57
|
+
/**
|
|
58
|
+
* Allows the button to submit a form
|
|
59
|
+
*/
|
|
60
|
+
submit: boolean;
|
|
61
|
+
}
|
|
62
|
+
export declare type ButtonProps = XOR<BaseActionProps, XOR<DestructiveActionProps, SubmitActionProps>> & XOR<SubmitButtonProps, XOR<ButtonLinkProps, ButtonAnchorProps>> & XOR<ButtonIconProps, ButtonLabelProps>;
|
|
63
|
+
export declare function Button(props: ButtonProps): JSX.Element;
|
|
64
|
+
export {};
|
package/dist/Button/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./Button";
|
|
1
|
+
export * from "./Button";
|