@cck-ui/core 0.4.10 → 0.5.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 (190) hide show
  1. package/cjs/components/button/button.cjs +71 -63
  2. package/cjs/components/button/button.cjs.map +1 -1
  3. package/cjs/components/button/button.utils.cjs +28 -0
  4. package/cjs/components/button/button.utils.cjs.map +1 -0
  5. package/cjs/components/button/index.cjs +5 -1
  6. package/cjs/components/button/index.cjs.map +1 -1
  7. package/cjs/components/grid/col/col.cjs +33 -16
  8. package/cjs/components/grid/col/col.cjs.map +1 -1
  9. package/cjs/components/grid/grid.cjs +63 -34
  10. package/cjs/components/grid/grid.cjs.map +1 -1
  11. package/cjs/components/grid/grid.constants.cjs.map +1 -1
  12. package/cjs/components/grid/grid.utils.cjs +11 -0
  13. package/cjs/components/grid/grid.utils.cjs.map +1 -0
  14. package/cjs/components/grid/index.cjs +7 -2
  15. package/cjs/components/grid/index.cjs.map +1 -1
  16. package/cjs/components/loader/loader.module.cjs.map +1 -1
  17. package/cjs/components/loader/loaders/bars.cjs +6 -3
  18. package/cjs/components/loader/loaders/bars.cjs.map +1 -1
  19. package/cjs/components/loader/loaders/dots.cjs +6 -3
  20. package/cjs/components/loader/loaders/dots.cjs.map +1 -1
  21. package/cjs/components/loader/loaders/oval.cjs +6 -3
  22. package/cjs/components/loader/loaders/oval.cjs.map +1 -1
  23. package/cjs/components/unstyled-button/unstyled-button.cjs +32 -22
  24. package/cjs/components/unstyled-button/unstyled-button.cjs.map +1 -1
  25. package/cjs/core/box/box.cjs +39 -27
  26. package/cjs/core/box/box.cjs.map +1 -1
  27. package/cjs/core/box/get-box-style/get-box-style.cjs.map +1 -1
  28. package/cjs/core/box/style-props/extract-style-props/extract-style-props.cjs.map +1 -1
  29. package/cjs/core/box/style-props/parse-style-props/sort-media-queries.cjs.map +1 -1
  30. package/cjs/core/box/style-props/resolvers/border-resolver/border-resolver.cjs.map +1 -1
  31. package/cjs/core/box/style-props/resolvers/color-resolver/color-resolver.cjs.map +1 -1
  32. package/cjs/core/box/style-props/resolvers/font-family-resolver/font-family-resolver.cjs.map +1 -1
  33. package/cjs/core/box/style-props/resolvers/index.cjs.map +1 -1
  34. package/cjs/core/box/style-props/style-props-data.cjs.map +1 -1
  35. package/cjs/core/config-provider/color-functions/get-gradient/get-gradient.cjs +3 -3
  36. package/cjs/core/config-provider/color-functions/get-gradient/get-gradient.cjs.map +1 -1
  37. package/cjs/core/config-provider/color-functions/rgba/rgba.cjs +8 -0
  38. package/cjs/core/config-provider/color-functions/rgba/rgba.cjs.map +1 -1
  39. package/cjs/core/config-provider/color-functions/to-rgba/to-rgba.cjs.map +1 -1
  40. package/cjs/core/config-provider/config-provider.cjs +33 -22
  41. package/cjs/core/config-provider/config-provider.cjs.map +1 -1
  42. package/cjs/core/config-provider/default-colors.cjs.map +1 -1
  43. package/cjs/core/config-provider/index.cjs +5 -0
  44. package/cjs/core/config-provider/index.cjs.map +1 -1
  45. package/cjs/core/config-provider/merge-cck-theme/merge-cck-theme.cjs +2 -2
  46. package/cjs/core/config-provider/merge-cck-theme/merge-cck-theme.cjs.map +1 -1
  47. package/cjs/core/config-provider/merge-theme-overrides/merge-theme-overrides.cjs +10 -0
  48. package/cjs/core/config-provider/merge-theme-overrides/merge-theme-overrides.cjs.map +1 -0
  49. package/cjs/core/config-provider/use-component-props/use-component-props.cjs +35 -0
  50. package/cjs/core/config-provider/use-component-props/use-component-props.cjs.map +1 -0
  51. package/cjs/core/responsive-style-manager/css-object-to-string/css-object-to-string.cjs.map +1 -1
  52. package/cjs/core/responsive-style-manager/normalize-number-like-string-prop/normalize-number-like-string-prop.cjs +1 -1
  53. package/cjs/core/responsive-style-manager/normalize-number-like-string-prop/normalize-number-like-string-prop.cjs.map +1 -1
  54. package/cjs/core/responsive-style-manager/responsive-style-manager.cjs.map +1 -1
  55. package/cjs/core/responsive-style-manager/styles-to-string/styles-to-string.cjs.map +1 -1
  56. package/cjs/core/styles-api/use-styles/get-class-name/get-options-class-names/get-options-class-names.cjs.map +1 -1
  57. package/cjs/core/styles-api/use-styles/get-class-name/get-resolved-class-names/get-resolved-class-names.cjs.map +1 -1
  58. package/cjs/core/styles-api/use-styles/get-class-name/get-root-class-name/get-root-class-name.cjs.map +1 -1
  59. package/cjs/core/styles-api/use-styles/get-class-name/get-selector-class-name/get-selector-class-name.cjs.map +1 -1
  60. package/cjs/core/styles-api/use-styles/get-class-name/get-static-class-names/get-static-class-names.cjs.map +1 -1
  61. package/cjs/core/styles-api/use-styles/get-class-name/get-variant-class-name/get-variant-class-name.cjs.map +1 -1
  62. package/cjs/core/utils/deep-merge/deep-merge.cjs +18 -0
  63. package/cjs/core/utils/deep-merge/deep-merge.cjs.map +1 -0
  64. package/cjs/core/utils/get-breakpoint-value/get-breakpoint-value.cjs.map +1 -1
  65. package/cjs/core/utils/get-size/get-size.cjs +2 -2
  66. package/cjs/core/utils/get-size/get-size.cjs.map +1 -1
  67. package/cjs/core/utils/get-sorted-breakpoints/get-sorted-breakpoints.cjs.map +1 -1
  68. package/cjs/core/utils/number-like-string-to-number/number-like-string-to-number.cjs.map +1 -1
  69. package/cjs/core/utils/units-converters/px.cjs.map +1 -1
  70. package/cjs/core/utils/units-converters/rem.cjs.map +1 -1
  71. package/cjs/core/utils/vue/component.cjs.map +1 -1
  72. package/cjs/core/utils/vue/install.cjs +3 -3
  73. package/cjs/core/utils/vue/install.cjs.map +1 -1
  74. package/cjs/core/utils/vue/statics.cjs +38 -0
  75. package/cjs/core/utils/vue/statics.cjs.map +1 -0
  76. package/cjs/index.cjs +12 -6
  77. package/cjs/index.cjs.map +1 -1
  78. package/esm/components/button/button.mjs +71 -63
  79. package/esm/components/button/button.mjs.map +1 -1
  80. package/esm/components/button/button.utils.mjs +29 -0
  81. package/esm/components/button/button.utils.mjs.map +1 -0
  82. package/esm/components/button/index.mjs +5 -1
  83. package/esm/components/button/index.mjs.map +1 -1
  84. package/esm/components/grid/col/col.mjs +34 -17
  85. package/esm/components/grid/col/col.mjs.map +1 -1
  86. package/esm/components/grid/grid.constants.mjs.map +1 -1
  87. package/esm/components/grid/grid.mjs +63 -34
  88. package/esm/components/grid/grid.mjs.map +1 -1
  89. package/esm/components/grid/grid.utils.mjs +12 -0
  90. package/esm/components/grid/grid.utils.mjs.map +1 -0
  91. package/esm/components/grid/index.mjs +6 -2
  92. package/esm/components/grid/index.mjs.map +1 -1
  93. package/esm/components/loader/loader.module.mjs.map +1 -1
  94. package/esm/components/loader/loaders/bars.mjs +7 -4
  95. package/esm/components/loader/loaders/bars.mjs.map +1 -1
  96. package/esm/components/loader/loaders/dots.mjs +7 -4
  97. package/esm/components/loader/loaders/dots.mjs.map +1 -1
  98. package/esm/components/loader/loaders/oval.mjs +7 -4
  99. package/esm/components/loader/loaders/oval.mjs.map +1 -1
  100. package/esm/components/unstyled-button/unstyled-button.mjs +33 -23
  101. package/esm/components/unstyled-button/unstyled-button.mjs.map +1 -1
  102. package/esm/core/box/box.mjs +40 -28
  103. package/esm/core/box/box.mjs.map +1 -1
  104. package/esm/core/box/get-box-style/get-box-style.mjs.map +1 -1
  105. package/esm/core/box/style-props/extract-style-props/extract-style-props.mjs.map +1 -1
  106. package/esm/core/box/style-props/parse-style-props/sort-media-queries.mjs.map +1 -1
  107. package/esm/core/box/style-props/resolvers/border-resolver/border-resolver.mjs.map +1 -1
  108. package/esm/core/box/style-props/resolvers/color-resolver/color-resolver.mjs.map +1 -1
  109. package/esm/core/box/style-props/resolvers/font-family-resolver/font-family-resolver.mjs.map +1 -1
  110. package/esm/core/box/style-props/resolvers/index.mjs.map +1 -1
  111. package/esm/core/box/style-props/style-props-data.mjs.map +1 -1
  112. package/esm/core/config-provider/color-functions/get-gradient/get-gradient.mjs +3 -3
  113. package/esm/core/config-provider/color-functions/get-gradient/get-gradient.mjs.map +1 -1
  114. package/esm/core/config-provider/color-functions/rgba/rgba.mjs +8 -1
  115. package/esm/core/config-provider/color-functions/rgba/rgba.mjs.map +1 -1
  116. package/esm/core/config-provider/color-functions/to-rgba/to-rgba.mjs.map +1 -1
  117. package/esm/core/config-provider/config-provider.mjs +33 -22
  118. package/esm/core/config-provider/config-provider.mjs.map +1 -1
  119. package/esm/core/config-provider/default-colors.mjs.map +1 -1
  120. package/esm/core/config-provider/index.mjs +4 -2
  121. package/esm/core/config-provider/index.mjs.map +1 -1
  122. package/esm/core/config-provider/merge-cck-theme/merge-cck-theme.mjs +2 -2
  123. package/esm/core/config-provider/merge-cck-theme/merge-cck-theme.mjs.map +1 -1
  124. package/esm/core/config-provider/merge-theme-overrides/merge-theme-overrides.mjs +10 -0
  125. package/esm/core/config-provider/merge-theme-overrides/merge-theme-overrides.mjs.map +1 -0
  126. package/esm/core/config-provider/use-component-props/use-component-props.mjs +35 -0
  127. package/esm/core/config-provider/use-component-props/use-component-props.mjs.map +1 -0
  128. package/esm/core/responsive-style-manager/css-object-to-string/css-object-to-string.mjs.map +1 -1
  129. package/esm/core/responsive-style-manager/normalize-number-like-string-prop/normalize-number-like-string-prop.mjs +1 -1
  130. package/esm/core/responsive-style-manager/normalize-number-like-string-prop/normalize-number-like-string-prop.mjs.map +1 -1
  131. package/esm/core/responsive-style-manager/responsive-style-manager.mjs.map +1 -1
  132. package/esm/core/responsive-style-manager/styles-to-string/styles-to-string.mjs.map +1 -1
  133. package/esm/core/styles-api/use-styles/get-class-name/get-options-class-names/get-options-class-names.mjs.map +1 -1
  134. package/esm/core/styles-api/use-styles/get-class-name/get-resolved-class-names/get-resolved-class-names.mjs.map +1 -1
  135. package/esm/core/styles-api/use-styles/get-class-name/get-root-class-name/get-root-class-name.mjs.map +1 -1
  136. package/esm/core/styles-api/use-styles/get-class-name/get-selector-class-name/get-selector-class-name.mjs.map +1 -1
  137. package/esm/core/styles-api/use-styles/get-class-name/get-static-class-names/get-static-class-names.mjs.map +1 -1
  138. package/esm/core/styles-api/use-styles/get-class-name/get-variant-class-name/get-variant-class-name.mjs.map +1 -1
  139. package/esm/core/utils/deep-merge/deep-merge.mjs +18 -0
  140. package/esm/core/utils/deep-merge/deep-merge.mjs.map +1 -0
  141. package/esm/core/utils/get-breakpoint-value/get-breakpoint-value.mjs.map +1 -1
  142. package/esm/core/utils/get-size/get-size.mjs +2 -2
  143. package/esm/core/utils/get-size/get-size.mjs.map +1 -1
  144. package/esm/core/utils/get-sorted-breakpoints/get-sorted-breakpoints.mjs.map +1 -1
  145. package/esm/core/utils/number-like-string-to-number/number-like-string-to-number.mjs.map +1 -1
  146. package/esm/core/utils/units-converters/px.mjs.map +1 -1
  147. package/esm/core/utils/units-converters/rem.mjs.map +1 -1
  148. package/esm/core/utils/vue/component.mjs.map +1 -1
  149. package/esm/core/utils/vue/install.mjs +2 -2
  150. package/esm/core/utils/vue/install.mjs.map +1 -1
  151. package/esm/core/utils/vue/statics.mjs +35 -0
  152. package/esm/core/utils/vue/statics.mjs.map +1 -0
  153. package/esm/index.mjs +6 -4
  154. package/esm/index.mjs.map +1 -1
  155. package/lib/components/button/button.utils.d.ts +9 -0
  156. package/lib/components/button/index.d.ts +3 -3
  157. package/lib/components/grid/grid.utils.d.ts +9 -0
  158. package/lib/components/grid/index.d.ts +6 -5
  159. package/lib/core/config-provider/color-functions/index.d.ts +1 -1
  160. package/lib/core/config-provider/color-functions/rgba/rgba.d.ts +1 -0
  161. package/lib/core/config-provider/index.d.ts +2 -0
  162. package/lib/core/config-provider/merge-theme-overrides/merge-theme-overrides.d.ts +2 -0
  163. package/lib/core/config-provider/use-component-props/use-component-props.d.ts +7 -0
  164. package/lib/core/responsive-style-manager/responsive-style-manager.d.ts +1 -0
  165. package/lib/core/styles-api/index.d.ts +1 -1
  166. package/lib/core/styles-api/use-styles/get-class-name/get-options-class-names/get-options-class-names.d.ts +1 -1
  167. package/lib/core/styles-api/use-styles/get-class-name/get-resolved-class-names/get-resolved-class-names.d.ts +1 -1
  168. package/lib/core/styles-api/use-styles/get-class-name/get-static-class-names/get-static-class-names.d.ts +1 -1
  169. package/lib/core/styles-api/use-styles/get-class-name/get-variant-class-name/get-variant-class-name.d.ts +1 -1
  170. package/lib/core/utils/deep-merge/deep-merge.d.ts +1 -0
  171. package/lib/core/utils/index.d.ts +4 -5
  172. package/lib/core/utils/vue/index.d.ts +1 -0
  173. package/lib/core/utils/vue/statics.d.ts +14 -0
  174. package/lib/core/utils/vue/typescript.d.ts +8 -0
  175. package/package.json +2 -1
  176. package/styles/loader.css +1 -2
  177. package/styles/loader.layer.css +1 -2
  178. package/styles.css +1 -2
  179. package/styles.layer.css +1 -2
  180. package/cjs/core/utils/color.cjs +0 -112
  181. package/cjs/core/utils/color.cjs.map +0 -1
  182. package/cjs/core/utils/dom/style.cjs +0 -13
  183. package/cjs/core/utils/dom/style.cjs.map +0 -1
  184. package/esm/core/utils/color.mjs +0 -110
  185. package/esm/core/utils/color.mjs.map +0 -1
  186. package/esm/core/utils/dom/style.mjs +0 -12
  187. package/esm/core/utils/dom/style.mjs.map +0 -1
  188. package/lib/core/utils/color.d.ts +0 -11
  189. package/lib/core/utils/dom/index.d.ts +0 -1
  190. package/lib/core/utils/dom/style.d.ts +0 -1
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  const require_rem = require("../../core/utils/units-converters/rem.cjs");
3
- const require_get_size = require("../../core/utils/get-size/get-size.cjs");
4
3
  const require_export_helper = require("../../_virtual/_/plugin-vue/export-helper.cjs");
