@hunter-industries/hunter-components 0.0.81 → 0.0.84

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.
@@ -2188,7 +2188,8 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2188
2188
  fill: {},
2189
2189
  stroke: {},
2190
2190
  strokeWidth: {},
2191
- flipIcon: {}
2191
+ flipIcon: {},
2192
+ aspectSquare: { type: Boolean }
2192
2193
  },
2193
2194
  setup(__props, { expose: __expose }) {
2194
2195
  const props = __props;
@@ -2206,7 +2207,6 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2206
2207
  obj.stroke = props.stroke;
2207
2208
  if (props.strokeWidth)
2208
2209
  obj.strokeWidth = props.strokeWidth;
2209
- console.log("OBJ", obj);
2210
2210
  return obj;
2211
2211
  });
2212
2212
  const hunterIcon = ref();
@@ -2216,6 +2216,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2216
2216
  if (flipIcon.value) {
2217
2217
  classes.push(`hcl-flip-icon ${flipIcon.value}`);
2218
2218
  }
2219
+ console.log("SQ", props.aspectSquare);
2219
2220
  return classes;
2220
2221
  });
2221
2222
  __expose({
@@ -2223,7 +2224,11 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2223
2224
  });
2224
2225
  return (_ctx, _cache) => {
2225
2226
  return icon.value ? (openBlock(), createBlock(resolveDynamicComponent(icon.value), mergeProps({ key: 0 }, iconProps.value, {
2226
- class: ["hcl-icon", [iconClasses.value, iconSizeClass.value, {}]],
2227
+ class: ["hcl-icon", [
2228
+ iconClasses.value,
2229
+ iconSizeClass.value,
2230
+ { "hcl-aspect-square": _ctx.aspectSquare === true }
2231
+ ]],
2227
2232
  style: { width: _ctx.width, height: _ctx.height },
2228
2233
  ref_key: "hunterIcon",
2229
2234
  ref: hunterIcon
@@ -2238,7 +2243,7 @@ const _export_sfc = (sfc, props) => {
2238
2243
  }
2239
2244
  return target;
2240
2245
  };
2241
- const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-1f4dafc5"]]);
2246
+ const Icon = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-4bbd4c4d"]]);
2242
2247
  const unitRegex = /(ch|em|rem|ex|px|cm|mm|in|pt|pc|vh|vw|vmin|vmax|svh|lvh|dvh|svw|lvw|dvw|%)$/i;
2243
2248
  const keywordOrFuncRegex = /^(auto|min-content|max-content|fit-content\(.+\)|calc\(.+\)|clamp\(.+\)|min\(.+\)|max\(.+\)|var\(--[^)]+\))$/i;
2244
2249
  const convertValueToCssSizeProperty = (value) => {
@@ -2343,7 +2348,9 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2343
2348
  height: {},
2344
2349
  type: {},
2345
2350
  useSlot: { type: Boolean },
2346
- flipIcon: {}
2351
+ flipIcon: {},
2352
+ iconButtonShape: {},
2353
+ hasShadow: { type: Boolean }
2347
2354
  },
2348
2355
  setup(__props, { expose: __expose }) {
2349
2356
  const props = __props;
@@ -2381,12 +2388,34 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2381
2388
  const buttonHeight = computed(
2382
2389
  () => convertValueToCssSizeProperty(props.height)
2383
2390
  );
2391
+ const isIconButton = computed(() => {
2392
+ var _a;
2393
+ return (_a = props.variant) == null ? void 0 : _a.includes("icon");
2394
+ });
2395
+ const buttonVariant = computed(() => {
2396
+ const v = props.variant;
2397
+ if (isIconButton.value === true && v) {
2398
+ return v.split("-")[1] || "icon_default";
2399
+ }
2400
+ return v || "primary";
2401
+ });
2384
2402
  const buttonClasses = computed(() => {
2385
- const defaultClass = `hunter-button_${props.variant ? props.variant : "primary"}`;
2403
+ console.log("TEST", isIconButton.value, buttonVariant.value);
2404
+ const defaultClass = buttonVariant.value && `hunter-button_${buttonVariant.value}`;
2405
+ console.log("DEF", defaultClass);
2386
2406
  const statusClass = props.useStatusStyles === true && status.value !== "idle" && !props.disabled ? `hunter-button_${status.value}` : void 0;
2387
2407
  const flipClass = props.icon && iconPosition.value === "left" ? "hunter-button_flip-icon-position" : void 0;
2388
2408
  const ellipsisClass = props.animatePendingEllipsis === true && status.value === "pending" ? "hunter-button_animate-ellipsis" : void 0;
2389
- return [defaultClass, statusClass, flipClass, ellipsisClass].filter(Boolean);
2409
+ const iconSizeClass = isIconButton.value === true ? `hcl-icon-size_${props.iconSize || "default"}` : void 0;
2410
+ const classes = [
2411
+ defaultClass,
2412
+ statusClass,
2413
+ flipClass,
2414
+ ellipsisClass,
2415
+ iconSizeClass
2416
+ ].filter(Boolean);
2417
+ console.log("CL", classes);
2418
+ return classes;
2390
2419
  });
2391
2420
  const buttonEl = ref(null);
2392
2421
  const buttonSpan = ref(null);
@@ -2400,7 +2429,16 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2400
2429
  return openBlock(), createElementBlock("button", {
2401
2430
  ref_key: "buttonEl",
2402
2431
  ref: buttonEl,
2403
- class: normalizeClass(["hunter-component hunter-button", [_ctx.className, ...buttonClasses.value, { disabled: _ctx.disabled }]]),
2432
+ class: normalizeClass(["hunter-component hunter-button", [
2433
+ _ctx.className,
2434
+ ...buttonClasses.value,
2435
+ {
2436
+ disabled: _ctx.disabled,
2437
+ "hunter-button_icon_circle": _ctx.iconButtonShape === "circle",
2438
+ "with-shadow": _ctx.hasShadow,
2439
+ "hunter-button_icon": isIconButton.value
2440
+ }
2441
+ ]]),
2404
2442
  style: normalizeStyle({
2405
2443
  width: buttonWidth.value,
2406
2444
  height: buttonHeight.value,
@@ -2412,25 +2450,22 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2412
2450
  onMouseover: _cache[0] || (_cache[0] = ($event) => isHovered.value = true),
2413
2451
  onMouseleave: _cache[1] || (_cache[1] = ($event) => isHovered.value = false)
2414
2452
  }, [
2415
- _ctx.variant !== "icon" && !_ctx.useSlot ? (openBlock(), createElementBlock("span", {
2453
+ !isIconButton.value && !_ctx.useSlot ? (openBlock(), createElementBlock("span", {
2416
2454
  key: 0,
2417
2455
  class: "hunter-button__label",
2418
2456
  ref_key: "buttonSpan",
2419
2457
  ref: buttonSpan
2420
2458
  }, toDisplayString(displayText.value), 513)) : createCommentVNode("", true),
2421
- _ctx.variant !== "icon" && _ctx.useSlot === true ? renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true) : createCommentVNode("", true),
2459
+ !isIconButton.value && _ctx.useSlot === true ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("", true),
2422
2460
  _ctx.icon ? (openBlock(), createBlock(Icon, {
2423
2461
  key: 2,
2424
2462
  ref_key: "buttonIcon",
2425
2463
  ref: buttonIcon,
2426
2464
  name: _ctx.icon,
2427
2465
  size: _ctx.iconSize || "default",
2428
- class: normalizeClass([
2429
- {
2430
- "hunter-button_icon": _ctx.variant === "icon"
2431
- },
2466
+ class: normalizeClass(["hunter-button__icon", [
2432
2467
  isHovered.value === true && _ctx.iconHoverClass ? [_ctx.iconHoverClass].flat().join(" ") : ""
2433
- ]),
2468
+ ]]),
2434
2469
  flipIcon: _ctx.flipIcon,
2435
2470
  className: unref(iconClass),
2436
2471
  width: _ctx.iconWidth,
@@ -2443,7 +2478,6 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2443
2478
  };
2444
2479
  }
2445
2480
  });
2446
- const Button = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-d65b8412"]]);
2447
2481
  const _hoisted_1$b = ["id"];
2448
2482
  const _hoisted_2$9 = { key: 0 };
2449
2483
  const _sfc_main$j = /* @__PURE__ */ defineComponent({
@@ -2559,7 +2593,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2559
2593
  var _a;
2560
2594
  return openBlock(), createElementBlock("div", {
2561
2595
  class: normalizeClass(["hunter-component hc__card", {
2562
- "horizontal": _ctx.variant === "horizontal",
2596
+ horizontal: _ctx.variant === "horizontal",
2563
2597
  "selected-card": isActive.value === true
2564
2598
  }]),
2565
2599
  id: cardId.value
@@ -2590,19 +2624,18 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2590
2624
  createElementVNode("div", _hoisted_7, toDisplayString(_ctx.description), 1)
2591
2625
  ]),
2592
2626
  !_ctx.hideToggleButton ? (openBlock(), createElementBlock("div", _hoisted_8, [
2593
- withDirectives(createVNode(unref(Button), {
2594
- variant: "icon",
2627
+ withDirectives(createVNode(unref(_sfc_main$k), {
2628
+ variant: "icon-primary",
2629
+ "icon-button-shape": "circle",
2595
2630
  icon: "add",
2596
- class: "hc__card__buttons__button_add",
2597
2631
  onClick: handleSetActive
2598
2632
  }, null, 512), [
2599
2633
  [vShow, !isActive.value]
2600
2634
  ]),
2601
- withDirectives(createVNode(unref(Button), {
2602
- variant: "icon",
2635
+ withDirectives(createVNode(unref(_sfc_main$k), {
2636
+ variant: "icon-primary",
2637
+ "icon-button-shape": "circle",
2603
2638
  icon: "delete",
2604
- class: "hc__card__buttons__button_delete",
2605
- iconClass: "delete-button-icon",
2606
2639
  onClick: handleSetActive
2607
2640
  }, null, 512), [
2608
2641
  [vShow, isActive.value]
@@ -3015,13 +3048,15 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3015
3048
  height: {},
3016
3049
  type: {},
3017
3050
  useSlot: { type: Boolean },
3018
- flipIcon: {}
3051
+ flipIcon: {},
3052
+ iconButtonShape: {},
3053
+ hasShadow: { type: Boolean }
3019
3054
  },
3020
3055
  setup(__props) {
3021
3056
  const props = __props;
3022
3057
  const { collapsed } = toRefs(props);
3023
3058
  return (_ctx, _cache) => {
3024
- return openBlock(), createBlock(Button, mergeProps(props, {
3059
+ return openBlock(), createBlock(_sfc_main$k, mergeProps(props, {
3025
3060
  class: ["hunter-button_dropdown", {
3026
3061
  disabled: _ctx.disabled
3027
3062
  }],
@@ -3196,7 +3231,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3196
3231
  height: {},
3197
3232
  type: {},
3198
3233
  useSlot: { type: Boolean },
3199
- flipIcon: {}
3234
+ flipIcon: {},
3235
+ iconButtonShape: {},
3236
+ hasShadow: { type: Boolean }
3200
3237
  },
3201
3238
  setup(__props) {
3202
3239
  const props = __props;
@@ -3383,8 +3420,8 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
3383
3420
  };
3384
3421
  }
3385
3422
  });
3386
- const FormInput = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-7e700c34"]]);
3387
- const _withScopeId = (n) => (pushScopeId("data-v-b640ca47"), n = n(), popScopeId(), n);
3423
+ const FormInput = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-7719e3d0"]]);
3424
+ const _withScopeId = (n) => (pushScopeId("data-v-478ffe71"), n = n(), popScopeId(), n);
3388
3425
  const _hoisted_1$3 = { class: "unit-selection-container" };
3389
3426
  const _hoisted_2$2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "font-medium" }, "Units", -1));
3390
3427
  const _hoisted_3$1 = { class: "unit-selection" };
@@ -3461,8 +3498,15 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3461
3498
  },
3462
3499
  ...formInputs.value
3463
3500
  ];
3464
- emit("submitForm", data, status.value, isValid);
3501
+ console.log("STAT", status.value, isValid);
3502
+ emit("submitForm", { inputs: data, status: status.value, isValid });
3465
3503
  if (!isValid) {
3504
+ formInputs.value.forEach((input) => {
3505
+ if (input.status !== "error") {
3506
+ input.status = "idle";
3507
+ }
3508
+ return input;
3509
+ });
3466
3510
  setTimeout(() => {
3467
3511
  status.value = "idle";
3468
3512
  }, 2500);
@@ -3581,14 +3625,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3581
3625
  ])
3582
3626
  ]),
3583
3627
  createElementVNode("div", _hoisted_6, [
3584
- createVNode(Button, mergeProps(unref(cancelButtonProps), {
3628
+ createVNode(_sfc_main$k, mergeProps(unref(cancelButtonProps), {
3585
3629
  variant: "tertiary",
3586
3630
  className: "form-button",
3587
3631
  text: _ctx.cancelButtonText,
3588
3632
  disabled: status.value === "pending" || status.value === "success",
3589
3633
  onClick: handleCancelFormClick
3590
3634
  }), null, 16, ["text", "disabled"]),
3591
- createVNode(Button, mergeProps({
3635
+ createVNode(_sfc_main$k, mergeProps({
3592
3636
  class: ["form-button form-button_submit", {
3593
3637
  "form-button_pointer-events-none": status.value === "success" && unref(successSubmitButtonDisabled) === true
3594
3638
  }]
@@ -3602,7 +3646,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
3602
3646
  };
3603
3647
  }
3604
3648
  });
3605
- const index = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-b640ca47"]]);
3649
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-478ffe71"]]);
3606
3650
  const _hoisted_1$2 = ["href"];
3607
3651
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
3608
3652
  __name: "Link",
@@ -3739,7 +3783,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3739
3783
  variant: _ctx.variant === "light" ? "light" : "dark",
3740
3784
  onClick: _cache[0] || (_cache[0] = ($event) => emit("button-click", informationEl.value))
3741
3785
  }, null, 8, ["text", "type", "variant"])) : createCommentVNode("", true),
3742
- _ctx.buttonType === "close" ? (openBlock(), createBlock(Button, {
3786
+ _ctx.buttonType === "close" ? (openBlock(), createBlock(_sfc_main$k, {
3743
3787
  key: 1,
3744
3788
  variant: "icon",
3745
3789
  onClick: _cache[1] || (_cache[1] = ($event) => emit("close", informationEl.value)),
@@ -3906,7 +3950,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3906
3950
  class: "hunter-search-input-dropdown",
3907
3951
  onSelectOption: _cache[3] || (_cache[3] = (value) => handleSelectedOption(value))
3908
3952
  }, null, 8, ["options", "option-key", "collapsed", "filter-value"]),
3909
- !_ctx.hideSearchButton ? (openBlock(), createBlock(Button, {
3953
+ !_ctx.hideSearchButton ? (openBlock(), createBlock(_sfc_main$k, {
3910
3954
  key: 0,
3911
3955
  ref_key: "searchButtonEl",
3912
3956
  ref: searchButtonEl,
@@ -3919,7 +3963,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3919
3963
  }, null, 8, ["icon-fill"])) : createCommentVNode("", true)
3920
3964
  ], 4),
3921
3965
  !_ctx.hideClearButton ? (openBlock(), createElementBlock("div", _hoisted_5, [
3922
- createVNode(Button, {
3966
+ createVNode(_sfc_main$k, {
3923
3967
  class: "underline clear-button",
3924
3968
  variant: "link",
3925
3969
  text: "Clear",
@@ -3932,7 +3976,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3932
3976
  });
3933
3977
  const SearchInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-603385ac"]]);
3934
3978
  export {
3935
- Button as HunterButton,
3979
+ _sfc_main$k as HunterButton,
3936
3980
  ButtonIcon as HunterButtonIcon,
3937
3981
  _sfc_main$i as HunterButtonToast,
3938
3982
  _sfc_main$h as HunterCard,