fiboui 1.0.2 → 2.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 (169) hide show
  1. package/README.md +138 -92
  2. package/dist/FineGrain-kBxv0WeR.js +29 -0
  3. package/dist/Link-DDzSPY1Q.js +88 -0
  4. package/dist/PluginManager-D5-ApsSN.js +111 -0
  5. package/dist/Router-i6Nc6qVs.js +386 -0
  6. package/dist/builder-DjLYXkXu.js +1842 -0
  7. package/dist/bundle-mjs-wppB-TKB.js +2760 -0
  8. package/dist/cli/bin.js +20 -0
  9. package/dist/cli/commands/generate/component.js +67 -0
  10. package/dist/cli/commands/generate/index.js +10 -0
  11. package/dist/cli/commands/generate/module.js +58 -0
  12. package/dist/cli/commands/generate/plugin.js +67 -0
  13. package/dist/cli/commands/init.js +58 -0
  14. package/dist/content.js +17 -0
  15. package/dist/core.js +33 -0
  16. package/dist/{effects-D16XdB_d.mjs → effects-CnevV566.js} +1 -0
  17. package/dist/index-B1av7e36.js +1102 -0
  18. package/dist/index-BQGRpkzR.js +1024 -0
  19. package/dist/index-CTRZRn9S.js +90 -0
  20. package/dist/index-DKFr-sai.js +33 -0
  21. package/dist/index-Dm4j2mMM.js +1031 -0
  22. package/dist/index-RbfIZuAo.js +119 -0
  23. package/dist/index-yeYkDTAx.js +778 -0
  24. package/dist/index.d.ts +43753 -6
  25. package/dist/index.js +2054 -0
  26. package/dist/interactive.js +12 -0
  27. package/dist/layout.js +18 -0
  28. package/dist/mount-sAVX_FBU.js +95 -0
  29. package/dist/navigation.js +13 -0
  30. package/dist/provider-B0eB-Wy7.js +286 -0
  31. package/dist/structure.js +15 -0
  32. package/dist/style.css +1 -1
  33. package/dist/style.js +1 -0
  34. package/dist/theme.js +9 -0
  35. package/package.json +88 -13
  36. package/dist/content/Alert/index.d.ts +0 -878
  37. package/dist/content/Avatar/index.d.ts +0 -886
  38. package/dist/content/Badge/index.d.ts +0 -887
  39. package/dist/content/Image/index.d.ts +0 -893
  40. package/dist/content/Label/index.d.ts +0 -879
  41. package/dist/content/Progress/index.d.ts +0 -898
  42. package/dist/content/Skeleton/index.d.ts +0 -879
  43. package/dist/content/Spinner/index.d.ts +0 -880
  44. package/dist/content/Text/index.d.ts +0 -878
  45. package/dist/content/index.d.ts +0 -9
  46. package/dist/core/StateWrapper.d.ts +0 -31
  47. package/dist/core/builder.d.ts +0 -58
  48. package/dist/core/component.d.ts +0 -7
  49. package/dist/core/effects.d.ts +0 -4
  50. package/dist/core/hooks.d.ts +0 -5
  51. package/dist/core/icons.d.ts +0 -11
  52. package/dist/core/index.d.ts +0 -6
  53. package/dist/core/state.d.ts +0 -86
  54. package/dist/core/types.d.ts +0 -51
  55. package/dist/demo.d.ts +0 -7
  56. package/dist/index.esm.js +0 -4777
  57. package/dist/index.umd.js +0 -251
  58. package/dist/interactive/Button/index.d.ts +0 -897
  59. package/dist/interactive/Checkbox/index.d.ts +0 -884
  60. package/dist/interactive/Combobox/index.d.ts +0 -898
  61. package/dist/interactive/RadioGroup/index.d.ts +0 -888
  62. package/dist/interactive/Select/index.d.ts +0 -895
  63. package/dist/interactive/Switch/index.d.ts +0 -881
  64. package/dist/interactive/TextField/index.d.ts +0 -893
  65. package/dist/interactive/Textarea/index.d.ts +0 -890
  66. package/dist/interactive/index.d.ts +0 -8
  67. package/dist/layout/Center/index.d.ts +0 -869
  68. package/dist/layout/Column/index.d.ts +0 -881
  69. package/dist/layout/Container/index.d.ts +0 -870
  70. package/dist/layout/DashboardLayout/index.d.ts +0 -870
  71. package/dist/layout/Header/index.d.ts +0 -870
  72. package/dist/layout/Line/index.d.ts +0 -872
  73. package/dist/layout/Row/index.d.ts +0 -879
  74. package/dist/layout/Scaffold/index.d.ts +0 -878
  75. package/dist/layout/ScrollView/index.d.ts +0 -879
  76. package/dist/layout/Sidebar/index.d.ts +0 -870
  77. package/dist/layout/Spacer/index.d.ts +0 -875
  78. package/dist/layout/StakentComponents.d.ts +0 -4
  79. package/dist/layout/index.d.ts +0 -11
  80. package/dist/structure/Banner/index.d.ts +0 -879
  81. package/dist/structure/Box/index.d.ts +0 -869
  82. package/dist/structure/Card/index.d.ts +0 -881
  83. package/dist/structure/Collapse/index.d.ts +0 -884
  84. package/dist/structure/Grid/index.d.ts +0 -1757
  85. package/dist/structure/List/index.d.ts +0 -888
  86. package/dist/structure/Table/index.d.ts +0 -895
  87. package/dist/structure/Tags/index.d.ts +0 -876
  88. package/dist/structure/cards/AssetCard/index.d.ts +0 -884
  89. package/dist/structure/cards/CollectionCard/index.d.ts +0 -880
  90. package/dist/structure/cards/ContentCard/index.d.ts +0 -884
  91. package/dist/structure/cards/ProfileCard/index.d.ts +0 -892
  92. package/dist/structure/cards/index.d.ts +0 -5
  93. package/dist/structure/cards/variants/index.d.ts +0 -3490
  94. package/dist/structure/index.d.ts +0 -9
  95. package/dist/theme/cupertino.d.ts +0 -3
  96. package/dist/theme/index.d.ts +0 -5
  97. package/dist/theme/material.d.ts +0 -3
  98. package/dist/theme/provider.d.ts +0 -16
  99. package/dist/theme/types.d.ts +0 -57
  100. package/dist/theme/web.d.ts +0 -3
  101. package/src/content/Alert/index.ts +0 -110
  102. package/src/content/Avatar/index.ts +0 -116
  103. package/src/content/Badge/index.ts +0 -162
  104. package/src/content/Image/index.ts +0 -137
  105. package/src/content/Label/index.ts +0 -66
  106. package/src/content/Progress/index.ts +0 -378
  107. package/src/content/Skeleton/index.ts +0 -71
  108. package/src/content/Spinner/index.ts +0 -139
  109. package/src/content/Text/index.ts +0 -74
  110. package/src/content/index.ts +0 -9
  111. package/src/core/StateWrapper.tsx +0 -131
  112. package/src/core/builder.ts +0 -301
  113. package/src/core/component.ts +0 -49
  114. package/src/core/effects.ts +0 -27
  115. package/src/core/hooks.ts +0 -48
  116. package/src/core/icons.tsx +0 -57
  117. package/src/core/index.ts +0 -6
  118. package/src/core/state.ts +0 -297
  119. package/src/core/types.ts +0 -62
  120. package/src/demo.tsx +0 -1050
  121. package/src/index.ts +0 -8
  122. package/src/interactive/Button/index.ts +0 -219
  123. package/src/interactive/Checkbox/index.ts +0 -145
  124. package/src/interactive/Combobox/index.ts +0 -278
  125. package/src/interactive/RadioGroup/index.ts +0 -124
  126. package/src/interactive/Select/index.ts +0 -227
  127. package/src/interactive/Switch/index.ts +0 -123
  128. package/src/interactive/TextField/index.ts +0 -223
  129. package/src/interactive/Textarea/index.ts +0 -129
  130. package/src/interactive/index.ts +0 -8
  131. package/src/layout/Center/index.ts +0 -34
  132. package/src/layout/Column/index.ts +0 -101
  133. package/src/layout/Container/index.ts +0 -28
  134. package/src/layout/DashboardLayout/index.ts +0 -106
  135. package/src/layout/Header/index.ts +0 -50
  136. package/src/layout/Line/index.ts +0 -41
  137. package/src/layout/Row/index.ts +0 -93
  138. package/src/layout/Scaffold/index.ts +0 -133
  139. package/src/layout/ScrollView/index.ts +0 -67
  140. package/src/layout/Sidebar/index.ts +0 -56
  141. package/src/layout/Spacer/index.ts +0 -46
  142. package/src/layout/StakentComponents.tsx +0 -57
  143. package/src/layout/index.ts +0 -11
  144. package/src/structure/Banner/index.ts +0 -92
  145. package/src/structure/Box/index.ts +0 -46
  146. package/src/structure/Card/index.ts +0 -113
  147. package/src/structure/Collapse/index.ts +0 -122
  148. package/src/structure/Grid/index.ts +0 -197
  149. package/src/structure/List/index.ts +0 -185
  150. package/src/structure/Table/index.ts +0 -165
  151. package/src/structure/Tags/index.ts +0 -69
  152. package/src/structure/cards/AssetCard/index.ts +0 -158
  153. package/src/structure/cards/CollectionCard/index.ts +0 -95
  154. package/src/structure/cards/ContentCard/index.ts +0 -127
  155. package/src/structure/cards/ProfileCard/index.ts +0 -152
  156. package/src/structure/cards/index.ts +0 -5
  157. package/src/structure/cards/variants/index.ts +0 -301
  158. package/src/structure/index.ts +0 -10
  159. package/src/styles/base.css +0 -186
  160. package/src/styles/core.css +0 -52
  161. package/src/styles/themes/cupertino.css +0 -197
  162. package/src/styles/themes/material.css +0 -322
  163. package/src/styles/themes/web.css +0 -196
  164. package/src/theme/cupertino.ts +0 -85
  165. package/src/theme/index.ts +0 -5
  166. package/src/theme/material.ts +0 -86
  167. package/src/theme/provider.tsx +0 -76
  168. package/src/theme/types.ts +0 -62
  169. package/src/theme/web.ts +0 -82
