fiboui 1.0.1 → 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 -53
  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 -297
  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,129 +0,0 @@
1
- import React, { ReactElement, ChangeEvent } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { BaseProps } from '../../core/types';
4
-
5
-
6
- const TextareaInner = React.memo((props: any) => {
7
- const uniqueId = React.useId();
8
- const inputId = props.id || uniqueId;
9
-
10
- const {
11
- containerClass,
12
- containerStyle,
13
- label,
14
- error,
15
- ...inputRest
16
- } = props;
17
-
18
-
19
-
20
-
21
- return React.createElement(
22
- 'div',
23
- { className: containerClass, style: containerStyle },
24
- React.createElement('textarea', {
25
- id: inputId,
26
- className: 'fibo-textarea-input',
27
- ...inputRest
28
- }),
29
- label && React.createElement(
30
- 'label',
31
- {
32
- htmlFor: inputId,
33
- className: 'fibo-textarea-label'
34
- },
35
- label
36
- ),
37
- error && React.createElement(
38
- 'span',
39
- { className: 'text-[var(--fibo-error)] text-xs mt-1 ml-1' },
40
- error
41
- )
42
- );
43
- });
44
-
45
- class TextareaBuilder extends FiboBuilder {
46
- private _value: string = '';
47
- private _label: string = '';
48
- private _placeholder: string = '';
49
- private _disabled: boolean = false;
50
- private _rows: number = 4;
51
- private _error?: string;
52
- private _resize: 'none' | 'vertical' | 'horizontal' | 'both' = 'vertical';
53
- private _onChange?: (value: string) => void;
54
-
55
- value(val: string): this {
56
- this._value = val;
57
- return this;
58
- }
59
-
60
- label(val: string): this {
61
- this._label = val;
62
- return this;
63
- }
64
-
65
- placeholder(val: string): this {
66
- this._placeholder = val;
67
- return this;
68
- }
69
-
70
- disabled(val: boolean = true): this {
71
- this._disabled = val;
72
- return this;
73
- }
74
-
75
- rows(val: number): this {
76
- this._rows = val;
77
- return this;
78
- }
79
-
80
- resize(val: 'none' | 'vertical' | 'horizontal' | 'both'): this {
81
- this._resize = val;
82
- return this;
83
- }
84
-
85
- error(val: string): this {
86
- this._error = val;
87
- return this;
88
- }
89
-
90
- onChange(handler: (value: string) => void): this {
91
- this._onChange = handler;
92
- return this;
93
- }
94
-
95
- build(): ReactElement {
96
- const containerClass = ['fibo-textarea-container', ...this._classNames]
97
- .filter(Boolean)
98
- .join(' ');
99
-
100
- const props = {
101
- containerClass,
102
- containerStyle: { width: '100%', ...this.getStyle() },
103
- label: this._label,
104
- error: this._error,
105
- rows: this._rows,
106
- value: this._value,
107
- placeholder: this._placeholder || ' ',
108
- disabled: this._disabled,
109
- style: { resize: this._resize },
110
- onChange: (e: ChangeEvent<HTMLTextAreaElement>) => {
111
- this._onChange?.(e.target.value);
112
- },
113
- ...this._props
114
- };
115
-
116
- return React.createElement(TextareaInner, props);
117
- }
118
- }
119
-
120
-
121
- export const Textarea = createBuilder(TextareaBuilder);
122
-
123
- export interface TextareaProps extends BaseProps {
124
- value: string;
125
- label?: string;
126
- placeholder?: string;
127
- onChange?: (value: string) => void;
128
- rows?: number;
129
- }
@@ -1,8 +0,0 @@
1
- export * from './Button';
2
- export * from './TextField';
3
- export * from './Switch';
4
- export * from './Checkbox';
5
- export * from './RadioGroup';
6
- export * from './Textarea';
7
- export * from './Select';
8
- export * from './Combobox';
@@ -1,34 +0,0 @@
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 {}
@@ -1,101 +0,0 @@
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
- }
@@ -1,28 +0,0 @@
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
- }
@@ -1,106 +0,0 @@
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);
@@ -1,50 +0,0 @@
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);
@@ -1,41 +0,0 @@
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
- }
@@ -1,93 +0,0 @@
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
- }