@pickle-ui/react 1.0.0-beta.17 → 1.0.0-beta.19

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.
Files changed (40) hide show
  1. package/README.md +2 -1
  2. package/dist/components/BottomSheet.d.ts +48 -0
  3. package/dist/components/BottomSheet.d.ts.map +1 -0
  4. package/dist/components/BottomSheet.js +97 -0
  5. package/dist/components/BottomSheet.js.map +1 -0
  6. package/dist/components/Drawer.d.ts +9 -1
  7. package/dist/components/Drawer.d.ts.map +1 -1
  8. package/dist/components/Drawer.js +15 -5
  9. package/dist/components/Drawer.js.map +1 -1
  10. package/dist/components/Tabs.d.ts +2 -9
  11. package/dist/components/Tabs.d.ts.map +1 -1
  12. package/dist/components/Tabs.js +3 -13
  13. package/dist/components/Tabs.js.map +1 -1
  14. package/dist/components/_internal/dialog-styles.d.ts +1 -1
  15. package/dist/components/_internal/dialog-styles.d.ts.map +1 -1
  16. package/dist/components/_internal/dialog-styles.js +1 -1
  17. package/dist/components/_internal/dialog-styles.js.map +1 -1
  18. package/dist/entries/bottom-sheet.d.ts +3 -0
  19. package/dist/entries/bottom-sheet.d.ts.map +1 -0
  20. package/dist/entries/bottom-sheet.js +2 -0
  21. package/dist/entries/bottom-sheet.js.map +1 -0
  22. package/dist/entries/tabs.d.ts +1 -1
  23. package/dist/entries/tabs.d.ts.map +1 -1
  24. package/dist/index.d.ts +1 -0
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +1 -0
  27. package/dist/index.js.map +1 -1
  28. package/package.json +1 -1
  29. package/skills/pickle-ui-react/SKILL.md +1 -0
  30. package/src/components/BottomSheet.stories.tsx +200 -0
  31. package/src/components/BottomSheet.test.tsx +143 -0
  32. package/src/components/BottomSheet.tsx +218 -0
  33. package/src/components/Drawer.tsx +41 -16
  34. package/src/components/Tabs.stories.tsx +2 -5
  35. package/src/components/Tabs.test.tsx +1 -2
  36. package/src/components/Tabs.tsx +4 -25
  37. package/src/components/_internal/dialog-styles.ts +1 -1
  38. package/src/entries/bottom-sheet.ts +12 -0
  39. package/src/entries/tabs.ts +1 -7
  40. package/src/index.ts +1 -0
