@leaflink/stash 46.5.0 → 46.7.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.
package/dist/Chip.js CHANGED
@@ -1,11 +1,11 @@
1
- import { defineComponent as h, useCssModule as f, openBlock as a, createElementBlock as i, normalizeClass as d, unref as l, renderSlot as u, withKeys as v, withModifiers as m, createVNode as C, createCommentVNode as b } from "vue";
2
- import _ from "./utils/colorScheme.js";
3
- import w from "./Icon.js";
4
- import { _ as $ } from "./_plugin-vue_export-helper-dad06003.js";
1
+ import { defineComponent as h, useCssModule as f, openBlock as i, createElementBlock as d, normalizeClass as n, unref as r, renderSlot as u, withKeys as b, withModifiers as m, createVNode as v, createCommentVNode as _ } from "vue";
2
+ import w from "./utils/colorScheme.js";
3
+ import C from "./Icon.js";
4
+ import { _ as y } from "./_plugin-vue_export-helper-dad06003.js";
5
5
  import "lodash-es/uniqueId";
6
6
  import "./index-79ce320f.js";
7
7
  import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
8
- const y = /* @__PURE__ */ h({
8
+ const $ = ["disabled"], z = /* @__PURE__ */ h({
9
9
  name: "ll-chip",
10
10
  __name: "Chip",
11
11
  props: {
@@ -16,67 +16,70 @@ const y = /* @__PURE__ */ h({
16
16
  bgColor: { default: void 0 },
17
17
  textColor: { default: void 0 },
18
18
  isRemovable: { type: Boolean, default: !1 },
19
- shouldOverrideColors: { type: Boolean, default: !1 }
19
+ shouldOverrideColors: { type: Boolean, default: !1 },
20
+ disabled: { type: Boolean, default: !1 }
20
21
  },
21
22
  emits: ["click", "remove"],
22
- setup(c, { emit: n }) {
23
+ setup(c, { emit: a }) {
23
24
  const e = c, s = f();
24
25
  function p() {
25
- const { computedBgColor: t, computedTextColor: o } = _({
26
+ const { computedBgColor: o, computedTextColor: t } = w({
26
27
  shade: e.shade,
27
28
  color: e.colorScheme
28
- }), r = `tw-text-${e.textColor || o} tw-bg-${e.bgColor || t}`;
29
+ }), l = `tw-text-${e.textColor || t} tw-bg-${e.bgColor || o}`;
29
30
  return {
30
31
  "tw-rounded-none": e.radius === "none",
31
32
  "tw-rounded-sm": e.radius === "standard",
32
33
  "tw-rounded-full": e.radius === "pill",
33
- [r]: !e.shouldOverrideColors
34
+ [l]: !e.shouldOverrideColors && !e.disabled,
35
+ "tw-bg-ice-500 tw-text-white": e.disabled
34
36
  };
35
37
  }
36
- return (t, o) => (a(), i("span", {
37
- class: d(["stash-chip tw-relative tw-inline-flex tw-items-center", [
38
+ return (o, t) => (i(), d("span", {
39
+ class: n(["stash-chip tw-relative tw-inline-flex tw-items-center", [
38
40
  `stash-chip--radius-${e.radius}`,
39
41
  `stash-chip--size-${e.size}`,
40
42
  `stash-chip--shade-${e.shade}`,
41
- l(s).root,
42
- l(s).removableChip,
43
- l(s)[`size-${e.size}`],
43
+ r(s).root,
44
+ r(s).removableChip,
45
+ r(s)[`size-${e.size}`],
44
46
  p()
45
47
  ]]),
46
48
  "data-test": "stash-chip",
47
- onClick: o[2] || (o[2] = (r) => n("click"))
49
+ onClick: t[2] || (t[2] = (l) => a("click"))
48
50
  }, [
49
- t.isRemovable ? (a(), i("span", {
51
+ o.isRemovable ? (i(), d("span", {
50
52
  key: 0,
51
- class: d([{ "tw-mr-6 tw-truncate": e.isRemovable }])
53
+ class: n([{ "tw-mr-6 tw-truncate": e.isRemovable }])
52
54
  }, [
53
- u(t.$slots, "default")
54
- ], 2)) : u(t.$slots, "default", { key: 1 }),
55
- e.isRemovable ? (a(), i("button", {
55
+ u(o.$slots, "default")
56
+ ], 2)) : u(o.$slots, "default", { key: 1 }),
57
+ e.isRemovable ? (i(), d("button", {
56
58
  key: 2,
57
59
  tabindex: "-1",
58
- class: d(["stash-chip__remove-button", ["tw-absolute", l(s)["remove-button"]]]),
60
+ class: n(["stash-chip__remove-button", ["tw-absolute", r(s)["remove-button"]]]),
59
61
  "data-test": "stash-chip|remove-button",
60
- onKeypress: o[0] || (o[0] = v(m((r) => n("remove"), ["prevent"]), ["enter"])),
61
- onMousedown: o[1] || (o[1] = m((r) => n("remove"), ["prevent", "stop"]))
62
+ disabled: e.disabled,
63
+ onKeypress: t[0] || (t[0] = b(m((l) => a("remove"), ["prevent"]), ["enter"])),
64
+ onMousedown: t[1] || (t[1] = m((l) => a("remove"), ["prevent", "stop"]))
62
65
  }, [
63
- C(w, {
66
+ v(C, {
64
67
  "data-test": "icon|close",
65
68
  name: "close",
66
69
  size: "small"
67
70
  })
68
- ], 34)) : b("", !0)
71
+ ], 42, $)) : _("", !0)
69
72
  ], 2));
70
73
  }
71
- }), z = "_root_jxnu3_2", x = {
72
- root: z,
73
- "size-medium": "_size-medium_jxnu3_12",
74
- "size-small": "_size-small_jxnu3_17",
75
- "remove-button": "_remove-button_jxnu3_22"
76
- }, k = {
74
+ }), k = "_root_1u8h2_2", x = {
75
+ root: k,
76
+ "size-medium": "_size-medium_1u8h2_12",
77
+ "size-small": "_size-small_1u8h2_17",
78
+ "remove-button": "_remove-button_1u8h2_22"
79
+ }, g = {
77
80
  $style: x
78
- }, N = /* @__PURE__ */ $(y, [["__cssModules", k]]);
81
+ }, V = /* @__PURE__ */ y(z, [["__cssModules", g]]);
79
82
  export {
80
- N as default
83
+ V as default
81
84
  };
82
85
  //# sourceMappingURL=Chip.js.map
package/dist/Chip.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Chip.js","sources":["../src/components/Chip/Chip.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n import { StashCommonColor, StashPrimaryColorGroup } from '../../../types/colors';\n import colorSchemeUtil from '../../utils/colorScheme';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-chip',\n });\n\n export interface ChipProps {\n /**\n * The color for the chip that determines both the text and bg color. Needs to\n * be one of the brand colors in our design system (not a shade).\n */\n colorScheme?: StashPrimaryColorGroup;\n\n /**\n * The shade of the provided color to use for the background color. This effects the inferred\n * text color unless a specific text color is provided. Currently only `light` and `main`\n * shades are supported. `dark` may be added in the future.\n */\n shade?: 'light' | 'main';\n\n /**\n * The size of the chip.\n */\n size?: 'small' | 'medium';\n\n /**\n * The type of border radius to use.\n */\n radius?: 'none' | 'standard' | 'pill';\n\n /**\n * The background color of the chip. Needs to be one of our design system colors.\n */\n bgColor?: StashCommonColor;\n\n /**\n * The color of the chip text. Needs to be one of our design system colors.\n */\n textColor?: StashCommonColor;\n\n /**\n * Determines if a close icon is surfaced.\n */\n isRemovable?: boolean;\n\n /**\n * Determines if background and text color in Chip should be overidden.\n */\n shouldOverrideColors?: boolean;\n }\n\n const props = withDefaults(defineProps<ChipProps>(), {\n size: 'medium',\n radius: 'standard',\n colorScheme: 'ice',\n shade: 'light',\n bgColor: undefined,\n textColor: undefined,\n isRemovable: false,\n shouldOverrideColors: false,\n });\n\n const emit =\n defineEmits<{\n /**\n * Fires on click of the chip.\n */\n (e: 'click'): void;\n /**\n * If `is-removable` is true, fires on click of the close button.\n */\n (e: 'remove'): void;\n }>();\n\n const classes = useCssModule();\n\n function determineConditionalStyles() {\n const { computedBgColor, computedTextColor } = colorSchemeUtil({\n shade: props.shade,\n color: props.colorScheme,\n });\n\n const colorStyles = `tw-text-${props.textColor || computedTextColor} tw-bg-${props.bgColor || computedBgColor}`;\n\n return {\n 'tw-rounded-none': props.radius === 'none',\n 'tw-rounded-sm': props.radius === 'standard',\n 'tw-rounded-full': props.radius === 'pill',\n [colorStyles]: !props.shouldOverrideColors,\n };\n }\n</script>\n\n<template>\n <span\n class=\"stash-chip tw-relative tw-inline-flex tw-items-center\"\n :class=\"[\n `stash-chip--radius-${props.radius}`,\n `stash-chip--size-${props.size}`,\n `stash-chip--shade-${props.shade}`,\n classes.root,\n classes.removableChip,\n classes[`size-${props.size}`],\n determineConditionalStyles(),\n ]\"\n data-test=\"stash-chip\"\n @click=\"emit('click')\"\n >\n <span v-if=\"isRemovable\" :class=\"[{ 'tw-mr-6 tw-truncate': props.isRemovable }]\">\n <!-- @slot Chip text -->\n <slot></slot>\n </span>\n\n <!-- Allows easier testing and DOM quering when the chip text isn't nested in an inner span -->\n <!-- @slot Chip text -->\n <slot v-else></slot>\n\n <button\n v-if=\"props.isRemovable\"\n tabindex=\"-1\"\n class=\"stash-chip__remove-button\"\n :class=\"['tw-absolute', classes['remove-button']]\"\n data-test=\"stash-chip|remove-button\"\n @keypress.enter.prevent=\"emit('remove')\"\n @mousedown.prevent.stop=\"emit('remove')\"\n >\n <Icon data-test=\"icon|close\" name=\"close\" size=\"small\" />\n </button>\n </span>\n</template>\n\n<style module>\n .root {\n /**\n * Applying these styles this way because the rule of thumb is that tailwind classes should\n * always end up taking precedence, so we're converted these specific styles to be generated\n * in a custom class instead, giving `FilterChip` (which wraps `Chip`) the ability to easily\n * override them.\n */\n @apply tw-leading-none tw-font-semibold tw-uppercase tw-text-[10px];\n }\n\n .size-medium {\n height: 20px;\n padding: 2px 8px 0 8px;\n }\n\n .size-small {\n height: 16px;\n padding: 2px 8px 0 8px;\n }\n\n .remove-button {\n border-radius: inherit;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n height: inherit;\n margin-top: -2px; /* used to offset 2px top padding from .size-medium and size-small */\n padding: 0 4px;\n right: 0;\n }\n\n .remove-button:hover {\n background: rgb(0 0 0 / 10%);\n }\n</style>\n"],"names":["classes","useCssModule","determineConditionalStyles","computedBgColor","computedTextColor","colorSchemeUtil","props","colorStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBA+EQA,IAAUC;AAEhB,aAASC,IAA6B;AACpC,YAAM,EAAE,iBAAAC,GAAiB,mBAAAC,EAAkB,IAAIC,EAAgB;AAAA,QAC7D,OAAOC,EAAM;AAAA,QACb,OAAOA,EAAM;AAAA,MAAA,CACd,GAEKC,IAAc,WAAWD,EAAM,aAAaF,CAAiB,UAAUE,EAAM,WAAWH,CAAe;AAEtG,aAAA;AAAA,QACL,mBAAmBG,EAAM,WAAW;AAAA,QACpC,iBAAiBA,EAAM,WAAW;AAAA,QAClC,mBAAmBA,EAAM,WAAW;AAAA,QACpC,CAACC,CAAW,GAAG,CAACD,EAAM;AAAA,MAAA;AAAA,IAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Chip.js","sources":["../src/components/Chip/Chip.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { useCssModule } from 'vue';\n\n import { StashCommonColor, StashPrimaryColorGroup } from '../../../types/colors';\n import colorSchemeUtil from '../../utils/colorScheme';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-chip',\n });\n\n export interface ChipProps {\n /**\n * The color for the chip that determines both the text and bg color. Needs to\n * be one of the brand colors in our design system (not a shade).\n */\n colorScheme?: StashPrimaryColorGroup;\n\n /**\n * The shade of the provided color to use for the background color. This effects the inferred\n * text color unless a specific text color is provided. Currently only `light` and `main`\n * shades are supported. `dark` may be added in the future.\n */\n shade?: 'light' | 'main';\n\n /**\n * The size of the chip.\n */\n size?: 'small' | 'medium';\n\n /**\n * The type of border radius to use.\n */\n radius?: 'none' | 'standard' | 'pill';\n\n /**\n * The background color of the chip. Needs to be one of our design system colors.\n */\n bgColor?: StashCommonColor;\n\n /**\n * The color of the chip text. Needs to be one of our design system colors.\n */\n textColor?: StashCommonColor;\n\n /**\n * Determines if a close icon is surfaced.\n */\n isRemovable?: boolean;\n\n /**\n * Determines if background and text color in Chip should be overidden.\n */\n shouldOverrideColors?: boolean;\n\n /**\n * Determines if the chip is disabled.\n */\n disabled?: boolean;\n }\n\n const props = withDefaults(defineProps<ChipProps>(), {\n size: 'medium',\n radius: 'standard',\n colorScheme: 'ice',\n shade: 'light',\n bgColor: undefined,\n textColor: undefined,\n isRemovable: false,\n shouldOverrideColors: false,\n disabled: false,\n });\n\n const emit =\n defineEmits<{\n /**\n * Fires on click of the chip.\n */\n (e: 'click'): void;\n /**\n * If `is-removable` is true, fires on click of the close button.\n */\n (e: 'remove'): void;\n }>();\n\n const classes = useCssModule();\n\n function determineConditionalStyles() {\n const { computedBgColor, computedTextColor } = colorSchemeUtil({\n shade: props.shade,\n color: props.colorScheme,\n });\n\n const colorStyles = `tw-text-${props.textColor || computedTextColor} tw-bg-${props.bgColor || computedBgColor}`;\n\n return {\n 'tw-rounded-none': props.radius === 'none',\n 'tw-rounded-sm': props.radius === 'standard',\n 'tw-rounded-full': props.radius === 'pill',\n [colorStyles]: !props.shouldOverrideColors && !props.disabled,\n 'tw-bg-ice-500 tw-text-white': props.disabled,\n };\n }\n</script>\n\n<template>\n <span\n class=\"stash-chip tw-relative tw-inline-flex tw-items-center\"\n :class=\"[\n `stash-chip--radius-${props.radius}`,\n `stash-chip--size-${props.size}`,\n `stash-chip--shade-${props.shade}`,\n classes.root,\n classes.removableChip,\n classes[`size-${props.size}`],\n determineConditionalStyles(),\n ]\"\n data-test=\"stash-chip\"\n @click=\"emit('click')\"\n >\n <span v-if=\"isRemovable\" :class=\"[{ 'tw-mr-6 tw-truncate': props.isRemovable }]\">\n <!-- @slot Chip text -->\n <slot></slot>\n </span>\n\n <!-- Allows easier testing and DOM quering when the chip text isn't nested in an inner span -->\n <!-- @slot Chip text -->\n <slot v-else></slot>\n\n <button\n v-if=\"props.isRemovable\"\n tabindex=\"-1\"\n class=\"stash-chip__remove-button\"\n :class=\"['tw-absolute', classes['remove-button']]\"\n data-test=\"stash-chip|remove-button\"\n :disabled=\"props.disabled\"\n @keypress.enter.prevent=\"emit('remove')\"\n @mousedown.prevent.stop=\"emit('remove')\"\n >\n <Icon data-test=\"icon|close\" name=\"close\" size=\"small\" />\n </button>\n </span>\n</template>\n\n<style module>\n .root {\n /**\n * Applying these styles this way because the rule of thumb is that tailwind classes should\n * always end up taking precedence, so we're converted these specific styles to be generated\n * in a custom class instead, giving `FilterChip` (which wraps `Chip`) the ability to easily\n * override them.\n */\n @apply tw-leading-none tw-font-semibold tw-uppercase tw-text-[10px];\n }\n\n .size-medium {\n height: 20px;\n padding: 2px 8px 0 8px;\n }\n\n .size-small {\n height: 16px;\n padding: 2px 8px 0 8px;\n }\n\n .remove-button {\n border-radius: inherit;\n border-top-left-radius: 0;\n border-bottom-left-radius: 0;\n height: inherit;\n margin-top: -2px; /* used to offset 2px top padding from .size-medium and size-small */\n padding: 0 4px;\n right: 0;\n }\n\n .remove-button:not(:disabled):hover {\n background: rgb(0 0 0 / 10%);\n }\n</style>\n"],"names":["classes","useCssModule","determineConditionalStyles","computedBgColor","computedTextColor","colorSchemeUtil","props","colorStyles"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;iBAqFQA,IAAUC;AAEhB,aAASC,IAA6B;AACpC,YAAM,EAAE,iBAAAC,GAAiB,mBAAAC,EAAkB,IAAIC,EAAgB;AAAA,QAC7D,OAAOC,EAAM;AAAA,QACb,OAAOA,EAAM;AAAA,MAAA,CACd,GAEKC,IAAc,WAAWD,EAAM,aAAaF,CAAiB,UAAUE,EAAM,WAAWH,CAAe;AAEtG,aAAA;AAAA,QACL,mBAAmBG,EAAM,WAAW;AAAA,QACpC,iBAAiBA,EAAM,WAAW;AAAA,QAClC,mBAAmBA,EAAM,WAAW;AAAA,QACpC,CAACC,CAAW,GAAG,CAACD,EAAM,wBAAwB,CAACA,EAAM;AAAA,QACrD,+BAA+BA,EAAM;AAAA,MAAA;AAAA,IAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -69,6 +69,10 @@ export declare interface ChipProps {
69
69
  * Determines if background and text color in Chip should be overidden.
70
70
  */
71
71
  shouldOverrideColors?: boolean;
72
+ /**
73
+ * Determines if the chip is disabled.
74
+ */
75
+ disabled?: boolean;
72
76
  }
73
77
 
74
78
  declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ChipProps>, {
@@ -80,6 +84,7 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
80
84
  textColor: undefined;
81
85
  isRemovable: boolean;
82
86
  shouldOverrideColors: boolean;
87
+ disabled: boolean;
83
88
  }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
84
89
  click: () => void;
85
90
  remove: () => void;
@@ -92,11 +97,13 @@ declare const _default: __VLS_WithTemplateSlots<DefineComponent<__VLS_WithDefaul
92
97
  textColor: undefined;
93
98
  isRemovable: boolean;
94
99
  shouldOverrideColors: boolean;
100
+ disabled: boolean;
95
101
  }>>> & {
96
102
  onClick?: (() => any) | undefined;
97
103
  onRemove?: (() => any) | undefined;
98
104
  }, {
99
105
  size: "small" | "medium";
106
+ disabled: boolean;
100
107
  shade: "main" | "light";
101
108
  colorScheme: StashPrimaryColorGroup;
102
109
  radius: "standard" | "none" | "pill";
package/dist/Dropdown.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as z, ref as u, useCssModule as I, watch as C, onMounted as q, onBeforeUnmount as K, computed as R, withDirectives as _, openBlock as v, createElementBlock as k, renderSlot as b, createElementVNode as x, normalizeClass as E, createTextVNode as U, toDisplayString as V, createVNode as S, createBlock as W, Transition as Y, withCtx as F, unref as M, normalizeStyle as j, vShow as G, nextTick as A } from "vue";
1
+ import { defineComponent as q, ref as u, useCssModule as z, watch as C, onMounted as I, onBeforeUnmount as K, computed as R, withDirectives as _, openBlock as m, createElementBlock as k, renderSlot as b, createElementVNode as x, normalizeClass as E, createTextVNode as U, toDisplayString as V, createVNode as S, createBlock as W, Transition as Y, withCtx as F, unref as M, normalizeStyle as j, vShow as G, nextTick as A } from "vue";
2
2
  import { KEY_CODES as d } from "./constants.js";
3
3
  import H from "./clickoutside.js";
4
4
  import J from "./utils/calculateElementOverflow.js";
@@ -15,7 +15,7 @@ import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
15
15
  const Z = ["aria-expanded"], ee = {
16
16
  key: 0,
17
17
  class: "tw-flex tw-items-center tw-font-medium tw-text-blue-500 hover:tw-text-blue-700"
18
- }, te = /* @__PURE__ */ z({
18
+ }, te = /* @__PURE__ */ q({
19
19
  name: "ll-dropdown",
20
20
  __name: "Dropdown",
21
21
  props: {
@@ -29,12 +29,12 @@ const Z = ["aria-expanded"], ee = {
29
29
  },
30
30
  emits: ["toggle", "dismiss"],
31
31
  setup(D, { expose: $, emit: p }) {
32
- const a = D, t = u(null), w = u(null), f = [], s = u(f), i = u(-1), o = u(!1), g = u({}), L = I();
32
+ const a = D, t = u(null), w = u(null), f = [], s = u(f), i = u(-1), o = u(!1), g = u({}), L = z();
33
33
  C(o, (e) => {
34
34
  e || (i.value = -1), p("toggle", e);
35
35
  }), C(i, (e, l) => {
36
36
  e in s.value && s.value[e].classList.add("tw-bg-ice-200"), l in s.value && s.value[l].classList.remove("tw-bg-ice-200");
37
- }), q(() => {
37
+ }), I(() => {
38
38
  var e, l, n;
39
39
  if (a.reattach) {
40
40
  const c = Q();
@@ -52,7 +52,7 @@ const Z = ["aria-expanded"], ee = {
52
52
  const l = o.value;
53
53
  o.value = !1, l && p("dismiss");
54
54
  }
55
- async function m() {
55
+ async function v() {
56
56
  var e;
57
57
  o.value ? o.value = !1 : (o.value = !0, await O(), (e = t.value) == null || e.focus());
58
58
  }
@@ -94,9 +94,9 @@ const Z = ["aria-expanded"], ee = {
94
94
  }
95
95
  return $({
96
96
  isActive: R(() => o.value),
97
- toggle: m,
97
+ toggle: v,
98
98
  dismiss: r
99
- }), (e, l) => _((v(), k("div", {
99
+ }), (e, l) => _((m(), k("div", {
100
100
  ref_key: "dropdownRef",
101
101
  ref: w,
102
102
  class: "tw-relative tw-inline-block",
@@ -105,18 +105,18 @@ const Z = ["aria-expanded"], ee = {
105
105
  }, [
106
106
  b(e.$slots, "toggle", {
107
107
  isActive: o.value,
108
- toggle: m
108
+ toggle: v
109
109
  }, () => [
110
110
  x("button", {
111
111
  "data-test": "button|toggle",
112
112
  "aria-expanded": o.value,
113
113
  class: E([e.label ? "button--tertiary tw-min-w-auto tw-outline-none" : "button--icon button tw-rounded"]),
114
- onClick: m
114
+ onClick: v
115
115
  }, [
116
- e.label ? (v(), k("span", ee, [
116
+ e.label ? (m(), k("span", ee, [
117
117
  U(V(e.label) + " ", 1),
118
118
  S(B, { name: "caret-down" })
119
- ])) : (v(), W(B, {
119
+ ])) : (m(), W(B, {
120
120
  key: 1,
121
121
  name: "ellipsis"
122
122
  }))
@@ -156,7 +156,7 @@ const Z = ["aria-expanded"], ee = {
156
156
  [M(H), r]
157
157
  ]);
158
158
  }
159
- }), oe = "_content_vy8m8_2", le = {
159
+ }), oe = "_content_9qi8v_2", le = {
160
160
  content: oe
161
161
  }, ae = {
162
162
  $style: le
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sources":["../src/components/Dropdown/Dropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, nextTick, onBeforeUnmount, onMounted, ref, useCssModule, watch } from 'vue';\n\n import { KEY_CODES } from '../../constants';\n import vClickoutside from '../../directives/clickoutside/clickoutside';\n import calculateElementOverflow from '../../utils/calculateElementOverflow';\n import { getMountPoint } from '../../utils/helpers';\n import Icon from '../Icon/Icon.vue';\n\n export type DropdownOffset = {\n x?: number;\n y?: number;\n };\n\n export interface DropdownProps {\n /**\n * Used to position the dropdown relative to target\n * Options: left, right\n */\n align?: 'left' | 'right';\n /**\n * When passed, text with caret is displayed instead of default kebab menu.\n */\n label?: string;\n /**\n * If true, dropdown will remain open when clicking on its content. Otherwise, it'll close automatically on click.\n */\n closeManually?: boolean;\n /**\n * Used to horizontally and vertically offset the dropdown in pixels\n * Keep in mind, `x` value is relative to `align` value.\n */\n offset?: DropdownOffset;\n /**\n * If `reattach` is true, the contents will be mounted in the mount point container,\n * so as to circumvent clipping issues from a parent's overflow property.\n */\n reattach?: boolean;\n /**\n * Custom class to apply to the default dropdown content element\n */\n contentClass?: string | string[];\n /**\n * Removes content container's max width\n */\n fluidContent?: boolean;\n }\n\n type DropdownStyles = {\n left?: string;\n right?: string;\n top?: string;\n };\n\n defineOptions({\n name: 'll-dropdown',\n });\n\n const props = withDefaults(defineProps<DropdownProps>(), {\n align: 'right',\n label: '',\n closeManually: false,\n offset: () => ({}),\n reattach: true,\n contentClass: '',\n fluidContent: false,\n });\n\n const emit =\n defineEmits<{\n toggle: [isActive: boolean];\n dismiss: [];\n }>();\n\n const contentRef = ref<HTMLElement | null>(null);\n const dropdownRef = ref<HTMLDivElement | null>(null);\n\n const DEFAULT_ITEMS_LIST = [] as unknown as NodeListOf<Element>;\n\n const items = ref<NodeListOf<Element>>(DEFAULT_ITEMS_LIST);\n const itemIndex = ref(-1);\n const isActive = ref(false);\n\n const styles = ref<DropdownStyles>({});\n const classes = useCssModule();\n\n watch(isActive, (val) => {\n if (!val) {\n itemIndex.value = -1;\n }\n\n emit('toggle', val);\n });\n\n watch(itemIndex, (next, prev) => {\n next in items.value && items.value[next].classList.add('tw-bg-ice-200');\n prev in items.value && items.value[prev].classList.remove('tw-bg-ice-200');\n });\n\n onMounted(() => {\n if (props.reattach) {\n const target = getMountPoint();\n\n contentRef.value && target.appendChild(contentRef.value);\n }\n\n // if stash-menu exists, use it's items\n if (contentRef.value?.querySelector('.stash-menu')) {\n items.value = contentRef.value?.querySelectorAll('.stash-menu-item') ?? DEFAULT_ITEMS_LIST;\n } else {\n items.value = contentRef.value?.querySelectorAll('.dropdown__item') ?? DEFAULT_ITEMS_LIST;\n }\n\n // avoid calling dismiss with ResizeEvent because it's target is the Window element and it's not a valid Node element to be passed to dismiss\n window.addEventListener('resize', () => dismiss());\n });\n\n onBeforeUnmount(() => {\n window.removeEventListener('resize', () => dismiss());\n contentRef?.value?.parentNode?.removeChild(contentRef.value);\n });\n\n /**\n * Dismisses the Dropdown.\n */\n function dismiss(event?: Event) {\n if (\n props.closeManually &&\n (contentRef.value?.contains(event?.target as HTMLElement) || contentRef.value === event?.target)\n ) {\n return;\n }\n\n const wasOpen = isActive.value;\n\n isActive.value = false;\n\n if (wasOpen) {\n emit('dismiss');\n }\n }\n\n /**\n * Opens or closes the Dropdown. If opening, positions and focuses its content.\n */\n async function toggle() {\n if (isActive.value) {\n isActive.value = false;\n } else {\n isActive.value = true;\n await calculateOffset();\n contentRef.value?.focus();\n }\n }\n\n /**\n * Handles all user keyboard input on the Dropdown.\n * @param {KeyboardEvent} e The native keydown event.\n */\n function onKeyDown(e: KeyboardEvent) {\n if (e.keyCode === KEY_CODES.ESCAPE) {\n dismiss();\n } else if (e.keyCode === KEY_CODES.DOWN && itemIndex.value < items.value.length - 1) {\n isActive.value && itemIndex.value++;\n } else if (e.keyCode === KEY_CODES.UP && itemIndex.value > -1) {\n isActive.value && itemIndex.value--;\n } else if (e.keyCode === KEY_CODES.ENTER && itemIndex.value !== -1) {\n isActive.value && items[itemIndex.value].click();\n } else {\n return;\n }\n\n e.preventDefault(); // if keyDown did something / we didn't return\n }\n\n /**\n * Reset any page overflow offset\n */\n function resetOffset() {\n contentRef.value?.style.setProperty('--offset', '0');\n }\n\n /**\n * Calculate the position for the Dropdown content element,\n * relative to the viewport.\n * Repositions the dropdown content element (& arrow)\n * if it overflows the page (including gutter).\n */\n async function calculateOffset() {\n await nextTick();\n\n const toggleBCR = dropdownRef.value?.getBoundingClientRect() || ({} as DOMRect);\n const top = toggleBCR.top + toggleBCR.height;\n const offset = {\n x: 0,\n y: 0,\n ...props.offset,\n };\n\n if (props.reattach) {\n styles.value = {\n left: props.align === 'left' ? `${Math.round(toggleBCR.left) + offset.x}px` : undefined,\n right:\n props.align === 'right'\n ? `${document.documentElement.clientWidth - Math.round(toggleBCR.right) + offset.x}px`\n : undefined,\n top: `${window.scrollY + top + offset.y}px`,\n };\n await nextTick(); // wait for style updates to sync in the DOM\n }\n\n const overflow = calculateElementOverflow(contentRef?.value);\n\n if (overflow) {\n const direction = props.align === 'left' ? '-' : '';\n contentRef.value?.style.setProperty('--offset', `${direction}${overflow.value}`);\n }\n }\n\n defineExpose({\n isActive: computed(() => isActive.value),\n toggle,\n dismiss,\n });\n</script>\n\n<template>\n <div\n ref=\"dropdownRef\"\n v-clickoutside=\"dismiss\"\n class=\"tw-relative tw-inline-block\"\n data-test=\"ll-dropdown\"\n @keydown=\"onKeyDown\"\n >\n <!-- @slot Toggle component slot, receives `toggle` method to trigger Dropdown display -->\n <slot name=\"toggle\" :is-active=\"isActive\" :toggle=\"toggle\">\n <button\n data-test=\"button|toggle\"\n :aria-expanded=\"isActive\"\n :class=\"[label ? 'button--tertiary tw-min-w-auto tw-outline-none' : 'button--icon button tw-rounded']\"\n @click=\"toggle\"\n >\n <span v-if=\"label\" class=\"tw-flex tw-items-center tw-font-medium tw-text-blue-500 hover:tw-text-blue-700\">\n {{ label }}\n <Icon name=\"caret-down\" />\n </span>\n <Icon v-else name=\"ellipsis\" />\n </button>\n </slot>\n\n <transition name=\"fade\" @after-leave=\"resetOffset\">\n <div\n v-show=\"isActive\"\n ref=\"contentRef\"\n data-test=\"ll-dropdown-content\"\n :class=\"[\n classes.content,\n contentClass,\n {\n 'tw-left-0 after:tw-left-6': props.align === 'left',\n 'tw-right-0': props.align === 'right',\n 'tw-max-w-[360px]': !props.fluidContent,\n },\n ]\"\n :style=\"styles\"\n >\n <!-- @slot Dropdown content slot. Receives `dismiss` method, to trigger manual close. You must call dismiss with parentheses. Receives `is-active` prop. -->\n <slot :dismiss=\"dismiss\" :is-active=\"isActive\"></slot>\n </div>\n </transition>\n </div>\n</template>\n\n<style module>\n .content {\n --offset: 0;\n\n @apply tw-shadow\n tw-bg-white\n tw-border\n tw-border-solid\n tw-border-blue-500\n tw-rounded\n tw-absolute\n tw-z-control\n tw-min-w-[200px];\n\n transform: translateX(calc(var(--offset) * 1px));\n }\n\n /**\n * TODO: these global styles should be componentized in https://leaflink.atlassian.net/browse/STASH-566\n */\n :global(.dropdown__list) {\n @apply tw-bg-white tw-list-none tw-m-1.5 tw-p-0;\n }\n\n :global(.dropdown__item) {\n @apply tw-block tw-mx-0 tw-mt-0 tw-mb-1.5 tw-w-full first:tw-mt-0 last:tw-mb-0;\n }\n\n :global(.dropdown__item) button {\n @apply tw-border-none tw-text-left tw-p-1.5;\n }\n\n :global(.dropdown__item) :where(a, button) {\n @apply tw-rounded\n tw-text-ice-700\n tw-block\n tw-py-[10px]\n tw-px-1.5\n tw-w-full\n disabled:tw-text-ice-500\n disabled:tw-cursor-default\n hover:tw-bg-ice-200\n hover:tw-text-ice-700\n hover:tw-no-underline\n tw-transition-all\n tw-duration-fast\n tw-ease-swing;\n }\n</style>\n"],"names":["contentRef","ref","dropdownRef","DEFAULT_ITEMS_LIST","items","itemIndex","isActive","styles","classes","useCssModule","watch","val","emit","next","prev","onMounted","props","target","getMountPoint","_a","_b","_c","dismiss","onBeforeUnmount","event","wasOpen","toggle","calculateOffset","onKeyDown","KEY_CODES","resetOffset","nextTick","toggleBCR","top","offset","overflow","calculateElementOverflow","direction","__expose","computed"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0EQA,IAAaC,EAAwB,IAAI,GACzCC,IAAcD,EAA2B,IAAI,GAE7CE,IAAqB,CAAA,GAErBC,IAAQH,EAAyBE,CAAkB,GACnDE,IAAYJ,EAAI,EAAE,GAClBK,IAAWL,EAAI,EAAK,GAEpBM,IAASN,EAAoB,CAAA,CAAE,GAC/BO,IAAUC;AAEV,IAAAC,EAAAJ,GAAU,CAACK,MAAQ;AACvB,MAAKA,MACHN,EAAU,QAAQ,KAGpBO,EAAK,UAAUD,CAAG;AAAA,IAAA,CACnB,GAEKD,EAAAL,GAAW,CAACQ,GAAMC,MAAS;AACvB,MAAAD,KAAAT,EAAM,SAASA,EAAM,MAAMS,CAAI,EAAE,UAAU,IAAI,eAAe,GAC9DC,KAAAV,EAAM,SAASA,EAAM,MAAMU,CAAI,EAAE,UAAU,OAAO,eAAe;AAAA,IAAA,CAC1E,GAEDC,EAAU,MAAM;;AACd,UAAIC,EAAM,UAAU;AAClB,cAAMC,IAASC;AAEf,QAAAlB,EAAW,SAASiB,EAAO,YAAYjB,EAAW,KAAK;AAAA,MACzD;AAGA,OAAImB,IAAAnB,EAAW,UAAX,QAAAmB,EAAkB,cAAc,iBAClCf,EAAM,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;;AACrB,OAAAX,IAAAnB,EAAW,UAAX,QAAAmB,EAAkB,MAAM,YAAY,YAAY;AAAA,IAClD;AAQA,mBAAeQ,IAAkB;;AAC/B,YAAMI,EAAS;AAEf,YAAMC,MAAYb,IAAAjB,EAAY,UAAZ,gBAAAiB,EAAmB,4BAA4B,CAAA,GAC3Dc,IAAMD,EAAU,MAAMA,EAAU,QAChCE,IAAS;AAAA,QACb,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAGlB,EAAM;AAAA,MAAA;AAGX,MAAIA,EAAM,aACRT,EAAO,QAAQ;AAAA,QACb,MAAMS,EAAM,UAAU,SAAS,GAAG,KAAK,MAAMgB,EAAU,IAAI,IAAIE,EAAO,CAAC,OAAO;AAAA,QAC9E,OACElB,EAAM,UAAU,UACZ,GAAG,SAAS,gBAAgB,cAAc,KAAK,MAAMgB,EAAU,KAAK,IAAIE,EAAO,CAAC,OAChF;AAAA,QACN,KAAK,GAAG,OAAO,UAAUD,IAAMC,EAAO,CAAC;AAAA,MAAA,GAEzC,MAAMH,EAAS;AAGX,YAAAI,IAAWC,EAAyBpC,KAAA,gBAAAA,EAAY,KAAK;AAE3D,UAAImC,GAAU;AACZ,cAAME,IAAYrB,EAAM,UAAU,SAAS,MAAM;AACtC,SAAAI,IAAApB,EAAA,UAAA,QAAAoB,EAAO,MAAM,YAAY,YAAY,GAAGiB,CAAS,GAAGF,EAAS,KAAK;AAAA,MAC/E;AAAA,IACF;AAEa,WAAAG,EAAA;AAAA,MACX,UAAUC,EAAS,MAAMjC,EAAS,KAAK;AAAA,MACvC,QAAAoB;AAAA,MACA,SAAAJ;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Dropdown.js","sources":["../src/components/Dropdown/Dropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, nextTick, onBeforeUnmount, onMounted, ref, useCssModule, watch } from 'vue';\n\n import { KEY_CODES } from '../../constants';\n import vClickoutside from '../../directives/clickoutside/clickoutside';\n import calculateElementOverflow from '../../utils/calculateElementOverflow';\n import { getMountPoint } from '../../utils/helpers';\n import Icon from '../Icon/Icon.vue';\n\n export type DropdownOffset = {\n x?: number;\n y?: number;\n };\n\n export interface DropdownProps {\n /**\n * Used to position the dropdown relative to target\n * Options: left, right\n */\n align?: 'left' | 'right';\n /**\n * When passed, text with caret is displayed instead of default kebab menu.\n */\n label?: string;\n /**\n * If true, dropdown will remain open when clicking on its content. Otherwise, it'll close automatically on click.\n */\n closeManually?: boolean;\n /**\n * Used to horizontally and vertically offset the dropdown in pixels\n * Keep in mind, `x` value is relative to `align` value.\n */\n offset?: DropdownOffset;\n /**\n * If `reattach` is true, the contents will be mounted in the mount point container,\n * so as to circumvent clipping issues from a parent's overflow property.\n */\n reattach?: boolean;\n /**\n * Custom class to apply to the default dropdown content element\n */\n contentClass?: string | string[];\n /**\n * Removes content container's max width\n */\n fluidContent?: boolean;\n }\n\n type DropdownStyles = {\n left?: string;\n right?: string;\n top?: string;\n };\n\n defineOptions({\n name: 'll-dropdown',\n });\n\n const props = withDefaults(defineProps<DropdownProps>(), {\n align: 'right',\n label: '',\n closeManually: false,\n offset: () => ({}),\n reattach: true,\n contentClass: '',\n fluidContent: false,\n });\n\n const emit =\n defineEmits<{\n toggle: [isActive: boolean];\n dismiss: [];\n }>();\n\n const contentRef = ref<HTMLElement | null>(null);\n const dropdownRef = ref<HTMLDivElement | null>(null);\n\n const DEFAULT_ITEMS_LIST = [] as unknown as NodeListOf<Element>;\n\n const items = ref<NodeListOf<Element>>(DEFAULT_ITEMS_LIST);\n const itemIndex = ref(-1);\n const isActive = ref(false);\n\n const styles = ref<DropdownStyles>({});\n const classes = useCssModule();\n\n watch(isActive, (val) => {\n if (!val) {\n itemIndex.value = -1;\n }\n\n emit('toggle', val);\n });\n\n watch(itemIndex, (next, prev) => {\n next in items.value && items.value[next].classList.add('tw-bg-ice-200');\n prev in items.value && items.value[prev].classList.remove('tw-bg-ice-200');\n });\n\n onMounted(() => {\n if (props.reattach) {\n const target = getMountPoint();\n\n contentRef.value && target.appendChild(contentRef.value);\n }\n\n // if stash-menu exists, use it's items\n if (contentRef.value?.querySelector('.stash-menu')) {\n items.value = contentRef.value?.querySelectorAll('.stash-menu-item') ?? DEFAULT_ITEMS_LIST;\n } else {\n items.value = contentRef.value?.querySelectorAll('.dropdown__item') ?? DEFAULT_ITEMS_LIST;\n }\n\n // avoid calling dismiss with ResizeEvent because it's target is the Window element and it's not a valid Node element to be passed to dismiss\n window.addEventListener('resize', () => dismiss());\n });\n\n onBeforeUnmount(() => {\n window.removeEventListener('resize', () => dismiss());\n contentRef?.value?.parentNode?.removeChild(contentRef.value);\n });\n\n /**\n * Dismisses the Dropdown.\n */\n function dismiss(event?: Event) {\n if (\n props.closeManually &&\n (contentRef.value?.contains(event?.target as HTMLElement) || contentRef.value === event?.target)\n ) {\n return;\n }\n\n const wasOpen = isActive.value;\n\n isActive.value = false;\n\n if (wasOpen) {\n emit('dismiss');\n }\n }\n\n /**\n * Opens or closes the Dropdown. If opening, positions and focuses its content.\n */\n async function toggle() {\n if (isActive.value) {\n isActive.value = false;\n } else {\n isActive.value = true;\n await calculateOffset();\n contentRef.value?.focus();\n }\n }\n\n /**\n * Handles all user keyboard input on the Dropdown.\n * @param {KeyboardEvent} e The native keydown event.\n */\n function onKeyDown(e: KeyboardEvent) {\n if (e.keyCode === KEY_CODES.ESCAPE) {\n dismiss();\n } else if (e.keyCode === KEY_CODES.DOWN && itemIndex.value < items.value.length - 1) {\n isActive.value && itemIndex.value++;\n } else if (e.keyCode === KEY_CODES.UP && itemIndex.value > -1) {\n isActive.value && itemIndex.value--;\n } else if (e.keyCode === KEY_CODES.ENTER && itemIndex.value !== -1) {\n isActive.value && items[itemIndex.value].click();\n } else {\n return;\n }\n\n e.preventDefault(); // if keyDown did something / we didn't return\n }\n\n /**\n * Reset any page overflow offset\n */\n function resetOffset() {\n contentRef.value?.style.setProperty('--offset', '0');\n }\n\n /**\n * Calculate the position for the Dropdown content element,\n * relative to the viewport.\n * Repositions the dropdown content element (& arrow)\n * if it overflows the page (including gutter).\n */\n async function calculateOffset() {\n await nextTick();\n\n const toggleBCR = dropdownRef.value?.getBoundingClientRect() || ({} as DOMRect);\n const top = toggleBCR.top + toggleBCR.height;\n const offset = {\n x: 0,\n y: 0,\n ...props.offset,\n };\n\n if (props.reattach) {\n styles.value = {\n left: props.align === 'left' ? `${Math.round(toggleBCR.left) + offset.x}px` : undefined,\n right:\n props.align === 'right'\n ? `${document.documentElement.clientWidth - Math.round(toggleBCR.right) + offset.x}px`\n : undefined,\n top: `${window.scrollY + top + offset.y}px`,\n };\n await nextTick(); // wait for style updates to sync in the DOM\n }\n\n const overflow = calculateElementOverflow(contentRef?.value);\n\n if (overflow) {\n const direction = props.align === 'left' ? '-' : '';\n contentRef.value?.style.setProperty('--offset', `${direction}${overflow.value}`);\n }\n }\n\n defineExpose({\n isActive: computed(() => isActive.value),\n toggle,\n dismiss,\n });\n</script>\n\n<template>\n <div\n ref=\"dropdownRef\"\n v-clickoutside=\"dismiss\"\n class=\"tw-relative tw-inline-block\"\n data-test=\"ll-dropdown\"\n @keydown=\"onKeyDown\"\n >\n <!-- @slot Toggle component slot, receives `toggle` method to trigger Dropdown display -->\n <slot name=\"toggle\" :is-active=\"isActive\" :toggle=\"toggle\">\n <button\n data-test=\"button|toggle\"\n :aria-expanded=\"isActive\"\n :class=\"[label ? 'button--tertiary tw-min-w-auto tw-outline-none' : 'button--icon button tw-rounded']\"\n @click=\"toggle\"\n >\n <span v-if=\"label\" class=\"tw-flex tw-items-center tw-font-medium tw-text-blue-500 hover:tw-text-blue-700\">\n {{ label }}\n <Icon name=\"caret-down\" />\n </span>\n <Icon v-else name=\"ellipsis\" />\n </button>\n </slot>\n\n <transition name=\"fade\" @after-leave=\"resetOffset\">\n <div\n v-show=\"isActive\"\n ref=\"contentRef\"\n data-test=\"ll-dropdown-content\"\n :class=\"[\n classes.content,\n contentClass,\n {\n 'tw-left-0 after:tw-left-6': props.align === 'left',\n 'tw-right-0': props.align === 'right',\n 'tw-max-w-[360px]': !props.fluidContent,\n },\n ]\"\n :style=\"styles\"\n >\n <!-- @slot Dropdown content slot. Receives `dismiss` method, to trigger manual close. You must call dismiss with parentheses. Receives `is-active` prop. -->\n <slot :dismiss=\"dismiss\" :is-active=\"isActive\"></slot>\n </div>\n </transition>\n </div>\n</template>\n\n<style module>\n .content {\n --offset: 0;\n\n @apply tw-shadow\n tw-bg-white\n tw-border\n tw-border-solid\n tw-border-blue-500\n tw-rounded\n tw-absolute\n tw-z-[301]\n tw-min-w-[200px];\n\n transform: translateX(calc(var(--offset) * 1px));\n }\n\n /**\n * TODO: these global styles should be componentized in https://leaflink.atlassian.net/browse/STASH-566\n */\n :global(.dropdown__list) {\n @apply tw-bg-white tw-list-none tw-m-1.5 tw-p-0;\n }\n\n :global(.dropdown__item) {\n @apply tw-block tw-mx-0 tw-mt-0 tw-mb-1.5 tw-w-full first:tw-mt-0 last:tw-mb-0;\n }\n\n :global(.dropdown__item) button {\n @apply tw-border-none tw-text-left tw-p-1.5;\n }\n\n :global(.dropdown__item) :where(a, button) {\n @apply tw-rounded\n tw-text-ice-700\n tw-block\n tw-py-[10px]\n tw-px-1.5\n tw-w-full\n disabled:tw-text-ice-500\n disabled:tw-cursor-default\n hover:tw-bg-ice-200\n hover:tw-text-ice-700\n hover:tw-no-underline\n tw-transition-all\n tw-duration-fast\n tw-ease-swing;\n }\n</style>\n"],"names":["contentRef","ref","dropdownRef","DEFAULT_ITEMS_LIST","items","itemIndex","isActive","styles","classes","useCssModule","watch","val","emit","next","prev","onMounted","props","target","getMountPoint","_a","_b","_c","dismiss","onBeforeUnmount","event","wasOpen","toggle","calculateOffset","onKeyDown","KEY_CODES","resetOffset","nextTick","toggleBCR","top","offset","overflow","calculateElementOverflow","direction","__expose","computed"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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ACZ,GAAG,SAAS,gBAAgB,cAAc,KAAK,MAAMgB,EAAU,KAAK,IAAIE,EAAO,CAAC,OAChF;AAAA,QACN,KAAK,GAAG,OAAO,UAAUD,IAAMC,EAAO,CAAC;AAAA,MAAA,GAEzC,MAAMH,EAAS;AAGX,YAAAI,IAAWC,EAAyBpC,KAAA,gBAAAA,EAAY,KAAK;AAE3D,UAAImC,GAAU;AACZ,cAAME,IAAYrB,EAAM,UAAU,SAAS,MAAM;AACtC,SAAAI,IAAApB,EAAA,UAAA,QAAAoB,EAAO,MAAM,YAAY,YAAY,GAAGiB,CAAS,GAAGF,EAAS,KAAK;AAAA,MAC/E;AAAA,IACF;AAEa,WAAAG,EAAA;AAAA,MACX,UAAUC,EAAS,MAAMjC,EAAS,KAAK;AAAA,MACvC,QAAAoB;AAAA,MACA,SAAAJ;AAAA,IAAA,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/Icon.js CHANGED
@@ -15,6 +15,7 @@ const _ = [
15
15
  "badge-discount",
16
16
  "badge-seller-elite",
17
17
  "badge-seller-power",
18
+ "badge-seller-verified",
18
19
  "book-customer",
19
20
  "building-office",
20
21
  "bulk-add",
@@ -184,7 +185,7 @@ const _ = [
184
185
  "warehouse",
185
186
  "working"
186
187
  ];
187
- var z = /* @__PURE__ */ ((r) => (r.Standard = "standard", r.Dense = "dense", r.Small = "small", r.Large = "large", r))(z || {});
188
+ var z = /* @__PURE__ */ ((t) => (t.Standard = "standard", t.Dense = "dense", t.Small = "small", t.Large = "large", t))(z || {});
188
189
  const q = /* @__PURE__ */ p({
189
190
  name: "ll-icon",
190
191
  __name: "Icon",
@@ -197,18 +198,18 @@ const q = /* @__PURE__ */ p({
197
198
  small: { type: Boolean },
198
199
  staticPath: { default: "" }
199
200
  },
200
- setup(r) {
201
- const e = r, o = m(), s = h("stashOptions", {
201
+ setup(t) {
202
+ const e = t, o = m(), s = h("stashOptions", {
202
203
  staticPath: "/static"
203
- }), c = i(() => _.includes(e.name) ? e.name : "mj-leaf"), d = i(() => e.staticPath || (s == null ? void 0 : s.staticPath)), u = (t) => {
204
- if (!t)
205
- return t;
204
+ }), c = i(() => _.includes(e.name) ? e.name : "mj-leaf"), d = i(() => e.staticPath || (s == null ? void 0 : s.staticPath)), u = (r) => {
205
+ if (!r)
206
+ return r;
206
207
  const l = document.createElement("use");
207
208
  l.setAttribute("href", `#${c.value}`);
208
- const n = t.querySelector(`#${c.value}`);
209
- return n ? (t.replaceChildren(n, l), t) : (t.insertBefore(l, t.firstChild), t);
209
+ const n = r.querySelector(`#${c.value}`);
210
+ return n ? (r.replaceChildren(n, l), r) : (r.insertBefore(l, r.firstChild), r);
210
211
  };
211
- return (t, l) => (g(), f(a(k), {
212
+ return (r, l) => (g(), f(a(k), {
212
213
  id: e.id,
213
214
  role: "presentation",
214
215
  "aria-labelledby": e.id,
package/dist/Icon.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sources":["../src/components/Icon/Icon.types.ts","../src/components/Icon/Icon.vue"],"sourcesContent":["export const iconNames = [\n 'action-dots',\n 'activity',\n 'alert-bell',\n 'archive',\n 'arrow-down',\n 'arrow-left',\n 'arrow-right',\n 'arrow-up',\n 'badge-discount',\n 'badge-seller-elite',\n 'badge-seller-power',\n 'book-customer',\n 'building-office',\n 'bulk-add',\n 'calendar-reschedule',\n 'calendar',\n 'caret-down',\n 'caret-up',\n 'cart-active',\n 'cart-plus',\n 'change-log',\n 'check',\n 'chevron-down',\n 'chevron-left',\n 'chevron-right',\n 'chevron-up',\n 'circle-check',\n 'circle-close',\n 'circle-dollar',\n 'circle-info',\n 'circle-partial',\n 'circle-percent',\n 'circle-question-mark',\n 'circle-status',\n 'circle-warning',\n 'clipboard-checkmark',\n 'clipboard-inventory',\n 'close',\n 'combine',\n 'compass',\n 'contact',\n 'contract',\n 'copy',\n 'credit-card',\n 'credit-profile',\n 'dashboard',\n 'document-accept',\n 'document-invoice',\n 'document-recieved',\n 'document-sent',\n 'document-view',\n 'document',\n 'dolly',\n 'download',\n 'edit',\n 'ellipsis',\n 'envelope-open',\n 'envelope',\n 'export',\n 'figma',\n 'file-csv',\n 'file',\n 'filter-funnel',\n 'filter-line',\n 'flag',\n 'folder',\n 'folder-bar-graph',\n 'folder-orders',\n 'gear',\n 'github',\n 'globe',\n 'graph-bar-chart',\n 'graph-line-chart',\n 'graph-pie-chart',\n 'hazard',\n 'hazard-outline',\n 'headset-agent',\n 'headset-mic',\n 'heart-filled',\n 'heart-outline',\n 'hide',\n 'history',\n 'image',\n 'import',\n 'keyboard-return',\n 'license-approved',\n 'license-certificate',\n 'lightbulb',\n 'link-add',\n 'link-unlink',\n 'link',\n 'list-items',\n 'loading-big',\n 'loading-small',\n 'location',\n 'lock-unlock',\n 'lock',\n 'logo-facebook',\n 'logo-instagram',\n 'logo-linkedin',\n 'logo-ll',\n 'logo-metrc',\n 'logo-plaid',\n 'logo-x',\n 'logo-youtube',\n 'logout',\n 'medical',\n 'megaphone-sound',\n 'megaphone',\n 'menu',\n 'message-dispute',\n 'message-reply',\n 'message',\n 'minus',\n 'mj-leaf',\n 'money',\n 'note-add',\n 'note',\n 'open-in-new',\n 'paperclip',\n 'performance',\n 'phone',\n 'plus',\n 'preview',\n 'print',\n 'product-menu-manage',\n 'product-menu-search',\n 'product-menu',\n 'queue-add',\n 'queue',\n 'recent',\n 'refresh',\n 'register',\n 'reply',\n 'report-download',\n 'sample',\n 'save',\n 'scale-law',\n 'scale-weight',\n 'search',\n 'seed-cycle',\n 'share',\n 'shop-bag-browse',\n 'shop-bag-reorder',\n 'shop-bag',\n 'shop-basket',\n 'shop-cart-add',\n 'shop-cart',\n 'show',\n 'sign-dollar',\n 'sign-percent',\n 'sort',\n 'split',\n 'star-filled',\n 'star-outline',\n 'storefront',\n 'submit',\n 'swap-horizontal',\n 'swap-vertical',\n 'tag-star',\n 'tag',\n 'test-results',\n 'ticket-star',\n 'ticket',\n 'tool-dropper',\n 'tool-wrench',\n 'transfer',\n 'trashcan',\n 'truck',\n 'upload',\n 'user-add',\n 'user-admin',\n 'user-check',\n 'user',\n 'view-card',\n 'view-detailed',\n 'view-list',\n 'warehouse',\n 'working',\n] as const;\n\nexport type IconName = typeof iconNames[number];\n\nexport enum IconSizes {\n Standard = 'standard',\n Dense = 'dense',\n Small = 'small',\n Large = 'large',\n}\n\nexport type IconSize = `${IconSizes}`;\n","<script lang=\"ts\">\n export * from './Icon.types';\n</script>\n\n<script lang=\"ts\" setup>\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, inject, useCssModule } from 'vue';\n import InlineSvg from 'vue-inline-svg';\n\n import { StashProvideState } from '../../../types/misc';\n import { IconName, iconNames, IconSize } from './Icon.types';\n\n export interface IconProps {\n id?: string;\n\n /**\n * The filename of the icon that should be displayed\n */\n name: IconName;\n\n /**\n * Accessible, short-text description for the icon. Not rendered as part of the graphic, but\n * browsers usually display it as a tooltip and screen readers use this.\n */\n title?: string;\n\n /**\n * The size of the icon\n * Options: large (32x32px), default (24x24px), dense (20x20px), small (14x14px).\n */\n size?: IconSize;\n\n /**\n * @deprecated Use the `size` prop with value \"dense\" instead\n */\n dense?: boolean;\n\n /**\n` * @deprecated Use the `size` prop with value \"small\" instead\n */\n small?: boolean;\n\n /**\n * Icon's custom static path. It'll default to either the staticPath defined on the library installation or '/static' if none are provided.\n */\n staticPath?: string;\n }\n\n defineOptions({\n name: 'll-icon',\n });\n\n const props = withDefaults(defineProps<IconProps>(), {\n id: () => uniqueId('ll-icon-'),\n size: 'standard',\n title: '',\n staticPath: '',\n });\n const classes = useCssModule();\n const stashOptions = inject<Partial<StashProvideState>>('stashOptions', {\n staticPath: '/static',\n });\n\n const computedName = computed<IconName>(() => {\n if (iconNames.includes(props.name)) {\n return props.name;\n }\n\n return 'mj-leaf';\n });\n\n const computedStaticPath = computed(() => {\n return props.staticPath || stashOptions?.staticPath;\n });\n\n /**\n * Event handler to add the use tag for the specific icon we need to the svg\n */\n const transformSvgSource = (svgElem: SVGElement) => {\n if (!svgElem) {\n return svgElem;\n }\n\n const useNode = document.createElement('use');\n useNode.setAttribute('href', `#${computedName.value}`);\n\n // Grab icon from sprite\n const symbolNode = svgElem.querySelector(`#${computedName.value}`);\n\n // This really shouldn't happen but if the spritesheet gets out of sync with the `IconName` type it could\n if (!symbolNode) {\n // still insert <use> element but it will not be found (this is more for tests than anything else)\n svgElem.insertBefore(useNode, svgElem.firstChild);\n return svgElem;\n }\n\n /**\n * Repeatedly inlining the entire spritesheet was causing failures in mobile Safari, and also\n * performance issues on long list pages where the svg was being inlined over and over.\n * Since the SVG is cached after the first request, this callback is just removing the unnecessary\n * <symbol> nodes to slim down the DOM manipulation and insertion.\n */\n // Replace all children with just the one <symbol> element and <use> element\n svgElem.replaceChildren(symbolNode, useNode);\n\n return svgElem;\n };\n</script>\n\n<!-- Use inline svg so that requests to pull the spritesheet are done via JS and avoid\n browser restrictions for different domains for svgs. inline svg also caches the requests\n so we don't load the spritesheet multiple times\n Reference: https://oreillymedia.github.io/Using_SVG/extras/ch10-cors.html -->\n<template>\n <InlineSvg\n :id=\"props.id\"\n role=\"presentation\"\n :aria-labelledby=\"props.id\"\n class=\"stash-icon\"\n :class=\"[\n classes.icon,\n `icon--${props.name}`,\n {\n [classes.standard]: props.size === 'standard',\n [classes.dense]: props.size === 'dense' || props.dense,\n [classes.small]: props.size === 'small' || props.small,\n [classes.large]: props.size === 'large',\n },\n ]\"\n data-test=\"stash-icon\"\n :src=\"`${computedStaticPath}/spritesheet.svg`\"\n :title=\"props.title\"\n :transform-source=\"transformSvgSource\"\n />\n</template>\n\n<style module>\n .icon {\n display: inline-block;\n fill: currentcolor;\n vertical-align: middle;\n }\n\n .standard {\n height: 24px;\n min-height: 24px;\n min-width: 24px;\n width: 24px;\n }\n\n .dense {\n height: 20px;\n min-height: 20px;\n min-width: 20px;\n width: 20px;\n }\n\n .small {\n height: 14px;\n min-height: 14px;\n min-width: 14px;\n width: 14px;\n }\n\n .large {\n height: 32px;\n min-height: 32px;\n min-width: 32px;\n width: 32px;\n }\n</style>\n"],"names":["iconNames","IconSizes","classes","useCssModule","stashOptions","inject","computedName","computed","props","computedStaticPath","transformSvgSource","svgElem","useNode","symbolNode"],"mappings":";;;;;AAAO,MAAMA,IAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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MAC3BC,EAAM,eAAcJ,KAAA,gBAAAA,EAAc,WAC1C,GAKKM,IAAqB,CAACC,MAAwB;AAClD,UAAI,CAACA;AACI,eAAAA;AAGH,YAAAC,IAAU,SAAS,cAAc,KAAK;AAC5C,MAAAA,EAAQ,aAAa,QAAQ,IAAIN,EAAa,KAAK,EAAE;AAGrD,YAAMO,IAAaF,EAAQ,cAAc,IAAIL,EAAa,KAAK,EAAE;AAGjE,aAAKO,KAaGF,EAAA,gBAAgBE,GAAYD,CAAO,GAEpCD,MAbGA,EAAA,aAAaC,GAASD,EAAQ,UAAU,GACzCA;AAAA,IAYF;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Icon.js","sources":["../src/components/Icon/Icon.types.ts","../src/components/Icon/Icon.vue"],"sourcesContent":["export const iconNames = [\n 'action-dots',\n 'activity',\n 'alert-bell',\n 'archive',\n 'arrow-down',\n 'arrow-left',\n 'arrow-right',\n 'arrow-up',\n 'badge-discount',\n 'badge-seller-elite',\n 'badge-seller-power',\n 'badge-seller-verified',\n 'book-customer',\n 'building-office',\n 'bulk-add',\n 'calendar-reschedule',\n 'calendar',\n 'caret-down',\n 'caret-up',\n 'cart-active',\n 'cart-plus',\n 'change-log',\n 'check',\n 'chevron-down',\n 'chevron-left',\n 'chevron-right',\n 'chevron-up',\n 'circle-check',\n 'circle-close',\n 'circle-dollar',\n 'circle-info',\n 'circle-partial',\n 'circle-percent',\n 'circle-question-mark',\n 'circle-status',\n 'circle-warning',\n 'clipboard-checkmark',\n 'clipboard-inventory',\n 'close',\n 'combine',\n 'compass',\n 'contact',\n 'contract',\n 'copy',\n 'credit-card',\n 'credit-profile',\n 'dashboard',\n 'document-accept',\n 'document-invoice',\n 'document-recieved',\n 'document-sent',\n 'document-view',\n 'document',\n 'dolly',\n 'download',\n 'edit',\n 'ellipsis',\n 'envelope-open',\n 'envelope',\n 'export',\n 'figma',\n 'file-csv',\n 'file',\n 'filter-funnel',\n 'filter-line',\n 'flag',\n 'folder',\n 'folder-bar-graph',\n 'folder-orders',\n 'gear',\n 'github',\n 'globe',\n 'graph-bar-chart',\n 'graph-line-chart',\n 'graph-pie-chart',\n 'hazard',\n 'hazard-outline',\n 'headset-agent',\n 'headset-mic',\n 'heart-filled',\n 'heart-outline',\n 'hide',\n 'history',\n 'image',\n 'import',\n 'keyboard-return',\n 'license-approved',\n 'license-certificate',\n 'lightbulb',\n 'link-add',\n 'link-unlink',\n 'link',\n 'list-items',\n 'loading-big',\n 'loading-small',\n 'location',\n 'lock-unlock',\n 'lock',\n 'logo-facebook',\n 'logo-instagram',\n 'logo-linkedin',\n 'logo-ll',\n 'logo-metrc',\n 'logo-plaid',\n 'logo-x',\n 'logo-youtube',\n 'logout',\n 'medical',\n 'megaphone-sound',\n 'megaphone',\n 'menu',\n 'message-dispute',\n 'message-reply',\n 'message',\n 'minus',\n 'mj-leaf',\n 'money',\n 'note-add',\n 'note',\n 'open-in-new',\n 'paperclip',\n 'performance',\n 'phone',\n 'plus',\n 'preview',\n 'print',\n 'product-menu-manage',\n 'product-menu-search',\n 'product-menu',\n 'queue-add',\n 'queue',\n 'recent',\n 'refresh',\n 'register',\n 'reply',\n 'report-download',\n 'sample',\n 'save',\n 'scale-law',\n 'scale-weight',\n 'search',\n 'seed-cycle',\n 'share',\n 'shop-bag-browse',\n 'shop-bag-reorder',\n 'shop-bag',\n 'shop-basket',\n 'shop-cart-add',\n 'shop-cart',\n 'show',\n 'sign-dollar',\n 'sign-percent',\n 'sort',\n 'split',\n 'star-filled',\n 'star-outline',\n 'storefront',\n 'submit',\n 'swap-horizontal',\n 'swap-vertical',\n 'tag-star',\n 'tag',\n 'test-results',\n 'ticket-star',\n 'ticket',\n 'tool-dropper',\n 'tool-wrench',\n 'transfer',\n 'trashcan',\n 'truck',\n 'upload',\n 'user-add',\n 'user-admin',\n 'user-check',\n 'user',\n 'view-card',\n 'view-detailed',\n 'view-list',\n 'warehouse',\n 'working',\n] as const;\n\nexport type IconName = typeof iconNames[number];\n\nexport enum IconSizes {\n Standard = 'standard',\n Dense = 'dense',\n Small = 'small',\n Large = 'large',\n}\n\nexport type IconSize = `${IconSizes}`;\n","<script lang=\"ts\">\n export * from './Icon.types';\n</script>\n\n<script lang=\"ts\" setup>\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, inject, useCssModule } from 'vue';\n import InlineSvg from 'vue-inline-svg';\n\n import { StashProvideState } from '../../../types/misc';\n import { IconName, iconNames, IconSize } from './Icon.types';\n\n export interface IconProps {\n id?: string;\n\n /**\n * The filename of the icon that should be displayed\n */\n name: IconName;\n\n /**\n * Accessible, short-text description for the icon. Not rendered as part of the graphic, but\n * browsers usually display it as a tooltip and screen readers use this.\n */\n title?: string;\n\n /**\n * The size of the icon\n * Options: large (32x32px), default (24x24px), dense (20x20px), small (14x14px).\n */\n size?: IconSize;\n\n /**\n * @deprecated Use the `size` prop with value \"dense\" instead\n */\n dense?: boolean;\n\n /**\n` * @deprecated Use the `size` prop with value \"small\" instead\n */\n small?: boolean;\n\n /**\n * Icon's custom static path. It'll default to either the staticPath defined on the library installation or '/static' if none are provided.\n */\n staticPath?: string;\n }\n\n defineOptions({\n name: 'll-icon',\n });\n\n const props = withDefaults(defineProps<IconProps>(), {\n id: () => uniqueId('ll-icon-'),\n size: 'standard',\n title: '',\n staticPath: '',\n });\n const classes = useCssModule();\n const stashOptions = inject<Partial<StashProvideState>>('stashOptions', {\n staticPath: '/static',\n });\n\n const computedName = computed<IconName>(() => {\n if (iconNames.includes(props.name)) {\n return props.name;\n }\n\n return 'mj-leaf';\n });\n\n const computedStaticPath = computed(() => {\n return props.staticPath || stashOptions?.staticPath;\n });\n\n /**\n * Event handler to add the use tag for the specific icon we need to the svg\n */\n const transformSvgSource = (svgElem: SVGElement) => {\n if (!svgElem) {\n return svgElem;\n }\n\n const useNode = document.createElement('use');\n useNode.setAttribute('href', `#${computedName.value}`);\n\n // Grab icon from sprite\n const symbolNode = svgElem.querySelector(`#${computedName.value}`);\n\n // This really shouldn't happen but if the spritesheet gets out of sync with the `IconName` type it could\n if (!symbolNode) {\n // still insert <use> element but it will not be found (this is more for tests than anything else)\n svgElem.insertBefore(useNode, svgElem.firstChild);\n return svgElem;\n }\n\n /**\n * Repeatedly inlining the entire spritesheet was causing failures in mobile Safari, and also\n * performance issues on long list pages where the svg was being inlined over and over.\n * Since the SVG is cached after the first request, this callback is just removing the unnecessary\n * <symbol> nodes to slim down the DOM manipulation and insertion.\n */\n // Replace all children with just the one <symbol> element and <use> element\n svgElem.replaceChildren(symbolNode, useNode);\n\n return svgElem;\n };\n</script>\n\n<!-- Use inline svg so that requests to pull the spritesheet are done via JS and avoid\n browser restrictions for different domains for svgs. inline svg also caches the requests\n so we don't load the spritesheet multiple times\n Reference: https://oreillymedia.github.io/Using_SVG/extras/ch10-cors.html -->\n<template>\n <InlineSvg\n :id=\"props.id\"\n role=\"presentation\"\n :aria-labelledby=\"props.id\"\n class=\"stash-icon\"\n :class=\"[\n classes.icon,\n `icon--${props.name}`,\n {\n [classes.standard]: props.size === 'standard',\n [classes.dense]: props.size === 'dense' || props.dense,\n [classes.small]: props.size === 'small' || props.small,\n [classes.large]: props.size === 'large',\n },\n ]\"\n data-test=\"stash-icon\"\n :src=\"`${computedStaticPath}/spritesheet.svg`\"\n :title=\"props.title\"\n :transform-source=\"transformSvgSource\"\n />\n</template>\n\n<style module>\n .icon {\n display: inline-block;\n fill: currentcolor;\n vertical-align: middle;\n }\n\n .standard {\n height: 24px;\n min-height: 24px;\n min-width: 24px;\n width: 24px;\n }\n\n .dense {\n height: 20px;\n min-height: 20px;\n min-width: 20px;\n width: 20px;\n }\n\n .small {\n height: 14px;\n min-height: 14px;\n min-width: 14px;\n width: 14px;\n }\n\n .large {\n height: 32px;\n min-height: 32px;\n min-width: 32px;\n width: 32px;\n }\n</style>\n"],"names":["iconNames","IconSizes","classes","useCssModule","stashOptions","inject","computedName","computed","props","computedStaticPath","transformSvgSource","svgElem","useNode","symbolNode"],"mappings":";;;;;AAAO,MAAMA,IAAY;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA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Aa,QAAQ,IAAIN,EAAa,KAAK,EAAE;AAGrD,YAAMO,IAAaF,EAAQ,cAAc,IAAIL,EAAa,KAAK,EAAE;AAGjE,aAAKO,KAaGF,EAAA,gBAAgBE,GAAYD,CAAO,GAEpCD,MAbGA,EAAA,aAAaC,GAASD,EAAQ,UAAU,GACzCA;AAAA,IAYF;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -47,7 +47,7 @@ export default _default;
47
47
 
48
48
  export declare type IconName = typeof iconNames[number];
49
49
 
50
- export declare const iconNames: readonly ["action-dots", "activity", "alert-bell", "archive", "arrow-down", "arrow-left", "arrow-right", "arrow-up", "badge-discount", "badge-seller-elite", "badge-seller-power", "book-customer", "building-office", "bulk-add", "calendar-reschedule", "calendar", "caret-down", "caret-up", "cart-active", "cart-plus", "change-log", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "circle-check", "circle-close", "circle-dollar", "circle-info", "circle-partial", "circle-percent", "circle-question-mark", "circle-status", "circle-warning", "clipboard-checkmark", "clipboard-inventory", "close", "combine", "compass", "contact", "contract", "copy", "credit-card", "credit-profile", "dashboard", "document-accept", "document-invoice", "document-recieved", "document-sent", "document-view", "document", "dolly", "download", "edit", "ellipsis", "envelope-open", "envelope", "export", "figma", "file-csv", "file", "filter-funnel", "filter-line", "flag", "folder", "folder-bar-graph", "folder-orders", "gear", "github", "globe", "graph-bar-chart", "graph-line-chart", "graph-pie-chart", "hazard", "hazard-outline", "headset-agent", "headset-mic", "heart-filled", "heart-outline", "hide", "history", "image", "keyboard-return", "license-approved", "license-certificate", "lightbulb", "link-add", "link-unlink", "link", "list-items", "loading-big", "loading-small", "location", "lock-unlock", "lock", "logo-facebook", "logo-instagram", "logo-linkedin", "logo-ll", "logo-metrc", "logo-plaid", "logo-x", "logo-youtube", "logout", "medical", "megaphone-sound", "megaphone", "menu", "message-dispute", "message-reply", "message", "minus", "mj-leaf", "money", "note-add", "note", "open-in-new", "paperclip", "performance", "phone", "plus", "preview", "print", "product-menu-manage", "product-menu-search", "product-menu", "queue-add", "queue", "recent", "refresh", "register", "reply", "report-download", "sample", "save", "scale-law", "scale-weight", "search", "seed-cycle", "share", "shop-bag-browse", "shop-bag-reorder", "shop-bag", "shop-basket", "shop-cart-add", "shop-cart", "show", "sign-dollar", "sign-percent", "sort", "split", "star-filled", "star-outline", "storefront", "submit", "swap-horizontal", "swap-vertical", "tag-star", "tag", "test-results", "ticket-star", "ticket", "tool-dropper", "tool-wrench", "transfer", "trashcan", "truck", "upload", "user-add", "user-admin", "user-check", "user", "view-card", "view-detailed", "view-list", "warehouse", "working"];
50
+ export declare const iconNames: readonly ["action-dots", "activity", "alert-bell", "archive", "arrow-down", "arrow-left", "arrow-right", "arrow-up", "badge-discount", "badge-seller-elite", "badge-seller-power", "badge-seller-verified", "book-customer", "building-office", "bulk-add", "calendar-reschedule", "calendar", "caret-down", "caret-up", "cart-active", "cart-plus", "change-log", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "circle-check", "circle-close", "circle-dollar", "circle-info", "circle-partial", "circle-percent", "circle-question-mark", "circle-status", "circle-warning", "clipboard-checkmark", "clipboard-inventory", "close", "combine", "compass", "contact", "contract", "copy", "credit-card", "credit-profile", "dashboard", "document-accept", "document-invoice", "document-recieved", "document-sent", "document-view", "document", "dolly", "download", "edit", "ellipsis", "envelope-open", "envelope", "export", "figma", "file-csv", "file", "filter-funnel", "filter-line", "flag", "folder", "folder-bar-graph", "folder-orders", "gear", "github", "globe", "graph-bar-chart", "graph-line-chart", "graph-pie-chart", "hazard", "hazard-outline", "headset-agent", "headset-mic", "heart-filled", "heart-outline", "hide", "history", "image", "keyboard-return", "license-approved", "license-certificate", "lightbulb", "link-add", "link-unlink", "link", "list-items", "loading-big", "loading-small", "location", "lock-unlock", "lock", "logo-facebook", "logo-instagram", "logo-linkedin", "logo-ll", "logo-metrc", "logo-plaid", "logo-x", "logo-youtube", "logout", "medical", "megaphone-sound", "megaphone", "menu", "message-dispute", "message-reply", "message", "minus", "mj-leaf", "money", "note-add", "note", "open-in-new", "paperclip", "performance", "phone", "plus", "preview", "print", "product-menu-manage", "product-menu-search", "product-menu", "queue-add", "queue", "recent", "refresh", "register", "reply", "report-download", "sample", "save", "scale-law", "scale-weight", "search", "seed-cycle", "share", "shop-bag-browse", "shop-bag-reorder", "shop-bag", "shop-basket", "shop-cart-add", "shop-cart", "show", "sign-dollar", "sign-percent", "sort", "split", "star-filled", "star-outline", "storefront", "submit", "swap-horizontal", "swap-vertical", "tag-star", "tag", "test-results", "ticket-star", "ticket", "tool-dropper", "tool-wrench", "transfer", "trashcan", "truck", "upload", "user-add", "user-admin", "user-check", "user", "view-card", "view-detailed", "view-list", "warehouse", "working"];
51
51
 
52
52
  export declare interface IconProps {
53
53
  id?: string;
@@ -85,7 +85,7 @@ export declare interface IconLabelProps {
85
85
 
86
86
  declare type IconName = typeof iconNames[number];
87
87
 
88
- declare const iconNames: readonly ["action-dots", "activity", "alert-bell", "archive", "arrow-down", "arrow-left", "arrow-right", "arrow-up", "badge-discount", "badge-seller-elite", "badge-seller-power", "book-customer", "building-office", "bulk-add", "calendar-reschedule", "calendar", "caret-down", "caret-up", "cart-active", "cart-plus", "change-log", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "circle-check", "circle-close", "circle-dollar", "circle-info", "circle-partial", "circle-percent", "circle-question-mark", "circle-status", "circle-warning", "clipboard-checkmark", "clipboard-inventory", "close", "combine", "compass", "contact", "contract", "copy", "credit-card", "credit-profile", "dashboard", "document-accept", "document-invoice", "document-recieved", "document-sent", "document-view", "document", "dolly", "download", "edit", "ellipsis", "envelope-open", "envelope", "export", "figma", "file-csv", "file", "filter-funnel", "filter-line", "flag", "folder", "folder-bar-graph", "folder-orders", "gear", "github", "globe", "graph-bar-chart", "graph-line-chart", "graph-pie-chart", "hazard", "hazard-outline", "headset-agent", "headset-mic", "heart-filled", "heart-outline", "hide", "history", "image", "keyboard-return", "license-approved", "license-certificate", "lightbulb", "link-add", "link-unlink", "link", "list-items", "loading-big", "loading-small", "location", "lock-unlock", "lock", "logo-facebook", "logo-instagram", "logo-linkedin", "logo-ll", "logo-metrc", "logo-plaid", "logo-x", "logo-youtube", "logout", "medical", "megaphone-sound", "megaphone", "menu", "message-dispute", "message-reply", "message", "minus", "mj-leaf", "money", "note-add", "note", "open-in-new", "paperclip", "performance", "phone", "plus", "preview", "print", "product-menu-manage", "product-menu-search", "product-menu", "queue-add", "queue", "recent", "refresh", "register", "reply", "report-download", "sample", "save", "scale-law", "scale-weight", "search", "seed-cycle", "share", "shop-bag-browse", "shop-bag-reorder", "shop-bag", "shop-basket", "shop-cart-add", "shop-cart", "show", "sign-dollar", "sign-percent", "sort", "split", "star-filled", "star-outline", "storefront", "submit", "swap-horizontal", "swap-vertical", "tag-star", "tag", "test-results", "ticket-star", "ticket", "tool-dropper", "tool-wrench", "transfer", "trashcan", "truck", "upload", "user-add", "user-admin", "user-check", "user", "view-card", "view-detailed", "view-list", "warehouse", "working"];
88
+ declare const iconNames: readonly ["action-dots", "activity", "alert-bell", "archive", "arrow-down", "arrow-left", "arrow-right", "arrow-up", "badge-discount", "badge-seller-elite", "badge-seller-power", "badge-seller-verified", "book-customer", "building-office", "bulk-add", "calendar-reschedule", "calendar", "caret-down", "caret-up", "cart-active", "cart-plus", "change-log", "check", "chevron-down", "chevron-left", "chevron-right", "chevron-up", "circle-check", "circle-close", "circle-dollar", "circle-info", "circle-partial", "circle-percent", "circle-question-mark", "circle-status", "circle-warning", "clipboard-checkmark", "clipboard-inventory", "close", "combine", "compass", "contact", "contract", "copy", "credit-card", "credit-profile", "dashboard", "document-accept", "document-invoice", "document-recieved", "document-sent", "document-view", "document", "dolly", "download", "edit", "ellipsis", "envelope-open", "envelope", "export", "figma", "file-csv", "file", "filter-funnel", "filter-line", "flag", "folder", "folder-bar-graph", "folder-orders", "gear", "github", "globe", "graph-bar-chart", "graph-line-chart", "graph-pie-chart", "hazard", "hazard-outline", "headset-agent", "headset-mic", "heart-filled", "heart-outline", "hide", "history", "image", "keyboard-return", "license-approved", "license-certificate", "lightbulb", "link-add", "link-unlink", "link", "list-items", "loading-big", "loading-small", "location", "lock-unlock", "lock", "logo-facebook", "logo-instagram", "logo-linkedin", "logo-ll", "logo-metrc", "logo-plaid", "logo-x", "logo-youtube", "logout", "medical", "megaphone-sound", "megaphone", "menu", "message-dispute", "message-reply", "message", "minus", "mj-leaf", "money", "note-add", "note", "open-in-new", "paperclip", "performance", "phone", "plus", "preview", "print", "product-menu-manage", "product-menu-search", "product-menu", "queue-add", "queue", "recent", "refresh", "register", "reply", "report-download", "sample", "save", "scale-law", "scale-weight", "search", "seed-cycle", "share", "shop-bag-browse", "shop-bag-reorder", "shop-bag", "shop-basket", "shop-cart-add", "shop-cart", "show", "sign-dollar", "sign-percent", "sort", "split", "star-filled", "star-outline", "storefront", "submit", "swap-horizontal", "swap-vertical", "tag-star", "tag", "test-results", "ticket-star", "ticket", "tool-dropper", "tool-wrench", "transfer", "trashcan", "truck", "upload", "user-add", "user-admin", "user-check", "user", "view-card", "view-detailed", "view-list", "warehouse", "working"];
89
89
 
90
90
  declare type StashCommonColor = `${StashCommonColors}`;
91
91
 
@@ -1,4 +1,4 @@
1
- import { defineComponent as a, useAttrs as p, computed as r, withDirectives as u, openBlock as m, createBlock as h, mergeProps as d, withCtx as C, createTextVNode as f, toDisplayString as A, vShow as _ } from "vue";
1
+ import { defineComponent as a, useAttrs as p, computed as r, withDirectives as u, openBlock as d, createBlock as m, mergeProps as h, withCtx as C, createTextVNode as f, toDisplayString as b, vShow as A } from "vue";
2
2
  import g from "./Chip.js";
3
3
  import "./utils/colorScheme.js";
4
4
  import "./Icon.js";
@@ -6,19 +6,20 @@ import "lodash-es/uniqueId";
6
6
  import "./index-79ce320f.js";
7
7
  import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
8
8
  import "./_plugin-vue_export-helper-dad06003.js";
9
- const z = /* @__PURE__ */ a({
9
+ const w = /* @__PURE__ */ a({
10
10
  name: "ll-license-chip",
11
11
  inheritAttrs: !1,
12
12
  __name: "LicenseChip",
13
13
  props: {
14
14
  license: {},
15
- size: { default: "medium" }
15
+ size: { default: "medium" },
16
+ disabled: { type: Boolean }
16
17
  },
17
- setup(i) {
18
- const s = i, c = p(), l = r(() => {
19
- const e = { ...c };
18
+ setup(l) {
19
+ const s = l, o = p(), c = r(() => {
20
+ const e = { ...o };
20
21
  return delete e["color-scheme"], delete e.radius, delete e.shade, e;
21
- }), o = Object.freeze({
22
+ }), i = Object.freeze({
22
23
  MED: "yellow",
23
24
  MEDI: "yellow",
24
25
  REC: "blue",
@@ -33,28 +34,28 @@ const z = /* @__PURE__ */ a({
33
34
  CANN: "green",
34
35
  ADU: "blue",
35
36
  ADUL: "blue"
36
- }), n = r(() => t.value in o ? o[t.value] : "blue"), t = r(() => {
37
+ }), n = r(() => s.disabled ? "ice" : t.value in i ? i[t.value] : "blue"), t = r(() => {
37
38
  const e = s.license.toUpperCase();
38
39
  return e.length > 4 ? e.slice(0, 3) : e;
39
40
  });
40
- return (e, v) => u((m(), h(g, d({
41
+ return (e, v) => u((d(), m(g, h({
41
42
  class: "stash-license-chip",
42
43
  "data-test": "stash-license-chip",
43
44
  radius: "pill",
44
45
  shade: "main",
45
46
  "color-scheme": n.value,
46
47
  size: s.size
47
- }, l.value), {
48
+ }, c.value, { disabled: e.disabled }), {
48
49
  default: C(() => [
49
- f(A(t.value), 1)
50
+ f(b(t.value), 1)
50
51
  ]),
51
52
  _: 1
52
- }, 16, ["color-scheme", "size"])), [
53
- [_, t.value.length]
53
+ }, 16, ["color-scheme", "size", "disabled"])), [
54
+ [A, t.value.length]
54
55
  ]);
55
56
  }
56
57
  });
57
58
  export {
58
- z as default
59
+ w as default
59
60
  };
60
61
  //# sourceMappingURL=LicenseChip.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LicenseChip.js","sources":["../src/components/LicenseChip/LicenseChip.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, useAttrs } from 'vue';\n\n import { StashPrimaryColorGroup } from '../../../types/colors';\n import Chip from '../Chip/Chip.vue';\n\n defineOptions({\n name: 'll-license-chip',\n inheritAttrs: false,\n });\n\n export interface LicenseChipProps {\n /**\n * License type to be displayed. This can be either the type code (e.g. \"MED\") or the full name (e.g. \"Medical\").\n */\n license: string;\n\n /**\n * Size of the chip. Defaults to medium. Available sizes: \"small\" | \"medium\".\n */\n size?: 'small' | 'medium';\n }\n\n const props = withDefaults(defineProps<LicenseChipProps>(), {\n size: 'medium',\n });\n const attrs = useAttrs();\n const chipAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n // prevents override to ensure license chips remain consistent\n delete tempAttrs['color-scheme'];\n delete tempAttrs['radius'];\n delete tempAttrs['shade'];\n\n return tempAttrs;\n });\n\n const COLOR_SCHEME_MAPPING = Object.freeze({\n MED: 'yellow',\n MEDI: 'yellow',\n REC: 'blue',\n RECR: 'blue',\n COM: 'royal',\n COMB: 'royal',\n ANC: 'orange',\n ANCI: 'orange',\n BUL: 'ice',\n BULK: 'ice',\n CAN: 'green',\n CANN: 'green',\n ADU: 'blue',\n ADUL: 'blue',\n });\n\n const color = computed<StashPrimaryColorGroup>(() => {\n if (formattedLicense.value in COLOR_SCHEME_MAPPING) {\n return COLOR_SCHEME_MAPPING[formattedLicense.value];\n }\n\n return 'blue';\n });\n\n const formattedLicense = computed(() => {\n const uppercaseLicense = props.license.toUpperCase();\n\n if (uppercaseLicense.length > 4) {\n return uppercaseLicense.slice(0, 3);\n }\n\n return uppercaseLicense;\n });\n</script>\n\n<template>\n <Chip\n v-show=\"formattedLicense.length\"\n class=\"stash-license-chip\"\n data-test=\"stash-license-chip\"\n radius=\"pill\"\n shade=\"main\"\n :color-scheme=\"color\"\n :size=\"props.size\"\n v-bind=\"chipAttrs\"\n >\n {{ formattedLicense }}\n </Chip>\n</template>\n"],"names":["attrs","useAttrs","chipAttrs","computed","tempAttrs","COLOR_SCHEME_MAPPING","color","formattedLicense","uppercaseLicense","props"],"mappings":";;;;;;;;;;;;;;;;;iBA0BQA,IAAQC,KACRC,IAAYC,EAAS,MAAM;AACzB,YAAAC,IAAY,EAAE,GAAGJ;AAGvB,oBAAOI,EAAU,cAAc,GAC/B,OAAOA,EAAU,QACjB,OAAOA,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAuB,OAAO,OAAO;AAAA,MACzC,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,IAAA,CACP,GAEKC,IAAQH,EAAiC,MACzCI,EAAiB,SAASF,IACrBA,EAAqBE,EAAiB,KAAK,IAG7C,MACR,GAEKA,IAAmBJ,EAAS,MAAM;AAChC,YAAAK,IAAmBC,EAAM,QAAQ,YAAY;AAE/C,aAAAD,EAAiB,SAAS,IACrBA,EAAiB,MAAM,GAAG,CAAC,IAG7BA;AAAA,IAAA,CACR;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"LicenseChip.js","sources":["../src/components/LicenseChip/LicenseChip.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, useAttrs } from 'vue';\n\n import { StashPrimaryColorGroup } from '../../../types/colors';\n import Chip from '../Chip/Chip.vue';\n\n defineOptions({\n name: 'll-license-chip',\n inheritAttrs: false,\n });\n\n export interface LicenseChipProps {\n /**\n * License type to be displayed. This can be either the type code (e.g. \"MED\") or the full name (e.g. \"Medical\").\n */\n license: string;\n\n /**\n * Size of the chip. Defaults to medium. Available sizes: \"small\" | \"medium\".\n */\n size?: 'small' | 'medium';\n\n /**\n * Whether the chip is disabled. Defaults to false.\n */\n disabled?: boolean;\n }\n\n const props = withDefaults(defineProps<LicenseChipProps>(), {\n size: 'medium',\n });\n const attrs = useAttrs();\n const chipAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n // prevents override to ensure license chips remain consistent\n delete tempAttrs['color-scheme'];\n delete tempAttrs['radius'];\n delete tempAttrs['shade'];\n\n return tempAttrs;\n });\n\n const COLOR_SCHEME_MAPPING = Object.freeze({\n MED: 'yellow',\n MEDI: 'yellow',\n REC: 'blue',\n RECR: 'blue',\n COM: 'royal',\n COMB: 'royal',\n ANC: 'orange',\n ANCI: 'orange',\n BUL: 'ice',\n BULK: 'ice',\n CAN: 'green',\n CANN: 'green',\n ADU: 'blue',\n ADUL: 'blue',\n });\n\n const color = computed<StashPrimaryColorGroup>(() => {\n if (props.disabled) {\n return 'ice';\n }\n\n if (formattedLicense.value in COLOR_SCHEME_MAPPING) {\n return COLOR_SCHEME_MAPPING[formattedLicense.value];\n }\n\n return 'blue';\n });\n\n const formattedLicense = computed(() => {\n const uppercaseLicense = props.license.toUpperCase();\n\n if (uppercaseLicense.length > 4) {\n return uppercaseLicense.slice(0, 3);\n }\n\n return uppercaseLicense;\n });\n</script>\n\n<template>\n <Chip\n v-show=\"formattedLicense.length\"\n class=\"stash-license-chip\"\n data-test=\"stash-license-chip\"\n radius=\"pill\"\n shade=\"main\"\n :color-scheme=\"color\"\n :size=\"props.size\"\n v-bind=\"chipAttrs\"\n :disabled=\"disabled\"\n >\n {{ formattedLicense }}\n </Chip>\n</template>\n"],"names":["attrs","useAttrs","chipAttrs","computed","tempAttrs","COLOR_SCHEME_MAPPING","color","props","formattedLicense","uppercaseLicense"],"mappings":";;;;;;;;;;;;;;;;;;iBA+BQA,IAAQC,KACRC,IAAYC,EAAS,MAAM;AACzB,YAAAC,IAAY,EAAE,GAAGJ;AAGvB,oBAAOI,EAAU,cAAc,GAC/B,OAAOA,EAAU,QACjB,OAAOA,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAuB,OAAO,OAAO;AAAA,MACzC,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,MACN,KAAK;AAAA,MACL,MAAM;AAAA,IAAA,CACP,GAEKC,IAAQH,EAAiC,MACzCI,EAAM,WACD,QAGLC,EAAiB,SAASH,IACrBA,EAAqBG,EAAiB,KAAK,IAG7C,MACR,GAEKA,IAAmBL,EAAS,MAAM;AAChC,YAAAM,IAAmBF,EAAM,QAAQ,YAAY;AAE/C,aAAAE,EAAiB,SAAS,IACrBA,EAAiB,MAAM,GAAG,CAAC,IAG7BA;AAAA,IAAA,CACR;;;;;;;;;;;;;;;;;;"}
@@ -45,6 +45,10 @@ export declare interface LicenseChipProps {
45
45
  * Size of the chip. Defaults to medium. Available sizes: "small" | "medium".
46
46
  */
47
47
  size?: 'small' | 'medium';
48
+ /**
49
+ * Whether the chip is disabled. Defaults to false.
50
+ */
51
+ disabled?: boolean;
48
52
  }
49
53
 
50
54
  export { }