@bitrise/bitkit 13.302.0 → 13.304.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "13.302.0",
4
+ "version": "13.304.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+ssh://git@github.com/bitrise-io/bitkit.git"
@@ -29,6 +29,7 @@ import { AvatarProps } from '../Avatar/Avatar';
29
29
  import { getDataAttributes } from '../../utils/utils';
30
30
  import Tag from '../Tag/Tag';
31
31
  import Box from '../Box/Box';
32
+ import Text from '../Text/Text';
32
33
  import IconButton from '../IconButton/IconButton';
33
34
  import { DropdownEventArgs, DropdownProvider, useDropdownContext, useDropdownStyles } from './Dropdown.context';
34
35
  import { DropdownDetailedOption, DropdownGroup, DropdownOption, DropdownOptionProps } from './DropdownOption';
@@ -38,7 +39,14 @@ import { NoResultsFound, useSimpleSearch } from './hooks/useSimpleSearch';
38
39
  import { isSearchable } from './isNodeMatch';
39
40
  import { DropdownProps } from './DropdownProps';
40
41
 
41
- const MultiSelectContext = createContext<{ invalidValues?: string[] } | undefined>(undefined);
42
+ const MultiSelectContext = createContext<
43
+ | {
44
+ invalidValues?: string[];
45
+ isConstrained?: boolean;
46
+ itemType?: string;
47
+ }
48
+ | undefined
49
+ >(undefined);
42
50
 
