@officesdk/design 0.1.13 → 0.1.15

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.
@@ -357,7 +357,7 @@ interface SliderProps {
357
357
  declare const Slider: React.FC<SliderProps>;
358
358
 
359
359
  type InputSize = 'mini' | 'small' | 'medium' | 'large';
360
- type LineType = 'outlined' | 'underlined';
360
+ type LineType = 'outlined' | 'underlined' | 'borderless';
361
361
  interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
362
362
  /**
363
363
  * Input line type
@@ -1437,10 +1437,16 @@ interface UIConfigProviderProps {
1437
1437
  children: React.ReactNode;
1438
1438
  }
1439
1439
  /**
1440
- * UIConfigProvider Component
1440
+ * UIConfigProvider Component (Optional, for React convenience)
1441
1441
  *
1442
- * Unified provider for all UI components and global configurations
1443
- * Includes ThemeProvider, IconProvider, ToastContainer, and other settings
1442
+ * Unified provider for all UI components and global configurations.
1443
+ * Includes IconProvider, ToastContainer, and other settings.
1444
+ *
1445
+ * Note: Global styles (Tooltip, Menu, Dropdown) are now injected on-demand
1446
+ * when components are first used, so they are no longer included here.
1447
+ *
1448
+ * For non-React environments or when you want to avoid Provider nesting,
1449
+ * use initUIConfig() instead.
1444
1450
  *
1445
1451
  * @example
1446
1452
  * import { UIConfigProvider } from '@officesdk/design';
@@ -1462,12 +1468,15 @@ declare const UIConfigProvider: React.FC<UIConfigProviderProps>;
1462
1468
  /**
1463
1469
  * Hook to access UI configuration
1464
1470
  *
1471
+ * Falls back to global config if context is not available.
1472
+ * This allows components to work even without UIConfigProvider when initUIConfig() is used.
1473
+ *
1465
1474
  * @example
1466
1475
  * const config = useUIConfig();
1467
- * console.log(config.theme);
1468
- * console.log(config.locale);
1476
+ * console.log(config?.theme);
1477
+ * console.log(config?.locale);
1469
1478
  */
1470
- declare const useUIConfig: () => UIConfig;
1479
+ declare const useUIConfig: () => UIConfig | null;
1471
1480
 
1472
1481
  /**
1473
1482
  * Create UI configuration with default values
@@ -1491,8 +1500,83 @@ declare const createUIConfig: (config: UIConfig) => UIConfig;
1491
1500
  */
1492
1501
  declare const mergeUIConfig: (baseConfig: UIConfig, ...configs: Partial<UIConfig>[]) => UIConfig;
1493
1502
 
1503
+ /**
1504
+ * Initialize UI configuration globally (non-React)
1505
+ *
1506
+ * This function allows you to configure the UI library without using React Provider components.
1507
+ * It's useful for:
1508
+ * - Non-React environments
1509
+ * - Avoiding Provider nesting (e.g., in Modal components)
1510
+ * - Setting up configuration before React app starts
1511
+ *
1512
+ * After calling this function, all components will automatically use the global configuration.
1513
+ * Global styles (Tooltip, Menu, Dropdown) will be injected on-demand when components are first used.
1514
+ *
1515
+ * @param config - UI configuration object
1516
+ * @param config.theme - Theme configuration (required)
1517
+ * @param config.icons - Icon registry mapping icon names to React components
1518
+ * @param config.toast - Toast configuration (maxCount, defaultDuration, etc.)
1519
+ * @param config.locale - Locale code (e.g., 'zh-CN', 'en-US')
1520
+ * @param config.i18n - Internationalization configuration
1521
+ * @param config.zIndex - Z-index layer management
1522
+ * @param config.animation - Animation configuration
1523
+ * @param config.a11y - Accessibility configuration
1524
+ *
1525
+ * @example
1526
+ * import { initUIConfig } from '@officesdk/design';
1527
+ * import { lightTheme } from '@officesdk/design/theme';
1528
+ * import { iconRegistry } from '@officesdk/design/icons';
1529
+ *
1530
+ * // Initialize before React app starts
1531
+ * initUIConfig({
1532
+ * theme: lightTheme,
1533
+ * icons: iconRegistry,
1534
+ * toast: {
1535
+ * maxCount: 5,
1536
+ * defaultDuration: 3000,
1537
+ * },
1538
+ * });
1539
+ *
1540
+ * // Now you can use components without UIConfigProvider
1541
+ * function App() {
1542
+ * return <Button>Click me</Button>;
1543
+ * }
1544
+ *
1545
+ * @example
1546
+ * // Useful for Modal scenarios - no need to nest Provider
1547
+ * function Modal({ children }) {
1548
+ * return (
1549
+ * <Portal>
1550
+ * {children}
1551
+ * </Portal>
1552
+ * );
1553
+ * }
1554
+ *
1555
+ * @example
1556
+ * // Can be called multiple times to update config
1557
+ * initUIConfig({ theme: lightTheme });
1558
+ * // Later update icons
1559
+ * initUIConfig({ theme: lightTheme, icons: newIconRegistry });
1560
+ */
1561
+ declare const initUIConfig: (config: UIConfig) => void;
1562
+ /**
1563
+ * Get global UI configuration
1564
+ */
1565
+ declare const getUIConfig: () => UIConfig | null;
1566
+ /**
1567
+ * Get global icon registry
1568
+ */
1569
+ declare const getGlobalIconRegistry: () => Record<string, React.ComponentType<React.SVGProps<SVGSVGElement>>> | null;
1570
+ /**
1571
+ * Get global toast config
1572
+ */
1573
+ declare const getGlobalToastConfig: () => {
1574
+ maxCount?: number;
1575
+ defaultDuration?: number;
1576
+ } | null;
1577
+
1494
1578
  declare const styled: ThemedStyledInterface<Theme>;
1495
1579
 
1496
1580
  declare const getGlobalTheme: () => Theme;
1497
1581
 
1498
- export { type A11yConfig, type AnimationConfig, Button, type ButtonProps, Checkbox, type CheckboxProps, Dropdown, DropdownButton, type DropdownButtonProps, DropdownGlobalStyles, type DropdownProps, type I18nConfig, Icon, type IconComponent, type IconProps, IconProvider, type IconProviderProps, type IconRegistry, Input, type InputProps, Menu, type MenuDivider, MenuGlobalStyles, type MenuGroup, type MenuItem, type MenuItemType, type MenuProps, NumberInput, type NumberInputProps, Radio, type RadioProps, SearchInput, type SearchInputProps, Slider, type SliderProps, SpinButton, type SpinButtonProps, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, Toast, type ToastConfig, ToastContainer, type ToastContainerConfig, type ToastContainerProps, type ToastPosition, type ToastProps, ToolbarButton, type ToolbarButtonProps, Tooltip, type TooltipProps, type UIConfig, UIConfigProvider, type UIConfigProviderProps, UnderlinedInput, type InputProps as UnderlinedInputProps, type ZIndexConfig, createUIConfig, getGlobalTheme, mergeUIConfig, styled, toast, useIconRegistry, useToast, useUIConfig };
1582
+ export { type A11yConfig, type AnimationConfig, Button, type ButtonProps, Checkbox, type CheckboxProps, Dropdown, DropdownButton, type DropdownButtonProps, DropdownGlobalStyles, type DropdownProps, type I18nConfig, Icon, type IconComponent, type IconProps, IconProvider, type IconProviderProps, type IconRegistry, Input, type InputProps, Menu, type MenuDivider, MenuGlobalStyles, type MenuGroup, type MenuItem, type MenuItemType, type MenuProps, NumberInput, type NumberInputProps, Radio, type RadioProps, SearchInput, type SearchInputProps, Slider, type SliderProps, SpinButton, type SpinButtonProps, Switch, type SwitchProps, type TabItem, Tabs, type TabsProps, Toast, type ToastConfig, ToastContainer, type ToastContainerConfig, type ToastContainerProps, type ToastPosition, type ToastProps, ToolbarButton, type ToolbarButtonProps, Tooltip, type TooltipProps, type UIConfig, UIConfigProvider, type UIConfigProviderProps, UnderlinedInput, type InputProps as UnderlinedInputProps, type ZIndexConfig, createUIConfig, getGlobalIconRegistry, getGlobalTheme, getGlobalToastConfig, getUIConfig, initUIConfig, mergeUIConfig, styled, toast, useIconRegistry, useToast, useUIConfig };