@@ -27,10 +27,9 @@ const LISTS = [
27
27
  export const All: StoryDefinition = {
28
28
  render: () => (
29
29
  <Story.Layout className="max-w-3xl" title="Tabs">
30
- <Story.Section title="With a sliding indicator">
30
+ <Story.Section title="Default">
31
31
  <Tabs className="flex flex-col gap-4" defaultValue="Overview">
32
32
  <Tabs.List aria-label="Project">
33
- <Tabs.Indicator />
34
33
  {SECTIONS.map((section) => (
35
34
  <Tabs.Tab key={section} value={section}>
36
35
  {section}
@@ -49,7 +48,6 @@ export const All: StoryDefinition = {
49
48
  <div className="max-w-sm">
50
49
  <Tabs className="flex flex-col gap-4" defaultValue="Holidays">
51
50
  <Tabs.List activateOnFocus aria-label="Meal lists">
52
- <Tabs.Indicator />
53
51
  {LISTS.map((list) => (
54
52
  <Tabs.Tab key={list} value={list}>
55
53
  {list}
@@ -65,7 +63,7 @@ export const All: StoryDefinition = {
65
63
  </div>
66
64
  </Story.Section>
67
65
 
68
- <Story.Section title="Wrapping, without an indicator">
66
+ <Story.Section title="Wrapping">
69
67
  <div className="max-w-sm">
70
68
  <Tabs className="flex flex-col gap-4" defaultValue="Members">
71
69
  <Tabs.List aria-label="Project" className="flex-wrap overflow-visible">
@@ -82,7 +80,6 @@ export const All: StoryDefinition = {
82
80
  <Story.Section title="Vertical">
83
81
  <Tabs className="flex gap-4" defaultValue="Activity" orientation="vertical">
84
82
  <Tabs.List aria-label="Project" className="w-40">
85
- <Tabs.Indicator />
86
83
  {SECTIONS.map((section) => (
87
84
  <Tabs.Tab className="justify-start" key={section} value={section}>
88
85
  {section}
@@ -11,7 +11,6 @@ function renderTabs(listProps?: { activateOnFocus?: boolean }) {
11
11
  return render(
12
12
  <Tabs defaultValue="overview">
13
13
  <Tabs.List aria-label="Project" {...listProps}>
14
- <Tabs.Indicator />
15
14
  <Tabs.Tab value="overview">Overview</Tabs.Tab>
16
15
  <Tabs.Tab value="activity">Activity</Tabs.Tab>
17
16
  <Tabs.Tab value="settings">Settings</Tabs.Tab>
@@ -44,7 +43,7 @@ describe('Tabs', () => {
44
43
  it('renders a data-slot on every part', () => {
45
44
  const { container } = renderTabs();
46
45
 
47
- for (const slot of ['tabs', 'tabs-list', 'tabs-indicator', 'tabs-tab', 'tabs-panel']) {
46
+ for (const slot of ['tabs', 'tabs-list', 'tabs-tab', 'tabs-panel']) {
48
47
  expect(container.querySelector(`[data-slot="${slot}"]`)).toBeInTheDocument();
49
48
  }
50
49
  });
@@ -7,7 +7,6 @@ import { useIsomorphicLayoutEffect } from '../hooks/use-isomorphic-layout-effect
7
7
  import { useComposedRefs } from '../lib/compose-refs';
8
8
  import { cn } from '../lib/utils';
9
9
 
10
- type TabsIndicatorProps = React.ComponentProps<typeof TabsPrimitive.Indicator>;
11
10
  type TabsListProps = React.ComponentProps<typeof TabsPrimitive.List>;
12
11
  type TabsPanelProps = React.ComponentProps<typeof TabsPrimitive.Panel>;
13
12
  type TabsProps = React.ComponentProps<typeof TabsPrimitive.Root>;
@@ -36,24 +35,6 @@ function revealActiveTab(list: HTMLElement) {
36
35
  list.scrollLeft += Math.min(left - visible.left - padding, pastEnd);
37
36
  }
38
37
 
39
- /**
40
- * Slides under the active tab, in CSS, from Base UI's `--active-tab-*` variables. Place it inside `Tabs.List`.
41
- * It renders before hydration through an inline script; under a strict CSP, give Base UI a nonce or pass `renderBeforeHydration={false}`.
42
- */
43
- function TabsIndicator({ className, renderBeforeHydration = true, ...props }: TabsIndicatorProps) {
44
- return (
45
- <TabsPrimitive.Indicator
46
- className={cn(
47
- 'bg-primary absolute top-0 left-0 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) translate-y-(--active-tab-top) rounded-lg transition-[translate,width,height] duration-180 ease-[cubic-bezier(0.23,1,0.32,1)] motion-reduce:transition-none',
48
- className,
49
- )}
50
- data-slot="tabs-indicator"
51
- renderBeforeHydration={renderBeforeHydration}
52
- {...props}
53
- />
54
- );
55
- }
56
-
57
38
  /**
58
39
  * Scrolls sideways when its tabs overflow, keeps the active one in view and fades the ends past which tabs hide.
59
40
  * Bleed it into a page's gutter with `-mx-4 px-4`.
@@ -93,7 +74,7 @@ function TabsList({ className, ref, ...props }: TabsListProps) {
93
74
  <TabsPrimitive.List
94
75
  className={cn(
95
76
  // `scroll-fade-x` fades as wide as the scroll padding, so a revealed or focused tab clears it.
96
- 'group/tabs-list scroll-fade-x relative -m-1 flex scroll-px-6 gap-2 overflow-x-auto overscroll-x-contain p-1 [scrollbar-width:none] data-[orientation=vertical]:flex-col [&::-webkit-scrollbar]:hidden',
77
+ 'scroll-fade-x -m-1 flex scroll-px-6 gap-2 overflow-x-auto overscroll-x-contain p-1 [scrollbar-width:none] data-[orientation=vertical]:flex-col [&::-webkit-scrollbar]:hidden',
97
78
  className,
98
79
  )}
99
80
  data-slot="tabs-list"
@@ -125,8 +106,7 @@ function TabsTab({ className, ...props }: TabsTabProps) {
125
106
  return (
126
107
  <TabsPrimitive.Tab
127
108
  className={cn(
128
- // The active tab is filled, or transparent over the list's sliding `Tabs.Indicator`.
129
- "bg-muted text-foreground not-data-active:hover:bg-accent data-active:bg-primary data-active:text-primary-foreground focus-visible:ring-ring focus-visible:ring-offset-background group-has-[[data-slot=tabs-indicator]]/tabs-list:data-active:bg-transparent relative inline-flex min-h-11 shrink-0 cursor-pointer items-center justify-center gap-2 rounded-lg px-4 text-base font-medium whitespace-nowrap transition-colors outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
109
+ "bg-muted text-foreground not-data-active:hover:bg-accent data-active:bg-primary data-active:text-primary-foreground focus-visible:ring-ring focus-visible:ring-offset-background inline-flex min-h-11 shrink-0 cursor-pointer items-center justify-center gap-2 rounded-lg px-4 text-base font-medium whitespace-nowrap transition-colors outline-none focus-visible:ring-2 focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-64 sm:text-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
130
110
  className,
131
111
  )}
132
112
  data-slot="tabs-tab"
@@ -136,11 +116,10 @@ function TabsTab({ className, ...props }: TabsTabProps) {
136
116
  }
137
117
 
138
118
  const Tabs = Object.assign(TabsRoot, {
139
- Indicator: TabsIndicator,
140
119
  List: TabsList,
141
120
  Panel: TabsPanel,
142
121
  Tab: TabsTab,
143
122
  });
144
123
 
145
- export { Tabs, TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab };
146
- export type { TabsIndicatorProps, TabsListProps, TabsPanelProps, TabsProps, TabsTabProps };
124
+ export { Tabs, TabsList, TabsPanel, TabsRoot, TabsTab };
125
+ export type { TabsListProps, TabsPanelProps, TabsProps, TabsTabProps };
@@ -3,7 +3,7 @@ import { cva, type VariantProps } from 'class-variance-authority';
3
3
  import { cn } from '../../lib/utils';
4
4
  import { textVariants } from '../Text';
5
5
 
6
- /** Shared look for `Dialog` and `AlertDialog`; not part of the public API. */
6
+ /** Shared look for `Dialog`, `AlertDialog` and `Drawer` (and `BottomSheet` through it); not part of the public API. */
7
7
 
8
8
  const dialogBackdropClassName =
9
9
  'fixed inset-0 z-50 bg-black/32 backdrop-blur-sm duration-200 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0';
@@ -0,0 +1,12 @@
1
+ export { BottomSheet } from '../components/BottomSheet';
2
+ export type {
3
+ BottomSheetCloseProps,
4
+ BottomSheetContentProps,
5
+ BottomSheetDescriptionProps,
6
+ BottomSheetFooterProps,
7
+ BottomSheetHeaderProps,
8
+ BottomSheetPanelProps,
9
+ BottomSheetProps,
10
+ BottomSheetTitleProps,
11
+ BottomSheetTriggerProps,
12
+ } from '../components/BottomSheet';
@@ -1,8 +1,2 @@
1
1
  export { Tabs } from '../components/Tabs';
2
- export type {
3
- TabsIndicatorProps,
4
- TabsListProps,
5
- TabsPanelProps,
6
- TabsProps,
7
- TabsTabProps,
8
- } from '../components/Tabs';
2
+ export type { TabsListProps, TabsPanelProps, TabsProps, TabsTabProps } from '../components/Tabs';
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ export * from './entries/alert';
4
4
  export * from './entries/alert-dialog';
5
5
  export * from './entries/avatar';
6
6
  export * from './entries/badge';
7
+ export * from './entries/bottom-sheet';
7
8
  export * from './entries/button';
8
9
  export * from './entries/card';
9
10
  export * from './entries/checkbox';