@leaflink/stash 44.0.0-beta.1 → 44.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/dist/ActionsDropdown.js +9 -9
  2. package/dist/ActionsDropdown.js.map +1 -1
  3. package/dist/AddressSelect.js +12 -11
  4. package/dist/AddressSelect.js.map +1 -1
  5. package/dist/Alert.js +2 -2
  6. package/dist/Alert.js.map +1 -1
  7. package/dist/AppNavigationItem.js +15 -15
  8. package/dist/AppNavigationItem.js.map +1 -1
  9. package/dist/AppSidebar.js +17 -17
  10. package/dist/AppSidebar.js.map +1 -1
  11. package/dist/AppTopbar.js +12 -12
  12. package/dist/Avatar.js +12 -12
  13. package/dist/Avatar.js.map +1 -1
  14. package/dist/Backdrop.js +1 -1
  15. package/dist/Backdrop.js.map +1 -1
  16. package/dist/Badge.js +12 -12
  17. package/dist/Badge.js.map +1 -1
  18. package/dist/Button.js +1 -1
  19. package/dist/Button.js.map +1 -1
  20. package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b2ee90e6.js +17 -0
  21. package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b2ee90e6.js.map +1 -0
  22. package/dist/ButtonGroup.js +26 -26
  23. package/dist/ButtonGroup.js.map +1 -1
  24. package/dist/Card.js +3 -3
  25. package/dist/Card.js.map +1 -1
  26. package/dist/CardHeader.js +3 -3
  27. package/dist/CardMedia.js +1 -1
  28. package/dist/CardMedia.js.map +1 -1
  29. package/dist/Carousel.js +24 -24
  30. package/dist/Carousel.js.map +1 -1
  31. package/dist/Checkbox.js +27 -26
  32. package/dist/Checkbox.js.map +1 -1
  33. package/dist/{Checkbox.vue_vue_type_style_index_0_scoped_0d7e7fd0_lang-4ed993c7.js → Checkbox.vue_vue_type_style_index_0_scoped_dbd26d7f_lang-4ed993c7.js} +1 -1
  34. package/dist/Checkbox.vue_vue_type_style_index_0_scoped_dbd26d7f_lang-4ed993c7.js.map +1 -0
  35. package/dist/ChevronToggle.js +1 -1
  36. package/dist/Chip.js +1 -1
  37. package/dist/Chip.js.map +1 -1
  38. package/dist/ConfirmationCodeInput.js +21 -21
  39. package/dist/ConfirmationCodeInput.js.map +1 -1
  40. package/dist/ContextSwitcher.js +6 -5
  41. package/dist/ContextSwitcher.js.map +1 -1
  42. package/dist/Copy.js +1 -1
  43. package/dist/CurrencyInput.js +2 -2
  44. package/dist/DataView.js +1 -1
  45. package/dist/DataViewFilters.js +7 -7
  46. package/dist/DataViewFilters.js.map +1 -1
  47. package/dist/DataViewSortButton.js +5 -5
  48. package/dist/DataViewSortButton.js.map +1 -1
  49. package/dist/DataViewToolbar.js +4 -4
  50. package/dist/DataViewToolbar.js.map +1 -1
  51. package/dist/DatePicker.js +8 -8
  52. package/dist/DatePicker.js.map +1 -1
  53. package/dist/DescriptionListTerm.js +1 -1
  54. package/dist/DescriptionListTerm.js.map +1 -1
  55. package/dist/Dialog.js +34 -34
  56. package/dist/Dialog.js.map +1 -1
  57. package/dist/Dropdown.js +3 -3
  58. package/dist/Dropdown.js.map +1 -1
  59. package/dist/EmptyState.js +1 -1
  60. package/dist/EmptyState.js.map +1 -1
  61. package/dist/Field.js +2 -2
  62. package/dist/{Field.vue_vue_type_script_setup_true_lang-475832fe.js → Field.vue_vue_type_script_setup_true_lang-42cf79d4.js} +5 -5
  63. package/dist/{Field.vue_vue_type_script_setup_true_lang-475832fe.js.map → Field.vue_vue_type_script_setup_true_lang-42cf79d4.js.map} +1 -1
  64. package/dist/FileUpload.js +25 -25
  65. package/dist/FileUpload.js.map +1 -1
  66. package/dist/FilterChip.js +32 -32
  67. package/dist/FilterChip.js.map +1 -1
  68. package/dist/FilterDrawerItem.js +4 -4
  69. package/dist/FilterDrawerItem.js.map +1 -1
  70. package/dist/FilterDropdown.js +19 -19
  71. package/dist/FilterDropdown.js.map +1 -1
  72. package/dist/FilterSelect.js +2 -2
  73. package/dist/Filters.js +7 -6
  74. package/dist/Filters.js.map +1 -1
  75. package/dist/HttpError.js +30 -30
  76. package/dist/HttpError.js.map +1 -1
  77. package/dist/IconLabel.js +1 -1
  78. package/dist/IconLabel.js.map +1 -1
  79. package/dist/InlineEdit.js +3 -3
  80. package/dist/InlineEdit.js.map +1 -1
  81. package/dist/Input.js +37 -37
  82. package/dist/Input.js.map +1 -1
  83. package/dist/InputOptions.js +37 -36
  84. package/dist/InputOptions.js.map +1 -1
  85. package/dist/Label.js +1 -1
  86. package/dist/{Label.vue_vue_type_script_setup_true_lang-1d29d98a.js → Label.vue_vue_type_script_setup_true_lang-c5589919.js} +2 -2
  87. package/dist/{Label.vue_vue_type_script_setup_true_lang-1d29d98a.js.map → Label.vue_vue_type_script_setup_true_lang-c5589919.js.map} +1 -1
  88. package/dist/ListItem.js +6 -5
  89. package/dist/ListItem.js.map +1 -1
  90. package/dist/ListView.js +55 -54
  91. package/dist/ListView.js.map +1 -1
  92. package/dist/Menu.js +1 -1
  93. package/dist/Menu.js.map +1 -1
  94. package/dist/Metric.js +4 -4
  95. package/dist/Metric.js.map +1 -1
  96. package/dist/Modal.js +21 -21
  97. package/dist/Modal.js.map +1 -1
  98. package/dist/Module.js +2 -2
  99. package/dist/Module.js.map +1 -1
  100. package/dist/ModuleContent.js +2 -2
  101. package/dist/ModuleContent.js.map +1 -1
  102. package/dist/ModuleFooter.js +11 -11
  103. package/dist/ModuleFooter.js.map +1 -1
  104. package/dist/ModuleHeader.js +6 -6
  105. package/dist/ModuleHeader.js.map +1 -1
  106. package/dist/ObfuscateText.js +1 -1
  107. package/dist/PageHeader.js +3 -3
  108. package/dist/PageHeader.js.map +1 -1
  109. package/dist/PageNavigation.js +2 -2
  110. package/dist/Paginate.js +1 -1
  111. package/dist/Paginate.js.map +1 -1
  112. package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-1a2084f9.js +11 -0
  113. package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-1a2084f9.js.map +1 -0
  114. package/dist/QuickAction.js +11 -11
  115. package/dist/QuickAction.js.map +1 -1
  116. package/dist/Radio.js +2 -2
  117. package/dist/Radio.js.map +1 -1
  118. package/dist/RadioGroup.js +44 -44
  119. package/dist/RadioGroup.js.map +1 -1
  120. package/dist/RadioNew.js +14 -14
  121. package/dist/SearchBar.js +21 -21
  122. package/dist/SearchBar.js.map +1 -1
  123. package/dist/Select.js +187 -186
  124. package/dist/Select.js.map +1 -1
  125. package/dist/SelectStatus.js +22 -21
  126. package/dist/SelectStatus.js.map +1 -1
  127. package/dist/Step.js +37 -37
  128. package/dist/Step.js.map +1 -1
  129. package/dist/Switch.js +26 -25
  130. package/dist/Switch.js.map +1 -1
  131. package/dist/Tab.js +3 -2
  132. package/dist/Tab.js.map +1 -1
  133. package/dist/{Tab.vue_vue_type_script_setup_true_lang-b810bee8.js → Tab.vue_vue_type_script_setup_true_lang-4a40f015.js} +23 -22
  134. package/dist/Tab.vue_vue_type_script_setup_true_lang-4a40f015.js.map +1 -0
  135. package/dist/Table.js +20 -19
  136. package/dist/Table.js.map +1 -1
  137. package/dist/TableCell.js +22 -21
  138. package/dist/TableCell.js.map +1 -1
  139. package/dist/TableHeaderCell.js +7 -6
  140. package/dist/TableHeaderCell.js.map +1 -1
  141. package/dist/TableHeaderRow.js +6 -5
  142. package/dist/TableHeaderRow.js.map +1 -1
  143. package/dist/TableRow.js +24 -23
  144. package/dist/TableRow.js.map +1 -1
  145. package/dist/Tabs.js +2 -2
  146. package/dist/{Tabs.vue_used_vue_type_style_index_0_lang.module-4f247ed7.js → Tabs.vue_used_vue_type_style_index_0_lang.module-0af1e1cf.js} +3 -3
  147. package/dist/{Tabs.vue_used_vue_type_style_index_0_lang.module-4f247ed7.js.map → Tabs.vue_used_vue_type_style_index_0_lang.module-0af1e1cf.js.map} +1 -1
  148. package/dist/Textarea.js +2 -2
  149. package/dist/components.css +1 -1
  150. package/dist/index.js +21 -20
  151. package/dist/index.js.map +1 -1
  152. package/dist/storage.js +3 -2
  153. package/dist/storage.js.map +1 -1
  154. package/dist/useGoogleMaps.js.map +1 -1
  155. package/dist/utils/storage.js +30 -29
  156. package/dist/utils/storage.js.map +1 -1
  157. package/package.json +2 -2
  158. package/styles/_base.scss +1 -1
  159. package/styles/_core.scss +1 -1
  160. package/styles/elements/_links.scss +1 -1
  161. package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b77978d6.js +0 -17
  162. package/dist/Button.vue_used_vue_type_style_index_0_lang.module-b77978d6.js.map +0 -1
  163. package/dist/Checkbox.vue_vue_type_style_index_0_scoped_0d7e7fd0_lang-4ed993c7.js.map +0 -1
  164. package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-bfccf992.js +0 -11
  165. package/dist/Paginate.vue_used_vue_type_style_index_0_lang.module-bfccf992.js.map +0 -1
  166. package/dist/Tab.vue_vue_type_script_setup_true_lang-b810bee8.js.map +0 -1
@@ -5,6 +5,7 @@ import { _ as $ } 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
+ import "@leaflink/snitch";
8
9
  import "lodash-es/debounce";
9
10
  import "lodash-es/isEmpty";
10
11
  import "lodash-es/isEqual";
@@ -21,14 +22,14 @@ import "./clickoutside.js";
21
22
  import "./MenusPlugin-5e93f0a5.js";
22
23
  import "./Chip.js";
23
24
  import "./utils/colorScheme.js";
24
- import "./Field.vue_vue_type_script_setup_true_lang-475832fe.js";
25
- import "./Label.vue_vue_type_script_setup_true_lang-1d29d98a.js";
25
+ import "./Field.vue_vue_type_script_setup_true_lang-42cf79d4.js";
26
+ import "./Label.vue_vue_type_script_setup_true_lang-c5589919.js";
26
27
  import "./locale.js";
