@bitrise/bitkit-v2 0.3.147 → 0.3.148

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.
@@ -0,0 +1,20 @@
1
+ import { SegmentGroup } from '@chakra-ui/react/segment-group';
2
+ import { ReactNode } from 'react';
3
+ import { BitkitIconComponent } from '../../icons';
4
+ export type BitkitSegmentedControlProps = Omit<SegmentGroup.RootProps, 'disabled'> & {
5
+ children: ReactNode;
6
+ state?: 'disabled';
7
+ };
8
+ export interface BitkitSegmentedControlItemProps {
9
+ children: string;
10
+ disabled?: boolean;
11
+ icon?: BitkitIconComponent;
12
+ value: string;
13
+ }
14
+ declare const _default: import('react').ForwardRefExoticComponent<Omit<SegmentGroup.RootProps, "disabled"> & {
15
+ children: ReactNode;
16
+ state?: "disabled";
17
+ } & import('react').RefAttributes<HTMLDivElement>> & {
18
+ Item: import('react').ForwardRefExoticComponent<BitkitSegmentedControlItemProps & import('react').RefAttributes<HTMLLabelElement>>;
19
+ };
20
+ export default _default;
@@ -0,0 +1,35 @@
1
+ import { jsx as t, jsxs as d } from "react/jsx-runtime";
2
+ import { createContext as S } from "@chakra-ui/react";
3
+ import { SegmentGroup as o } from "@chakra-ui/react/segment-group";
4
+ import { forwardRef as s } from "react";
5
+ const [I, p] = S({
6
+ name: "SegmentedControlContext",
7
+ hookName: "useSegmentedControlContext",
8
+ providerName: "<BitkitSegmentedControl />"
9
+ }), l = s((n, i) => {
10
+ const { children: r, state: m, ...e } = n;
11
+ return /* @__PURE__ */ t(I, { value: { size: e.size }, children: /* @__PURE__ */ d(o.Root, { ref: i, disabled: m === "disabled", ...e, children: [
12
+ /* @__PURE__ */ t(o.Indicator, {}),
13
+ r
14
+ ] }) });
15
+ });
16
+ l.displayName = "BitkitSegmentedControl";
17
+ const u = {
18
+ lg: "24",
19
+ md: "16",
20
+ sm: "16"
21
+ }, a = s((n, i) => {
22
+ const { children: r, disabled: m, icon: e, value: c } = n, { size: C = "sm" } = p(), g = u[C] ?? "16";
23
+ return /* @__PURE__ */ d(o.Item, { ref: i, disabled: m, value: c, children: [
24
+ !!e && /* @__PURE__ */ t(e, { size: g }),
25
+ /* @__PURE__ */ t(o.ItemText, { children: r }),
26
+ /* @__PURE__ */ t(o.ItemHiddenInput, {})
27
+ ] });
28
+ });
29
+ a.displayName = "BitkitSegmentedControlItem";
30
+ const B = Object.assign(l, {
31
+ Item: a
32
+ });
33
+ export {
34
+ B as default
35
+ };
@@ -23,6 +23,7 @@ export { default as BitkitNativeSelect, type BitkitNativeSelectProps } from './B
23
23
  export { default as BitkitNumberInput, type BitkitNumberInputProps } from './BitkitNumberInput/BitkitNumberInput';
24
24
  export { default as BitkitRadio, type BitkitRadioProps } from './BitkitRadio/BitkitRadio';
25
25
  export { default as BitkitRadioGroup, type BitkitRadioGroupProps } from './BitkitRadioGroup/BitkitRadioGroup';
26
+ export { default as BitkitSegmentedControl, type BitkitSegmentedControlItemProps, type BitkitSegmentedControlProps, } from './BitkitSegmentedControl/BitkitSegmentedControl';
26
27
  export { default as BitkitSelect, type BitkitSelectProps } from './BitkitSelect/BitkitSelect';
27
28
  export { default as BitkitSelectMenu, type BitkitSelectMenuProps } from './BitkitSelectMenu/BitkitSelectMenu';
28
29
  export { default as BitkitTabs } from './BitkitTabs/BitkitTabs';
package/dist/main.js CHANGED
@@ -302,6 +302,7 @@ import { default as pu } from "./icons/IconWorkflowFlow.js";
302
302
  import { default as mu } from "./icons/IconXTwitter.js";
303
303
  import { default as Iu } from "./icons/IconXamarin.js";
304
304
  import { default as Cu } from "./icons/IconXcode.js";
