@skyscanner/backpack-web 42.10.0-dev-v24443725500.1 → 42.10.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-ai-blurb/src/BpkAiBlurb.module.css +1 -1
- package/bpk-component-ai-blurb/src/BpkAiBlurbFeedback.js +21 -13
- package/bpk-component-chatbot-input/index.d.ts +2 -1
- package/bpk-component-chatbot-input/src/BpkChatbotInput.d.ts +3 -13
- package/bpk-component-chatbot-input/src/BpkChatbotInput.js +98 -18
- package/bpk-component-chatbot-input/src/BpkChatbotInput.module.css +1 -1
- 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 +0 -1
- package/bpk-component-chatbot-input/src/TextAreaField/TextAreaField.js +1 -5
- package/bpk-component-chatbot-input/src/common-types.d.ts +3 -23
- package/bpk-component-chatbot-input/src/hooks/useChatbotInput.d.ts +1 -2
- package/bpk-component-chatbot-input/src/hooks/useChatbotInput.js +1 -3
- package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.d.ts +1 -2
- package/bpk-component-chatbot-input/src/hooks/useTextAreaAutoResize.js +6 -19
- package/bpk-component-layout/src/theme.js +252 -29
- package/bpk-component-layout/src/tokenUtils.js +9 -31
- package/package.json +1 -1
- package/bpk-component-chatbot-input/src/BpkChatbotInputContext.d.ts +0 -9
- package/bpk-component-chatbot-input/src/BpkChatbotInputContext.js +0 -26
- package/bpk-component-chatbot-input/src/BpkChatbotInputInput.d.ts +0 -3
- package/bpk-component-chatbot-input/src/BpkChatbotInputInput.js +0 -125
- package/bpk-component-chatbot-input/src/BpkChatbotInputRoot.d.ts +0 -3
- package/bpk-component-chatbot-input/src/BpkChatbotInputRoot.js +0 -77
- package/bpk-component-chatbot-input/src/BpkChatbotInputToolbar.d.ts +0 -3
- package/bpk-component-chatbot-input/src/BpkChatbotInputToolbar.js +0 -33
- package/bpk-component-layout/src/resolveTextStyle.d.ts +0 -13
- package/bpk-component-layout/src/resolveTextStyle.js +0 -265
|
@@ -1,33 +0,0 @@
|
|
|
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 { BpkHStack, BpkSpacing } from "../../bpk-component-layout";
|
|
20
|
-
import { getDataComponentAttribute } from "../../bpk-react-utils";
|
|
21
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
|
-
const BpkChatbotInputToolbar = ({
|
|
23
|
-
children,
|
|
24
|
-
gap = BpkSpacing.Base,
|
|
25
|
-
...rest
|
|
26
|
-
}) => /*#__PURE__*/_jsx(BpkHStack, {
|
|
27
|
-
gap: gap,
|
|
28
|
-
width: "100%",
|
|
29
|
-
...getDataComponentAttribute('ChatbotInput.Toolbar'),
|
|
30
|
-
...rest,
|
|
31
|
-
children: children
|
|
32
|
-
});
|
|
33
|
-
export default BpkChatbotInputToolbar;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expands a textStyle token (or responsive object of tokens) into concrete
|
|
3
|
-
* CSS property values that can be spread directly onto a Chakra component.
|
|
4
|
-
*
|
|
5
|
-
* Supports:
|
|
6
|
-
* - Static values: `textStyle="heading-3"` → `{ fontSize, lineHeight, fontWeight }`
|
|
7
|
-
* - Responsive objects: `textStyle={{ mobile: 'heading-5', desktop: 'heading-3' }}`
|
|
8
|
-
* → `{ fontSize: { md: '...', '2xl': '...' }, lineHeight: { ... }, ... }`
|
|
9
|
-
*
|
|
10
|
-
* @param {any} value - A textStyle token string, responsive object, or undefined/null.
|
|
11
|
-
* @returns {Record<string, any>} An object of CSS props to spread, or an empty object if no match.
|
|
12
|
-
*/
|
|
13
|
-
export declare function expandTextStyleProps(value: any): Record<string, any>;
|
|
@@ -1,265 +0,0 @@
|
|
|
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 only the specific tokens needed for text styles, rather than the
|
|
20
|
-
// entire foundations module. This avoids pulling unused tokens (colors,
|
|
21
|
-
// shadows, borders, etc.) into the layout bundle.
|
|
22
|
-
import { fontSizeXs, fontSizeSm, fontSizeBase, fontSizeLg, fontSizeXl, fontSizeXxl, fontSizeXxxl, fontSizeXxxxl, fontSizeXxxxxl, fontSize6Xl, fontSize7Xl, fontSize8Xl, lineHeightXs, lineHeightSm, lineHeightBase, lineHeightBaseTight, lineHeightLg, lineHeightLgTight, lineHeightXl, lineHeightXlTight, lineHeightXxl, lineHeightXxxl, lineHeightXxxxl, lineHeightXxxxxl, lineHeight6Xl, lineHeight7Xl, lineHeight8Xl, fontWeightBook, fontWeightBold, fontWeightBlack, fontWeightLight, letterSpacingTight, letterSpacingHero, fontFamilyLarken } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
23
|
-
import { BpkBreakpointToChakraKey } from "./tokens";
|
|
24
|
-
/**
|
|
25
|
-
* Maps Backpack text style tokens to concrete CSS properties.
|
|
26
|
-
*
|
|
27
|
-
* This map is intentionally kept outside the Chakra theme config so that
|
|
28
|
-
* layout-only consumers (who never use textStyle) do not pay for it.
|
|
29
|
-
* Components that use textStyle expand it inline via `expandTextStyleProps`.
|
|
30
|
-
*/
|
|
31
|
-
const TEXT_STYLE_MAP = {
|
|
32
|
-
xs: {
|
|
33
|
-
fontSize: fontSizeXs,
|
|
34
|
-
lineHeight: lineHeightXs,
|
|
35
|
-
fontWeight: fontWeightBook
|
|
36
|
-
},
|
|
37
|
-
sm: {
|
|
38
|
-
fontSize: fontSizeSm,
|
|
39
|
-
lineHeight: lineHeightSm,
|
|
40
|
-
fontWeight: fontWeightBook
|
|
41
|
-
},
|
|
42
|
-
base: {
|
|
43
|
-
fontSize: fontSizeBase,
|
|
44
|
-
lineHeight: lineHeightBase,
|
|
45
|
-
fontWeight: fontWeightBook
|
|
46
|
-
},
|
|
47
|
-
lg: {
|
|
48
|
-
fontSize: fontSizeLg,
|
|
49
|
-
lineHeight: lineHeightLg,
|
|
50
|
-
fontWeight: fontWeightBook
|
|
51
|
-
},
|
|
52
|
-
xl: {
|
|
53
|
-
fontSize: fontSizeXl,
|
|
54
|
-
lineHeight: lineHeightXl,
|
|
55
|
-
fontWeight: fontWeightBook
|
|
56
|
-
},
|
|
57
|
-
xxl: {
|
|
58
|
-
fontSize: fontSizeXxl,
|
|
59
|
-
lineHeight: lineHeightXxl,
|
|
60
|
-
fontWeight: fontWeightBold
|
|
61
|
-
},
|
|
62
|
-
xxxl: {
|
|
63
|
-
fontSize: fontSizeXxxl,
|
|
64
|
-
lineHeight: lineHeightXxxl,
|
|
65
|
-
fontWeight: fontWeightBold
|
|
66
|
-
},
|
|
67
|
-
xxxxl: {
|
|
68
|
-
fontSize: fontSizeXxxxl,
|
|
69
|
-
lineHeight: lineHeightXxxxl,
|
|
70
|
-
fontWeight: fontWeightBold,
|
|
71
|
-
letterSpacing: letterSpacingTight
|
|
72
|
-
},
|
|
73
|
-
xxxxxl: {
|
|
74
|
-
fontSize: fontSizeXxxxxl,
|
|
75
|
-
lineHeight: lineHeightXxxxxl,
|
|
76
|
-
fontWeight: fontWeightBold,
|
|
77
|
-
letterSpacing: letterSpacingTight
|
|
78
|
-
},
|
|
79
|
-
caption: {
|
|
80
|
-
fontSize: fontSizeXs,
|
|
81
|
-
lineHeight: lineHeightXs,
|
|
82
|
-
fontWeight: fontWeightBook
|
|
83
|
-
},
|
|
84
|
-
footnote: {
|
|
85
|
-
fontSize: fontSizeSm,
|
|
86
|
-
lineHeight: lineHeightSm,
|
|
87
|
-
fontWeight: fontWeightBook
|
|
88
|
-
},
|
|
89
|
-
'label-1': {
|
|
90
|
-
fontSize: fontSizeBase,
|
|
91
|
-
lineHeight: lineHeightBase,
|
|
92
|
-
fontWeight: fontWeightBold
|
|
93
|
-
},
|
|
94
|
-
'label-2': {
|
|
95
|
-
fontSize: fontSizeSm,
|
|
96
|
-
lineHeight: lineHeightSm,
|
|
97
|
-
fontWeight: fontWeightBold
|
|
98
|
-
},
|
|
99
|
-
'label-3': {
|
|
100
|
-
fontSize: fontSizeXs,
|
|
101
|
-
lineHeight: lineHeightXs,
|
|
102
|
-
fontWeight: fontWeightBold
|
|
103
|
-
},
|
|
104
|
-
'body-default': {
|
|
105
|
-
fontSize: fontSizeBase,
|
|
106
|
-
lineHeight: lineHeightBase,
|
|
107
|
-
fontWeight: fontWeightBook
|
|
108
|
-
},
|
|
109
|
-
'body-longform': {
|
|
110
|
-
fontSize: fontSizeLg,
|
|
111
|
-
lineHeight: lineHeightLg,
|
|
112
|
-
fontWeight: fontWeightBook
|
|
113
|
-
},
|
|
114
|
-
subheading: {
|
|
115
|
-
fontSize: fontSizeXl,
|
|
116
|
-
lineHeight: lineHeightXl,
|
|
117
|
-
fontWeight: fontWeightBook
|
|
118
|
-
},
|
|
119
|
-
'heading-1': {
|
|
120
|
-
fontSize: fontSizeXxxl,
|
|
121
|
-
lineHeight: lineHeightXxxl,
|
|
122
|
-
fontWeight: fontWeightBold
|
|
123
|
-
},
|
|
124
|
-
'heading-2': {
|
|
125
|
-
fontSize: fontSizeXxl,
|
|
126
|
-
lineHeight: lineHeightXxl,
|
|
127
|
-
fontWeight: fontWeightBold
|
|
128
|
-
},
|
|
129
|
-
'heading-3': {
|
|
130
|
-
fontSize: fontSizeXl,
|
|
131
|
-
lineHeight: lineHeightXlTight,
|
|
132
|
-
fontWeight: fontWeightBold
|
|
133
|
-
},
|
|
134
|
-
'heading-4': {
|
|
135
|
-
fontSize: fontSizeLg,
|
|
136
|
-
lineHeight: lineHeightLgTight,
|
|
137
|
-
fontWeight: fontWeightBold
|
|
138
|
-
},
|
|
139
|
-
'heading-5': {
|
|
140
|
-
fontSize: fontSizeBase,
|
|
141
|
-
lineHeight: lineHeightBaseTight,
|
|
142
|
-
fontWeight: fontWeightBold
|
|
143
|
-
},
|
|
144
|
-
'hero-1': {
|
|
145
|
-
fontSize: fontSize8Xl,
|
|
146
|
-
lineHeight: lineHeight8Xl,
|
|
147
|
-
fontWeight: fontWeightBlack,
|
|
148
|
-
letterSpacing: letterSpacingHero
|
|
149
|
-
},
|
|
150
|
-
'hero-2': {
|
|
151
|
-
fontSize: fontSize7Xl,
|
|
152
|
-
lineHeight: lineHeight7Xl,
|
|
153
|
-
fontWeight: fontWeightBlack,
|
|
154
|
-
letterSpacing: letterSpacingHero
|
|
155
|
-
},
|
|
156
|
-
'hero-3': {
|
|
157
|
-
fontSize: fontSize6Xl,
|
|
158
|
-
lineHeight: lineHeight6Xl,
|
|
159
|
-
fontWeight: fontWeightBlack,
|
|
160
|
-
letterSpacing: letterSpacingHero
|
|
161
|
-
},
|
|
162
|
-
'hero-4': {
|
|
163
|
-
fontSize: fontSizeXxxxxl,
|
|
164
|
-
lineHeight: lineHeightXxxxxl,
|
|
165
|
-
fontWeight: fontWeightBlack,
|
|
166
|
-
letterSpacing: letterSpacingHero
|
|
167
|
-
},
|
|
168
|
-
'hero-5': {
|
|
169
|
-
fontSize: fontSizeXxxxl,
|
|
170
|
-
lineHeight: lineHeightXxxl,
|
|
171
|
-
fontWeight: fontWeightBlack,
|
|
172
|
-
letterSpacing: letterSpacingHero
|
|
173
|
-
},
|
|
174
|
-
'hero-6': {
|
|
175
|
-
fontSize: fontSizeXxxl,
|
|
176
|
-
lineHeight: lineHeightXxl,
|
|
177
|
-
fontWeight: fontWeightBlack,
|
|
178
|
-
letterSpacing: letterSpacingHero
|
|
179
|
-
},
|
|
180
|
-
'editorial-1': {
|
|
181
|
-
fontFamily: `var(--bpk-larken-font-stack, ${fontFamilyLarken})`,
|
|
182
|
-
fontSize: fontSizeXxxxl,
|
|
183
|
-
lineHeight: lineHeightXxxxl,
|
|
184
|
-
fontWeight: fontWeightLight
|
|
185
|
-
},
|
|
186
|
-
'editorial-2': {
|
|
187
|
-
fontFamily: `var(--bpk-larken-font-stack, ${fontFamilyLarken})`,
|
|
188
|
-
fontSize: fontSizeXxl,
|
|
189
|
-
lineHeight: lineHeightXxl,
|
|
190
|
-
fontWeight: fontWeightLight
|
|
191
|
-
},
|
|
192
|
-
'editorial-3': {
|
|
193
|
-
fontFamily: `var(--bpk-larken-font-stack, ${fontFamilyLarken})`,
|
|
194
|
-
fontSize: fontSizeLg,
|
|
195
|
-
lineHeight: lineHeightLg,
|
|
196
|
-
fontWeight: fontWeightBook
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Expands a textStyle token (or responsive object of tokens) into concrete
|
|
202
|
-
* CSS property values that can be spread directly onto a Chakra component.
|
|
203
|
-
*
|
|
204
|
-
* Supports:
|
|
205
|
-
* - Static values: `textStyle="heading-3"` → `{ fontSize, lineHeight, fontWeight }`
|
|
206
|
-
* - Responsive objects: `textStyle={{ mobile: 'heading-5', desktop: 'heading-3' }}`
|
|
207
|
-
* → `{ fontSize: { md: '...', '2xl': '...' }, lineHeight: { ... }, ... }`
|
|
208
|
-
*
|
|
209
|
-
* @param {any} value - A textStyle token string, responsive object, or undefined/null.
|
|
210
|
-
* @returns {Record<string, any>} An object of CSS props to spread, or an empty object if no match.
|
|
211
|
-
*/
|
|
212
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
213
|
-
export function expandTextStyleProps(value) {
|
|
214
|
-
if (value == null) return {};
|
|
215
|
-
|
|
216
|
-
// Responsive object: { mobile: 'heading-5', desktop: 'heading-3' }
|
|
217
|
-
if (typeof value === 'object' && !Array.isArray(value)) {
|
|
218
|
-
// Normalise Backpack breakpoint keys to Chakra keys inline (avoids
|
|
219
|
-
// circular dependency on tokenUtils).
|
|
220
|
-
const normalized = {};
|
|
221
|
-
Object.entries(value).forEach(([key, val]) => {
|
|
222
|
-
if (key === 'base') {
|
|
223
|
-
normalized.base = val;
|
|
224
|
-
} else {
|
|
225
|
-
const chakraKey = BpkBreakpointToChakraKey[key];
|
|
226
|
-
if (chakraKey) {
|
|
227
|
-
normalized[chakraKey] = val;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
// Pivot from { bp -> token } to { cssProp -> { bp -> cssValue } }
|
|
233
|
-
const result = {};
|
|
234
|
-
Object.entries(normalized).forEach(([bp, token]) => {
|
|
235
|
-
const style = TEXT_STYLE_MAP[String(token)];
|
|
236
|
-
if (!style) {
|
|
237
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
238
|
-
// eslint-disable-next-line no-console
|
|
239
|
-
console.warn(`Unknown textStyle token "${String(token)}" at breakpoint "${bp}".`);
|
|
240
|
-
}
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
Object.entries(style).forEach(([cssProp, cssValue]) => {
|
|
244
|
-
if (!result[cssProp]) {
|
|
245
|
-
result[cssProp] = {};
|
|
246
|
-
}
|
|
247
|
-
result[cssProp][bp] = cssValue;
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
return result;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
// Static string value
|
|
254
|
-
const style = TEXT_STYLE_MAP[String(value)];
|
|
255
|
-
if (!style) {
|
|
256
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
257
|
-
// eslint-disable-next-line no-console
|
|
258
|
-
console.warn(`Unknown textStyle token "${String(value)}".`);
|
|
259
|
-
}
|
|
260
|
-
return {};
|
|
261
|
-
}
|
|
262
|
-
return {
|
|
263
|
-
...style
|
|
264
|
-
};
|
|
265
|
-
}
|