@@ -1,133 +0,0 @@
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
- }
@@ -1,67 +0,0 @@
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
- }
@@ -1,56 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
-
4
-
5
-
6
-
7
-
8
- const SidebarInner = React.memo((props: any) => {
9
- const { width = 260, collapsed, className, style, children, ...rest } = props;
10
-
11
-
12
- const currentWidth = collapsed ? 80 : width;
13
-
14
- return React.createElement(
15
- 'aside',
16
- {
17
- className: `flex flex-col border-r border-gray-200 bg-white transition-all duration-300 h-full ${className || ''}`,
18
- style: { width: currentWidth, minWidth: currentWidth, ...style },
19
- ...rest
20
- },
21
- children
22
- );
23
- });
24
-
25
- class SidebarBuilder extends FiboBuilder {
26
- private _width: number | string = 260;
27
- private _collapsed: boolean = false;
28
-
29
- width(width: number | string): this {
30
- this._width = width;
31
- return this;
32
- }
33
-
34
- collapsible(collapsed: boolean = false): this {
35
- this._collapsed = collapsed;
36
- return this;
37
- }
38
-
39
- build(): ReactElement {
40
- const props = {
41
- width: this._width,
42
- collapsed: this._collapsed,
43
- className: this.getClassName(),
44
- style: this.getStyle(),
45
- children: this.processChildren(),
46
- ...this._props
47
- };
48
- return React.createElement(SidebarInner, props);
49
- }
50
- }
51
-
52
-
53
- export const Sidebar = createBuilder(SidebarBuilder);
54
-
55
-
56
-
@@ -1,46 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { BaseProps } from '../../core/types';
4
-
5
- class SpacerBuilder extends FiboBuilder {
6
- private _height?: string | number;
7
- private _width?: string | number;
8
-
9
- height(value: string | number): this {
10
- this._height = value;
11
- return this;
12
- }
13
-
14
- width(value: string | number): this {
15
- this._width = value;
16
- return this;
17
- }
18
-
19
- build(): ReactElement {
20
- const style = this.getStyle();
21
-
22
- if (this._height) {
23
- style.height = typeof this._height === 'number' ? `${this._height}px` : this._height;
24
- }
25
-
26
- if (this._width) {
27
- style.width = typeof this._width === 'number' ? `${this._width}px` : this._width;
28
- }
29
-
30
- const className = this.getClassName();
31
-
32
- return React.createElement('div', {
33
- className: `fibo-spacer ${className}`,
34
- style,
35
- ...this._props,
36
- });
37
- }
38
- }
39
-
40
-
41
- export const Spacer = createBuilder(SpacerBuilder);
42
-
43
- export interface SpacerProps extends BaseProps {
44
- height?: string | number;
45
- width?: string | number;
46
- }
@@ -1,57 +0,0 @@
1
- import { Box } from '../structure/Box';
2
- import { Button } from '../interactive/Button';
3
-
4
- export const StakentCard = ({ className = "", style = {} }: any): any => {
5
- return Box()
6
- .className(`bg-[#0B0C15] border border-white/5 rounded-[32px] overflow-hidden relative ${className}`)
7
- .style({ backgroundColor: '#0B0C15', ...style });
8
- };
9
-
10
- export const StakentButton = ({ text, icon, variant = 'primary', className = "", onClick }: any): React.ReactElement => {
11
- let baseClass = "rounded-xl font-bold transition-all duration-200 flex items-center justify-center gap-2";
12
-
13
- if (variant === 'primary') {
14
- baseClass += " bg-[#6366f1] text-white shadow-[0_0_20px_rgba(99,102,241,0.4)] hover:shadow-[0_0_25px_rgba(99,102,241,0.6)] hover:-translate-y-0.5";
15
- } else if (variant === 'secondary') {
16
- baseClass += " bg-white/5 border border-white/10 text-white hover:bg-white/10";
17
- } else if (variant === 'outline') {
18
- baseClass += " border border-white/10 text-gray-400 hover:text-white hover:border-white/20";
19
- } else if (variant === 'ghost') {
20
- baseClass += " text-gray-400 hover:text-white hover:bg-white/5";
21
- } else if (variant === 'gradient') {
22
- baseClass += " bg-gradient-to-r from-[#818CF8] to-[#6366f1] text-white shadow-lg shadow-indigo-500/30 border-none";
23
- }
24
-
25
- return Button(text)
26
- .icon(icon)
27
- .className(`${baseClass} ${className}`)
28
- .onPress(onClick)
29
- .variant("text")
30
- .build();
31
- };
32
-
33
- export const StakentSidebarItem = ({ label, icon, active = false }: any): React.ReactElement => {
34
- if (active) {
35
- return Button(label)
36
- .icon(icon ? Box().className(`${icon} w-5 h-5 text-white`).build() : null)
37
- .className("w-full justify-start text-sm font-bold text-white bg-[#6366f1] shadow-[0_4px_20px_rgba(99,102,241,0.4)] rounded-xl mb-1 py-3 px-4")
38
- .build();
39
- }
40
- return Button(label)
41
- .icon(icon ? Box().className(`${icon} w-5 h-5 text-gray-400 group-hover:text-white transition-colors`).build() : null)
42
- .variant("ghost")
43
- .className("w-full justify-start text-sm font-medium text-gray-400 hover:text-white hover:bg-white/5 rounded-xl group py-3 px-4")
44
- .build();
45
- };
46
-
47
- export const StakentBadge = ({ text, type = 'default' }: any): React.ReactElement => {
48
- let style = "text-[10px] px-2 py-0.5 rounded border font-bold uppercase tracking-wider";
49
- if (type === 'hot') {
50
- style = "bg-[#FF3B30] text-white border-none text-[9px] px-1.5 py-0.5 rounded-md shadow-lg shadow-red-500/20";
51
- } else if (type === 'beta') {
52
- style = "bg-[#6366f1]/10 text-[#818CF8] border-[#6366f1]/20";
53
- } else if (type === 'new') {
54
- style = "bg-white text-black border-none";
55
- }
56
- return Box().className(style).children(text).build();
57
- }
@@ -1,11 +0,0 @@
1
- export * from './Container';
2
- export * from './Row';
3
- export * from './Column';
4
- export * from './Spacer';
5
- export * from './Line';
6
- export * from './Center';
7
- export * from './ScrollView';
8
- export * from './Header';
9
- export * from './Sidebar';
10
- export * from './DashboardLayout';
11
- export * from './Scaffold';
@@ -1,92 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { BaseProps, StatusType } from '../../core/types';
4
-
5
- const BannerInner = React.memo((props: any) => {
6
- const { status, title, subtitle, className, style, ...rest } = props;
7
-
8
- return React.createElement(
9
- 'div',
10
- {
11
- className,
12
- style,
13
- ...rest,
14
- },
15
- React.createElement(
16
- 'div',
17
- { className: 'flex flex-col gap-1' },
18
- title &&
19
- React.createElement(
20
- 'h4',
21
- {
22
- className: 'font-semibold text-sm uppercase tracking-wide opacity-90',
23
- },
24
- title
25
- ),
26
- subtitle &&
27
- React.createElement(
28
- 'p',
29
- {
30
- className: 'opacity-80 text-sm',
31
- },
32
- subtitle
33
- )
34
- )
35
- );
36
- });
37
-
38
- class BannerBuilder extends FiboBuilder {
39
- private _status: StatusType = 'info';
40
- private _title: string = '';
41
- private _subtitle?: string;
42
-
43
- constructor(title: string = '') {
44
- super();
45
- this._title = title;
46
- }
47
-
48
- status(value: StatusType): this {
49
- this._status = value;
50
- return this;
51
- }
52
-
53
- title(value: string): this {
54
- this._title = value;
55
- return this;
56
- }
57
-
58
- subtitle(value: string): this {
59
- this._subtitle = value;
60
- return this;
61
- }
62
-
63
- build(): ReactElement {
64
- const classes = [
65
- 'fibo-banner',
66
- `fibo-banner-${this._status}`,
67
- ...this._classNames,
68
- ];
69
-
70
- const className = classes.filter(Boolean).join(' ');
71
-
72
- const props = {
73
- status: this._status,
74
- title: this._title,
75
- subtitle: this._subtitle,
76
- className: className,
77
- style: this.getStyle(),
78
- ...this._props
79
- };
80
-
81
- return React.createElement(BannerInner, props);
82
- }
83
- }
84
-
85
-
86
- export const Banner = createBuilder(BannerBuilder);
87
-
88
- export interface BannerProps extends BaseProps {
89
- status: StatusType;
90
- title: string;
91
- subtitle?: string;
92
- }
@@ -1,46 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { ChildrenProps } from '../../core/types';
4
-
5
- const BoxInner = React.memo((props: any) => {
6
- const { className, style, children, ...rest } = props;
7
- return React.createElement(
8
- 'div',
9
- {
10
- className,
11
- style,
12
- ...rest,
13
- },
14
- ...children
15
- );
16
- });
17
-
18
- class BoxBuilder extends FiboBuilder {
19
-
20
- build(): ReactElement {
21
- const classes = [
22
- 'fibo-box',
23
- ...this._classNames,
24
- ];
25
-
26
- const className = classes.filter(Boolean).join(' ');
27
- const style = this.getStyle();
28
-
29
- // Universal builder handles observer logic now.
30
- // processChildren handles function execution if present.
31
- const children = this.processChildren();
32
-
33
- const props = {
34
- className,
35
- style: style,
36
- children: children,
37
- ...this._props
38
- };
39
-
40
- return React.createElement(BoxInner, props);
41
- }
42
- }
43
-
44
- export const Box = createBuilder(BoxBuilder);
45
-
46
- export interface BoxProps extends ChildrenProps {}
@@ -1,113 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { BaseProps } from '../../core/types';
4
-
5
- const CardInner = React.memo((props: any) => {
6
- const { text, subtitle, number, color, className, style, children, ...rest } = props;
7
-
8
- return React.createElement(
9
- 'div',
10
- {
11
- className: `rounded-[24px] shadow-[0_8px_30px_rgb(0,0,0,0.04)] hover:shadow-[0_8px_30px_rgb(0,0,0,0.08)] transition-shadow duration-300 border-none p-4 ${className || ''}`,
12
- style: { backgroundColor: '#ffffff', ...style },
13
- ...rest,
14
- },
15
- React.createElement(
16
- 'div',
17
- { className: 'flex flex-col gap-2' },
18
- text &&
19
- React.createElement(
20
- 'h3',
21
- {
22
- className: 'font-semibold text-[var(--fibo-on-surface-variant)] text-sm uppercase tracking-wide',
23
- },
24
- text
25
- ),
26
- number &&
27
- React.createElement(
28
- 'p',
29
- {
30
- className: 'font-bold text-[var(--fibo-on-surface)] text-3xl',
31
- },
32
- number
33
- ),
34
- subtitle &&
35
- React.createElement(
36
- 'p',
37
- {
38
- className: 'text-[var(--fibo-on-surface-variant)] text-xs',
39
- },
40
- subtitle
41
- ),
42
- ...children
43
- )
44
- );
45
- });
46
-
47
- class CardBuilder extends FiboBuilder {
48
- private _text: string = '';
49
- private _subtitle?: string;
50
- private _number?: string;
51
- private _color?: string;
52
-
53
- text(value: string): this {
54
- this._text = value;
55
- return this;
56
- }
57
-
58
- subtitle(value: string): this {
59
- this._subtitle = value;
60
- return this;
61
- }
62
-
63
- number(value: string): this {
64
- this._number = value;
65
- return this;
66
- }
67
-
68
- color(value: string): this {
69
- this._color = value;
70
- return this;
71
- }
72
-
73
- build(): ReactElement {
74
- const colorClasses: Record<string, string> = {
75
- green: 'border-l-green-500',
76
- orange: 'border-l-orange-500',
77
- red: 'border-l-red-500',
78
- blue: 'border-l-blue-500',
79
- purple: 'border-l-purple-500',
80
- };
81
-
82
- const className = [
83
- 'fibo-card',
84
- this._color ? `border-l-4 ${colorClasses[this._color]}` : '',
85
- ...this._classNames,
86
- ]
87
- .filter(Boolean)
88
- .join(' ');
89
-
90
- const props = {
91
- text: this._text,
92
- subtitle: this._subtitle,
93
- number: this._number,
94
- color: this._color,
95
- className: className,
96
- style: this.getStyle(),
97
- children: this.processChildren(),
98
- ...this._props
99
- };
100
-
101
- return React.createElement(CardInner, props);
102
- }
103
- }
104
-
105
-
106
- export const Card = createBuilder(CardBuilder);
107
-
108
- export interface CardProps extends BaseProps {
109
- text: string;
110
- subtitle?: string;
111
- number?: string;
112
- color?: string;
113
- }