fiboui 1.0.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 (141) hide show
  1. package/README.md +101 -0
  2. package/dist/content/Alert/index.d.ts +878 -0
  3. package/dist/content/Avatar/index.d.ts +886 -0
  4. package/dist/content/Badge/index.d.ts +887 -0
  5. package/dist/content/Image/index.d.ts +893 -0
  6. package/dist/content/Label/index.d.ts +879 -0
  7. package/dist/content/Progress/index.d.ts +898 -0
  8. package/dist/content/Skeleton/index.d.ts +879 -0
  9. package/dist/content/Spinner/index.d.ts +880 -0
  10. package/dist/content/Text/index.d.ts +878 -0
  11. package/dist/content/index.d.ts +9 -0
  12. package/dist/core/StateWrapper.d.ts +28 -0
  13. package/dist/core/builder.d.ts +50 -0
  14. package/dist/core/component.d.ts +7 -0
  15. package/dist/core/effects.d.ts +3 -0
  16. package/dist/core/icons.d.ts +11 -0
  17. package/dist/core/index.d.ts +5 -0
  18. package/dist/core/state.d.ts +37 -0
  19. package/dist/core/types.d.ts +51 -0
  20. package/dist/demo.d.ts +7 -0
  21. package/dist/effects-Co9C_Dyx.mjs +9 -0
  22. package/dist/examples/ScaffoldExamples.d.ts +3 -0
  23. package/dist/examples/StateExamples.d.ts +5 -0
  24. package/dist/index.d.ts +6 -0
  25. package/dist/index.esm.js +4622 -0
  26. package/dist/index.umd.js +251 -0
  27. package/dist/interactive/Button/index.d.ts +897 -0
  28. package/dist/interactive/Checkbox/index.d.ts +884 -0
  29. package/dist/interactive/Combobox/index.d.ts +898 -0
  30. package/dist/interactive/RadioGroup/index.d.ts +888 -0
  31. package/dist/interactive/Select/index.d.ts +895 -0
  32. package/dist/interactive/Switch/index.d.ts +881 -0
  33. package/dist/interactive/TextField/index.d.ts +892 -0
  34. package/dist/interactive/Textarea/index.d.ts +890 -0
  35. package/dist/interactive/index.d.ts +8 -0
  36. package/dist/layout/Center/index.d.ts +869 -0
  37. package/dist/layout/Column/index.d.ts +881 -0
  38. package/dist/layout/Container/index.d.ts +870 -0
  39. package/dist/layout/DashboardLayout/index.d.ts +870 -0
  40. package/dist/layout/Header/index.d.ts +870 -0
  41. package/dist/layout/Line/index.d.ts +872 -0
  42. package/dist/layout/Row/index.d.ts +879 -0
  43. package/dist/layout/Scaffold/index.d.ts +878 -0
  44. package/dist/layout/ScrollView/index.d.ts +879 -0
  45. package/dist/layout/Sidebar/index.d.ts +870 -0
  46. package/dist/layout/Spacer/index.d.ts +875 -0
  47. package/dist/layout/StakentComponents.d.ts +4 -0
  48. package/dist/layout/index.d.ts +11 -0
  49. package/dist/structure/Banner/index.d.ts +879 -0
  50. package/dist/structure/Box/index.d.ts +869 -0
  51. package/dist/structure/Card/index.d.ts +881 -0
  52. package/dist/structure/Collapse/index.d.ts +884 -0
  53. package/dist/structure/Grid/index.d.ts +1757 -0
  54. package/dist/structure/List/index.d.ts +888 -0
  55. package/dist/structure/Table/index.d.ts +895 -0
  56. package/dist/structure/Tags/index.d.ts +876 -0
  57. package/dist/structure/cards/AssetCard/index.d.ts +884 -0
  58. package/dist/structure/cards/CollectionCard/index.d.ts +880 -0
  59. package/dist/structure/cards/ContentCard/index.d.ts +884 -0
  60. package/dist/structure/cards/ProfileCard/index.d.ts +892 -0
  61. package/dist/structure/cards/index.d.ts +5 -0
  62. package/dist/structure/cards/variants/index.d.ts +3490 -0
  63. package/dist/structure/index.d.ts +9 -0
  64. package/dist/style.css +1 -0
  65. package/dist/theme/cupertino.d.ts +3 -0
  66. package/dist/theme/index.d.ts +5 -0
  67. package/dist/theme/material.d.ts +3 -0
  68. package/dist/theme/provider.d.ts +16 -0
  69. package/dist/theme/types.d.ts +57 -0
  70. package/dist/theme/web.d.ts +3 -0
  71. package/package.json +54 -0
  72. package/src/content/Alert/index.ts +110 -0
  73. package/src/content/Avatar/index.ts +116 -0
  74. package/src/content/Badge/index.ts +162 -0
  75. package/src/content/Image/index.ts +137 -0
  76. package/src/content/Label/index.ts +66 -0
  77. package/src/content/Progress/index.ts +378 -0
  78. package/src/content/Skeleton/index.ts +71 -0
  79. package/src/content/Spinner/index.ts +139 -0
  80. package/src/content/Text/index.ts +74 -0
  81. package/src/content/index.ts +9 -0
  82. package/src/core/StateWrapper.tsx +105 -0
  83. package/src/core/builder.ts +259 -0
  84. package/src/core/component.ts +49 -0
  85. package/src/core/effects.ts +27 -0
  86. package/src/core/icons.tsx +57 -0
  87. package/src/core/index.ts +5 -0
  88. package/src/core/state.ts +233 -0
  89. package/src/core/types.ts +62 -0
  90. package/src/demo.tsx +1045 -0
  91. package/src/examples/ScaffoldExamples.tsx +299 -0
  92. package/src/examples/StateExamples.tsx +149 -0
  93. package/src/index.ts +8 -0
  94. package/src/interactive/Button/index.ts +218 -0
  95. package/src/interactive/Checkbox/index.ts +145 -0
  96. package/src/interactive/Combobox/index.ts +278 -0
  97. package/src/interactive/RadioGroup/index.ts +124 -0
  98. package/src/interactive/Select/index.ts +227 -0
  99. package/src/interactive/Switch/index.ts +123 -0
  100. package/src/interactive/TextField/index.ts +200 -0
  101. package/src/interactive/Textarea/index.ts +129 -0
  102. package/src/interactive/index.ts +8 -0
  103. package/src/layout/Center/index.ts +34 -0
  104. package/src/layout/Column/index.ts +101 -0
  105. package/src/layout/Container/index.ts +28 -0
  106. package/src/layout/DashboardLayout/index.ts +106 -0
  107. package/src/layout/Header/index.ts +50 -0
  108. package/src/layout/Line/index.ts +41 -0
  109. package/src/layout/Row/index.ts +93 -0
  110. package/src/layout/Scaffold/index.ts +133 -0
  111. package/src/layout/ScrollView/index.ts +67 -0
  112. package/src/layout/Sidebar/index.ts +56 -0
  113. package/src/layout/Spacer/index.ts +46 -0
  114. package/src/layout/StakentComponents.tsx +57 -0
  115. package/src/layout/index.ts +11 -0
  116. package/src/structure/Banner/index.ts +92 -0
  117. package/src/structure/Box/index.ts +45 -0
  118. package/src/structure/Card/index.ts +113 -0
  119. package/src/structure/Collapse/index.ts +122 -0
  120. package/src/structure/Grid/index.ts +197 -0
  121. package/src/structure/List/index.ts +185 -0
  122. package/src/structure/Table/index.ts +165 -0
  123. package/src/structure/Tags/index.ts +69 -0
  124. package/src/structure/cards/AssetCard/index.ts +158 -0
  125. package/src/structure/cards/CollectionCard/index.ts +95 -0
  126. package/src/structure/cards/ContentCard/index.ts +127 -0
  127. package/src/structure/cards/ProfileCard/index.ts +152 -0
  128. package/src/structure/cards/index.ts +5 -0
  129. package/src/structure/cards/variants/index.ts +301 -0
  130. package/src/structure/index.ts +10 -0
  131. package/src/styles/base.css +186 -0
  132. package/src/styles/core.css +52 -0
  133. package/src/styles/themes/cupertino.css +197 -0
  134. package/src/styles/themes/material.css +322 -0
  135. package/src/styles/themes/web.css +196 -0
  136. package/src/theme/cupertino.ts +85 -0
  137. package/src/theme/index.ts +5 -0
  138. package/src/theme/material.ts +86 -0
  139. package/src/theme/provider.tsx +76 -0
  140. package/src/theme/types.ts +62 -0
  141. package/src/theme/web.ts +82 -0