43
51
  type DropdownSearchCustomProps = {
44
52
  value?: string;
@@ -134,7 +142,11 @@ function findOption<T>(
134
142
  if (React.isValidElement(elem) && !elem.props.isDisabled) {
135
143
  const optValue = typeof elem.props.value === 'undefined' ? null : elem.props.value;
136
144
  if (elem.type === DropdownOption && optValue === value) {
137
- return { index: elem.props.index, label: elem.props.children, avatar: elem.props.avatar };
145
+ return {
146
+ index: elem.props.index,
147
+ label: elem.props.children,
148
+ avatar: elem.props.avatar,
149
+ };
138
150
  }
139
151
  const ch =
140
152
  findOption(elem.props.children, value) || (isSearchable(elem.type) && findOption(elem.type(elem.props), value));
@@ -203,7 +215,12 @@ function useDropdown<T>({
203
215
  listRef,
204
216
  setActiveIndex,
205
217
  setSelectedIndex,
206
- } = useFloatingDropdown({ dropdownWidth, enabled: !readOnly, optionsRef, placement });
218
+ } = useFloatingDropdown({
219
+ dropdownWidth,
220
+ enabled: !readOnly,
221
+ optionsRef,
222
+ placement,
223
+ });
207
224
 
208
225
  const multiSelectContext = useContext(MultiSelectContext);
209
226
  const isMultiSelect = Boolean(multiSelectContext);
@@ -304,46 +321,63 @@ function useDropdown<T>({
304
321
  formValue.length > 0 ? (
305
322
  <Box alignItems="center" display="flex" gap={8}>
306
323
  <Box display="flex" flexGrow={1} flexWrap="wrap" gap={8}>
307
- {formValue
308
- ?.sort((a, b) => {
309
- if (typeof a === 'string' && typeof b === 'string') {
310
- return a.localeCompare(b);
311
- }
312
-
313
- if (a === null) {
314
- return -1;
315
- }
316
-
317
- return 1;
318
- })
319
- .map((formValueItem) => {
320
- if (typeof formValueItem !== 'string' && formValueItem !== null) {
321
- return <>{formValueItem}</>;
322
- }
323
-
324
- const colors = multiSelectContext?.invalidValues?.includes(formValueItem) ? 'red' : 'neutral';
325
- return (
326
- <Tag
327
- colorScheme={colors}
328
- isDisabled={disabled}
329
- key={formValueItem}
330
- onClose={(event) => {
331
- event.stopPropagation();
332
-
333
- setFormValue((previous: T) => {
334
- if (!Array.isArray(previous)) {
335
- return previous;
336
- }
337
-
338
- return previous.filter((aPrevious) => aPrevious !== formValueItem) as T;
339
- });
340
- }}
341
- size="sm"
342
- >
343
- {labelCache.get(formValueItem) || fallback?.(formValueItem) || formValueItem}
344
- </Tag>
345
- );
346
- })}
324
+ {multiSelectContext?.isConstrained ? (
325
+ <>
326
+ <Tag
327
+ size="sm"
328
+ colorScheme="neutral"
329
+ onClose={(event) => {
330
+ event.stopPropagation();
331
+ setFormValue([] as T);
332
+ }}
333
+ isDisabled={disabled}
334
+ >
335
+ {formValue.length}
336
+ </Tag>
337
+ <Text>{`${multiSelectContext.itemType} selected`}</Text>
338
+ </>
339
+ ) : (
340
+ formValue
341
+ ?.sort((a, b) => {
342
+ if (typeof a === 'string' && typeof b === 'string') {
343
+ return a.localeCompare(b);
344
+ }
345
+
346
+ if (a === null) {
347
+ return -1;
348
+ }
349
+
350
+ return 1;
351
+ })
352
+ .map((formValueItem) => {
353
+ if (typeof formValueItem !== 'string' && formValueItem !== null) {
354
+ return <>{formValueItem}</>;
355
+ }
356
+
357
+ const colors = multiSelectContext?.invalidValues?.includes(formValueItem) ? 'red' : 'neutral';
358
+ return (
359
+ <Tag
360
+ colorScheme={colors}
361
+ isDisabled={disabled}
362
+ key={formValueItem}
363
+ onClose={(event) => {
364
+ event.stopPropagation();
365
+
366
+ setFormValue((previous: T) => {
367
+ if (!Array.isArray(previous)) {
368
+ return previous;
369
+ }
370
+
371
+ return previous.filter((aPrevious) => aPrevious !== formValueItem) as T;
372
+ });
373
+ }}
374
+ size="sm"
375
+ >
376
+ {labelCache.get(formValueItem) || fallback?.(formValueItem) || formValueItem}
377
+ </Tag>
378
+ );
379
+ })
380
+ )}
347
381
  </Box>
348
382
  <IconButton
349
383
  aria-label="Clear all"
@@ -377,7 +411,7 @@ function useDropdown<T>({
377
411
  setSelectedAvatar(undefined);
378
412
  }
379
413
  }
380
- }, [refdChildren, formValue]);
414
+ }, [refdChildren, formValue, multiSelectContext]);
381
415
  return {
382
416
  avatar: selectedAvatar,
383
417
  context,
@@ -587,11 +621,20 @@ export function typedDropdown<T>() {
587
621
  };
588
622
  }
589
623
 
590
- export const MultiSelectDropdown = (props: DropdownProps<(string | null)[]> & { invalidValues?: string[] }) => {
624
+ export const MultiSelectDropdown = (
625
+ props: DropdownProps<(string | null)[]> & {
626
+ invalidValues?: string[];
627
+ isConstrained?: boolean;
628
+ itemType?: string;
629
+ },
630
+ ) => {
591
631
  const { Dropdown: TypedDropdown } = typedDropdown<(string | null)[]>();
592
632
 
593
- const { children, invalidValues, ...rest } = props;
594
- const contextValue = useMemo(() => ({ invalidValues }), [invalidValues]);
633
+ const { children, invalidValues, isConstrained, itemType, ...rest } = props;
634
+ const contextValue = useMemo(
635
+ () => ({ invalidValues, isConstrained, itemType }),
636
+ [invalidValues, isConstrained, itemType],
637
+ );
595
638
 
596
639
  return (
597
640
  <MultiSelectContext.Provider value={contextValue}>
@@ -289,7 +289,7 @@
289
289
  "subtle": "pal.neutral.93",
290
290
  "minimal": "pal.neutral.95",
291
291
  "disabled": "pal.neutral.95",
292
- "transparent": "pal.neutral.100 0%"
292
+ "transparent": "rgba(255, 255, 255, 0)"
293
293
  },
294
294
  "border": {
295
295
  "minimal": "pal.neutral.93",
@@ -377,6 +377,8 @@
377
377
  },
378
378
  "turquoise": {
379
379
  "base": "pal.turquoise.50",
380
+ "dark": "pal.turquoise.20",
381
+ "emphasized": "pal.turquoise.30",
380
382
  "strong": "pal.turquoise.40",
381
383
  "bold": "pal.turquoise.60",
382
384
  "muted": "pal.turquoise.80",
@@ -413,6 +415,7 @@
413
415
  "secondary": "sys.fg.secondary",
414
416
  "tertiary": "sys.fg.tertiary",
415
417
  "body": "sys.fg.base",
418
+ "helper": "sys.fg.secondary",
416
419
  "link": "sys.interactive.base",
417
420
  "link-hover": "sys.interactive.strong",
418
421
  "selected": "sys.interactive.base",
@@ -504,6 +507,40 @@
504
507
  "fg-hover": "sys.critical.base",
505
508
  "fg-active": "sys.critical.strong",
506
509
  "fg-disabled": "sys.fg.disabled"
510
+ },
511
+ "ai-primary": {
512
+ "bg": "sys.turquoise.strong",
513
+ "bg-hover": "sys.turquoise.emphasized",
514
+ "bg-active": "sys.turquoise.dark",
515
+ "bg-disabled": "sys.primary.disabled",
516
+ "fg": "sys.fg.on-color",
517
+ "fg-hover": "sys.fg.on-color",
518
+ "fg-active": "sys.fg.on-color",
519
+ "fg-disabled": "sys.fg.on-disabled"
520
+ },
521
+ "ai-secondary": {
522
+ "bg": "sys.bg.surface",
523
+ "bg-hover": "sys.turquoise.minimal",
524
+ "bg-active": "sys.turquoise.moderate",
525
+ "bg-disabled": "sys.bg.minimal",
526
+ "fg": "sys.turquoise.base",
527
+ "fg-hover": "sys.turquoise.base",
528
+ "fg-active": "sys.turquoise.strong",
529
+ "fg-disabled": "sys.fg.disabled",
530
+ "border": "sys.turquoise.muted",
531
+ "border-hover": "sys.turquoise.muted",
532
+ "border-active": "sys.turquoise.base",
533
+ "border-disabled": "sys.border.disabled"
534
+ },
535
+ "ai-tertiary": {
536
+ "bg": "sys.bg.transparent",
537
+ "bg-hover": "sys.turquoise.minimal",
538
+ "bg-active": "sys.turquoise.moderate",
539
+ "bg-disabled": "sys.bg.transparent",
540
+ "fg": "sys.turquoise.base",
541
+ "fg-hover": "sys.turquoise.base",
542
+ "fg-active": "sys.turquoise.strong",
543
+ "fg-disabled": "sys.fg.disabled"
507
544
  }
508
545
  },
509
546
  "input": {
@@ -577,15 +614,32 @@
577
614
  "border": "sys.neutral.muted",
578
615
  "icon": "sys.neutral.strong",
579
616
  "text": "sys.neutral.strong"
617
+ },
618
+ "ai": {
619
+ "bg": "sys.turquoise.minimal",
620
+ "bg-hover": "sys.turquoise.subtle",
621
+ "bg-active": "sys.turquoise.moderate",
622
+ "border": "sys.turquoise.muted",
623
+ "icon": "sys.turquoise.strong",
624
+ "text": "sys.turquoise.strong"
580
625
  }
581
626
  },
582
627
  "utilities": {
583
- "overlay": "rgba(32, 27, 34, 0.8)",
628
+ "overlay": "rgba(32, 27, 34, 0.5)",
584
629
  "overlay-side": "linear-gradient(90deg, rgba(32, 27, 34, 0) 0%, rgba(32, 27, 34, 0.32) 100%)",
585
630
  "overlay-light": "rgba(32, 27, 34, 0.16)",
586
631
  "skeleton": "sys.bg.subtle",
587
632
  "skeleton-strong": "sys.fg.minimal"
588
633
  },
634
+ "ui": {
635
+ "header-action": {
636
+ "bg": "rgba(255, 255, 255, 0)",
637
+ "bg-hover": "rgba(255, 255, 255, 0.1)",
638
+ "bg-active": "rgba(255, 255, 255, 0.2)",
639
+ "bg-selected": "rgba(255, 255, 255, 0.2)",
640
+ "bg-selected-hover": "rgba(255, 255, 255, 0.1)"
641
+ }
642
+ },
589
643
  "brand/primary": "pal.purple.30",
590
644
  "separator/primary": "pal.neutral.90",
591
645
  "sys/fg/base": "pal.neutral.10",
@@ -606,7 +660,7 @@
606
660
  "sys/bg/subtle": "pal.neutral.93",
607
661
  "sys/bg/minimal": "pal.neutral.95",
608
662
  "sys/bg/disabled": "pal.neutral.95",
609
- "sys/bg/transparent": "pal.neutral.100 0%",
663
+ "sys/bg/transparent": "rgba(255, 255, 255, 0)",
610
664
  "sys/border/minimal": "pal.neutral.93",
611
665
  "sys/border/subtle": "pal.neutral.90",
612
666
  "sys/border/strong": "pal.neutral.80",
@@ -674,6 +728,8 @@
674
728
  "sys/orange/subtle": "pal.orange.93",
675
729
  "sys/orange/minimal": "pal.orange.95",
676
730
  "sys/turquoise/base": "pal.turquoise.50",
731
+ "sys/turquoise/dark": "pal.turquoise.20",
732
+ "sys/turquoise/emphasized": "pal.turquoise.30",
677
733
  "sys/turquoise/strong": "pal.turquoise.40",
678
734
  "sys/turquoise/bold": "pal.turquoise.60",
679
735
  "sys/turquoise/muted": "pal.turquoise.80",
@@ -703,6 +759,7 @@
703
759
  "text/secondary": "sys.fg.secondary",
704
760
  "text/tertiary": "sys.fg.tertiary",
705
761
  "text/body": "sys.fg.base",
762
+ "text/helper": "sys.fg.secondary",
706
763
  "text/link": "sys.interactive.base",
707
764
  "text/link-hover": "sys.interactive.strong",
708
765
  "text/selected": "sys.interactive.base",
@@ -779,6 +836,34 @@
779
836
  "button/danger-tertiary/fg-hover": "sys.critical.base",
780
837
  "button/danger-tertiary/fg-active": "sys.critical.strong",
781
838
  "button/danger-tertiary/fg-disabled": "sys.fg.disabled",
839
+ "button/ai-primary/bg": "sys.turquoise.strong",
840
+ "button/ai-primary/bg-hover": "sys.turquoise.emphasized",
841
+ "button/ai-primary/bg-active": "sys.turquoise.dark",
842
+ "button/ai-primary/bg-disabled": "sys.primary.disabled",
843
+ "button/ai-primary/fg": "sys.fg.on-color",
844
+ "button/ai-primary/fg-hover": "sys.fg.on-color",
845
+ "button/ai-primary/fg-active": "sys.fg.on-color",
846
+ "button/ai-primary/fg-disabled": "sys.fg.on-disabled",
847
+ "button/ai-secondary/bg": "sys.bg.surface",
848
+ "button/ai-secondary/bg-hover": "sys.turquoise.minimal",
849
+ "button/ai-secondary/bg-active": "sys.turquoise.moderate",
850
+ "button/ai-secondary/bg-disabled": "sys.bg.minimal",
851
+ "button/ai-secondary/fg": "sys.turquoise.base",
852
+ "button/ai-secondary/fg-hover": "sys.turquoise.base",
853
+ "button/ai-secondary/fg-active": "sys.turquoise.strong",
854
+ "button/ai-secondary/fg-disabled": "sys.fg.disabled",
855
+ "button/ai-secondary/border": "sys.turquoise.muted",
856
+ "button/ai-secondary/border-hover": "sys.turquoise.muted",
857
+ "button/ai-secondary/border-active": "sys.turquoise.base",
858
+ "button/ai-secondary/border-disabled": "sys.border.disabled",
859
+ "button/ai-tertiary/bg": "sys.bg.transparent",
860
+ "button/ai-tertiary/bg-hover": "sys.turquoise.minimal",
861
+ "button/ai-tertiary/bg-active": "sys.turquoise.moderate",
862
+ "button/ai-tertiary/bg-disabled": "sys.bg.transparent",
863
+ "button/ai-tertiary/fg": "sys.turquoise.base",
864
+ "button/ai-tertiary/fg-hover": "sys.turquoise.base",
865
+ "button/ai-tertiary/fg-active": "sys.turquoise.strong",
866
+ "button/ai-tertiary/fg-disabled": "sys.fg.disabled",
782
867
  "input/text/label": "sys.fg.primary",
783
868
  "input/text/inputValue": "sys.fg.base",
784
869
  "input/text/placeholder": "sys.fg.subtle",
@@ -830,11 +915,22 @@
830
915
  "status/neutral/border": "sys.neutral.muted",
831
916
  "status/neutral/icon": "sys.neutral.strong",
832
917
  "status/neutral/text": "sys.neutral.strong",
833
- "utilities/overlay": "rgba(32, 27, 34, 0.8)",
918
+ "status/ai/bg": "sys.turquoise.minimal",
919
+ "status/ai/bg-hover": "sys.turquoise.subtle",
920
+ "status/ai/bg-active": "sys.turquoise.moderate",
921
+ "status/ai/border": "sys.turquoise.muted",
922
+ "status/ai/icon": "sys.turquoise.strong",
923
+ "status/ai/text": "sys.turquoise.strong",
924
+ "utilities/overlay": "rgba(32, 27, 34, 0.5)",
834
925
  "utilities/overlay-side": "linear-gradient(90deg, rgba(32, 27, 34, 0) 0%, rgba(32, 27, 34, 0.32) 100%)",
835
926
  "utilities/overlay-light": "rgba(32, 27, 34, 0.16)",
836
927
  "utilities/skeleton": "sys.bg.subtle",
837
- "utilities/skeleton-strong": "sys.fg.minimal"
928
+ "utilities/skeleton-strong": "sys.fg.minimal",
929
+ "ui/header-action/bg": "rgba(255, 255, 255, 0)",
930
+ "ui/header-action/bg-hover": "rgba(255, 255, 255, 0.1)",
931
+ "ui/header-action/bg-active": "rgba(255, 255, 255, 0.2)",
932
+ "ui/header-action/bg-selected": "rgba(255, 255, 255, 0.2)",
933
+ "ui/header-action/bg-selected-hover": "rgba(255, 255, 255, 0.1)"
838
934
  }
839
935
  },
