@skyscanner/backpack-web 42.15.0 → 42.17.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-accordion/src/BpkAccordionItem.module.css +1 -1
- package/bpk-component-autosuggest/index.d.ts +6 -0
- package/bpk-component-autosuggest/index.js +3 -1
- package/bpk-component-autosuggest/src/BpkAutosuggest.d.ts +2 -0
- package/bpk-component-autosuggest/src/BpkAutosuggest.js +14 -15
- package/bpk-component-autosuggest/src/BpkAutosuggest.module.css +1 -1
- package/bpk-component-autosuggest/src/BpkAutosuggestSuggestion.d.ts +11 -0
- package/bpk-component-autosuggest/src/BpkAutosuggestSuggestion.js +35 -55
- package/bpk-component-autosuggest/src/BpkAutosuggestV2/BpkAutosuggest.module.css +1 -1
- package/bpk-component-collapsible/index.d.ts +11 -0
- package/bpk-component-collapsible/index.js +22 -0
- package/bpk-component-collapsible/src/BpkCollapsible.d.ts +8 -0
- package/bpk-component-collapsible/src/BpkCollapsible.js +31 -0
- package/bpk-component-collapsible/src/BpkCollapsible.module.css +18 -0
- package/bpk-component-collapsible/src/BpkCollapsibleContent.d.ts +6 -0
- package/bpk-component-collapsible/src/BpkCollapsibleContent.js +36 -0
- package/bpk-component-collapsible/src/BpkCollapsibleIndicator.d.ts +6 -0
- package/bpk-component-collapsible/src/BpkCollapsibleIndicator.js +34 -0
- package/bpk-component-collapsible/src/BpkCollapsibleRoot.d.ts +22 -0
- package/bpk-component-collapsible/src/BpkCollapsibleRoot.js +49 -0
- package/bpk-component-collapsible/src/BpkCollapsibleRootProvider.d.ts +10 -0
- package/bpk-component-collapsible/src/BpkCollapsibleRootProvider.js +33 -0
- package/bpk-component-collapsible/src/BpkCollapsibleTrigger.d.ts +6 -0
- package/bpk-component-collapsible/src/BpkCollapsibleTrigger.js +43 -0
- package/bpk-component-collapsible/src/common-types.d.ts +9 -0
- package/bpk-component-collapsible/src/common-types.js +29 -0
- package/bpk-component-collapsible/src/useBpkCollapsible.d.ts +5 -0
- package/bpk-component-collapsible/src/useBpkCollapsible.js +21 -0
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTable.module.css +1 -1
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableColumnHeader.d.ts +2 -4
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableColumnHeader.js +1 -15
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableContent.js +20 -4
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableHeaderRow.d.ts +1 -2
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableHeaderRow.js +1 -5
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableRoot.d.ts +1 -1
- package/bpk-component-comparison-table/src/BpkComparisonTable/BpkComparisonTableRoot.js +25 -13
- package/bpk-component-comparison-table/src/BpkComparisonTable/common-types.d.ts +2 -0
- package/bpk-component-comparison-table/src/BpkComparisonTray/BpkComparisonTray.module.css +1 -1
- package/bpk-component-horizontal-nav/index.d.ts +6 -0
- package/bpk-component-horizontal-nav/index.js +3 -1
- package/bpk-component-horizontal-nav/src/BpkHorizontalNav.d.ts +27 -0
- package/bpk-component-horizontal-nav/src/BpkHorizontalNav.js +79 -114
- package/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.d.ts +25 -0
- package/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.js +38 -73
- package/bpk-component-switch/index.d.ts +3 -3
- package/bpk-component-switch/index.js +2 -2
- package/bpk-component-switch/src/BpkSwitch.d.ts +7 -1
- package/bpk-component-switch/src/BpkSwitch.js +10 -1
- package/bpk-component-switch/src/BpkSwitch.module.css +1 -1
- package/package.json +2 -2
|
@@ -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-accordion__item--with-divider{box-shadow:0 -1px 0 0 #c1c7cf inset}.bpk-accordion__item--with-divider-on-dark{box-shadow:0 -1px 0 0 hsla(0,0%,100%,.5) inset}.bpk-accordion__title{height:auto}.bpk-accordion__toggle-button{width:100%;padding:0;border:0;background-color:rgba(0,0,0,0);color:#161616;text-align:
|
|
18
|
+
.bpk-accordion__item--with-divider{box-shadow:0 -1px 0 0 #c1c7cf inset}.bpk-accordion__item--with-divider-on-dark{box-shadow:0 -1px 0 0 hsla(0,0%,100%,.5) inset}.bpk-accordion__title{height:auto}.bpk-accordion__toggle-button{width:100%;padding:0;border:0;background-color:rgba(0,0,0,0);color:#161616;text-align:start;cursor:pointer;appearance:none}.bpk-accordion__flex-container{display:inline-flex;width:100%;margin:1rem 0;flex-direction:row}.bpk-accordion__title-text{flex-grow:1}.bpk-accordion__title-text--on-dark{color:#fff}.bpk-accordion__icon-wrapper{display:flex;align-items:center;margin-left:.5rem;margin-right:0}html[dir=rtl] .bpk-accordion__icon-wrapper{margin-left:0;margin-right:.5rem}.bpk-accordion__leading-icon{margin-left:0;margin-right:.5rem}html[dir=rtl] .bpk-accordion__leading-icon{margin-left:.5rem;margin-right:0}.bpk-accordion__item-expand-icon{fill:#161616}.bpk-accordion__item-expand-icon--flipped{transform:scaleY(-1)}.bpk-accordion__item-expand-icon--on-dark{fill:#fff}.bpk-accordion__content-container{margin:0}.bpk-accordion__content-inner-container--with-divider{padding-bottom:1rem}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import BpkAutosuggestLegacy from './src/BpkAutosuggest';
|
|
2
|
+
import BpkAutosuggestSuggestion from './src/BpkAutosuggestSuggestion';
|
|
3
|
+
import { defaultTheme } from './src/BpkAutosuggestV2/BpkAutosuggest';
|
|
4
|
+
declare const BpkAutosuggest: import("react").ForwardRefExoticComponent<import("./src/BpkAutosuggestV2/BpkAutosuggest").BpkAutoSuggestProps<any> & import("react").RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export default BpkAutosuggest;
|
|
6
|
+
export { BpkAutosuggestLegacy, BpkAutosuggestSuggestion, defaultTheme };
|
|
@@ -14,7 +14,9 @@
|
|
|
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
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import BpkAutosuggestLegacy from "./src/BpkAutosuggest";
|
|
18
20
|
import BpkAutosuggestSuggestion from "./src/BpkAutosuggestSuggestion";
|
|
19
21
|
import BpkAutosuggestV2, { defaultTheme } from "./src/BpkAutosuggestV2/BpkAutosuggest";
|
|
20
22
|
const BpkAutosuggest = BpkAutosuggestV2;
|
|
@@ -14,7 +14,10 @@
|
|
|
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
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
20
|
+
import Autosuggest from 'react-autosuggest';
|
|
18
21
|
import BpkInput from "../../bpk-component-input";
|
|
19
22
|
import { cssModules } from "../../bpk-react-utils";
|
|
20
23
|
import STYLES from "./BpkAutosuggest.module.css";
|
|
@@ -47,19 +50,15 @@ Autosuggest.defaultProps.renderInputComponent = inputProps => {
|
|
|
47
50
|
ref,
|
|
48
51
|
...rest
|
|
49
52
|
} = inputProps;
|
|
50
|
-
return (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
autoComplete: autoComplete,
|
|
61
|
-
...rest
|
|
62
|
-
})
|
|
63
|
-
);
|
|
53
|
+
return /*#__PURE__*/_jsx(BpkInput, {
|
|
54
|
+
inputRef: element => {
|
|
55
|
+
ref(element);
|
|
56
|
+
if (typeof inputRef === 'function') {
|
|
57
|
+
inputRef(element);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
autoComplete: autoComplete,
|
|
61
|
+
...rest
|
|
62
|
+
});
|
|
64
63
|
};
|
|
65
64
|
export default Autosuggest;
|
|
@@ -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-autosuggest__container--open{position:relative}.bpk-autosuggest__suggestions-container{display:none}.bpk-autosuggest__suggestions-container--open{position:absolute;top:100%;display:block;z-index:900;width:100%;margin-top:.75rem}.bpk-autosuggest__suggestions-container--open::before{position:absolute;bottom:100%;left:50%;content:" ";display:block;margin-bottom:-0.0625rem;margin-left:-0.8125rem;border:.8125rem solid rgba(0,0,0,0);border-bottom-color:#e0e4e9;pointer-events:none}.bpk-autosuggest__suggestions-container--open::after{position:absolute;bottom:100%;left:50%;content:" ";display:block;margin-bottom:-0.0625rem;margin-left:-0.75rem;border:.75rem solid rgba(0,0,0,0);border-bottom-color:#fff;pointer-events:none}.bpk-autosuggest__suggestions-list{min-width:fit-content;margin:0;padding:0;list-style:none;overflow:hidden;border:.0625rem solid #e0e4e9;background-color:#fff;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}.bpk-autosuggest__suggestion-item{cursor:pointer;margin:0;font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-autosuggest__suggestion-item:not(:last-child){box-shadow:0 -1px 0 0 #c1c7cf inset}.bpk-autosuggest__suggestion-item:active{background-color:#eff3f8}.bpk-autosuggest__suggestion-item--highlighted{background-color:#eff3f8}.bpk-autosuggest__suggestion{display:table;width:100%;padding:1rem}.bpk-autosuggest__suggestion--indent{padding-
|
|
18
|
+
.bpk-autosuggest__container--open{position:relative}.bpk-autosuggest__suggestions-container{display:none}.bpk-autosuggest__suggestions-container--open{position:absolute;top:100%;display:block;z-index:900;width:100%;margin-top:.75rem}.bpk-autosuggest__suggestions-container--open::before{position:absolute;bottom:100%;left:50%;content:" ";display:block;margin-bottom:-0.0625rem;margin-left:-0.8125rem;border:.8125rem solid rgba(0,0,0,0);border-bottom-color:#e0e4e9;pointer-events:none}.bpk-autosuggest__suggestions-container--open::after{position:absolute;bottom:100%;left:50%;content:" ";display:block;margin-bottom:-0.0625rem;margin-left:-0.75rem;border:.75rem solid rgba(0,0,0,0);border-bottom-color:#fff;pointer-events:none}.bpk-autosuggest__suggestions-list{min-width:fit-content;margin:0;padding:0;list-style:none;overflow:hidden;border:.0625rem solid #e0e4e9;background-color:#fff;border-radius:.5rem;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25)}.bpk-autosuggest__suggestion-item{cursor:pointer;margin:0;font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-autosuggest__suggestion-item:not(:last-child){box-shadow:0 -1px 0 0 #c1c7cf inset}.bpk-autosuggest__suggestion-item:active{background-color:#eff3f8}.bpk-autosuggest__suggestion-item--highlighted{background-color:#eff3f8}.bpk-autosuggest__suggestion{display:table;width:100%;padding:1rem}.bpk-autosuggest__suggestion--indent{padding-inline-start:2rem}.bpk-autosuggest__suggestion-icon{display:flex;vertical-align:top;fill:#626971;margin-inline-end:.5rem}.bpk-autosuggest__suggestion-content{display:table-cell;width:100%;vertical-align:top}.bpk-autosuggest__suggestion-inner{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between}.bpk-autosuggest__suggestion-value{display:block;overflow-wrap:anywhere}.bpk-autosuggest__suggestion-sub-heading{display:table-cell;width:100%;vertical-align:top;margin:0;font-size:.75rem;line-height:1rem;font-weight:400}.bpk-autosuggest__suggestion-tertiary-label{display:table-cell;align-self:center;color:#626971;vertical-align:top;word-break:keep-all;margin:0;font-size:.75rem;line-height:1rem;font-weight:400}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
type Props = Omit<HTMLAttributes<HTMLElement>, 'className'> & {
|
|
3
|
+
value: ReactNode;
|
|
4
|
+
subHeading?: ReactNode | null;
|
|
5
|
+
tertiaryLabel?: string | null;
|
|
6
|
+
icon?: ComponentType | null;
|
|
7
|
+
indent?: boolean;
|
|
8
|
+
className?: string | null;
|
|
9
|
+
};
|
|
10
|
+
declare const BpkAutosuggestSuggestion: ({ className, icon: Icon, indent, subHeading, tertiaryLabel, value, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default BpkAutosuggestSuggestion;
|
|
@@ -14,72 +14,52 @@
|
|
|
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
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
19
20
|
import STYLES from "./BpkAutosuggest.module.css";
|
|
20
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
22
|
const getClassName = cssModules(STYLES);
|
|
22
|
-
const BpkAutosuggestSuggestion =
|
|
23
|
+
const BpkAutosuggestSuggestion = ({
|
|
24
|
+
className,
|
|
25
|
+
icon: Icon,
|
|
26
|
+
indent = false,
|
|
27
|
+
subHeading,
|
|
28
|
+
tertiaryLabel,
|
|
29
|
+
value,
|
|
30
|
+
...rest
|
|
31
|
+
}) => {
|
|
23
32
|
const classNames = [getClassName('bpk-autosuggest__suggestion')];
|
|
24
|
-
const {
|
|
25
|
-
className,
|
|
26
|
-
icon,
|
|
27
|
-
indent,
|
|
28
|
-
subHeading,
|
|
29
|
-
tertiaryLabel,
|
|
30
|
-
value,
|
|
31
|
-
...rest
|
|
32
|
-
} = props;
|
|
33
|
-
const Icon = icon;
|
|
34
33
|
if (indent) {
|
|
35
34
|
classNames.push(getClassName('bpk-autosuggest__suggestion--indent'));
|
|
36
35
|
}
|
|
37
36
|
if (className) {
|
|
38
37
|
classNames.push(className);
|
|
39
38
|
}
|
|
40
|
-
return (
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
className:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}), subHeading || tertiaryLabel ? /*#__PURE__*/_jsx("small", {
|
|
58
|
-
className: getClassName('bpk-autosuggest__suggestion-sub-heading'),
|
|
59
|
-
children: subHeading
|
|
60
|
-
}) : null]
|
|
61
|
-
}), tertiaryLabel ? /*#__PURE__*/_jsx("aside", {
|
|
62
|
-
className: getClassName('bpk-autosuggest__suggestion-tertiary-label'),
|
|
63
|
-
children: tertiaryLabel
|
|
39
|
+
return /*#__PURE__*/_jsxs("section", {
|
|
40
|
+
className: classNames.join(' '),
|
|
41
|
+
...rest,
|
|
42
|
+
children: [Icon ? /*#__PURE__*/_jsx("div", {
|
|
43
|
+
className: getClassName('bpk-autosuggest__suggestion-icon'),
|
|
44
|
+
children: /*#__PURE__*/_jsx(Icon, {})
|
|
45
|
+
}) : null, /*#__PURE__*/_jsx("div", {
|
|
46
|
+
className: getClassName('bpk-autosuggest__suggestion-content'),
|
|
47
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
48
|
+
className: getClassName('bpk-autosuggest__suggestion-inner'),
|
|
49
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
50
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
51
|
+
className: getClassName('bpk-autosuggest__suggestion-value'),
|
|
52
|
+
children: value
|
|
53
|
+
}), subHeading || tertiaryLabel ? /*#__PURE__*/_jsx("small", {
|
|
54
|
+
className: getClassName('bpk-autosuggest__suggestion-sub-heading'),
|
|
55
|
+
children: subHeading
|
|
64
56
|
}) : null]
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
subHeading: PropTypes.node,
|
|
73
|
-
tertiaryLabel: PropTypes.string,
|
|
74
|
-
icon: PropTypes.func,
|
|
75
|
-
indent: PropTypes.bool,
|
|
76
|
-
className: PropTypes.string
|
|
77
|
-
};
|
|
78
|
-
BpkAutosuggestSuggestion.defaultProps = {
|
|
79
|
-
subHeading: null,
|
|
80
|
-
tertiaryLabel: null,
|
|
81
|
-
icon: null,
|
|
82
|
-
indent: false,
|
|
83
|
-
className: null
|
|
57
|
+
}), tertiaryLabel ? /*#__PURE__*/_jsx("aside", {
|
|
58
|
+
className: getClassName('bpk-autosuggest__suggestion-tertiary-label'),
|
|
59
|
+
children: tertiaryLabel
|
|
60
|
+
}) : null]
|
|
61
|
+
})
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
84
64
|
};
|
|
85
65
|
export default BpkAutosuggestSuggestion;
|
|
@@ -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-autosuggest__input{width:100%}.bpk-autosuggest__suggestions-container{margin-top:.75rem;border:.0625rem solid #e0e4e9;border-radius:.5rem;background-color:#fff}.bpk-autosuggest__arrow{width:1.5rem;height:1.5rem;fill:#fff}.bpk-autosuggest__arrow[data-hide]{visibility:hidden}.bpk-autosuggest__suggestions-list{min-width:fit-content;margin:0;padding:0;border-radius:.5rem;background-color:#fff;list-style:none;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25);overflow:hidden}.bpk-autosuggest__suggestion-item{cursor:pointer;margin:0;font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-autosuggest__suggestion-item:not(:last-child){box-shadow:0 -1px 0 0 #c1c7cf inset}.bpk-autosuggest__suggestion-item:active{background-color:#eff3f8}.bpk-autosuggest__suggestion-item--highlighted{background-color:#eff3f8}.bpk-autosuggest__suggestion{display:table;width:100%;padding:1rem}.bpk-autosuggest__suggestion--indent{padding-
|
|
18
|
+
.bpk-autosuggest__input{width:100%}.bpk-autosuggest__suggestions-container{margin-top:.75rem;border:.0625rem solid #e0e4e9;border-radius:.5rem;background-color:#fff}.bpk-autosuggest__arrow{width:1.5rem;height:1.5rem;fill:#fff}.bpk-autosuggest__arrow[data-hide]{visibility:hidden}.bpk-autosuggest__suggestions-list{min-width:fit-content;margin:0;padding:0;border-radius:.5rem;background-color:#fff;list-style:none;box-shadow:0px 4px 14px 0px rgba(37,32,31,.25);overflow:hidden}.bpk-autosuggest__suggestion-item{cursor:pointer;margin:0;font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-autosuggest__suggestion-item:not(:last-child){box-shadow:0 -1px 0 0 #c1c7cf inset}.bpk-autosuggest__suggestion-item:active{background-color:#eff3f8}.bpk-autosuggest__suggestion-item--highlighted{background-color:#eff3f8}.bpk-autosuggest__suggestion{display:table;width:100%;padding:1rem}.bpk-autosuggest__suggestion--indent{padding-inline-start:2rem}.bpk-autosuggest__suggestion-icon{display:table-cell;vertical-align:top;fill:#626971;margin-inline-end:.5rem}.bpk-autosuggest__suggestion-content{display:table-cell;width:100%;vertical-align:top}.bpk-autosuggest__suggestion-inner{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-between}.bpk-autosuggest__suggestion-value{display:block}.bpk-autosuggest__suggestion-sub-heading{display:table-cell;width:100%;vertical-align:top;margin:0;font-size:.75rem;line-height:1rem;font-weight:400}.bpk-autosuggest__suggestion-tertiary-label{display:table-cell;align-self:center;color:#626971;vertical-align:top;word-break:keep-all;margin:0;font-size:.75rem;line-height:1rem;font-weight:400}.bpk-autosuggest__section-container:not(:first-of-type){border-top:1px solid #c1c7cf}.bpk-autosuggest__visuallyhidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;white-space:nowrap;overflow:hidden;clip:rect(0 0 0 0)}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import BpkCollapsible from './src/BpkCollapsible';
|
|
2
|
+
export { default as useBpkCollapsible } from './src/useBpkCollapsible';
|
|
3
|
+
export { COLLAPSIBLE_VARIANTS } from './src/common-types';
|
|
4
|
+
export default BpkCollapsible;
|
|
5
|
+
export type { BpkCollapsibleOpenChangeDetails, BpkCollapsibleVariant, } from './src/common-types';
|
|
6
|
+
export type { BpkCollapsibleRootProps } from './src/BpkCollapsibleRoot';
|
|
7
|
+
export type { BpkCollapsibleRootProviderProps } from './src/BpkCollapsibleRootProvider';
|
|
8
|
+
export type { BpkCollapsibleTriggerProps } from './src/BpkCollapsibleTrigger';
|
|
9
|
+
export type { BpkCollapsibleIndicatorProps } from './src/BpkCollapsibleIndicator';
|
|
10
|
+
export type { BpkCollapsibleContentProps } from './src/BpkCollapsibleContent';
|
|
11
|
+
export type { BpkUseCollapsibleProps, BpkUseCollapsibleReturn, } from './src/useBpkCollapsible';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import BpkCollapsible from "./src/BpkCollapsible";
|
|
20
|
+
export { default as useBpkCollapsible } from "./src/useBpkCollapsible";
|
|
21
|
+
export { COLLAPSIBLE_VARIANTS } from "./src/common-types";
|
|
22
|
+
export default BpkCollapsible;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const BpkCollapsible: {
|
|
2
|
+
Root: ({ children, collapsedHeight, defaultOpen, disabled, ids, lazyMount, onExitComplete, onOpenChange, open, unmountOnExit, variant, }: import("./BpkCollapsibleRoot").BpkCollapsibleRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
RootProvider: ({ children, value, variant, }: import("./BpkCollapsibleRootProvider").BpkCollapsibleRootProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
Trigger: import("react").ForwardRefExoticComponent<import("./BpkCollapsibleTrigger").BpkCollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
5
|
+
Indicator: import("react").ForwardRefExoticComponent<import("./BpkCollapsibleIndicator").BpkCollapsibleIndicatorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
Content: import("react").ForwardRefExoticComponent<import("./BpkCollapsibleContent").BpkCollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
};
|
|
8
|
+
export default BpkCollapsible;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import BpkCollapsibleContent from "./BpkCollapsibleContent";
|
|
20
|
+
import BpkCollapsibleIndicator from "./BpkCollapsibleIndicator";
|
|
21
|
+
import BpkCollapsibleRoot from "./BpkCollapsibleRoot";
|
|
22
|
+
import BpkCollapsibleRootProvider from "./BpkCollapsibleRootProvider";
|
|
23
|
+
import BpkCollapsibleTrigger from "./BpkCollapsibleTrigger";
|
|
24
|
+
const BpkCollapsible = {
|
|
25
|
+
Root: BpkCollapsibleRoot,
|
|
26
|
+
RootProvider: BpkCollapsibleRootProvider,
|
|
27
|
+
Trigger: BpkCollapsibleTrigger,
|
|
28
|
+
Indicator: BpkCollapsibleIndicator,
|
|
29
|
+
Content: BpkCollapsibleContent
|
|
30
|
+
};
|
|
31
|
+
export default BpkCollapsible;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
.bpk-collapsible{display:block;inline-size:100%;min-inline-size:0}.bpk-collapsible--default{color:#161616}.bpk-collapsible--on-contrast{color:#fff}.bpk-collapsible--on-contrast .bpk-collapsible__trigger:disabled,.bpk-collapsible--on-contrast .bpk-collapsible__content[data-disabled]{color:hsla(0,0%,100%,.5)}.bpk-collapsible__trigger{display:flex;padding:0;align-items:center;border:0;background:rgba(0,0,0,0);color:inherit;text-align:start;cursor:pointer;appearance:none;gap:.25rem;inline-size:100%}.bpk-collapsible__trigger:disabled,.bpk-collapsible__trigger[data-disabled]{cursor:not-allowed}.bpk-collapsible__trigger:disabled{color:rgba(0,0,0,.2)}.bpk-collapsible__trigger:focus-visible{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-collapsible__indicator{display:inline-flex;justify-content:center;align-items:center;transition:transform 200ms ease;color:inherit;margin-inline-start:auto}@media(prefers-reduced-motion: reduce){.bpk-collapsible__indicator{transition:none}}.bpk-collapsible__indicator svg{fill:currentcolor}.bpk-collapsible__indicator[data-state=open]{transform:rotate(180deg)}.bpk-collapsible__content{overflow:hidden}@media(prefers-reduced-motion: reduce){.bpk-collapsible__content[data-state=open],.bpk-collapsible__content[data-state=closing],.bpk-collapsible__content[data-state=closed]{animation:none}}.bpk-collapsible__content[data-disabled]{color:rgba(0,0,0,.2)}.bpk-collapsible__content[data-state=open]{animation:bpk-collapsible-expand 200ms ease}.bpk-collapsible__content[data-state=closing],.bpk-collapsible__content[data-state=closed]{animation:bpk-collapsible-collapse 200ms ease}.bpk-collapsible__content-inner{display:block}@keyframes bpk-collapsible-expand{from{block-size:var(--collapsed-height, 0)}to{block-size:var(--height)}}@keyframes bpk-collapsible-collapse{from{block-size:var(--height)}to{block-size:var(--collapsed-height, 0)}}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type BpkCollapsibleContentProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const BpkCollapsibleContent: import("react").ForwardRefExoticComponent<BpkCollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export default BpkCollapsibleContent;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { forwardRef } from 'react';
|
|
20
|
+
import { Collapsible } from '@ark-ui/react';
|
|
21
|
+
import { cssModules } from "../../bpk-react-utils";
|
|
22
|
+
import STYLES from "./BpkCollapsible.module.css";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
const getClassName = cssModules(STYLES);
|
|
25
|
+
const BpkCollapsibleContent = /*#__PURE__*/forwardRef(({
|
|
26
|
+
children
|
|
27
|
+
}, ref) => /*#__PURE__*/_jsx(Collapsible.Content, {
|
|
28
|
+
ref: ref,
|
|
29
|
+
className: getClassName('bpk-collapsible__content'),
|
|
30
|
+
children: /*#__PURE__*/_jsx("div", {
|
|
31
|
+
className: getClassName('bpk-collapsible__content-inner'),
|
|
32
|
+
children: children
|
|
33
|
+
})
|
|
34
|
+
}));
|
|
35
|
+
BpkCollapsibleContent.displayName = 'BpkCollapsibleContent';
|
|
36
|
+
export default BpkCollapsibleContent;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type BpkCollapsibleIndicatorProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const BpkCollapsibleIndicator: import("react").ForwardRefExoticComponent<BpkCollapsibleIndicatorProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export default BpkCollapsibleIndicator;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { forwardRef } from 'react';
|
|
20
|
+
import { Collapsible } from '@ark-ui/react';
|
|
21
|
+
import { cssModules } from "../../bpk-react-utils";
|
|
22
|
+
import STYLES from "./BpkCollapsible.module.css";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
const getClassName = cssModules(STYLES);
|
|
25
|
+
const BpkCollapsibleIndicator = /*#__PURE__*/forwardRef(({
|
|
26
|
+
children
|
|
27
|
+
}, ref) => /*#__PURE__*/_jsx(Collapsible.Indicator, {
|
|
28
|
+
ref: ref,
|
|
29
|
+
className: getClassName('bpk-collapsible__indicator'),
|
|
30
|
+
"aria-hidden": true,
|
|
31
|
+
children: children
|
|
32
|
+
}));
|
|
33
|
+
BpkCollapsibleIndicator.displayName = 'BpkCollapsibleIndicator';
|
|
34
|
+
export default BpkCollapsibleIndicator;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { BpkCollapsibleOpenChangeDetails, BpkCollapsibleVariant } from './common-types';
|
|
3
|
+
type ElementIds = Partial<{
|
|
4
|
+
root: string;
|
|
5
|
+
trigger: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}>;
|
|
8
|
+
export type BpkCollapsibleRootProps = {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
collapsedHeight?: string | number;
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
ids?: ElementIds;
|
|
14
|
+
lazyMount?: boolean;
|
|
15
|
+
onExitComplete?: () => void;
|
|
16
|
+
onOpenChange?: (details: BpkCollapsibleOpenChangeDetails) => void;
|
|
17
|
+
open?: boolean;
|
|
18
|
+
unmountOnExit?: boolean;
|
|
19
|
+
variant?: BpkCollapsibleVariant;
|
|
20
|
+
};
|
|
21
|
+
declare const BpkCollapsibleRoot: ({ children, collapsedHeight, defaultOpen, disabled, ids, lazyMount, onExitComplete, onOpenChange, open, unmountOnExit, variant, }: BpkCollapsibleRootProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export default BpkCollapsibleRoot;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { Collapsible } from '@ark-ui/react';
|
|
20
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
import { COLLAPSIBLE_VARIANTS, getRootClassName } from "./common-types";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const BpkCollapsibleRoot = ({
|
|
24
|
+
children,
|
|
25
|
+
collapsedHeight,
|
|
26
|
+
defaultOpen,
|
|
27
|
+
disabled = false,
|
|
28
|
+
ids,
|
|
29
|
+
lazyMount,
|
|
30
|
+
onExitComplete,
|
|
31
|
+
onOpenChange,
|
|
32
|
+
open,
|
|
33
|
+
unmountOnExit,
|
|
34
|
+
variant = COLLAPSIBLE_VARIANTS.default
|
|
35
|
+
}) => /*#__PURE__*/_jsx(Collapsible.Root, {
|
|
36
|
+
className: getRootClassName(variant),
|
|
37
|
+
collapsedHeight: collapsedHeight,
|
|
38
|
+
defaultOpen: defaultOpen,
|
|
39
|
+
disabled: disabled,
|
|
40
|
+
ids: ids,
|
|
41
|
+
lazyMount: lazyMount,
|
|
42
|
+
onExitComplete: onExitComplete,
|
|
43
|
+
onOpenChange: onOpenChange,
|
|
44
|
+
open: open,
|
|
45
|
+
unmountOnExit: unmountOnExit,
|
|
46
|
+
...getDataComponentAttribute('Collapsible'),
|
|
47
|
+
children: children
|
|
48
|
+
});
|
|
49
|
+
export default BpkCollapsibleRoot;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { BpkCollapsibleVariant } from './common-types';
|
|
3
|
+
import type { BpkUseCollapsibleReturn } from './useBpkCollapsible';
|
|
4
|
+
export type BpkCollapsibleRootProviderProps = {
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
value: BpkUseCollapsibleReturn;
|
|
7
|
+
variant?: BpkCollapsibleVariant;
|
|
8
|
+
};
|
|
9
|
+
declare const BpkCollapsibleRootProvider: ({ children, value, variant, }: BpkCollapsibleRootProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default BpkCollapsibleRootProvider;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { Collapsible } from '@ark-ui/react';
|
|
20
|
+
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
+
import { COLLAPSIBLE_VARIANTS, getRootClassName } from "./common-types";
|
|
22
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
|
+
const BpkCollapsibleRootProvider = ({
|
|
24
|
+
children,
|
|
25
|
+
value,
|
|
26
|
+
variant = COLLAPSIBLE_VARIANTS.default
|
|
27
|
+
}) => /*#__PURE__*/_jsx(Collapsible.RootProvider, {
|
|
28
|
+
className: getRootClassName(variant),
|
|
29
|
+
value: value,
|
|
30
|
+
...getDataComponentAttribute('Collapsible'),
|
|
31
|
+
children: children
|
|
32
|
+
});
|
|
33
|
+
export default BpkCollapsibleRootProvider;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type BpkCollapsibleTriggerProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
};
|
|
5
|
+
declare const BpkCollapsibleTrigger: import("react").ForwardRefExoticComponent<BpkCollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
export default BpkCollapsibleTrigger;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { forwardRef } from 'react';
|
|
20
|
+
import { Collapsible, useCollapsibleContext } from '@ark-ui/react';
|
|
21
|
+
import { cssModules } from "../../bpk-react-utils";
|
|
22
|
+
import STYLES from "./BpkCollapsible.module.css";
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
const getClassName = cssModules(STYLES);
|
|
25
|
+
// Applies the native HTML `disabled` attribute to the underlying <button> so
|
|
26
|
+
// the trigger is removed from the tab order and announced as disabled by
|
|
27
|
+
// assistive tech. Ark/Zag only emit `data-disabled`, which would otherwise
|
|
28
|
+
// leave the button tabbable and announced as enabled.
|
|
29
|
+
const BpkCollapsibleTrigger = /*#__PURE__*/forwardRef(({
|
|
30
|
+
children
|
|
31
|
+
}, ref) => {
|
|
32
|
+
const {
|
|
33
|
+
disabled
|
|
34
|
+
} = useCollapsibleContext();
|
|
35
|
+
return /*#__PURE__*/_jsx(Collapsible.Trigger, {
|
|
36
|
+
ref: ref,
|
|
37
|
+
className: getClassName('bpk-collapsible__trigger'),
|
|
38
|
+
disabled: disabled,
|
|
39
|
+
children: children
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
BpkCollapsibleTrigger.displayName = 'BpkCollapsibleTrigger';
|
|
43
|
+
export default BpkCollapsibleTrigger;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const COLLAPSIBLE_VARIANTS: {
|
|
2
|
+
readonly default: "default";
|
|
3
|
+
readonly onContrast: "onContrast";
|
|
4
|
+
};
|
|
5
|
+
export type BpkCollapsibleVariant = (typeof COLLAPSIBLE_VARIANTS)[keyof typeof COLLAPSIBLE_VARIANTS];
|
|
6
|
+
export type BpkCollapsibleOpenChangeDetails = {
|
|
7
|
+
open: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const getRootClassName: (variant: BpkCollapsibleVariant) => string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Backpack - Skyscanner's Design System
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2016 Skyscanner Ltd
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { cssModules } from "../../bpk-react-utils";
|
|
20
|
+
import STYLES from "./BpkCollapsible.module.css";
|
|
21
|
+
export const COLLAPSIBLE_VARIANTS = {
|
|
22
|
+
default: 'default',
|
|
23
|
+
onContrast: 'onContrast'
|
|
24
|
+
};
|
|
25
|
+
const getClassName = cssModules(STYLES);
|
|
26
|
+
export const getRootClassName = variant => {
|
|
27
|
+
const variantModifier = variant === COLLAPSIBLE_VARIANTS.onContrast ? 'on-contrast' : 'default';
|
|
28
|
+
return getClassName('bpk-collapsible', `bpk-collapsible--${variantModifier}`);
|
|
29
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { UseCollapsibleProps, UseCollapsibleReturn } from '@ark-ui/react';
|
|
2
|
+
export type BpkUseCollapsibleProps = UseCollapsibleProps;
|
|
3
|
+
export type BpkUseCollapsibleReturn = UseCollapsibleReturn;
|
|
4
|
+
declare const useBpkCollapsible: (props?: BpkUseCollapsibleProps) => BpkUseCollapsibleReturn;
|
|
5
|
+
export default useBpkCollapsible;
|