@@ -0,0 +1,34 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { FiboBuilder, createBuilder } from '../../core/builder';
3
+ import { ChildrenProps } from '../../core/types';
4
+
5
+ class CenterBuilder extends FiboBuilder {
6
+ build(): ReactElement {
7
+ const classes = [
8
+ 'fibo-center',
9
+ 'flex',
10
+ 'items-center',
11
+ 'justify-center',
12
+ ...this._classNames,
13
+ ];
14
+
15
+ const className = classes.filter(Boolean).join(' ');
16
+ const style = this.getStyle();
17
+ const children = this.processChildren();
18
+
19
+ return React.createElement(
20
+ 'div',
21
+ {
22
+ className,
23
+ style,
24
+ ...this._props,
25
+ },
26
+ ...children
27
+ );
28
+ }
29
+ }
30
+
31
+
32
+ export const Center = createBuilder(CenterBuilder);
33
+
34
+ export interface CenterProps extends ChildrenProps {}
@@ -0,0 +1,101 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { FiboBuilder, createBuilder } from '../../core/builder';
3
+ import { ChildrenProps, MainAxisAlignment, CrossAxisAlignment } from '../../core/types';
4
+
5
+ class ColumnBuilder extends FiboBuilder {
6
+ private _mainAxisAlignment: MainAxisAlignment = 'start';
7
+ private _crossAxisAlignment: CrossAxisAlignment = 'start';
8
+ private _spacing?: string | number;
9
+ private _size?: 'small' | 'medium' | 'large';
10
+
11
+ mainAxisAlignment(alignment: MainAxisAlignment): this {
12
+ this._mainAxisAlignment = alignment;
13
+ return this;
14
+ }
15
+
16
+ crossAxisAlignment(alignment: CrossAxisAlignment): this {
17
+ this._crossAxisAlignment = alignment;
18
+ return this;
19
+ }
20
+
21
+ spacing(value: string | number): this {
22
+ this._spacing = value;
23
+ return this;
24
+ }
25
+
26
+ size(size: 'small' | 'medium' | 'large'): this {
27
+ this._size = size;
28
+ return this;
29
+ }
30
+
31
+ build(): ReactElement {
32
+ const alignmentMap: Record<MainAxisAlignment, string> = {
33
+ start: 'justify-start',
34
+ center: 'justify-center',
35
+ end: 'justify-end',
36
+ spaceBetween: 'justify-between',
37
+ spaceAround: 'justify-around',
38
+ spaceEvenly: 'justify-evenly',
39
+ };
40
+
41
+ const crossAlignmentMap: Record<CrossAxisAlignment, string> = {
42
+ start: 'items-start',
43
+ center: 'items-center',
44
+ end: 'items-end',
45
+ stretch: 'items-stretch',
46
+ };
47
+
48
+ const sizeMap = {
49
+ small: 'flex-[0.3]',
50
+ medium: 'flex-1',
51
+ large: 'flex-[1.5]',
52
+ };
53
+
54
+ const classes = [
55
+ 'fibo-column',
56
+ 'flex',
57
+ 'flex-col',
58
+ alignmentMap[this._mainAxisAlignment],
59
+ crossAlignmentMap[this._crossAxisAlignment],
60
+ this._size ? sizeMap[this._size] : '',
61
+ ...this._classNames,
62
+ ];
63
+
64
+ const style = this.getStyle();
65
+
66
+ if (this._spacing) {
67
+ if (typeof this._spacing === 'number') {
68
+ style.gap = `${this._spacing}px`;
69
+ } else {
70
+ if (!isNaN(Number(this._spacing))) {
71
+ style.gap = `${Number(this._spacing) * 4}px`;
72
+ } else {
73
+ style.gap = this._spacing;
74
+ }
75
+ }
76
+ }
77
+
78
+ const className = classes.filter(Boolean).join(' ');
79
+ const children = this.processChildren();
80
+
81
+ return React.createElement(
82
+ 'div',
83
+ {
84
+ className,
85
+ style,
86
+ ...this._props,
87
+ },
88
+ ...children
89
+ );
90
+ }
91
+ }
92
+
93
+
94
+ export const Column = createBuilder(ColumnBuilder);
95
+
96
+ export interface ColumnProps extends ChildrenProps {
97
+ mainAxisAlignment?: MainAxisAlignment;
98
+ crossAxisAlignment?: CrossAxisAlignment;
99
+ spacing?: string | number;
100
+ size?: 'small' | 'medium' | 'large';
101
+ }
@@ -0,0 +1,28 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { FiboBuilder, createBuilder } from '../../core/builder';
3
+ import { ChildrenProps } from '../../core/types';
4
+
5
+ class ContainerBuilder extends FiboBuilder {
6
+ build(): ReactElement {
7
+ const className = this.getClassName();
8
+ const style = this.getStyle();
9
+ const children = this.processChildren();
10
+
11
+ return React.createElement(
12
+ 'div',
13
+ {
14
+ className: `fibo-container ${className}`,
15
+ style,
16
+ ...this._props,
17
+ },
18
+ ...children
19
+ );
20
+ }
21
+ }
22
+
23
+
24
+ export const Container = createBuilder(ContainerBuilder);
25
+
26
+ export interface ContainerProps extends ChildrenProps {
27
+ maxWidth?: string | number;
28
+ }
@@ -0,0 +1,106 @@
1
+ import React, { ReactElement, ReactNode, useState } from 'react';
2
+ import { FiboBuilder, createBuilder } from '../../core/builder';
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ const DashboardLayoutInner = React.memo((props: any) => {
13
+ const { sidebar, header, children, className, style, ...rest } = props;
14
+ const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
15
+
16
+ return React.createElement(
17
+ 'div',
18
+ {
19
+ className: `h-full w-full bg-[#0B0C15] overflow-hidden relative ${className || ''}`,
20
+ style,
21
+ ...rest
22
+ },
23
+
24
+ isMobileMenuOpen && React.createElement('div', {
25
+ className: 'fixed inset-0 z-40 bg-black/50 backdrop-blur-sm transition-opacity lg:hidden',
26
+ onClick: () => setIsMobileMenuOpen(false)
27
+ }),
28
+
29
+
30
+
31
+ React.createElement('button', {
32
+ className: 'lg:hidden fixed top-4 right-4 z-50 p-2 rounded-lg bg-[#1A1B23] border border-white/10 text-white shadow-lg',
33
+ onClick: () => setIsMobileMenuOpen(!isMobileMenuOpen)
34
+ },
35
+ React.createElement('div', { className: isMobileMenuOpen ? 'i-heroicons-x-mark w-6 h-6' : 'i-heroicons-bars-3 w-6 h-6' })
36
+ ),
37
+
38
+
39
+ React.createElement(
40
+ 'div',
41
+ {
42
+ className: 'grid h-full w-full lg:grid-cols-[260px_1fr] transition-all duration-300'
43
+ },
44
+
45
+
46
+ React.createElement(
47
+ 'aside',
48
+ {
49
+ className: `
50
+ fixed inset-y-0 left-0 z-50 w-[260px] bg-[#0B0C15] border-r border-white/5 transition-transform duration-300 transform
51
+ lg:relative lg:translate-x-0
52
+ ${isMobileMenuOpen ? 'translate-x-0 shadow-2xl' : '-translate-x-full'}
53
+ `
54
+ },
55
+ sidebar
56
+ ),
57
+
58
+
59
+ React.createElement(
60
+ 'main',
61
+ {
62
+ className: 'flex flex-col min-w-0 h-full overflow-hidden relative'
63
+ },
64
+
65
+ header && React.createElement('div', { className: 'flex-shrink-0' }, header),
66
+
67
+
68
+ React.createElement(
69
+ 'div',
70
+ { className: 'flex-1 overflow-y-auto scrollbar-hide p-4 lg:p-0' },
71
+ children
72
+ )
73
+ )
74
+ )
75
+ );
76
+ });
77
+
78
+ class DashboardLayoutBuilder extends FiboBuilder {
79
+ private _sidebar?: ReactNode;
80
+ private _header?: ReactNode;
81
+
82
+ sidebar(component: ReactNode): this {
83
+ this._sidebar = component;
84
+ return this;
85
+ }
86
+
87
+ header(component: ReactNode): this {
88
+ this._header = component;
89
+ return this;
90
+ }
91
+
92
+ build(): ReactElement {
93
+ const props = {
94
+ sidebar: this._sidebar,
95
+ header: this._header,
96
+ className: this.getClassName(),
97
+ style: this.getStyle(),
98
+ children: this.processChildren(),
99
+ ...this._props
100
+ };
101
+ return React.createElement(DashboardLayoutInner, props);
102
+ }
103
+ }
104
+
105
+
106
+ export const DashboardLayout = createBuilder(DashboardLayoutBuilder);
@@ -0,0 +1,50 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { FiboBuilder, createBuilder } from '../../core/builder';
3
+
4
+
5
+
6
+
7
+
8
+ const HeaderInner = React.memo((props: any) => {
9
+ const { height = 64, sticky, className, style, children, ...rest } = props;
10
+
11
+ return React.createElement(
12
+ 'header',
13
+ {
14
+ className: `flex items-center px-6 border-b border-gray-200 bg-white/80 backdrop-blur-md z-10 w-full ${sticky ? 'sticky top-0' : ''} ${className || ''}`,
15
+ style: { height, minHeight: height, ...style },
16
+ ...rest
17
+ },
18
+ children
19
+ );
20
+ });
21
+
22
+ class HeaderBuilder extends FiboBuilder {
23
+ private _height: number | string = 64;
24
+ private _sticky: boolean = false;
25
+
26
+ height(height: number | string): this {
27
+ this._height = height;
28
+ return this;
29
+ }
30
+
31
+ sticky(enable: boolean = true): this {
32
+ this._sticky = enable;
33
+ return this;
34
+ }
35
+
36
+ build(): ReactElement {
37
+ const props = {
38
+ height: this._height,
39
+ sticky: this._sticky,
40
+ className: this.getClassName(),
41
+ style: this.getStyle(),
42
+ children: this.processChildren(),
43
+ ...this._props
44
+ };
45
+ return React.createElement(HeaderInner, props);
46
+ }
47
+ }
48
+
49
+
50
+ export const Header = createBuilder(HeaderBuilder);
@@ -0,0 +1,41 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { FiboBuilder, createBuilder } from '../../core/builder';
3
+ import { ChildrenProps } from '../../core/types';
4
+
5
+ class LineBuilder extends FiboBuilder {
6
+ private _sizeHeight?: string;
7
+
8
+ sizeHeight(value: string): this {
9
+ this._sizeHeight = value;
10
+ return this;
11
+ }
12
+
13
+ build(): ReactElement {
14
+ const classes = ['fibo-line', 'flex', 'flex-row', ...this._classNames];
15
+ const className = classes.filter(Boolean).join(' ');
16
+ const style = this.getStyle();
17
+
18
+ if (this._sizeHeight) {
19
+ style.height = this._sizeHeight;
20
+ }
21
+
22
+ const children = this.processChildren();
23
+
24
+ return React.createElement(
25
+ 'div',
26
+ {
27
+ className,
28
+ style,
29
+ ...this._props,
30
+ },
31
+ ...children
32
+ );
33
+ }
34
+ }
35
+
36
+
37
+ export const Line = createBuilder(LineBuilder);
38
+
39
+ export interface LineProps extends ChildrenProps {
40
+ sizeHeight?: string;
41
+ }
@@ -0,0 +1,93 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { FiboBuilder, createBuilder } from '../../core/builder';
3
+ import { ChildrenProps, MainAxisAlignment, CrossAxisAlignment } from '../../core/types';
4
+
5
+ class RowBuilder extends FiboBuilder {
6
+ private _mainAxisAlignment: MainAxisAlignment = 'start';
7
+ private _crossAxisAlignment: CrossAxisAlignment = 'start';
8
+ private _spacing?: string | number;
9
+
10
+ mainAxisAlignment(alignment: MainAxisAlignment): this {
11
+ this._mainAxisAlignment = alignment;
12
+ return this;
13
+ }
14
+
15
+ crossAxisAlignment(alignment: CrossAxisAlignment): this {
16
+ this._crossAxisAlignment = alignment;
17
+ return this;
18
+ }
19
+
20
+ spacing(value: string | number): this {
21
+ this._spacing = value;
22
+ return this;
23
+ }
24
+
25
+ items(children: ReactElement[]): this {
26
+ this.children(children);
27
+ return this;
28
+ }
29
+
30
+ build(): ReactElement {
31
+ const alignmentMap: Record<MainAxisAlignment, string> = {
32
+ start: 'justify-start',
33
+ center: 'justify-center',
34
+ end: 'justify-end',
35
+ spaceBetween: 'justify-between',
36
+ spaceAround: 'justify-around',
37
+ spaceEvenly: 'justify-evenly',
38
+ };
39
+
40
+ const crossAlignmentMap: Record<CrossAxisAlignment, string> = {
41
+ start: 'items-start',
42
+ center: 'items-center',
43
+ end: 'items-end',
44
+ stretch: 'items-stretch',
45
+ };
46
+
47
+ const classes = [
48
+ 'fibo-row',
49
+ 'flex',
50
+ 'flex-row',
51
+ alignmentMap[this._mainAxisAlignment],
52
+ crossAlignmentMap[this._crossAxisAlignment],
53
+ ...this._classNames,
54
+ ];
55
+
56
+ const style = this.getStyle();
57
+
58
+ if (this._spacing) {
59
+ if (typeof this._spacing === 'number') {
60
+ style.gap = `${this._spacing}px`;
61
+ } else {
62
+
63
+ if (!isNaN(Number(this._spacing))) {
64
+ style.gap = `${Number(this._spacing) * 4}px`;
65
+ } else {
66
+ style.gap = this._spacing;
67
+ }
68
+ }
69
+ }
70
+
71
+ const className = classes.filter(Boolean).join(' ');
72
+ const children = this.processChildren();
73
+
74
+ return React.createElement(
75
+ 'div',
76
+ {
77
+ className,
78
+ style,
79
+ ...this._props,
80
+ },
81
+ ...children
82
+ );
83
+ }
84
+ }
85
+
86
+
87
+ export const Row = createBuilder(RowBuilder);
88
+
89
+ export interface RowProps extends ChildrenProps {
90
+ mainAxisAlignment?: MainAxisAlignment;
91
+ crossAxisAlignment?: CrossAxisAlignment;
92
+ spacing?: string | number;
93
+ }
@@ -0,0 +1,133 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { FiboBuilder, createBuilder } from '../../core/builder';
3
+ import { ProviderWrapper } from '../../core/StateWrapper';
4
+
5
+
6
+
7
+ interface ScaffoldConfig {
8
+ theme?: any;
9
+ locale?: string;
10
+ providers?: Record<string, any>;
11
+ className?: string;
12
+ style?: React.CSSProperties;
13
+ children?: React.ReactNode;
14
+ }
15
+
16
+ const ScaffoldInner = React.memo((props: ScaffoldConfig) => {
17
+ const {
18
+ theme,
19
+ locale,
20
+ providers = {},
21
+ className,
22
+ style,
23
+ children,
24
+ } = props;
25
+
26
+
27
+ const allProviders = new Map<string, any>();
28
+
29
+
30
+ if (theme) {
31
+ allProviders.set('theme', theme);
32
+ }
33
+
34
+
35
+ if (locale) {
36
+ allProviders.set('locale', locale);
37
+ }
38
+
39
+
40
+ Object.entries(providers).forEach(([key, value]) => {
41
+ allProviders.set(key, value);
42
+ });
43
+
44
+
45
+ if (allProviders.size > 0) {
46
+ return React.createElement(
47
+ ProviderWrapper,
48
+ {
49
+ providers: allProviders,
50
+ children: React.createElement(
51
+ 'div',
52
+ {
53
+ className: `fibo-scaffold ${className || ''}`,
54
+ style: {
55
+ minHeight: '100vh',
56
+ display: 'flex',
57
+ flexDirection: 'column',
58
+ ...style,
59
+ },
60
+ },
61
+ children
62
+ )
63
+ }
64
+ );
65
+ }
66
+
67
+
68
+ return React.createElement(
69
+ 'div',
70
+ {
71
+ className: `fibo-scaffold ${className || ''}`,
72
+ style: {
73
+ minHeight: '100vh',
74
+ display: 'flex',
75
+ flexDirection: 'column',
76
+ ...style,
77
+ },
78
+ },
79
+ children
80
+ );
81
+ });
82
+
83
+ class ScaffoldBuilder extends FiboBuilder {
84
+ private _theme?: any;
85
+ private _locale?: string;
86
+ private _customProviders: Record<string, any> = {};
87
+
88
+
89
+ theme(theme: any): this {
90
+ this._theme = theme;
91
+ return this;
92
+ }
93
+
94
+
95
+ locale(locale: string): this {
96
+ this._locale = locale;
97
+ return this;
98
+ }
99
+
100
+
101
+ providers(providers: Record<string, any>): this {
102
+ this._customProviders = { ...this._customProviders, ...providers };
103
+ return this;
104
+ }
105
+
106
+
107
+ provider(key: string, value: any): this {
108
+ this._customProviders[key] = value;
109
+ return this;
110
+ }
111
+
112
+ build(): ReactElement {
113
+ const props: ScaffoldConfig = {
114
+ theme: this._theme,
115
+ locale: this._locale,
116
+ providers: this._customProviders,
117
+ className: this.getClassName(),
118
+ style: this.getStyle(),
119
+ children: this.processChildren(),
120
+ };
121
+
122
+ return React.createElement(ScaffoldInner, props);
123
+ }
124
+ }
125
+
126
+
127
+ export const Scaffold = createBuilder(ScaffoldBuilder);
128
+
129
+ export interface ScaffoldProps {
130
+ theme?: any;
131
+ locale?: string;
132
+ providers?: Record<string, any>;
133
+ }
@@ -0,0 +1,67 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { FiboBuilder, createBuilder } from '../../core/builder';
3
+ import { BaseProps } from '../../core/types';
4
+
5
+
6
+ type ScrollDirection = 'vertical' | 'horizontal' | 'both';
7
+ type ScrollbarVisibility = 'hidden' | 'visible' | 'auto';
8
+
9
+ class ScrollViewBuilder extends FiboBuilder {
10
+ private _direction: ScrollDirection = 'vertical';
11
+ private _scrollbar: ScrollbarVisibility = 'auto';
12
+
13
+ direction(direction: ScrollDirection): this {
14
+ this._direction = direction;
15
+ return this;
16
+ }
17
+
18
+ horizontal(): this {
19
+ this._direction = 'horizontal';
20
+ return this;
21
+ }
22
+
23
+ vertical(): this {
24
+ this._direction = 'vertical';
25
+ return this;
26
+ }
27
+
28
+ scrollbar(visibility: ScrollbarVisibility): this {
29
+ this._scrollbar = visibility;
30
+ return this;
31
+ }
32
+
33
+ build(): ReactElement {
34
+ const scrollStyles: React.CSSProperties = {
35
+ overflowX: this._direction === 'horizontal' || this._direction === 'both' ? 'auto' : 'hidden',
36
+ overflowY: this._direction === 'vertical' || this._direction === 'both' ? 'auto' : 'hidden',
37
+ WebkitOverflowScrolling: 'touch',
38
+ display: 'flex',
39
+ flexDirection: this._direction === 'horizontal' ? 'row' : 'column',
40
+ ...this.getStyle()
41
+ };
42
+
43
+ const classNames = [...this.getClassName().split(' ')];
44
+
45
+ if (this._scrollbar === 'hidden') {
46
+ classNames.push('scrollbar-hide');
47
+
48
+ scrollStyles.scrollbarWidth = 'none';
49
+
50
+ scrollStyles['msOverflowStyle'] = 'none';
51
+ }
52
+
53
+ return React.createElement('div', {
54
+ className: classNames.join(' '),
55
+ style: scrollStyles,
56
+ ...this._props
57
+ }, ...this._children);
58
+ }
59
+ }
60
+
61
+
62
+ export const ScrollView = createBuilder(ScrollViewBuilder);
63
+
64
+ export interface ScrollViewProps extends BaseProps {
65
+ direction?: ScrollDirection;
66
+ scrollbar?: ScrollbarVisibility;
67
+ }