@capillarytech/blaze-ui 2.0.2 → 2.0.3

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/dist/index.js CHANGED
@@ -517,9 +517,9 @@ exports["default"] = CheckOutlined;
517
517
 
518
518
 
519
519
  exports.__esModule = true;
520
- exports.loadBlazeUIFonts = exports.getBlazeUIFontLinks = void 0;
520
+ exports.loadCapUIFonts = exports.getCapUIFontLinks = void 0;
521
521
  /**
522
- * Font configuration for Blaze UI
522
+ * Font configuration for Cap UI
523
523
  * Centralized font management for consistent typography across applications
524
524
  */
525
525
 
@@ -577,7 +577,7 @@ const injectRobotoFont = function (weights) {
577
577
  const link = document.createElement('link');
578
578
  link.href = href;
579
579
  link.rel = 'stylesheet';
580
- link.setAttribute('data-blaze-ui-font', 'roboto');
580
+ link.setAttribute('data-cap-ui-font', 'roboto');
581
581
  document.head.appendChild(link);
582
582
  };
583
583
 
@@ -595,7 +595,7 @@ const injectMaterialIcons = () => {
595
595
  preloadLink.rel = 'preload';
596
596
  preloadLink.href = FONT_URLS.materialIcons;
597
597
  preloadLink.setAttribute('as', 'style');
598
- preloadLink.setAttribute('data-blaze-ui-font', 'material-icons');
598
+ preloadLink.setAttribute('data-cap-ui-font', 'material-icons');
599
599
 
600
600
  // Convert to stylesheet when loaded
601
601
  preloadLink.onload = function () {
@@ -610,13 +610,13 @@ const injectMaterialIcons = () => {
610
610
  const fallbackLink = document.createElement('link');
611
611
  fallbackLink.rel = 'stylesheet';
612
612
  fallbackLink.href = FONT_URLS.materialIcons;
613
- fallbackLink.setAttribute('data-blaze-ui-font', 'material-icons-fallback');
613
+ fallbackLink.setAttribute('data-cap-ui-font', 'material-icons-fallback');
614
614
  noscript.appendChild(fallbackLink);
615
615
  document.head.appendChild(noscript);
616
616
  };
617
617
 
618
618
  /**
619
- * Loads Blaze UI fonts into the document head
619
+ * Loads Cap UI fonts into the document head
620
620
  *
621
621
  * This function should be called once when your application initializes.
622
622
  * It's safe to call multiple times - it will check if fonts are already loaded.
@@ -625,19 +625,19 @@ const injectMaterialIcons = () => {
625
625
  *
626
626
  * @example
627
627
  * ```typescript
628
- * import { loadBlazeUIFonts } from '@capillarytech/blaze-ui';
628
+ * import { loadCapUIFonts } from '@capillarytech/blaze-ui';
629
629
  *
630
630
  * // Load all fonts (default)
631
- * loadBlazeUIFonts();
631
+ * loadCapUIFonts();
632
632
  *
633
633
  * // Load only Roboto with custom weights
634
- * loadBlazeUIFonts({
634
+ * loadCapUIFonts({
635
635
  * loadMaterialIcons: false,
636
636
  * robotoWeights: [400, 500, 700]
637
637
  * });
638
638
  * ```
639
639
  */
640
- const loadBlazeUIFonts = function (config) {
640
+ const loadCapUIFonts = function (config) {
641
641
  if (config === void 0) {
642
642
  config = {};
643
643
  }
@@ -663,11 +663,11 @@ const loadBlazeUIFonts = function (config) {
663
663
  * @example
664
664
  * ```html
665
665
  * <!-- In your HTML head -->
666
- * ${getBlazeUIFontLinks().join('\n')}
666
+ * ${getCapUIFontLinks().join('\n')}
667
667
  * ```
668
668
  */
669
- exports.loadBlazeUIFonts = loadBlazeUIFonts;
670
- const getBlazeUIFontLinks = function (config) {
669
+ exports.loadCapUIFonts = loadCapUIFonts;
670
+ const getCapUIFontLinks = function (config) {
671
671
  if (config === void 0) {
672
672
  config = {};
673
673
  }
@@ -685,7 +685,7 @@ const getBlazeUIFontLinks = function (config) {
685
685
  }
686
686
  return links;
687
687
  };
688
- exports.getBlazeUIFontLinks = getBlazeUIFontLinks;
688
+ exports.getCapUIFontLinks = getCapUIFontLinks;
689
689
 
690
690
  /***/ }),
691
691
 
@@ -752,9 +752,9 @@ const CapDropdownComponent = _ref => {
752
752
  const v6Placement = mapPlacement(placement);
753
753
 
754
754
  // Support both new `classNames.root` and deprecated `overlayClassName` props
755
- // Note: TypeScript types may be outdated, but runtime supports classNames.root
756
- const finalClassNames = _extends({}, classNamesProp, {
757
- root: (0, _classnames.default)(_styles.default[clsPrefix + "-overlay"], classNamesProp == null ? void 0 : classNamesProp.root, overlayClassName)
755
+ const existingRoot = classNamesProp && typeof classNamesProp === 'object' && !Array.isArray(classNamesProp) ? classNamesProp.root : undefined;
756
+ const finalClassNames = _extends({}, typeof classNamesProp === 'object' && !Array.isArray(classNamesProp) ? classNamesProp : {}, {
757
+ root: (0, _classnames.default)(_styles.default[clsPrefix + "-overlay"], existingRoot, overlayClassName)
758
758
  });
759
759
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Dropdown, _extends({
760
760
  className: (0, _classnames.default)(_styles.default[clsPrefix], className),
@@ -5136,7 +5136,7 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(1601);
5136
5136
  var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(6314);
5137
5137
  var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
5138
5138
  // Module
5139
- ___CSS_LOADER_EXPORT___.push([module.id, `.blaze-ui-cap-dropdown-v2-overlay{min-width:14.286rem}.ant-dropdown .ant-dropdown-menu .ant-dropdown-menu-item{padding:.857rem 1.714rem}`, ""]);
5139
+ ___CSS_LOADER_EXPORT___.push([module.id, `.blaze-ui-cap-dropdown-v2-overlay{min-width:14.286rem}.blaze-ui-cap-dropdown-v2-overlay .ant-dropdown .ant-dropdown-menu .ant-dropdown-menu-item{padding:.857rem 1.714rem}`, ""]);
5140
5140
  // Exports
5141
5141
  ___CSS_LOADER_EXPORT___.locals = {
5142
5142
  "cap-dropdown-v2-overlay": `blaze-ui-cap-dropdown-v2-overlay`
@@ -5781,13 +5781,36 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
5781
5781
 
5782
5782
  exports.__esModule = true;
5783
5783
  exports.getCapThemeConfig = getCapThemeConfig;
5784
+ var _lodash = __webpack_require__(2543);
5784
5785
  var styledVars = _interopRequireWildcard(__webpack_require__(9941));
5785
5786
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
5786
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
5787
5787
  /**
5788
- * Converts rem values to pixels (number).
5789
- * Base font size is 14px, so 1rem = 14px.
5788
+ * Gets the root font size from the document element dynamically.
5789
+ * Falls back to Cap UI default (14px) if not available or in non-browser environments.
5790
5790
  *
5791
+ * @returns Root font size in pixels
5792
+ */
5793
+ function getRootFontSize() {
5794
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
5795
+ // SSR or non-browser environment: return Cap UI default
5796
+ return 14;
5797
+ }
5798
+ const rootElement = document.documentElement;
5799
+ const computedStyle = window.getComputedStyle(rootElement);
5800
+ const fontSize = computedStyle.fontSize;
5801
+ if (fontSize) {
5802
+ const pxValue = parseFloat(fontSize);
5803
+ if (!isNaN(pxValue) && pxValue > 0) {
5804
+ return pxValue;
5805
+ }
5806
+ }
5807
+
5808
+ // Fallback to Cap UI default if unable to read computed size
5809
+ return 14;
5810
+ }
5811
+
5812
+ /**
5813
+ * Converts rem values to pixels (number) by reading the root font size dynamically.
5791
5814
  * @param remValue - Rem value as string (e.g., '1rem', '0.857rem') or number
5792
5815
  * @returns Number in pixels
5793
5816
  *
@@ -5803,11 +5826,12 @@ function remToPx(remValue, fallback) {
5803
5826
  if (typeof remValue === 'number') {
5804
5827
  return remValue;
5805
5828
  }
5829
+ const rootFontSize = getRootFontSize();
5806
5830
  const value = remValue || fallback;
5807
5831
  const remMatch = typeof value === 'string' ? value.match(/^([\d.]+)rem$/) : null;
5808
5832
  if (remMatch) {
5809
5833
  const rem = parseFloat(remMatch[1]);
5810
- return rem * 14; // Base font size is 14px
5834
+ return rem * rootFontSize;
5811
5835
  }
5812
5836
 
5813
5837
  // If it's already a number string, parse it
@@ -5818,7 +5842,7 @@ function remToPx(remValue, fallback) {
5818
5842
 
5819
5843
  // Default fallback: parse the fallback value
5820
5844
  const fallbackMatch = fallback.match(/^([\d.]+)rem$/);
5821
- return fallbackMatch ? parseFloat(fallbackMatch[1]) * 14 : 14;
5845
+ return fallbackMatch ? parseFloat(fallbackMatch[1]) * rootFontSize : rootFontSize;
5822
5846
  }
5823
5847
 
5824
5848
  /**
@@ -5826,6 +5850,13 @@ function remToPx(remValue, fallback) {
5826
5850
  * This function maps Capillary design tokens to Ant Design tokens,
5827
5851
  * eliminating the need for SCSS overrides.
5828
5852
  *
5853
+ * **⚠️ Accessibility Note:**
5854
+ * This function converts rem values to px for Ant Design theme tokens.
5855
+ * This means Ant Design components will not scale with user browser font size settings,
5856
+ * while Cap UI components (which use rem) will scale. This creates inconsistent
5857
+ * behavior and violates WCAG 2.1 SC 1.4.4 (Resize text). Consider using rem values
5858
+ * directly in theme config when Ant Design v6 supports it, or use CSS custom properties.
5859
+ *
5829
5860
  * @param options - Optional theme configuration overrides
5830
5861
  * @returns Ant Design ThemeConfig object
5831
5862
  *
@@ -6077,8 +6108,8 @@ function getCapThemeConfig(options) {
6077
6108
  // Merge with custom options if provided
6078
6109
  if (options) {
6079
6110
  return {
6080
- token: _extends({}, baseTheme.token, options.token),
6081
- components: _extends({}, baseTheme.components, options.components),
6111
+ token: options.token ? (0, _lodash.merge)({}, baseTheme.token, options.token) : baseTheme.token,
6112
+ components: options.components ? (0, _lodash.merge)({}, baseTheme.components, options.components) : baseTheme.components,
6082
6113
  algorithm: options.algorithm,
6083
6114
  cssVar: options.cssVar,
6084
6115
  hashed: options.hashed
@@ -6965,7 +6996,7 @@ const CapAlert = _ref => {
6965
6996
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Alert, _extends({
6966
6997
  className: (0, _classnames.default)(_styles.default[clsPrefix], className),
6967
6998
  type: type,
6968
- title: alertTitle
6999
+ message: alertTitle
6969
7000
  }, rest))
6970
7001
  });
6971
7002
  };
@@ -7035,9 +7066,9 @@ function _isNativeReflectConstruct() {
7035
7066
  exports.__esModule = true;
7036
7067
  var _exportNames = {
7037
7068
  getCapThemeConfig: true,
7038
- loadBlazeUI: true
7069
+ loadCapUI: true
7039
7070
  };
7040
- exports.loadBlazeUI = exports.getCapThemeConfig = void 0;
7071
+ exports.loadCapUI = exports.getCapThemeConfig = void 0;
7041
7072
  var _fonts = __webpack_require__(170);
7042
7073
  Object.keys(_fonts).forEach(function (key) {
7043
7074
  if (key === "default" || key === "__esModule") return;
@@ -7051,11 +7082,11 @@ exports.getCapThemeConfig = _getCapThemeConfig.getCapThemeConfig;
7051
7082
  const _excluded = ["baseFontSize"];
7052
7083
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
7053
7084
  /**
7054
- * Configuration for Blaze UI initialization
7085
+ * Configuration for Cap UI initialization
7055
7086
  */
7056
7087
 
7057
7088
  /**
7058
- * Loads Blaze UI fonts and base styles (sanitize.css) together
7089
+ * Loads Cap UI fonts and base styles (sanitize.css) together
7059
7090
  *
7060
7091
  * This is a convenience function that loads both fonts and base styles in one call.
7061
7092
  * It should be called once when your application initializes.
@@ -7064,28 +7095,28 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
7064
7095
  * - Webpack will typically deduplicate it if both resolve to the same module path in node_modules
7065
7096
  * - However, if you want to avoid any potential duplication, import fonts separately:
7066
7097
  * ```typescript
7067
- * import { loadBlazeUIFonts } from '@capillarytech/blaze-ui/utils';
7068
- * loadBlazeUIFonts();
7098
+ * import { loadCapUIFonts } from '@capillarytech/blaze-ui/utils';
7099
+ * loadCapUIFonts();
7069
7100
  * ```
7070
7101
  *
7071
- * @param config - Blaze UI configuration options
7102
+ * @param config - Cap UI configuration options
7072
7103
  *
7073
7104
  * @example
7074
7105
  * ```typescript
7075
- * import { loadBlazeUI } from '@capillarytech/blaze-ui/utils';
7106
+ * import { loadCapUI } from '@capillarytech/blaze-ui/utils';
7076
7107
  *
7077
7108
  * // Load everything with default base font size (14px)
7078
- * loadBlazeUI();
7109
+ * loadCapUI();
7079
7110
  *
7080
7111
  * // Load with custom font configuration and base font size
7081
- * loadBlazeUI({
7112
+ * loadCapUI({
7082
7113
  * loadMaterialIcons: false,
7083
7114
  * robotoWeights: [400, 500, 700],
7084
7115
  * baseFontSize: '16px'
7085
7116
  * });
7086
7117
  * ```
7087
7118
  */
7088
- const loadBlazeUI = function (config) {
7119
+ const loadCapUI = function (config) {
7089
7120
  if (config === void 0) {
7090
7121
  config = {};
7091
7122
  }
@@ -7101,9 +7132,9 @@ const loadBlazeUI = function (config) {
7101
7132
 
7102
7133
  // Styles are loaded via import at module level (above)
7103
7134
  // Webpack will deduplicate sanitize.css if imported elsewhere with same module path
7104
- (0, _fonts.loadBlazeUIFonts)(fontConfig);
7135
+ (0, _fonts.loadCapUIFonts)(fontConfig);
7105
7136
  };
7106
- exports.loadBlazeUI = loadBlazeUI;
7137
+ exports.loadCapUI = loadCapUI;
7107
7138
 
7108
7139
  /***/ }),
7109
7140
 
@@ -7456,13 +7487,13 @@ var _exportNames = {
7456
7487
  CapTooltipWithInfo: true,
7457
7488
  CapUnifiedSelect: true,
7458
7489
  LocaleHoc: true,
7459
- loadBlazeUI: true,
7490
+ loadCapUI: true,
7460
7491
  getCapThemeConfig: true,
7461
- loadBlazeUIFonts: true,
7462
- getBlazeUIFontLinks: true,
7492
+ loadCapUIFonts: true,
7493
+ getCapUIFontLinks: true,
7463
7494
  styledVars: true
7464
7495
  };
7465
- exports.styledVars = exports.loadBlazeUIFonts = exports.loadBlazeUI = exports.getCapThemeConfig = exports.getBlazeUIFontLinks = exports.LocaleHoc = exports.CapUnifiedSelect = exports.CapTooltipWithInfo = exports.CapTooltip = exports.CapTable = exports.CapTab = exports.CapSwitch = exports.CapSpin = exports.CapSkeleton = exports.CapRow = exports.CapRadio = exports.CapMenu = exports.CapLabel = exports.CapInput = exports.CapIcon = exports.CapFormItem = exports.CapForm = exports.CapDropdown = exports.CapDivider = exports.CapColumn = exports.CapCheckbox = exports.CapCard = exports.CapButton = exports.CapAlert = void 0;
7496
+ exports.styledVars = exports.loadCapUIFonts = exports.loadCapUI = exports.getCapUIFontLinks = exports.getCapThemeConfig = exports.LocaleHoc = exports.CapUnifiedSelect = exports.CapTooltipWithInfo = exports.CapTooltip = exports.CapTable = exports.CapTab = exports.CapSwitch = exports.CapSpin = exports.CapSkeleton = exports.CapRow = exports.CapRadio = exports.CapMenu = exports.CapLabel = exports.CapInput = exports.CapIcon = exports.CapFormItem = exports.CapForm = exports.CapDropdown = exports.CapDivider = exports.CapColumn = exports.CapCheckbox = exports.CapCard = exports.CapButton = exports.CapAlert = void 0;
7466
7497
  var _CapAlert = _interopRequireDefault(__webpack_require__(8501));
7467
7498
  exports.CapAlert = _CapAlert.default;
7468
7499
  var _CapButton = _interopRequireDefault(__webpack_require__(8793));
@@ -7512,11 +7543,11 @@ exports.CapUnifiedSelect = _CapUnifiedSelect.default;
7512
7543
  var _LocaleHoc = _interopRequireDefault(__webpack_require__(9879));
7513
7544
  exports.LocaleHoc = _LocaleHoc.default;
7514
7545
  var _utils = __webpack_require__(2232);
7515
- exports.loadBlazeUI = _utils.loadBlazeUI;
7546
+ exports.loadCapUI = _utils.loadCapUI;
7516
7547
  exports.getCapThemeConfig = _utils.getCapThemeConfig;
7517
7548
  var _fonts = __webpack_require__(170);
7518
- exports.loadBlazeUIFonts = _fonts.loadBlazeUIFonts;
7519
- exports.getBlazeUIFontLinks = _fonts.getBlazeUIFontLinks;
7549
+ exports.loadCapUIFonts = _fonts.loadCapUIFonts;
7550
+ exports.getCapUIFontLinks = _fonts.getCapUIFontLinks;
7520
7551
  var _styles = __webpack_require__(7668);
7521
7552
  Object.keys(_styles).forEach(function (key) {
7522
7553
  if (key === "default" || key === "__esModule") return;
@@ -33545,27 +33576,31 @@ var _antdV = __webpack_require__(4273);
33545
33576
  var _classnames = _interopRequireDefault(__webpack_require__(6942));
33546
33577
  var _react = _interopRequireDefault(__webpack_require__(9206));
33547
33578
  var _jsxRuntime = __webpack_require__(4848);
33548
- const _excluded = ["className", "orientation"]; // Deprecated values from old API
33579
+ const _excluded = ["className", "orientation", "type"]; // Legacy alignment values that need mapping
33580
+ // Valid Ant Design v6 title placement values
33549
33581
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
33550
33582
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
33551
33583
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
33552
- // Map deprecated values to valid v6 values
33553
- const mapOrientation = value => {
33554
- // Map deprecated values to 'horizontal'
33555
- if (value === 'left' || value === 'center' || value === 'right') {
33556
- return 'horizontal';
33584
+ // Map legacy alignment values to Ant Design v6 titlePlacement values
33585
+ const mapTitlePlacement = value => {
33586
+ if (value === 'left') return 'start';
33587
+ if (value === 'right') return 'end';
33588
+ if (value === 'center' || value === 'start' || value === 'end') {
33589
+ return value;
33557
33590
  }
33558
- return value;
33591
+ return undefined;
33559
33592
  };
33560
33593
  const CapDivider = _ref => {
33561
33594
  let {
33562
33595
  className,
33563
- orientation = 'horizontal'
33596
+ orientation,
33597
+ type = 'horizontal'
33564
33598
  } = _ref,
33565
33599
  rest = _objectWithoutPropertiesLoose(_ref, _excluded);
33566
33600
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antdV.Divider, _extends({
33567
33601
  className: (0, _classnames.default)('cap-divider-v2', className),
33568
- orientation: mapOrientation(orientation)
33602
+ orientation: type,
33603
+ titlePlacement: mapTitlePlacement(orientation)
33569
33604
  }, rest));
33570
33605
  };
33571
33606
  var _default = exports["default"] = CapDivider;