27
- const E = { class: "tw-truncate tw-mr-6" }, N = {
28
+ const j = { class: "tw-mr-6 tw-truncate" }, E = {
28
29
  key: 1,
29
30
  class: "tw-flex tw-items-center",
30
31
  "data-test": "select-status|value"
31
- }, D = { class: "tw-truncate tw-ml-1.5 tw-mr-6" }, I = { class: "tw-flex tw-min-w-0" }, L = /* @__PURE__ */ S({
32
+ }, N = { class: "tw-ml-1.5 tw-mr-6 tw-truncate" }, D = { class: "tw-flex tw-min-w-0" }, I = /* @__PURE__ */ S({
32
33
  name: "ll-select-status",
33
34
  __name: "SelectStatus",
34
35
  props: {
@@ -44,12 +45,12 @@ const E = { class: "tw-truncate tw-mr-6" }, N = {
44
45
  },
45
46
  emits: ["update:model-value"],
46
47
  setup(w, { emit: y }) {
47
- const e = w, _ = ["green", "teal", "ice", "yellow", "seafoam", "seafoam-700"], h = b(), v = g();
48
+ const e = w, _ = ["green", "teal", "ice", "yellow", "seafoam", "seafoam-700"], h = b(), x = g();
48
49
  if (e.value)
49
50
  throw new Error("ll-select-status: use :model-value or v-model instead of :value.");
50
51
  if (h.onInput)
51
52
  throw new Error("ll-select-status: use the @update:model-value event instead of @input");
52
- const r = u(() => e.statusOptions.find((t) => t[e.trackBy] === e.modelValue)), x = u(() => {
53
+ const r = u(() => e.statusOptions.find((t) => t[e.trackBy] === e.modelValue)), v = u(() => {
53
54
  const { color: t = "" } = r.value || {};
54
55
  return _.includes(t);
55
56
  });
@@ -62,15 +63,15 @@ const E = { class: "tw-truncate tw-mr-6" }, N = {
62
63
  function k(t) {
63
64
  y("update:model-value", (t == null ? void 0 : t[e.trackBy]) ?? "");
64
65
  }
65
- return (t, A) => (o(), C(V, {
66
+ return (t, z) => (o(), C(V, {
66
67
  ref: "select",
67
68
  "hide-search": "",
68
69
  single: "",
69
70
  class: l([[
70
- O(v).select,
71
+ O(x).select,
71
72
  {
72
73
  "stash-select-status--filled": e.secondary,
73
- "stash-select-status--filled-dark": e.secondary && x.value
74
+ "stash-select-status--filled-dark": e.secondary && v.value
74
75
  }
75
76
  ], "stash-select-status"]),
76
77
  disabled: e.disabled,
@@ -85,11 +86,11 @@ const E = { class: "tw-truncate tw-mr-6" }, N = {
85
86
  selected: d(({ option: s }) => [
86
87
  e.secondary ? (o(), i("div", {
87
88
  key: 0,
88
- class: l(["stash-select-status--selected tw-absolute tw-flex tw-items-center tw-pl-3 tw-rounded tw-h-full tw-inset-0 tw-w-full", [B(s.color)]]),
89
+ class: l(["stash-select-status--selected tw-absolute tw-inset-0 tw-flex tw-h-full tw-w-full tw-items-center tw-rounded tw-pl-3", [B(s.color)]]),
89
90
  "data-test": "select-status|value"
90
91
  }, [
91
- a("span", E, c(s[e.displayBy]), 1)
92
- ], 2)) : (o(), i("div", N, [
92
+ a("span", j, c(s[e.displayBy]), 1)
93
+ ], 2)) : (o(), i("div", E, [
93
94
  m(f, {
94
95
  "data-test": "select-status|value-icon",
95
96
  name: s.icon || "circle-status",
@@ -99,11 +100,11 @@ const E = { class: "tw-truncate tw-mr-6" }, N = {
99
100
  ]),
100
101
  style: p({ color: s.hexCode })
101
102
  }, null, 8, ["name", "class", "style"]),
102
- a("span", D, c(s[e.displayBy]), 1)
103
+ a("span", N, c(s[e.displayBy]), 1)
103
104
  ]))
104
105
  ]),
105
106
  option: d(({ option: s }) => [
106
- a("div", I, [
107
+ a("div", D, [
107
108
  m(f, {
108
109
  "data-test": "svg|status-color",
109
110
  name: s.icon || "circle-status",
@@ -122,13 +123,13 @@ const E = { class: "tw-truncate tw-mr-6" }, N = {
122
123
  _: 1
123
124
  }, 8, ["class", "disabled", "icon", "options", "placeholder", "track-by", "model-value"]));
124
125
  }
125
- }), M = "_select_1wypi_25", T = {
126
- select: M,
127
- "stash-select__chips": "_stash-select__chips_1wypi_30"
128
- }, z = {
129
- $style: T
130
- }, it = /* @__PURE__ */ $(L, [["__cssModules", z]]);
126
+ }), L = "_select_2rxjj_25", M = {
127
+ select: L,
128
+ "stash-select__chips": "_stash-select__chips_2rxjj_30"
129
+ }, T = {
130
+ $style: M
131
+ }, mt = /* @__PURE__ */ $(I, [["__cssModules", T]]);
131
132
  export {
132
- it as default
133
+ mt as default
133
134
  };
134
135
  //# sourceMappingURL=SelectStatus.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectStatus.js","sources":["../src/components/SelectStatus/SelectStatus.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, useAttrs, useCssModule } from 'vue';\n\n import { StashCommonColor, StashPrimaryColorGroup } from '../../../types';\n import { IconName } from '../Icon/Icon.types';\n import Icon from '../Icon/Icon.vue';\n import Select from '../Select/Select.vue';\n\n defineOptions({\n name: 'll-select-status',\n });\n\n export type SelectStatusOption = {\n id: number | string;\n name: string;\n color?: StashPrimaryColorGroup | StashCommonColor; // todo: just `StashPrimaryColor`?.\n icon?: IconName;\n };\n\n export interface SelectStatusProps {\n /**\n * Disables the component, if true\n */\n disabled?: boolean;\n /**\n * Which key of the prop option to use for display\n */\n displayBy?: string;\n /**\n * Sets the background color of the component to the color of the selected option\n */\n secondary?: boolean;\n /**\n * Allows option text to wrap to next line when set to true\n */\n noTruncate?: boolean;\n /**\n * Placeholder text\n */\n placeholder?: string;\n /**\n * The list of all options to select the status from\n * each object must have the following structure: { id: number | string, name: string, color?: string }\n */\n statusOptions: Array<SelectStatusOption>;\n /**\n * Default field to track the selected status by\n */\n trackBy?: string;\n /**\n * Sets the currently-selected option for the component\n */\n modelValue: number | string | boolean;\n /**\n * @deprecated Use `:model-value` or `v-model` instead of `:value`.\n */\n value?: number | string | boolean | null;\n }\n\n /**\n * Array containing the available dark fill colors that need a different text color.\n */\n const DARK_FILL_COLORS = ['green', 'teal', 'ice', 'yellow', 'seafoam', 'seafoam-700'];\n\n const attrs = useAttrs();\n const classes = useCssModule();\n\n const props = withDefaults(defineProps<SelectStatusProps>(), {\n disabled: false,\n displayBy: 'name',\n secondary: false,\n noTruncate: false,\n placeholder: 'Select Status',\n trackBy: 'id',\n value: null,\n });\n\n if (props.value) {\n throw new Error('ll-select-status: use :model-value or v-model instead of :value.');\n }\n\n if (attrs.onInput) {\n throw new Error('ll-select-status: use the @update:model-value event instead of @input');\n }\n\n const emit =\n defineEmits<{\n /**\n * Emitted when the model value changes\n */\n (e: 'update:model-value', value: unknown): void;\n }>();\n\n const valueOption = computed(() => {\n return props.statusOptions.find((status) => status[props.trackBy] === props.modelValue);\n });\n\n const hasDarkFill = computed(() => {\n const { color = '' } = valueOption.value || {};\n return DARK_FILL_COLORS.includes(color);\n });\n\n /**\n * @param {string} color Valid color name\n * @return {string} tailwind class for given color\n */\n function getBgColor(color: SelectStatusOption['color']): string {\n // if there's no hyphen then it's a color name and has no shade, so we default to 500\n return color?.includes('-') ? `tw-bg-${color}` : `tw-bg-${color}-500`;\n }\n\n /**\n * @param {string} color Valid color name\n * @return {string} tailwind class for given color\n */\n function getTextColor(color: SelectStatusOption['color']): string {\n // if there's no hyphen then it's a color name and has no shade, so we default to 500\n return color?.includes('-') ? `tw-text-${color}` : `tw-text-${color}-500`;\n }\n\n function onSelect(value?: SelectStatusOption): void {\n emit('update:model-value', value?.[props.trackBy] ?? '');\n }\n</script>\n\n<template>\n <Select\n ref=\"select\"\n hide-search\n single\n :class=\"[\n classes.select,\n {\n 'stash-select-status--filled': props.secondary,\n 'stash-select-status--filled-dark': props.secondary && hasDarkFill,\n },\n ]\"\n :disabled=\"props.disabled\"\n :icon=\"!props.disabled && 'caret-down'\"\n :options=\"props.statusOptions\"\n :placeholder=\"props.placeholder\"\n :track-by=\"props.trackBy\"\n :model-value=\"valueOption\"\n data-test=\"stash-select-status\"\n class=\"stash-select-status\"\n @update:model-value=\"onSelect\"\n >\n <template #selected=\"{ option }\">\n <div\n v-if=\"props.secondary\"\n class=\"\n stash-select-status--selected\n tw-absolute tw-flex tw-items-center tw-pl-3 tw-rounded tw-h-full tw-inset-0 tw-w-full\n \"\n data-test=\"select-status|value\"\n :class=\"[getBgColor(option.color)]\"\n >\n <span class=\"tw-truncate tw-mr-6\">{{ option[props.displayBy] }}</span>\n </div>\n\n <div v-else class=\"tw-flex tw-items-center\" data-test=\"select-status|value\">\n <Icon\n data-test=\"select-status|value-icon\"\n :name=\"option.icon || 'circle-status'\"\n :class=\"[\n { [getTextColor(option.color)]: option.color },\n { 'tw-text-ice-700': !option.color && !option.hexCode },\n ]\"\n :style=\"{ color: option.hexCode }\"\n />\n <span class=\"tw-truncate tw-ml-1.5 tw-mr-6\">{{ option[props.displayBy] }}</span>\n </div>\n </template>\n\n <template #option=\"{ option }\">\n <div class=\"tw-flex tw-min-w-0\">\n <Icon\n data-test=\"svg|status-color\"\n :name=\"option.icon || 'circle-status'\"\n :class=\"[\n { [getTextColor(option.color)]: option.color },\n { 'tw-text-ice-700': !option.color && !option.hexCode },\n ]\"\n class=\"!tw-shrink-0\"\n :style=\"{ color: option.hexCode }\"\n />\n <span data-test=\"span|option-text\" class=\"tw-ml-1.5\" :class=\"!props.noTruncate && 'tw-truncate'\">\n {{ option[props.displayBy] }}\n </span>\n </div>\n </template>\n </Select>\n</template>\n\n<style module>\n :global(.stash-select-status--filled .stash-select__content) {\n border: none;\n padding: 0;\n }\n\n :global(.stash-select-status--filled\n .stash-select--active\n .stash-select__content:focus-within\n .stash-select__border-selector) {\n box-sizing: content-box;\n max-width: calc(100% - 2px);\n }\n\n :global(.stash-select-status--filled .stash-select-status--selected),\n :global(.stash-select-status--filled :has(.stash-select-status--selected) .icon--caret-down) {\n color: theme('colors.white');\n }\n\n :global(.stash-select-status--filled-dark .stash-select-status--selected),\n :global(.stash-select-status--filled-dark :has(.stash-select-status--selected) .icon--caret-down) {\n color: theme('colors.ice.900');\n }\n\n .select :global(.stash-select--disabled > .stash-select__content) {\n background-color: transparent;\n border-color: transparent;\n }\n\n .select :deep(.stash-select__chips) {\n margin: 0;\n }\n\n .select :global(.stash-select__options) {\n margin: 0;\n padding: 0;\n }\n\n .select ul {\n position: relative;\n }\n</style>\n"],"names":["DARK_FILL_COLORS","attrs","useAttrs","classes","useCssModule","props","valueOption","computed","status","hasDarkFill","color","getBgColor","getTextColor","onSelect","value","emit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8DQA,IAAmB,CAAC,SAAS,QAAQ,OAAO,UAAU,WAAW,aAAa,GAE9EC,IAAQC,KACRC,IAAUC;AAYhB,QAAIC,EAAM;AACF,YAAA,IAAI,MAAM,kEAAkE;AAGpF,QAAIJ,EAAM;AACF,YAAA,IAAI,MAAM,uEAAuE;AAWnF,UAAAK,IAAcC,EAAS,MACpBF,EAAM,cAAc,KAAK,CAACG,MAAWA,EAAOH,EAAM,OAAO,MAAMA,EAAM,UAAU,CACvF,GAEKI,IAAcF,EAAS,MAAM;AACjC,YAAM,EAAE,OAAAG,IAAQ,GAAA,IAAOJ,EAAY,SAAS,CAAA;AACrC,aAAAN,EAAiB,SAASU,CAAK;AAAA,IAAA,CACvC;AAMD,aAASC,EAAWD,GAA4C;AAEvD,aAAAA,KAAA,QAAAA,EAAO,SAAS,OAAO,SAASA,CAAK,KAAK,SAASA,CAAK;AAAA,IACjE;AAMA,aAASE,EAAaF,GAA4C;AAEzD,aAAAA,KAAA,QAAAA,EAAO,SAAS,OAAO,WAAWA,CAAK,KAAK,WAAWA,CAAK;AAAA,IACrE;AAEA,aAASG,EAASC,GAAkC;AAClD,MAAAC,EAAK,uBAAsBD,KAAA,gBAAAA,EAAQT,EAAM,aAAY,EAAE;AAAA,IACzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"SelectStatus.js","sources":["../src/components/SelectStatus/SelectStatus.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, useAttrs, useCssModule } from 'vue';\n\n import { StashCommonColor, StashPrimaryColorGroup } from '../../../types';\n import { IconName } from '../Icon/Icon.types';\n import Icon from '../Icon/Icon.vue';\n import Select from '../Select/Select.vue';\n\n defineOptions({\n name: 'll-select-status',\n });\n\n export type SelectStatusOption = {\n id: number | string;\n name: string;\n color?: StashPrimaryColorGroup | StashCommonColor; // todo: just `StashPrimaryColor`?.\n icon?: IconName;\n };\n\n export interface SelectStatusProps {\n /**\n * Disables the component, if true\n */\n disabled?: boolean;\n /**\n * Which key of the prop option to use for display\n */\n displayBy?: string;\n /**\n * Sets the background color of the component to the color of the selected option\n */\n secondary?: boolean;\n /**\n * Allows option text to wrap to next line when set to true\n */\n noTruncate?: boolean;\n /**\n * Placeholder text\n */\n placeholder?: string;\n /**\n * The list of all options to select the status from\n * each object must have the following structure: { id: number | string, name: string, color?: string }\n */\n statusOptions: Array<SelectStatusOption>;\n /**\n * Default field to track the selected status by\n */\n trackBy?: string;\n /**\n * Sets the currently-selected option for the component\n */\n modelValue: number | string | boolean;\n /**\n * @deprecated Use `:model-value` or `v-model` instead of `:value`.\n */\n value?: number | string | boolean | null;\n }\n\n /**\n * Array containing the available dark fill colors that need a different text color.\n */\n const DARK_FILL_COLORS = ['green', 'teal', 'ice', 'yellow', 'seafoam', 'seafoam-700'];\n\n const attrs = useAttrs();\n const classes = useCssModule();\n\n const props = withDefaults(defineProps<SelectStatusProps>(), {\n disabled: false,\n displayBy: 'name',\n secondary: false,\n noTruncate: false,\n placeholder: 'Select Status',\n trackBy: 'id',\n value: null,\n });\n\n if (props.value) {\n throw new Error('ll-select-status: use :model-value or v-model instead of :value.');\n }\n\n if (attrs.onInput) {\n throw new Error('ll-select-status: use the @update:model-value event instead of @input');\n }\n\n const emit =\n defineEmits<{\n /**\n * Emitted when the model value changes\n */\n (e: 'update:model-value', value: unknown): void;\n }>();\n\n const valueOption = computed(() => {\n return props.statusOptions.find((status) => status[props.trackBy] === props.modelValue);\n });\n\n const hasDarkFill = computed(() => {\n const { color = '' } = valueOption.value || {};\n return DARK_FILL_COLORS.includes(color);\n });\n\n /**\n * @param {string} color Valid color name\n * @return {string} tailwind class for given color\n */\n function getBgColor(color: SelectStatusOption['color']): string {\n // if there's no hyphen then it's a color name and has no shade, so we default to 500\n return color?.includes('-') ? `tw-bg-${color}` : `tw-bg-${color}-500`;\n }\n\n /**\n * @param {string} color Valid color name\n * @return {string} tailwind class for given color\n */\n function getTextColor(color: SelectStatusOption['color']): string {\n // if there's no hyphen then it's a color name and has no shade, so we default to 500\n return color?.includes('-') ? `tw-text-${color}` : `tw-text-${color}-500`;\n }\n\n function onSelect(value?: SelectStatusOption): void {\n emit('update:model-value', value?.[props.trackBy] ?? '');\n }\n</script>\n\n<template>\n <Select\n ref=\"select\"\n hide-search\n single\n :class=\"[\n classes.select,\n {\n 'stash-select-status--filled': props.secondary,\n 'stash-select-status--filled-dark': props.secondary && hasDarkFill,\n },\n ]\"\n :disabled=\"props.disabled\"\n :icon=\"!props.disabled && 'caret-down'\"\n :options=\"props.statusOptions\"\n :placeholder=\"props.placeholder\"\n :track-by=\"props.trackBy\"\n :model-value=\"valueOption\"\n data-test=\"stash-select-status\"\n class=\"stash-select-status\"\n @update:model-value=\"onSelect\"\n >\n <template #selected=\"{ option }\">\n <div\n v-if=\"props.secondary\"\n class=\"\n stash-select-status--selected\n tw-absolute tw-inset-0 tw-flex tw-h-full tw-w-full tw-items-center tw-rounded tw-pl-3\n \"\n data-test=\"select-status|value\"\n :class=\"[getBgColor(option.color)]\"\n >\n <span class=\"tw-mr-6 tw-truncate\">{{ option[props.displayBy] }}</span>\n </div>\n\n <div v-else class=\"tw-flex tw-items-center\" data-test=\"select-status|value\">\n <Icon\n data-test=\"select-status|value-icon\"\n :name=\"option.icon || 'circle-status'\"\n :class=\"[\n { [getTextColor(option.color)]: option.color },\n { 'tw-text-ice-700': !option.color && !option.hexCode },\n ]\"\n :style=\"{ color: option.hexCode }\"\n />\n <span class=\"tw-ml-1.5 tw-mr-6 tw-truncate\">{{ option[props.displayBy] }}</span>\n </div>\n </template>\n\n <template #option=\"{ option }\">\n <div class=\"tw-flex tw-min-w-0\">\n <Icon\n data-test=\"svg|status-color\"\n :name=\"option.icon || 'circle-status'\"\n :class=\"[\n { [getTextColor(option.color)]: option.color },\n { 'tw-text-ice-700': !option.color && !option.hexCode },\n ]\"\n class=\"!tw-shrink-0\"\n :style=\"{ color: option.hexCode }\"\n />\n <span data-test=\"span|option-text\" class=\"tw-ml-1.5\" :class=\"!props.noTruncate && 'tw-truncate'\">\n {{ option[props.displayBy] }}\n </span>\n </div>\n </template>\n </Select>\n</template>\n\n<style module>\n :global(.stash-select-status--filled .stash-select__content) {\n border: none;\n padding: 0;\n }\n\n :global(.stash-select-status--filled\n .stash-select--active\n .stash-select__content:focus-within\n .stash-select__border-selector) {\n box-sizing: content-box;\n max-width: calc(100% - 2px);\n }\n\n :global(.stash-select-status--filled .stash-select-status--selected),\n :global(.stash-select-status--filled :has(.stash-select-status--selected) .icon--caret-down) {\n color: theme('colors.white');\n }\n\n :global(.stash-select-status--filled-dark .stash-select-status--selected),\n :global(.stash-select-status--filled-dark :has(.stash-select-status--selected) .icon--caret-down) {\n color: var(--color-ice-900);\n }\n\n .select :global(.stash-select--disabled > .stash-select__content) {\n background-color: transparent;\n border-color: transparent;\n }\n\n .select :deep(.stash-select__chips) {\n margin: 0;\n }\n\n .select :global(.stash-select__options) {\n margin: 0;\n padding: 0;\n }\n\n .select ul {\n position: relative;\n }\n</style>\n"],"names":["DARK_FILL_COLORS","attrs","useAttrs","classes","useCssModule","props","valueOption","computed","status","hasDarkFill","color","getBgColor","getTextColor","onSelect","value","emit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8DQA,IAAmB,CAAC,SAAS,QAAQ,OAAO,UAAU,WAAW,aAAa,GAE9EC,IAAQC,KACRC,IAAUC;AAYhB,QAAIC,EAAM;AACF,YAAA,IAAI,MAAM,kEAAkE;AAGpF,QAAIJ,EAAM;AACF,YAAA,IAAI,MAAM,uEAAuE;AAWnF,UAAAK,IAAcC,EAAS,MACpBF,EAAM,cAAc,KAAK,CAACG,MAAWA,EAAOH,EAAM,OAAO,MAAMA,EAAM,UAAU,CACvF,GAEKI,IAAcF,EAAS,MAAM;AACjC,YAAM,EAAE,OAAAG,IAAQ,GAAA,IAAOJ,EAAY,SAAS,CAAA;AACrC,aAAAN,EAAiB,SAASU,CAAK;AAAA,IAAA,CACvC;AAMD,aAASC,EAAWD,GAA4C;AAEvD,aAAAA,KAAA,QAAAA,EAAO,SAAS,OAAO,SAASA,CAAK,KAAK,SAASA,CAAK;AAAA,IACjE;AAMA,aAASE,EAAaF,GAA4C;AAEzD,aAAAA,KAAA,QAAAA,EAAO,SAAS,OAAO,WAAWA,CAAK,KAAK,WAAWA,CAAK;AAAA,IACrE;AAEA,aAASG,EAASC,GAAkC;AAClD,MAAAC,EAAK,uBAAsBD,KAAA,gBAAAA,EAAQT,EAAM,aAAY,EAAE;AAAA,IACzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/Step.js CHANGED
@@ -1,14 +1,14 @@
1
- import { defineComponent as f, useSlots as v, useCssModule as y, inject as h, computed as _, onBeforeMount as x, openBlock as a, createElementBlock as d, normalizeClass as o, unref as t, createElementVNode as i, createBlock as B, toDisplayString as m, createCommentVNode as u, renderSlot as k } from "vue";
2
- import b from "./Icon.js";
3
- import { S as g } from "./keys-7ecef029.js";
4
- import { _ as E } from "./_plugin-vue_export-helper-dad06003.js";
1
+ import { defineComponent as f, useSlots as v, useCssModule as h, inject as x, computed as _, onBeforeMount as z, openBlock as a, createElementBlock as r, normalizeClass as c, unref as t, createElementVNode as i, createBlock as y, toDisplayString as m, createCommentVNode as u, renderSlot as B } from "vue";
2
+ import k from "./Icon.js";
3
+ import { S as b } from "./keys-7ecef029.js";
4
+ import { _ as g } 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 C = {
8
+ const E = {
9
9
  key: 0,
10
- class: "tw-flex tw-flex-col tw-items-center tw-mr-3"
11
- }, S = { key: 1 }, z = /* @__PURE__ */ f({
10
+ class: "tw-mr-3 tw-flex tw-flex-col tw-items-center"
11
+ }, C = { key: 1 }, S = /* @__PURE__ */ f({
12
12
  __name: "Step",
13
13
  props: {
14
14
  active: { type: Boolean, default: !1 },
@@ -20,19 +20,19 @@ const C = {
20
20
  disabled: { type: Boolean, default: !1 }
21
21
  },
22
22
  setup(w) {
23
- const e = w, r = v(), l = y(), s = h(g), c = _(() => (s == null ? void 0 : s.orientation) === "horizontal"), n = _(() => (s == null ? void 0 : s.theme) === "light");
24
- return x(() => {
23
+ const e = w, n = v(), l = h(), s = x(b), o = _(() => (s == null ? void 0 : s.orientation) === "horizontal"), d = _(() => (s == null ? void 0 : s.theme) === "light");
24
+ return z(() => {
25
25
  s && s.registerStep(e.nested);
26
- }), (p, D) => (a(), d("li", {
27
- class: o(["stash-step tw-flex tw-relative tw-w-full", [
26
+ }), (p, D) => (a(), r("li", {
27
+ class: c(["stash-step tw-relative tw-flex tw-w-full", [
28
28
  t(l).step,
29
- { [t(l)["nested-step--active"]]: e.nested && e.active, "last:tw-w-auto": c.value }
29
+ { [t(l)["nested-step--active"]]: e.nested && e.active, "last:tw-w-auto": o.value }
30
30
  ]]),
31
31
  "data-test": "stash-step"
32
32
  }, [
33
- e.nested ? u("", !0) : (a(), d("div", C, [
33
+ e.nested ? u("", !0) : (a(), r("div", E, [
34
34
  i("div", {
35
- class: o([
35
+ class: c([
36
36
  t(l).circle,
37
37
  {
38
38
  [t(l)["circle--todo"]]: !e.error && !e.active && !e.completed,
@@ -42,70 +42,70 @@ const C = {
42
42
  }
43
43
  ])
44
44
  }, [
45
- (e.completed || e.error) && !e.active ? (a(), B(b, {
45
+ (e.completed || e.error) && !e.active ? (a(), y(k, {
46
46
  key: 0,
47
47
  name: e.completed ? "circle-check" : "circle-info",
48
48
  size: "dense"
49
- }, null, 8, ["name"])) : (a(), d("span", S, m(e.step), 1))
49
+ }, null, 8, ["name"])) : (a(), r("span", C, m(e.step), 1))
50
50
  ], 2),
51
51
  i("div", {
52
- class: o(["tw-my-1.5 tw-bg-ice-500 tw-w-[1px]", [
52
+ class: c(["tw-my-1.5 tw-w-px tw-bg-ice-500", [
53
53
  t(l).line,
54
- { [t(l)["line--expanded"]]: e.completed || e.active, "tw-hidden": c.value }
54
+ { [t(l)["line--expanded"]]: e.completed || e.active, "tw-hidden": o.value }
55
55
  ]])
56
56
  }, null, 2)
57
57
  ])),
58
58
  i("div", {
59
- class: o(["tw-flex", [
59
+ class: c(["tw-flex", [
60
60
  {
61
- "tw-flex-row tw-items-center tw-w-full": c.value,
62
- "tw-flex-col": !c.value
61
+ "tw-w-full tw-flex-row tw-items-center": o.value,
62
+ "tw-flex-col": !o.value
63
63
  }
64
64
  ]])
65
65
  }, [
66
66
  i("div", {
67
- class: o(["tw-whitespace-nowrap", [
67
+ class: c(["tw-whitespace-nowrap", [
68
68
  t(l).title,
69
69
  {
70
70
  "tw-cursor-pointer": !e.active && (e.completed || e.error),
71
71
  "tw-cursor-not-allowed": e.disabled,
72
- "tw-text-ice-900": n.value,
72
+ "tw-text-ice-900": d.value,
73
73
  "!tw-font-semibold": e.active,
74
- "tw-text-white": !e.disabled && !n.value
74
+ "tw-text-white": !e.disabled && !d.value
75
75
  }
76
76
  ]])
77
77
  }, m(e.text), 3),
78
- c.value ? (a(), d("div", {
78
+ o.value ? (a(), r("div", {
79
79
  key: 0,
80
- class: o(["tw-border-t tw-mx-1.5 group-last:tw-hidden", [t(l).line, { [t(l)["line--expanded"]]: e.completed || e.active }]])
80
+ class: c(["tw-mx-1.5 tw-border-t group-last:tw-hidden", [t(l).line, { [t(l)["line--expanded"]]: e.completed || e.active }]])
81
81
  }, null, 2)) : u("", !0),
82
82
  i("div", {
83
- class: o({ "tw-pb-9": !p.nested && !t(r).default, "tw-hidden": c.value })
83
+ class: c({ "tw-pb-9": !p.nested && !t(n).default, "tw-hidden": o.value })
84
84
  }, [
85
85
  i("ul", {
86
- class: o([t(l).nested, { "tw-hidden": !t(r).default }])
86
+ class: c([t(l).nested, { "tw-hidden": !t(n).default }])
87
87
  }, [
88
- k(p.$slots, "default")
88
+ B(p.$slots, "default")
89
89
  ], 2)
90
90
  ], 2)
91
91
  ], 2)
92
92
  ], 2));
93
93
  }
94
- }), M = "_step_s5dyo_2", N = "_title_s5dyo_11", I = "_line_s5dyo_22", T = "_circle_s5dyo_35", P = "_nested_s5dyo_18", V = {
94
+ }), M = "_step_1h7zt_2", N = "_title_1h7zt_11", I = "_line_1h7zt_22", T = "_circle_1h7zt_35", P = "_nested_1h7zt_18", V = {
95
95
  step: M,
96
96
  title: N,
97
- "nested-step--active": "_nested-step--active_s5dyo_18",
97
+ "nested-step--active": "_nested-step--active_1h7zt_18",
98
98
  line: I,
99
- "line--expanded": "_line--expanded_s5dyo_31",
99
+ "line--expanded": "_line--expanded_1h7zt_31",
100
100
  circle: T,
101
- "circle--todo": "_circle--todo_s5dyo_46",
102
- "circle--active": "_circle--active_s5dyo_52",
103
- "circle--completed": "_circle--completed_s5dyo_58",
104
- "circle--error": "_circle--error_s5dyo_65",
101
+ "circle--todo": "_circle--todo_1h7zt_46",
102
+ "circle--active": "_circle--active_1h7zt_52",
103
+ "circle--completed": "_circle--completed_1h7zt_58",
104
+ "circle--error": "_circle--error_1h7zt_65",
105
105
  nested: P
106
106
  }, $ = {
107
107
  $style: V
108
- }, q = /* @__PURE__ */ E(z, [["__cssModules", $]]);
108
+ }, q = /* @__PURE__ */ g(S, [["__cssModules", $]]);
109
109
  export {
110
110
  q as default
111
111
  };
package/dist/Step.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Step.js","sources":["../src/components/Step/Step.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, useCssModule, useSlots } from 'vue';\n\n import Icon from '../Icon/Icon.vue';\n import { STEPPER_INJECTION_KEY } from '../Stepper/keys';\n\n export interface StepProps {\n /**\n * Indicates if the step is currently active.\n * This takes precedence over `completed` and `error`\n */\n active?: boolean;\n /**\n * Indicates if the step is completed\n */\n completed?: boolean;\n /**\n * Indicates if the step has an error\n * This takes precedence over `completed`\n */\n error?: boolean;\n /**\n * The text to display in the step\n */\n text: string;\n /**\n * Indicates if the step is nested\n */\n nested?: boolean;\n /**\n * The text to display in the step circle\n */\n step?: string;\n /**\n * Indicates if the step is disabled\n */\n disabled?: boolean;\n }\n\n const props = withDefaults(defineProps<StepProps>(), {\n active: false,\n completed: false,\n error: false,\n nested: false,\n step: undefined,\n disabled: false,\n });\n\n const slots = useSlots();\n const classes = useCssModule();\n\n const injectedStepper = inject(STEPPER_INJECTION_KEY);\n\n const isHorizontal = computed(() => injectedStepper?.orientation === 'horizontal');\n\n const isLightThemed = computed(() => injectedStepper?.theme === 'light');\n\n // OnBeforeMount ensures that steps and substeps are registered in the correct order\n onBeforeMount(() => {\n if (injectedStepper) {\n injectedStepper.registerStep(props.nested);\n }\n });\n</script>\n\n<template>\n <li\n class=\"stash-step tw-flex tw-relative tw-w-full\"\n data-test=\"stash-step\"\n :class=\"[\n classes.step,\n { [classes['nested-step--active']]: props.nested && props.active, 'last:tw-w-auto': isHorizontal },\n ]\"\n >\n <div v-if=\"!props.nested\" class=\"tw-flex tw-flex-col tw-items-center tw-mr-3\">\n <div\n :class=\"[\n classes.circle,\n {\n [classes['circle--todo']]: !props.error && !props.active && !props.completed,\n [classes['circle--error']]: props.error && !props.active,\n [classes['circle--completed']]: props.completed && !props.active,\n [classes['circle--active']]: props.active,\n },\n ]\"\n >\n <Icon\n v-if=\"(props.completed || props.error) && !props.active\"\n :name=\"props.completed ? 'circle-check' : 'circle-info'\"\n size=\"dense\"\n />\n <span v-else>{{ props.step }}</span>\n </div>\n <div\n class=\"tw-my-1.5 tw-bg-ice-500 tw-w-[1px]\"\n :class=\"[\n classes.line,\n { [classes['line--expanded']]: props.completed || props.active, 'tw-hidden': isHorizontal },\n ]\"\n />\n </div>\n <div\n class=\"tw-flex\"\n :class=\"[\n {\n 'tw-flex-row tw-items-center tw-w-full': isHorizontal,\n 'tw-flex-col': !isHorizontal,\n },\n ]\"\n >\n <div\n class=\"tw-whitespace-nowrap\"\n :class=\"[\n classes.title,\n {\n 'tw-cursor-pointer': !props.active && (props.completed || props.error),\n 'tw-cursor-not-allowed': props.disabled,\n 'tw-text-ice-900': isLightThemed,\n '!tw-font-semibold': props.active,\n 'tw-text-white': !props.disabled && !isLightThemed,\n },\n ]\"\n >\n {{ props.text }}\n </div>\n <div\n v-if=\"isHorizontal\"\n class=\"tw-border-t tw-mx-1.5 group-last:tw-hidden\"\n :class=\"[classes.line, { [classes['line--expanded']]: props.completed || props.active }]\"\n />\n <div :class=\"{ 'tw-pb-9': !nested && !slots.default, 'tw-hidden': isHorizontal }\">\n <ul :class=\"[classes.nested, { 'tw-hidden': !slots.default }]\">\n <!-- @slot Default slot to compose multiple nested steps -->\n <slot></slot>\n </ul>\n </div>\n </div>\n </li>\n</template>\n\n<style module>\n .step::before {\n content: '●';\n position: absolute;\n color: theme('colors.white');\n left: -28px;\n opacity: 0;\n transition: opacity 500ms cubic-bezier(0.85, 0, 0.15, 1);\n }\n\n .title {\n font-weight: theme('fontWeight.medium');\n font-size: 1rem;\n margin-top: 1px;\n user-select: none;\n }\n\n .nested-step--active::before {\n opacity: 1;\n }\n\n .line {\n flex-grow: 0;\n transition: flex-grow 500ms cubic-bezier(0.87, 0, 0.13, 1);\n }\n\n .step:last-child .line {\n display: none;\n }\n\n .line--expanded {\n flex-grow: 1;\n }\n\n .circle {\n width: theme('spacing.6');\n height: theme('spacing.6');\n line-height: theme('spacing.6');\n border-radius: theme('borderRadius.full');\n display: grid;\n place-items: center;\n font-weight: theme('fontWeight.medium');\n transition: background-color 500ms, color 500ms;\n }\n\n .circle--todo {\n background-color: rgb(255 255 255 / 50%);\n color: #4d4a69;\n border: 1px solid #747293;\n }\n\n .circle--active {\n background-color: theme('colors.blue.500');\n color: theme('colors.white');\n border: 1px solid transparent;\n }\n\n .circle--completed {\n background-color: theme('colors.white');\n border: 1px solid theme('colors.ice.500');\n color: theme('colors.green.500');\n cursor: pointer;\n }\n\n .circle--error {\n background-color: theme('colors.white');\n border: 1px solid theme('colors.ice.500');\n color: theme('colors.red.500');\n cursor: pointer;\n }\n\n .nested {\n padding: calc(theme('spacing.3') + theme('spacing[1.5]')) 0;\n }\n\n .nested li + li {\n margin-top: theme('spacing.3');\n }\n\n .nested .title {\n font-weight: theme('fontWeight.normal');\n font-size: 0.9rem;\n }\n</style>\n"],"names":["slots","useSlots","classes","useCssModule","injectedStepper","inject","STEPPER_INJECTION_KEY","isHorizontal","computed","isLightThemed","onBeforeMount","props"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAgDQA,IAAQC,KACRC,IAAUC,KAEVC,IAAkBC,EAAOC,CAAqB,GAE9CC,IAAeC,EAAS,OAAMJ,KAAA,gBAAAA,EAAiB,iBAAgB,YAAY,GAE3EK,IAAgBD,EAAS,OAAMJ,KAAA,gBAAAA,EAAiB,WAAU,OAAO;AAGvE,WAAAM,EAAc,MAAM;AAClB,MAAIN,KACcA,EAAA,aAAaO,EAAM,MAAM;AAAA,IAC3C,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Step.js","sources":["../src/components/Step/Step.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, inject, onBeforeMount, useCssModule, useSlots } from 'vue';\n\n import Icon from '../Icon/Icon.vue';\n import { STEPPER_INJECTION_KEY } from '../Stepper/keys';\n\n export interface StepProps {\n /**\n * Indicates if the step is currently active.\n * This takes precedence over `completed` and `error`\n */\n active?: boolean;\n /**\n * Indicates if the step is completed\n */\n completed?: boolean;\n /**\n * Indicates if the step has an error\n * This takes precedence over `completed`\n */\n error?: boolean;\n /**\n * The text to display in the step\n */\n text: string;\n /**\n * Indicates if the step is nested\n */\n nested?: boolean;\n /**\n * The text to display in the step circle\n */\n step?: string;\n /**\n * Indicates if the step is disabled\n */\n disabled?: boolean;\n }\n\n const props = withDefaults(defineProps<StepProps>(), {\n active: false,\n completed: false,\n error: false,\n nested: false,\n step: undefined,\n disabled: false,\n });\n\n const slots = useSlots();\n const classes = useCssModule();\n\n const injectedStepper = inject(STEPPER_INJECTION_KEY);\n\n const isHorizontal = computed(() => injectedStepper?.orientation === 'horizontal');\n\n const isLightThemed = computed(() => injectedStepper?.theme === 'light');\n\n // OnBeforeMount ensures that steps and substeps are registered in the correct order\n onBeforeMount(() => {\n if (injectedStepper) {\n injectedStepper.registerStep(props.nested);\n }\n });\n</script>\n\n<template>\n <li\n class=\"stash-step tw-relative tw-flex tw-w-full\"\n data-test=\"stash-step\"\n :class=\"[\n classes.step,\n { [classes['nested-step--active']]: props.nested && props.active, 'last:tw-w-auto': isHorizontal },\n ]\"\n >\n <div v-if=\"!props.nested\" class=\"tw-mr-3 tw-flex tw-flex-col tw-items-center\">\n <div\n :class=\"[\n classes.circle,\n {\n [classes['circle--todo']]: !props.error && !props.active && !props.completed,\n [classes['circle--error']]: props.error && !props.active,\n [classes['circle--completed']]: props.completed && !props.active,\n [classes['circle--active']]: props.active,\n },\n ]\"\n >\n <Icon\n v-if=\"(props.completed || props.error) && !props.active\"\n :name=\"props.completed ? 'circle-check' : 'circle-info'\"\n size=\"dense\"\n />\n <span v-else>{{ props.step }}</span>\n </div>\n <div\n class=\"tw-my-1.5 tw-w-px tw-bg-ice-500\"\n :class=\"[\n classes.line,\n { [classes['line--expanded']]: props.completed || props.active, 'tw-hidden': isHorizontal },\n ]\"\n />\n </div>\n <div\n class=\"tw-flex\"\n :class=\"[\n {\n 'tw-w-full tw-flex-row tw-items-center': isHorizontal,\n 'tw-flex-col': !isHorizontal,\n },\n ]\"\n >\n <div\n class=\"tw-whitespace-nowrap\"\n :class=\"[\n classes.title,\n {\n 'tw-cursor-pointer': !props.active && (props.completed || props.error),\n 'tw-cursor-not-allowed': props.disabled,\n 'tw-text-ice-900': isLightThemed,\n '!tw-font-semibold': props.active,\n 'tw-text-white': !props.disabled && !isLightThemed,\n },\n ]\"\n >\n {{ props.text }}\n </div>\n <div\n v-if=\"isHorizontal\"\n class=\"tw-mx-1.5 tw-border-t group-last:tw-hidden\"\n :class=\"[classes.line, { [classes['line--expanded']]: props.completed || props.active }]\"\n />\n <div :class=\"{ 'tw-pb-9': !nested && !slots.default, 'tw-hidden': isHorizontal }\">\n <ul :class=\"[classes.nested, { 'tw-hidden': !slots.default }]\">\n <!-- @slot Default slot to compose multiple nested steps -->\n <slot></slot>\n </ul>\n </div>\n </div>\n </li>\n</template>\n\n<style module>\n .step::before {\n content: '●';\n position: absolute;\n color: theme('colors.white');\n left: -28px;\n opacity: 0;\n transition: opacity 500ms cubic-bezier(0.85, 0, 0.15, 1);\n }\n\n .title {\n font-weight: theme('fontWeight.medium');\n font-size: 1rem;\n margin-top: 1px;\n user-select: none;\n }\n\n .nested-step--active::before {\n opacity: 1;\n }\n\n .line {\n flex-grow: 0;\n transition: flex-grow 500ms cubic-bezier(0.87, 0, 0.13, 1);\n }\n\n .step:last-child .line {\n display: none;\n }\n\n .line--expanded {\n flex-grow: 1;\n }\n\n .circle {\n width: theme('spacing.6');\n height: theme('spacing.6');\n line-height: theme('spacing.6');\n border-radius: theme('borderRadius.full');\n display: grid;\n place-items: center;\n font-weight: theme('fontWeight.medium');\n transition: background-color 500ms, color 500ms;\n }\n\n .circle--todo {\n background-color: rgb(255 255 255 / 50%);\n color: #4d4a69;\n border: 1px solid #747293;\n }\n\n .circle--active {\n background-color: var(--color-blue-500);\n color: theme('colors.white');\n border: 1px solid transparent;\n }\n\n .circle--completed {\n background-color: theme('colors.white');\n border: 1px solid var(--color-ice-500);\n color: var(--color-green-500);\n cursor: pointer;\n }\n\n .circle--error {\n background-color: theme('colors.white');\n border: 1px solid var(--color-ice-500);\n color: var(--color-red-500);\n cursor: pointer;\n }\n\n .nested {\n padding: calc(theme('spacing.3') + theme('spacing[1.5]')) 0;\n }\n\n .nested li + li {\n margin-top: theme('spacing.3');\n }\n\n .nested .title {\n font-weight: theme('fontWeight.normal');\n font-size: 0.9rem;\n }\n</style>\n"],"names":["slots","useSlots","classes","useCssModule","injectedStepper","inject","STEPPER_INJECTION_KEY","isHorizontal","computed","isLightThemed","onBeforeMount","props"],"mappings":";;;;;;;;;;;;;;;;;;;;;;iBAgDQA,IAAQC,KACRC,IAAUC,KAEVC,IAAkBC,EAAOC,CAAqB,GAE9CC,IAAeC,EAAS,OAAMJ,KAAA,gBAAAA,EAAiB,iBAAgB,YAAY,GAE3EK,IAAgBD,EAAS,OAAMJ,KAAA,gBAAAA,EAAiB,WAAU,OAAO;AAGvE,WAAAM,EAAc,MAAM;AAClB,MAAIN,KACcA,EAAA,aAAaO,EAAM,MAAM;AAAA,IAC3C,CACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/Switch.js CHANGED
@@ -1,7 +1,8 @@
1
- import { defineComponent as v, useAttrs as x, useSlots as k, computed as o, openBlock as d, createElementBlock as i, normalizeClass as a, unref as n, createElementVNode as l, mergeProps as g, withDirectives as y, vModelCheckbox as S, toDisplayString as u, createCommentVNode as p, renderSlot as I, createTextVNode as A, pushScopeId as C, popScopeId as V } from "vue";
2
- import B from "lodash-es/uniqueId";
3
- import { _ as T } from "./_plugin-vue_export-helper-dad06003.js";
4
- const E = (s) => (C("data-v-dc85b7ec"), s = s(), V(), s), N = ["data-test"], D = ["for"], q = /* @__PURE__ */ E(() => /* @__PURE__ */ l("span", { class: "stash-switch__control tw-bg-white tw-border tw-border-solid tw-border-ice-500 tw-rounded-[10px] tw-h-5 tw-absolute tw-left-0 tw-w-5 tw-shadow" }, null, -1)), z = ["id", "disabled", "name", "value"], M = /* @__PURE__ */ v({
1
+ import { defineComponent as v, useAttrs as x, useSlots as k, computed as c, openBlock as d, createElementBlock as i, normalizeClass as a, unref as n, createElementVNode as l, mergeProps as g, withDirectives as y, vModelCheckbox as S, toDisplayString as u, createCommentVNode as p, renderSlot as I, createTextVNode as A, pushScopeId as C, popScopeId as V } from "vue";
2
+ import B from "@leaflink/snitch";
3
+ import T from "lodash-es/uniqueId";
4
+ import { _ as E } from "./_plugin-vue_export-helper-dad06003.js";
5
+ const N = (s) => (C("data-v-148dbe3f"), s = s(), V(), s), D = ["data-test"], q = ["for"], z = /* @__PURE__ */ N(() => /* @__PURE__ */ l("span", { class: "stash-switch__control tw-absolute tw-left-0 tw-h-5 tw-w-5 tw-rounded-[10px] tw-border tw-border-solid tw-border-ice-500 tw-bg-white tw-shadow" }, null, -1)), M = ["id", "disabled", "name", "value"], P = /* @__PURE__ */ v({
5
6
  name: "ll-switch",
6
7
  inheritAttrs: !1,
7
8
  __name: "Switch",
@@ -16,47 +17,47 @@ const E = (s) => (C("data-v-dc85b7ec"), s = s(), V(), s), N = ["data-test"], D =
16
17
  },
17
18
  emits: ["update:checked"],
18
19
  setup(s, { emit: b }) {
19
- const t = s, c = x(), _ = k();
20
- if (typeof t.value == "boolean" && console.warn("Switch: use `checked` to toggle the state; `value` is what will be set if `checked` is true"), c.onChange)
20
+ const t = s, o = x(), f = k();
21
+ if (typeof t.value == "boolean" && B.warn("Switch: use `checked` to toggle the state; `value` is what will be set if `checked` is true"), o.onChange)
21
22
  throw new Error("ll-switch: use the @update:checked event instead of @change.");
22
- const f = o(() => {
23
- const e = { ...c };
23
+ const m = c(() => {
24
+ const e = { ...o };
24
25
  return delete e["data-test"], delete e.class, e;
25
- }), r = o({
26
+ }), r = c({
26
27
  get() {
27
28
  return t.checked;
28
29
  },
29
30
  set(e) {
30
31
  b("update:checked", e);
31
32
  }
32
- }), w = o(() => t.id || B("switch-"));
33
+ }), w = c(() => t.id || T("switch-"));
33
34
  return (e, h) => (d(), i("div", {
34
- class: a(["stash-switch", n(c).class]),
35
- "data-test": n(c)["data-test"] || "stash-switch"
35
+ class: a(["stash-switch", n(o).class]),
36
+ "data-test": n(o)["data-test"] || "stash-switch"
36
37
  }, [
37
38
  l("label", g({
38
39
  for: w.value,
39
40
  class: [{ "tw-pointer-events-none": t.disabled }, "tw-flex tw-cursor-pointer"],
40
41
  "data-test": "stash-switch|label"
41
- }, f.value), [
42
+ }, m.value), [
42
43
  l("span", {
43
- class: a(["tw-inline-block tw-h-5 tw-relative tw-min-w-[34px] tw-w-[34px]", { "is-active": t.checked }])
44
+ class: a(["tw-relative tw-inline-block tw-h-5 tw-w-[34px] tw-min-w-[34px]", { "is-active": t.checked }])
44
45
  }, [
45
46
  l("span", {
46
- class: a(["stash-switch__track tw-rounded-[10px] tw-h-4 tw-absolute tw-top-0.5 tw-w-full", t.disabled ? "tw-bg-ice-500" : "tw-bg-ice-700"])
47
+ class: a(["stash-switch__track tw-absolute tw-top-0.5 tw-h-4 tw-w-full tw-rounded-[10px]", t.disabled ? "tw-bg-ice-500" : "tw-bg-ice-700"])
47
48
  }, null, 2),
48
- q
49
+ z
49
50
  ], 2),
50
51
  y(l("input", {
51
52
  id: w.value,
52
- "onUpdate:modelValue": h[0] || (h[0] = (m) => r.value = m),
53
+ "onUpdate:modelValue": h[0] || (h[0] = (_) => r.value = _),
53
54
  type: "checkbox",
54
55
  disabled: t.disabled,
55
56
  name: t.name,
56
57
  tabindex: "0",
57
58
  value: e.value,
58
59
  class: "tw-sr-only"
59
- }, null, 8, z), [
60
+ }, null, 8, M), [
60
61
  [S, r.value]
61
62
  ]),
62
63
  t.label ? (d(), i("span", {
@@ -65,24 +66,24 @@ const E = (s) => (C("data-v-dc85b7ec"), s = s(), V(), s), N = ["data-test"], D =
65
66
  "tw-text-ice-700": !t.checked && !t.disabled,
66
67
  "tw-text-ice-900": t.checked,
67
68
  "tw-text-ice-500": t.disabled
68
- }, "tw-relative tw-top-[1px] tw-ml-1.5"]),
69
+ }, "tw-relative tw-top-px tw-ml-1.5"]),
69
70
  "data-test": "stash-switch|label-text"
70
71
  }, u(t.label), 3)) : p("", !0)
71
- ], 16, D),
72
- t.hintText || n(_).hint ? (d(), i("span", {
72
+ ], 16, q),
73
+ t.hintText || n(f).hint ? (d(), i("span", {
73
74
  key: 0,
74
- class: a(["tw-block tw-text-xs tw-mt-1.5 tw-ml-[40px] tw-whitespace-pre-line", { "tw-text-ice-500": t.disabled }]),
75
+ class: a(["tw-ml-[40px] tw-mt-1.5 tw-block tw-whitespace-pre-line tw-text-xs", { "tw-text-ice-500": t.disabled }]),
75
76
  "data-test": "stash-switch|hint"
76
77
  }, [
77
78
  I(e.$slots, "hint", {}, () => [
78
79
  A(u(t.hintText), 1)
79
80
  ], !0)
80
81
  ], 2)) : p("", !0)
81
- ], 10, N));
82
+ ], 10, D));
82
83
  }
83
84
  });
84
- const j = /* @__PURE__ */ T(M, [["__scopeId", "data-v-dc85b7ec"]]);
85
+ const G = /* @__PURE__ */ E(P, [["__scopeId", "data-v-148dbe3f"]]);
85
86
  export {
86
- j as default
87
+ G as default
87
88
  };
88
89
  //# sourceMappingURL=Switch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sources":["../src/components/Switch/Switch.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, useAttrs, useSlots } from 'vue';\n\n export interface SwitchProps {\n /**\n * The current checked value, can be a boolean or an array of values\n */\n checked?: boolean | Array<string | number>;\n /**\n * Prevent the user from changing the switch state.\n */\n disabled?: boolean;\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n /**\n * Unique ID for the switch, required for accessibility purposes\n */\n id?: string;\n /**\n * Label text to display with switch\n */\n label?: string;\n /**\n * HTML name property\n */\n name?: string;\n /**\n * Value associated with switch when it is `checked`. This value is\n * used to compare against `checked` property when passed as an array.\n */\n value?: string | number;\n }\n\n defineOptions({\n name: 'll-switch',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<SwitchProps>(), {\n checked: false,\n disabled: false,\n hintText: '',\n id: undefined,\n label: '',\n name: '',\n value: '',\n });\n\n const attrs = useAttrs();\n const slots = useSlots();\n\n const emit =\n defineEmits<{\n (e: 'update:checked', value: SwitchProps['checked']): void;\n }>();\n\n if (typeof props.value === 'boolean') {\n console.warn('Switch: use `checked` to toggle the state; `value` is what will be set if `checked` is true');\n }\n\n if (attrs.onChange) {\n throw new Error('ll-switch: use the @update:checked event instead of @change.');\n }\n\n const switchAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs['data-test'];\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const internalValue = computed({\n get() {\n return props.checked;\n },\n set(value) {\n emit('update:checked', value);\n },\n });\n\n const switchId = computed(() => props.id || uniqueId('switch-'));\n</script>\n\n<template>\n <div class=\"stash-switch\" :class=\"attrs['class']\" :data-test=\"attrs['data-test'] || 'stash-switch'\">\n <label\n :for=\"switchId\"\n :class=\"{ 'tw-pointer-events-none': props.disabled }\"\n class=\"tw-flex tw-cursor-pointer\"\n data-test=\"stash-switch|label\"\n v-bind=\"switchAttrs\"\n >\n <span\n class=\"tw-inline-block tw-h-5 tw-relative tw-min-w-[34px] tw-w-[34px]\"\n :class=\"{ 'is-active': props.checked }\"\n >\n <span\n class=\"stash-switch__track tw-rounded-[10px] tw-h-4 tw-absolute tw-top-0.5 tw-w-full\"\n :class=\"props.disabled ? 'tw-bg-ice-500' : 'tw-bg-ice-700'\"\n ></span>\n <span\n class=\"\n stash-switch__control\n tw-bg-white\n tw-border\n tw-border-solid\n tw-border-ice-500\n tw-rounded-[10px]\n tw-h-5\n tw-absolute\n tw-left-0\n tw-w-5\n tw-shadow\n \"\n ></span>\n </span>\n <input\n :id=\"switchId\"\n v-model=\"internalValue\"\n type=\"checkbox\"\n :disabled=\"props.disabled\"\n :name=\"props.name\"\n tabindex=\"0\"\n :value=\"value\"\n class=\"tw-sr-only\"\n />\n <span\n v-if=\"props.label\"\n :class=\"{\n 'tw-text-ice-700': !props.checked && !props.disabled,\n 'tw-text-ice-900': props.checked,\n 'tw-text-ice-500': props.disabled,\n }\"\n class=\"tw-relative tw-top-[1px] tw-ml-1.5\"\n data-test=\"stash-switch|label-text\"\n >{{ props.label }}</span\n >\n </label>\n <span\n v-if=\"props.hintText || slots.hint\"\n class=\"tw-block tw-text-xs tw-mt-1.5 tw-ml-[40px] tw-whitespace-pre-line\"\n :class=\"{ 'tw-text-ice-500': props.disabled }\"\n data-test=\"stash-switch|hint\"\n >\n <!-- @slot for displaying hint text -->\n <slot name=\"hint\">{{ props.hintText }}</slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n .is-active .stash-switch__track {\n @apply tw-bg-blue-500;\n }\n\n .stash-switch__control {\n transition: left 0.2s ease-in-out;\n\n .is-active & {\n @apply tw-left-3.5; /* track width - switch width */\n }\n }\n</style>\n"],"names":["attrs","useAttrs","slots","useSlots","props","switchAttrs","computed","tempAttrs","internalValue","value","emit","switchId","uniqueId"],"mappings":";;;;;;;;;;;;;;;;;;iBAmDQA,IAAQC,KACRC,IAAQC;AAWd,QAJI,OAAOC,EAAM,SAAU,aACzB,QAAQ,KAAK,6FAA6F,GAGxGJ,EAAM;AACF,YAAA,IAAI,MAAM,8DAA8D;AAG1E,UAAAK,IAAcC,EAAS,MAAM;AAC3B,YAAAC,IAAY,EAAE,GAAGP;AAEvB,oBAAOO,EAAU,WAAW,GAC5B,OAAOA,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAgBF,EAAS;AAAA,MAC7B,MAAM;AACJ,eAAOF,EAAM;AAAA,MACf;AAAA,MACA,IAAIK,GAAO;AACT,QAAAC,EAAK,kBAAkBD,CAAK;AAAA,MAC9B;AAAA,IAAA,CACD,GAEKE,IAAWL,EAAS,MAAMF,EAAM,MAAMQ,EAAS,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Switch.js","sources":["../src/components/Switch/Switch.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, useAttrs, useSlots } from 'vue';\n\n export interface SwitchProps {\n /**\n * The current checked value, can be a boolean or an array of values\n */\n checked?: boolean | Array<string | number>;\n /**\n * Prevent the user from changing the switch state.\n */\n disabled?: boolean;\n /**\n * Displays text below the input; hidden when the isReadOnly prop is truthy.\n */\n hintText?: string;\n /**\n * Unique ID for the switch, required for accessibility purposes\n */\n id?: string;\n /**\n * Label text to display with switch\n */\n label?: string;\n /**\n * HTML name property\n */\n name?: string;\n /**\n * Value associated with switch when it is `checked`. This value is\n * used to compare against `checked` property when passed as an array.\n */\n value?: string | number;\n }\n\n defineOptions({\n name: 'll-switch',\n inheritAttrs: false,\n });\n\n const props = withDefaults(defineProps<SwitchProps>(), {\n checked: false,\n disabled: false,\n hintText: '',\n id: undefined,\n label: '',\n name: '',\n value: '',\n });\n\n const attrs = useAttrs();\n const slots = useSlots();\n\n const emit =\n defineEmits<{\n (e: 'update:checked', value: SwitchProps['checked']): void;\n }>();\n\n if (typeof props.value === 'boolean') {\n logger.warn('Switch: use `checked` to toggle the state; `value` is what will be set if `checked` is true');\n }\n\n if (attrs.onChange) {\n throw new Error('ll-switch: use the @update:checked event instead of @change.');\n }\n\n const switchAttrs = computed(() => {\n const tempAttrs = { ...attrs };\n\n delete tempAttrs['data-test'];\n delete tempAttrs.class;\n\n return tempAttrs;\n });\n\n const internalValue = computed({\n get() {\n return props.checked;\n },\n set(value) {\n emit('update:checked', value);\n },\n });\n\n const switchId = computed(() => props.id || uniqueId('switch-'));\n</script>\n\n<template>\n <div class=\"stash-switch\" :class=\"attrs['class']\" :data-test=\"attrs['data-test'] || 'stash-switch'\">\n <label\n :for=\"switchId\"\n :class=\"{ 'tw-pointer-events-none': props.disabled }\"\n class=\"tw-flex tw-cursor-pointer\"\n data-test=\"stash-switch|label\"\n v-bind=\"switchAttrs\"\n >\n <span\n class=\"tw-relative tw-inline-block tw-h-5 tw-w-[34px] tw-min-w-[34px]\"\n :class=\"{ 'is-active': props.checked }\"\n >\n <span\n class=\"stash-switch__track tw-absolute tw-top-0.5 tw-h-4 tw-w-full tw-rounded-[10px]\"\n :class=\"props.disabled ? 'tw-bg-ice-500' : 'tw-bg-ice-700'\"\n ></span>\n <span\n class=\"\n stash-switch__control\n tw-absolute\n tw-left-0\n tw-h-5\n tw-w-5\n tw-rounded-[10px]\n tw-border\n tw-border-solid\n tw-border-ice-500\n tw-bg-white\n tw-shadow\n \"\n ></span>\n </span>\n <input\n :id=\"switchId\"\n v-model=\"internalValue\"\n type=\"checkbox\"\n :disabled=\"props.disabled\"\n :name=\"props.name\"\n tabindex=\"0\"\n :value=\"value\"\n class=\"tw-sr-only\"\n />\n <span\n v-if=\"props.label\"\n :class=\"{\n 'tw-text-ice-700': !props.checked && !props.disabled,\n 'tw-text-ice-900': props.checked,\n 'tw-text-ice-500': props.disabled,\n }\"\n class=\"tw-relative tw-top-px tw-ml-1.5\"\n data-test=\"stash-switch|label-text\"\n >{{ props.label }}</span\n >\n </label>\n <span\n v-if=\"props.hintText || slots.hint\"\n class=\"tw-ml-[40px] tw-mt-1.5 tw-block tw-whitespace-pre-line tw-text-xs\"\n :class=\"{ 'tw-text-ice-500': props.disabled }\"\n data-test=\"stash-switch|hint\"\n >\n <!-- @slot for displaying hint text -->\n <slot name=\"hint\">{{ props.hintText }}</slot>\n </span>\n </div>\n</template>\n\n<style scoped>\n .is-active .stash-switch__track {\n @apply tw-bg-blue-500;\n }\n\n .stash-switch__control {\n transition: left 0.2s ease-in-out;\n\n .is-active & {\n @apply tw-left-3.5; /* track width - switch width */\n }\n }\n</style>\n"],"names":["attrs","useAttrs","slots","useSlots","props","logger","switchAttrs","computed","tempAttrs","internalValue","value","emit","switchId","uniqueId"],"mappings":";;;;;;;;;;;;;;;;;;;iBAoDQA,IAAQC,KACRC,IAAQC;AAWd,QAJI,OAAOC,EAAM,SAAU,aACzBC,EAAO,KAAK,6FAA6F,GAGvGL,EAAM;AACF,YAAA,IAAI,MAAM,8DAA8D;AAG1E,UAAAM,IAAcC,EAAS,MAAM;AAC3B,YAAAC,IAAY,EAAE,GAAGR;AAEvB,oBAAOQ,EAAU,WAAW,GAC5B,OAAOA,EAAU,OAEVA;AAAA,IAAA,CACR,GAEKC,IAAgBF,EAAS;AAAA,MAC7B,MAAM;AACJ,eAAOH,EAAM;AAAA,MACf;AAAA,MACA,IAAIM,GAAO;AACT,QAAAC,EAAK,kBAAkBD,CAAK;AAAA,MAC9B;AAAA,IAAA,CACD,GAEKE,IAAWL,EAAS,MAAMH,EAAM,MAAMS,EAAS,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/Tab.js CHANGED
@@ -1,8 +1,9 @@
1
- import { _ as o } from "./Tab.vue_vue_type_script_setup_true_lang-b810bee8.js";
1
+ import { _ as o } from "./Tab.vue_vue_type_script_setup_true_lang-4a40f015.js";
2
2
  import "vue";
3
+ import "@leaflink/snitch";
3
4
  import "./Badge.js";
4
5
  import "./_plugin-vue_export-helper-dad06003.js";
5
- import "./Tabs.vue_used_vue_type_style_index_0_lang.module-4f247ed7.js";
6
+ import "./Tabs.vue_used_vue_type_style_index_0_lang.module-0af1e1cf.js";
6
7
  import "lodash-es/debounce";
7
8
  import "lodash-es/uniqueId";
8
9
  import "./constants.js";
package/dist/Tab.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Tab.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,8 @@
1
- import { defineComponent as x, inject as T, computed as r, onMounted as k, nextTick as y, toRefs as u, openBlock as c, createElementBlock as _, normalizeClass as g, unref as n, withKeys as C, createBlock as P, resolveDynamicComponent as B, mergeProps as E, withCtx as b, createElementVNode as $, createVNode as N, renderSlot as A } from "vue";
2
- import I from "./Badge.js";
3
- import { T as j } from "./Tabs.vue_used_vue_type_style_index_0_lang.module-4f247ed7.js";
4
- const D = ["id", "aria-selected", "aria-controls", "aria-disabled"], L = { class: "tw-mt-0.5" }, S = /* @__PURE__ */ x({
1
+ import { defineComponent as x, inject as T, computed as o, onMounted as k, nextTick as g, toRefs as u, openBlock as c, createElementBlock as y, normalizeClass as _, unref as n, withKeys as C, createBlock as P, resolveDynamicComponent as B, mergeProps as E, withCtx as b, createElementVNode as $, createVNode as N, renderSlot as A } from "vue";
2
+ import I from "@leaflink/snitch";
3
+ import j from "./Badge.js";
4
+ import { T as D } from "./Tabs.vue_used_vue_type_style_index_0_lang.module-0af1e1cf.js";
5
+ const L = ["id", "aria-selected", "aria-controls", "aria-disabled"], V = { class: "tw-mt-0.5" }, J = /* @__PURE__ */ x({
5
6
  __name: "Tab",
6
7
  props: {
7
8
  value: {},
@@ -12,26 +13,26 @@ const D = ["id", "aria-selected", "aria-controls", "aria-disabled"], L = { class
12
13
  anchorProps: {},
13
14
  routerLinkProps: {}
14
15
  },
15
- setup(v) {
16
- const e = v, l = T(j.key);
16
+ setup(p) {
17
+ const e = p, l = T(D.key);
17
18
  if (!l)
18
19
  throw Error("The Tab component must be a child of the Tabs component.");
19
- const { setActiveTab: p, activeTab: w, variant: a } = l, t = r(() => e.value === w.value), f = r(() => e.to ? "router-link" : e.href ? "a" : "button");
20
+ const { setActiveTab: v, activeTab: w, variant: a } = l, t = o(() => e.value === w.value), f = o(() => e.to ? "router-link" : e.href ? "a" : "button");
20
21
  function d(i) {
21
- e.disabled || p(i);
22
+ e.disabled || v(i);
22
23
  }
23
- const s = r(() => `tabpanel-${e.value}`);
24
+ const s = o(() => `tabpanel-${e.value}`);
24
25
  k(async () => {
25
- await y(), process.env.NODE_ENV !== "test" && t.value && !document.getElementById(s.value) && console.warn(`The <Tab> with value "${e.value}" is active, but its corresponding tab panel cannot be found. Please ensure that the corresponding tab panel has an "id" attribute with value "${s.value}" and a "role" attribute with value "tabpanel".`);
26
+ await g(), process.env.NODE_ENV !== "test" && t.value && !document.getElementById(s.value) && I.warn(`The <Tab> with value "${e.value}" is active, but its corresponding tab panel cannot be found. Please ensure that the corresponding tab panel has an "id" attribute with value "${s.value}" and a "role" attribute with value "tabpanel".`);
26
27
  });
27
- const h = r(() => e.to && e.routerLinkProps ? u(e.routerLinkProps) : e.href && e.anchorProps ? u(e.anchorProps) : {});
28
- return (i, o) => (c(), _("li", {
28
+ const h = o(() => e.to && e.routerLinkProps ? u(e.routerLinkProps) : e.href && e.anchorProps ? u(e.anchorProps) : {});
29
+ return (i, r) => (c(), y("li", {
29
30
  id: `tab-${e.value}`,
30
31
  role: "tab",
31
32
  "aria-selected": t.value,
32
33
  "aria-controls": s.value,
33
34
  "aria-disabled": e.disabled,
34
- class: g(["stash-tab", [
35
+ class: _(["stash-tab", [
35
36
  {
36
37
  "stash-tab--active is-active": t.value,
37
38
  "stash-tab--disabled": e.disabled,
@@ -39,16 +40,16 @@ const D = ["id", "aria-selected", "aria-controls", "aria-disabled"], L = { class
39
40
  "stash-tab--variant-enclosed": n(a) === "enclosed"
40
41
  }
41
42
  ]]),
42
- onClick: o[0] || (o[0] = (m) => d(e.value)),
43
- onKeypress: o[1] || (o[1] = C((m) => d(e.value), ["enter"]))
43
+ onClick: r[0] || (r[0] = (m) => d(e.value)),
44
+ onKeypress: r[1] || (r[1] = C((m) => d(e.value), ["enter"]))
44
45
  }, [
45
46
  (c(), P(B(f.value), E(h.value, {
46
47
  to: e.to,
47
48
  href: e.href,
48
- class: ["tw-font-medium tw-text-sm tw-border-solid tw-py-1.5 tw-flex tw-items-center tw-justify-center tw-cursor-pointer hover:tw-no-underline tw-whitespace-nowrap", [
49
+ class: ["tw-flex tw-cursor-pointer tw-items-center tw-justify-center tw-whitespace-nowrap tw-border-solid tw-py-1.5 tw-text-sm tw-font-medium hover:tw-no-underline", [
49
50
  {
50
51
  "tw-border-b-2": n(a) === "line",
51
- "tw-px-6 tw-border-t-4": n(a) === "enclosed",
52
+ "tw-border-t-4 tw-px-6": n(a) === "enclosed",
52
53
  "tw-rounded-t tw-bg-white": t.value && n(a) === "enclosed",
53
54
  "focus:tw-no-underline": e.href,
54
55
  "tw-pointer-events-none tw-text-ice-500": e.disabled,
@@ -61,8 +62,8 @@ const D = ["id", "aria-selected", "aria-controls", "aria-disabled"], L = { class
61
62
  tabindex: e.disabled ? -1 : 0
62
63
  }), {
63
64
  default: b(() => [
64
- $("div", L, [
65
- N(I, {
65
+ $("div", V, [
66
+ N(j, {
66
67
  content: e.badge,
67
68
  position: "inline",
68
69
  color: "red",
@@ -81,10 +82,10 @@ const D = ["id", "aria-selected", "aria-controls", "aria-disabled"], L = { class
81
82
  ]),
82
83
  _: 3
83
84
  }, 16, ["to", "href", "class", "tabindex"]))
84
- ], 42, D));
85
+ ], 42, L));
85
86
  }
86
87
  });
87
88
  export {
88
- S as _
89
+ J as _
89
90
  };
90
- //# sourceMappingURL=Tab.vue_vue_type_script_setup_true_lang-b810bee8.js.map
91
+ //# sourceMappingURL=Tab.vue_vue_type_script_setup_true_lang-4a40f015.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.vue_vue_type_script_setup_true_lang-4a40f015.js","sources":["../src/components/Tab/Tab.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import logger from '@leaflink/snitch';\n import { computed, inject, nextTick, onMounted, toRefs } from 'vue';\n import { type RouteLocationRaw, type RouterLinkProps } from 'vue-router';\n\n import Badge from '../Badge/Badge.vue';\n import { TABS_INJECTION } from '../Tabs/Tabs.vue';\n\n /**\n * Allowed attributes for the `<a>` element when the `href` prop is used.\n */\n type AnchorAttrs = HTMLAnchorElement['download'] | HTMLAnchorElement['hreflang'] | HTMLAnchorElement['ping'] | HTMLAnchorElement['referrerPolicy'] | HTMLAnchorElement['rel'] | HTMLAnchorElement['target'] | HTMLAnchorElement['type'];\n\n export interface TabProps {\n /**\n * The tab identifier\n */\n value: string;\n\n /**\n * Router link `to` prop\n */\n to?: RouteLocationRaw;\n\n /**\n * Anchor tag href. Used for navigating to non-vue pages, such as Django pages in marketplace.\n */\n href?: string;\n\n /**\n * The badge's content\n */\n badge?: string | number;\n\n /**\n * Will render a plain text item if true.\n */\n disabled?: boolean\n\n /**\n * Props for the `<a>` element when the `href` prop is used\n */\n anchorProps?: Record<AnchorAttrs, string>;\n\n /**\n * Props for the `<RouterLink>` element when the `to` prop is used\n */\n routerLinkProps?: Omit<RouterLinkProps, 'to'>;\n }\n\n const props = defineProps<TabProps>();\n\n const tabsInjection = inject(TABS_INJECTION.key);\n\n if (!tabsInjection) {\n throw Error('The Tab component must be a child of the Tabs component.');\n }\n\n const { setActiveTab, activeTab, variant } = tabsInjection;\n\n const isTabActive = computed(() => {\n return props.value === activeTab.value;\n });\n\n const is = computed(() => {\n if (props.to) {\n return 'router-link';\n }\n\n if (props.href) {\n return 'a';\n }\n\n return 'button';\n });\n\n /**\n * Note: this click handler gets ignored when the `href` prop is used; `preventDefault()` is intentionally omitted in order to enable the `href` prop to work correctly. The `href` prop is used for navigation to non-vue pages, such as Django pages in marketplace.\n */\n function onClick(tabValue: string) {\n if (props.disabled) {\n return;\n }\n\n setActiveTab(tabValue);\n }\n\n const panelId = computed(() => `tabpanel-${props.value}`);\n\n onMounted(async () => {\n await nextTick();\n\n if (process.env.NODE_ENV !== 'test' && isTabActive.value && !document.getElementById(panelId.value)) {\n // The following warning ensures optimal accessibility is maintained when using the Tabs component. See: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role#example\n logger.warn(`The <Tab> with value \"${props.value}\" is active, but its corresponding tab panel cannot be found. Please ensure that the corresponding tab panel has an \"id\" attribute with value \"${panelId.value}\" and a \"role\" attribute with value \"tabpanel\".`);\n }\n });\n\n const dynamicComponentAttrs = computed(() => {\n if (props.to && props.routerLinkProps) {\n return toRefs(props.routerLinkProps);\n }\n\n if (props.href && props.anchorProps) {\n return toRefs(props.anchorProps);\n }\n\n return {};\n });\n</script>\n\n<template>\n <li\n :id=\"`tab-${props.value}`\"\n role=\"tab\"\n :aria-selected=\"isTabActive\"\n :aria-controls=\"panelId\"\n :aria-disabled=\"props.disabled\"\n class=\"stash-tab\"\n :class=\"[\n {\n 'stash-tab--active is-active': isTabActive,\n 'stash-tab--disabled': props.disabled,\n 'stash-tab--variant-line': variant === 'line',\n 'stash-tab--variant-enclosed': variant === 'enclosed',\n },\n ]\"\n @click=\"onClick(props.value)\"\n @keypress.enter=\"onClick(props.value)\"\n >\n <component\n v-bind=\"dynamicComponentAttrs\"\n :is=\"is\"\n :to=\"props.to\"\n :href=\"props.href\"\n class=\"\n tw-flex\n tw-cursor-pointer\n tw-items-center\n tw-justify-center\n tw-whitespace-nowrap\n tw-border-solid\n tw-py-1.5\n tw-text-sm\n tw-font-medium\n hover:tw-no-underline\n \"\n :class=\"[\n {\n 'tw-border-b-2': variant === 'line',\n 'tw-border-t-4 tw-px-6': variant === 'enclosed',\n 'tw-rounded-t tw-bg-white': isTabActive && variant === 'enclosed',\n 'focus:tw-no-underline': props.href,\n 'tw-pointer-events-none tw-text-ice-500': props.disabled,\n 'tw-text-ice-700': !props.disabled && !isTabActive,\n },\n [\n isTabActive\n ? 'tw-border-blue-500 tw-text-blue-500'\n : 'tw-border-transparent hover:tw-text-blue-500 focus:tw-text-blue-500',\n ],\n ]\"\n :tabindex=\"props.disabled ? -1 : 0\"\n >\n <!-- The margin-top on the <div> below is necessary to fix the vertical alignment of text in the default slot since our Sofia font has extra space under the baseline -->\n <div class=\"tw-mt-0.5\">\n <Badge :content=\"props.badge\" position=\"inline\" color=\"red\" :is-disabled=\"props.disabled\">\n <slot :is-active=\"isTabActive\" :is-disabled=\"props.disabled\" :variant=\"variant\"></slot>\n </Badge>\n </div>\n </component>\n </li>\n</template>\n"],"names":["tabsInjection","inject","TABS_INJECTION","setActiveTab","activeTab","variant","isTabActive","computed","props","is","onClick","tabValue","panelId","onMounted","nextTick","logger","dynamicComponentAttrs","toRefs"],"mappings":";;;;;;;;;;;;;;;;iBAoDQA,IAAgBC,EAAOC,EAAe,GAAG;AAE/C,QAAI,CAACF;AACH,YAAM,MAAM,0DAA0D;AAGxE,UAAM,EAAE,cAAAG,GAAc,WAAAC,GAAW,SAAAC,EAAA,IAAYL,GAEvCM,IAAcC,EAAS,MACpBC,EAAM,UAAUJ,EAAU,KAClC,GAEKK,IAAKF,EAAS,MACdC,EAAM,KACD,gBAGLA,EAAM,OACD,MAGF,QACR;AAKD,aAASE,EAAQC,GAAkB;AACjC,MAAIH,EAAM,YAIVL,EAAaQ,CAAQ;AAAA,IACvB;AAEA,UAAMC,IAAUL,EAAS,MAAM,YAAYC,EAAM,KAAK,EAAE;AAExD,IAAAK,EAAU,YAAY;AACpB,YAAMC,EAAS,GAEX,QAAQ,IAAI,aAAa,UAAUR,EAAY,SAAS,CAAC,SAAS,eAAeM,EAAQ,KAAK,KAEhGG,EAAO,KAAK,yBAAyBP,EAAM,KAAK,kJAAkJI,EAAQ,KAAK,iDAAiD;AAAA,IAClQ,CACD;AAEK,UAAAI,IAAwBT,EAAS,MACjCC,EAAM,MAAMA,EAAM,kBACbS,EAAOT,EAAM,eAAe,IAGjCA,EAAM,QAAQA,EAAM,cACfS,EAAOT,EAAM,WAAW,IAG1B,EACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}