4
+ const require_use_component_props = require("../../core/config-provider/use-component-props/use-component-props.cjs");
5
5
  const require_index = require("../../core/box/index.cjs");
6
- const require_create_vars_resolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
7
6
  const require_use_styles = require("../../core/styles-api/use-styles/use-styles.cjs");
8
7
  const require_button_module = require("./button.module.cjs");
9
8
  const require_index$1 = require("../unstyled-button/index.cjs");
9
+ const require_button_utils = require("./button.utils.cjs");
10
10
  const require_index$2 = require("../loader/index.cjs");
11
11
  const require_index$3 = require("../transition/index.cjs");
12
12
  let vue = require("vue");
@@ -358,7 +358,10 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
358
358
  }
359
359
  },
360
360
  setup(__props, { expose: __expose }) {
361
- __expose();
361
+ const _root = (0, vue.ref)(null);
362
+ const _inner = (0, vue.ref)(null);
363
+ const _label = (0, vue.ref)(null);
364
+ const attrs = (0, vue.useAttrs)();
362
365
  const slots = (0, vue.useSlots)();
363
366
  const hasLeftSlot = (0, vue.computed)(() => !!slots["left-section"]);
364
367
  const hasRightSlot = (0, vue.computed)(() => !!slots["right-section"]);
@@ -374,28 +377,12 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
374
377
  common: { transformOrigin: "center" },
375
378
  transitionProperty: "transform, opacity"
376
379
  };