305
+ import { default as Bu } from "./components/BitkitSegmentedControl/BitkitSegmentedControl.js";
305
306
  export {
306
307
  s as BitkitAccordion,
307
308
  u as BitkitActionBar,
@@ -329,6 +330,7 @@ export {
329
330
  a as BitkitProvider,
330
331
  oo as BitkitRadio,
331
332
  to as BitkitRadioGroup,
333
+ Bu as BitkitSegmentedControl,
332
334
  ao as BitkitSelect,
333
335
  lo as BitkitSelectMenu,
334
336
  so as BitkitTabs,
@@ -0,0 +1,32 @@
1
+ declare const segmentGroupSlotRecipe: import('@chakra-ui/react').SlotRecipeDefinition<"label" | "root" | "item" | "indicator" | "itemText" | "itemControl", {
2
+ fullWidth: {
3
+ true: {
4
+ root: {
5
+ display: "flex";
6
+ width: "100%";
7
+ };
8
+ item: {
9
+ flex: "1";
10
+ };
11
+ };
12
+ };
13
+ size: {
14
+ lg: {
15
+ item: {
16
+ paddingBlock: "12";
17
+ textStyle: "body/lg/regular";
18
+ };
19
+ };
20
+ md: {
21
+ item: {
22
+ paddingBlock: "8";
23
+ };
24
+ };
25
+ sm: {
26
+ item: {
27
+ paddingBlock: "6";
28
+ };
29
+ };
30
+ };
31
+ }>;
32
+ export default segmentGroupSlotRecipe;
@@ -0,0 +1,138 @@
1
+ import { segmentGroupAnatomy as o } from "@chakra-ui/react/anatomy";
2
+ import { defineSlotRecipe as e } from "@chakra-ui/react/styled-system";
3
+ const a = e({
4
+ slots: o.keys(),
5
+ className: "segment-group",
6
+ base: {
7
+ root: {
8
+ alignItems: "center",
9
+ backgroundColor: "background/secondary",
10
+ borderColor: "border/minimal",
11
+ borderRadius: "4",
12
+ borderStyle: "solid",
13
+ borderWidth: "1px",
14
+ display: "inline-flex",
15
+ gap: "1",
16
+ isolation: "isolate",
17
+ position: "relative"
18
+ },
19
+ // Zag.js positions the indicator via inline CSS variables (--width, --height, --top, --left).
20
+ // We must reference them here because our custom recipe replaces the Chakra default entirely.
21
+ indicator: {
22
+ backgroundColor: "background/primary",
23
+ borderRadius: "4",
24
+ boxShadow: "small",
25
+ height: "var(--height)",
26
+ left: "var(--left)",
27
+ outline: "1px solid",
28
+ outlineColor: "border/regular",
29
+ position: "absolute",
30
+ top: "var(--top)",
31
+ width: "var(--width)",
32
+ zIndex: -1
33
+ },
34
+ item: {
35
+ alignItems: "center",
36
+ borderRadius: "4",
37
+ color: "text/secondary",
38
+ cursor: "pointer",
39
+ _icon: {
40
+ color: "icon/secondary"
41
+ },
42
+ display: "flex",
43
+ gap: "4",
44
+ justifyContent: "center",
45
+ paddingInline: "12",
46
+ position: "relative",
47
+ textStyle: "body/md/regular",
48
+ // Vertical separator between items
49
+ _before: {
50
+ backgroundColor: "border/minimal",
51
+ content: '""',
52
+ insetBlock: "8",
53
+ insetInlineStart: "-1px",
54
+ position: "absolute",
55
+ width: "1"
56
+ },
57
+ // Hide separator on first item, and on both sides of the checked item
58
+ "& + &[data-state=checked], &[data-state=checked] + &, &:first-of-type": {
59
+ _before: { opacity: "0" }
60
+ },
61
+ // Focus ring on item when its hidden input is focused (same as Chakra default)
62
+ "&:has(input:focus-visible)": {
63
+ focusRing: "outside"
64
+ },
65
+ _hover: {
66
+ backgroundColor: "background/hover",
67
+ color: "text/primary",
68
+ _active: {
69
+ backgroundColor: "background/active"
70
+ }
71
+ },
72
+ _active: {
73
+ backgroundColor: "background/active",
74
+ color: "text/primary"
75
+ },
76
+ _checked: {
77
+ backgroundColor: "transparent",
78
+ color: "text/primary",
79
+ _active: {
80
+ backgroundColor: "transparent"
81
+ },
82
+ _hover: {
83
+ backgroundColor: "transparent",
84
+ _active: {
85
+ backgroundColor: "transparent"
86
+ }
87
+ }
88
+ },
89
+ _disabled: {
90
+ color: "text/disabled",
91
+ cursor: "not-allowed",
92
+ _hover: {
93
+ backgroundColor: "transparent"
94
+ }
95
+ }
96
+ },
97
+ itemText: {
98
+ paddingInline: "4"
99
+ }
100
+ },
101
+ variants: {
102
+ fullWidth: {
103
+ true: {
104
+ root: {
105
+ display: "flex",
106
+ width: "100%"
107
+ },
108
+ item: {
109
+ flex: "1"
110
+ }
111
+ }
112
+ },
113
+ size: {
114
+ lg: {
115
+ item: {
116
+ paddingBlock: "12",
117
+ textStyle: "body/lg/regular"
118
+ }
119
+ },
120
+ md: {
121
+ item: {
122
+ paddingBlock: "8"
123
+ }
124
+ },
125
+ sm: {
126
+ item: {
127
+ paddingBlock: "6"
128
+ }
129
+ }
130
+ }
131
+ },
132
+ defaultVariants: {
133
+ size: "sm"
134
+ }
135
+ });
136
+ export {
137
+ a as default
138
+ };
@@ -497,6 +497,37 @@ declare const slotRecipes: {
497
497
  };
498
498
  };
499
499
  }>;
