@chayns-components/core 5.3.9 → 5.3.10

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 (47) hide show
  1. package/AGENTS.md +61 -2
  2. package/lib/cjs/components/masonry/Masonry.context.js +17 -0
  3. package/lib/cjs/components/masonry/Masonry.context.js.map +1 -0
  4. package/lib/cjs/components/masonry/Masonry.hooks.js +53 -0
  5. package/lib/cjs/components/masonry/Masonry.hooks.js.map +1 -0
  6. package/lib/cjs/components/masonry/Masonry.js +81 -0
  7. package/lib/cjs/components/masonry/Masonry.js.map +1 -0
  8. package/lib/cjs/components/masonry/Masonry.styles.js +16 -0
  9. package/lib/cjs/components/masonry/Masonry.styles.js.map +1 -0
  10. package/lib/cjs/components/masonry/Masonry.types.js +6 -0
  11. package/lib/cjs/components/masonry/Masonry.types.js.map +1 -0
  12. package/lib/cjs/components/masonry/Masonry.utils.js +121 -0
  13. package/lib/cjs/components/masonry/Masonry.utils.js.map +1 -0
  14. package/lib/cjs/components/masonry/masonry-item/MasonryItem.js +77 -0
  15. package/lib/cjs/components/masonry/masonry-item/MasonryItem.js.map +1 -0
  16. package/lib/cjs/components/masonry/masonry-item/MasonryItem.styles.js +17 -0
  17. package/lib/cjs/components/masonry/masonry-item/MasonryItem.styles.js.map +1 -0
  18. package/lib/cjs/index.js +7 -0
  19. package/lib/cjs/index.js.map +1 -1
  20. package/lib/esm/components/masonry/Masonry.context.js +10 -0
  21. package/lib/esm/components/masonry/Masonry.context.js.map +1 -0
  22. package/lib/esm/components/masonry/Masonry.hooks.js +44 -0
  23. package/lib/esm/components/masonry/Masonry.hooks.js.map +1 -0
  24. package/lib/esm/components/masonry/Masonry.js +74 -0
  25. package/lib/esm/components/masonry/Masonry.js.map +1 -0
  26. package/lib/esm/components/masonry/Masonry.styles.js +9 -0
  27. package/lib/esm/components/masonry/Masonry.styles.js.map +1 -0
  28. package/lib/esm/components/masonry/Masonry.types.js +2 -0
  29. package/lib/esm/components/masonry/Masonry.types.js.map +1 -0
  30. package/lib/esm/components/masonry/Masonry.utils.js +110 -0
  31. package/lib/esm/components/masonry/Masonry.utils.js.map +1 -0
  32. package/lib/esm/components/masonry/masonry-item/MasonryItem.js +69 -0
  33. package/lib/esm/components/masonry/masonry-item/MasonryItem.js.map +1 -0
  34. package/lib/esm/components/masonry/masonry-item/MasonryItem.styles.js +10 -0
  35. package/lib/esm/components/masonry/masonry-item/MasonryItem.styles.js.map +1 -0
  36. package/lib/esm/index.js +1 -0
  37. package/lib/esm/index.js.map +1 -1
  38. package/lib/types/components/masonry/Masonry.context.d.ts +3 -0
  39. package/lib/types/components/masonry/Masonry.d.ts +3 -0
  40. package/lib/types/components/masonry/Masonry.hooks.d.ts +22 -0
  41. package/lib/types/components/masonry/Masonry.styles.d.ts +5 -0
  42. package/lib/types/components/masonry/Masonry.types.d.ts +40 -0
  43. package/lib/types/components/masonry/Masonry.utils.d.ts +22 -0
  44. package/lib/types/components/masonry/masonry-item/MasonryItem.d.ts +5 -0
  45. package/lib/types/components/masonry/masonry-item/MasonryItem.styles.d.ts +5 -0
  46. package/lib/types/index.d.ts +1 -0
  47. package/package.json +2 -2