377
- const varsResolver = require_create_vars_resolver.createVarsResolver((theme, { radius, color, gradient, variant, size, justify, autoContrast }) => {
378
- const colors = theme.variantColorResolver({
379
- color: color || theme.primaryColor,
380
- theme,
381
- gradient,
382
- variant: variant || "default",
383
- autoContrast
384
- });
385
- return { root: {
386
- "--button-justify": justify,
387
- "--button-height": require_get_size.getSize(size, "button-height"),
388
- "--button-padding-x": require_get_size.getSize(size, "button-padding-x"),
389
- "--button-fz": size?.includes("compact") ? require_get_size.getFontSize(size.replace("compact-", "")) : require_get_size.getFontSize(size),
390
- "--button-radius": radius === void 0 ? void 0 : require_get_size.getRadius(radius),
391
- "--button-bg": color || variant ? colors.background : void 0,
392
- "--button-hover": color || variant ? colors.hover : void 0,
393
- "--button-color": colors.color,
394
- "--button-bd": color || variant ? colors.border : void 0,
395
- "--button-hover-color": color || variant ? colors.hoverColor : void 0
396
- } };
380
+ const rawProps = __props;
381
+ const props = require_use_component_props.useComponentProps({
382
+ component: "CButton",
383
+ defaultProps: {},
384
+ props: rawProps
397
385
  });
398
- const props = __props;
399
386
  const knownProps = [
400
387
  "style",
401
388
  "vars",
@@ -419,46 +406,69 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
419
406
  ];
420
407
  const getStyles = require_use_styles.useStyles({
421
408
  name: "Button",
422
- props,
409
+ props: {
410
+ ...props.value,
411
+ ...attrs
412
+ },
423
413
  classes: require_button_module.default,
424
- className: props.className,
425
- style: props.style,
426
- classNames: props.classNames,
427
- styles: props.styles,
428
- unstyled: props.unstyled,
429
- attributes: props.attributes,
430
- vars: props.vars,
431
- varsResolver
414
+ className: props.value.className,
415
+ style: props.value.style,
416
+ classNames: props.value.classNames,
417
+ styles: props.value.styles,
418
+ unstyled: props.value.unstyled,
419
+ attributes: props.value.attributes,
420
+ vars: props.value.vars,
421
+ varsResolver: require_button_utils.varsResolver
422
+ });
423
+ const modList = (0, vue.computed)(() => [
424
+ { disabled: props.value.disabled || props.value.dataDisabled },
425
+ { loading: props.value.loading },
426
+ { block: props.value.fullWidth },
427
+ { "with-left-section": hasLeftSlot.value || !!props.value.leftSection },
428
+ { "with-right-section": hasRightSlot.value || !!props.value.rightSection }
429
+ ]);
430
+ const rootAttrs = (0, vue.computed)(() => getStyles("root", { active: !props.value.disabled && !props.value.loading && !props.value.dataDisabled }));
431
+ const mergedRootAttrs = (0, vue.computed)(() => {
432
+ const others = {};
433
+ const propsValue = props.value;
434
+ Object.keys(propsValue).forEach((key) => {
435
+ if (!knownProps.includes(key)) others[key] = propsValue[key];
436
+ });
437
+ const userMod = props.value.mod;
438
+ const mergedMod = [...Array.isArray(userMod) ? userMod : [userMod].filter(Boolean), ...modList.value || []];
439
+ return {
440
+ ...others,
441
+ mod: mergedMod,
442
+ ...rootAttrs.value
443
+ };
444
+ });
445
+ const innerAttrs = (0, vue.computed)(() => getStyles("inner"));
446
+ const sectionAttrs = (0, vue.computed)(() => getStyles("section"));
447
+ const labelAttrs = (0, vue.computed)(() => getStyles("label"));
448
+ __expose({
449
+ root: (0, vue.computed)(() => _root.value?.root ?? null),
450
+ inner: _inner.value,
451
+ label: _label.value
432
452
  });
433
- const rootAttrs = (0, vue.computed)(() => getStyles("root", { active: !props.disabled && !props.loading && !props.dataDisabled }));
434
453
  const __returned__ = {
454
+ _root,
455
+ _inner,
456
+ _label,
457
+ attrs,
435
458
  slots,
436
459
  hasLeftSlot,
437
460
  hasRightSlot,
438
461
  loaderTransition,
439
- varsResolver,
462
+ rawProps,
440
463
  props,
441
464
  knownProps,
442
465
  getStyles,
466
+ modList,
443
467
  rootAttrs,
444
- mergedRootAttrs: (0, vue.computed)(() => {
445
- const others = {};
446
- for (const key in props) if (!knownProps.includes(key)) others[key] = props[key];
447
- return {
448
- ...others,
449
- ...rootAttrs.value
450
- };
451
- }),
452
- innerAttrs: (0, vue.computed)(() => getStyles("inner")),
453
- sectionAttrs: (0, vue.computed)(() => getStyles("section")),
454
- labelAttrs: (0, vue.computed)(() => getStyles("label")),
455
- modList: (0, vue.computed)(() => [{
456
- disabled: props.disabled || props.dataDisabled,
457
- loading: props.loading,
458
- block: props.fullWidth,
459
- "with-left-section": hasLeftSlot.value || !!props.leftSection,
460
- "with-right-section": hasRightSlot.value || !!props.rightSection
461
- }]),
468
+ mergedRootAttrs,
469
+ innerAttrs,
470
+ sectionAttrs,
471
+ labelAttrs,
462
472
  get CBox() {
463
473
  return require_index.CBox;
464
474
  },
@@ -480,10 +490,9 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
480
490
  }
481
491
  });
