@bonprix-ds/react-tab-group 1.0.2 → 1.1.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"TabGroup.js","names":[],"sources":["../../src/TabGroup.tsx"],"sourcesContent":["import React from \"react\";\n\nimport TabGroupContent from \"./TabGroupContent\";\nimport TabGroupItem from \"./TabGroupItem/TabGroupItem\";\nimport TabGroupList from \"./TabGroupList/TabGroupList\";\nimport TabGroupRoot, { type TabGroupProps } from \"./TabGroupRoot\";\n\nexport type { TabGroupProps, TabGroupVariant } from \"./TabGroupRoot\";\n\nconst TabGroup = (props: TabGroupProps) => <TabGroupRoot {...props} />;\n\nTabGroup.displayName = \"TabGroup\";\n\nTabGroup.Item = TabGroupItem;\nTabGroup.Content = TabGroupContent;\nTabGroup.List = TabGroupList;\n\nexport default TabGroup;\n"],"mappings":";;;;;;;AASA,IAAM,KAAY,MAAyB,kBAAC,GAAD,EAAc,GAAI,EAAQ,CAAA;AAErE,EAAS,cAAc,YAEvB,EAAS,OAAO,GAChB,EAAS,UAAU,GACnB,EAAS,OAAO"}
1
+ {"version":3,"file":"TabGroup.js","names":["TabGroupContent","TabGroupContent_default","TabGroupItem","TabGroupList","TabGroupRoot","TabGroup","props"],"sources":["../../src/TabGroup.tsx"],"sourcesContent":["import React from \"react\";\n\nimport TabGroupContent from \"./TabGroupContent\";\nimport TabGroupItem from \"./TabGroupItem/TabGroupItem\";\nimport TabGroupList from \"./TabGroupList/TabGroupList\";\nimport TabGroupRoot, { type TabGroupProps } from \"./TabGroupRoot\";\n\nexport type { TabGroupProps, TabGroupVariant } from \"./TabGroupRoot\";\n\nconst TabGroup = (props: TabGroupProps) => <TabGroupRoot {...props} />;\n\nTabGroup.displayName = \"TabGroup\";\n\nTabGroup.Item = TabGroupItem;\nTabGroup.Content = TabGroupContent;\nTabGroup.List = TabGroupList;\n\nexport default TabGroup;\n"],"mappings":";;;;;;;AASA,IAAMK,KAAY,MAAyB,kBAACD,GAAD,EAAc,GAAIE,EAAQ,CAAA;AAErE,EAAS,cAAc,YAEvB,EAAS,OAAOJ,GAChB,EAAS,UAAUF,GACnB,EAAS,OAAOG"}
@@ -1 +1 @@
1
- {"version":3,"file":"TabGroupContent.js","names":[],"sources":["../../../src/TabGroupContent/TabGroupContent.tsx"],"sourcesContent":["\"use client\";\n\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport React, { ReactNode } from \"react\";\n\nexport interface TabGroupContentProps {\n /** The unique identifier for the tab content. With its help the tab content can be referenced programmatically. */\n value: string;\n /** The content of the tab content. */\n children: ReactNode;\n}\n\nconst TabGroupContent = ({ children, value }: TabGroupContentProps) => {\n return <TabsPrimitive.Content value={value}>{children}</TabsPrimitive.Content>;\n};\n\nTabGroupContent.displayName = \"TabGroup.Content\";\n\nexport default TabGroupContent;\n"],"mappings":";;;;;AAYA,IAAM,KAAmB,EAAE,aAAU,eAC5B,kBAAC,EAAc,SAAf;CAA8B;CAAQ;AAAgC,CAAA;AAG/E,EAAgB,cAAc"}
1
+ {"version":3,"file":"TabGroupContent.js","names":["TabsPrimitive","TabGroupContent"],"sources":["../../../src/TabGroupContent/TabGroupContent.tsx"],"sourcesContent":["\"use client\";\n\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport React, { ReactNode } from \"react\";\n\nexport interface TabGroupContentProps {\n /** The unique identifier for the tab content. With its help the tab content can be referenced programmatically. */\n value: string;\n /** The content of the tab content. */\n children: ReactNode;\n}\n\nconst TabGroupContent = ({ children, value }: TabGroupContentProps) => {\n return <TabsPrimitive.Content value={value}>{children}</TabsPrimitive.Content>;\n};\n\nTabGroupContent.displayName = \"TabGroup.Content\";\n\nexport default TabGroupContent;\n"],"mappings":";;;;;AAYA,IAAMC,KAAmB,EAAE,aAAU,eAC5B,kBAACD,EAAc,SAAf;CAA8B;CAAQ;AAAgC,CAAA;AAG/E,EAAgB,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/TabGroupContent/index.ts"],"sourcesContent":["import TabGroupContent from \"./TabGroupContent\";\n\nexport default TabGroupContent;\n"],"mappings":";;AAEA,IAAA,IAAe"}
1
+ {"version":3,"file":"index.js","names":["TabGroupContent","TabGroupContent_default"],"sources":["../../../src/TabGroupContent/index.ts"],"sourcesContent":["import TabGroupContent from \"./TabGroupContent\";\n\nexport default TabGroupContent;\n"],"mappings":";;AAEA,IAAAC,IAAeD"}
@@ -1 +1 @@
1
- {"version":3,"file":"TabGroupContext.js","names":[],"sources":["../../src/TabGroupContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\n\nimport { TabGroupVariant } from \"./TabGroup\";\n\nexport interface TabGroupContextProps {\n fullWidth?: boolean;\n variant: TabGroupVariant;\n}\n\nconst TabGroupContext = createContext<TabGroupContextProps>({\n fullWidth: false,\n variant: \"tab\",\n});\n\nexport default TabGroupContext;\n"],"mappings":";;;AAWA,IAAM,IAAkB,EAAoC;CAC1D,WAAW;CACX,SAAS;AACX,CAAC"}
1
+ {"version":3,"file":"TabGroupContext.js","names":["TabGroupContext","createContext"],"sources":["../../src/TabGroupContext.ts"],"sourcesContent":["\"use client\";\n\nimport { createContext } from \"react\";\n\nimport { TabGroupVariant } from \"./TabGroup\";\n\nexport interface TabGroupContextProps {\n fullWidth?: boolean;\n variant: TabGroupVariant;\n}\n\nconst TabGroupContext = createContext<TabGroupContextProps>({\n fullWidth: false,\n variant: \"tab\",\n});\n\nexport default TabGroupContext;\n"],"mappings":";;;AAWA,IAAMA,IAAkBC,EAAoC;CAC1D,WAAW;CACX,SAAS;AACX,CAAC"}
@@ -12,13 +12,13 @@ var u = i({
12
12
  "preflight",
13
13
  a,
14
14
  "hover:after:border-b-2 hover:after:border-current",
15
- "data-[state=active]:after:border-b-4 data-[state=active]:after:h-1 data-[state=active]:after:border-current",
15
+ "data-[state=active]:after:h-1 data-[state=active]:after:border-b-4 data-[state=active]:after:border-current",
16
16
  "text-inherit"
17
17
  ],
18
- iconContainer: "flex max-w-10 h-7",
18
+ iconContainer: "flex h-7 max-w-10",
19
19
  labelContainer: c,
20
20
  labelClass: s,
21
- dummyBoldLabelClass: "h-0 font-bold invisible",
21
+ dummyBoldLabelClass: "invisible h-0 font-bold",
22
22
  sublabelClass: "line-clamp-1"
23
23
  },
