sangam-ui 0.1.9 → 0.1.11

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.
package/README.md CHANGED
@@ -127,6 +127,41 @@ module.exports = {
127
127
 
128
128
  Spreading `...sangamTailwind` gives you the Sangam theme (colors, spacing, radii, shadows), `darkMode` setting, and any plugins — without having to duplicate them.
129
129
 
130
+ #### Base44: using `.js` config files
131
+
132
+ If your project (e.g. **Base44**) expects `postcss.config.js` and `tailwind.config.js` instead of `.cjs`, use the same content with the `.js` extension:
133
+
134
+ **postcss.config.js**
135
+
136
+ ```js
137
+ // postcss.config.js
138
+ export default {
139
+ plugins: {
140
+ "postcss-import": {}, // MUST be first: inlines @import before Tailwind sees the file
141
+ tailwindcss: {},
142
+ autoprefixer: {},
143
+ },
144
+ };
145
+ ```
146
+
147
+ **tailwind.config.js**
148
+
149
+ ```js
150
+ // tailwind.config.js
151
+ import sangamTailwind from "@esds-sangam/tailwind-config";
152
+
153
+ /** @type {import('tailwindcss').Config} */
154
+ export default {
155
+ ...sangamTailwind,
156
+ content: [
157
+ ...sangamTailwind.content,
158
+ "./index.html",
159
+ "./src/**/*.{ts,tsx}",
160
+ "./node_modules/sangam-ui/dist/**/*.{js,mjs}",
161
+ ],
162
+ };
163
+ ```
164
+
130
165
  ### 5.3 Wire styles — single CSS entry file
131
166
 
132
167
  > [!IMPORTANT]
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
8
8
  import * as SelectPrimitive from '@radix-ui/react-select';
9
9
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
10
10
  import * as TabsPrimitive from '@radix-ui/react-tabs';
11
+ import * as react_jsx_runtime from 'react/jsx-runtime';
11
12
 
12
13
  /**
13
14
  * Sangam Button Component
@@ -22,7 +23,7 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
22
23
  * CVA (Class Variance Authority) manages all variants
23
24
  */
24
25
  declare const buttonVariants: (props?: ({
25
- variant?: "link" | "primary" | "secondary" | "danger" | null | undefined;
26
+ variant?: "primary" | "link" | "secondary" | "danger" | null | undefined;
26
27
  size?: "big" | "small" | null | undefined;
27
28
  iconOnly?: boolean | null | undefined;
28
29
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
@@ -72,7 +73,7 @@ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAtt
72
73
  * Sangam Toggle (Switch) Component
73
74
  *
74
75
  * Production-grade toggle following Figma design specs:
75
- * - Colors: Neutral palette from colors.json
76
+ * - Colors: semantic-colors (background, border, text) where available
76
77
  * - Sizes: Big (56×28px), Small (44×24px)
77
78
  * - States: Default, Hover, Disabled
78
79
  * - Smooth transitions: 200ms ease-out
@@ -144,7 +145,7 @@ declare const Toggle: React.ForwardRefExoticComponent<ToggleProps & React.RefAtt
144
145
  * Sangam Checkbox Component
145
146
  *
146
147
  * Production-grade checkbox following Figma design specs:
147
- * - Colors: Neutral palette from colors.json
148
+ * - Colors: semantic-colors (border, background, text) where available
148
149
  * - Sizes: Big (24×24px), Small (20×20px)
149
150
  * - States: Default, Hover, Disabled
150
151
  * - Smooth transitions: 200ms ease-out
@@ -218,7 +219,7 @@ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.Re
218
219
  * Sangam Radio Component
219
220
  *
220
221
  * Production-grade radio button following Figma design specs:
221
- * - Colors: Neutral palette from colors.json
222
+ * - Colors: semantic-colors (background, border, text) where available
222
223
  * - Sizes: Big (24×24px), Small (20×20px)
223
224
  * - States: Default, Hover, Disabled
224
225
  * - Smooth transitions: 200ms ease-out
@@ -322,7 +323,7 @@ declare const Radio: React.ForwardRefExoticComponent<RadioProps & React.RefAttri
322
323
  * Sangam Input Component
323
324
  *
324
325
  * Production-grade text input following Figma design specs:
325
- * - Colors: Neutral, Red, Green from colors.json
326
+ * - Colors: semantic-colors (background, border, text) where available
326
327
  * - Multiple states: Default, Hover, Active, Typing, Filled, Error, Success, Disabled
327
328
  * - Consistent padding: 4px 12px
328
329
  * - Smooth transitions: 200ms ease-out
@@ -536,7 +537,7 @@ declare const DropdownMulti: React.ForwardRefExoticComponent<DropdownMultiProps
536
537
  *
537
538
  * Production-grade search input following Figma design specs:
538
539
  * - Width: Fixed 400px
539
- * - Colors: Neutral palette from colors.json
540
+ * - Colors: semantic-colors (background, border, text) where available
540
541
  * - Multiple states: Default, Hover, Active, Typing, Filled, Disabled
541
542
  * - Border radius: 8px
542
543
  * - Padding: 4px 12px
@@ -571,9 +572,9 @@ declare const SearchField: React.ForwardRefExoticComponent<SearchFieldProps & Re
571
572
  * Sangam Textarea Component
572
573
  *
573
574
  * Production-grade textarea following Figma design specs:
574
- * - Width: Fixed 450px
575
+ * - Width: 100% with min-width 450px (responsive, matches Input pattern)
575
576
  * - Height: Fixed 96px
576
- * - Colors: Neutral, Red, Green from colors.json
577
+ * - Colors: semantic-colors (background, border, text) where available
577
578
  * - Multiple states: Default, Hover, Active, Typing, Filled, Error, Success, Disabled
578
579
  * - Padding: 4px 12px
579
580
  * - Border radius: 8px (sm)
@@ -705,7 +706,7 @@ declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.Re
705
706
  * Sangam Tooltip Component
706
707
  *
707
708
  * Production-grade tooltip following Figma design specs:
708
- * - Colors: Background #111111, Text #FFFFFF
709
+ * - Colors: semantic-colors (background neutralInverse primary, text neutralInverse primary)
709
710
  * - Fixed width: 7.5rem (120px at default)
710
711
  * - Fixed height: 2rem (32px at default), 3.25rem (52px with description)
711
712
  * - Border radius: 4px
@@ -791,10 +792,10 @@ interface ProgressBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "c
791
792
  */
792
793
  max?: number;
793
794
  /**
794
- * Show percentage label: "left" | "right" | "both" | "none".
795
- * @default "both"
795
+ * When true, shows the percentage label on the right of the bar. When false, bar only (no label).
796
+ * @default true
796
797
  */
797
- showLabel?: "left" | "right" | "both" | "none";
798
+ showLabel?: boolean;
798
799
  /**
799
800
  * Track width in pixels. Ignored when fluid is true.
800
801
  * @default 476
@@ -818,11 +819,11 @@ interface ProgressBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "c
818
819
  /**
819
820
  * ProgressBar for completion or loading states.
820
821
  *
821
- * @example With labels
822
- * <ProgressBar value={50} showLabel="both" />
822
+ * @example With label on the right (default)
823
+ * <ProgressBar value={50} />
823
824
  *
824
- * @example Bar only
825
- * <ProgressBar value={75} showLabel="none" />
825
+ * @example Bar only (no label)
826
+ * <ProgressBar value={75} showLabel={false} />
826
827
  */
827
828
  declare const ProgressBar: React.ForwardRefExoticComponent<ProgressBarProps & React.RefAttributes<HTMLDivElement>>;
828
829
 
@@ -837,7 +838,7 @@ interface LoaderProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "childr
837
838
  "aria-label"?: string;
838
839
  /**
839
840
  * Gradient color (e.g. #FFFFFF for white on dark backgrounds).
840
- * @default blue-600 from tokens
841
+ * @default semantic background.neutralInverse.primary (neutral.1100)
841
842
  */
842
843
  color?: string;
843
844
  /**
@@ -859,9 +860,9 @@ declare const Loader: React.ForwardRefExoticComponent<LoaderProps & React.RefAtt
859
860
  *
860
861
  * Lightweight, token-friendly loading placeholder.
861
862
  * Uses tokens from @esds-sangam/tokens:
862
- * - Base bg: neutral-200 (colors.json)
863
+ * - Base bg: semantic background.neutral.tertiary (neutral.200)
863
864
  * - Border radius: rounded-sm = tokens radius.sm (0.5rem / 8px)
864
- * - Shimmer: gradient neutral-200 neutral-100 → neutral-50 → neutral-200
865
+ * - Shimmer: animate-pulse (Tailwind built-in)
865
866
  * - Animation: ease-out, 1s duration, 800ms delay, loops infinitely.
866
867
  *
867
868
  * By default the component is layout-flexible — width/height
@@ -885,8 +886,9 @@ declare const Skeleton: React.ForwardRefExoticComponent<SkeletonProps & React.Re
885
886
  *
886
887
  * Types: Container, Underline, Icon only.
887
888
  * States: Default, Hover, Selected, Disabled.
889
+ * Colors: semantic-colors (background, border, text) where available.
888
890
  * Typography: 14px, weight 500, line-height 24px.
889
- * Spec: Container selected box 178×32, shadow 0 2px 6px; Underline selected 2px blue-600; Icon only 24×24 box, radius 4, padding 4, gap 8.
891
+ * Spec: Container selected box 178×32, shadow 0 2px 6px; Underline selected 2px info; Icon only 24×24 box, radius 4, padding 4, gap 8.
890
892
  */
891
893
  declare const tabsListVariants: (props?: ({
892
894
  type?: "underline" | "iconOnly" | "container" | null | undefined;
@@ -938,7 +940,7 @@ declare const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttribu
938
940
  *
939
941
  * Two variants: Image (photo or placeholder silhouette) and Letter (initials).
940
942
  * Sizes: large (32×32), medium (24×24), small (20×20).
941
- * Letter: bg neutral-200, text neutral-600 (tokens); weight 500.
943
+ * Letter: bg/text from semantic-colors (neutral tertiary); weight 500.
942
944
  * Letter typography: large tokens base (16px)/leading-6; medium/small tokens 3xs (10px).
943
945
  * Token-based, circular (rounded-full).
944
946
  */
@@ -948,7 +950,7 @@ declare const avatarVariants: (props?: ({
948
950
  interface AvatarProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, "children">, VariantProps<typeof avatarVariants> {
949
951
  /**
950
952
  * Variant: "image" (photo or placeholder silhouette) or "letter" (initials).
951
- * Letter uses bg neutral-200, text neutral-600 (tokens); typography per size (Big: tokens base, Medium/Small: tokens 3xs = 10px).
953
+ * Letter uses semantic-colors: bg neutral tertiary, text neutral tertiary; typography per size (Big: tokens base, Medium/Small: tokens 3xs = 10px).
952
954
  */
953
955
  variant?: "image" | "letter";
954
956
  /**
@@ -1040,12 +1042,12 @@ declare const Badge: React.ForwardRefExoticComponent<BadgeProps & React.RefAttri
1040
1042
  * Sizes: Large (75×32, close 16×16), Small (67×24, close 12×12).
1041
1043
  * Radius 999 (pill). Colors from @esds-sangam/tokens.
1042
1044
  *
1043
- * States:
1044
- * - Default: bg white, text neutral-1100, border neutral-400
1045
- * - Hover: bg neutral-200, text neutral-1100
1046
- * - Selected: bg neutral-1100, text white
1047
- * - Disabled: bg neutral-200, text neutral-500
1048
- * - Focused: bg white, text neutral-1100, border 2px neutral-700
1045
+ * States (semantic-colors):
1046
+ * - Default: bg neutral primary, text neutral primary, border neutral primary
1047
+ * - Hover: bg neutral tertiary, border transparent
1048
+ * - Selected: bg neutralInverse primary, text neutralInverse primary
1049
+ * - Disabled: bg neutral disabled, text neutral disabled
1050
+ * - Focused: bg neutral primary, text neutral primary, border 2px neutralInverse primary
1049
1051
  */
1050
1052
  declare const chipVariants: (props?: ({
1051
1053
  size?: "small" | "large" | null | undefined;
@@ -1095,87 +1097,50 @@ interface ChipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children
1095
1097
  */
1096
1098
  declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLDivElement>>;
1097
1099
 
1100
+ /** Toast entry for the provider (id, content, optional duration in ms; default 4000) */
1101
+ interface ToastEntryOptions {
1102
+ title: string;
1103
+ variant?: "info" | "success" | "warning" | "error";
1104
+ description?: string;
1105
+ ctaText?: string;
1106
+ onCtaClick?: () => void;
1107
+ showClose?: boolean;
1108
+ /** Duration in ms before auto-dismiss. @default 4000 */
1109
+ duration?: number;
1110
+ }
1111
+ interface ToastEntry extends ToastEntryOptions {
1112
+ id: string;
1113
+ }
1114
+ type ToastContextValue = {
1115
+ toasts: ToastEntry[];
1116
+ addToast: (options: ToastEntryOptions) => void;
1117
+ removeToast: (id: string) => void;
1118
+ };
1098
1119
  /**
1099
- * Sangam Toast Component
1100
- *
1101
- * Production-grade toast notification following Figma design specs:
1102
- * - Fixed width: 384px
1103
- * - Height: 56px (default), 84px (with description or CTA)
1104
- * - Border radius: 8px
1105
- * - Left border width: 3px
1106
- * - Padding: 16px
1107
- * - Background: white (neutral-50)
1108
- * - Title: 16px, 500 weight, 24px line-height, neutral-1100 color
1109
- * - Description: 14px, 400 weight, 24px line-height, neutral-600 color
1110
- * - Shadow: 0px 4px 10px 0px
1111
- * - Close icon: 16x16
1112
- * - Status icon: 20x20
1113
- * - CTA Button: radius 8px, padding 4px 16px
1114
- *
1115
- * Four color variants (token-based):
1116
- * 1. Info - blue-600 border/icon
1117
- * 2. Success - green-800 border/icon
1118
- * 3. Warning - orange-700 border/icon
1119
- * 4. Error - red-800 border/icon
1120
- *
1121
- * Three layout variants:
1122
- * 1. Default - Title only (56px height)
1123
- * 2. With Description - Title + description + close (84px height)
1124
- * 3. With CTA - Title + button (84px height, no description)
1125
- *
1126
- * @example Basic usage
1127
- * <Toast variant="info" title="Info message" />
1128
- *
1129
- * @example With description
1130
- * <Toast variant="success" title="Success!" description="Your changes have been saved" />
1131
- *
1132
- * @example With CTA button
1133
- * <Toast variant="info" title="New update" ctaText="Update" onCtaClick={() => {}} />
1120
+ * Hook to show toasts. Must be used inside ToastProvider.
1121
+ * Each call to addToast() shows a new toast; toasts stack from the top (60px from top) and auto-dismiss after 4 seconds.
1122
+ */
1123
+ declare function useToast(): ToastContextValue;
1124
+ /**
1125
+ * Provider for toast notifications. Renders toasts in a fixed container 60px from the top, stacked vertically.
1126
+ * Toasts auto-dismiss after 4 seconds (configurable per toast via duration).
1134
1127
  */
1128
+ declare function ToastProvider({ children }: {
1129
+ children: React.ReactNode;
1130
+ }): react_jsx_runtime.JSX.Element;
1135
1131
  declare const toastVariants: (props?: ({
1136
1132
  variant?: "error" | "success" | "info" | "warning" | null | undefined;
1137
1133
  layout?: "default" | "withDescription" | null | undefined;
1138
1134
  } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
1139
1135
  interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">, VariantProps<typeof toastVariants> {
1140
- /**
1141
- * Toast variant type
1142
- * @default "info"
1143
- */
1144
1136
  variant?: "info" | "success" | "warning" | "error";
1145
- /**
1146
- * Title text (required)
1147
- */
1148
1137
  title: string;
1149
- /**
1150
- * Description text (optional)
1151
- * When provided, toast height becomes 84px
1152
- */
1153
1138
  description?: string;
1154
- /**
1155
- * Whether to show close button
1156
- * @default true (false when CTA is provided)
1157
- */
1158
1139
  showClose?: boolean;
1159
- /**
1160
- * Callback when close button is clicked
1161
- */
1162
1140
  onClose?: () => void;
1163
- /**
1164
- * CTA button text (optional)
1165
- * When provided, replaces close button and height becomes 84px
1166
- */
1167
1141
  ctaText?: string;
1168
- /**
1169
- * Callback when CTA button is clicked
1170
- */
1171
1142
  onCtaClick?: () => void;
1172
1143
  }
1173
- /**
1174
- * Toast component with icon, title, optional description, and close/CTA
1175
- *
1176
- * Displays status-based notification with appropriate icon and border color
1177
- * Supports three layouts: default (56px), with description (84px), with CTA (84px)
1178
- */
1179
1144
  declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLDivElement>>;
1180
1145
 
1181
1146
  /**
@@ -1191,7 +1156,7 @@ declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttri
1191
1156
  * - Optional subtext line below the title
1192
1157
  * - Optional up to three CTA buttons on the right
1193
1158
  * - Optional close icon button on the right
1194
- * - Tabs: underline style, 14px/500/24px, active blue-600, border neutral-200
1159
+ * - Tabs: underline style, 14px/500/24px, active blue-600, border semantic neutral tertiary
1195
1160
  */
1196
1161
  interface PageHeaderTab {
1197
1162
  value: string;
@@ -1301,9 +1266,40 @@ interface PageHeaderProps extends Omit<React.HTMLAttributes<HTMLElement>, "title
1301
1266
  }
1302
1267
  declare const PageHeader: React.ForwardRefExoticComponent<PageHeaderProps & React.RefAttributes<HTMLElement>>;
1303
1268
 
1269
+ type PageFooterAction = {
1270
+ /**
1271
+ * Visible label for the button.
1272
+ */
1273
+ label: string;
1274
+ /**
1275
+ * Click handler for the button.
1276
+ */
1277
+ onClick?: () => void;
1278
+ /**
1279
+ * Visual style of the button. Defaults to primary.
1280
+ */
1281
+ variant?: "primary" | "secondary";
1282
+ /**
1283
+ * Optional icon to render alongside the label.
1284
+ */
1285
+ icon?: React.ReactNode;
1286
+ /**
1287
+ * Position of the icon relative to the label. Defaults to leading.
1288
+ */
1289
+ iconPosition?: "leading" | "trailing";
1290
+ };
1304
1291
  interface PageFooterProps extends React.HTMLAttributes<HTMLElement> {
1305
1292
  /**
1306
- * Action buttons or content. Defaults to primary small "Convert" button when omitted.
1293
+ * Primary CTA button (rightmost). When set with secondaryAction, renders as props-based actions.
1294
+ */
1295
+ primaryAction?: PageFooterAction;
1296
+ /**
1297
+ * Secondary CTA button (left of primary). Renders before primaryAction when both are set.
1298
+ */
1299
+ secondaryAction?: PageFooterAction;
1300
+ /**
1301
+ * Action buttons or content. When provided, overrides primaryAction/secondaryAction.
1302
+ * Defaults to primary small "Convert" button when neither children nor actions are set.
1307
1303
  */
1308
1304
  children?: React.ReactNode;
1309
1305
  /**
@@ -1431,4 +1427,4 @@ type Size = "sm" | "md" | "lg";
1431
1427
  type Variant = "primary" | "secondary" | "outline" | "ghost";
1432
1428
  type ColorScheme = "primary" | "secondary" | "success" | "error" | "warning" | "info";
1433
1429
 
1434
- export { Avatar, Badge, type BaseComponentProps, Button, Checkbox, Chip, type ColorScheme, Dropdown, DropdownMulti, type DropdownMultiProps, type DropdownOption, type DropdownProps, Input, Label, Loader, PageFooter, type PageFooterProps, PageHeader, type PageHeaderAction, type PageHeaderProps, type PageHeaderTab, ProgressBar, Radio, RadioGroup, SearchField, SideMenu, type SideMenuItem, type SideMenuProps, type Size, Skeleton, Tabs, TabsContent, TabsList, TabsRoot, TabsTrigger, type TabsTriggerOption, type TabsTriggerProps, Textarea, Toast, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Upload, UploadFileItem, type UploadFileItemProps, type UploadFileItemStatus, type UploadProps, type Variant, avatarVariants, badgeVariants, buttonVariants, checkboxRootVariants as checkboxVariants, chipVariants, dropdownContentVariants, dropdownItemVariants, dropdownTriggerVariants, inputVariants, loaderVariants, pageHeaderVariants, radioVariants, searchFieldVariants, sideMenuVariants, skeletonVariants, tabsListVariants, tabsTriggerVariants, textareaVariants, toastVariants, toggleVariants, tooltipContentVariants, uploadBoxVariants, uploadFileItemBoxVariants };
1430
+ export { Avatar, Badge, type BaseComponentProps, Button, Checkbox, Chip, type ColorScheme, Dropdown, DropdownMulti, type DropdownMultiProps, type DropdownOption, type DropdownProps, Input, Label, Loader, PageFooter, type PageFooterAction, type PageFooterProps, PageHeader, type PageHeaderAction, type PageHeaderProps, type PageHeaderTab, ProgressBar, Radio, RadioGroup, SearchField, SideMenu, type SideMenuItem, type SideMenuProps, type Size, Skeleton, Tabs, TabsContent, TabsList, TabsRoot, TabsTrigger, type TabsTriggerOption, type TabsTriggerProps, Textarea, Toast, type ToastEntryOptions, ToastProvider, Toggle, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Upload, UploadFileItem, type UploadFileItemProps, type UploadFileItemStatus, type UploadProps, type Variant, avatarVariants, badgeVariants, buttonVariants, checkboxRootVariants as checkboxVariants, chipVariants, dropdownContentVariants, dropdownItemVariants, dropdownTriggerVariants, inputVariants, loaderVariants, pageHeaderVariants, radioVariants, searchFieldVariants, sideMenuVariants, skeletonVariants, tabsListVariants, tabsTriggerVariants, textareaVariants, toastVariants, toggleVariants, tooltipContentVariants, uploadBoxVariants, uploadFileItemBoxVariants, useToast };