periplo-ui 4.23.0 → 4.23.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,7 +1,7 @@
1
1
  import { ColorToken } from '../../../lib/utils';
2
2
  import * as TabsPrimitive from '@radix-ui/react-tabs';
3
3
  import * as React from 'react';
4
- declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
4
+ declare const Tabs: React.ForwardRefExoticComponent<Readonly<Omit<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>, "ref">> & React.RefAttributes<HTMLDivElement>>;
5
5
  type TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {
6
6
  fullWidth?: boolean;
7
7
  underlined?: boolean;
@@ -1,12 +1,20 @@
1
1
  import { cn, resolveColor } from "../../../lib/utils.js";
2
2
  import { Typography } from "../../data-display/Typography/Typography.js";
3
+ import { useTrackInputModality } from "../../../lib/inputModality.js";
3
4
  import { slidingIndicatorProps, useSlidingIndicator } from "../../../lib/useSlidingIndicator.js";
4
5
  import * as React$1 from "react";
5
6
  import { Slot } from "@radix-ui/react-slot";
6
7
  import { jsx } from "react/jsx-runtime";
7
8
  import * as TabsPrimitive from "@radix-ui/react-tabs";
8
9
  //#region src/components/navigation/Tabs/Tabs.tsx
9
- var Tabs = TabsPrimitive.Root;
10
+ var Tabs = React$1.forwardRef((props, ref) => {
11
+ useTrackInputModality();
12
+ return /* @__PURE__ */ jsx(TabsPrimitive.Root, {
13
+ ref,
14
+ ...props
15
+ });
16
+ });
17
+ Tabs.displayName = TabsPrimitive.Root.displayName;
10
18
  var TABS_TAB_ITEM_CLASSNAME = `data-[state=active]:text-foreground relative inline-flex shrink-0 items-center justify-center rounded-lg control-md h-(--control-height) px-3 whitespace-nowrap text-neutral-400 transition-colors press-fill hover:bg-neutral-50 [--focus-ring-offset:-2px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:hover:bg-transparent data-[state=active]:pointer-coarse:active:bg-transparent`;
11
19
  var TAB_INDICATOR_INSET = 2;
12
20
  function measureTab(active) {
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.js","names":["React"],"sources":["../../../../src/components/navigation/Tabs/Tabs.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport * as React from 'react'\n\nimport { Typography } from '../../data-display/Typography'\n\nimport { useSlidingIndicator, slidingIndicatorProps } from '@/lib/useSlidingIndicator'\nimport { cn, resolveColor, type ColorToken } from '@/lib/utils'\n\nconst Tabs = TabsPrimitive.Root\n\nconst TABS_TAB_ITEM_CLASSNAME = `data-[state=active]:text-foreground relative inline-flex shrink-0 items-center justify-center rounded-lg control-md h-(--control-height) px-3 whitespace-nowrap text-neutral-400 transition-colors press-fill hover:bg-neutral-50 [--focus-ring-offset:-2px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:hover:bg-transparent data-[state=active]:pointer-coarse:active:bg-transparent`\n\nconst TAB_INDICATOR_INSET = 2\n\nfunction measureTab(active: HTMLElement) {\n const range = document.createRange()\n range.selectNodeContents(active)\n const label = range.getBoundingClientRect()\n const hasLabel = label.width > 0\n const labelLeft = hasLabel ? label.left - active.getBoundingClientRect().left : 0\n const labelWidth = hasLabel ? label.width : active.offsetWidth\n const raw = active.style.getPropertyValue('--tab-active-color')\n return {\n left: active.offsetLeft + labelLeft + TAB_INDICATOR_INSET,\n width: Math.max(0, labelWidth - TAB_INDICATOR_INSET * 2),\n color: raw === '' ? undefined : raw,\n }\n}\n\nconst TAB_INDICATOR_OPTIONS = {\n activeSelector: '[data-state=active]',\n stateAttribute: 'data-state',\n measure: measureTab,\n}\n\ntype TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {\n fullWidth?: boolean\n underlined?: boolean\n}\n\nconst TabsList = React.forwardRef<React.ComponentRef<typeof TabsPrimitive.List>, Readonly<TabsListProps>>(\n ({ className, fullWidth, underlined, children, style, ...props }, ref) => {\n const listRef = React.useRef<HTMLDivElement>(null)\n React.useImperativeHandle(ref, () => listRef.current as HTMLDivElement, [])\n const indicator = useSlidingIndicator(listRef, TAB_INDICATOR_OPTIONS)\n\n return (\n <TabsPrimitive.List\n ref={listRef}\n {...slidingIndicatorProps(indicator)}\n className={cn(\n `\n relative flex scrollbar-none overflow-x-auto sliding-indicator-horizontal [-ms-overflow-style:none]\n after:absolute after:bottom-0 after:left-0 after:h-0.75 after:w-(--indicator-width)\n after:translate-x-(--indicator-left) after:bg-(--indicator-color)\n [&::-webkit-scrollbar]:hidden\n `,\n fullWidth ? 'w-full *:flex-1' : 'gap-2',\n underlined && 'shadow-[inset_0_-1px_0_var(--color-neutral-100)] *:mb-px',\n className,\n )}\n style={\n {\n '--indicator-left': `${indicator?.left ?? 0}px`,\n '--indicator-width': `${indicator?.width ?? 0}px`,\n '--indicator-color': indicator?.color ?? resolveColor(undefined),\n ...style,\n } as React.CSSProperties\n }\n {...props}\n >\n {children}\n </TabsPrimitive.List>\n )\n },\n)\nTabsList.displayName = TabsPrimitive.List.displayName\n\ntype TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & {\n color?: ColorToken | (string & {})\n}\n\nconst TabsTrigger = React.forwardRef<React.ComponentRef<typeof TabsPrimitive.Trigger>, Readonly<TabsTriggerProps>>(\n ({ className, children, color, style, ...props }, ref) => (\n <TabsPrimitive.Trigger\n asChild\n ref={ref}\n className={cn(TABS_TAB_ITEM_CLASSNAME, className)}\n style={\n {\n '--tab-active-color': resolveColor(color),\n ...style,\n } as React.CSSProperties\n }\n {...props}\n >\n <Typography variant=\"title-md\">{children}</Typography>\n </TabsPrimitive.Trigger>\n ),\n)\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\ntype TabsLinkProps = React.ComponentPropsWithoutRef<'a'> & {\n active?: boolean\n color?: ColorToken | (string & {})\n asChild?: boolean\n}\n\nconst TabsLink = React.forwardRef<HTMLAnchorElement, Readonly<TabsLinkProps>>(\n ({ className, children, color, style, active = false, asChild, ...props }, ref) => {\n const Comp = asChild ? Slot : 'a'\n\n return (\n <Comp\n ref={ref}\n data-state={active ? 'active' : 'inactive'}\n aria-current={active ? 'page' : undefined}\n className={cn(TABS_TAB_ITEM_CLASSNAME, className)}\n style={\n {\n '--tab-active-color': resolveColor(color),\n ...style,\n } as React.CSSProperties\n }\n {...props}\n >\n {asChild ? children : <Typography variant=\"title-md\">{children}</Typography>}\n </Comp>\n )\n },\n)\nTabsLink.displayName = 'TabsLink'\n\nconst TabsContent = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Content>,\n Readonly<React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>>\n>(({ className, ...props }, ref) => <TabsPrimitive.Content ref={ref} className={cn(`mt-2`, className)} {...props} />)\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, TabsLink, TabsContent }\n"],"mappings":";;;;;;;;AASA,IAAM,OAAO,cAAc;AAE3B,IAAM,0BAA0B;AAEhC,IAAM,sBAAsB;AAE5B,SAAS,WAAW,QAAqB;CACvC,MAAM,QAAQ,SAAS,YAAY;CACnC,MAAM,mBAAmB,MAAM;CAC/B,MAAM,QAAQ,MAAM,sBAAsB;CAC1C,MAAM,WAAW,MAAM,QAAQ;CAC/B,MAAM,YAAY,WAAW,MAAM,OAAO,OAAO,sBAAsB,CAAC,CAAC,OAAO;CAChF,MAAM,aAAa,WAAW,MAAM,QAAQ,OAAO;CACnD,MAAM,MAAM,OAAO,MAAM,iBAAiB,oBAAoB;CAC9D,OAAO;EACL,MAAM,OAAO,aAAa,YAAY;EACtC,OAAO,KAAK,IAAI,GAAG,aAAa,CAAuB;EACvD,OAAO,QAAQ,KAAK,KAAA,IAAY;CAClC;AACF;AAEA,IAAM,wBAAwB;CAC5B,gBAAgB;CAChB,gBAAgB;CAChB,SAAS;AACX;AAOA,IAAM,WAAWA,QAAM,YACpB,E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CAAA;AAEV,CACF;AACA,SAAS,cAAc;AAEvB,IAAM,cAAcA,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAAQ,oBAAC,cAAc,SAAf;CAA4B;CAAK,WAAW,GAAG,QAAQ,SAAS;CAAG,GAAI;AAAQ,CAAA,CAAC;AACpH,YAAY,cAAc,cAAc,QAAQ"}
1
+ {"version":3,"file":"Tabs.js","names":["React"],"sources":["../../../../src/components/navigation/Tabs/Tabs.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot'\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport * as React from 'react'\n\nimport { Typography } from '../../data-display/Typography'\n\nimport { useTrackInputModality } from '@/lib/inputModality'\nimport { useSlidingIndicator, slidingIndicatorProps } from '@/lib/useSlidingIndicator'\nimport { cn, resolveColor, type ColorToken } from '@/lib/utils'\n\nconst Tabs = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Root>,\n Readonly<React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root>>\n>((props, ref) => {\n useTrackInputModality()\n\n return <TabsPrimitive.Root ref={ref} {...props} />\n})\nTabs.displayName = TabsPrimitive.Root.displayName\n\nconst TABS_TAB_ITEM_CLASSNAME = `data-[state=active]:text-foreground relative inline-flex shrink-0 items-center justify-center rounded-lg control-md h-(--control-height) px-3 whitespace-nowrap text-neutral-400 transition-colors press-fill hover:bg-neutral-50 [--focus-ring-offset:-2px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:hover:bg-transparent data-[state=active]:pointer-coarse:active:bg-transparent`\n\nconst TAB_INDICATOR_INSET = 2\n\nfunction measureTab(active: HTMLElement) {\n const range = document.createRange()\n range.selectNodeContents(active)\n const label = range.getBoundingClientRect()\n const hasLabel = label.width > 0\n const labelLeft = hasLabel ? label.left - active.getBoundingClientRect().left : 0\n const labelWidth = hasLabel ? label.width : active.offsetWidth\n const raw = active.style.getPropertyValue('--tab-active-color')\n return {\n left: active.offsetLeft + labelLeft + TAB_INDICATOR_INSET,\n width: Math.max(0, labelWidth - TAB_INDICATOR_INSET * 2),\n color: raw === '' ? undefined : raw,\n }\n}\n\nconst TAB_INDICATOR_OPTIONS = {\n activeSelector: '[data-state=active]',\n stateAttribute: 'data-state',\n measure: measureTab,\n}\n\ntype TabsListProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {\n fullWidth?: boolean\n underlined?: boolean\n}\n\nconst TabsList = React.forwardRef<React.ComponentRef<typeof TabsPrimitive.List>, Readonly<TabsListProps>>(\n ({ className, fullWidth, underlined, children, style, ...props }, ref) => {\n const listRef = React.useRef<HTMLDivElement>(null)\n React.useImperativeHandle(ref, () => listRef.current as HTMLDivElement, [])\n const indicator = useSlidingIndicator(listRef, TAB_INDICATOR_OPTIONS)\n\n return (\n <TabsPrimitive.List\n ref={listRef}\n {...slidingIndicatorProps(indicator)}\n className={cn(\n `\n relative flex scrollbar-none overflow-x-auto sliding-indicator-horizontal [-ms-overflow-style:none]\n after:absolute after:bottom-0 after:left-0 after:h-0.75 after:w-(--indicator-width)\n after:translate-x-(--indicator-left) after:bg-(--indicator-color)\n [&::-webkit-scrollbar]:hidden\n `,\n fullWidth ? 'w-full *:flex-1' : 'gap-2',\n underlined && 'shadow-[inset_0_-1px_0_var(--color-neutral-100)] *:mb-px',\n className,\n )}\n style={\n {\n '--indicator-left': `${indicator?.left ?? 0}px`,\n '--indicator-width': `${indicator?.width ?? 0}px`,\n '--indicator-color': indicator?.color ?? resolveColor(undefined),\n ...style,\n } as React.CSSProperties\n }\n {...props}\n >\n {children}\n </TabsPrimitive.List>\n )\n },\n)\nTabsList.displayName = TabsPrimitive.List.displayName\n\ntype TabsTriggerProps = React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & {\n color?: ColorToken | (string & {})\n}\n\nconst TabsTrigger = React.forwardRef<React.ComponentRef<typeof TabsPrimitive.Trigger>, Readonly<TabsTriggerProps>>(\n ({ className, children, color, style, ...props }, ref) => (\n <TabsPrimitive.Trigger\n asChild\n ref={ref}\n className={cn(TABS_TAB_ITEM_CLASSNAME, className)}\n style={\n {\n '--tab-active-color': resolveColor(color),\n ...style,\n } as React.CSSProperties\n }\n {...props}\n >\n <Typography variant=\"title-md\">{children}</Typography>\n </TabsPrimitive.Trigger>\n ),\n)\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\ntype TabsLinkProps = React.ComponentPropsWithoutRef<'a'> & {\n active?: boolean\n color?: ColorToken | (string & {})\n asChild?: boolean\n}\n\nconst TabsLink = React.forwardRef<HTMLAnchorElement, Readonly<TabsLinkProps>>(\n ({ className, children, color, style, active = false, asChild, ...props }, ref) => {\n const Comp = asChild ? Slot : 'a'\n\n return (\n <Comp\n ref={ref}\n data-state={active ? 'active' : 'inactive'}\n aria-current={active ? 'page' : undefined}\n className={cn(TABS_TAB_ITEM_CLASSNAME, className)}\n style={\n {\n '--tab-active-color': resolveColor(color),\n ...style,\n } as React.CSSProperties\n }\n {...props}\n >\n {asChild ? children : <Typography variant=\"title-md\">{children}</Typography>}\n </Comp>\n )\n },\n)\nTabsLink.displayName = 'TabsLink'\n\nconst TabsContent = React.forwardRef<\n React.ComponentRef<typeof TabsPrimitive.Content>,\n Readonly<React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>>\n>(({ className, ...props }, ref) => <TabsPrimitive.Content ref={ref} className={cn(`mt-2`, className)} {...props} />)\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, TabsLink, TabsContent }\n"],"mappings":";;;;;;;;;AAUA,IAAM,OAAOA,QAAM,YAGhB,OAAO,QAAQ;CAChB,sBAAsB;CAEtB,OAAO,oBAAC,cAAc,MAAf;EAAyB;EAAK,GAAI;CAAQ,CAAA;AACnD,CAAC;AACD,KAAK,cAAc,cAAc,KAAK;AAEtC,IAAM,0BAA0B;AAEhC,IAAM,sBAAsB;AAE5B,SAAS,WAAW,QAAqB;CACvC,MAAM,QAAQ,SAAS,YAAY;CACnC,MAAM,mBAAmB,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,oBAAC,YAAD;EAAY,SAAQ;EAAY;CAAqB,CAAA;AAChC,CAAA,CAE3B;AACA,YAAY,cAAc,cAAc,QAAQ;AAQhD,IAAM,WAAWA,QAAM,YACpB,EAAE,WAAW,UAAU,OAAO,OAAO,SAAS,OAAO,SAAS,GAAG,SAAS,QAAQ;CAGjF,OACE,oBAHW,UAAU,OAAO,KAG5B;EACO;EACL,cAAY,SAAS,WAAW;EAChC,gBAAc,SAAS,SAAS,KAAA;EAChC,WAAW,GAAG,yBAAyB,SAAS;EAChD,OACE;GACE,sBAAsB,aAAa,KAAK;GACxC,GAAG;EACL;EAEF,GAAI;EAEH,UAAA,UAAU,WAAW,oBAAC,YAAD;GAAY,SAAQ;GAAY;EAAqB,CAAA;CACvE,CAAA;AAEV,CACF;AACA,SAAS,cAAc;AAEvB,IAAM,cAAcA,QAAM,YAGvB,EAAE,WAAW,GAAG,SAAS,QAAQ,oBAAC,cAAc,SAAf;CAA4B;CAAK,WAAW,GAAG,QAAQ,SAAS;CAAG,GAAI;AAAQ,CAAA,CAAC;AACpH,YAAY,cAAc,cAAc,QAAQ"}
package/dist/theme.css CHANGED
@@ -262,7 +262,13 @@
262
262
  }
263
263
 
264
264
  [data-input-modality='pointer']
265
- :is([role='menuitem'], [role='menuitemcheckbox'], [role='menuitemradio'], [role='option']):focus-visible {
265
+ :is(
266
+ [role='menuitem'],
267
+ [role='menuitemcheckbox'],
268
+ [role='menuitemradio'],
269
+ [role='option'],
270
+ [role='tab']
271
+ ):focus-visible {
266
272
  outline-style: none;
267
273
  }
268
274
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "periplo-ui",
3
3
  "description": "IATI UI library",
4
4
  "private": false,
5
- "version": "4.23.0",
5
+ "version": "4.23.1",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",