@skyscanner/backpack-web 42.1.0 → 42.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/bpk-component-banner-alert/src/BpkBannerAlert.js +0 -7
- package/bpk-component-breakpoint/src/BpkBreakpoint.js +3 -1
- package/bpk-component-calendar/src/utils.js +1 -1
- package/bpk-component-card/index.d.ts +4 -1
- package/bpk-component-card/index.js +3 -1
- package/bpk-component-card/src/BpkCardV2/BpkCardV2.d.ts +27 -0
- package/bpk-component-card/src/BpkCardV2/BpkCardV2.js +57 -0
- package/bpk-component-card/src/BpkCardV2/BpkCardV2.module.css +18 -0
- package/bpk-component-card/src/BpkCardV2/common-types.d.ts +124 -0
- package/bpk-component-card/src/BpkCardV2/common-types.js +102 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Body.d.ts +36 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Body.js +65 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Divider.d.ts +13 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Divider.js +37 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Footer.d.ts +24 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Footer.js +60 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Header.d.ts +24 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Header.js +60 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Root.d.ts +28 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Root.js +68 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Section.d.ts +22 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/Section.js +53 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/resolveDirectionalPadding.d.ts +16 -0
- package/bpk-component-card/src/BpkCardV2/subcomponents/resolveDirectionalPadding.js +32 -0
- package/bpk-component-card-list/src/BpkCardList.module.css +1 -1
- package/bpk-component-card-list/src/BpkCardListRowRail/BpkCardListCarousel.js +3 -3
- package/bpk-component-chat-bubble/index.d.ts +4 -0
- package/bpk-component-chat-bubble/index.js +21 -0
- package/bpk-component-chat-bubble/src/BpkChatBubble.d.ts +3 -0
- package/bpk-component-chat-bubble/src/BpkChatBubble.js +107 -0
- package/bpk-component-chat-bubble/src/BpkChatBubble.module.css +18 -0
- package/bpk-component-chat-bubble/src/common-types.d.ts +55 -0
- package/bpk-component-chat-bubble/src/common-types.js +29 -0
- package/bpk-component-chatbot-input/index.d.ts +7 -0
- package/bpk-component-chatbot-input/index.js +23 -0
- package/bpk-component-chatbot-input/src/BpkChatbotInput.d.ts +4 -0
- package/bpk-component-chatbot-input/src/BpkChatbotInput.js +118 -0
- package/bpk-component-chatbot-input/src/BpkChatbotInput.module.css +18 -0
- package/bpk-component-chatbot-input/src/InputField/InputField.d.ts +3 -0
- package/bpk-component-chatbot-input/src/InputField/InputField.js +82 -0
- package/bpk-component-chatbot-input/src/InputField/InputField.module.css +18 -0
- package/bpk-component-chatbot-input/src/SendButton/SendButton.d.ts +9 -0
- package/bpk-component-chatbot-input/src/SendButton/SendButton.js +47 -0
- package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.d.ts +10 -0
- package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.js +93 -0
- package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.module.css +18 -0
- package/bpk-component-chatbot-input/src/common-types.d.ts +37 -0
- package/bpk-component-chatbot-input/src/common-types.js +23 -0
- package/bpk-component-chatbot-input/src/constants.d.ts +5 -0
- package/bpk-component-chatbot-input/src/constants.js +22 -0
- package/bpk-component-chatbot-input/src/hooks/index.d.ts +4 -0
- package/bpk-component-chatbot-input/src/hooks/index.js +22 -0
- package/bpk-component-chatbot-input/src/hooks/useChatbotInput.d.ts +32 -0
- package/bpk-component-chatbot-input/src/hooks/useChatbotInput.js +111 -0
- package/bpk-component-chatbot-input/src/hooks/useChatbotInputManager.d.ts +20 -0
- package/bpk-component-chatbot-input/src/hooks/useChatbotInputManager.js +83 -0
- package/bpk-component-chatbot-input/src/hooks/useInputHandlers.d.ts +8 -0
- package/bpk-component-chatbot-input/src/hooks/useInputHandlers.js +54 -0
- package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.d.ts +22 -0
- package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.js +137 -0
- package/bpk-component-chatbot-input/src/themeAttributes.d.ts +14 -0
- package/bpk-component-chatbot-input/src/themeAttributes.js +34 -0
- package/bpk-component-checkbox/index.d.ts +8 -8
- package/bpk-component-checkbox/index.js +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2.d.ts +9 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckbox.js → BpkCheckboxV2.js} +14 -14
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Control.d.ts +6 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxControl.js → BpkCheckboxV2Control.js} +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Description.d.ts +6 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxDescription.js → BpkCheckboxV2Description.js} +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2HiddenInput.d.ts +2 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxHiddenInput.js → BpkCheckboxV2HiddenInput.js} +2 -2
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Indicator.d.ts +2 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxIndicator.js → BpkCheckboxV2Indicator.js} +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Label.d.ts +6 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxLabel.js → BpkCheckboxV2Label.js} +3 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Root.d.ts +16 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxRoot.js → BpkCheckboxV2Root.js} +3 -3
- package/bpk-component-checkbox-card/src/BpkCheckboxCard.module.css +1 -1
- package/bpk-component-floating-notification/index.d.ts +2 -1
- package/bpk-component-floating-notification/index.js +2 -1
- package/bpk-component-floating-notification/src/BpkFloatingNotification.d.ts +5 -0
- package/bpk-component-floating-notification/src/BpkFloatingNotification.js +8 -2
- package/bpk-component-floating-notification/src/BpkFloatingNotification.module.css +1 -1
- package/bpk-component-icon/scripts/generate-figma-connect.js +267 -0
- package/bpk-component-info-banner/src/BpkInfoBanner.module.css +1 -1
- package/bpk-component-info-banner/src/BpkInfoBannerInner.js +8 -3
- package/bpk-component-info-banner/src/common-types.d.ts +1 -0
- package/bpk-component-info-banner/src/common-types.js +2 -1
- package/bpk-component-inset-banner/index.d.ts +4 -1
- package/bpk-component-inset-banner/index.js +2 -1
- package/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.d.ts +56 -0
- package/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.js +118 -0
- package/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.module.css +18 -0
- package/bpk-component-layout/src/BpkProvider.d.ts +9 -4
- package/bpk-component-layout/src/BpkProvider.js +87 -8
- package/bpk-component-layout/src/types.d.ts +2 -2
- package/bpk-component-link/src/common-types.d.ts +1 -1
- package/bpk-component-modal/index.d.ts +3 -1
- package/bpk-component-modal/index.js +3 -1
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3.d.ts +14 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3.js +43 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Body/BpkModalV3Body.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Body/BpkModalV3Body.js +30 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Body/BpkModalV3Body.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.js +49 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3CloseTrigger/BpkModalV3CloseTrigger.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.js +38 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Content/BpkModalV3Content.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Context.d.ts +3 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Context.js +22 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Description/BpkModalV3Description.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Description/BpkModalV3Description.js +28 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Header/BpkModalV3Header.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Header/BpkModalV3Header.js +34 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Header/BpkModalV3Header.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3HeroImage/BpkModalV3HeroImage.d.ts +10 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3HeroImage/BpkModalV3HeroImage.js +44 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3HeroImage/BpkModalV3HeroImage.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Portal/BpkModalV3Portal.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Portal/BpkModalV3Portal.js +26 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/BpkModalV3Root.d.ts +13 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/BpkModalV3Root.js +67 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/useBodyLock.d.ts +9 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Root/useBodyLock.js +69 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.d.ts +2 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.js +32 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Scrim/BpkModalV3Scrim.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.js +31 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Title/BpkModalV3Title.module.css +18 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Trigger/BpkModalV3Trigger.d.ts +8 -0
- package/bpk-component-modal/src/BpkModalV3/BpkModalV3Trigger/BpkModalV3Trigger.js +30 -0
- package/bpk-component-modal/src/BpkModalV3/common-types.d.ts +7 -0
- package/bpk-component-modal/src/BpkModalV3/common-types.js +24 -0
- package/bpk-component-page-indicator/src/NavButton.d.ts +2 -1
- package/bpk-component-segmented-control/src/BpkSegmentedControlV2/BpkSegmentedControlV2.js +37 -16
- package/bpk-component-skeleton/src/BpkBaseSkeleton.d.d.ts +1 -0
- package/bpk-component-skeleton/src/BpkSkeleton.d.d.ts +1 -0
- package/bpk-component-table/index.d.ts +2 -1
- package/bpk-component-table/index.js +2 -1
- package/bpk-component-table/src/BpkTable.module.css +1 -1
- package/bpk-component-table/src/BpkTableBody.d.ts +4 -1
- package/bpk-component-table/src/BpkTableBody.js +19 -4
- package/bpk-component-table/src/common-types.d.ts +5 -0
- package/bpk-component-table/src/common-types.js +22 -0
- package/bpk-react-utils/src/Portal.d.ts +1 -1
- package/package.json +2 -2
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckbox.d.ts +0 -9
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxControl.d.ts +0 -6
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxDescription.d.ts +0 -6
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxHiddenInput.d.ts +0 -2
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxIndicator.d.ts +0 -2
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxLabel.d.ts +0 -6
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxRoot.d.ts +0 -16
- /package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckbox.module.css → BpkCheckboxV2.module.css} +0 -0
package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxLabel.js → BpkCheckboxV2Label.js}
RENAMED
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
import { Checkbox } from '@ark-ui/react';
|
|
20
20
|
import { cssModules } from "../../../bpk-react-utils";
|
|
21
|
-
import STYLES from "./
|
|
21
|
+
import STYLES from "./BpkCheckboxV2.module.css";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
const getClassName = cssModules(STYLES);
|
|
24
|
-
const
|
|
24
|
+
const BpkCheckboxV2Label = ({
|
|
25
25
|
children
|
|
26
26
|
}) => /*#__PURE__*/_jsx(Checkbox.Label, {
|
|
27
27
|
className: getClassName('bpk-checkbox-v2__label'),
|
|
28
28
|
children: children
|
|
29
29
|
});
|
|
30
|
-
export default
|
|
30
|
+
export default BpkCheckboxV2Label;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type BpkCheckboxV2CheckedState = boolean | 'indeterminate';
|
|
3
|
+
export type BpkCheckboxV2RootProps = {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
checked?: BpkCheckboxV2CheckedState;
|
|
6
|
+
defaultChecked?: BpkCheckboxV2CheckedState;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
id?: string;
|
|
9
|
+
invalid?: boolean;
|
|
10
|
+
name?: string;
|
|
11
|
+
onCheckedChange?: (checked: BpkCheckboxV2CheckedState) => void;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
value?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const BpkCheckboxV2Root: ({ checked, children, defaultChecked, disabled, id, invalid, name, onCheckedChange, required, value, }: BpkCheckboxV2RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default BpkCheckboxV2Root;
|
package/bpk-component-checkbox/src/BpkCheckboxV2/{BpkCheckboxRoot.js → BpkCheckboxV2Root.js}
RENAMED
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
|
|
19
19
|
import { Checkbox } from '@ark-ui/react';
|
|
20
20
|
import { cssModules, getDataComponentAttribute } from "../../../bpk-react-utils";
|
|
21
|
-
import STYLES from "./
|
|
21
|
+
import STYLES from "./BpkCheckboxV2.module.css";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
const getClassName = cssModules(STYLES);
|
|
24
|
-
const
|
|
24
|
+
const BpkCheckboxV2Root = ({
|
|
25
25
|
checked,
|
|
26
26
|
children,
|
|
27
27
|
defaultChecked,
|
|
@@ -46,4 +46,4 @@ const BpkCheckboxRoot = ({
|
|
|
46
46
|
...getDataComponentAttribute('CheckboxV2'),
|
|
47
47
|
children: children
|
|
48
48
|
});
|
|
49
|
-
export default
|
|
49
|
+
export default BpkCheckboxV2Root;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-checkbox-card-root{position:relative;display:block;min-width:2.75rem;height:100%;min-height:2.75rem;transition:background-color 200ms ease-in-out,border-color 200ms ease-in-out,color 200ms ease-in-out;border:1px solid var(--bpk-checkbox-card-default-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-default-background-color, rgb(255, 255, 255));color:var(--bpk-checkbox-card-default-text-color, rgb(22, 22, 22));cursor:pointer;box-sizing:border-box}.bpk-checkbox-card-root:has(:focus-visible){outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-no-touch-support .bpk-checkbox-card-root:not([data-state=checked]):not([data-disabled]):hover:not(:active):not(:disabled),.bpk-no-touch-support .bpk-checkbox-card-root:not([data-state=checked])[data-loading]:hover:not(:active):not(:disabled){border-color:var(--bpk-checkbox-card-hover-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-hover-background-color, rgb(245, 247, 250))}:global(.bpk-no-touch-support) .bpk-checkbox-card-root:not([data-state=checked]):not([data-disabled]):hover:not(:active):not(:disabled),:global(.bpk-no-touch-support) .bpk-checkbox-card-root:not([data-state=checked])[data-loading]:hover:not(:active):not(:disabled){border-color:var(--bpk-checkbox-card-hover-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-hover-background-color, rgb(245, 247, 250))}.bpk-checkbox-card-root[data-state=checked]{border-color:var(--bpk-checkbox-card-checked-border-color, transparent);background-color:var(--bpk-checkbox-card-checked-background-color, rgb(5, 32, 60));color:var(--bpk-checkbox-card-checked-text-color, rgb(255, 255, 255))}.bpk-checkbox-card-root[data-disabled]:not([data-loading]){border-color:var(--bpk-checkbox-card-disabled-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-disabled-background-color, rgb(239, 243, 248));color:var(--bpk-checkbox-card-disabled-text-color, rgba(0, 0, 0, 0.2));cursor:not-allowed}.bpk-checkbox-card-root[data-loading]{cursor:not-allowed}.bpk-checkbox-card-root--radius-square{border-radius:0}.bpk-checkbox-card-root--radius-rounded{border-radius:.75rem}.bpk-checkbox-card-root--on-canvas-default{--bpk-checkbox-card-default-background-color: rgb(255, 255, 255);--bpk-checkbox-card-default-border-color: rgb(193, 199, 207)}.bpk-checkbox-card-root--cars{--bpk-checkbox-card-default-background-color: rgb(255, 255, 255);--bpk-checkbox-card-default-border-color: rgb(193, 199, 207);--bpk-checkbox-card-disabled-border-color: transparent;--bpk-checkbox-card-hover-background-color: rgb(255, 255, 255);--bpk-checkbox-card-hover-border-color: rgb(5, 32, 60);--bpk-checkbox-card-checked-background-color: rgb(255, 255, 255);--bpk-checkbox-card-checked-text-color: rgb(22, 22, 22);--bpk-checkbox-card-checked-border-color: rgb(5, 32, 60);--bpk-checkbox-card-indicator-background-color: rgb(5, 32, 60)}.bpk-checkbox-card-root--cars.bpk-checkbox-card-root--cars--radius-rounded{border-radius:1.5rem}.bpk-checkbox-card-root--cars[data-state=checked]{box-shadow:0 0 0 1px #05203c}.bpk-checkbox-card-root--on-canvas-contrast{--bpk-checkbox-card-default-background-color: rgb(255, 255, 255);--bpk-checkbox-card-hover-background-color: rgb(255, 255, 255);--bpk-checkbox-card-default-border-color: transparent;--bpk-checkbox-card-hover-border-color: rgb(193, 199, 207);--bpk-checkbox-card-disabled-background-color: rgb(239, 243, 248)}.bpk-checkbox-card-root--on-surface-contrast{--bpk-checkbox-card-default-background-color: rgba(255, 255, 255, 0.1);--bpk-checkbox-card-default-text-color: rgb(255, 255, 255);--bpk-checkbox-card-secondary-text-color: rgb(255, 255, 255);--bpk-checkbox-card-hover-background-color: rgb(5, 32, 60);--bpk-checkbox-card-checked-background-color: rgb(0, 98, 227);--bpk-checkbox-card-default-border-color: transparent;--bpk-checkbox-card-hover-border-color: transparent;--bpk-checkbox-card-disabled-border-color: transparent}.bpk-checkbox-card-content{width:100%;padding:.5rem}.bpk-checkbox-card-label{display:-webkit-box;width:100%;color:inherit;text-align:center;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--bpk-label-line-clamp, 2);line-clamp:var(--bpk-label-line-clamp, 2)}.bpk-checkbox-card-label>*{text-align:inherit}.bpk-checkbox-card-description{display:-webkit-box;width:100%;color:var(--bpk-checkbox-card-secondary-text-color, rgb(98, 105, 113));text-align:center;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--bpk-description-line-clamp, 3);line-clamp:var(--bpk-description-line-clamp, 3);margin:0}.bpk-checkbox-card-root[data-state=checked] .bpk-checkbox-card-description{color:inherit}.bpk-checkbox-card-root--cars[data-state=checked] .bpk-checkbox-card-description{color:var(--bpk-checkbox-card-secondary-text-color, rgb(98, 105, 113))}.bpk-checkbox-card-description>*{text-align:inherit}.bpk-checkbox-card-price{display:flex;align-items:center;gap:.25rem}.bpk-checkbox-card-indicator{position:absolute;top:.5rem;
|
|
18
|
+
.bpk-checkbox-card-root{position:relative;display:block;min-width:2.75rem;height:100%;min-height:2.75rem;transition:background-color 200ms ease-in-out,border-color 200ms ease-in-out,color 200ms ease-in-out;border:1px solid var(--bpk-checkbox-card-default-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-default-background-color, rgb(255, 255, 255));color:var(--bpk-checkbox-card-default-text-color, rgb(22, 22, 22));cursor:pointer;box-sizing:border-box}.bpk-checkbox-card-root:has(:focus-visible){outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-no-touch-support .bpk-checkbox-card-root:not([data-state=checked]):not([data-disabled]):hover:not(:active):not(:disabled),.bpk-no-touch-support .bpk-checkbox-card-root:not([data-state=checked])[data-loading]:hover:not(:active):not(:disabled){border-color:var(--bpk-checkbox-card-hover-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-hover-background-color, rgb(245, 247, 250))}:global(.bpk-no-touch-support) .bpk-checkbox-card-root:not([data-state=checked]):not([data-disabled]):hover:not(:active):not(:disabled),:global(.bpk-no-touch-support) .bpk-checkbox-card-root:not([data-state=checked])[data-loading]:hover:not(:active):not(:disabled){border-color:var(--bpk-checkbox-card-hover-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-hover-background-color, rgb(245, 247, 250))}.bpk-checkbox-card-root[data-state=checked]{border-color:var(--bpk-checkbox-card-checked-border-color, transparent);background-color:var(--bpk-checkbox-card-checked-background-color, rgb(5, 32, 60));color:var(--bpk-checkbox-card-checked-text-color, rgb(255, 255, 255))}.bpk-checkbox-card-root[data-disabled]:not([data-loading]){border-color:var(--bpk-checkbox-card-disabled-border-color, rgb(193, 199, 207));background-color:var(--bpk-checkbox-card-disabled-background-color, rgb(239, 243, 248));color:var(--bpk-checkbox-card-disabled-text-color, rgba(0, 0, 0, 0.2));cursor:not-allowed}.bpk-checkbox-card-root[data-loading]{cursor:not-allowed}.bpk-checkbox-card-root--radius-square{border-radius:0}.bpk-checkbox-card-root--radius-rounded{border-radius:.75rem}.bpk-checkbox-card-root--on-canvas-default{--bpk-checkbox-card-default-background-color: rgb(255, 255, 255);--bpk-checkbox-card-default-border-color: rgb(193, 199, 207)}.bpk-checkbox-card-root--cars{--bpk-checkbox-card-default-background-color: rgb(255, 255, 255);--bpk-checkbox-card-default-border-color: rgb(193, 199, 207);--bpk-checkbox-card-disabled-border-color: transparent;--bpk-checkbox-card-hover-background-color: rgb(255, 255, 255);--bpk-checkbox-card-hover-border-color: rgb(5, 32, 60);--bpk-checkbox-card-checked-background-color: rgb(255, 255, 255);--bpk-checkbox-card-checked-text-color: rgb(22, 22, 22);--bpk-checkbox-card-checked-border-color: rgb(5, 32, 60);--bpk-checkbox-card-indicator-background-color: rgb(5, 32, 60)}.bpk-checkbox-card-root--cars.bpk-checkbox-card-root--cars--radius-rounded{border-radius:1.5rem}.bpk-checkbox-card-root--cars[data-state=checked]{box-shadow:0 0 0 1px #05203c}.bpk-checkbox-card-root--on-canvas-contrast{--bpk-checkbox-card-default-background-color: rgb(255, 255, 255);--bpk-checkbox-card-hover-background-color: rgb(255, 255, 255);--bpk-checkbox-card-default-border-color: transparent;--bpk-checkbox-card-hover-border-color: rgb(193, 199, 207);--bpk-checkbox-card-disabled-background-color: rgb(239, 243, 248)}.bpk-checkbox-card-root--on-surface-contrast{--bpk-checkbox-card-default-background-color: rgba(255, 255, 255, 0.1);--bpk-checkbox-card-default-text-color: rgb(255, 255, 255);--bpk-checkbox-card-secondary-text-color: rgb(255, 255, 255);--bpk-checkbox-card-hover-background-color: rgb(5, 32, 60);--bpk-checkbox-card-checked-background-color: rgb(0, 98, 227);--bpk-checkbox-card-default-border-color: transparent;--bpk-checkbox-card-hover-border-color: transparent;--bpk-checkbox-card-disabled-border-color: transparent}.bpk-checkbox-card-content{width:100%;padding:.5rem}.bpk-checkbox-card-label{display:-webkit-box;width:100%;color:inherit;text-align:center;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--bpk-label-line-clamp, 2);line-clamp:var(--bpk-label-line-clamp, 2)}.bpk-checkbox-card-label>*{text-align:inherit}.bpk-checkbox-card-description{display:-webkit-box;width:100%;color:var(--bpk-checkbox-card-secondary-text-color, rgb(98, 105, 113));text-align:center;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--bpk-description-line-clamp, 3);line-clamp:var(--bpk-description-line-clamp, 3);margin:0}.bpk-checkbox-card-root[data-state=checked] .bpk-checkbox-card-description{color:inherit}.bpk-checkbox-card-root--cars[data-state=checked] .bpk-checkbox-card-description{color:var(--bpk-checkbox-card-secondary-text-color, rgb(98, 105, 113))}.bpk-checkbox-card-description>*{text-align:inherit}.bpk-checkbox-card-price{display:flex;align-items:center;gap:.25rem}.bpk-checkbox-card-indicator{position:absolute;top:.5rem;display:none;z-index:1;width:1.25rem;height:1.25rem;inset-inline-end:.5rem;pointer-events:none}.bpk-checkbox-card-indicator svg{width:100%;height:100%;fill:var(--bpk-checkbox-card-indicator-background-color, rgb(0, 98, 227))}.bpk-checkbox-card-root[data-state=checked] .bpk-checkbox-card-indicator{display:block}.bpk-checkbox-card-root--cars .bpk-checkbox-card-indicator{width:1rem;height:1rem}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import BpkFloatingNotification, { type Props as BpkFloatingNotificationProps } from './src/BpkFloatingNotification';
|
|
1
|
+
import BpkFloatingNotification, { NOTIFICATION_TYPES, type Props as BpkFloatingNotificationProps } from './src/BpkFloatingNotification';
|
|
2
2
|
export type { BpkFloatingNotificationProps };
|
|
3
|
+
export { NOTIFICATION_TYPES };
|
|
3
4
|
export default BpkFloatingNotification;
|
|
@@ -14,5 +14,6 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/import BpkFloatingNotification from "./src/BpkFloatingNotification";
|
|
17
|
+
*/import BpkFloatingNotification, { NOTIFICATION_TYPES } from "./src/BpkFloatingNotification";
|
|
18
|
+
export { NOTIFICATION_TYPES };
|
|
18
19
|
export default BpkFloatingNotification;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { MouseEvent, FunctionComponent } from 'react';
|
|
2
|
+
export declare const NOTIFICATION_TYPES: {
|
|
3
|
+
readonly default: "default";
|
|
4
|
+
readonly critical: "critical";
|
|
5
|
+
};
|
|
2
6
|
export type Props = {
|
|
3
7
|
animateOnEnter?: boolean;
|
|
4
8
|
animateOnExit?: boolean;
|
|
@@ -16,6 +20,7 @@ export type Props = {
|
|
|
16
20
|
*/
|
|
17
21
|
onExit?: () => void;
|
|
18
22
|
text: string;
|
|
23
|
+
type?: (typeof NOTIFICATION_TYPES)[keyof typeof NOTIFICATION_TYPES];
|
|
19
24
|
[rest: string]: any;
|
|
20
25
|
};
|
|
21
26
|
declare const BpkFloatingNotification: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -18,13 +18,17 @@
|
|
|
18
18
|
|
|
19
19
|
import { useEffect, useState } from 'react';
|
|
20
20
|
import { CSSTransition } from 'react-transition-group';
|
|
21
|
-
import BpkAriaLive from "../../bpk-component-aria-live";
|
|
21
|
+
import BpkAriaLive, { ARIA_LIVE_POLITENESS_SETTINGS } from "../../bpk-component-aria-live";
|
|
22
22
|
import BpkButton, { BUTTON_TYPES } from "../../bpk-component-button";
|
|
23
23
|
import BpkText, { TEXT_STYLES } from "../../bpk-component-text";
|
|
24
24
|
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
25
25
|
import STYLES from "./BpkFloatingNotification.module.css";
|
|
26
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
27
|
const getClassName = cssModules(STYLES);
|
|
28
|
+
export const NOTIFICATION_TYPES = {
|
|
29
|
+
default: 'default',
|
|
30
|
+
critical: 'critical'
|
|
31
|
+
};
|
|
28
32
|
const BpkFloatingNotification = props => {
|
|
29
33
|
const [showMessage, setShowMessage] = useState(true);
|
|
30
34
|
const {
|
|
@@ -37,9 +41,10 @@ const BpkFloatingNotification = props => {
|
|
|
37
41
|
onClick,
|
|
38
42
|
onExit,
|
|
39
43
|
text,
|
|
44
|
+
type = NOTIFICATION_TYPES.default,
|
|
40
45
|
...rest
|
|
41
46
|
} = props;
|
|
42
|
-
const classNames = getClassName('bpk-floating-notification', className);
|
|
47
|
+
const classNames = getClassName('bpk-floating-notification', type === NOTIFICATION_TYPES.critical && 'bpk-floating-notification--critical', className);
|
|
43
48
|
useEffect(() => {
|
|
44
49
|
let timer;
|
|
45
50
|
if (hideAfter) {
|
|
@@ -78,6 +83,7 @@ const BpkFloatingNotification = props => {
|
|
|
78
83
|
})
|
|
79
84
|
}), /*#__PURE__*/_jsx(BpkAriaLive, {
|
|
80
85
|
"aria-hidden": true,
|
|
86
|
+
politenessSetting: type === NOTIFICATION_TYPES.critical ? ARIA_LIVE_POLITENESS_SETTINGS.assertive : ARIA_LIVE_POLITENESS_SETTINGS.polite,
|
|
81
87
|
children: text
|
|
82
88
|
}), ctaText && /*#__PURE__*/_jsx("div", {
|
|
83
89
|
className: getClassName('bpk-floating-notification__cta'),
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-floating-notification{position:fixed;right:0;bottom:2rem;left:0;display:flex;z-index:2;max-width:25rem;margin:auto;padding:1.5rem;align-items:center;transition:opacity 400ms ease-in-out,transform 400ms ease-in-out;border-radius:.75rem;background:#05203c;color:#fff;box-shadow:0px 12px 50px 0px rgba(37,32,31,.25),0px 4px 14px 0px rgba(37,32,31,.25)}@media(max-width: 32rem){.bpk-floating-notification{max-width:100%;padding:1rem}}.bpk-floating-notification--leave{transform:translateY(0);opacity:1}.bpk-floating-notification--leave-active{transform:translateY(2rem);opacity:0}.bpk-floating-notification--leave-done{opacity:0}.bpk-floating-notification--appear{transform:translateY(2rem);opacity:0}.bpk-floating-notification--appear-active{transform:translateY(0);opacity:1}.bpk-floating-notification__icon{margin-right:.5rem;margin-left:.25rem;flex-shrink:0;transform:translateY(0.25rem);text-align:bottom;fill:#fff}.bpk-floating-notification__text{margin-inline-end:.5rem}.bpk-floating-notification__cta{margin-inline-start:auto}
|
|
18
|
+
.bpk-floating-notification{position:fixed;right:0;bottom:2rem;left:0;display:flex;z-index:2;max-width:25rem;margin:auto;padding:1.5rem;align-items:center;transition:opacity 400ms ease-in-out,transform 400ms ease-in-out;border-radius:.75rem;background:#05203c;color:#fff;box-shadow:0px 12px 50px 0px rgba(37,32,31,.25),0px 4px 14px 0px rgba(37,32,31,.25)}@media(max-width: 32rem){.bpk-floating-notification{max-width:100%;padding:1rem}}.bpk-floating-notification--critical{background-color:#e70866}.bpk-floating-notification--leave{transform:translateY(0);opacity:1}.bpk-floating-notification--leave-active{transform:translateY(2rem);opacity:0}.bpk-floating-notification--leave-done{opacity:0}.bpk-floating-notification--appear{transform:translateY(2rem);opacity:0}.bpk-floating-notification--appear-active{transform:translateY(0);opacity:1}.bpk-floating-notification__icon{margin-right:.5rem;margin-left:.25rem;flex-shrink:0;transform:translateY(0.25rem);text-align:bottom;fill:#fff}.bpk-floating-notification__text{margin-inline-end:.5rem}.bpk-floating-notification__cta{margin-inline-start:auto}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Backpack - Skyscanner's Design System
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2016 Skyscanner Ltd
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Generates Figma Code Connect mappings for Backpack icons.
|
|
23
|
+
*
|
|
24
|
+
* This script fetches component metadata from the Figma Icons file and
|
|
25
|
+
* cross-references it with the icon files in sm/ and lg/ to produce
|
|
26
|
+
* a single .figma.tsx file that maps every icon to its Figma component.
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* FIGMA_ACCESS_TOKEN=<token> node packages/bpk-component-icon/scripts/generate-figma-connect.js
|
|
30
|
+
*
|
|
31
|
+
* The generated file is written to:
|
|
32
|
+
* packages/bpk-component-icon/BpkIcon.figma.tsx
|
|
33
|
+
*/
|
|
34
|
+
const fs = require('fs');
|
|
35
|
+
const path = require('path');
|
|
36
|
+
const FIGMA_FILE_KEY = 'I9hynSlX2wyrlhceZr7z1u';
|
|
37
|
+
const FIGMA_FILE_NAME = 'Backpack-Icons';
|
|
38
|
+
const FIGMA_BASE_URL = `https://www.figma.com/design/${FIGMA_FILE_KEY}/${FIGMA_FILE_NAME}`;
|
|
39
|
+
const ICON_PKG = path.resolve(__dirname, '..');
|
|
40
|
+
const OUTPUT_FILE = path.join(ICON_PKG, 'BpkIcon.figma.tsx');
|
|
41
|
+
function kebabToPascal(str) {
|
|
42
|
+
return str.split(/[-]+/).map(part => part.charAt(0).toUpperCase() + part.slice(1)).join('');
|
|
43
|
+
}
|
|
44
|
+
function getIconFiles(dir) {
|
|
45
|
+
if (!fs.existsSync(dir)) return new Set();
|
|
46
|
+
return new Set(fs.readdirSync(dir).filter(f => f.endsWith('.jsx')).map(f => f.replace('.jsx', '')));
|
|
47
|
+
}
|
|
48
|
+
async function fetchFigmaComponents() {
|
|
49
|
+
const token = process.env.FIGMA_ACCESS_TOKEN;
|
|
50
|
+
if (!token) {
|
|
51
|
+
console.error('Error: FIGMA_ACCESS_TOKEN environment variable is required.');
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
const url = `https://api.figma.com/v1/files/${FIGMA_FILE_KEY}/components`;
|
|
55
|
+
const res = await fetch(url, {
|
|
56
|
+
headers: {
|
|
57
|
+
'X-Figma-Token': token
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
if (!res.ok) {
|
|
61
|
+
console.error(`Figma API error: ${res.status} ${res.statusText}`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
const data = await res.json();
|
|
65
|
+
return data.meta.components;
|
|
66
|
+
}
|
|
67
|
+
function groupComponentSets(components) {
|
|
68
|
+
const sets = {};
|
|
69
|
+
for (const c of components) {
|
|
70
|
+
const {
|
|
71
|
+
name
|
|
72
|
+
} = c.containing_frame;
|
|
73
|
+
const setNodeId = c.containing_frame.nodeId;
|
|
74
|
+
if (!sets[name]) {
|
|
75
|
+
sets[name] = {
|
|
76
|
+
nodeId: setNodeId,
|
|
77
|
+
variants: {},
|
|
78
|
+
variantProp: null
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Detect the variant property name (most use "Size", one uses "Property 1")
|
|
83
|
+
const match = c.name.match(/^(.+?)=(\d+)$/);
|
|
84
|
+
if (match) {
|
|
85
|
+
const [, variantProp, variantValue] = match;
|
|
86
|
+
sets[name].variantProp = variantProp;
|
|
87
|
+
sets[name].variants[variantValue] = c.node_id;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return sets;
|
|
91
|
+
}
|
|
92
|
+
function figmaUrl(nodeId) {
|
|
93
|
+
const encoded = nodeId.replace(/:/g, '%3A');
|
|
94
|
+
return `${FIGMA_BASE_URL}?node-id=${encoded}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Spelling aliases: Figma name → code name
|
|
98
|
+
const SPELLING_ALIASES = {
|
|
99
|
+
centre: 'center'
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Normalize a name by collapsing double-hyphens to single and applying
|
|
104
|
+
* spelling aliases, so we can fuzzy-match Figma names to code file names.
|
|
105
|
+
*
|
|
106
|
+
* @param {string} name - The icon name to normalize.
|
|
107
|
+
* @returns {string} The normalized name.
|
|
108
|
+
*/
|
|
109
|
+
function normalize(name) {
|
|
110
|
+
const collapsed = name.replace(/--/g, '-');
|
|
111
|
+
return collapsed.split('-').map(part => SPELLING_ALIASES[part] || part).join('-');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Find the matching code file name for a Figma icon name.
|
|
116
|
+
* Tries exact match first, then falls back to normalized matching.
|
|
117
|
+
*
|
|
118
|
+
* @param {string} figmaName - The icon name from Figma.
|
|
119
|
+
* @param {Set<string>} codeIcons - Set of icon file names from code.
|
|
120
|
+
* @returns {string|null} The matching code file name, or null if not found.
|
|
121
|
+
*/
|
|
122
|
+
function findCodeMatch(figmaName, codeIcons) {
|
|
123
|
+
if (codeIcons.has(figmaName)) return figmaName;
|
|
124
|
+
const normalizedFigma = normalize(figmaName);
|
|
125
|
+
for (const codeName of codeIcons) {
|
|
126
|
+
if (normalize(codeName) === normalizedFigma) return codeName;
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
function generateFile(iconSets, smIcons, lgIcons) {
|
|
131
|
+
const entries = [];
|
|
132
|
+
for (const [name, set] of Object.entries(iconSets).sort(([a], [b]) => a.localeCompare(b))) {
|
|
133
|
+
const smMatch = set.variants['16'] ? findCodeMatch(name, smIcons) : null;
|
|
134
|
+
const lgMatch = set.variants['24'] ? findCodeMatch(name, lgIcons) : null;
|
|
135
|
+
if (smMatch || lgMatch) {
|
|
136
|
+
entries.push({
|
|
137
|
+
name: smMatch || lgMatch,
|
|
138
|
+
figmaName: name,
|
|
139
|
+
nodeId: set.nodeId,
|
|
140
|
+
smFile: smMatch,
|
|
141
|
+
lgFile: lgMatch,
|
|
142
|
+
variantProp: set.variantProp || 'Size'
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (entries.length === 0) {
|
|
147
|
+
console.error('No matching icons found between Figma and code.');
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Build imports — interleaved and sorted alphabetically by import path
|
|
152
|
+
// to satisfy eslint import/order rules
|
|
153
|
+
const allImports = [];
|
|
154
|
+
for (const e of entries) {
|
|
155
|
+
if (e.lgFile) {
|
|
156
|
+
const pascal = kebabToPascal(e.lgFile);
|
|
157
|
+
allImports.push(`import BpkLarge${pascal}Icon from './lg/${e.lgFile}';`);
|
|
158
|
+
}
|
|
159
|
+
if (e.smFile) {
|
|
160
|
+
const pascal = kebabToPascal(e.smFile);
|
|
161
|
+
allImports.push(`import BpkSmall${pascal}Icon from './sm/${e.smFile}';`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
allImports.sort((a, b) => {
|
|
165
|
+
const pathA = a.match(/from '(.+)'/)[1];
|
|
166
|
+
const pathB = b.match(/from '(.+)'/)[1];
|
|
167
|
+
return pathA.localeCompare(pathB);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// Build connect calls
|
|
171
|
+
const connectCalls = [];
|
|
172
|
+
for (const e of entries) {
|
|
173
|
+
const url = figmaUrl(e.nodeId);
|
|
174
|
+
const prop = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e.variantProp) ? e.variantProp : JSON.stringify(e.variantProp);
|
|
175
|
+
if (e.smFile && e.lgFile) {
|
|
176
|
+
const smPascal = kebabToPascal(e.smFile);
|
|
177
|
+
const lgPascal = kebabToPascal(e.lgFile);
|
|
178
|
+
connectCalls.push(`figma.connect(
|
|
179
|
+
BpkSmall${smPascal}Icon,
|
|
180
|
+
"${url}",
|
|
181
|
+
{
|
|
182
|
+
variant: { ${prop}: "16" },
|
|
183
|
+
example: () => <BpkSmall${smPascal}Icon />,
|
|
184
|
+
},
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
figma.connect(
|
|
188
|
+
BpkLarge${lgPascal}Icon,
|
|
189
|
+
"${url}",
|
|
190
|
+
{
|
|
191
|
+
variant: { ${prop}: "24" },
|
|
192
|
+
example: () => <BpkLarge${lgPascal}Icon />,
|
|
193
|
+
},
|
|
194
|
+
)`);
|
|
195
|
+
} else if (e.smFile) {
|
|
196
|
+
const smPascal = kebabToPascal(e.smFile);
|
|
197
|
+
const variantLine = prop ? ` variant: { ${prop}: "16" },\n` : '';
|
|
198
|
+
connectCalls.push(`figma.connect(
|
|
199
|
+
BpkSmall${smPascal}Icon,
|
|
200
|
+
"${url}",
|
|
201
|
+
{
|
|
202
|
+
${variantLine} example: () => <BpkSmall${smPascal}Icon />,
|
|
203
|
+
},
|
|
204
|
+
)`);
|
|
205
|
+
} else if (e.lgFile) {
|
|
206
|
+
const lgPascal = kebabToPascal(e.lgFile);
|
|
207
|
+
const variantLine = prop ? ` variant: { ${prop}: "24" },\n` : '';
|
|
208
|
+
connectCalls.push(`figma.connect(
|
|
209
|
+
BpkLarge${lgPascal}Icon,
|
|
210
|
+
"${url}",
|
|
211
|
+
{
|
|
212
|
+
${variantLine} example: () => <BpkLarge${lgPascal}Icon />,
|
|
213
|
+
},
|
|
214
|
+
)`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
const content = `/*
|
|
218
|
+
* Backpack - Skyscanner's Design System
|
|
219
|
+
*
|
|
220
|
+
* Copyright 2016 Skyscanner Ltd
|
|
221
|
+
*
|
|
222
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
223
|
+
* you may not use this file except in compliance with the License.
|
|
224
|
+
* You may obtain a copy of the License at
|
|
225
|
+
*
|
|
226
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
227
|
+
*
|
|
228
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
229
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
230
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
231
|
+
* See the License for the specific language governing permissions and
|
|
232
|
+
* limitations under the License.
|
|
233
|
+
*/
|
|
234
|
+
|
|
235
|
+
// AUTO-GENERATED by scripts/generate-figma-connect.js — do not edit manually.
|
|
236
|
+
|
|
237
|
+
import figma from '@figma/code-connect'
|
|
238
|
+
|
|
239
|
+
${allImports.join('\n')}
|
|
240
|
+
|
|
241
|
+
${connectCalls.join('\n\n')}
|
|
242
|
+
`;
|
|
243
|
+
return {
|
|
244
|
+
content,
|
|
245
|
+
count: entries.length
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
async function main() {
|
|
249
|
+
console.log('Fetching icon components from Figma...');
|
|
250
|
+
const components = await fetchFigmaComponents();
|
|
251
|
+
console.log(`Found ${components.length} components in Figma.`);
|
|
252
|
+
const iconSets = groupComponentSets(components);
|
|
253
|
+
console.log(`Grouped into ${Object.keys(iconSets).length} icon sets.`);
|
|
254
|
+
const smIcons = getIconFiles(path.join(ICON_PKG, 'sm'));
|
|
255
|
+
const lgIcons = getIconFiles(path.join(ICON_PKG, 'lg'));
|
|
256
|
+
console.log(`Code icons: ${smIcons.size} sm, ${lgIcons.size} lg.`);
|
|
257
|
+
const {
|
|
258
|
+
content,
|
|
259
|
+
count
|
|
260
|
+
} = generateFile(iconSets, smIcons, lgIcons);
|
|
261
|
+
fs.writeFileSync(OUTPUT_FILE, content);
|
|
262
|
+
console.log(`Generated ${OUTPUT_FILE} with ${count} icon mappings.`);
|
|
263
|
+
}
|
|
264
|
+
main().catch(err => {
|
|
265
|
+
console.error(err);
|
|
266
|
+
process.exit(1);
|
|
267
|
+
});
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-info-banner{padding:.5rem 1rem;overflow:hidden;border-radius:.5rem;margin:0;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner--style-default{background-color:#eff3f8}.bpk-info-banner--style-onContrast{background-color:#fff}.bpk-info-banner__header{display:flex;flex-direction:row;align-items:flex-start}.bpk-info-banner__header--expandable{width:100%;padding:0;border:none;background-color:rgba(0,0,0,0);text-align:start;cursor:pointer}.bpk-info-banner__icon,.bpk-info-banner__toggle{padding:.125rem 0}.bpk-info-banner__message{padding:.25rem .5rem;flex-grow:1}.bpk-info-banner__success-icon{fill:#0c838a}.bpk-info-banner__warning-icon{fill:#f55d42}.bpk-info-banner__error-icon{fill:#e70866}.bpk-info-banner__info-icon{fill:#626971}.bpk-info-banner__toggle-button{padding:0;border:0;background-color:rgba(0,0,0,0);cursor:pointer;appearance:none;fill:#626971}.bpk-info-banner__children-container{color:#161616;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner__children-container--with-action{padding:.25rem 0 .25rem}.bpk-info-banner__children-container--no-action{padding:.25rem 0 .5rem}
|
|
18
|
+
.bpk-info-banner{padding:.5rem 1rem;overflow:hidden;border-radius:.5rem;margin:0;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner--style-default{background-color:#eff3f8}.bpk-info-banner--style-onContrast{background-color:#fff}.bpk-info-banner__header{display:flex;flex-direction:row;align-items:flex-start}.bpk-info-banner__header--expandable{width:100%;padding:0;border:none;background-color:rgba(0,0,0,0);text-align:start;cursor:pointer}.bpk-info-banner__icon,.bpk-info-banner__toggle{padding:.125rem 0}.bpk-info-banner__message{padding:.25rem .5rem;flex-grow:1}.bpk-info-banner__success-icon{fill:#0c838a}.bpk-info-banner__warning-icon{fill:#f55d42}.bpk-info-banner__error-icon{fill:#e70866}.bpk-info-banner__info-icon{fill:#626971}.bpk-info-banner__critical-icon{fill:#fff}.bpk-info-banner--critical{background-color:#e70866;color:#fff}.bpk-info-banner--critical .bpk-info-banner__message{color:#fff}.bpk-info-banner--critical .bpk-info-banner__toggle-button{fill:#fff}.bpk-info-banner--critical .bpk-info-banner__children-container,.bpk-info-banner--critical .bpk-info-banner__children-container--with-action,.bpk-info-banner--critical .bpk-info-banner__children-container--no-action{color:#fff}.bpk-info-banner__toggle-button{padding:0;border:0;background-color:rgba(0,0,0,0);cursor:pointer;appearance:none;fill:#626971}.bpk-info-banner__children-container{color:#161616;font-size:.875rem;line-height:1.25rem;font-weight:400}.bpk-info-banner__children-container--with-action{padding:.25rem 0 .25rem}.bpk-info-banner__children-container--no-action{padding:.25rem 0 .5rem}
|
|
@@ -27,6 +27,7 @@ import BpkCloseButton from "../../bpk-component-close-button";
|
|
|
27
27
|
import { withButtonAlignment } from "../../bpk-component-icon";
|
|
28
28
|
import ChevronDownIcon from "../../bpk-component-icon/sm/chevron-down";
|
|
29
29
|
import ChevronUpIcon from "../../bpk-component-icon/sm/chevron-up";
|
|
30
|
+
import ExclamationCircleIcon from "../../bpk-component-icon/sm/exclamation-circle";
|
|
30
31
|
import InfoCircleIcon from "../../bpk-component-icon/sm/information-circle";
|
|
31
32
|
import TickCircleIcon from "../../bpk-component-icon/sm/tick-circle";
|
|
32
33
|
import BpkLink from "../../bpk-component-link";
|
|
@@ -49,14 +50,16 @@ const getIconForType = (type, CustomIcon) => {
|
|
|
49
50
|
[ALERT_TYPES.SUCCESS]: getClassName('bpk-info-banner__success-icon'),
|
|
50
51
|
[ALERT_TYPES.WARNING]: getClassName('bpk-info-banner__warning-icon'),
|
|
51
52
|
[ALERT_TYPES.ERROR]: getClassName('bpk-info-banner__error-icon'),
|
|
52
|
-
[ALERT_TYPES.INFO]: getClassName('bpk-info-banner__info-icon')
|
|
53
|
+
[ALERT_TYPES.INFO]: getClassName('bpk-info-banner__info-icon'),
|
|
54
|
+
[ALERT_TYPES.CRITICAL]: getClassName('bpk-info-banner__critical-icon')
|
|
53
55
|
};
|
|
54
56
|
const className = classMap[type];
|
|
55
57
|
const componentMap = {
|
|
56
58
|
[ALERT_TYPES.SUCCESS]: TickCircleIcon,
|
|
57
59
|
[ALERT_TYPES.WARNING]: InfoCircleIcon,
|
|
58
60
|
[ALERT_TYPES.ERROR]: InfoCircleIcon,
|
|
59
|
-
[ALERT_TYPES.INFO]: InfoCircleIcon
|
|
61
|
+
[ALERT_TYPES.INFO]: InfoCircleIcon,
|
|
62
|
+
[ALERT_TYPES.CRITICAL]: ExclamationCircleIcon
|
|
60
63
|
};
|
|
61
64
|
const Icon = CustomIcon || componentMap[type];
|
|
62
65
|
const AlignedIcon = withButtonAlignment(Icon);
|
|
@@ -139,7 +142,8 @@ const BpkInfoBannerInner = ({
|
|
|
139
142
|
children: /*#__PURE__*/_jsx(BpkCloseButton, {
|
|
140
143
|
onClick: onBannerDismiss,
|
|
141
144
|
"aria-label": dismissButtonLabel,
|
|
142
|
-
label: dismissButtonLabel
|
|
145
|
+
label: dismissButtonLabel,
|
|
146
|
+
onDark: type === ALERT_TYPES.CRITICAL
|
|
143
147
|
})
|
|
144
148
|
})]
|
|
145
149
|
}), /*#__PURE__*/_jsxs(BpkAnimateHeight, {
|
|
@@ -149,6 +153,7 @@ const BpkInfoBannerInner = ({
|
|
|
149
153
|
className: childrenContainerClassName,
|
|
150
154
|
children: children
|
|
151
155
|
}), isExpandable && action && /*#__PURE__*/_jsx(BpkLink, {
|
|
156
|
+
alternate: type === ALERT_TYPES.CRITICAL,
|
|
152
157
|
onClick: action.callback,
|
|
153
158
|
href: "#",
|
|
154
159
|
children: action.title
|
|
@@ -2,7 +2,10 @@ import BpkInsetBanner, { type Props as BpkInsetBannerProps } from './src/BpkInse
|
|
|
2
2
|
import BpkInsetBannerSponsored from './src/BpkInsetBannerV2/BpkInsetBannerSponsored';
|
|
3
3
|
import { type CommonProps as BpkInsetBannerSponsoredProps } from './src/BpkInsetBannerV2/common-types';
|
|
4
4
|
import { VARIANT } from './src/BpkInsetBannerV2/common-types';
|
|
5
|
+
import BpkInsetBannerV3 from './src/BpkInsetBannerV3/BpkInsetBannerV3';
|
|
6
|
+
import type { RootProps as BpkInsetBannerV3RootProps, HeaderProps as BpkInsetBannerV3HeaderProps, LeadingAccessoryProps as BpkInsetBannerV3LeadingAccessoryProps, ContentProps as BpkInsetBannerV3ContentProps, BodyProps as BpkInsetBannerV3BodyProps, TrailingAccessoryProps as BpkInsetBannerV3TrailingAccessoryProps } from './src/BpkInsetBannerV3/BpkInsetBannerV3';
|
|
5
7
|
export type { BpkInsetBannerProps };
|
|
6
8
|
export type { BpkInsetBannerSponsoredProps };
|
|
9
|
+
export type { BpkInsetBannerV3RootProps, BpkInsetBannerV3HeaderProps, BpkInsetBannerV3LeadingAccessoryProps, BpkInsetBannerV3ContentProps, BpkInsetBannerV3BodyProps, BpkInsetBannerV3TrailingAccessoryProps, };
|
|
7
10
|
export { VARIANT };
|
|
8
|
-
export { BpkInsetBannerSponsored, BpkInsetBanner };
|
|
11
|
+
export { BpkInsetBannerSponsored, BpkInsetBanner, BpkInsetBannerV3 };
|
|
@@ -19,5 +19,6 @@
|
|
|
19
19
|
import BpkInsetBanner from "./src/BpkInsetBanner";
|
|
20
20
|
import BpkInsetBannerSponsored from "./src/BpkInsetBannerV2/BpkInsetBannerSponsored";
|
|
21
21
|
import { VARIANT } from "./src/BpkInsetBannerV2/common-types";
|
|
22
|
+
import BpkInsetBannerV3 from "./src/BpkInsetBannerV3/BpkInsetBannerV3";
|
|
22
23
|
export { VARIANT };
|
|
23
|
-
export { BpkInsetBannerSponsored, BpkInsetBanner };
|
|
24
|
+
export { BpkInsetBannerSponsored, BpkInsetBanner, BpkInsetBannerV3 };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
export type BodyProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
bleed?: boolean;
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
};
|
|
7
|
+
export type RootProps = Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'style' | 'children'> & {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
textVariant?: 'on-light' | 'on-dark';
|
|
11
|
+
};
|
|
12
|
+
export type HeaderProps = {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
layout?: 'horizontal' | 'vertical';
|
|
15
|
+
};
|
|
16
|
+
export type LeadingAccessoryProps = {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export type ContentProps = {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
};
|
|
22
|
+
type InteractiveTrailingAccessoryProps = Omit<ComponentPropsWithoutRef<'button'>, 'className' | 'style' | 'children' | 'type' | 'onClick'> & {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
25
|
+
'aria-label'?: string;
|
|
26
|
+
};
|
|
27
|
+
type StaticTrailingAccessoryProps = Omit<ComponentPropsWithoutRef<'div'>, 'className' | 'style' | 'children'> & {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
onClick?: never;
|
|
30
|
+
};
|
|
31
|
+
export type TrailingAccessoryProps = InteractiveTrailingAccessoryProps | StaticTrailingAccessoryProps;
|
|
32
|
+
declare const BpkInsetBannerV3: {
|
|
33
|
+
Root: import("react").ForwardRefExoticComponent<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "className" | "style" | "children"> & {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
backgroundColor?: string;
|
|
36
|
+
textVariant?: "on-light" | "on-dark";
|
|
37
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
38
|
+
Header: {
|
|
39
|
+
({ children, layout }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
displayName: string;
|
|
41
|
+
};
|
|
42
|
+
LeadingAccessory: {
|
|
43
|
+
({ children }: LeadingAccessoryProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
displayName: string;
|
|
45
|
+
};
|
|
46
|
+
Content: {
|
|
47
|
+
({ children }: ContentProps): import("react/jsx-runtime").JSX.Element;
|
|
48
|
+
displayName: string;
|
|
49
|
+
};
|
|
50
|
+
Body: {
|
|
51
|
+
({ backgroundColor, bleed, children }: BodyProps): import("react/jsx-runtime").JSX.Element;
|
|
52
|
+
displayName: string;
|
|
53
|
+
};
|
|
54
|
+
TrailingAccessory: import("react").ForwardRefExoticComponent<TrailingAccessoryProps & import("react").RefAttributes<HTMLDivElement | HTMLButtonElement>>;
|
|
55
|
+
};
|
|
56
|
+
export default BpkInsetBannerV3;
|