@udixio/ui-react 1.4.0 → 1.6.0

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 (30) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/index.cjs +2 -2
  3. package/dist/index.js +1029 -892
  4. package/dist/lib/components/SlideSheet.d.ts +9 -0
  5. package/dist/lib/components/SlideSheet.d.ts.map +1 -0
  6. package/dist/lib/components/index.d.ts +1 -0
  7. package/dist/lib/components/index.d.ts.map +1 -1
  8. package/dist/lib/effects/ThemeProvider.d.ts +4 -2
  9. package/dist/lib/effects/ThemeProvider.d.ts.map +1 -1
  10. package/dist/lib/interfaces/index.d.ts +1 -0
  11. package/dist/lib/interfaces/index.d.ts.map +1 -1
  12. package/dist/lib/interfaces/navigation-rail.interface.d.ts +1 -1
  13. package/dist/lib/interfaces/navigation-rail.interface.d.ts.map +1 -1
  14. package/dist/lib/interfaces/slide-sheet.interface.d.ts +29 -0
  15. package/dist/lib/interfaces/slide-sheet.interface.d.ts.map +1 -0
  16. package/dist/lib/styles/index.d.ts +1 -0
  17. package/dist/lib/styles/index.d.ts.map +1 -1
  18. package/dist/lib/styles/navigation-rail.style.d.ts +2 -2
  19. package/dist/lib/styles/slide-sheet.style.d.ts +25 -0
  20. package/dist/lib/styles/slide-sheet.style.d.ts.map +1 -0
  21. package/package.json +2 -2
  22. package/src/lib/components/SlideSheet.tsx +122 -0
  23. package/src/lib/components/index.ts +1 -0
  24. package/src/lib/effects/ThemeProvider.tsx +78 -34
  25. package/src/lib/interfaces/index.ts +1 -0
  26. package/src/lib/interfaces/navigation-rail.interface.ts +1 -1
  27. package/src/lib/interfaces/slide-sheet.interface.tsx +27 -0
  28. package/src/lib/styles/index.ts +1 -0
  29. package/src/lib/styles/slide-sheet.style.ts +31 -0
  30. package/src/stories/containment/slide-sheet.stories.tsx +50 -0
@@ -0,0 +1,9 @@
1
+ import { MotionProps } from '../utils';
2
+ import { SlideSheetInterface } from '../interfaces';
3
+ /**
4
+ * Side sheets show secondary content anchored to the side of the screen
5
+ * @status beta
6
+ * @category Layout
7
+ */
8
+ export declare const SlideSheet: ({ variant, className, children, title, position, extended, onExtendedChange, closeIcon, transition, ...rest }: MotionProps<SlideSheetInterface>) => import("react/jsx-runtime").JSX.Element;
9
+ //# sourceMappingURL=SlideSheet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SlideSheet.d.ts","sourceRoot":"","sources":["../../../src/lib/components/SlideSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAUpD;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,+GAWxB,WAAW,CAAC,mBAAmB,CAAC,4CA8FlC,CAAC"}
@@ -9,6 +9,7 @@ export * from './IconButton';
9
9
  export * from './IconButton';
10
10
  export * from './ProgressIndicator';
11
11
  export * from './Slider';
12
+ export * from './SlideSheet';
12
13
  export * from './Snackbar';
13
14
  export * from './Switch';
14
15
  export * from './Tab';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
