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,9 +0,0 @@
1
- export * from './Box';
2
- export * from './Card';
3
- export * from './List';
4
- export * from './Table';
5
- export * from './Tags';
6
- export * from './Banner';
7
- export * from './cards';
8
- export * from './Collapse';
9
- export * from './Grid';
@@ -1,3 +0,0 @@
1
- import { FiboTheme } from './types';
2
-
3
- export declare const cupertinoTheme: FiboTheme;
@@ -1,5 +0,0 @@
1
- export * from './types';
2
- export * from './material';
3
- export * from './cupertino';
4
- export * from './web';
5
- export * from './provider';
@@ -1,3 +0,0 @@
1
- import { FiboTheme } from './types';
2
-
3
- export declare const materialTheme: FiboTheme;
@@ -1,16 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { FiboTheme } from './types';
3
- import { FiboThemeName } from '../core/types';
4
-
5
- interface FiboThemeContextValue {
6
- theme: FiboTheme;
7
- themeName: FiboThemeName;
8
- setTheme: (name: FiboThemeName) => void;
9
- }
10
- interface FiboThemeProviderProps {
11
- theme?: FiboThemeName;
12
- children: ReactNode;
13
- }
14
- export declare function FiboThemeProvider({ theme: initialTheme, children }: FiboThemeProviderProps): import("react/jsx-runtime").JSX.Element;
15
- export declare function useFiboTheme(): FiboThemeContextValue;
16
- export {};
@@ -1,57 +0,0 @@
1
- import { FiboThemeName, TextStyle } from '../core/types';
2
-
3
- export interface ThemeColors {
4
- primary: string;
5
- primaryVariant?: string;
6
- secondary: string;
7
- secondaryVariant?: string;
8
- background: string;
9
- surface: string;
10
- error: string;
11
- success?: string;
12
- warning?: string;
13
- info?: string;
14
- onPrimary: string;
15
- onSecondary: string;
16
- onBackground: string;
17
- onSurface: string;
18
- onError: string;
19
- }
20
- export interface ThemeTypography {
21
- h1: TextStyle;
22
- h2: TextStyle;
23
- h3: TextStyle;
24
- h4: TextStyle;
25
- h5: TextStyle;
26
- h6: TextStyle;
27
- body: TextStyle;
28
- caption: TextStyle;
29
- label: TextStyle;
30
- }
31
- export interface ThemeSpacing {
32
- xs: string;
33
- sm: string;
34
- md: string;
35
- lg: string;
36
- xl: string;
37
- }
38
- export interface ThemeBorderRadius {
39
- sm: string;
40
- md: string;
41
- lg: string;
42
- full: string;
43
- }
44
- export interface ThemeShadows {
45
- sm: string;
46
- md: string;
47
- lg: string;
48
- }
49
- export interface FiboTheme {
50
- name: FiboThemeName;
51
- colors: ThemeColors;
52
- typography: ThemeTypography;
53
- spacing: ThemeSpacing;
54
- borderRadius: ThemeBorderRadius;
55
- shadows: ThemeShadows;
56
- fontFamily: string;
57
- }
@@ -1,3 +0,0 @@
1
- import { FiboTheme } from './types';
2
-
3
- export declare const webTheme: FiboTheme;
@@ -1,110 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { BaseProps, StatusType } from '../../core/types';
4
-
5
- import { Icons } from '../../core/icons';
6
-
7
- const AlertInner = React.memo((props: any) => {
8
- const { title, description, intent = 'info', className, style, ...rest } = props;
9
- const currentIntent = intent as StatusType;
10
-
11
-
12
- const intentStyles: Record<StatusType, string> = {
13
- info: 'bg-blue-500 text-white',
14
- success: 'bg-emerald-500 text-white',
15
- warning: 'bg-orange-400 text-white',
16
- error: 'bg-rose-500 text-white'
17
- };
18
-
19
-
20
- const iconBgStyles: Record<StatusType, string> = {
21
- info: 'bg-blue-600',
22
- success: 'bg-emerald-600',
23
- warning: 'bg-orange-500',
24
- error: 'bg-rose-600'
25
- };
26
-
27
- const iconMap: Record<StatusType, ReactElement> = {
28
- info: Icons.Info || React.createElement('span', {}, '?'),
29
- success: Icons.Check || React.createElement('span', {}, '✔'),
30
- warning: Icons.Search || React.createElement('span', {}, '!'),
31
- error: Icons.Close || React.createElement('span', {}, 'x')
32
- };
33
-
34
- const baseClass = `relative overflow-hidden flex items-start gap-4 p-5 rounded-3xl shadow-lg border-none ${intentStyles[currentIntent]}`;
35
-
36
- return React.createElement('div', {
37
- className: `${baseClass} ${className}`,
38
- style,
39
- ...rest
40
- }, [
41
-
42
- React.createElement('div', {
43
- key: 'blob1',
44
- className: 'absolute -top-6 -right-6 w-24 h-24 rounded-full bg-white opacity-10 pointer-events-none'
45
- }),
46
- React.createElement('div', {
47
- key: 'blob2',
48
- className: 'absolute bottom-[-10px] left-10 w-12 h-12 rounded-full bg-black opacity-5 pointer-events-none'
49
- }),
50
- React.createElement('div', {
51
- key: 'blob3',
52
- className: 'absolute top-10 right-20 w-8 h-8 rounded-full bg-white opacity-10 pointer-events-none'
53
- }),
54
-
55
-
56
- React.createElement('div', {
57
- key: 'icon-wrapper',
58
- className: `relative z-10 shrink-0 w-10 h-10 rounded-full flex items-center justify-center shadow-sm ${iconBgStyles[currentIntent]}`
59
- }, React.cloneElement(iconMap[currentIntent] as ReactElement, { width: 20, height: 20, strokeWidth: 3 })),
60
-
61
-
62
- React.createElement('div', { key: 'content', className: 'relative z-10 flex flex-col gap-1.5 pt-0.5' }, [
63
- title && React.createElement('h5', { key: 'title', className: 'font-bold text-lg leading-none tracking-tight' }, title),
64
- description && React.createElement('p', { key: 'desc', className: 'text-sm font-medium opacity-90 leading-relaxed' }, description)
65
- ])
66
- ]);
67
- });
68
-
69
- class AlertBuilder extends FiboBuilder {
70
- private _title: string = '';
71
- private _description?: string;
72
- private _intent: StatusType = 'info';
73
-
74
- title(value: string): this {
75
- this._title = value;
76
- return this;
77
- }
78
-
79
- description(value: string): this {
80
- this._description = value;
81
- return this;
82
- }
83
-
84
- intent(value: StatusType): this {
85
- this._intent = value;
86
- return this;
87
- }
88
-
89
- build(): ReactElement {
90
- const props = {
91
- title: this._title,
92
- description: this._description,
93
- intent: this._intent,
94
- className: this.getClassName(),
95
- style: this.getStyle(),
96
- ...this._props
97
- };
98
-
99
- return React.createElement(AlertInner, props);
100
- }
101
- }
102
-
103
-
104
- export const Alert = createBuilder(AlertBuilder);
105
-
106
- export interface AlertProps extends BaseProps {
107
- title: string;
108
- description?: string;
109
- intent?: StatusType;
110
- }
@@ -1,116 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { BaseProps } from '../../core/types';
4
- import { Box } from '../../structure/Box';
5
-
6
- type AvatarShape = 'circle' | 'rounded' | 'square';
7
- type AvatarStatus = 'none' | 'online' | 'offline' | 'busy';
8
-
9
- const AvatarInner = React.memo((props: any) => {
10
- const { image, size, border, shape, status, className, style } = props;
11
-
12
- const sizeValue = typeof size === 'number' ? `${size}px` : size;
13
-
14
- const borderRadiusMap: Record<AvatarShape, string> = {
15
- circle: '50%',
16
- rounded: '24%',
17
- square: '0'
18
- };
19
-
20
- const statusColors: Record<AvatarStatus, string> = {
21
- none: 'transparent',
22
- online: '#10B981',
23
- offline: '#9CA3AF',
24
- busy: '#EF4444'
25
- };
26
-
27
- return Box()
28
- .className(className)
29
- .style({
30
- position: 'relative',
31
- width: sizeValue,
32
- height: sizeValue,
33
- borderRadius: borderRadiusMap[shape as AvatarShape],
34
- backgroundImage: `url(${image})`,
35
- backgroundSize: 'cover',
36
- backgroundPosition: 'center',
37
- border: border,
38
- boxShadow: border !== 'none' ? '0 2px 8px rgba(0,0,0,0.05)' : 'none',
39
- ...style
40
- })
41
- .children(
42
- status !== 'none' ?
43
- Box().style({
44
- position: 'absolute',
45
- bottom: '-2%',
46
- right: '-2%',
47
- width: '28%',
48
- height: '28%',
49
- minWidth: '10px',
50
- minHeight: '10px',
51
- backgroundColor: statusColors[status as AvatarStatus],
52
- borderRadius: '50%',
53
- border: '3px solid #ffffff',
54
- boxSizing: 'content-box'
55
- }).build()
56
- : null
57
- )
58
- .build();
59
- });
60
-
61
- class AvatarBuilder extends FiboBuilder {
62
- private _image: string = '';
63
- private _size: string | number = 40;
64
- private _border: string = 'none';
65
- private _shape: AvatarShape = 'circle';
66
- private _status: AvatarStatus = 'none';
67
-
68
- image(url: string): this {
69
- this._image = url;
70
- return this;
71
- }
72
-
73
- size(value: string | number): this {
74
- this._size = value;
75
- return this;
76
- }
77
-
78
- border(value: string): this {
79
- this._border = value;
80
- return this;
81
- }
82
-
83
- shape(value: AvatarShape): this {
84
- this._shape = value;
85
- return this;
86
- }
87
-
88
- status(value: AvatarStatus): this {
89
- this._status = value;
90
- return this;
91
- }
92
-
93
- build(): ReactElement {
94
- const props = {
95
- image: this._image,
96
- size: this._size,
97
- border: this._border,
98
- shape: this._shape,
99
- status: this._status,
100
- className: this.getClassName(),
101
- style: this.getStyle()
102
- };
103
- return React.createElement(AvatarInner, props);
104
- }
105
- }
106
-
107
-
108
- export const Avatar = createBuilder(AvatarBuilder);
109
-
110
- export interface AvatarProps extends BaseProps {
111
- image: string;
112
- size?: string | number;
113
- border?: string;
114
- shape?: AvatarShape;
115
- status?: AvatarStatus;
116
- }
@@ -1,162 +0,0 @@
1
- import React, { ReactElement, ReactNode } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { BaseProps } from '../../core/types';
4
- import { Box } from '../../structure/Box';
5
- import { Text } from '../Text';
6
- import { Row } from '../../layout/Row';
7
-
8
-
9
- type BadgeVariant = 'neutral' | 'accent' | 'outline' | 'glass' | 'solid' | 'dot';
10
- type BadgeIntent = 'none' | 'success' | 'warning' | 'error' | 'info';
11
- type BadgeShape = 'pill' | 'rounded';
12
-
13
- const BadgeInner = React.memo((props: any) => {
14
- const { text, icon, variant, intent, shape, className, style } = props;
15
-
16
-
17
- const intentColors: Record<BadgeIntent, { bg: string, text: string, border?: string }> = {
18
- none: { bg: '#F9FAFB', text: '#6B7280', border: '#E5E7EB' },
19
- success: { bg: '#ECFDF5', text: '#059669', border: 'transparent' },
20
- warning: { bg: '#FFFBEB', text: '#D97706', border: 'transparent' },
21
- error: { bg: '#FFF1F2', text: '#E11D48', border: 'transparent' },
22
- info: { bg: '#EFF6FF', text: '#2563EB', border: 'transparent' }
23
- };
24
-
25
-
26
- const variantStyles: Record<BadgeVariant, any> = {
27
- neutral: { backgroundColor: '#F9FAFB', color: '#6B7280', border: '1px solid #E5E7EB' },
28
- accent: { backgroundColor: '#EFF6FF', color: '#3B82F6', border: 'none' },
29
- outline: { backgroundColor: 'transparent', color: '#FFFFFF', border: '1px solid rgba(255,255,255,0.3)' },
30
-
31
- glass: {
32
- backgroundColor: 'rgba(255, 255, 255, 0.85)',
33
- backdropFilter: 'blur(12px)',
34
- color: '#111827',
35
- border: '1px solid rgba(255, 255, 255, 0.4)'
36
- },
37
-
38
-
39
- solid: { backgroundColor: '#111827', color: '#FFFFFF', border: 'none' },
40
- dot: { backgroundColor: 'transparent', color: '#6B7280', border: '1px solid #E5E7EB', padding: '4px 10px' }
41
- };
42
-
43
- let finalStyle = { ...variantStyles[variant as BadgeVariant] };
44
-
45
-
46
- if (intent !== 'none') {
47
- const colors = intentColors[intent as BadgeIntent];
48
-
49
- if (variant === 'solid') {
50
-
51
- const solidIntentMap: Record<BadgeIntent, string> = {
52
- none: '#111827', success: '#059669', warning: '#D97706', error: '#E11D48', info: '#2563EB'
53
- };
54
- finalStyle.backgroundColor = solidIntentMap[intent as BadgeIntent];
55
- finalStyle.color = '#FFFFFF';
56
- } else if (variant === 'dot') {
57
- finalStyle.color = '#374151';
58
- finalStyle.borderColor = '#E5E7EB';
59
- } else {
60
-
61
- finalStyle.backgroundColor = colors.bg;
62
- finalStyle.color = colors.text;
63
- if (colors.border) finalStyle.border = `1px solid ${colors.border}`;
64
- else finalStyle.border = 'none';
65
- }
66
- }
67
-
68
- const shapeRadius: Record<BadgeShape, string> = {
69
- pill: '9999px',
70
- rounded: '8px'
71
- };
72
-
73
- return Box()
74
- .className(className)
75
- .style({
76
- ...finalStyle,
77
- borderRadius: shapeRadius[shape as BadgeShape],
78
- padding: variant === 'dot' ? '4px 8px' : '4px 10px',
79
- display: 'inline-flex',
80
- alignItems: 'center',
81
- justifyContent: 'center',
82
- height: 'fit-content',
83
- fontSize: '11px',
84
- lineHeight: '1',
85
- fontWeight: 600,
86
- ...style
87
- })
88
- .children(
89
- Row().gap(6).alignItems("center").children([
90
-
91
- variant === 'dot' && intent !== 'none' ?
92
- Box().style({
93
- width: '6px',
94
- height: '6px',
95
- borderRadius: '50%',
96
- backgroundColor: intentColors[intent as BadgeIntent].text,
97
- boxShadow: `0 0 6px ${intentColors[intent as BadgeIntent].text}66`
98
- }).build() : null,
99
-
100
- icon ? Box().classNames(['flex', 'items-center']).children(icon).build() : null,
101
- Text(text).fontSize(12).fontWeight(600).style({ color: 'inherit' }).build()
102
- ]).build()
103
- )
104
- .build();
105
- });
106
-
107
- class BadgeBuilder extends FiboBuilder {
108
- private _text: string = '';
109
- private _icon?: ReactNode;
110
- private _variant: BadgeVariant = 'neutral';
111
- private _intent: BadgeIntent = 'none';
112
- private _shape: BadgeShape = 'rounded';
113
-
114
- text(value: string): this {
115
- this._text = value;
116
- return this;
117
- }
118
-
119
- icon(icon: ReactNode): this {
120
- this._icon = icon;
121
- return this;
122
- }
123
-
124
- variant(variant: BadgeVariant): this {
125
- this._variant = variant;
126
- return this;
127
- }
128
-
129
- intent(intent: BadgeIntent): this {
130
- this._intent = intent;
131
- return this;
132
- }
133
-
134
- shape(shape: BadgeShape): this {
135
- this._shape = shape;
136
- return this;
137
- }
138
-
139
- build(): ReactElement {
140
- const props = {
141
- text: this._text,
142
- icon: this._icon,
143
- variant: this._variant,
144
- intent: this._intent,
145
- shape: this._shape,
146
- className: this.getClassName(),
147
- style: this.getStyle()
148
- };
149
- return React.createElement(BadgeInner, props);
150
- }
151
- }
152
-
153
-
154
- export const Badge = createBuilder(BadgeBuilder);
155
-
156
- export interface BadgeProps extends BaseProps {
157
- text: string;
158
- icon?: ReactNode;
159
- variant?: BadgeVariant;
160
- intent?: BadgeIntent;
161
- shape?: BadgeShape;
162
- }
@@ -1,137 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { BaseProps } from '../../core/types';
4
-
5
- type ImageFit = 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';
6
- type ClipShape = 'circle' | 'rounded' | 'square';
7
-
8
- const ImageInner = React.memo((props: any) => {
9
- const {
10
- src,
11
- alt,
12
- fit,
13
- resizable,
14
- clipShape,
15
- frameWidth,
16
- frameHeight,
17
- className,
18
- style,
19
- ...rest
20
- } = props;
21
-
22
- const finalStyle = { ...style };
23
-
24
- finalStyle.objectFit = fit;
25
-
26
- if (frameWidth) {
27
- finalStyle.width = `${frameWidth}px`;
28
- }
29
-
30
- if (frameHeight) {
31
- finalStyle.height = `${frameHeight}px`;
32
- }
33
-
34
- if (resizable) {
35
- finalStyle.maxWidth = '100%';
36
- finalStyle.height = 'auto';
37
- }
38
-
39
- return React.createElement('img', {
40
- src: src,
41
- alt: alt,
42
- className,
43
- style: finalStyle,
44
- ...rest,
45
- });
46
- });
47
-
48
- class ImageBuilder extends FiboBuilder {
49
- private _src: string = '';
50
- private _alt: string = '';
51
- private _fit: ImageFit = 'cover';
52
- private _resizable: boolean = false;
53
- private _clipShape?: ClipShape;
54
- private _frameWidth?: number;
55
- private _frameHeight?: number;
56
-
57
- constructor(src: string = '') {
58
- super();
59
- this._src = src;
60
- }
61
-
62
- src(value: string): this {
63
- this._src = value;
64
- return this;
65
- }
66
-
67
- alt(value: string): this {
68
- this._alt = value;
69
- return this;
70
- }
71
-
72
- resizable(): this {
73
- this._resizable = true;
74
- return this;
75
- }
76
-
77
- scaledToFit(): this {
78
- this._fit = 'contain';
79
- return this;
80
- }
81
-
82
- scaledToFill(): this {
83
- this._fit = 'cover';
84
- return this;
85
- }
86
-
87
- frame(dimensions: { width: number; height: number }): this {
88
- this._frameWidth = dimensions.width;
89
- this._frameHeight = dimensions.height;
90
- return this;
91
- }
92
-
93
- clipShape(shape: ClipShape): this {
94
- this._clipShape = shape;
95
- return this;
96
- }
97
-
98
- foregroundStyle(_style: string): this {
99
- return this;
100
- }
101
-
102
- build(): ReactElement {
103
- const classes = ['fibo-image', ...this._classNames];
104
-
105
- if (this._clipShape === 'circle') {
106
- classes.push('rounded-full');
107
- } else if (this._clipShape === 'rounded') {
108
- classes.push('rounded-lg');
109
- }
110
-
111
- const className = classes.filter(Boolean).join(' ');
112
-
113
- const props = {
114
- src: this._src,
115
- alt: this._alt,
116
- fit: this._fit,
117
- resizable: this._resizable,
118
- clipShape: this._clipShape,
119
- frameWidth: this._frameWidth,
120
- frameHeight: this._frameHeight,
121
- className: className,
122
- style: this.getStyle(),
123
- ...this._props
124
- };
125
-
126
- return React.createElement(ImageInner, props);
127
- }
128
- }
129
-
130
-
131
- export const Image = createBuilder(ImageBuilder);
132
-
133
- export interface ImageProps extends BaseProps {
134
- src: string;
135
- alt?: string;
136
- fit?: ImageFit;
137
- }
@@ -1,66 +0,0 @@
1
- import React, { ReactElement } from 'react';
2
- import { FiboBuilder, createBuilder } from '../../core/builder';
3
- import { BaseProps } from '../../core/types';
4
-
5
- const LabelInner = React.memo((props: any) => {
6
- const { text, htmlFor, required, className, style, ...rest } = props;
7
-
8
- return React.createElement(
9
- 'label',
10
- {
11
- className: `fibo-label text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 ${className}`,
12
- htmlFor: htmlFor,
13
- style: style,
14
- ...rest,
15
- },
16
- text,
17
- required && React.createElement('span', { className: 'text-red-500 ml-0.5' }, '*')
18
- );
19
- });
20
-
21
- class LabelBuilder extends FiboBuilder {
22
- private _text: string = '';
23
- private _htmlFor?: string;
24
- private _required: boolean = false;
25
-
26
- constructor(text: string = '') {
27
- super();
28
- this._text = text;
29
- }
30
-
31
- text(value: string): this {
32
- this._text = value;
33
- return this;
34
- }
35
-
36
- htmlFor(id: string): this {
37
- this._htmlFor = id;
38
- return this;
39
- }
40
-
41
- required(val: boolean = true): this {
42
- this._required = val;
43
- return this;
44
- }
45
-
46
- build(): ReactElement {
47
- const props = {
48
- text: this._text,
49
- htmlFor: this._htmlFor,
50
- required: this._required,
51
- className: this.getClassName(),
52
- style: this.getStyle(),
53
- ...this._props
54
- };
55
- return React.createElement(LabelInner, props);
56
- }
57
- }
58
-
59
-
60
- export const Label = createBuilder(LabelBuilder);
61
-
62
- export interface LabelProps extends BaseProps {
63
- text: string;
64
- htmlFor?: string;
65
- required?: boolean;
66
- }