482
492
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
483
- return (0, vue.openBlock)(), (0, vue.createBlock)($setup["UnstyledButton"], (0, vue.mergeProps)($setup.mergedRootAttrs, {
493
+ return (0, vue.openBlock)(), (0, vue.createBlock)($setup["UnstyledButton"], (0, vue.mergeProps)({ ref: "_root" }, $setup.mergedRootAttrs, {
484
494
  disabled: $props.disabled || $props.loading,
485
- unstyled: $props.unstyled,
486
- mod: $setup.modList
495
+ unstyled: $props.unstyled
487
496
  }), {
488
497
  default: (0, vue.withCtx)(() => [typeof $setup.props.loading === "boolean" ? ((0, vue.openBlock)(), (0, vue.createBlock)($setup["CTransition"], {
489
498
  key: 0,
@@ -491,7 +500,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
491
500
  transition: $setup.loaderTransition,
492
501
  duration: 150
493
502
  }, {
494
- default: (0, vue.withCtx)(({ styles }) => [(0, vue.createVNode)($setup["CBox"], (0, vue.mergeProps)({ tag: "span" }, $setup.getStyles("loader", { style: styles }), { "aria-hidden": "true" }), {
503
+ default: (0, vue.withCtx)(({ styles }) => [(0, vue.createVNode)($setup["CBox"], (0, vue.mergeProps)({
504
+ ref: "_inner",
505
+ tag: "span"
506
+ }, $setup.getStyles("loader", { style: styles }), { "aria-hidden": "true" }), {
495
507
  default: (0, vue.withCtx)(() => [(0, vue.createVNode)($setup["CLoader"], (0, vue.mergeProps)({
496
508
  color: "var(--button-color)",
497
509
  size: "calc(var(--button-height) / 1.8)"
@@ -514,7 +526,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
514
526
  default: (0, vue.withCtx)(() => [(0, vue.createCommentVNode)(" TODO "), ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)($props.leftSection)))]),
515
527
  _: 1
516
528
  }, 16)) : (0, vue.createCommentVNode)("v-if", true),
517
- (0, vue.createVNode)($setup["CBox"], (0, vue.mergeProps)($setup.labelAttrs, {
529
+ (0, vue.createVNode)($setup["CBox"], (0, vue.mergeProps)({ ref: "_label" }, $setup.labelAttrs, {
518
530
  tag: "span",
519
531
  mod: { loading: $props.loading }
520
532
  }), {
@@ -538,11 +550,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
538
550
  _: 3
539
551
  }, 16)]),
540
552
  _: 3
541
- }, 16, [
542
- "disabled",
543
- "unstyled",
544
- "mod"
545
- ]);
553
+ }, 16, ["disabled", "unstyled"]);
546
554
  }
547
555
  var button_default = /*#__PURE__*/ require_export_helper.default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/button/button.vue"]]);
548
556
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"button.cjs","names":[],"sources":["../../../src/components/button/button.vue"],"sourcesContent":["<template>\n <unstyled-button\n v-bind=\"mergedRootAttrs\"\n :disabled=\"disabled || loading\"\n :unstyled=\"unstyled\"\n :mod=\"modList\"\n >\n <c-transition\n v-if=\"typeof props.loading === 'boolean'\"\n :mounted=\"props.loading\"\n :transition=\"loaderTransition\"\n :duration=\"150\"\n >\n <template #default=\"{ styles }\">\n <c-box tag=\"span\" v-bind=\"getStyles('loader', { style: styles })\" aria-hidden=\"true\">\n <c-loader\n color=\"var(--button-color)\"\n size=\"calc(var(--button-height) / 1.8)\"\n v-bind=\"props.loaderProps\"\n ></c-loader>\n </c-box>\n </template>\n </c-transition>\n\n <c-box tag=\"span\" v-bind=\"innerAttrs\">\n <c-box\n v-if=\"$slots['left-section']\"\n v-bind=\"sectionAttrs\"\n tag=\"span\"\n :mod=\"{ position: 'left' }\"\n >\n <slot name=\"left-section\"></slot>\n </c-box>\n <c-box v-else-if=\"leftSection\" v-bind=\"sectionAttrs\" tag=\"span\" :mod=\"{ position: 'left' }\">\n <!-- TODO -->\n <component :is=\"leftSection\" />\n </c-box>\n <c-box v-bind=\"labelAttrs\" tag=\"span\" :mod=\"{ loading }\">\n <slot />\n </c-box>\n <c-box\n v-if=\"$slots['right-section']\"\n v-bind=\"sectionAttrs\"\n tag=\"span\"\n :mod=\"{ position: 'right' }\"\n >\n <slot name=\"right-section\"></slot>\n </c-box>\n <c-box v-else-if=\"rightSection\" v-bind=\"sectionAttrs\" tag=\"span\" :mod=\"{ position: 'right' }\">\n <!-- TODO -->\n <component :is=\"rightSection\" />\n </c-box>\n </c-box>\n </unstyled-button>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, useSlots } from 'vue'\nimport {\n CBox,\n createVarsResolver,\n getFontSize,\n getRadius,\n getSize,\n rem,\n useStyles,\n} from '../../core'\nimport { UnstyledButton } from '../unstyled-button'\nimport { ButtonFactory, type ButtonProps } from './button.types'\nimport classes from './button.module.css'\nimport { CLoader } from '../loader'\nimport { CTransition, CckTransition } from '../transition'\n\ndefineOptions({\n name: 'CButton',\n})\n\ndefineSlots<{\n 'left-section': any\n 'right-section': any\n default: any\n}>()\n\nconst slots = useSlots()\n\nconst hasLeftSlot = computed(() => !!slots['left-section'])\nconst hasRightSlot = computed(() => !!slots['right-section'])\n\nconst loaderTransition: CckTransition = {\n in: { opacity: 1, transform: `translate(-50%, calc(-50% + ${rem(1)}))` },\n out: { opacity: 0, transform: 'translate(-50%, -200%)' },\n common: { transformOrigin: 'center' },\n transitionProperty: 'transform, opacity',\n}\n\nconst varsResolver = createVarsResolver<ButtonFactory>(\n (theme, { radius, color, gradient, variant, size, justify, autoContrast }) => {\n const colors = theme.variantColorResolver({\n color: color || theme.primaryColor,\n theme,\n gradient,\n variant: variant || 'default',\n autoContrast,\n })\n\n return {\n root: {\n '--button-justify': justify,\n '--button-height': getSize(size, 'button-height'),\n '--button-padding-x': getSize(size, 'button-padding-x'),\n '--button-fz': size?.includes('compact')\n ? getFontSize(size.replace('compact-', ''))\n : getFontSize(size),\n '--button-radius': radius === undefined ? undefined : getRadius(radius),\n '--button-bg': color || variant ? colors.background : undefined,\n '--button-hover': color || variant ? colors.hover : undefined,\n '--button-color': colors.color,\n '--button-bd': color || variant ? colors.border : undefined,\n '--button-hover-color': color || variant ? colors.hoverColor : undefined,\n },\n }\n }\n)\n\nconst props = defineProps<ButtonProps>()\n\nconst knownProps = [\n 'style',\n 'vars',\n 'className',\n 'color',\n 'disabled',\n 'leftSection',\n 'rightSection',\n 'fullWidth',\n 'radius',\n 'loading',\n 'loaderProps',\n 'gradient',\n 'classNames',\n 'styles',\n 'unstyled',\n 'dataDisabled',\n 'autoContrast',\n 'mod',\n 'attributes',\n]\n\nconst getStyles = useStyles<ButtonFactory>({\n name: 'Button',\n props,\n classes,\n className: props.className,\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n unstyled: props.unstyled,\n attributes: props.attributes,\n vars: props.vars,\n varsResolver,\n})\n\nconst rootAttrs = computed(() =>\n getStyles('root', { active: !props.disabled && !props.loading && !props.dataDisabled })\n)\nconst mergedRootAttrs = computed(() => {\n const others: Record<string, any> = {}\n for (const key in props) {\n if (!knownProps.includes(key)) {\n others[key] = props[key as keyof typeof props]\n }\n }\n return { ...others, ...rootAttrs.value }\n})\n\nconst innerAttrs = computed(() => getStyles('inner'))\nconst sectionAttrs = computed(() => getStyles('section'))\nconst labelAttrs = computed(() => getStyles('label'))\n\nconst modList = computed(() => [\n {\n disabled: props.disabled || props.dataDisabled,\n loading: props.loading,\n block: props.fullWidth,\n 'with-left-section': hasLeftSlot.value || !!props.leftSection,\n 'with-right-section': hasRightSlot.value || !!props.rightSection,\n },\n])\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmFA,MAAM,SAAA,GAAA,IAAA,SAAA,CAAiB;EAEvB,MAAM,eAAA,GAAA,IAAA,SAAA,OAA6B,CAAC,CAAC,MAAM,eAAe;EAC1D,MAAM,gBAAA,GAAA,IAAA,SAAA,OAA8B,CAAC,CAAC,MAAM,gBAAgB;EAE5D,MAAM,mBAAkC;GACtC,IAAI;IAAE,SAAS;IAAG,WAAW,+BAA+B,YAAA,IAAI,CAAC,EAAE;GAAI;GACvE,KAAK;IAAE,SAAS;IAAG,WAAW;GAAyB;GACvD,QAAQ,EAAE,iBAAiB,SAAS;GACpC,oBAAoB;EACtB;EAE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AAb,QAAA,KAAA,GAAA,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,YAAA,EAAA,GAAA,IAAA,wBAAA,CACgB,OAAA,YAAY,CAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"button.cjs","names":[],"sources":["../../../src/components/button/button.vue"],"sourcesContent":["<template>\n <unstyled-button\n ref=\"_root\"\n v-bind=\"mergedRootAttrs\"\n :disabled=\"disabled || loading\"\n :unstyled=\"unstyled\"\n >\n <c-transition\n v-if=\"typeof props.loading === 'boolean'\"\n :mounted=\"props.loading\"\n :transition=\"loaderTransition\"\n :duration=\"150\"\n >\n <template #default=\"{ styles }\">\n <c-box\n ref=\"_inner\"\n tag=\"span\"\n v-bind=\"getStyles('loader', { style: styles })\"\n aria-hidden=\"true\"\n >\n <c-loader\n color=\"var(--button-color)\"\n size=\"calc(var(--button-height) / 1.8)\"\n v-bind=\"props.loaderProps\"\n ></c-loader>\n </c-box>\n </template>\n </c-transition>\n\n <c-box tag=\"span\" v-bind=\"innerAttrs\">\n <c-box\n v-if=\"$slots['left-section']\"\n v-bind=\"sectionAttrs\"\n tag=\"span\"\n :mod=\"{ position: 'left' }\"\n >\n <slot name=\"left-section\"></slot>\n </c-box>\n <c-box v-else-if=\"leftSection\" v-bind=\"sectionAttrs\" tag=\"span\" :mod=\"{ position: 'left' }\">\n <!-- TODO -->\n <component :is=\"leftSection\" />\n </c-box>\n <c-box ref=\"_label\" v-bind=\"labelAttrs\" tag=\"span\" :mod=\"{ loading }\">\n <slot />\n </c-box>\n <c-box\n v-if=\"$slots['right-section']\"\n v-bind=\"sectionAttrs\"\n tag=\"span\"\n :mod=\"{ position: 'right' }\"\n >\n <slot name=\"right-section\"></slot>\n </c-box>\n <c-box v-else-if=\"rightSection\" v-bind=\"sectionAttrs\" tag=\"span\" :mod=\"{ position: 'right' }\">\n <!-- TODO -->\n <component :is=\"rightSection\" />\n </c-box>\n </c-box>\n </unstyled-button>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs, useSlots } from 'vue'\nimport { CBox, rem, useComponentProps, useStyles } from '../../core'\nimport { UnstyledButton } from '../unstyled-button'\nimport { ButtonFactory, type ButtonProps } from './button.types'\nimport { varsResolver } from './button.utils'\nimport classes from './button.module.css'\nimport { CLoader } from '../loader'\nimport { CTransition, CckTransition } from '../transition'\n\ndefineOptions({\n name: 'CButton',\n})\n\ndefineSlots<{\n 'left-section': any\n 'right-section': any\n default: any\n}>()\n\nconst _root = ref<InstanceType<typeof UnstyledButton> | null>(null)\nconst _inner = ref<HTMLSpanElement | null>(null)\nconst _label = ref<HTMLSpanElement | null>(null)\n\nconst attrs = useAttrs()\nconst slots = useSlots()\n\nconst hasLeftSlot = computed(() => !!slots['left-section'])\nconst hasRightSlot = computed(() => !!slots['right-section'])\n\nconst loaderTransition: CckTransition = {\n in: { opacity: 1, transform: `translate(-50%, calc(-50% + ${rem(1)}))` },\n out: { opacity: 0, transform: 'translate(-50%, -200%)' },\n common: { transformOrigin: 'center' },\n transitionProperty: 'transform, opacity',\n}\n\nconst rawProps = defineProps<ButtonProps>()\n\nconst props = useComponentProps({\n component: 'CButton',\n defaultProps: {},\n props: rawProps,\n})\n\nconst knownProps = [\n 'style',\n 'vars',\n 'className',\n 'color',\n 'disabled',\n 'leftSection',\n 'rightSection',\n 'fullWidth',\n 'radius',\n 'loading',\n 'loaderProps',\n 'gradient',\n 'classNames',\n 'styles',\n 'unstyled',\n 'dataDisabled',\n 'autoContrast',\n 'mod',\n 'attributes',\n]\n\nconst getStyles = useStyles<ButtonFactory>({\n name: 'Button',\n props: { ...props.value, ...attrs } as ButtonProps,\n classes,\n className: props.value.className,\n style: props.value.style,\n classNames: props.value.classNames,\n styles: props.value.styles,\n unstyled: props.value.unstyled,\n attributes: props.value.attributes,\n vars: props.value.vars,\n varsResolver,\n})\n\nconst modList = computed(() => [\n {\n disabled: props.value.disabled || props.value.dataDisabled,\n },\n { loading: props.value.loading },\n { block: props.value.fullWidth },\n { 'with-left-section': hasLeftSlot.value || !!props.value.leftSection },\n { 'with-right-section': hasRightSlot.value || !!props.value.rightSection },\n])\n\nconst rootAttrs = computed(() =>\n getStyles('root', {\n active: !props.value.disabled && !props.value.loading && !props.value.dataDisabled,\n })\n)\nconst mergedRootAttrs = computed(() => {\n const others: Record<string, any> = {}\n const propsValue = props.value\n Object.keys(propsValue).forEach((key) => {\n if (!knownProps.includes(key)) {\n others[key] = propsValue[key as keyof typeof propsValue]\n }\n })\n const userMod = props.value.mod\n const mergedMod = [\n ...(Array.isArray(userMod) ? userMod : [userMod].filter(Boolean)),\n ...(modList.value || []),\n ]\n return { ...others, mod: mergedMod, ...rootAttrs.value }\n})\n\nconst innerAttrs = computed(() => getStyles('inner'))\nconst sectionAttrs = computed(() => getStyles('section'))\nconst labelAttrs = computed(() => getStyles('label'))\n\ndefineExpose({\n root: computed(() => _root.value?.root ?? null),\n inner: _inner.value,\n label: _label.value,\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFA,MAAM,SAAA,GAAA,IAAA,IAAA,CAAwD,IAAI;EAClE,MAAM,UAAA,GAAA,IAAA,IAAA,CAAqC,IAAI;EAC/C,MAAM,UAAA,GAAA,IAAA,IAAA,CAAqC,IAAI;EAE/C,MAAM,SAAA,GAAA,IAAA,SAAA,CAAiB;EACvB,MAAM,SAAA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D,EAAA,GAAA,IAAA,WAAA,CAAA,KAAA,QAAA,SAAA,CAAA,CAAA;;;IAGF,KAAA,OAAM,qBAAA,GAAA,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,YAAA,CAMN,OAAA,UAAA,GAAA,IAAA,WAAA,CAAA,EAAA,KAAA,EAAA,GALE,OAAA,cAAY;KACpB,KAAI;KACH,KAAK,EAAA,UAAA,QAAA;;qCAE4B,EAAA,GAAA,IAAA,WAAA,CAAA,KAAA,QAAA,eAAA,CAAA,CAAA;;cAElB,OAAA,iBAAA,GAAA,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,YAAA,CAGV,OAAA,UAAA,GAAA,IAAA,WAAA,CAAA,EAAA,KAAA,EAAA,GAHgC,OAAA,cAAY;KAAE,KAAI;KAAQ,KAAK,EAAA,UAAA,QAAA;;qCACxD,EAAA,GAAA,IAAA,mBAAA,CAAb,QAAA,KAAA,GAAA,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,YAAA,EAAA,GAAA,IAAA,wBAAA,CACgB,OAAA,YAAY,CAAA,EAAA,CAAA"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ const require_get_size = require("../../core/utils/get-size/get-size.cjs");
3
+ //#region packages/@cck-ui/core/src/components/button/button.utils.ts
4
+ const varsResolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs").createVarsResolver((theme, { radius, color, gradient, variant, size, justify, autoContrast }) => {
5
+ const colors = theme.variantColorResolver({
6
+ color: color || theme.primaryColor,
7
+ theme,
8
+ gradient,
9
+ variant: variant || "default",
10
+ autoContrast
11
+ });
12
+ return { root: {
13
+ "--button-justify": justify,
14
+ "--button-height": require_get_size.getSize(size, "button-height"),
15
+ "--button-padding-x": require_get_size.getSize(size, "button-padding-x"),
16
+ "--button-fz": size?.includes("compact") ? require_get_size.getFontSize(size.replace("compact-", "")) : require_get_size.getFontSize(size),
17
+ "--button-radius": radius === void 0 ? void 0 : require_get_size.getRadius(radius),
18
+ "--button-bg": color || variant ? colors.background : void 0,
19
+ "--button-hover": color || variant ? colors.hover : void 0,
20
+ "--button-color": colors.color,
21
+ "--button-bd": color || variant ? colors.border : void 0,
22
+ "--button-hover-color": color || variant ? colors.hoverColor : void 0
23
+ } };
24
+ });
25
+ //#endregion
26
+ exports.varsResolver = varsResolver;
27
+
28
+ //# sourceMappingURL=button.utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.utils.cjs","names":["createVarsResolver","getSize","getFontSize","getRadius"],"sources":["../../../src/components/button/button.utils.ts"],"sourcesContent":["import { createVarsResolver, getFontSize, getRadius, getSize } from '../../core'\nimport { ButtonFactory } from './button.types'\n\nexport const varsResolver = createVarsResolver<ButtonFactory>(\n (theme, { radius, color, gradient, variant, size, justify, autoContrast }) => {\n const colors = theme.variantColorResolver({\n color: color || theme.primaryColor,\n theme,\n gradient,\n variant: variant || 'default',\n autoContrast,\n })\n\n return {\n root: {\n '--button-justify': justify,\n '--button-height': getSize(size, 'button-height'),\n '--button-padding-x': getSize(size, 'button-padding-x'),\n '--button-fz': size?.includes('compact')\n ? getFontSize(size.replace('compact-', ''))\n : getFontSize(size),\n '--button-radius': radius === undefined ? undefined : getRadius(radius),\n '--button-bg': color || variant ? colors.background : undefined,\n '--button-hover': color || variant ? colors.hover : undefined,\n '--button-color': colors.color,\n '--button-bd': color || variant ? colors.border : undefined,\n '--button-hover-color': color || variant ? colors.hoverColor : undefined,\n },\n }\n }\n)\n"],"mappings":";;;AAGA,MAAa,4FAAeA,CAAAA,CAAAA,oBACzB,OAAO,EAAE,QAAQ,OAAO,UAAU,SAAS,MAAM,SAAS,mBAAmB;CAC5E,MAAM,SAAS,MAAM,qBAAqB;EACxC,OAAO,SAAS,MAAM;EACtB;EACA;EACA,SAAS,WAAW;EACpB;CACF,CAAC;CAED,OAAO,EACL,MAAM;EACJ,oBAAoB;EACpB,mBAAmBC,iBAAAA,QAAQ,MAAM,eAAe;EAChD,sBAAsBA,iBAAAA,QAAQ,MAAM,kBAAkB;EACtD,eAAe,MAAM,SAAS,SAAS,IACnCC,iBAAAA,YAAY,KAAK,QAAQ,YAAY,EAAE,CAAC,IACxCA,iBAAAA,YAAY,IAAI;EACpB,mBAAmB,WAAW,KAAA,IAAY,KAAA,IAAYC,iBAAAA,UAAU,MAAM;EACtE,eAAe,SAAS,UAAU,OAAO,aAAa,KAAA;EACtD,kBAAkB,SAAS,UAAU,OAAO,QAAQ,KAAA;EACpD,kBAAkB,OAAO;EACzB,eAAe,SAAS,UAAU,OAAO,SAAS,KAAA;EAClD,wBAAwB,SAAS,UAAU,OAAO,aAAa,KAAA;CACjE,EACF;AACF,CACF"}
@@ -1,12 +1,16 @@
1
1
  "use client";
2
2
  const require_install = require("../../core/utils/vue/install.cjs");
3
+ const require_statics = require("../../core/utils/vue/statics.cjs");
4
+ const require_button_module = require("./button.module.cjs");
5
+ const require_button_utils = require("./button.utils.cjs");
3
6
  const require_button = require("./button.cjs");
4
7
  const require_button_group_section = require("./button-group-section/button-group-section.cjs");
5
8
  const require_button_group = require("./button-group/button-group.cjs");
6
9
  //#region packages/@cck-ui/core/src/components/button/index.ts
10
+ const ButtonWithStatic = require_statics.withPropsFactory(require_statics.withExtend(require_statics.withVarsResolver(require_statics.withClasses(require_button.default, require_button_module.default), require_button_utils.varsResolver)));
7
11
  const CButtonGroup = require_install.withInstall(require_button_group.default);
8
12
  const CButtonGroupSection = require_install.withInstall(require_button_group_section.default);
9
- const CButton = require_install.withInstall(require_button.default, {
13
+ const CButton = require_install.withInstall(ButtonWithStatic, {
10
14
  ButtonGroup: require_button_group.default,
11
15
  ButtonGroupSection: require_button_group_section.default
12
16
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["withInstall","ButtonGroup","ButtonGroupSection","Button"],"sources":["../../../src/components/button/index.ts"],"sourcesContent":["import { type SFCWithInstall, withInstall } from '../../core'\nimport ButtonGroup from './button-group/button-group.vue'\nimport ButtonGroupSection from './button-group-section/button-group-section.vue'\nimport Button from './button.vue'\n\nexport const CButtonGroup: SFCWithInstall<typeof ButtonGroup> = withInstall(ButtonGroup)\nexport const CButtonGroupSection: SFCWithInstall<typeof ButtonGroupSection> =\n withInstall(ButtonGroupSection)\nexport const CButton: SFCWithInstall<typeof Button> & {\n ButtonGroup: typeof ButtonGroup\n} & { ButtonGroupSection: typeof ButtonGroupSection } = withInstall(Button, {\n ButtonGroup,\n ButtonGroupSection,\n})\nexport default CButton\n\nexport * from './button-group-section/button-group-section.types'\nexport * from './button-group/button-group.types'\nexport * from './button.types'\n"],"mappings":";;;;;;AAKA,MAAa,eAAmDA,gBAAAA,YAAYC,qBAAAA,OAAW;AACvF,MAAa,sBACXD,gBAAAA,YAAYE,6BAAAA,OAAkB;AAChC,MAAa,UAE2CF,gBAAAA,YAAYG,eAAAA,SAAQ;CAC1E,aAAA,qBAAA;CACA,oBAAA,6BAAA;AACF,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["withPropsFactory","withExtend","withVarsResolver","withClasses","Button","classes","varsResolver","withInstall","ButtonGroup","ButtonGroupSection"],"sources":["../../../src/components/button/index.ts"],"sourcesContent":["import {\n type SFCWithInstall,\n type SFCWithInstallAndClasses,\n withClasses,\n withExtend,\n withInstall,\n withPropsFactory,\n withVarsResolver,\n} from '../../core'\nimport ButtonGroup from './button-group/button-group.vue'\nimport ButtonGroupSection from './button-group-section/button-group-section.vue'\nimport Button from './button.vue'\nimport classes from './button.module.css'\n\nimport { varsResolver } from './button.utils'\n\nconst ButtonWithStatic = withPropsFactory(\n withExtend(withVarsResolver(withClasses(Button, classes), varsResolver))\n)\n\nexport const CButtonGroup: SFCWithInstall<typeof ButtonGroup> = withInstall(ButtonGroup)\nexport const CButtonGroupSection: SFCWithInstall<typeof ButtonGroupSection> =\n withInstall(ButtonGroupSection)\nexport const CButton: SFCWithInstallAndClasses<typeof Button, typeof classes> & {\n ButtonGroup: typeof ButtonGroup\n ButtonGroupSection: typeof ButtonGroupSection\n} = withInstall(ButtonWithStatic, {\n ButtonGroup,\n ButtonGroupSection,\n})\n\nexport default CButton\n\nexport * from './button-group-section/button-group-section.types'\nexport * from './button-group/button-group.types'\nexport * from './button.types'\n"],"mappings":";;;;;;;;;AAgBA,MAAM,mBAAmBA,gBAAAA,iBACvBC,gBAAAA,WAAWC,gBAAAA,iBAAiBC,gBAAAA,YAAYC,eAAAA,SAAQC,sBAAAA,OAAO,GAAGC,qBAAAA,YAAY,CAAC,CACzE;AAEA,MAAa,eAAmDC,gBAAAA,YAAYC,qBAAAA,OAAW;AACvF,MAAa,sBACXD,gBAAAA,YAAYE,6BAAAA,OAAkB;AAChC,MAAa,UAGTF,gBAAAA,YAAY,kBAAkB;CAChC,aAAA,qBAAA;CACA,oBAAA,6BAAA;AACF,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
3
3
  const require_export_helper = require("../../../_virtual/_/plugin-vue/export-helper.cjs");
4
+ const require_use_component_props = require("../../../core/config-provider/use-component-props/use-component-props.cjs");
4
5
  const require_responsive_style_manager = require("../../../core/responsive-style-manager/responsive-style-manager.cjs");
5
6
  const require_normalize_number_like_string_prop = require("../../../core/responsive-style-manager/normalize-number-like-string-prop/normalize-number-like-string-prop.cjs");
6
7
  const require_use_random_classname = require("../../../core/box/use-random-classname/use-random-classname.cjs");
@@ -17,8 +18,7 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
17
18
  props: {
18
19
  span: {
19
20
  type: null,
20
- required: false,
21
- default: 12
21
+ required: false
22
22
  },
23
23
  order: {
24
24
  type: null,
@@ -315,8 +315,13 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
315
315
  }
316
316
  },
317
317
  setup(__props, { expose: __expose }) {
318
- __expose();
319
- const props = __props;
318
+ const _col = (0, vue.ref)(null);
319
+ const rawProps = __props;
320
+ const props = require_use_component_props.useComponentProps({
321
+ component: "CCol",
322
+ defaultProps: { span: 12 },
323
+ props: rawProps
324
+ });
320
325
  const knownProps = [
321
326
  "classNames",
322
327
  "className",
@@ -329,29 +334,38 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
329
334
  "align"
330
335
  ];
331
336
  const gridContext = (0, vue.inject)(require_grid_constants.GRID_CONTEXT_KEY);
337
+ if (!gridContext) throw new Error("[@cck-ui/col] CCol component should be wrapped inside CGrid component.");
332
338
  const responsiveClassname = require_use_random_classname.useRandomClassName();
333
- const rootAttrs = (0, vue.computed)(() => gridContext.getStyles("col", {
334
- className: (0, clsx.default)(props.className, responsiveClassname),
335
- style: props.style,
336
- classNames: props.classNames,
337
- styles: props.styles
338
- }));
339
+ const rootAttrs = (0, vue.computed)(() => {
340
+ return gridContext.getStyles("col", {
341
+ className: (0, clsx.default)(props.value.className, responsiveClassname),
342
+ style: props.value.style,
343
+ classNames: props.value.classNames,
344
+ styles: props.value.styles
345
+ });
346
+ });
339
347
  const mergedAttrs = (0, vue.computed)(() => {
340
348
  const others = {};
341
- for (const key in props) if (!knownProps.includes(key)) others[key] = props[key];
349
+ const propsValue = props.value;
350
+ Object.keys(propsValue).forEach((key) => {
351
+ if (!knownProps.includes(key)) others[key] = propsValue[key];
352
+ });
353
+ const userMod = props.value.mod;
354
+ const mergedMod = [...Array.isArray(userMod) ? userMod : [userMod].filter(Boolean)];
342
355
  return {
343
356
  ...others,
357
+ mod: mergedMod,
344
358
  ...rootAttrs.value
345
359
  };
346
360
  });
347
- const _offset = require_normalize_number_like_string_prop.normalizeNumberLikeStringProp(props.offset);
348
- const _order = require_normalize_number_like_string_prop.normalizeNumberLikeStringProp(props.order);
361
+ const _offset = require_normalize_number_like_string_prop.normalizeNumberLikeStringProp(props.value.offset);
362
+ const _order = require_normalize_number_like_string_prop.normalizeNumberLikeStringProp(props.value.order);
349
363
  const colStyle = require_col_custom.useColCustomStyle({
350
364
  selector: responsiveClassname,
351
- align: props.align,
365
+ align: props.value.align,
352
366
  offset: _offset,
353
367
  order: _order,
354
- span: props.span
368
+ span: props.value.span
355
369
  }, gridContext);
356
370
  const currentStyleKey = (0, vue.ref)(null);
357
371
  (0, vue.watchEffect)(() => {
@@ -368,7 +382,10 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
368
382
  (0, vue.onUnmounted)(() => {
369
383
  if (currentStyleKey.value) require_responsive_style_manager.responsiveStyleManager.unregister(currentStyleKey.value);
370
384
  });
385
+ __expose({ root: (0, vue.computed)(() => _col.value?.root ?? null) });
371
386
  const __returned__ = {
387
+ _col,
388
+ rawProps,
372
389
  props,
373
390
  knownProps,
374
391
  gridContext,
@@ -391,7 +408,7 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
391
408
  }
392
409
  });
393
410
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
394
- return (0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.normalizeProps)((0, vue.guardReactiveProps)($setup.mergedAttrs)), {
411
+ return (0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({ ref: "_col" }, $setup.mergedAttrs), {
395
412
  default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
396
413
  _: 3
397
414
  }, 16);
@@ -1 +1 @@
1
- {"version":3,"file":"col.cjs","names":[],"sources":["../../../../src/components/grid/col/col.vue"],"sourcesContent":["<template>\n <c-box v-bind=\"mergedAttrs\">\n <slot />\n </c-box>\n</template>\n\n<script setup lang=\"ts\">\nimport cx from 'clsx'\nimport { computed, inject, onUnmounted, ref, watchEffect } from 'vue'\nimport {\n CBox,\n normalizeNumberLikeStringProp,\n responsiveStyleManager,\n useRandomClassName,\n} from '../../../core'\nimport type { ColProps } from './col.types'\nimport { useColCustomStyle } from './col-custom'\nimport { GridContextValue } from '../grid.context'\nimport { GRID_CONTEXT_KEY } from '../grid.constants'\n\ndefineOptions({\n name: 'CCol',\n})\n\nconst props = withDefaults(defineProps<ColProps>(), {\n span: 12,\n})\n\nconst knownProps = [\n 'classNames',\n 'className',\n 'style',\n 'styles',\n 'vars',\n 'span',\n 'order',\n 'offset',\n 'align',\n]\n\nconst gridContext = inject(GRID_CONTEXT_KEY) as GridContextValue\n\nconst responsiveClassname = useRandomClassName()\n\nconst rootAttrs = computed(() =>\n gridContext.getStyles('col', {\n className: cx(props.className, responsiveClassname),\n style: props.style,\n classNames: props.classNames,\n styles: props.styles,\n })\n)\nconst mergedAttrs = computed(() => {\n const others: Record<string, any> = {}\n for (const key in props) {\n if (!knownProps.includes(key)) {\n others[key] = props[key as keyof typeof props]\n }\n }\n return { ...others, ...rootAttrs.value }\n})\n\nconst _offset = normalizeNumberLikeStringProp(props.offset)\nconst _order = normalizeNumberLikeStringProp(props.order)\nconst colStyle = useColCustomStyle(\n {\n selector: responsiveClassname,\n align: props.align,\n offset: _offset,\n order: _order,\n span: props.span,\n },\n gridContext\n)\n\nconst currentStyleKey = ref<string | null>(null)\nwatchEffect(() => {\n const cssText = colStyle.value.queryStylesString\n if (cssText) {\n const newKey = responsiveStyleManager.register(cssText)\n if (currentStyleKey.value && currentStyleKey.value !== newKey) {\n responsiveStyleManager.unregister(currentStyleKey.value)\n }\n currentStyleKey.value = newKey\n } else if (currentStyleKey.value) {\n responsiveStyleManager.unregister(currentStyleKey.value)\n currentStyleKey.value = null\n }\n})\nonUnmounted(() => {\n if (currentStyleKey.value) {\n responsiveStyleManager.unregister(currentStyleKey.value)\n }\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;EACF,CAAC;EACD,CAAA,GAAA,IAAA,YAAA,OAAkB;GAChB,IAAI,gBAAgB,OAClB,iCAAA,uBAAuB,WAAW,gBAAgB,KAAK;EAE3D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;mDA1FS,OAAA,UAAA,GAAA,IAAA,eAAA,EAAA,GAAA,IAAA,mBAAA,CAFO,OAAA,WAAW,CAAA,GAAA;kCAChB,EAAA,GAAA,IAAA,WAAA,CAAA,KAAA,QAAA,SAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"col.cjs","names":[],"sources":["../../../../src/components/grid/col/col.vue"],"sourcesContent":["<template>\n <c-box ref=\"_col\" v-bind=\"mergedAttrs\">\n <slot />\n </c-box>\n</template>\n\n<script setup lang=\"ts\">\nimport cx from 'clsx'\nimport { computed, inject, onUnmounted, ref, watchEffect } from 'vue'\nimport {\n CBox,\n normalizeNumberLikeStringProp,\n responsiveStyleManager,\n useComponentProps,\n useRandomClassName,\n} from '../../../core'\nimport type { ColProps } from './col.types'\nimport { useColCustomStyle } from './col-custom'\nimport { GRID_CONTEXT_KEY } from '../grid.constants'\n\ndefineOptions({\n name: 'CCol',\n})\n\nconst _col = ref<InstanceType<typeof CBox> | null>(null)\n\nconst rawProps = defineProps<ColProps>()\n\nconst props = useComponentProps({\n component: 'CCol',\n defaultProps: {\n span: 12,\n },\n props: rawProps,\n})\n\nconst knownProps = [\n 'classNames',\n 'className',\n 'style',\n 'styles',\n 'vars',\n 'span',\n 'order',\n 'offset',\n 'align',\n]\n\nconst gridContext = inject(GRID_CONTEXT_KEY)\n\nif (!gridContext) {\n throw new Error('[@cck-ui/col] CCol component should be wrapped inside CGrid component.')\n}\n\nconst responsiveClassname = useRandomClassName()\n\nconst rootAttrs = computed(() => {\n return gridContext.getStyles('col', {\n className: cx(props.value.className, responsiveClassname),\n style: props.value.style,\n classNames: props.value.classNames,\n styles: props.value.styles,\n })\n})\n\nconst mergedAttrs = computed(() => {\n const others: Record<string, any> = {}\n const propsValue = props.value\n Object.keys(propsValue).forEach((key) => {\n if (!knownProps.includes(key)) {\n others[key] = propsValue[key as keyof typeof propsValue]\n }\n })\n const userMod = props.value.mod\n const mergedMod = [...(Array.isArray(userMod) ? userMod : [userMod].filter(Boolean))]\n return { ...others, mod: mergedMod, ...rootAttrs.value }\n})\n\nconst _offset = normalizeNumberLikeStringProp(props.value.offset)\nconst _order = normalizeNumberLikeStringProp(props.value.order)\nconst colStyle = useColCustomStyle(\n {\n selector: responsiveClassname,\n align: props.value.align,\n offset: _offset,\n order: _order,\n span: props.value.span,\n },\n gridContext\n)\n\nconst currentStyleKey = ref<string | null>(null)\nwatchEffect(() => {\n const cssText = colStyle.value.queryStylesString\n if (cssText) {\n const newKey = responsiveStyleManager.register(cssText)\n if (currentStyleKey.value && currentStyleKey.value !== newKey) {\n responsiveStyleManager.unregister(currentStyleKey.value)\n }\n currentStyleKey.value = newKey\n } else if (currentStyleKey.value) {\n responsiveStyleManager.unregister(currentStyleKey.value)\n currentStyleKey.value = null\n }\n})\nonUnmounted(() => {\n if (currentStyleKey.value) {\n responsiveStyleManager.unregister(currentStyleKey.value)\n }\n})\n\ndefineExpose({\n root: computed(() => _col.value?.root ?? null),\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,QAAA,GAAA,IAAA,IAAA,CAA6C,IAAI;EAEvD,MAAM,WAAW;EAEjB,MAAM,QAAQ,4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/C,CAAA,GAAA,IAAA,YAAA,OAAkB;GAChB,MAAM,UAAU,SAAS,MAAM;GAC/B,IAAI,SAAS;IACX,MAAM,SAAS,iCAAA,uBAAuB,SAAS,OAAO;IACtD,IAAI,gBAAgB,SAAS,gBAAgB,UAAU,QACrD,iCAAA,uBAAuB,WAAW,gBAAgB,KAAK;IAEzD,gBAAgB,QAAQ;GAC1B,OAAO,IAAI,gBAAgB,OAAO;IAChC,iCAAA,uBAAuB,WAAW,gBAAgB,KAAK;IACvD,gBAAgB,QAAQ;GAC1B;EACF,CAAC;EACD,CAAA,GAAA,IAAA,YAAA,OAAkB;GAChB,IAAI,gBAAgB,OAClB,iCAAA,uBAAuB,WAAW,gBAAgB,KAAK;EAE3D,CAAC;EAED,SAAa,EACX,OAAA,GAAA,IAAA,SAAA,OAAqB,KAAK,OAAO,QAAQ,IAAI,EAC/C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;mDA9GS,OAAA,UAAA,GAAA,IAAA,WAAA,CAAA,EAFD,KAAI,OAAM,GAAS,OAAA,WAAW,GAAA;kCAC3B,EAAA,GAAA,IAAA,WAAA,CAAA,KAAA,QAAA,SAAA,CAAA,CAAA"}
@@ -1,14 +1,15 @@
1
1
  "use client";
2
2
  const require_is_number_like = require("../../core/utils/is-number-like/is-number-like.cjs");
3
3
  const require_export_helper = require("../../_virtual/_/plugin-vue/export-helper.cjs");
4
+ const require_use_component_props = require("../../core/config-provider/use-component-props/use-component-props.cjs");
4
5
  const require_responsive_style_manager = require("../../core/responsive-style-manager/responsive-style-manager.cjs");
5
6
  const require_use_random_classname = require("../../core/box/use-random-classname/use-random-classname.cjs");
6
7
  const require_index = require("../../core/box/index.cjs");
7
- const require_create_vars_resolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs");
8
8
  const require_use_styles = require("../../core/styles-api/use-styles/use-styles.cjs");
9
9
  const require_grid_custom = require("./grid-custom.cjs");
10
10
  const require_grid_constants = require("./grid.constants.cjs");
11
11
  const require_grid_module = require("./grid.module.cjs");
12
+ const require_grid_utils = require("./grid.utils.cjs");
12
13
  let vue = require("vue");
13
14
  //#region packages/@cck-ui/core/src/components/grid/grid.vue
14
15
  const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
@@ -17,8 +18,7 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
17
18
  props: {
18
19
  gap: {
19
20
  type: null,
20
- required: false,
21
- default: "md"
21
+ required: false
22
22
  },
23
23
  rowGap: {
24
24
  type: null,
@@ -42,8 +42,7 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
42
42
  },
43
43
  columns: {
44
44
  type: [Number, String],
45
- required: false,
46
- default: 12
45
+ required: false
47
46
  },
48
47
  overflow: {
49
48
  type: null,
@@ -348,8 +347,19 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
348
347
  }
349
348
  },
350
349
  setup(__props, { expose: __expose }) {
351
- __expose();
352
- const props = __props;
350
+ const _container = (0, vue.ref)(null);
351
+ const _root = (0, vue.ref)(null);
352
+ const _inner = (0, vue.ref)(null);
353
+ const attrs = (0, vue.useAttrs)();
354
+ const rawProps = __props;
355
+ const props = require_use_component_props.useComponentProps({
356
+ component: "CGrid",
357
+ defaultProps: {
358
+ columns: 12,
359
+ gap: "md"
360
+ },
361
+ props: rawProps
362
+ });
353
363
  const knownProps = [
354
364
  "classNames",
355
365
  "className",
@@ -368,31 +378,35 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
368
378
  "type",
369
379
  "attributes"
370
380
  ];
371
- const varsResolver = require_create_vars_resolver.createVarsResolver((_, { justify, align, overflow }) => ({ root: {
372
- "--grid-align": align,
373
- "--grid-justify": justify,
374
- "--grid-overflow": overflow
375
- } }));
376
381
  const getStyles = require_use_styles.useStyles({
377
382
  name: "Grid",
378
383
  classes: require_grid_module.default,
379
- props,
380
- className: props.className,
381
- style: props.style,
382
- classNames: props.classNames,
383
- styles: props.styles,
384
- unstyled: props.unstyled,
385
- attributes: props.attributes,
386
- vars: props.vars,
387
- varsResolver
384
+ props: {
385
+ ...props.value,
386
+ ...attrs
387
+ },
388
+ className: props.value.className,
389
+ style: props.value.style,
390
+ classNames: props.value.classNames,
391
+ styles: props.value.styles,
392
+ unstyled: props.value.unstyled,
393
+ attributes: props.value.attributes,
394
+ vars: props.value.vars,
395
+ varsResolver: require_grid_utils.varsResolver
388
396
  });
389
397
  const responsiveClassname = require_use_random_classname.useRandomClassName();
390
398
  const rootAttrs = (0, vue.computed)(() => getStyles("root", { className: responsiveClassname }));
391
399
  const mergedRootAttrs = (0, vue.computed)(() => {
392
400
  const others = {};
393
- for (const key in props) if (!knownProps.includes(key)) others[key] = props[key];
401
+ const propsValue = props.value;
402
+ Object.keys(propsValue).forEach((key) => {
403
+ if (!knownProps.includes(key)) others[key] = propsValue[key];
404
+ });
405
+ const userMod = props.value.mod;
406
+ const mergedMod = [...Array.isArray(userMod) ? userMod : [userMod].filter(Boolean)];
394
407
  return {
395
408
  ...others,
409
+ mod: mergedMod,
396
410
  ...rootAttrs.value
397
411
  };
398
412
  });
@@ -417,16 +431,16 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
417
431
  (0, vue.onUnmounted)(() => {
418
432
  if (currentStyleKey.value) require_responsive_style_manager.responsiveStyleManager.unregister(currentStyleKey.value);
419
433
  });
420
- const _breakpoints = (0, vue.computed)(() => props.breakpoints);
434
+ const _breakpoints = (0, vue.computed)(() => props.value.breakpoints);
421
435
  const _columns = (0, vue.computed)(() => {
422
- if (!require_is_number_like.isNumberLike(props.columns)) {
423
- console.warn(`[C-Grid] columns should be number or number-like string, got ${props.columns}. Fallback to default columns 12.`);
436
+ if (!require_is_number_like.isNumberLike(props.value.columns)) {
437
+ console.warn(`[C-Grid] columns should be number or number-like string, got ${props.value.columns}. Fallback to default columns 12.`);
424
438
  return 12;
425
439
  }
426
- return Number(props.columns);
440
+ return Number(props.value.columns);
427
441
  });
428
- const _grow = (0, vue.computed)(() => props.grow);
429
- const _type = (0, vue.computed)(() => props.type);
442
+ const _grow = (0, vue.computed)(() => props.value.grow);
443
+ const _type = (0, vue.computed)(() => props.value.type);
430
444
  const context = {
431
445
  getStyles,
432
446
  get breakpoints() {
@@ -443,10 +457,19 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
443
457
  }
444
458
  };
445
459
  (0, vue.provide)(require_grid_constants.GRID_CONTEXT_KEY, context);
460
+ __expose({
461
+ container: (0, vue.computed)(() => _container.value?.root ?? null),
462
+ root: (0, vue.computed)(() => _root.value?.root ?? null),
463
+ inner: (0, vue.computed)(() => _inner.value?.root ?? null)
464
+ });
446
465
  const __returned__ = {
466
+ _container,
467
+ _root,
468
+ _inner,
469
+ attrs,
470
+ rawProps,
447
471
  props,
448
472
  knownProps,
449
- varsResolver,
450
473
  getStyles,
451
474
  responsiveClassname,
452
475
  rootAttrs,
@@ -472,17 +495,23 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
472
495
  }
473
496
  });
474
497
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
475
- return $props.type === "container" && $props.breakpoints ? ((0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 0 }, $setup.containerAttrs)), {
476
- default: (0, vue.withCtx)(() => [(0, vue.createVNode)($setup["CBox"], (0, vue.normalizeProps)((0, vue.guardReactiveProps)($setup.mergedRootAttrs)), {
477
- default: (0, vue.withCtx)(() => [(0, vue.createVNode)($setup["CBox"], (0, vue.normalizeProps)((0, vue.guardReactiveProps)($setup.innerAttrs)), {
498
+ return $props.type === "container" && $props.breakpoints ? ((0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({
499
+ key: 0,
500
+ ref: "_container"
501
+ }, $setup.containerAttrs), {
502
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)($setup["CBox"], (0, vue.mergeProps)({ ref: "_root" }, $setup.mergedRootAttrs), {
503
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)($setup["CBox"], (0, vue.mergeProps)({ ref: "_inner" }, $setup.innerAttrs), {
478
504
  default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
479
505
  _: 3
480
506
  }, 16)]),
481
507
  _: 3
482
508
  }, 16)]),
483
509
  _: 3
484
- }, 16)) : ((0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, $setup.mergedRootAttrs)), {
485
- default: (0, vue.withCtx)(() => [(0, vue.createVNode)($setup["CBox"], (0, vue.normalizeProps)((0, vue.guardReactiveProps)($setup.innerAttrs)), {
510
+ }, 16)) : ((0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({
511
+ key: 1,
512
+ ref: "_root"
513
+ }, $setup.mergedRootAttrs), {
514
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)($setup["CBox"], (0, vue.mergeProps)({ ref: "_inner" }, $setup.innerAttrs), {
486
515
  default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
487
516
  _: 3
488
517
  }, 16)]),