@@ -1,5 +1,7 @@
1
- import { ConfigInterface } from '@udixio/theme';
2
- export declare const ThemeProvider: ({ config }: {
1
+ import { API, ConfigInterface } from '@udixio/theme';
2
+ export declare const ThemeProvider: ({ config, throttleDelay, onLoad, }: {
3
3
  config: ConfigInterface;
4
+ onLoad?: (api: API) => void;
5
+ throttleDelay?: number;
4
6
  }) => import("react/jsx-runtime").JSX.Element | null;
5
7
  //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/effects/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAU,MAAM,eAAe,CAAC;AAS7D,eAAO,MAAM,aAAa,GAAI,YAAY;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,mDAgDpE,CAAC"}
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/effects/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,eAAe,EAAU,MAAM,eAAe,CAAC;AASvE,eAAO,MAAM,aAAa,GAAI,oCAI3B;IACD,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,mDAoFA,CAAC"}
@@ -6,6 +6,7 @@ export * from './divider.interface';
6
6
  export * from './fab.interface';
7
7
  export * from './icon-button.interface';
8
8
  export * from './progress-indicator.interface';
9
+ export * from './slide-sheet.interface';
9
10
  export * from './slider.interface';
10
11
  export * from './snackbar.interface';
11
12
  export * from './switch.interface';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,qBAAqB,CAAC"}
@@ -20,12 +20,12 @@ export interface NavigationRailInterface {
20
20
  selectedItem?: number | null;
21
21
  setSelectedItem?: Dispatch<SetStateAction<number | null>>;
22
22
  extended?: boolean;
23
+ onExtendedChange?: (extended: boolean) => void;
23
24
  alignment?: 'middle' | 'top';
24
25
  menu?: {
25
26
  closed: MenuState;
26
27
  opened: MenuState;
27
28
  };
28
- onExtendedChange?: (extended: boolean) => void;
29
29
  transition?: Transition;
30
30
  };
31
31
  states: {
@@ -1 +1 @@
1
- {"version":3,"file":"navigation-rail.interface.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/navigation-rail.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE;QACL,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;QAC/B,cAAc,CAAC,EAAE,CACf,IAAI,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAC5B,UAAU,CAAC,2BAA2B,CAAC,EACvC,OAAO,GAAG,MAAM,CACjB,GAAG;YACA,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;SACrB,KACA,IAAI,CAAC;QACV,QAAQ,EAAE,SAAS,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,eAAe,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;QAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,EAAE;YACL,MAAM,EAAE,SAAS,CAAC;YAClB,MAAM,EAAE,SAAS,CAAC;SACnB,CAAC;QACF,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;QAE/C,UAAU,CAAC,EAAE,UAAU,CAAC;KACzB,CAAC;IACF,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACjC,QAAQ,EAAE,CAAC,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;CAChE"}
1
+ {"version":3,"file":"navigation-rail.interface.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/navigation-rail.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,KAAK,SAAS,GAAG;IACf,IAAI,EAAE,IAAI,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE;QACL,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;QAC/B,cAAc,CAAC,EAAE,CACf,IAAI,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAC5B,UAAU,CAAC,2BAA2B,CAAC,EACvC,OAAO,GAAG,MAAM,CACjB,GAAG;YACA,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC;SACrB,KACA,IAAI,CAAC;QACV,QAAQ,EAAE,SAAS,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,eAAe,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;QAC1D,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;QAC/C,SAAS,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;QAC7B,IAAI,CAAC,EAAE;YACL,MAAM,EAAE,SAAS,CAAC;YAClB,MAAM,EAAE,SAAS,CAAC;SACnB,CAAC;QAEF,UAAU,CAAC,EAAE,UAAU,CAAC;KACzB,CAAC;IACF,MAAM,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IACjC,QAAQ,EAAE,CAAC,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;CAChE"}
@@ -0,0 +1,29 @@
1
+ import { Transition } from 'motion';
2
+ import { Icon } from '../icon';
3
+ export interface SlideSheetInterface {
4
+ type: 'div';
5
+ props: {
6
+ variant?: 'standard' | 'modal';
7
+ children: React.ReactNode;
8
+ title?: string;
9
+ position?: 'left' | 'right';
10
+ extended?: boolean;
11
+ onExtendedChange?: (extended: boolean) => void;
12
+ transition?: Transition;
13
+ closeIcon?: Icon;
14
+ };
15
+ states: {
16
+ isExtended: boolean;
17
+ };
18
+ elements: [
19
+ 'slideSheet',
20
+ 'container',
21
+ 'title',
22
+ 'content',
23
+ 'header',
24
+ 'closeButton',
25
+ 'divider',
26
+ 'overlay'
27
+ ];
28
+ }
29
+ //# sourceMappingURL=slide-sheet.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slide-sheet.interface.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/slide-sheet.interface.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE;QACL,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;QAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;QAC/C,UAAU,CAAC,EAAE,UAAU,CAAC;QACxB,SAAS,CAAC,EAAE,IAAI,CAAC;KAClB,CAAC;IACF,MAAM,EAAE;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC;IAChC,QAAQ,EAAE;QACR,YAAY;QACZ,WAAW;QACX,OAAO;QACP,SAAS;QACT,QAAQ;QACR,aAAa;QACb,SAAS;QACT,SAAS;KACV,CAAC;CACH"}
@@ -6,6 +6,7 @@ export * from './divider.style';
6
6
  export * from './fab.style';
7
7
  export * from './icon-button.style';
8
8
  export * from './progress-indicator.style';
9
+ export * from './slide-sheet.style';
9
10
  export * from './slider.style';
10
11
  export * from './snackbar.style';
11
12
  export * from './switch.style';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
@@ -6,9 +6,9 @@ export declare const navigationRailStyle: (states: {
6
6
  selectedItem: any;
7
7
  setSelectedItem: any;
8
8
  extended: any;
9
+ onExtendedChange: any;
9
10
  alignment: any;
10
11
  menu: any;
11
- onExtendedChange: any;
12
12
  transition: any;
13
13
  } & {
14
14
  variant?: "standard" | "modal";
@@ -21,6 +21,7 @@ export declare const navigationRailStyle: (states: {
21
21
  selectedItem?: number | null;
22
22
  setSelectedItem?: import('react').Dispatch<import('react').SetStateAction<number | null>>;
23
23
  extended?: boolean;
24
+ onExtendedChange?: (extended: boolean) => void;
24
25
  alignment?: "middle" | "top";
25
26
  menu?: {
26
27
  closed: {
@@ -32,7 +33,6 @@ export declare const navigationRailStyle: (states: {
32
33
  label: string;
33
34
  };
34
35
  };
35
- onExtendedChange?: (extended: boolean) => void;
36
36
  transition?: import('motion').Transition;
37
37
  } & {
38
38
  isExtended?: boolean;
@@ -0,0 +1,25 @@
1
+ import { SlideSheetInterface } from '../interfaces/slide-sheet.interface';
2
+ export declare const slideSheetStyle: (states: {
3
+ variant: any;
4
+ children: any;
5
+ title: any;
6
+ position: any;
7
+ extended: any;
8
+ onExtendedChange: any;
9
+ transition: any;
10
+ closeIcon: any;
11
+ } & {
12
+ variant?: "standard" | "modal";
13
+ children: React.ReactNode;
14
+ title?: string;
15
+ position?: "left" | "right";
16
+ extended?: boolean;
17
+ onExtendedChange?: (extended: boolean) => void;
18
+ transition?: import('motion').Transition;
19
+ closeIcon?: import('..').Icon;
20
+ } & {
21
+ isExtended: boolean;
22
+ } & {
23
+ className: string | import('..').ClassNameComponent<SlideSheetInterface> | undefined;
24
+ }) => Record<"container" | "content" | "header" | "title" | "overlay" | "divider" | "slideSheet" | "closeButton", string>;
25
+ //# sourceMappingURL=slide-sheet.style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slide-sheet.style.d.ts","sourceRoot":"","sources":["../../../src/lib/styles/slide-sheet.style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE1E,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;yHA2B3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@udixio/ui-react",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -36,7 +36,7 @@
36
36
  "react": "^19.1.1",
37
37
  "react-dom": "^19.1.1",
38
38
  "@udixio/theme": "1.2.0",
39
- "@udixio/tailwind": "1.4.0"
39
+ "@udixio/tailwind": "1.6.0"
40
40
  },
41
41
  "repository": {
42
42
  "type": "git",
@@ -0,0 +1,122 @@
1
+ import { MotionProps } from '../utils';
2
+ import { SlideSheetInterface } from '../interfaces';
3
+ import { slideSheetStyle } from '../styles';
4
+ import { Divider } from './Divider';
5
+
6
+ import { faXmark } from '@fortawesome/free-solid-svg-icons';
7
+ import { IconButton } from './IconButton';
8
+ import { useEffect, useState } from 'react';
9
+ import { createPortal } from 'react-dom';
10
+ import { AnimatePresence, motion } from 'motion/react';
11
+
12
+ /**
13
+ * Side sheets show secondary content anchored to the side of the screen
14
+ * @status beta
15
+ * @category Layout
16
+ */
17
+ export const SlideSheet = ({
18
+ variant = 'standard',
19
+ className,
20
+ children,
21
+ title,
22
+ position = 'right',
23
+ extended,
24
+ onExtendedChange,
25
+ closeIcon = faXmark,
26
+ transition,
27
+ ...rest
28
+ }: MotionProps<SlideSheetInterface>) => {
29
+ transition = { duration: 0.3, ...transition };
30
+
31
+ const [isExtended, setIsExtended] = useState(extended ?? true);
32
+
33
+ const styles = slideSheetStyle({
34
+ transition,
35
+ title,
36
+ position,
37
+ closeIcon,
38
+ className,
39
+ children,
40
+ onExtendedChange,
41
+ isExtended,
42
+ extended: isExtended,
43
+ variant,
44
+ });
45
+
46
+ useEffect(() => {
47
+ onExtendedChange?.(isExtended ?? false);
48
+ }, [isExtended]);
49
+
50
+ useEffect(() => {
51
+ if (extended != undefined) {
52
+ setIsExtended(extended);
53
+ }
54
+ }, [extended]);
55
+
56
+ const variants = {
57
+ close: {
58
+ width: 0,
59
+ },
60
+ open: {
61
+ width: 'auto',
62
+ },
63
+ };
64
+
65
+ const render = () => (
66
+ <>
67
+ <AnimatePresence>
68
+ {variant == 'modal' && isExtended && (
69
+ <motion.div
70
+ initial={{ opacity: 0 }}
71
+ animate={{ opacity: 1 }}
72
+ exit={{ opacity: 0 }}
73
+ transition={transition}
74
+ onClick={() => setIsExtended(false)}
75
+ className={styles.overlay}
76
+ ></motion.div>
77
+ )}
78
+ </AnimatePresence>
79
+ <AnimatePresence>
80
+ {isExtended && (
81
+ <div
82
+ {...rest}
83
+ className={styles.slideSheet}
84
+ style={{ transition: transition.duration + 's' }}
85
+ >
86
+ <motion.div
87
+ variants={variants}
88
+ initial={extended === false ? 'open' : 'close'}
89
+ animate={'open'}
90
+ exit={'close'}
91
+ className={styles.container}
92
+ >
93
+ <div className={styles.header}>
94
+ {title && <p className={styles.title}>{title}</p>}
95
+ <IconButton
96
+ size={'small'}
97
+ label={'close'}
98
+ icon={closeIcon}
99
+ onClick={() => setIsExtended(false)}
100
+ className={styles.closeButton}
101
+ ></IconButton>
102
+ </div>
103
+ <div
104
+ className={styles.content}
105
+ style={{ transition: transition.duration + 's' }}
106
+ >
107
+ {children}
108
+ </div>
109
+ </motion.div>
110
+ <Divider className={styles.divider} orientation="vertical" />
111
+ </div>
112
+ )}
113
+ </AnimatePresence>
114
+ </>
115
+ );
116
+
117
+ if (variant == 'modal') {
118
+ return createPortal(render(), document.body);
119
+ }
120
+
121
+ return render();
122
+ };
@@ -9,6 +9,7 @@ export * from './IconButton';
9
9
  export * from './IconButton';
10
10
  export * from './ProgressIndicator';
11
11
  export * from './Slider';
12
+ export * from './SlideSheet';
12
13
  export * from './Snackbar';
13
14
  export * from './Switch';
14
15
  export * from './Tab';
@@ -1,5 +1,5 @@
1
- import { type ConfigInterface, loader } from '@udixio/theme';
2
- import { useEffect, useState } from 'react';
1
+ import { type API, type ConfigInterface, loader } from '@udixio/theme';
2
+ import { useEffect, useRef, useState } from 'react';
3
3
  import { TailwindPlugin } from '@udixio/tailwind';
4
4
 
5
5
  function isValidHexColor(hexColorString: string) {
@@ -7,52 +7,96 @@ function isValidHexColor(hexColorString: string) {
7
7
  return regex.test(hexColorString);
8
8
  }
9
9
 
10
- export const ThemeProvider = ({ config }: { config: ConfigInterface }) => {
11
- const [error, setError] = useState<string | null>(null);
12
-
10
+ export const ThemeProvider = ({
11
+ config,
12
+ throttleDelay = 100, // Délai par défaut de 300ms
13
+ onLoad,
14
+ }: {
15
+ config: ConfigInterface;
16
+ onLoad?: (api: API) => void;
17
+ throttleDelay?: number;
18
+ }) => {
13
19
  const [outputCss, setOutputCss] = useState<null | string>(null);
14
20
 
21
+ // Refs pour gérer le throttling
22
+ const timeoutRef = useRef<NodeJS.Timeout | null>(null);
23
+ const lastSourceColorRef = useRef<string>(config.sourceColor);
24
+ const isInitialLoadRef = useRef<boolean>(true);
25
+
15
26
  useEffect(() => {
16
- if (!isValidHexColor(config.sourceColor)) {
17
- setError('Invalid hex color');
27
+ // Si c'est le premier chargement, on applique immédiatement
28
+ if (isInitialLoadRef.current) {
29
+ isInitialLoadRef.current = false;
30
+ lastSourceColorRef.current = config.sourceColor;
31
+ applyThemeChange(config.sourceColor);
18
32
  return;
19
33
  }
20
34
 
21
- const initTheme = async () => {
22
- try {
23
- const api = await loader(config);
24
-
25
- api.themes.update({
26
- sourceColorHex: config.sourceColor,
27
- });
35
+ // Si la couleur n'a pas changé, on ne fait rien
36
+ if (config.sourceColor === lastSourceColorRef.current) {
37
+ return;
38
+ }
28
39
 
29
- await api.load();
40
+ // Annuler le timeout précédent s'il existe
41
+ if (timeoutRef.current) {
42
+ clearTimeout(timeoutRef.current);
43
+ }
30
44
 
31
- setOutputCss(
32
- api.plugins.getPlugin(TailwindPlugin).getInstance().outputCss,
33
- );
45
+ // Programmer un nouveau changement de thème avec un délai
46
+ timeoutRef.current = setTimeout(async () => {
47
+ lastSourceColorRef.current = config.sourceColor;
48
+ await applyThemeChange(config.sourceColor);
49
+ timeoutRef.current = null;
50
+ }, throttleDelay);
34
51
 
35
- console.log('Theme loaded');
36
- } catch (err) {
37
- console.error('Theme loading failed:', err);
38
- setError(err instanceof Error ? err.message : 'Theme loading failed');
52
+ // Cleanup function pour annuler le timeout si le composant se démonte
53
+ return () => {
54
+ if (timeoutRef.current) {
55
+ clearTimeout(timeoutRef.current);
56
+ timeoutRef.current = null;
39
57
  }
40
58
  };
59
+ }, [config.sourceColor, throttleDelay]);
41
60
 
42
- initTheme();
43
- }, [config.sourceColor]);
44
- if (error) {
45
- console.error('ThemeProvider error:', error);
46
- return null;
47
- }
61
+ const applyThemeChange = async (sourceColor: string) => {
62
+ if (!isValidHexColor(sourceColor)) {
63
+ throw new Error('Invalid hex color');
64
+ }
65
+
66
+ try {
67
+ // Mesure du temps de chargement de l'API
68
+ const api = await loader({
69
+ ...config,
70
+ sourceColor,
71
+ });
72
+ onLoad?.(api);
73
+
74
+ const generatedCss = api.plugins
75
+ .getPlugin(TailwindPlugin)
76
+ .getInstance().outputCss;
77
+
78
+ if (generatedCss) {
79
+ setOutputCss(generatedCss);
80
+ }
81
+ } catch (err) {
82
+ throw new Error(
83
+ err instanceof Error ? err.message : 'Theme loading failed',
84
+ );
85
+ }
86
+ };
87
+
88
+ // Cleanup lors du démontage du composant
89
+ useEffect(() => {
90
+ return () => {
91
+ if (timeoutRef.current) {
92
+ clearTimeout(timeoutRef.current);
93
+ }
94
+ };
95
+ }, []);
48
96
 
49
97
  if (!outputCss) {
50
98
  return null;
51
99
  }
52
- return (
53
- <style
54
- type="text/tailwindcss"
55
- dangerouslySetInnerHTML={{ __html: outputCss }}
56
- />
57
- );
100
+
101
+ return <style dangerouslySetInnerHTML={{ __html: outputCss }} />;
58
102
  };
@@ -6,6 +6,7 @@ export * from './divider.interface';
6
6
  export * from './fab.interface';
7
7
  export * from './icon-button.interface';
8
8
  export * from './progress-indicator.interface';
9
+ export * from './slide-sheet.interface';
9
10
  export * from './slider.interface';
10
11
  export * from './snackbar.interface';
11
12
  export * from './switch.interface';
@@ -25,12 +25,12 @@ export interface NavigationRailInterface {
25
25
  selectedItem?: number | null;
26
26
  setSelectedItem?: Dispatch<SetStateAction<number | null>>;
27
27
  extended?: boolean;
28
+ onExtendedChange?: (extended: boolean) => void;
28
29
  alignment?: 'middle' | 'top';
29
30
  menu?: {
30
31
  closed: MenuState;
31
32
  opened: MenuState;
32
33
  };
33
- onExtendedChange?: (extended: boolean) => void;
34
34
 
35
35
  transition?: Transition;
36
36
  };
@@ -0,0 +1,27 @@
1
+ import { Transition } from 'motion';
2
+ import { Icon } from '../icon';
3
+
4
+ export interface SlideSheetInterface {
5
+ type: 'div';
6
+ props: {
7
+ variant?: 'standard' | 'modal';
8
+ children: React.ReactNode;
9
+ title?: string;
10
+ position?: 'left' | 'right';
11
+ extended?: boolean;
12
+ onExtendedChange?: (extended: boolean) => void;
13
+ transition?: Transition;
14
+ closeIcon?: Icon;
15
+ };
16
+ states: { isExtended: boolean };
17
+ elements: [
18
+ 'slideSheet',
19
+ 'container',
20
+ 'title',
21
+ 'content',
22
+ 'header',
23
+ 'closeButton',
24
+ 'divider',
25
+ 'overlay',
26
+ ];
27
+ }
@@ -6,6 +6,7 @@ export * from './divider.style';
6
6
  export * from './fab.style';
7
7
  export * from './icon-button.style';
8
8
  export * from './progress-indicator.style';
9
+ export * from './slide-sheet.style';
9
10
  export * from './slider.style';
10
11
  export * from './snackbar.style';
11
12
  export * from './switch.style';
@@ -0,0 +1,31 @@
1
+ import { classNames, defaultClassNames } from '../utils';
2
+ import { SlideSheetInterface } from '../interfaces/slide-sheet.interface';
3
+
4
+ export const slideSheetStyle = defaultClassNames<SlideSheetInterface>(
5
+ 'slideSheet',
6
+ ({ variant, position }) => ({
7
+ slideSheet: classNames(
8
+ 'bg-surface flex justify-between max-w-xs z-10',
9
+ {
10
+ 'flex-row-reverse': position == 'right',
11
+ 'h-screen': variant == 'standard',
12
+ },
13
+ variant == 'modal' && [
14
+ 'rounded-2xl fixed top-0 m-[1rem] h-[calc(100dvh-2rem)]',
15
+ {
16
+ 'right-0': position == 'right',
17
+ 'left-0': position == 'left',
18
+ },
19
+ ],
20
+ ),
21
+ container: classNames('w-full overflow-hidden', {}),
22
+ content: classNames('w-fit '),
23
+ header: classNames('p-4 flex items-center gap-2'),
24
+ title: classNames('text-on-surface-variant text-title-large'),
25
+ closeButton: classNames('ml-auto'),
26
+ divider: classNames({ hidden: variant == 'modal' }),
27
+ overlay: classNames(
28
+ 'bg-[black]/[0.32] fixed top-0 left-0 w-screen h-screen',
29
+ ),
30
+ }),
31
+ );
@@ -0,0 +1,50 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import {
3
+ MotionProps,
4
+ ReactProps,
5
+ SlideSheet,
6
+ SlideSheetInterface,
7
+ } from '../../';
8
+
9
+ // More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
10
+ const meta = {
11
+ title: 'containment/SlideSheet',
12
+ component: SlideSheet,
13
+ parameters: {
14
+ // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/react/configure/story-layout
15
+ },
16
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/react/writing-docs/autodocs
17
+ tags: ['autodocs'],
18
+ // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
19
+ argTypes: {},
20
+ } satisfies Meta<typeof SlideSheet>;
21
+
22
+ export default meta;
23
+ type Story = StoryObj<typeof meta>;
24
+
25
+ // More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
26
+
27
+ const createSlideSheetStory = (
28
+ variant: ReactProps<SlideSheetInterface>['variant'],
29
+ ) => {
30
+ const SlideSheetStory: Story = (args: MotionProps<SlideSheetInterface>) => (
31
+ <>
32
+ <div
33
+ className={
34
+ 'bg-surface-container-highest h-screen w-full flex justify-between'
35
+ }
36
+ >
37
+ <SlideSheet position={'left'} {...args}></SlideSheet>
38
+ <SlideSheet position={'right'} {...args}></SlideSheet>
39
+ </div>
40
+ </>
41
+ );
42
+ SlideSheetStory.args = {
43
+ children: <div className={'h-96 w-96 bg-secondary-container'}></div>,
44
+ variant: variant,
45
+ title: 'SlideSheet',
46
+ };
47
+ return SlideSheetStory;
48
+ };
49
+ export const Standard = createSlideSheetStory('standard');
50
+ export const Modal = createSlideSheetStory('modal');