840
936
  "shadows": {
@@ -1085,6 +1181,21 @@
1085
1181
  "letterSpacing": "2",
1086
1182
  "textTransform": "uppercase"
1087
1183
  },
1184
+ "heading/mobile/h1": {
1185
+ "fontWeight": "bold",
1186
+ "lineHeight": "size-5",
1187
+ "fontSize": "5"
1188
+ },
1189
+ "heading/mobile/h2": {
1190
+ "fontWeight": "bold",
1191
+ "lineHeight": "size-4",
1192
+ "fontSize": "4"
1193
+ },
1194
+ "heading/mobile/h3": {
1195
+ "fontWeight": "bold",
1196
+ "lineHeight": "size-3",
1197
+ "fontSize": "3"
1198
+ },
1088
1199
  "body/sm/regular": {
1089
1200
  "lineHeight": "size-1",
1090
1201
  "fontSize": "1",
@@ -1124,6 +1235,33 @@
1124
1235
  "fontSize": "3",
1125
1236
  "textDecoration": "underline"
1126
1237
  },
1238
+ "body/xl/regular": {
1239
+ "lineHeight": "size-4",
1240
+ "fontSize": "4"
1241
+ },
1242
+ "body/xl/semibold": {
1243
+ "fontWeight": "semibold",
1244
+ "lineHeight": "size-4",
1245
+ "fontSize": "4"
1246
+ },
1247
+ "body/2xl/regular": {
1248
+ "lineHeight": "size-5",
1249
+ "fontSize": "5"
1250
+ },
1251
+ "body/2xl/semibold": {
1252
+ "fontWeight": "semibold",
1253
+ "lineHeight": "size-5",
1254
+ "fontSize": "5"
1255
+ },
1256
+ "body/3xl/regular": {
1257
+ "lineHeight": "size-6",
1258
+ "fontSize": "6"
1259
+ },
1260
+ "body/3xl/semibold": {
1261
+ "fontWeight": "semibold",
1262
+ "lineHeight": "size-6",
1263
+ "fontSize": "6"
1264
+ },
1127
1265
  "code/md": {
1128
1266
  "fontFamily": "mono",
1129
1267
  "fontSize": "1",