@leaflink/stash 42.4.4 → 42.5.1
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/README.md +27 -3
- package/dist/ActionsDropdown.js +15 -20
- package/dist/ActionsDropdown.js.map +1 -1
- package/dist/AddressSelect.js +34 -45
- package/dist/AddressSelect.js.map +1 -1
- package/dist/Alert.js +58 -57
- package/dist/Alert.js.map +1 -1
- package/dist/AppNavigationItem.js +4 -6
- package/dist/AppNavigationItem.js.map +1 -1
- package/dist/AppTopbar.js +13 -15
- package/dist/AppTopbar.js.map +1 -1
- package/dist/ButtonGroup.js +12 -14
- package/dist/ButtonGroup.js.map +1 -1
- package/dist/CardMedia.js +9 -11
- package/dist/CardMedia.js.map +1 -1
- package/dist/Carousel.js +41 -44
- package/dist/Carousel.js.map +1 -1
- package/dist/Checkbox.js +9 -11
- package/dist/Checkbox.js.map +1 -1
- package/dist/ChevronToggle.js +2 -4
- package/dist/ChevronToggle.js.map +1 -1
- package/dist/Chip.js +4 -6
- package/dist/Chip.js.map +1 -1
- package/dist/ContextSwitcher.js +12 -17
- package/dist/ContextSwitcher.js.map +1 -1
- package/dist/Copy.js +19 -24
- package/dist/Copy.js.map +1 -1
- package/dist/CurrencyInput.js +8 -13
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/DataView.js +48 -59
- package/dist/DataView.js.map +1 -1
- package/dist/DataViewFilters.js +87 -97
- package/dist/DataViewFilters.js.map +1 -1
- package/dist/DataViewSortButton.js +14 -18
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewToolbar.js +12 -14
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/DatePicker.js +2624 -2581
- package/dist/DatePicker.js.map +1 -1
- package/dist/DatePicker.vue.d.ts +19 -0
- package/dist/Dialog.js +6 -9
- package/dist/Dialog.js.map +1 -1
- package/dist/Dropdown.js +15 -20
- package/dist/Dropdown.js.map +1 -1
- package/dist/EmptyState.js +10 -13
- package/dist/EmptyState.js.map +1 -1
- package/dist/Field.js +3 -6
- package/dist/Field.js.map +1 -1
- package/dist/{Field.vue_vue_type_script_setup_true_lang-c864abd3.js → Field.vue_vue_type_script_setup_true_lang-475832fe.js} +2 -2
- package/dist/{Field.vue_vue_type_script_setup_true_lang-c864abd3.js.map → Field.vue_vue_type_script_setup_true_lang-475832fe.js.map} +1 -1
- package/dist/FileUpload.js +27 -30
- package/dist/FileUpload.js.map +1 -1
- package/dist/FilterChip.js +10 -13
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterDrawerItem.js +5 -8
- package/dist/FilterDrawerItem.js.map +1 -1
- package/dist/FilterDropdown.js +73 -88
- package/dist/FilterDropdown.js.map +1 -1
- package/dist/FilterSelect.js +15 -18
- package/dist/FilterSelect.js.map +1 -1
- package/dist/Filters.js +67 -78
- package/dist/Filters.js.map +1 -1
- package/dist/HttpError.js +4 -7
- package/dist/HttpError.js.map +1 -1
- package/dist/Icon.js +236 -14
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.vue.d.ts +2 -2
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js +11 -0
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js.map +1 -0
- package/dist/IconLabel.js +4 -6
- package/dist/IconLabel.js.map +1 -1
- package/dist/Illustration.js +6 -8
- package/dist/Illustration.js.map +1 -1
- package/dist/Image.js +39 -49
- package/dist/Image.js.map +1 -1
- package/dist/InlineEdit.js +10 -12
- package/dist/InlineEdit.js.map +1 -1
- package/dist/Input.js +50 -55
- package/dist/Input.js.map +1 -1
- package/dist/InputOptions.js +20 -29
- package/dist/InputOptions.js.map +1 -1
- package/dist/Label.js +1 -4
- package/dist/Label.js.map +1 -1
- package/dist/LicenseChip.js +7 -9
- package/dist/LicenseChip.js.map +1 -1
- package/dist/ListItem.js +11 -13
- package/dist/ListItem.js.map +1 -1
- package/dist/ListView.js +47 -58
- package/dist/ListView.js.map +1 -1
- package/dist/Metric.js +43 -45
- package/dist/Metric.js.map +1 -1
- package/dist/Metric.vue.d.ts +24 -15
- package/dist/Modal.js +16 -19
- package/dist/Modal.js.map +1 -1
- package/dist/Modals.js +16 -26
- package/dist/Modals.js.map +1 -1
- package/dist/ModalsPlugin.js +12 -22
- package/dist/ModalsPlugin.js.map +1 -1
- package/dist/ObfuscateText.js +7 -9
- package/dist/ObfuscateText.js.map +1 -1
- package/dist/PageNavigation.js +25 -29
- package/dist/PageNavigation.js.map +1 -1
- package/dist/Paginate.js +29 -31
- package/dist/Paginate.js.map +1 -1
- package/dist/QuickAction.js +13 -15
- package/dist/QuickAction.js.map +1 -1
- package/dist/RadioGroup.js +86 -89
- package/dist/RadioGroup.js.map +1 -1
- package/dist/SearchBar.js +18 -20
- package/dist/SearchBar.js.map +1 -1
- package/dist/Select.js +13 -23
- package/dist/Select.js.map +1 -1
- package/dist/SelectStatus.js +26 -36
- package/dist/SelectStatus.js.map +1 -1
- package/dist/Step.js +19 -21
- package/dist/Step.js.map +1 -1
- package/dist/Switch.js +8 -10
- package/dist/Switch.js.map +1 -1
- package/dist/Tab.js +25 -30
- package/dist/Tab.js.map +1 -1
- package/dist/Table.js +19 -21
- package/dist/Table.js.map +1 -1
- package/dist/TableCell.js +21 -22
- package/dist/TableCell.js.map +1 -1
- package/dist/TableHeaderCell.js +4 -4
- package/dist/TableHeaderRow.js +7 -9
- package/dist/TableHeaderRow.js.map +1 -1
- package/dist/TableRow.js +22 -24
- package/dist/TableRow.js.map +1 -1
- package/dist/Tabs.js +11 -16
- package/dist/Tabs.js.map +1 -1
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-ba383fda.js → Tabs.vue_vue_type_script_setup_true_lang-aca4f8b8.js} +3 -3
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-ba383fda.js.map → Tabs.vue_vue_type_script_setup_true_lang-aca4f8b8.js.map} +1 -1
- package/dist/Textarea.js +10 -13
- package/dist/Textarea.js.map +1 -1
- package/dist/Toast.js +8 -10
- package/dist/Toast.js.map +1 -1
- package/dist/Toasts.js +14 -25
- package/dist/Toasts.js.map +1 -1
- package/dist/ToastsPlugin.js +14 -25
- package/dist/ToastsPlugin.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/index.js +53 -62
- package/dist/index.js.map +1 -1
- package/dist/locale.js +12 -15
- package/dist/locale.js.map +1 -1
- package/dist/{searchFuzzy-13c124f8.js → searchFuzzy-74a7de1c.js} +2 -2
- package/dist/{searchFuzzy-13c124f8.js.map → searchFuzzy-74a7de1c.js.map} +1 -1
- package/dist/storage.js +6 -11
- package/dist/storage.js.map +1 -1
- package/dist/tooltip.js +21 -26
- package/dist/tooltip.js.map +1 -1
- package/dist/useGoogleMaps.js +91 -226
- package/dist/useGoogleMaps.js.map +1 -1
- package/dist/useModals.js +21 -31
- package/dist/useModals.js.map +1 -1
- package/dist/useSearch.js +17 -22
- package/dist/useSearch.js.map +1 -1
- package/dist/useToasts.js +25 -36
- package/dist/useToasts.js.map +1 -1
- package/dist/useValidation.js +79 -108
- package/dist/useValidation.js.map +1 -1
- package/dist/utils/calculateElementOverflow.js +9 -14
- package/dist/utils/calculateElementOverflow.js.map +1 -1
- package/dist/utils/createQueryString.js +9 -15
- package/dist/utils/createQueryString.js.map +1 -1
- package/dist/utils/helpers.js +46 -59
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/i18n.js +17 -20
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/searchFuzzy.js +7 -12
- package/dist/utils/searchFuzzy.js.map +1 -1
- package/dist/utils/storage.js +10 -15
- package/dist/utils/storage.js.map +1 -1
- package/dist/viewable.js +26 -34
- package/dist/viewable.js.map +1 -1
- package/package.json +4 -6
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-d2507af3.js +0 -243
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-d2507af3.js.map +0 -1
- package/dist/_MapCache-65811284.js +0 -188
- package/dist/_MapCache-65811284.js.map +0 -1
- package/dist/_Uint8Array-06e4d083.js +0 -66
- package/dist/_Uint8Array-06e4d083.js.map +0 -1
- package/dist/_baseAssignValue-dd1499b4.js +0 -22
- package/dist/_baseAssignValue-dd1499b4.js.map +0 -1
- package/dist/_baseIsEqual-d594c87f.js +0 -171
- package/dist/_baseIsEqual-d594c87f.js.map +0 -1
- package/dist/_createCompounder-ae01a723.js +0 -245
- package/dist/_createCompounder-ae01a723.js.map +0 -1
- package/dist/_getAllKeys-5e735d41.js +0 -44
- package/dist/_getAllKeys-5e735d41.js.map +0 -1
- package/dist/_getPrototype-3e6fccd6.js +0 -7
- package/dist/_getPrototype-3e6fccd6.js.map +0 -1
- package/dist/_getTag-4db47fa6.js +0 -47
- package/dist/_getTag-4db47fa6.js.map +0 -1
- package/dist/_initCloneObject-161353b9.js +0 -88
- package/dist/_initCloneObject-161353b9.js.map +0 -1
- package/dist/_overArg-6d920d99.js +0 -9
- package/dist/_overArg-6d920d99.js.map +0 -1
- package/dist/capitalize-667d9f60.js +0 -42
- package/dist/capitalize-667d9f60.js.map +0 -1
- package/dist/cloneDeep-5bc375b0.js +0 -146
- package/dist/cloneDeep-5bc375b0.js.map +0 -1
- package/dist/debounce-6aca1ca9.js +0 -86
- package/dist/debounce-6aca1ca9.js.map +0 -1
- package/dist/get-27d90892.js +0 -66
- package/dist/get-27d90892.js.map +0 -1
- package/dist/identity-452d03fd.js +0 -20
- package/dist/identity-452d03fd.js.map +0 -1
- package/dist/isArrayLike-09233e52.js +0 -61
- package/dist/isArrayLike-09233e52.js.map +0 -1
- package/dist/isEmpty-2fbad344.js +0 -23
- package/dist/isEmpty-2fbad344.js.map +0 -1
- package/dist/isEqual-fca467fb.js +0 -8
- package/dist/isEqual-fca467fb.js.map +0 -1
- package/dist/isObjectLike-54341556.js +0 -39
- package/dist/isObjectLike-54341556.js.map +0 -1
- package/dist/isPlainObject-55c7f916.js +0 -16
- package/dist/isPlainObject-55c7f916.js.map +0 -1
- package/dist/merge-b14fad9d.js +0 -124
- package/dist/merge-b14fad9d.js.map +0 -1
- package/dist/toString-7d5bf363.js +0 -29
- package/dist/toString-7d5bf363.js.map +0 -1
- package/dist/uniqueId-847efe53.js +0 -10
- package/dist/uniqueId-847efe53.js.map +0 -1
package/README.md
CHANGED
|
@@ -266,6 +266,9 @@ These peer dependencies need to be installed separately by the consumer of the p
|
|
|
266
266
|
|
|
267
267
|
## Testing
|
|
268
268
|
|
|
269
|
+
> [!TIP]
|
|
270
|
+
> If you are contributing to `@leaflink/stash`, please refer to this contributing [testing](CONTRIBUTING.md#testing) section for more details on how to properly test your changes.
|
|
271
|
+
|
|
269
272
|
To run tests, there's multiple npm scripts available to you:
|
|
270
273
|
|
|
271
274
|
* `npm run test` - Run all tests in watch mode.
|
|
@@ -291,11 +294,18 @@ import { config, flushPromises } from '@vue/test-utils';
|
|
|
291
294
|
config.global.plugins = [[stash, { googleMapsApiKey: 'my-key' }]];
|
|
292
295
|
```
|
|
293
296
|
|
|
294
|
-
|
|
297
|
+
### Mocking Google Maps API when testing AddressSelect
|
|
295
298
|
|
|
296
|
-
|
|
297
|
-
|
|
299
|
+
When testing components that use the `AddressSelect` component or `useGoogleMaps` composable, it's necessary to mock it.
|
|
300
|
+
This is because the `useGoogleMaps` composable uses the `google.maps` global object, which is not available in the
|
|
301
|
+
testing environment.
|
|
302
|
+
|
|
303
|
+
The easiest way to do this is to mock the useGoogleMaps composable and avoid trying to mock the Google Maps API directly.
|
|
298
304
|
|
|
305
|
+
Create a file in the `__mocks__` directory of the `@leaflink/stash` package, and mock the `useGoogleMaps` composable.
|
|
306
|
+
|
|
307
|
+
```ts
|
|
308
|
+
/* __mocks__/@leaflink/stash/useGoogleMaps.js */
|
|
299
309
|
export default function () {
|
|
300
310
|
return {
|
|
301
311
|
getPlaceDetails: vi.fn().mockResolvedValue({
|
|
@@ -311,6 +321,20 @@ export default function () {
|
|
|
311
321
|
},
|
|
312
322
|
};
|
|
313
323
|
}
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
/* tests/setup-env.ts */
|
|
327
|
+
import '@leaflink/dom-testing-utils/setup-env'; // to ensure lodash-es/debounce is mocked properly
|
|
328
|
+
vi.mock('@leaflink/stash/useGoogleMaps');
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
/* src/components/YourComponent.spec.ts */
|
|
332
|
+
const user = userEvent.setup();
|
|
333
|
+
// Start typing in the AddressSelect select input to trigger the useGoogleMaps mock response
|
|
334
|
+
await user.type(screen.getByPlaceholderText('Search'), 'type anything');
|
|
335
|
+
// The mock response will be used to populate the options - so it will always be the same
|
|
336
|
+
// (id of 1 from the getPlacePredictions mock)
|
|
337
|
+
await user.selectOptions(screen.getByLabelText('Bank address'), ['1']);
|
|
314
338
|
```
|
|
315
339
|
|
|
316
340
|
It's also encouraged the use of [@leaflink/dom-testing-utils](https://github.com/LeafLink/dom-testing-utils) for testing utilities like global and local test setup, mocking endpoints, clean up components, get selected options and more. Checkout the [documention](https://github.com/LeafLink/dom-testing-utils) for learning more about this package.
|
package/dist/ActionsDropdown.js
CHANGED
|
@@ -4,23 +4,18 @@ import g from "./Button.js";
|
|
|
4
4
|
import x from "./Dropdown.js";
|
|
5
5
|
import B from "./Icon.js";
|
|
6
6
|
import { _ as D } from "./_plugin-vue_export-helper-dad06003.js";
|
|
7
|
-
import "
|
|
8
|
-
import "./isObjectLike-54341556.js";
|
|
9
|
-
import "./toString-7d5bf363.js";
|
|
10
|
-
import "./_MapCache-65811284.js";
|
|
7
|
+
import "lodash-es/get";
|
|
11
8
|
import "./Button.vue_used_vue_type_style_index_0_lang.module-b77978d6.js";
|
|
12
9
|
import "./constants.js";
|
|
13
10
|
import "./clickoutside.js";
|
|
14
11
|
import "./utils/calculateElementOverflow.js";
|
|
15
12
|
import "./utils/helpers.js";
|
|
16
|
-
import "
|
|
17
|
-
import "
|
|
18
|
-
import "
|
|
19
|
-
import "
|
|
20
|
-
import "./_overArg-6d920d99.js";
|
|
21
|
-
import "./Icon.vue_used_vue_type_style_index_0_lang.module-d2507af3.js";
|
|
22
|
-
import "./uniqueId-847efe53.js";
|
|
13
|
+
import "lodash-es/camelCase";
|
|
14
|
+
import "lodash-es/isFinite";
|
|
15
|
+
import "lodash-es/isPlainObject";
|
|
16
|
+
import "lodash-es/uniqueId";
|
|
23
17
|
import "./index-79ce320f.js";
|
|
18
|
+
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
24
19
|
const y = /* @__PURE__ */ c({
|
|
25
20
|
name: "ll-actions-dropdown",
|
|
26
21
|
__name: "ActionsDropdown",
|
|
@@ -30,20 +25,20 @@ const y = /* @__PURE__ */ c({
|
|
|
30
25
|
contentClass: { default: "" },
|
|
31
26
|
buttonText: { default: () => C("ll.actions") }
|
|
32
27
|
},
|
|
33
|
-
setup(
|
|
34
|
-
const o =
|
|
35
|
-
return (
|
|
28
|
+
setup(l) {
|
|
29
|
+
const o = l, t = p();
|
|
30
|
+
return (d, A) => (m(), u(x, {
|
|
36
31
|
align: o.align,
|
|
37
32
|
"content-class": [n(t).dropdownContent, o.contentClass],
|
|
38
33
|
class: s(n(t).actionsDropdown)
|
|
39
34
|
}, f({
|
|
40
|
-
toggle: e(({ isActive:
|
|
35
|
+
toggle: e(({ isActive: r, toggle: i }) => [
|
|
41
36
|
a(g, {
|
|
42
37
|
class: s(["button flex align-middle align-justify w-full border border-blue text-blue", [n(t).actionButton, { [n(t).disabled]: o.disabled }]]),
|
|
43
38
|
secondary: "",
|
|
44
|
-
"aria-expanded":
|
|
39
|
+
"aria-expanded": r.toString(),
|
|
45
40
|
disabled: o.disabled,
|
|
46
|
-
onClick:
|
|
41
|
+
onClick: i
|
|
47
42
|
}, {
|
|
48
43
|
default: e(() => [
|
|
49
44
|
_(b(o.buttonText) + " ", 1),
|
|
@@ -60,7 +55,7 @@ const y = /* @__PURE__ */ c({
|
|
|
60
55
|
o.disabled ? void 0 : {
|
|
61
56
|
name: "default",
|
|
62
57
|
fn: e(() => [
|
|
63
|
-
w(
|
|
58
|
+
w(d.$slots, "default")
|
|
64
59
|
]),
|
|
65
60
|
key: "0"
|
|
66
61
|
}
|
|
@@ -73,8 +68,8 @@ const y = /* @__PURE__ */ c({
|
|
|
73
68
|
actionsDropdown: M
|
|
74
69
|
}, h = {
|
|
75
70
|
$style: T
|
|
76
|
-
},
|
|
71
|
+
}, U = /* @__PURE__ */ D(y, [["__cssModules", h]]);
|
|
77
72
|
export {
|
|
78
|
-
|
|
73
|
+
U as default
|
|
79
74
|
};
|
|
80
75
|
//# sourceMappingURL=ActionsDropdown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionsDropdown.js","sources":["../src/components/ActionsDropdown/ActionsDropdown.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { useCssModule } from 'vue';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Dropdown from '../Dropdown/Dropdown.vue';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-actions-dropdown',\n });\n\n export interface ActionsDropdownProps {\n /**\n * Used to position the dropdown relative to target\n * Options: left, right\n */\n align?: 'left' | 'right';\n /**\n * Indicates whether the trigger button is disabled or not\n */\n disabled?: boolean;\n /**\n * Class to be applied to the dropdown content\n */\n contentClass?: string;\n /**\n * Text to be displayed on the trigger button\n */\n buttonText?: string;\n }\n\n const props = withDefaults(defineProps<ActionsDropdownProps>(), {\n align: 'left',\n disabled: false,\n contentClass: '',\n buttonText: () => t('ll.actions'),\n });\n\n const classes = useCssModule();\n</script>\n\n<template>\n <Dropdown\n :align=\"props.align\"\n :content-class=\"[classes.dropdownContent, props.contentClass]\"\n :class=\"classes.actionsDropdown\"\n >\n <template #toggle=\"{ isActive, toggle }\">\n <Button\n class=\"button flex align-middle align-justify w-full border border-blue text-blue\"\n secondary\n :aria-expanded=\"isActive.toString()\"\n :class=\"[classes.actionButton, { [classes.disabled]: props.disabled }]\"\n :disabled=\"props.disabled\"\n @click=\"toggle\"\n >\n {{ props.buttonText }} <Icon class=\"tw-ml-1.5\" name=\"caret-down\" />\n </Button>\n </template>\n\n <template v-if=\"!props.disabled\" #default>\n <!-- @slot Dropdown content -->\n <slot></slot>\n </template>\n </Dropdown>\n</template>\n\n<style module>\n .actionButton {\n min-width: 156px;\n white-space: normal;\n }\n\n .actionButton:hover {\n background-color: var(--color-blue-100);\n border-color: var(--color-blue) !important;\n }\n\n .disabled {\n background-color: var(--color-ice-100) !important;\n border-color: var(--color-ice-500) !important;\n color: var(--color-ice-500) !important;\n }\n\n .dropdownContent {\n margin-top: 4px;\n }\n\n .dropdownContent:global(.dropdown__content) {\n margin-left: 0;\n margin-right: 0;\n max-width: 90vw;\n }\n\n .dropdownContent:global(.dropdown__content)::after {\n display: none;\n }\n\n @media screen(md) {\n .actionsDropdown {\n min-width: 156px;\n }\n\n .dropdownContent:global(.dropdown__content) {\n min-width: 156px;\n }\n }\n</style>\n"],"names":["classes","useCssModule"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionsDropdown.js","sources":["../src/components/ActionsDropdown/ActionsDropdown.vue"],"sourcesContent":["<script lang=\"ts\" setup>\n import { useCssModule } from 'vue';\n\n import { t } from '../../locale';\n import Button from '../Button/Button.vue';\n import Dropdown from '../Dropdown/Dropdown.vue';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-actions-dropdown',\n });\n\n export interface ActionsDropdownProps {\n /**\n * Used to position the dropdown relative to target\n * Options: left, right\n */\n align?: 'left' | 'right';\n /**\n * Indicates whether the trigger button is disabled or not\n */\n disabled?: boolean;\n /**\n * Class to be applied to the dropdown content\n */\n contentClass?: string;\n /**\n * Text to be displayed on the trigger button\n */\n buttonText?: string;\n }\n\n const props = withDefaults(defineProps<ActionsDropdownProps>(), {\n align: 'left',\n disabled: false,\n contentClass: '',\n buttonText: () => t('ll.actions'),\n });\n\n const classes = useCssModule();\n</script>\n\n<template>\n <Dropdown\n :align=\"props.align\"\n :content-class=\"[classes.dropdownContent, props.contentClass]\"\n :class=\"classes.actionsDropdown\"\n >\n <template #toggle=\"{ isActive, toggle }\">\n <Button\n class=\"button flex align-middle align-justify w-full border border-blue text-blue\"\n secondary\n :aria-expanded=\"isActive.toString()\"\n :class=\"[classes.actionButton, { [classes.disabled]: props.disabled }]\"\n :disabled=\"props.disabled\"\n @click=\"toggle\"\n >\n {{ props.buttonText }} <Icon class=\"tw-ml-1.5\" name=\"caret-down\" />\n </Button>\n </template>\n\n <template v-if=\"!props.disabled\" #default>\n <!-- @slot Dropdown content -->\n <slot></slot>\n </template>\n </Dropdown>\n</template>\n\n<style module>\n .actionButton {\n min-width: 156px;\n white-space: normal;\n }\n\n .actionButton:hover {\n background-color: var(--color-blue-100);\n border-color: var(--color-blue) !important;\n }\n\n .disabled {\n background-color: var(--color-ice-100) !important;\n border-color: var(--color-ice-500) !important;\n color: var(--color-ice-500) !important;\n }\n\n .dropdownContent {\n margin-top: 4px;\n }\n\n .dropdownContent:global(.dropdown__content) {\n margin-left: 0;\n margin-right: 0;\n max-width: 90vw;\n }\n\n .dropdownContent:global(.dropdown__content)::after {\n display: none;\n }\n\n @media screen(md) {\n .actionsDropdown {\n min-width: 156px;\n }\n\n .dropdownContent:global(.dropdown__content) {\n min-width: 156px;\n }\n }\n</style>\n"],"names":["classes","useCssModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuCQA,IAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/AddressSelect.js
CHANGED
|
@@ -1,44 +1,33 @@
|
|
|
1
1
|
import { defineComponent as M, useSlots as S, inject as A, computed as h, ref as n, watch as T, openBlock as I, createBlock as P, unref as y, createSlots as j, withCtx as k, renderSlot as D } from "vue";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import G from "lodash-es/debounce";
|
|
3
|
+
import K from "lodash-es/uniqueId";
|
|
4
4
|
import C from "./useGoogleMaps.js";
|
|
5
5
|
import { DEBOUNCE as U } from "./constants.js";
|
|
6
6
|
import q from "./Select.js";
|
|
7
|
-
import "
|
|
8
|
-
import "
|
|
9
|
-
import "
|
|
10
|
-
import "
|
|
11
|
-
import "./identity-452d03fd.js";
|
|
12
|
-
import "./_getAllKeys-5e735d41.js";
|
|
13
|
-
import "./_Uint8Array-06e4d083.js";
|
|
14
|
-
import "./isArrayLike-09233e52.js";
|
|
15
|
-
import "./_getTag-4db47fa6.js";
|
|
16
|
-
import "./_overArg-6d920d99.js";
|
|
17
|
-
import "./_baseIsEqual-d594c87f.js";
|
|
18
|
-
import "./get-27d90892.js";
|
|
19
|
-
import "./isEmpty-2fbad344.js";
|
|
20
|
-
import "./isEqual-fca467fb.js";
|
|
21
|
-
import "./isPlainObject-55c7f916.js";
|
|
22
|
-
import "./_getPrototype-3e6fccd6.js";
|
|
7
|
+
import "lodash-es/keyBy";
|
|
8
|
+
import "lodash-es/isEmpty";
|
|
9
|
+
import "lodash-es/isEqual";
|
|
10
|
+
import "lodash-es/isPlainObject";
|
|
23
11
|
import "./useSearch.js";
|
|
24
|
-
import "
|
|
12
|
+
import "lodash-es/get";
|
|
13
|
+
import "./searchFuzzy-74a7de1c.js";
|
|
25
14
|
import "./_commonjsHelpers-10dfc225.js";
|
|
26
15
|
import "./utils/helpers.js";
|
|
27
|
-
import "
|
|
28
|
-
import "
|
|
16
|
+
import "lodash-es/camelCase";
|
|
17
|
+
import "lodash-es/isFinite";
|
|
29
18
|
import "./clickoutside.js";
|
|
30
19
|
import "./MenusPlugin-5e93f0a5.js";
|
|
31
20
|
import "./Chip.js";
|
|
32
21
|
import "./colors-13e95ebf.js";
|
|
33
22
|
import "./utils/colorScheme.js";
|
|
34
23
|
import "./Icon.js";
|
|
35
|
-
import "./Icon.vue_used_vue_type_style_index_0_lang.module-d2507af3.js";
|
|
36
24
|
import "./index-79ce320f.js";
|
|
25
|
+
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
37
26
|
import "./_plugin-vue_export-helper-dad06003.js";
|
|
38
|
-
import "./Field.vue_vue_type_script_setup_true_lang-
|
|
27
|
+
import "./Field.vue_vue_type_script_setup_true_lang-475832fe.js";
|
|
39
28
|
import "./Label.vue_vue_type_script_setup_true_lang-1d29d98a.js";
|
|
40
29
|
import "./locale.js";
|
|
41
|
-
const _ = "address-select-",
|
|
30
|
+
const _ = "address-select-", ve = /* @__PURE__ */ M({
|
|
42
31
|
__name: "AddressSelect",
|
|
43
32
|
props: {
|
|
44
33
|
apiKey: { default: void 0 },
|
|
@@ -59,38 +48,38 @@ const _ = "address-select-", Me = /* @__PURE__ */ M({
|
|
|
59
48
|
preventEmpty: { type: Boolean, default: !1 }
|
|
60
49
|
},
|
|
61
50
|
emits: ["update:modelValue", "error"],
|
|
62
|
-
setup(g, { emit:
|
|
63
|
-
const t = g, V = S(), d = A("stashOptions"),
|
|
64
|
-
if (!
|
|
51
|
+
setup(g, { emit: l }) {
|
|
52
|
+
const t = g, V = S(), d = A("stashOptions"), u = h(() => t.apiKey || (d == null ? void 0 : d.googleMapsApiKey));
|
|
53
|
+
if (!u.value)
|
|
65
54
|
throw new Error("Google Maps API key is required");
|
|
66
|
-
const { getPlaceDetails: b, getPlacePredictions: x } = C(
|
|
67
|
-
var e,
|
|
55
|
+
const { getPlaceDetails: b, getPlacePredictions: x } = C(u.value), i = n(!1), a = n(), r = n(), E = G(w, t.debounceTime), s = h(() => {
|
|
56
|
+
var e, p, m, c, f, v;
|
|
68
57
|
return [
|
|
69
|
-
[(e = t.modelValue) == null ? void 0 : e.street_address, (
|
|
70
|
-
(
|
|
58
|
+
[(e = t.modelValue) == null ? void 0 : e.street_address, (p = t.modelValue) == null ? void 0 : p.extended_address].filter(Boolean).join(" "),
|
|
59
|
+
(m = t.modelValue) == null ? void 0 : m.city,
|
|
71
60
|
[(c = t.modelValue) == null ? void 0 : c.state, (f = t.modelValue) == null ? void 0 : f.postal_code].filter(Boolean).join(" "),
|
|
72
61
|
(v = t.modelValue) == null ? void 0 : v.country
|
|
73
62
|
].filter(Boolean).join(", ");
|
|
74
63
|
});
|
|
75
64
|
T(() => t.modelValue, () => {
|
|
76
65
|
var o;
|
|
77
|
-
if (s.value && !((o =
|
|
66
|
+
if (s.value && !((o = a.value) != null && o.length)) {
|
|
78
67
|
const e = {
|
|
79
68
|
id: t.modelValue.place_id || K(_),
|
|
80
69
|
name: s.value,
|
|
81
70
|
address: t.modelValue
|
|
82
71
|
};
|
|
83
|
-
|
|
72
|
+
a.value = [e], r.value = e;
|
|
84
73
|
} else
|
|
85
|
-
s.value || (
|
|
74
|
+
s.value || (r.value = void 0, a.value = []);
|
|
86
75
|
}, { immediate: !0 });
|
|
87
76
|
async function w(o) {
|
|
88
77
|
i.value = !0;
|
|
89
78
|
try {
|
|
90
|
-
|
|
79
|
+
a.value = await x(o);
|
|
91
80
|
} catch (e) {
|
|
92
|
-
if (
|
|
93
|
-
|
|
81
|
+
if (a.value = [], e != null && e.isGoogleMapsError)
|
|
82
|
+
l("error", e);
|
|
94
83
|
else
|
|
95
84
|
throw e;
|
|
96
85
|
} finally {
|
|
@@ -98,8 +87,8 @@ const _ = "address-select-", Me = /* @__PURE__ */ M({
|
|
|
98
87
|
}
|
|
99
88
|
}
|
|
100
89
|
async function B(o) {
|
|
101
|
-
if (
|
|
102
|
-
|
|
90
|
+
if (r.value = o, !o) {
|
|
91
|
+
l("update:modelValue", {
|
|
103
92
|
street_address: void 0,
|
|
104
93
|
extended_address: void 0,
|
|
105
94
|
city: void 0,
|
|
@@ -110,15 +99,15 @@ const _ = "address-select-", Me = /* @__PURE__ */ M({
|
|
|
110
99
|
return;
|
|
111
100
|
}
|
|
112
101
|
if (o.id.startsWith(_) && o.address) {
|
|
113
|
-
|
|
102
|
+
l("update:modelValue", o.address);
|
|
114
103
|
return;
|
|
115
104
|
}
|
|
116
105
|
try {
|
|
117
106
|
const e = await b(o.id);
|
|
118
|
-
|
|
107
|
+
l("update:modelValue", e);
|
|
119
108
|
} catch (e) {
|
|
120
109
|
if (e != null && e.isGoogleMapsError)
|
|
121
|
-
|
|
110
|
+
l("error", e);
|
|
122
111
|
else
|
|
123
112
|
throw e;
|
|
124
113
|
}
|
|
@@ -128,12 +117,12 @@ const _ = "address-select-", Me = /* @__PURE__ */ M({
|
|
|
128
117
|
"data-test": "select|address",
|
|
129
118
|
disabled: t.disabled,
|
|
130
119
|
loading: i.value,
|
|
131
|
-
options:
|
|
120
|
+
options: a.value,
|
|
132
121
|
placeholder: t.placeholder,
|
|
133
122
|
label: t.label,
|
|
134
123
|
"hint-text": t.hintText,
|
|
135
124
|
error: t.errorText,
|
|
136
|
-
"model-value":
|
|
125
|
+
"model-value": r.value,
|
|
137
126
|
"prevent-empty": t.preventEmpty,
|
|
138
127
|
"disable-filtering": "",
|
|
139
128
|
onSearch: y(E),
|
|
@@ -150,6 +139,6 @@ const _ = "address-select-", Me = /* @__PURE__ */ M({
|
|
|
150
139
|
}
|
|
151
140
|
});
|
|
152
141
|
export {
|
|
153
|
-
|
|
142
|
+
ve as default
|
|
154
143
|
};
|
|
155
144
|
//# sourceMappingURL=AddressSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressSelect.js","sources":["../src/components/AddressSelect/AddressSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import debounce from 'lodash-es/debounce';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, inject, ref, useSlots, watch } from 'vue';\n\n import { StashProvideState } from '../../../types/misc';\n import useGoogleMaps, { type Address, type AddressOption } from '../../composables/useGoogleMaps/useGoogleMaps';\n import { DEBOUNCE } from '../../constants';\n import Select from '../Select/Select.vue';\n\n export interface AddressSelectProps {\n /**\n * Google Maps API Key. This takes precedence over the key defined in stashOptions\n */\n apiKey?: string;\n /**\n * Wether the Select is disabled or not\n */\n disabled?: boolean;\n /**\n * Select placeholder\n */\n placeholder?: string;\n /**\n * Debounce time in milliseconds to perform API requests on search\n */\n debounceTime?: number;\n /**\n * Model value address\n */\n modelValue: Address;\n /**\n * Hint text to be passed down to Select component\n */\n hintText?: string;\n /**\n * Error text to be passed down to Select component\n */\n errorText?: string;\n /**\n * Label text to be passed down to Select component\n */\n label?: string;\n /**\n * Disallows values from being de-selected\n */\n preventEmpty?: boolean;\n }\n\n const props = withDefaults(defineProps<AddressSelectProps>(), {\n disabled: false,\n placeholder: 'Type an address',\n debounceTime: DEBOUNCE.MEDIUM,\n modelValue: () => ({\n street_address: undefined,\n extended_address: undefined,\n city: undefined,\n state: undefined,\n postal_code: undefined,\n country: undefined,\n }),\n hintText: undefined,\n errorText: undefined,\n label: undefined,\n preventEmpty: false,\n apiKey: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the model value changes\n */\n (e: 'update:modelValue', value: Address): void,\n /**\n * Emitted when an error occurs while reaching out to Google's API\n */\n (e: 'error', value: unknown): void\n }>();\n\n const slots = useSlots();\n const stashOptions = inject<StashProvideState>('stashOptions');\n\n const googleMapsApiKey = computed(() => props.apiKey || stashOptions?.googleMapsApiKey);\n\n if (!googleMapsApiKey.value) {\n throw new Error('Google Maps API key is required');\n }\n\n const { getPlaceDetails, getPlacePredictions } = useGoogleMaps(googleMapsApiKey.value);\n\n const ID_PREFIX = 'address-select-';\n\n const isLoading = ref(false);\n const options = ref<Array<AddressOption>>();\n const internalValue = ref<AddressOption>();\n\n const debouncedSearch = debounce(search, props.debounceTime);\n\n const formattedAddress = computed(() => {\n const formattedAddress = [\n [props.modelValue?.street_address, props.modelValue?.extended_address].filter(Boolean).join(' '),\n props.modelValue?.city,\n [props.modelValue?.state, props.modelValue?.postal_code].filter(Boolean).join(' '),\n props.modelValue?.country\n ].filter(Boolean).join(', ');\n\n return formattedAddress;\n });\n\n // When we don't have options just yet, we need to create them on our own\n watch(() => props.modelValue, () => {\n if (formattedAddress.value && !options.value?.length) {\n const option = {\n id: props.modelValue.place_id || uniqueId(ID_PREFIX),\n name: formattedAddress.value,\n address: props.modelValue,\n };\n\n options.value = [option];\n internalValue.value = option;\n } else if (!formattedAddress.value) {\n internalValue.value = undefined;\n options.value = [];\n }\n }, { immediate: true });\n\n async function search(query: string) {\n isLoading.value = true;\n\n try {\n options.value = await getPlacePredictions(query);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n options.value = [];\n if (error?.isGoogleMapsError) {\n emit('error', error);\n } else {\n throw error;\n }\n } finally {\n isLoading.value = false;\n }\n }\n\n async function select(option: AddressOption) {\n internalValue.value = option;\n\n // When an option is de-selected, the option will be undefined\n if (!option) {\n emit('update:modelValue', {\n street_address: undefined,\n extended_address: undefined,\n city: undefined,\n state: undefined,\n postal_code: undefined,\n country: undefined,\n });\n return;\n }\n\n // When an option does not have a google place id, we don't want to fetch it's details\n if (option.id.startsWith(ID_PREFIX) && option.address) {\n emit('update:modelValue', option.address);\n return;\n }\n\n try {\n const address = await getPlaceDetails(option.id);\n emit('update:modelValue', address);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (error?.isGoogleMapsError) {\n emit('error', error);\n } else {\n throw error;\n }\n }\n }\n</script>\n\n<template>\n <Select\n single\n data-test=\"select|address\"\n :disabled=\"props.disabled\"\n :loading=\"isLoading\"\n :options=\"options\"\n :placeholder=\"props.placeholder\"\n :label=\"props.label\"\n :hint-text=\"props.hintText\"\n :error=\"props.errorText\"\n :model-value=\"internalValue\"\n :prevent-empty=\"props.preventEmpty\"\n disable-filtering\n @search=\"debouncedSearch\"\n @update:model-value=\"select\"\n >\n <template v-if=\"slots.hint\" #hint>\n <slot name=\"hint\"></slot>\n </template>\n </Select>\n</template>\n"],"names":["ID_PREFIX","slots","useSlots","stashOptions","inject","googleMapsApiKey","computed","props","getPlaceDetails","getPlacePredictions","useGoogleMaps","isLoading","ref","options","internalValue","debouncedSearch","debounce","search","formattedAddress","_a","_b","_c","_d","_e","_f","watch","option","uniqueId","query","error","emit","select","address"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressSelect.js","sources":["../src/components/AddressSelect/AddressSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import debounce from 'lodash-es/debounce';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, inject, ref, useSlots, watch } from 'vue';\n\n import { StashProvideState } from '../../../types/misc';\n import useGoogleMaps, { type Address, type AddressOption } from '../../composables/useGoogleMaps/useGoogleMaps';\n import { DEBOUNCE } from '../../constants';\n import Select from '../Select/Select.vue';\n\n export interface AddressSelectProps {\n /**\n * Google Maps API Key. This takes precedence over the key defined in stashOptions\n */\n apiKey?: string;\n /**\n * Wether the Select is disabled or not\n */\n disabled?: boolean;\n /**\n * Select placeholder\n */\n placeholder?: string;\n /**\n * Debounce time in milliseconds to perform API requests on search\n */\n debounceTime?: number;\n /**\n * Model value address\n */\n modelValue: Address;\n /**\n * Hint text to be passed down to Select component\n */\n hintText?: string;\n /**\n * Error text to be passed down to Select component\n */\n errorText?: string;\n /**\n * Label text to be passed down to Select component\n */\n label?: string;\n /**\n * Disallows values from being de-selected\n */\n preventEmpty?: boolean;\n }\n\n const props = withDefaults(defineProps<AddressSelectProps>(), {\n disabled: false,\n placeholder: 'Type an address',\n debounceTime: DEBOUNCE.MEDIUM,\n modelValue: () => ({\n street_address: undefined,\n extended_address: undefined,\n city: undefined,\n state: undefined,\n postal_code: undefined,\n country: undefined,\n }),\n hintText: undefined,\n errorText: undefined,\n label: undefined,\n preventEmpty: false,\n apiKey: undefined,\n });\n\n const emit = defineEmits<{\n /**\n * Emitted when the model value changes\n */\n (e: 'update:modelValue', value: Address): void,\n /**\n * Emitted when an error occurs while reaching out to Google's API\n */\n (e: 'error', value: unknown): void\n }>();\n\n const slots = useSlots();\n const stashOptions = inject<StashProvideState>('stashOptions');\n\n const googleMapsApiKey = computed(() => props.apiKey || stashOptions?.googleMapsApiKey);\n\n if (!googleMapsApiKey.value) {\n throw new Error('Google Maps API key is required');\n }\n\n const { getPlaceDetails, getPlacePredictions } = useGoogleMaps(googleMapsApiKey.value);\n\n const ID_PREFIX = 'address-select-';\n\n const isLoading = ref(false);\n const options = ref<Array<AddressOption>>();\n const internalValue = ref<AddressOption>();\n\n const debouncedSearch = debounce(search, props.debounceTime);\n\n const formattedAddress = computed(() => {\n const formattedAddress = [\n [props.modelValue?.street_address, props.modelValue?.extended_address].filter(Boolean).join(' '),\n props.modelValue?.city,\n [props.modelValue?.state, props.modelValue?.postal_code].filter(Boolean).join(' '),\n props.modelValue?.country\n ].filter(Boolean).join(', ');\n\n return formattedAddress;\n });\n\n // When we don't have options just yet, we need to create them on our own\n watch(() => props.modelValue, () => {\n if (formattedAddress.value && !options.value?.length) {\n const option = {\n id: props.modelValue.place_id || uniqueId(ID_PREFIX),\n name: formattedAddress.value,\n address: props.modelValue,\n };\n\n options.value = [option];\n internalValue.value = option;\n } else if (!formattedAddress.value) {\n internalValue.value = undefined;\n options.value = [];\n }\n }, { immediate: true });\n\n async function search(query: string) {\n isLoading.value = true;\n\n try {\n options.value = await getPlacePredictions(query);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n options.value = [];\n if (error?.isGoogleMapsError) {\n emit('error', error);\n } else {\n throw error;\n }\n } finally {\n isLoading.value = false;\n }\n }\n\n async function select(option: AddressOption) {\n internalValue.value = option;\n\n // When an option is de-selected, the option will be undefined\n if (!option) {\n emit('update:modelValue', {\n street_address: undefined,\n extended_address: undefined,\n city: undefined,\n state: undefined,\n postal_code: undefined,\n country: undefined,\n });\n return;\n }\n\n // When an option does not have a google place id, we don't want to fetch it's details\n if (option.id.startsWith(ID_PREFIX) && option.address) {\n emit('update:modelValue', option.address);\n return;\n }\n\n try {\n const address = await getPlaceDetails(option.id);\n emit('update:modelValue', address);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n if (error?.isGoogleMapsError) {\n emit('error', error);\n } else {\n throw error;\n }\n }\n }\n</script>\n\n<template>\n <Select\n single\n data-test=\"select|address\"\n :disabled=\"props.disabled\"\n :loading=\"isLoading\"\n :options=\"options\"\n :placeholder=\"props.placeholder\"\n :label=\"props.label\"\n :hint-text=\"props.hintText\"\n :error=\"props.errorText\"\n :model-value=\"internalValue\"\n :prevent-empty=\"props.preventEmpty\"\n disable-filtering\n @search=\"debouncedSearch\"\n @update:model-value=\"select\"\n >\n <template v-if=\"slots.hint\" #hint>\n <slot name=\"hint\"></slot>\n </template>\n </Select>\n</template>\n"],"names":["ID_PREFIX","slots","useSlots","stashOptions","inject","googleMapsApiKey","computed","props","getPlaceDetails","getPlacePredictions","useGoogleMaps","isLoading","ref","options","internalValue","debouncedSearch","debounce","search","formattedAddress","_a","_b","_c","_d","_e","_f","watch","option","uniqueId","query","error","emit","select","address"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FE,MAAMA,IAAY;;;;;;;;;;;;;;;;;;;;;;iBAXZC,IAAQC,KACRC,IAAeC,EAA0B,cAAc,GAEvDC,IAAmBC,EAAS,MAAMC,EAAM,WAAUJ,KAAA,gBAAAA,EAAc,iBAAgB;AAElF,QAAA,CAACE,EAAiB;AACd,YAAA,IAAI,MAAM,iCAAiC;AAGnD,UAAM,EAAE,iBAAAG,GAAiB,qBAAAC,EAAA,IAAwBC,EAAcL,EAAiB,KAAK,GAI/EM,IAAYC,EAAI,EAAK,GACrBC,IAAUD,KACVE,IAAgBF,KAEhBG,IAAkBC,EAASC,GAAQV,EAAM,YAAY,GAErDW,IAAmBZ,EAAS,MAAM;;AAQ/BY,aAPkB;AAAA,QACvB,EAACC,IAAAZ,EAAM,eAAN,gBAAAY,EAAkB,iBAAgBC,IAAAb,EAAM,eAAN,gBAAAa,EAAkB,gBAAgB,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,SAC/FC,IAAAd,EAAM,eAAN,gBAAAc,EAAkB;AAAA,QAClB,EAACC,IAAAf,EAAM,eAAN,gBAAAe,EAAkB,QAAOC,IAAAhB,EAAM,eAAN,gBAAAgB,EAAkB,WAAW,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,SACjFC,IAAAjB,EAAM,eAAN,gBAAAiB,EAAkB;AAAA,MAClB,EAAA,OAAO,OAAO,EAAE,KAAK,IAAI;AAAA,IAEpB,CACR;AAGK,IAAAC,EAAA,MAAMlB,EAAM,YAAY,MAAM;;AAClC,UAAIW,EAAiB,SAAS,GAACC,IAAAN,EAAQ,UAAR,QAAAM,EAAe,SAAQ;AACpD,cAAMO,IAAS;AAAA,UACb,IAAInB,EAAM,WAAW,YAAYoB,EAAS3B,CAAS;AAAA,UACnD,MAAMkB,EAAiB;AAAA,UACvB,SAASX,EAAM;AAAA,QAAA;AAGT,QAAAM,EAAA,QAAQ,CAACa,CAAM,GACvBZ,EAAc,QAAQY;AAAA,MAAA;AACxB,QAAYR,EAAiB,UAC3BJ,EAAc,QAAQ,QACtBD,EAAQ,QAAQ;IAClB,GACC,EAAE,WAAW,GAAA,CAAM;AAEtB,mBAAeI,EAAOW,GAAe;AACnC,MAAAjB,EAAU,QAAQ;AAEd,UAAA;AACM,QAAAE,EAAA,QAAQ,MAAMJ,EAAoBmB,CAAK;AAAA,eAExCC,GAAY;AAEnB,YADAhB,EAAQ,QAAQ,IACZgB,KAAA,QAAAA,EAAO;AACT,UAAAC,EAAK,SAASD,CAAK;AAAA;AAEb,gBAAAA;AAAA,MACR,UACA;AACA,QAAAlB,EAAU,QAAQ;AAAA,MACpB;AAAA,IACF;AAEA,mBAAeoB,EAAOL,GAAuB;AAI3C,UAHAZ,EAAc,QAAQY,GAGlB,CAACA,GAAQ;AACX,QAAAI,EAAK,qBAAqB;AAAA,UACxB,gBAAgB;AAAA,UAChB,kBAAkB;AAAA,UAClB,MAAM;AAAA,UACN,OAAO;AAAA,UACP,aAAa;AAAA,UACb,SAAS;AAAA,QAAA,CACV;AACD;AAAA,MACF;AAGA,UAAIJ,EAAO,GAAG,WAAW1B,CAAS,KAAK0B,EAAO,SAAS;AAChD,QAAAI,EAAA,qBAAqBJ,EAAO,OAAO;AACxC;AAAA,MACF;AAEI,UAAA;AACF,cAAMM,IAAU,MAAMxB,EAAgBkB,EAAO,EAAE;AAC/C,QAAAI,EAAK,qBAAqBE,CAAO;AAAA,eAE1BH,GAAY;AACnB,YAAIA,KAAA,QAAAA,EAAO;AACT,UAAAC,EAAK,SAASD,CAAK;AAAA;AAEb,gBAAAA;AAAA,MAEV;AAAA,IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Alert.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import N from "./
|
|
5
|
-
import
|
|
1
|
+
import { defineComponent as x, useSlots as $, useCssModule as C, ref as I, computed as s, withDirectives as B, openBlock as i, createElementBlock as l, normalizeClass as r, createVNode as w, unref as t, createElementVNode as f, renderSlot as m, createCommentVNode as o } from "vue";
|
|
2
|
+
import y from "lodash-es/capitalize";
|
|
3
|
+
import S from "lodash-es/uniqueId";
|
|
4
|
+
import { b as M, a as N } from "./statusLevels-2c64f4f8.js";
|
|
5
|
+
import V from "./sticky.js";
|
|
6
|
+
import p from "./Icon.js";
|
|
6
7
|
import { _ as j } from "./_plugin-vue_export-helper-dad06003.js";
|
|
7
|
-
import "./toString-7d5bf363.js";
|
|
8
|
-
import "./isObjectLike-54341556.js";
|
|
9
|
-
import "./Icon.vue_used_vue_type_style_index_0_lang.module-d2507af3.js";
|
|
10
|
-
import "./uniqueId-847efe53.js";
|
|
11
8
|
import "./index-79ce320f.js";
|
|
12
|
-
|
|
9
|
+
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
10
|
+
const z = { class: "tw-m-0" }, A = /* @__PURE__ */ x({
|
|
13
11
|
name: "ll-alert",
|
|
14
12
|
__name: "Alert",
|
|
15
13
|
props: {
|
|
@@ -20,75 +18,78 @@ const z = { class: "tw-m-0" }, A = /* @__PURE__ */ $({
|
|
|
20
18
|
sticky: { default: null },
|
|
21
19
|
variant: { default: "outlined" }
|
|
22
20
|
},
|
|
23
|
-
setup(
|
|
24
|
-
const e =
|
|
25
|
-
return (
|
|
21
|
+
setup(b) {
|
|
22
|
+
const e = b, g = S("close-icon"), _ = $(), a = C(), c = I(!0), d = s(() => M[y(e.severity)]), h = s(() => N[y(e.severity)]), k = s(() => e.variant === "filled" && ["warning", "success"].includes(e.severity) ? "tw-text-ice-900" : e.variant === "filled" && ["info", "error"].includes(e.severity) ? "tw-text-white" : `tw-text-${h.value}`), n = s(() => e.variant === "filled" && ["info", "error"].includes(e.severity) ? "tw-text-white" : "tw-text-ice-900");
|
|
23
|
+
return (u, v) => c.value ? B((i(), l("div", {
|
|
26
24
|
key: 0,
|
|
27
|
-
class:
|
|
25
|
+
class: r(["stash-alert tw-items-center tw-flex tw-p-3 tw-relative tw-leading-6 tw-border tw-border-solid", [
|
|
26
|
+
`stash-alert--${e.severity}`,
|
|
27
|
+
`stash-alert--${e.variant}`,
|
|
28
|
+
n.value,
|
|
28
29
|
{
|
|
30
|
+
"tw-my-6": e.variant === "outlined",
|
|
29
31
|
// Todo - this makes ZERO sense. We should remove this altogether and let the consumer handle the margin.
|
|
30
|
-
"tw-
|
|
31
|
-
"tw-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
"tw-rounded": e.radius === "standard",
|
|
33
|
+
"tw-border-red": e.severity === "error",
|
|
34
|
+
"tw-border-orange": e.severity === "warning",
|
|
35
|
+
"tw-border-blue": e.severity === "info",
|
|
36
|
+
"tw-border-green": e.severity === "success",
|
|
37
|
+
"tw-bg-red": e.severity === "error" && e.variant === "filled",
|
|
38
|
+
"tw-bg-orange": e.severity === "warning" && e.variant === "filled",
|
|
39
|
+
"tw-bg-blue": e.severity === "info" && e.variant === "filled",
|
|
40
|
+
"tw-bg-green": e.severity === "success" && e.variant === "filled",
|
|
41
|
+
"tw-bg-red-100": e.severity === "error" && e.variant === "outlined",
|
|
42
|
+
"tw-bg-orange-100": e.severity === "warning" && e.variant === "outlined",
|
|
43
|
+
"tw-bg-blue-100": e.severity === "info" && e.variant === "outlined",
|
|
44
|
+
"tw-bg-green-100": e.severity === "success" && e.variant === "outlined"
|
|
45
|
+
}
|
|
35
46
|
]]),
|
|
36
47
|
"data-test": "stash-alert"
|
|
37
48
|
}, [
|
|
38
|
-
|
|
39
|
-
class:
|
|
40
|
-
name:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
w(p, {
|
|
50
|
+
class: r(["stash-alert__icon", [t(a).iconInfo, k.value, `stash-alert__icon--${d.value}`]]),
|
|
51
|
+
name: d.value,
|
|
52
|
+
title: `${e.severity} icon`,
|
|
53
|
+
"data-test": "stash-alert|status-icon"
|
|
54
|
+
}, null, 8, ["class", "name", "title"]),
|
|
55
|
+
f("div", {
|
|
56
|
+
class: r(["tw-flex tw-flex-1 tw-px-2 tw-flex-wrap", {
|
|
45
57
|
"tw-justify-center": e.centered,
|
|
46
58
|
"tw-justify-between": !e.centered
|
|
47
59
|
}])
|
|
48
60
|
}, [
|
|
49
|
-
|
|
50
|
-
|
|
61
|
+
f("p", z, [
|
|
62
|
+
m(u.$slots, "default")
|
|
51
63
|
]),
|
|
52
|
-
|
|
64
|
+
t(_).link ? (i(), l("div", {
|
|
53
65
|
key: 0,
|
|
54
|
-
class:
|
|
55
|
-
s(o).link,
|
|
56
|
-
{
|
|
57
|
-
"tw-ml-2": e.centered
|
|
58
|
-
}
|
|
59
|
-
]]),
|
|
66
|
+
class: r(["stash-alert__link tw-pointer tw-underline hover:tw-no-underline", [t(a).link, n.value, { "tw-ml-2": e.centered }]]),
|
|
60
67
|
"data-test": "stash-alert|link"
|
|
61
68
|
}, [
|
|
62
|
-
|
|
63
|
-
], 2)) :
|
|
69
|
+
m(u.$slots, "link")
|
|
70
|
+
], 2)) : o("", !0)
|
|
64
71
|
], 2),
|
|
65
|
-
e.permanent ?
|
|
72
|
+
e.permanent ? o("", !0) : (i(), l("button", {
|
|
66
73
|
key: 0,
|
|
67
|
-
class:
|
|
74
|
+
class: r(["stash-alert__close", [t(a).button, n.value]]),
|
|
68
75
|
type: "button",
|
|
69
76
|
"data-test": "stash-alert|close",
|
|
70
|
-
onClick:
|
|
77
|
+
onClick: v[0] || (v[0] = (q) => c.value = !1)
|
|
71
78
|
}, [
|
|
72
|
-
|
|
79
|
+
w(p, {
|
|
80
|
+
id: t(g),
|
|
81
|
+
name: "close",
|
|
82
|
+
title: "Dismiss alert"
|
|
83
|
+
}, null, 8, ["id"])
|
|
73
84
|
], 2))
|
|
74
85
|
], 2)), [
|
|
75
|
-
[
|
|
76
|
-
]) :
|
|
86
|
+
[t(V), e.sticky]
|
|
87
|
+
]) : o("", !0);
|
|
77
88
|
}
|
|
78
|
-
}),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
info: F,
|
|
82
|
-
success: q,
|
|
83
|
-
link: G,
|
|
84
|
-
"filled-error": "_filled-error_12xko_31",
|
|
85
|
-
"filled-info": "_filled-info_12xko_40",
|
|
86
|
-
"filled-warning": "_filled-warning_12xko_64",
|
|
87
|
-
"filled-success": "_filled-success_12xko_68"
|
|
88
|
-
}, J = {
|
|
89
|
-
$style: H
|
|
90
|
-
}, ee = /* @__PURE__ */ j(A, [["__cssModules", J]]);
|
|
89
|
+
}), D = {}, E = {
|
|
90
|
+
$style: D
|
|
91
|
+
}, Q = /* @__PURE__ */ j(A, [["__cssModules", E]]);
|
|
91
92
|
export {
|
|
92
|
-
|
|
93
|
+
Q as default
|
|
93
94
|
};
|
|
94
95
|
//# sourceMappingURL=Alert.js.map
|
package/dist/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../src/components/Alert/Alert.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import capitalize from 'lodash-es/capitalize';\n import { computed, ref, useCssModule, useSlots } from 'vue';\n\n import { StatusColor, StatusColors, StatusIcon, StatusIcons, StatusSeverity } from '../../../types/statusLevels';\n import vSticky from '../../directives/sticky/sticky';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-alert',\n });\n\n export interface AlertProps {\n /**\n * Determines if the alert is centered\n */\n centered?: boolean;\n\n /**\n * Determines if the alert is permanent (doesn't have a close button).\n */\n permanent?: boolean;\n\n /**\n * The type of border radius to use. Available types:\n *\n * - `none` - no border radius\n * - `standard` - 4px border radius\n */\n radius?: 'none' | 'standard';\n\n /**\n * The type of alert. Available types:\n *\n * - `info`\n * - `success`\n * - `warning`\n * - `error`\n */\n severity?: StatusSeverity;\n\n /**\n * Determines if the alert is sticky. By default, it's not sticky. The provided `number` value is a top offset of alert.\n */\n sticky?: number | null;\n\n /**\n * The variant of alert. Available variants:\n *\n * - `filled` - previously alert component\n * - `outlined` - previously banner component\n */\n variant?: 'outlined' | 'filled';\n }\n\n const props = withDefaults(defineProps<AlertProps>(), {\n centered: false,\n permanent: false,\n radius: 'standard',\n severity: 'info',\n sticky: null,\n variant: 'outlined',\n });\n\n const slots = useSlots();\n const classes = useCssModule();\n const show = ref(true);\n const icon = computed<StatusIcon>(() => StatusIcons[capitalize(props.severity)]);\n const color = computed<StatusColor>(() => StatusColors[capitalize(props.severity)]);\n\n const
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../src/components/Alert/Alert.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import capitalize from 'lodash-es/capitalize';\n import uniqueId from 'lodash-es/uniqueId';\n import { computed, ref, useCssModule, useSlots } from 'vue';\n\n import { StatusColor, StatusColors, StatusIcon, StatusIcons, StatusSeverity } from '../../../types/statusLevels';\n import vSticky from '../../directives/sticky/sticky';\n import Icon from '../Icon/Icon.vue';\n\n defineOptions({\n name: 'll-alert',\n });\n\n export interface AlertProps {\n /**\n * Determines if the alert is centered\n */\n centered?: boolean;\n\n /**\n * Determines if the alert is permanent (doesn't have a close button).\n */\n permanent?: boolean;\n\n /**\n * The type of border radius to use. Available types:\n *\n * - `none` - no border radius\n * - `standard` - 4px border radius\n */\n radius?: 'none' | 'standard';\n\n /**\n * The type of alert. Available types:\n *\n * - `info`\n * - `success`\n * - `warning`\n * - `error`\n */\n severity?: StatusSeverity;\n\n /**\n * Determines if the alert is sticky. By default, it's not sticky. The provided `number` value is a top offset of alert.\n */\n sticky?: number | null;\n\n /**\n * The variant of alert. Available variants:\n *\n * - `filled` - previously alert component\n * - `outlined` - previously banner component\n */\n variant?: 'outlined' | 'filled';\n }\n\n const props = withDefaults(defineProps<AlertProps>(), {\n centered: false,\n permanent: false,\n radius: 'standard',\n severity: 'info',\n sticky: null,\n variant: 'outlined',\n });\n\n const iconId = uniqueId('close-icon');\n const slots = useSlots();\n const classes = useCssModule();\n const show = ref(true);\n const icon = computed<StatusIcon>(() => StatusIcons[capitalize(props.severity)]);\n const color = computed<StatusColor>(() => StatusColors[capitalize(props.severity)]);\n\n const iconColor = computed<string>(() => {\n if (props.variant === 'filled' && ['warning', 'success'].includes(props.severity)) {\n return 'tw-text-ice-900';\n }\n\n if (props.variant === 'filled' && ['info', 'error'].includes(props.severity)) {\n return 'tw-text-white';\n }\n\n return `tw-text-${color.value}`;\n });\n\n const computedTextColor = computed<string>(() => {\n if (props.variant === 'filled' && ['info', 'error'].includes(props.severity)) {\n return 'tw-text-white';\n }\n\n return 'tw-text-ice-900';\n });\n</script>\n\n<template>\n <div\n v-if=\"show\"\n v-sticky=\"props.sticky\"\n class=\"stash-alert tw-items-center tw-flex tw-p-3 tw-relative tw-leading-6 tw-border tw-border-solid\"\n :class=\"[\n `stash-alert--${props.severity}`,\n `stash-alert--${props.variant}`,\n computedTextColor,\n {\n 'tw-my-6': props.variant === 'outlined', // Todo - this makes ZERO sense. We should remove this altogether and let the consumer handle the margin.\n 'tw-rounded': props.radius === 'standard',\n 'tw-border-red': props.severity === 'error',\n 'tw-border-orange': props.severity === 'warning',\n 'tw-border-blue': props.severity === 'info',\n 'tw-border-green': props.severity === 'success',\n 'tw-bg-red': props.severity === 'error' && props.variant === 'filled',\n 'tw-bg-orange': props.severity === 'warning' && props.variant === 'filled',\n 'tw-bg-blue': props.severity === 'info' && props.variant === 'filled',\n 'tw-bg-green': props.severity === 'success' && props.variant === 'filled',\n 'tw-bg-red-100': props.severity === 'error' && props.variant === 'outlined',\n 'tw-bg-orange-100': props.severity === 'warning' && props.variant === 'outlined',\n 'tw-bg-blue-100': props.severity === 'info' && props.variant === 'outlined',\n 'tw-bg-green-100': props.severity === 'success' && props.variant === 'outlined',\n },\n ]\"\n data-test=\"stash-alert\"\n >\n <Icon\n class=\"stash-alert__icon\"\n :class=\"[classes.iconInfo, iconColor, `stash-alert__icon--${icon}`]\"\n :name=\"icon\"\n :title=\"`${props.severity} icon`\"\n data-test=\"stash-alert|status-icon\"\n />\n\n <!-- Alert text elements -->\n <div\n class=\"tw-flex tw-flex-1 tw-px-2 tw-flex-wrap\"\n :class=\"{\n 'tw-justify-center': props.centered,\n 'tw-justify-between': !props.centered,\n }\"\n >\n <p class=\"tw-m-0\">\n <slot></slot>\n </p>\n\n <div\n v-if=\"slots.link\"\n class=\"stash-alert__link tw-pointer tw-underline hover:tw-no-underline\"\n :class=\"[classes.link, computedTextColor, { 'tw-ml-2': props.centered }]\"\n data-test=\"stash-alert|link\"\n >\n <slot name=\"link\"></slot>\n </div>\n </div>\n\n <button\n v-if=\"!props.permanent\"\n class=\"stash-alert__close\"\n :class=\"[classes.button, computedTextColor]\"\n type=\"button\"\n data-test=\"stash-alert|close\"\n @click=\"show = false\"\n >\n <Icon :id=\"iconId\" name=\"close\" title=\"Dismiss alert\" />\n </button>\n </div>\n</template>\n\n<style module>\n :global(.stash-alert__link) {\n a,\n button {\n color: theme('colors.ice.900');\n cursor: pointer;\n text-decoration: underline;\n\n &:hover {\n text-decoration: none;\n }\n }\n }\n\n :global(.stash-alert--filled.stash-alert--error),\n :global(.stash-alert--filled.stash-alert--info) {\n :global(.stash-alert__link) a,\n :global(.stash-alert__link) button {\n color: theme('colors.white');\n }\n }\n</style>\n"],"names":["iconId","uniqueId","slots","useSlots","classes","useCssModule","show","ref","icon","computed","StatusIcons","capitalize","props","color","StatusColors","iconColor","computedTextColor"],"mappings":";;;;;;;;;;;;;;;;;;;;;iBAiEQA,IAASC,EAAS,YAAY,GAC9BC,IAAQC,KACRC,IAAUC,KACVC,IAAOC,EAAI,EAAI,GACfC,IAAOC,EAAqB,MAAMC,EAAYC,EAAWC,EAAM,QAAQ,CAAC,CAAC,GACzEC,IAAQJ,EAAsB,MAAMK,EAAaH,EAAWC,EAAM,QAAQ,CAAC,CAAC,GAE5EG,IAAYN,EAAiB,MAC7BG,EAAM,YAAY,YAAY,CAAC,WAAW,SAAS,EAAE,SAASA,EAAM,QAAQ,IACvE,oBAGLA,EAAM,YAAY,YAAY,CAAC,QAAQ,OAAO,EAAE,SAASA,EAAM,QAAQ,IAClE,kBAGF,WAAWC,EAAM,KAAK,EAC9B,GAEKG,IAAoBP,EAAiB,MACrCG,EAAM,YAAY,YAAY,CAAC,QAAQ,OAAO,EAAE,SAASA,EAAM,QAAQ,IAClE,kBAGF,iBACR;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,11 +2,9 @@ import { defineComponent as v, ref as y, useSlots as $, resolveComponent as x, o
|
|
|
2
2
|
import { _ as h } from "./Expand.vue_vue_type_script_setup_true_lang-5fe03d51.js";
|
|
3
3
|
import i from "./Icon.js";
|
|
4
4
|
import { _ as k } from "./_plugin-vue_export-helper-dad06003.js";
|
|
5
|
-
import "
|
|
6
|
-
import "./uniqueId-847efe53.js";
|
|
7
|
-
import "./toString-7d5bf363.js";
|
|
8
|
-
import "./isObjectLike-54341556.js";
|
|
5
|
+
import "lodash-es/uniqueId";
|
|
9
6
|
import "./index-79ce320f.js";
|
|
7
|
+
import "./Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js";
|
|
10
8
|
const C = { class: "flex-1 flex items-center overflow-hidden" }, A = { class: "text-truncate" }, B = { key: 1 }, I = { class: "flex-1 flex items-center overflow-hidden" }, N = { class: "text-truncate" }, g = /* @__PURE__ */ v({
|
|
11
9
|
__name: "AppNavigationItem",
|
|
12
10
|
props: {
|
|
@@ -79,8 +77,8 @@ const C = { class: "flex-1 flex items-center overflow-hidden" }, A = { class: "t
|
|
|
79
77
|
caret: j
|
|
80
78
|
}, V = {
|
|
81
79
|
$style: M
|
|
82
|
-
},
|
|
80
|
+
}, L = /* @__PURE__ */ k(g, [["__cssModules", V]]);
|
|
83
81
|
export {
|
|
84
|
-
|
|
82
|
+
L as default
|
|
85
83
|
};
|
|
86
84
|
//# sourceMappingURL=AppNavigationItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppNavigationItem.js","sources":["../src/components/AppNavigationItem/AppNavigationItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { ref, useSlots } from 'vue';\n import { type RouteLocationRaw } from 'vue-router';\n\n import Expand from '../Expand/Expand.vue';\n import { IconName } from '../Icon/Icon.types';\n import Icon from '../Icon/Icon.vue';\n\n export interface AppNavigationItemProps {\n /**\n * Location to navigate to\n */\n to: RouteLocationRaw,\n /**\n * Icon to render on the left side\n */\n icon: IconName;\n /**\n * Text label to render\n */\n label: string;\n /**\n * Indicates whether the route is active or not\n */\n isActive?: boolean;\n }\n\n const isExpanded = ref(false);\n\n const props = withDefaults(defineProps<AppNavigationItemProps>(), {\n isActive: false,\n });\n\n const slots = useSlots();\n</script>\n\n<template>\n <li>\n <router-link\n v-if=\"!slots['sub-items']\"\n :to=\"props.to\"\n :class=\"[$style.item, { [$style.active]: props.isActive }]\"\n :active-class=\"$style.active\"\n class=\"flex items-center justify-between text-capitalize font-normal w-full\"\n >\n <div class=\"flex-1 flex items-center overflow-hidden\">\n <Icon :name=\"props.icon\" class=\"tw-mr-3\" />\n <span class=\"text-truncate\">{{ props.label }}</span>\n </div>\n <!-- @slot Default component slot, for content to the right side of item -->\n <slot></slot>\n </router-link>\n <div v-else>\n <button\n :class=\"[$style.item, { [$style.expanded]: isExpanded }]\"\n class=\"flex items-center justify-between text-capitalize font-normal w-full\"\n @click=\"() => (isExpanded = !isExpanded)\"\n >\n <div class=\"flex-1 flex items-center overflow-hidden\">\n <Icon :name=\"props.icon\" class=\"tw-mr-3\" />\n <span class=\"text-truncate\">{{ props.label }}</span>\n </div>\n <Icon :class=\"[$style.caret, { [$style.expandedIcon]: isExpanded }]\" name=\"chevron-left\" />\n </button>\n <Expand :is-expanded=\"isExpanded\" :class=\"$style.expand\">\n <ul :class=\"$style['sub-items']\">\n <!-- @slot Sub items component slot, for rendering nested navigation items -->\n <slot name=\"sub-items\"></slot>\n </ul>\n </Expand>\n </div>\n </li>\n</template>\n\n<style module>\n .item {\n border-left: 6px solid transparent;\n color: var(--color-ice);\n padding: 10px 12px;\n transition: background-color 150ms;\n }\n\n .item:hover,\n .item:focus {\n text-decoration: none;\n background: #140e35;\n }\n\n .sub-items .item {\n padding-left: 40px;\n }\n\n .expanded {\n background-color: #263256;\n }\n\n .active {\n color: var(--color-seafoam);\n border-color: var(--color-seafoam);\n background: #140e35;\n }\n\n .caret {\n transition: transform 300ms ease-in-out;\n }\n\n .expanded .caret {\n transform: rotate(-90deg);\n }\n</style>\n"],"names":["isExpanded","ref","slots","useSlots"],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppNavigationItem.js","sources":["../src/components/AppNavigationItem/AppNavigationItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\n import { ref, useSlots } from 'vue';\n import { type RouteLocationRaw } from 'vue-router';\n\n import Expand from '../Expand/Expand.vue';\n import { IconName } from '../Icon/Icon.types';\n import Icon from '../Icon/Icon.vue';\n\n export interface AppNavigationItemProps {\n /**\n * Location to navigate to\n */\n to: RouteLocationRaw,\n /**\n * Icon to render on the left side\n */\n icon: IconName;\n /**\n * Text label to render\n */\n label: string;\n /**\n * Indicates whether the route is active or not\n */\n isActive?: boolean;\n }\n\n const isExpanded = ref(false);\n\n const props = withDefaults(defineProps<AppNavigationItemProps>(), {\n isActive: false,\n });\n\n const slots = useSlots();\n</script>\n\n<template>\n <li>\n <router-link\n v-if=\"!slots['sub-items']\"\n :to=\"props.to\"\n :class=\"[$style.item, { [$style.active]: props.isActive }]\"\n :active-class=\"$style.active\"\n class=\"flex items-center justify-between text-capitalize font-normal w-full\"\n >\n <div class=\"flex-1 flex items-center overflow-hidden\">\n <Icon :name=\"props.icon\" class=\"tw-mr-3\" />\n <span class=\"text-truncate\">{{ props.label }}</span>\n </div>\n <!-- @slot Default component slot, for content to the right side of item -->\n <slot></slot>\n </router-link>\n <div v-else>\n <button\n :class=\"[$style.item, { [$style.expanded]: isExpanded }]\"\n class=\"flex items-center justify-between text-capitalize font-normal w-full\"\n @click=\"() => (isExpanded = !isExpanded)\"\n >\n <div class=\"flex-1 flex items-center overflow-hidden\">\n <Icon :name=\"props.icon\" class=\"tw-mr-3\" />\n <span class=\"text-truncate\">{{ props.label }}</span>\n </div>\n <Icon :class=\"[$style.caret, { [$style.expandedIcon]: isExpanded }]\" name=\"chevron-left\" />\n </button>\n <Expand :is-expanded=\"isExpanded\" :class=\"$style.expand\">\n <ul :class=\"$style['sub-items']\">\n <!-- @slot Sub items component slot, for rendering nested navigation items -->\n <slot name=\"sub-items\"></slot>\n </ul>\n </Expand>\n </div>\n </li>\n</template>\n\n<style module>\n .item {\n border-left: 6px solid transparent;\n color: var(--color-ice);\n padding: 10px 12px;\n transition: background-color 150ms;\n }\n\n .item:hover,\n .item:focus {\n text-decoration: none;\n background: #140e35;\n }\n\n .sub-items .item {\n padding-left: 40px;\n }\n\n .expanded {\n background-color: #263256;\n }\n\n .active {\n color: var(--color-seafoam);\n border-color: var(--color-seafoam);\n background: #140e35;\n }\n\n .caret {\n transition: transform 300ms ease-in-out;\n }\n\n .expanded .caret {\n transform: rotate(-90deg);\n }\n</style>\n"],"names":["isExpanded","ref","slots","useSlots"],"mappings":";;;;;;;;;;;;;;;;iBA2BQA,IAAaC,EAAI,EAAK,GAMtBC,IAAQC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|