@alveole/components 0.30.1 → 0.30.2

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,12 @@
1
- import { BoxProps, PopoverProps } from '@alveole/components';
1
+ import { BoxProps } from '@alveole/components';
2
+ import { PopoverProps } from '../Popover';
2
3
  import { ActionMenuItem } from './ActionMenuItem';
3
4
  export type { ActionMenuItemProps } from './ActionMenuItem';
4
- export type ActionMenuProps = BoxProps & PopoverProps;
5
+ export type ActionMenuProps = BoxProps & PopoverProps & {
6
+ open?: boolean;
7
+ setOpen?: (open: boolean) => void;
8
+ scrollable?: boolean;
9
+ };
5
10
  declare const ActionMenuBase: (props: ActionMenuProps) => import("react/jsx-runtime").JSX.Element;
6
11
  type ActionMenuCompoundComponent = typeof ActionMenuBase & {
7
12
  Item: typeof ActionMenuItem;
@@ -1 +1 @@
1
- {"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../../src/ui/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAW,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEtD,QAAA,MAAM,cAAc,GAAI,OAAO,eAAe,4CAU7C,CAAC;AAEF,KAAK,2BAA2B,GAAG,OAAO,cAAc,GAAG;IACzD,IAAI,EAAE,OAAO,cAAc,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,2BAEvB,CAAC"}
1
+ {"version":3,"file":"ActionMenu.d.ts","sourceRoot":"","sources":["../../../src/ui/ActionMenu/ActionMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAW,YAAY,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE5D,MAAM,MAAM,eAAe,GAAG,QAAQ,GACpC,YAAY,GAAG;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEJ,QAAA,MAAM,cAAc,GAAI,OAAO,eAAe,4CAU7C,CAAC;AAEF,KAAK,2BAA2B,GAAG,OAAO,cAAc,GAAG;IACzD,IAAI,EAAE,OAAO,cAAc,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,2BAEvB,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Popover } from '@alveole/components';
3
2
  import { Box } from '../../core';
3
+ import { Popover } from '../Popover';
4
4
  import { ActionMenuItem } from './ActionMenuItem';
5
5
  const ActionMenuBase = (props) => {
6
- const { children, placement = 'bottom', renderTrigger, ...boxProps } = props;
7
- return (_jsx(Popover, { placement: placement, renderTrigger: renderTrigger, children: _jsx(Box, { tag: "action-menu-content", ...boxProps, children: children }) }));
6
+ const { children, placement = 'bottom', renderTrigger, open, setOpen, scrollable = true, ...boxProps } = props;
7
+ return (_jsx(Popover, { placement: placement, renderTrigger: renderTrigger, open: open, setOpen: setOpen, scrollable: scrollable, children: _jsx(Box, { tag: "action-menu-content", ...boxProps, children: children }) }));
8
8
  };
9
9
  export const ActionMenu = Object.assign(ActionMenuBase, {
10
10
  Item: ActionMenuItem,
@@ -1,6 +1,6 @@
1
1
  declare const _default: {
2
2
  title: string;
3
- tags: "Components"[];
3
+ tags: "Composant"[];
4
4
  experimental: false;
5
5
  figmaURL: string;
6
6
  description: string;
@@ -4,7 +4,7 @@ import { Button } from '../Button';
4
4
  import { ActionMenu } from './ActionMenu';
5
5
  export default {
6
6
  title: 'ActionMenu',
7
- tags: ['Components'],
7
+ tags: ['Composant'],
8
8
  experimental: false,
9
9
  figmaURL: 'https://www.figma.com/design/xJz8Z6vfrnZPKTtRbuT2W8/Composants?node-id=1002-547',
10
10
  description: 'Composant de type Box.',
@@ -8,10 +8,10 @@ export type IconName = LucideIconName | LabIconName;
8
8
  export declare const isLucideIconName: (name: string) => name is LucideIconName;
9
9
  declare const PublicPropsSchema: z.ZodObject<{
10
10
  size: z.ZodEnum<{
11
- xs: "xs";
12
11
  sm: "sm";
13
12
  md: "md";
14
13
  lg: "lg";
14
+ xs: "xs";
15
15
  xl: "xl";
16
16
  }>;
17
17
  name: z.ZodEnum<{
@@ -20,6 +20,9 @@ declare const PublicPropsSchema: z.ZodObject<{
20
20
  olive: "olive";
21
21
  Menu: "Menu";
22
22
  toolbox: "toolbox";
23
+ Focus: "Focus";
24
+ Anchor: "Anchor";
25
+ Sheet: "Sheet";
23
26
  AArrowDown: "AArrowDown";
24
27
  AArrowUp: "AArrowUp";
25
28
  ALargeSmall: "ALargeSmall";
@@ -60,7 +63,6 @@ declare const PublicPropsSchema: z.ZodObject<{
60
63
  Ampersand: "Ampersand";
61
64
  Ampersands: "Ampersands";
62
65
  Amphora: "Amphora";
63
- Anchor: "Anchor";
64
66
  Angry: "Angry";
65
67
  Annoyed: "Annoyed";
66
68
  Antenna: "Antenna";
@@ -679,7 +681,6 @@ declare const PublicPropsSchema: z.ZodObject<{
679
681
  FlipVertical2: "FlipVertical2";
680
682
  Flower: "Flower";
681
683
  Flower2: "Flower2";
682
- Focus: "Focus";
683
684
  FoldHorizontal: "FoldHorizontal";
684
685
  FoldVertical: "FoldVertical";
685
686
  Folder: "Folder";
@@ -1316,7 +1317,6 @@ declare const PublicPropsSchema: z.ZodObject<{
1316
1317
  Shapes: "Shapes";
1317
1318
  Share: "Share";
1318
1319
  Share2: "Share2";
1319
- Sheet: "Sheet";
1320
1320
  Shell: "Shell";
1321
1321
  ShelvingUnit: "ShelvingUnit";
1322
1322
  Shield: "Shield";
@@ -2106,10 +2106,10 @@ type PrivateProps = {
2106
2106
  export type LucideIconProps = z.infer<typeof PublicPropsSchema> & PrivateProps;
2107
2107
  export declare const LucideIconPropsJSON: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
2108
2108
  size: z.ZodEnum<{
2109
- xs: "xs";
2110
2109
  sm: "sm";
2111
2110
  md: "md";
2112
2111
  lg: "lg";
2112
+ xs: "xs";
2113
2113
  xl: "xl";
2114
2114
  }>;
2115
2115
  name: z.ZodEnum<{
@@ -2118,6 +2118,9 @@ export declare const LucideIconPropsJSON: z.core.ZodStandardJSONSchemaPayload<z.
2118
2118
  olive: "olive";
2119
2119
  Menu: "Menu";
2120
2120
  toolbox: "toolbox";
2121
+ Focus: "Focus";
2122
+ Anchor: "Anchor";
2123
+ Sheet: "Sheet";
2121
2124
  AArrowDown: "AArrowDown";
2122
2125
  AArrowUp: "AArrowUp";
2123
2126
  ALargeSmall: "ALargeSmall";
@@ -2158,7 +2161,6 @@ export declare const LucideIconPropsJSON: z.core.ZodStandardJSONSchemaPayload<z.
2158
2161
  Ampersand: "Ampersand";
2159
2162
  Ampersands: "Ampersands";
2160
2163
  Amphora: "Amphora";
2161
- Anchor: "Anchor";
2162
2164
  Angry: "Angry";
2163
2165
  Annoyed: "Annoyed";
2164
2166
  Antenna: "Antenna";
@@ -2777,7 +2779,6 @@ export declare const LucideIconPropsJSON: z.core.ZodStandardJSONSchemaPayload<z.
2777
2779
  FlipVertical2: "FlipVertical2";
2778
2780
  Flower: "Flower";
2779
2781
  Flower2: "Flower2";
2780
- Focus: "Focus";
2781
2782
  FoldHorizontal: "FoldHorizontal";
2782
2783
  FoldVertical: "FoldVertical";
2783
2784
  Folder: "Folder";
@@ -3414,7 +3415,6 @@ export declare const LucideIconPropsJSON: z.core.ZodStandardJSONSchemaPayload<z.
3414
3415
  Shapes: "Shapes";
3415
3416
  Share: "Share";
3416
3417
  Share2: "Share2";
3417
- Sheet: "Sheet";
3418
3418
  Shell: "Shell";
3419
3419
  ShelvingUnit: "ShelvingUnit";
3420
3420
  Shield: "Shield";
@@ -6,10 +6,10 @@ declare const _default: {
6
6
  description: string;
7
7
  props: import("zod/v4/core").ZodStandardJSONSchemaPayload<import("zod").ZodObject<{
8
8
  size: import("zod").ZodEnum<{
9
- xs: "xs";
10
9
  sm: "sm";
11
10
  md: "md";
12
11
  lg: "lg";
12
+ xs: "xs";
13
13
  xl: "xl";
14
14
  }>;
15
15
  name: import("zod").ZodEnum<{
@@ -18,6 +18,9 @@ declare const _default: {
18
18
  olive: "olive";
19
19
  Menu: "Menu";
20
20
  toolbox: "toolbox";
21
+ Focus: "Focus";
22
+ Anchor: "Anchor";
23
+ Sheet: "Sheet";
21
24
  AArrowDown: "AArrowDown";
22
25
  AArrowUp: "AArrowUp";
23
26
  ALargeSmall: "ALargeSmall";
@@ -58,7 +61,6 @@ declare const _default: {
58
61
  Ampersand: "Ampersand";
59
62
  Ampersands: "Ampersands";
60
63
  Amphora: "Amphora";
61
- Anchor: "Anchor";
62
64
  Angry: "Angry";
63
65
  Annoyed: "Annoyed";
64
66
  Antenna: "Antenna";
@@ -677,7 +679,6 @@ declare const _default: {
677
679
  FlipVertical2: "FlipVertical2";
678
680
  Flower: "Flower";
679
681
  Flower2: "Flower2";
680
- Focus: "Focus";
681
682
  FoldHorizontal: "FoldHorizontal";
682
683
  FoldVertical: "FoldVertical";
683
684
  Folder: "Folder";
@@ -1314,7 +1315,6 @@ declare const _default: {
1314
1315
  Shapes: "Shapes";
1315
1316
  Share: "Share";
1316
1317
  Share2: "Share2";
1317
- Sheet: "Sheet";
1318
1318
  Shell: "Shell";
1319
1319
  ShelvingUnit: "ShelvingUnit";
1320
1320
  Shield: "Shield";
@@ -9,6 +9,9 @@ export type PopoverProps = PopoverStyles & React.PropsWithChildren<{
9
9
  renderTrigger: (context: {
10
10
  open: boolean;
11
11
  }) => React.ReactNode;
12
+ scrollable?: boolean;
13
+ open?: boolean;
14
+ setOpen?: (open: boolean) => void;
12
15
  }>;
13
16
  export declare const Popover: (props: PopoverProps) => import("react/jsx-runtime").JSX.Element;
14
17
  //# sourceMappingURL=Popover.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/ui/Popover/Popover.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyC,YAAY,IAAI,mBAAmB,EAAU,MAAM,SAAS,CAAC;AAG7G,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,aAAa,GACtC,KAAK,CAAC,iBAAiB,CAAC;IACtB,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC5C,aAAa,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC;CAChE,CAAC,CAAC;AAEL,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,4CAqC1C,CAAC"}
1
+ {"version":3,"file":"Popover.d.ts","sourceRoot":"","sources":["../../../src/ui/Popover/Popover.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAyC,YAAY,IAAI,mBAAmB,EAAU,MAAM,SAAS,CAAC;AAG7G,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,aAAa,GACtC,KAAK,CAAC,iBAAiB,CAAC;IACtB,SAAS,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC5C,aAAa,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC,CAAC,CAAC;AAEL,eAAO,MAAM,OAAO,GAAI,OAAO,YAAY,4CAoD1C,CAAC"}
@@ -4,8 +4,16 @@ import React from 'react';
4
4
  import { ScrollView, Popover as TamaguiPopover, YStack } from 'tamagui';
5
5
  import { useStyles } from './Popover.styles';
6
6
  export const Popover = (props) => {
7
- const { children, placement, renderTrigger, ...popoverStyles } = props;
8
- const [open, setOpen] = React.useState(false);
7
+ const { children, placement, renderTrigger, scrollable = true, open: controlledOpen, setOpen: controlledSetOpen, ...popoverStyles } = props;
8
+ const [internalOpen, setInternalOpen] = React.useState(false);
9
+ const isControlled = controlledOpen !== undefined;
10
+ const open = isControlled ? controlledOpen : internalOpen;
11
+ const setOpen = React.useCallback((nextOpen) => {
12
+ controlledSetOpen?.(nextOpen);
13
+ if (!isControlled) {
14
+ setInternalOpen(nextOpen);
15
+ }
16
+ }, [controlledSetOpen, isControlled]);
9
17
  const styles = useStyles();
10
18
  const { spacing } = useTheme();
11
19
  const spacings = {
@@ -17,5 +25,5 @@ export const Popover = (props) => {
17
25
  };
18
26
  const maxH = popoverStyles.maxH ?? 500;
19
27
  const maxW = popoverStyles.maxW ?? '100%';
20
- return (_jsxs(TamaguiPopover, { placement: placement, disableFocus: true, open: open, onOpenChange: setOpen, children: [_jsx(TamaguiPopover.Trigger, { asChild: true, children: renderTrigger({ open }) }), _jsx(TamaguiPopover.Content, { trapFocus: false, disableFocusScope: true, overflow: "hidden", style: { maxHeight: maxH, maxWidth: maxW }, ...spacings, ...styles.content, children: _jsx(YStack, { style: { maxHeight: maxH, overflow: 'hidden' }, children: _jsx(ScrollView, { style: { maxHeight: maxH - spacing('025') }, children: children }) }) })] }));
28
+ return (_jsxs(TamaguiPopover, { placement: placement, disableFocus: true, open: open, onOpenChange: setOpen, children: [_jsx(TamaguiPopover.Trigger, { asChild: true, children: renderTrigger({ open }) }), _jsx(TamaguiPopover.Content, { trapFocus: false, disableFocusScope: true, overflow: "hidden", style: { maxHeight: scrollable ? maxH : undefined, maxWidth: maxW }, ...spacings, ...styles.content, children: scrollable ? (_jsx(YStack, { style: { overflow: 'hidden' }, children: _jsx(ScrollView, { style: { maxHeight: maxH - spacing('025') }, children: children }) })) : (children) })] }));
21
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alveole/components",
3
- "version": "0.30.1",
3
+ "version": "0.30.2",
4
4
  "description": "Shared UI components.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",