24
24
  variants: { variant: {
@@ -27,8 +27,8 @@ var u = i({
27
27
  labelContainer: l
28
28
  },
29
29
  "tab-box": {
30
- container: ["px-1 py-4 items-center focus-visible:outline outline-2 outline-offset-2 outline-current", "border-current border after:absolute data-[state=active]:after:rounded-b-sm after:rounded-b-sm flex-auto"],
31
- labelContainer: "items-center [overflow-wrap:anywhere] text-center hyphens-auto",
30
+ container: ["items-center px-1 py-4 outline-2 outline-offset-2 outline-current focus-visible:outline", "flex-auto border border-current after:absolute after:rounded-b-sm data-[state=active]:after:rounded-b-sm"],
31
+ labelContainer: "items-center hyphens-auto text-center [overflow-wrap:anywhere]",
32
32
  labelClass: "group-data-[state=active]:font-bold"
33
33
  }
34
34
  } }
@@ -1 +1 @@
1
- {"version":3,"file":"TabGroupItem.js","names":[],"sources":["../../../src/TabGroupItem/TabGroupItem.tsx"],"sourcesContent":["\"use client\";\n\nimport * as Tabs from \"@radix-ui/react-tabs\";\nimport React, { ReactNode } from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport {\n tabStyleContainerBase,\n tabStyleContainerVariant,\n tabStyleLabelClass,\n tabStyleLabelContainerBase,\n tabStyleLabelContainerVariant,\n} from \"@bonprix-ds/internal-components\";\n\nimport useTabGroup from \"../useTabGroup\";\n\nconst generateClasses = tv({\n slots: {\n container: [\n \"preflight\",\n tabStyleContainerBase,\n \"hover:after:border-b-2 hover:after:border-current\",\n \"data-[state=active]:after:border-b-4 data-[state=active]:after:h-1 data-[state=active]:after:border-current\",\n // in order to use 'current' as color values, we need to inherit the color (primary) from TabGroupList,\n // because <button> is given a User Agent propietary color (black, not our primary)\n \"text-inherit\",\n ],\n iconContainer: \"flex max-w-10 h-7\",\n labelContainer: tabStyleLabelContainerBase,\n labelClass: tabStyleLabelClass,\n dummyBoldLabelClass: \"h-0 font-bold invisible\",\n sublabelClass: \"line-clamp-1\",\n },\n variants: {\n variant: {\n tab: {\n container: tabStyleContainerVariant,\n labelContainer: tabStyleLabelContainerVariant,\n },\n \"tab-box\": {\n container: [\n \"px-1 py-4 items-center focus-visible:outline outline-2 outline-offset-2 outline-current\",\n \"border-current border after:absolute data-[state=active]:after:rounded-b-sm after:rounded-b-sm flex-auto\",\n ],\n labelContainer: \"items-center [overflow-wrap:anywhere] text-center hyphens-auto\",\n labelClass: \"group-data-[state=active]:font-bold\",\n },\n },\n },\n});\n\nexport interface TabGroupItemProps {\n /** Unique identifier for the tab item. With its help the tab item can be referenced programmatically. */\n value: string;\n /** The label of the tab item. */\n label: string;\n /** The sublabel of the tab item. */\n subLabel?: string;\n /** The icon of the tab item. */\n icon?: ReactNode;\n}\n\nconst TabGroupItem = ({ label, subLabel, icon, value }: TabGroupItemProps) => {\n const { variant } = useTabGroup();\n const { container, iconContainer, labelContainer, labelClass, dummyBoldLabelClass, sublabelClass } = generateClasses({\n variant,\n });\n return (\n <Tabs.Trigger className={container()} value={value} data-bpds-has-sublabel={!!subLabel}>\n {icon && <div className={iconContainer()}>{icon}</div>}\n <div className={labelContainer()}>\n <p className={labelClass()}>{label}</p>\n {/* When label gets bold in active state, its box takes up more space and causes a layout shift (button gets bigger).\n By adding the 'physical copy of the label text in bold, but invisible, the space is already created and therefore layout is consistent*/}\n {variant === \"tab-box\" && (\n <p className={dummyBoldLabelClass()} aria-hidden=\"true\">\n {label}\n </p>\n )}\n\n {subLabel && <p className={sublabelClass()}>{subLabel}</p>}\n </div>\n </Tabs.Trigger>\n );\n};\n\nTabGroupItem.displayName = \"TabGroup.Item\";\n\nexport default TabGroupItem;\n"],"mappings":";;;;;;;;AAgBA,IAAM,IAAkB,EAAG;CACzB,OAAO;EACL,WAAW;GACT;GACA;GACA;GACA;GAGA;EACF;EACA,eAAe;EACf,gBAAgB;EAChB,YAAY;EACZ,qBAAqB;EACrB,eAAe;CACjB;CACA,UAAU,EACR,SAAS;EACP,KAAK;GACH,WAAW;GACX,gBAAgB;EAClB;EACA,WAAW;GACT,WAAW,CACT,2FACA,0GACF;GACA,gBAAgB;GAChB,YAAY;EACd;CACF,EACF;AACF,CAAC,GAaK,KAAgB,EAAE,UAAO,aAAU,SAAM,eAA+B;CAC5E,IAAM,EAAE,eAAY,EAAY,GAC1B,EAAE,cAAW,kBAAe,mBAAgB,eAAY,wBAAqB,qBAAkB,EAAgB,EACnH,WACF,CAAC;CACD,OACE,kBAAC,EAAK,SAAN;EAAc,WAAW,EAAU;EAAU;EAAO,0BAAwB,CAAC,CAAC;EAA9E,UAAA,CACG,KAAQ,kBAAC,OAAD;GAAK,WAAW,EAAc;GAAI,UAAA;EAAU,CAAA,GACrD,kBAAC,OAAD;GAAK,WAAW,EAAe;GAA/B,UAAA;IACE,kBAAC,KAAD;KAAG,WAAW,EAAW;KAAI,UAAA;IAAS,CAAA;IAGrC,MAAY,aACX,kBAAC,KAAD;KAAG,WAAW,EAAoB;KAAG,eAAY;KAC9C,UAAA;IACA,CAAA;IAGJ,KAAY,kBAAC,KAAD;KAAG,WAAW,EAAc;KAAI,UAAA;IAAY,CAAA;GACtD;EACO,CAAA,CAAA;;AAElB;AAEA,EAAa,cAAc"}
1
+ {"version":3,"file":"TabGroupItem.js","names":["useTabGroup","Tabs","generateClasses","tv","tabStyleContainerBase","tabStyleLabelContainerBase","tabStyleLabelClass","tabStyleContainerVariant","tabStyleLabelContainerVariant","TabGroupItem","container","subLabel","icon","iconContainer","labelContainer","labelClass","label","variant","dummyBoldLabelClass","sublabelClass"],"sources":["../../../src/TabGroupItem/TabGroupItem.tsx"],"sourcesContent":["\"use client\";\n\nimport * as Tabs from \"@radix-ui/react-tabs\";\nimport React, { ReactNode } from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport {\n tabStyleContainerBase,\n tabStyleContainerVariant,\n tabStyleLabelClass,\n tabStyleLabelContainerBase,\n tabStyleLabelContainerVariant,\n} from \"@bonprix-ds/internal-components\";\n\nimport useTabGroup from \"../useTabGroup\";\n\nconst generateClasses = tv({\n slots: {\n container: [\n \"preflight\",\n tabStyleContainerBase,\n \"hover:after:border-b-2 hover:after:border-current\",\n \"data-[state=active]:after:h-1 data-[state=active]:after:border-b-4 data-[state=active]:after:border-current\",\n // in order to use 'current' as color values, we need to inherit the color (primary) from TabGroupList,\n // because <button> is given a User Agent propietary color (black, not our primary)\n \"text-inherit\",\n ],\n iconContainer: \"flex h-7 max-w-10\",\n labelContainer: tabStyleLabelContainerBase,\n labelClass: tabStyleLabelClass,\n dummyBoldLabelClass: \"invisible h-0 font-bold\",\n sublabelClass: \"line-clamp-1\",\n },\n variants: {\n variant: {\n tab: {\n container: tabStyleContainerVariant,\n labelContainer: tabStyleLabelContainerVariant,\n },\n \"tab-box\": {\n container: [\n \"items-center px-1 py-4 outline-2 outline-offset-2 outline-current focus-visible:outline\",\n \"flex-auto border border-current after:absolute after:rounded-b-sm data-[state=active]:after:rounded-b-sm\",\n ],\n labelContainer: \"items-center hyphens-auto text-center [overflow-wrap:anywhere]\",\n labelClass: \"group-data-[state=active]:font-bold\",\n },\n },\n },\n});\n\nexport interface TabGroupItemProps {\n /** Unique identifier for the tab item. With its help the tab item can be referenced programmatically. */\n value: string;\n /** The label of the tab item. */\n label: string;\n /** The sublabel of the tab item. */\n subLabel?: string;\n /** The icon of the tab item. */\n icon?: ReactNode;\n}\n\nconst TabGroupItem = ({ label, subLabel, icon, value }: TabGroupItemProps) => {\n const { variant } = useTabGroup();\n const { container, iconContainer, labelContainer, labelClass, dummyBoldLabelClass, sublabelClass } = generateClasses({\n variant,\n });\n return (\n <Tabs.Trigger className={container()} value={value} data-bpds-has-sublabel={!!subLabel}>\n {icon && <div className={iconContainer()}>{icon}</div>}\n <div className={labelContainer()}>\n <p className={labelClass()}>{label}</p>\n {/* When label gets bold in active state, its box takes up more space and causes a layout shift (button gets bigger).\n By adding the 'physical copy of the label text in bold, but invisible, the space is already created and therefore layout is consistent*/}\n {variant === \"tab-box\" && (\n <p className={dummyBoldLabelClass()} aria-hidden=\"true\">\n {label}\n </p>\n )}\n\n {subLabel && <p className={sublabelClass()}>{subLabel}</p>}\n </div>\n </Tabs.Trigger>\n );\n};\n\nTabGroupItem.displayName = \"TabGroup.Item\";\n\nexport default TabGroupItem;\n"],"mappings":";;;;;;;;AAgBA,IAAME,IAAkBC,EAAG;CACzB,OAAO;EACL,WAAW;GACT;GACAC;GACA;GACA;GAGA;EACF;EACA,eAAe;EACf,gBAAgBC;EAChB,YAAYC;EACZ,qBAAqB;EACrB,eAAe;CACjB;CACA,UAAU,EACR,SAAS;EACP,KAAK;GACH,WAAWC;GACX,gBAAgBC;EAClB;EACA,WAAW;GACT,WAAW,CACT,2FACA,0GACF;GACA,gBAAgB;GAChB,YAAY;EACd;CACF,EACF;AACF,CAAC,GAaKC,KAAgB,EAAE,UAAO,aAAU,SAAM,eAA+B;CAC5E,IAAM,EAAE,eAAYT,EAAY,GAC1B,EAAE,cAAW,kBAAe,mBAAgB,eAAY,wBAAqB,qBAAkBE,EAAgB,EACnH,WACF,CAAC;CACD,OACE,kBAACD,EAAK,SAAN;EAAc,WAAWS,EAAU;EAAU;EAAO,0BAAwB,CAAC,CAACC;EAA9E,UAAA,CACGC,KAAQ,kBAAC,OAAD;GAAK,WAAWC,EAAc;GAAI,UAAAD;EAAU,CAAA,GACrD,kBAAC,OAAD;GAAK,WAAWE,EAAe;GAA/B,UAAA;IACE,kBAAC,KAAD;KAAG,WAAWC,EAAW;KAAI,UAAAC;IAAS,CAAA;IAGrCC,MAAY,aACX,kBAAC,KAAD;KAAG,WAAWC,EAAoB;KAAG,eAAY;KAC9C,UAAAF;IACA,CAAA;IAGJL,KAAY,kBAAC,KAAD;KAAG,WAAWQ,EAAc;KAAI,UAAAR;IAAY,CAAA;GACtD;EACO,CAAA,CAAA;;AAElB;AAEA,EAAa,cAAc"}
@@ -10,7 +10,7 @@ var a = (e, t = !1) => e === "tab-box" ? `repeat(${t ? "auto-fit" : "auto-fill"}
10
10
  base: ["[&:has(button_svg)_button:not(:has(svg))_p:first-child]:mt-7"],
11
11
  variants: { variant: {
12
12
  tab: i,
13
- "tab-box": "text-clr-primary grid gap-x-3 gap-y-2 scrollbar-none"
13
+ "tab-box": "scrollbar-none grid gap-x-3 gap-y-2 text-clr-primary"
14
14
  } }
15
15
  }), s = ({ children: r }) => {
16
16
  let { variant: i, fullWidth: s } = e();
@@ -1 +1 @@
1
- {"version":3,"file":"TabGroupList.js","names":[],"sources":["../../../src/TabGroupList/TabGroupList.tsx"],"sourcesContent":["\"use client\";\n\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport React, { ReactNode } from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { tabStyleList } from \"@bonprix-ds/internal-components\";\n\nimport { TabGroupVariant } from \"../TabGroup\";\nimport useTabGroup from \"../useTabGroup\";\n\nconst getGridTemplateColumnsStyle = (variant: TabGroupVariant, fullWidth = false) => {\n const BOX_ITEM_MIN_WIDTH = \"4.6875rem\";\n if (variant !== \"tab-box\") return \"\";\n const repeatCount = fullWidth ? \"auto-fit\" : \"auto-fill\";\n const style = `repeat(${repeatCount}, minmax(${BOX_ITEM_MIN_WIDTH}, 1fr))`;\n return style;\n};\n\nconst generateClasses = tv({\n base: [\n // Following rule allows to align 'label' in a button with no SVG only if other buttons contain an SVG (logo or icon), according to design\n \"[&:has(button_svg)_button:not(:has(svg))_p:first-child]:mt-7\",\n ],\n variants: {\n variant: {\n tab: tabStyleList,\n \"tab-box\": \"text-clr-primary grid gap-x-3 gap-y-2 scrollbar-none\",\n },\n },\n});\n\nexport interface TabGroupListProps {\n /** Here, the TabGroup.Item subcomponents should be placed. */\n children: ReactNode;\n}\n\nconst TabGroupList = ({ children }: TabGroupListProps) => {\n const { variant, fullWidth } = useTabGroup();\n return (\n <TabsPrimitive.List\n className={generateClasses({ variant })}\n style={{ gridTemplateColumns: getGridTemplateColumnsStyle(variant, fullWidth) }}\n >\n {children}\n </TabsPrimitive.List>\n );\n};\n\nTabGroupList.displayName = \"TabGroup.List\";\n\nexport default TabGroupList;\n"],"mappings":";;;;;;;;AAWA,IAAM,KAA+B,GAA0B,IAAY,OAErE,MAAY,YAGT,UAFa,IAAY,aAAa,YACT,6BAFF,IAM9B,IAAkB,EAAG;CACzB,MAAM,CAEJ,8DACF;CACA,UAAU,EACR,SAAS;EACP,KAAK;EACL,WAAW;CACb,EACF;AACF,CAAC,GAOK,KAAgB,EAAE,kBAAkC;CACxD,IAAM,EAAE,YAAS,iBAAc,EAAY;CAC3C,OACE,kBAAC,EAAc,MAAf;EACE,WAAW,EAAgB,EAAE,WAAQ,CAAC;EACtC,OAAO,EAAE,qBAAqB,EAA4B,GAAS,CAAS,EAAE;EAE7E;CACiB,CAAA;AAExB;AAEA,EAAa,cAAc"}
1
+ {"version":3,"file":"TabGroupList.js","names":["useTabGroup","TabsPrimitive","getGridTemplateColumnsStyle","variant","fullWidth","generateClasses","tv","tabStyleList","TabGroupList"],"sources":["../../../src/TabGroupList/TabGroupList.tsx"],"sourcesContent":["\"use client\";\n\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport React, { ReactNode } from \"react\";\nimport { tv } from \"tailwind-variants\";\n\nimport { tabStyleList } from \"@bonprix-ds/internal-components\";\n\nimport { TabGroupVariant } from \"../TabGroup\";\nimport useTabGroup from \"../useTabGroup\";\n\nconst getGridTemplateColumnsStyle = (variant: TabGroupVariant, fullWidth = false) => {\n const BOX_ITEM_MIN_WIDTH = \"4.6875rem\";\n if (variant !== \"tab-box\") return \"\";\n const repeatCount = fullWidth ? \"auto-fit\" : \"auto-fill\";\n const style = `repeat(${repeatCount}, minmax(${BOX_ITEM_MIN_WIDTH}, 1fr))`;\n return style;\n};\n\nconst generateClasses = tv({\n base: [\n // Following rule allows to align 'label' in a button with no SVG only if other buttons contain an SVG (logo or icon), according to design\n \"[&:has(button_svg)_button:not(:has(svg))_p:first-child]:mt-7\",\n ],\n variants: {\n variant: {\n tab: tabStyleList,\n \"tab-box\": \"scrollbar-none grid gap-x-3 gap-y-2 text-clr-primary\",\n },\n },\n});\n\nexport interface TabGroupListProps {\n /** Here, the TabGroup.Item subcomponents should be placed. */\n children: ReactNode;\n}\n\nconst TabGroupList = ({ children }: TabGroupListProps) => {\n const { variant, fullWidth } = useTabGroup();\n return (\n <TabsPrimitive.List\n className={generateClasses({ variant })}\n style={{ gridTemplateColumns: getGridTemplateColumnsStyle(variant, fullWidth) }}\n >\n {children}\n </TabsPrimitive.List>\n );\n};\n\nTabGroupList.displayName = \"TabGroup.List\";\n\nexport default TabGroupList;\n"],"mappings":";;;;;;;;AAWA,IAAME,KAA+B,GAA0B,IAAY,OAErEC,MAAY,YAGT,UAFaC,IAAY,aAAa,YACT,6BAFF,IAM9BC,IAAkBC,EAAG;CACzB,MAAM,CAEJ,8DACF;CACA,UAAU,EACR,SAAS;EACP,KAAKC;EACL,WAAW;CACb,EACF;AACF,CAAC,GAOKC,KAAgB,EAAE,kBAAkC;CACxD,IAAM,EAAE,YAAS,iBAAcR,EAAY;CAC3C,OACE,kBAACC,EAAc,MAAf;EACE,WAAWI,EAAgB,EAAE,WAAQ,CAAC;EACtC,OAAO,EAAE,qBAAqBH,EAA4BC,GAASC,CAAS,EAAE;EAE7E;CACiB,CAAA;AAExB;AAEA,EAAa,cAAc"}
@@ -3,13 +3,25 @@ export type TabGroupVariant = "tab" | "tab-box";
3
3
  interface BaseProps {
4
4
  /** This property should contain all of the subcomponents of the TabGroup component (TabGroup.Item, TabGroup.Content, TabGroup.List). */
5
5
  children: ReactNode;
6
- /** The currently active tab. Should be used in conjunction with the `onChange` prop. */
7
- activeTab: string;
8
- /** Callback function that is called when the active tab changes. */
6
+ /** Callback function that is called when the selected tab changes. */
9
7
  onChange: (value: string) => void;
10
8
  /** Sets "the variant. */
11
9
  variant?: TabGroupVariant;
12
10
  }
11
+ interface SelectedProps {
12
+ /** The value of the selected tab. Should be used in conjunction with the `onChange` prop. */
13
+ selected: string;
14
+ /** @deprecated [tab-group-active-tab] Use `selected` instead. */
15
+ activeTab?: never;
16
+ }
17
+ interface DeprecatedSelectedProps {
18
+ selected?: never;
19
+ /**
20
+ * The value of the selected tab. Should be used in conjunction with the `onChange` prop.
21
+ * @deprecated [tab-group-active-tab] Use `selected` instead.
22
+ */
23
+ activeTab: string;
24
+ }
13
25
  interface TabBoxProps extends BaseProps {
14
26
  variant?: "tab-box";
15
27
  /** If true, the tab items will occupy the available width. */
@@ -19,9 +31,9 @@ interface TabProps extends BaseProps {
19
31
  variant?: "tab";
20
32
  fullWidth?: never;
21
33
  }
22
- export type TabGroupProps = TabBoxProps | TabProps;
34
+ export type TabGroupProps = (TabBoxProps | TabProps) & (DeprecatedSelectedProps | SelectedProps);
23
35
  declare const TabGroupRoot: {
24
- ({ children, activeTab, onChange, variant, fullWidth }: TabGroupProps): React.JSX.Element;
36
+ ({ children, selected: selectedProp, activeTab, onChange, variant, fullWidth }: TabGroupProps): React.JSX.Element;
25
37
  displayName: string;
26
38
  };
27
39
  export default TabGroupRoot;
@@ -3,25 +3,31 @@ import e from "./TabGroupContext.js";
3
3
  import "react";
4
4
  import * as t from "@radix-ui/react-tabs";
5
5
  import { jsx as n } from "react/jsx-runtime";
6
+ import { warnDeprecated as r } from "@bonprix-ds/utils/deprecation";
6
7
  //#region src/TabGroupRoot.tsx
7
- var r = ({ children: r, activeTab: i, onChange: a, variant: o = "tab", fullWidth: s }) => /* @__PURE__ */ n(t.Root, {
8
- className: "preflight",
9
- value: i,
10
- onValueChange: a,
11
- "data-bpds": "tab-group",
12
- "data-bpds-active-tab": i,
13
- "data-bpds-variant": o,
14
- "data-bpds-full-width": s,
15
- children: /* @__PURE__ */ n(e, {
16
- value: {
17
- fullWidth: s,
18
- variant: o
19
- },
20
- children: r
21
- })
22
- });
23
- r.displayName = "TabGroup";
8
+ var i = ({ children: i, selected: a, activeTab: o, onChange: s, variant: c = "tab", fullWidth: l }) => {
9
+ o !== void 0 && r("tab-group-active-tab");
10
+ let u = a ?? o;
11
+ return /* @__PURE__ */ n(t.Root, {
12
+ className: "preflight",
13
+ value: u,
14
+ onValueChange: s,
15
+ "data-bpds": "tab-group",
16
+ "data-bpds-selected": u,
17
+ "data-bpds-active-tab": u,
18
+ "data-bpds-variant": c,
19
+ "data-bpds-full-width": l,
20
+ children: /* @__PURE__ */ n(e, {
21
+ value: {
22
+ fullWidth: l,
23
+ variant: c
24
+ },
25
+ children: i
26
+ })
27
+ });
28
+ };
29
+ i.displayName = "TabGroup";
24
30
  //#endregion
25
- export { r as default };
31
+ export { i as default };
26
32
 
27
33
  //# sourceMappingURL=TabGroupRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TabGroupRoot.js","names":[],"sources":["../../src/TabGroupRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport React, { ReactNode } from \"react\";\n\nimport TabGroupContext from \"./TabGroupContext\";\n\nexport type TabGroupVariant = \"tab\" | \"tab-box\";\n\ninterface BaseProps {\n /** This property should contain all of the subcomponents of the TabGroup component (TabGroup.Item, TabGroup.Content, TabGroup.List). */\n children: ReactNode;\n /** The currently active tab. Should be used in conjunction with the `onChange` prop. */\n activeTab: string;\n /** Callback function that is called when the active tab changes. */\n onChange: (value: string) => void;\n /** Sets \"the variant. */\n variant?: TabGroupVariant;\n}\n\ninterface TabBoxProps extends BaseProps {\n variant?: \"tab-box\";\n /** If true, the tab items will occupy the available width. */\n fullWidth?: boolean;\n}\n\ninterface TabProps extends BaseProps {\n variant?: \"tab\";\n fullWidth?: never;\n}\n\nexport type TabGroupProps = TabBoxProps | TabProps;\n\nconst TabGroupRoot = ({ children, activeTab, onChange, variant = \"tab\", fullWidth }: TabGroupProps) => {\n return (\n <TabsPrimitive.Root\n className=\"preflight\"\n value={activeTab}\n onValueChange={onChange}\n data-bpds=\"tab-group\"\n data-bpds-active-tab={activeTab}\n data-bpds-variant={variant}\n data-bpds-full-width={fullWidth}\n >\n <TabGroupContext value={{ fullWidth, variant }}>{children}</TabGroupContext>\n </TabsPrimitive.Root>\n );\n};\n\nTabGroupRoot.displayName = \"TabGroup\";\n\nexport default TabGroupRoot;\n"],"mappings":";;;;;;AAiCA,IAAM,KAAgB,EAAE,aAAU,cAAW,aAAU,aAAU,OAAO,mBAEpE,kBAAC,EAAc,MAAf;CACE,WAAU;CACV,OAAO;CACP,eAAe;CACf,aAAU;CACV,wBAAsB;CACtB,qBAAmB;CACnB,wBAAsB;CAEtB,UAAA,kBAAC,GAAD;EAAiB,OAAO;GAAE;GAAW;EAAQ;EAAI;CAA0B,CAAA;AACzD,CAAA;AAIxB,EAAa,cAAc"}
1
+ {"version":3,"file":"TabGroupRoot.js","names":["TabGroupContext","TabsPrimitive","TabGroupRoot","selectedProp","activeTab","warnDeprecated","selected","onChange","variant","fullWidth"],"sources":["../../src/TabGroupRoot.tsx"],"sourcesContent":["\"use client\";\n\nimport * as TabsPrimitive from \"@radix-ui/react-tabs\";\nimport React, { ReactNode } from \"react\";\n\nimport { warnDeprecated } from \"@bonprix-ds/utils/deprecation\";\n\nimport TabGroupContext from \"./TabGroupContext\";\n\nexport type TabGroupVariant = \"tab\" | \"tab-box\";\n\ninterface BaseProps {\n /** This property should contain all of the subcomponents of the TabGroup component (TabGroup.Item, TabGroup.Content, TabGroup.List). */\n children: ReactNode;\n /** Callback function that is called when the selected tab changes. */\n onChange: (value: string) => void;\n /** Sets \"the variant. */\n variant?: TabGroupVariant;\n}\n\ninterface SelectedProps {\n /** The value of the selected tab. Should be used in conjunction with the `onChange` prop. */\n selected: string;\n /** @deprecated [tab-group-active-tab] Use `selected` instead. */\n activeTab?: never;\n}\n\ninterface DeprecatedSelectedProps {\n selected?: never;\n /**\n * The value of the selected tab. Should be used in conjunction with the `onChange` prop.\n * @deprecated [tab-group-active-tab] Use `selected` instead.\n */\n activeTab: string;\n}\n\ninterface TabBoxProps extends BaseProps {\n variant?: \"tab-box\";\n /** If true, the tab items will occupy the available width. */\n fullWidth?: boolean;\n}\n\ninterface TabProps extends BaseProps {\n variant?: \"tab\";\n fullWidth?: never;\n}\n\nexport type TabGroupProps = (TabBoxProps | TabProps) & (DeprecatedSelectedProps | SelectedProps);\n\nconst TabGroupRoot = ({ children, selected: selectedProp, activeTab, onChange, variant = \"tab\", fullWidth }: TabGroupProps) => {\n if (activeTab !== undefined) warnDeprecated(\"tab-group-active-tab\");\n const selected = selectedProp ?? activeTab;\n return (\n <TabsPrimitive.Root\n className=\"preflight\"\n value={selected}\n onValueChange={onChange}\n data-bpds=\"tab-group\"\n data-bpds-selected={selected}\n // @deprecated [tab-group-active-tab] data-bpds-active-tab goes in the major, use data-bpds-selected\n data-bpds-active-tab={selected}\n data-bpds-variant={variant}\n data-bpds-full-width={fullWidth}\n >\n <TabGroupContext value={{ fullWidth, variant }}>{children}</TabGroupContext>\n </TabsPrimitive.Root>\n );\n};\n\nTabGroupRoot.displayName = \"TabGroup\";\n\nexport default TabGroupRoot;\n"],"mappings":";;;;;;;AAiDA,IAAME,KAAgB,EAAE,aAAU,UAAUC,GAAc,cAAW,aAAU,aAAU,OAAO,mBAA+B;CAC7H,AAAIC,MAAc,KAAA,KAAWC,EAAe,sBAAsB;CAClE,IAAMC,IAAWH,KAAgBC;CACjC,OACE,kBAACH,EAAc,MAAf;EACE,WAAU;EACV,OAAOK;EACP,eAAeC;EACf,aAAU;EACV,sBAAoBD;EAEpB,wBAAsBA;EACtB,qBAAmBE;EACnB,wBAAsBC;EAEtB,UAAA,kBAACT,GAAD;GAAiB,OAAO;IAAE;IAAW;GAAQ;GAAI;EAA0B,CAAA;CACzD,CAAA;AAExB;AAEA,EAAa,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"useTabGroup.js","names":[],"sources":["../../src/useTabGroup.ts"],"sourcesContent":["import { useContext } from \"react\";\n\nimport TabGroupContext from \"./TabGroupContext\";\n\nconst useTabGroup = () => {\n return useContext(TabGroupContext);\n};\n\nexport default useTabGroup;\n"],"mappings":";;;AAIA,IAAM,UACG,EAAW,CAAe"}
1
+ {"version":3,"file":"useTabGroup.js","names":["TabGroupContext","useTabGroup","useContext"],"sources":["../../src/useTabGroup.ts"],"sourcesContent":["import { useContext } from \"react\";\n\nimport TabGroupContext from \"./TabGroupContext\";\n\nconst useTabGroup = () => {\n return useContext(TabGroupContext);\n};\n\nexport default useTabGroup;\n"],"mappings":";;;AAIA,IAAMC,UACGC,EAAWF,CAAe"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonprix-ds/react-tab-group",
3
- "version": "1.0.2",
3
+ "version": "1.1.1",
4
4
  "description": "TabGroup component, implemented in React, for the Bonprix Design System.",
5
5
  "keywords": [],
6
6
  "license": "UNLICENSED",
@@ -33,17 +33,17 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@radix-ui/react-tabs": "1.1.21",
36
- "@bonprix-ds/internal-components": "0.2.1"
36
+ "@bonprix-ds/internal-components": "0.2.3",
37
+ "@bonprix-ds/utils": "0.4.0"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@types/react": "19.3.0",
40
- "@vitejs/plugin-react": "6.1.1",
41
- "rollup-preserve-directives": "1.1.3",
42
- "vite": "8.3.0"
41
+ "vite": "8.3.2",
42
+ "@bonprix-ds/vite-config": "0.0.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "react": "^19.3.0",
46
- "react-dom": "^19.3.0",
45
+ "react": "^19",
46
+ "react-dom": "^19",
47
47
  "tailwind-variants": "0.3.1"
48
48
  },
49
49
  "scripts": {