500
+ segmentGroup: import('@chakra-ui/react').SlotRecipeDefinition<"label" | "root" | "item" | "indicator" | "itemText" | "itemControl", {
501
+ fullWidth: {
502
+ true: {
503
+ root: {
504
+ display: "flex";
505
+ width: "100%";
506
+ };
507
+ item: {
508
+ flex: "1";
509
+ };
510
+ };
511
+ };
512
+ size: {
513
+ lg: {
514
+ item: {
515
+ paddingBlock: "12";
516
+ textStyle: "body/lg/regular";
517
+ };
518
+ };
519
+ md: {
520
+ item: {
521
+ paddingBlock: "8";
522
+ };
523
+ };
524
+ sm: {
525
+ item: {
526
+ paddingBlock: "6";
527
+ };
528
+ };
529
+ };
530
+ }>;
500
531
  select: import('@chakra-ui/react').SlotRecipeDefinition<"content" | "label" | "root" | "item" | "itemIndicator" | "trigger" | "positioner" | "indicator" | "list" | "clearTrigger" | "control" | "valueText" | "itemText" | "itemGroup" | "itemGroupLabel" | "indicatorGroup" | "searchInputGroup" | "searchInput" | "createItemContainer" | "createItem", {
501
532
  size: {
502
533
  lg: Record<string, import('@chakra-ui/react').SystemStyleObject>;
@@ -16,13 +16,14 @@ import b from "./Menu.recipe.js";
16
16
  import n from "./NativeSelect.recipe.js";
17
17
  import s from "./NumberInput.recipe.js";
18
18
  import u from "./RadioGroup.recipe.js";
19
- import { selectSlotRecipe as x } from "./Select.recipe.js";
20
- import k from "./Switch.recipe.js";
19
+ import x from "./SegmentGroup.recipe.js";
20
+ import { selectSlotRecipe as k } from "./Select.recipe.js";
21
+ import g from "./Switch.recipe.js";
21
22
  import h from "./Table.recipe.js";
22
23
  import v from "./Tabs.recipe.js";
23
- import P from "./Tag.recipe.js";
24
- import g from "./Tooltip.recipe.js";
25
- const W = {
24
+ import G from "./Tag.recipe.js";
25
+ import P from "./Tooltip.recipe.js";
26
+ const Y = {
26
27
  actionBar: o,
27
28
  avatar: r,
28
29
  breadcrumb: i,
@@ -39,15 +40,16 @@ const W = {
39
40
  alert: t,
40
41
  numberInput: s,
41
42
  radioGroup: u,
42
- select: x,
43
- switch: k,
43
+ segmentGroup: x,
44
+ select: k,
45
+ switch: g,
44
46
  table: h,
45
47
  tabs: v,
46
- tag: P,
47
- tooltip: g,
48
+ tag: G,
49
+ tooltip: P,
48
50
  accordion: e,
49
51
  menu: b
50
52
  };
51
53
  export {
52
- W as default
54
+ Y as default
53
55
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit-v2",
3
3
  "private": false,
4
- "version": "0.3.147",
4
+ "version": "0.3.148",
5
5
  "description": "Bitrise Design System Components built with Chakra UI V3",
6
6
  "keywords": [
7
7
  "react",