@@ -0,0 +1,5 @@
1
+ export declare const StyledMasonry: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$height"> & {
2
+ $height: number;
3
+ }, never> & Partial<Pick<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$height"> & {
4
+ $height: number;
5
+ }, never>>> & string;
@@ -0,0 +1,40 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ export interface MasonryProps {
3
+ children: ReactNode;
4
+ gap?: number;
5
+ columnWidth?: number;
6
+ rowHeight?: number;
7
+ }
8
+ export interface MasonryItemProps {
9
+ children: ReactNode;
10
+ columns?: number;
11
+ }
12
+ export interface MasonryContextValue {
13
+ registerItem: (key: string, height: number) => void;
14
+ }
15
+ export interface MasonryLayoutItem {
16
+ key: string;
17
+ columns: number;
18
+ rows: number;
19
+ }
20
+ export interface PackedMasonryItem {
21
+ key: string;
22
+ x: number;
23
+ y: number;
24
+ width: number;
25
+ }
26
+ export interface PackedMasonryGrid {
27
+ items: Record<string, PackedMasonryItem>;
28
+ height: number;
29
+ }
30
+ export interface InternalMasonryItemProps {
31
+ children: ReactNode;
32
+ itemKey: string;
33
+ x: number;
34
+ y: number;
35
+ width: number;
36
+ }
37
+ export type MasonryChild = ReactElement<MasonryItemProps>;
38
+ export type MasonryComponent = React.FC<MasonryProps> & {
39
+ Item: React.FC<MasonryItemProps>;
40
+ };
@@ -0,0 +1,22 @@
1
+ import { ReactElement } from 'react';
2
+ import { MasonryItemProps, MasonryLayoutItem, PackedMasonryGrid } from './Masonry.types';
3
+ export declare const getMasonryItemKey: (item: ReactElement<MasonryItemProps>, index: number) => string;
4
+ interface PackMasonryGridParams {
5
+ items: MasonryLayoutItem[];
6
+ columnCount: number;
7
+ columnWidth: number;
8
+ rowHeight: number;
9
+ gap: number;
10
+ }
11
+ export declare const packMasonryGrid: ({ items, columnCount, columnWidth, rowHeight, gap, }: PackMasonryGridParams) => PackedMasonryGrid;
12
+ export declare const calculateColumnCount: ({ containerWidth, columnWidth, gap, }: {
13
+ containerWidth: number;
14
+ columnWidth: number;
15
+ gap: number;
16
+ }) => number;
17
+ export declare const calculateRowSpan: ({ height, rowHeight, gap, }: {
18
+ height: number;
19
+ rowHeight: number;
20
+ gap: number;
21
+ }) => number;
22
+ export {};
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import { InternalMasonryItemProps, MasonryItemProps } from '../Masonry.types';
3
+ declare const MasonryItem: FC<MasonryItemProps>;
4
+ export declare const InternalMasonryItem: FC<InternalMasonryItemProps>;
5
+ export default MasonryItem;
@@ -0,0 +1,5 @@
1
+ export declare const StyledMasonryItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
2
+ ref?: React.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
3
+ }, never> & Partial<Pick<Omit<Omit<import("motion/react").HTMLMotionProps<"div">, "ref"> & React.RefAttributes<HTMLDivElement>, "ref"> & {
4
+ ref?: React.RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | null | undefined;
5
+ }, never>>> & string & Omit<import("motion/react").ForwardRefComponent<HTMLDivElement, import("motion/react").HTMLMotionProps<"div">>, keyof React.Component<any, {}, any>>;
@@ -100,3 +100,4 @@ export { ComboBoxSize } from './components/combobox/ComboBox.types';
100
100
  export type { IComboBoxItem as ComboBoxItem, ComboBoxTextStyles, IComboBoxItems as ComboBoxItems, ComboBoxRef, } from './components/combobox/ComboBox.types';
101
101
  export { default as Skeleton } from './components/skeleton';
102
102
  export { SkeletonAnimationType } from './components/skeleton/types';
103
+ export { default as Masonry } from './components/masonry/Masonry';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chayns-components/core",
3
- "version": "5.3.9",
3
+ "version": "5.3.10",
4
4
  "description": "A set of beautiful React components for developing your own applications with chayns.",
5
5
  "sideEffects": false,
6
6
  "browserslist": [
@@ -88,5 +88,5 @@
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
- "gitHead": "d47204bde2d504689320e48b9f2520bd90338ba6"
91
+ "gitHead": "ae538b0fd6f041f55b5b842cb47dc7363fc9511d"
92
92
  }