@pequity/squirrel 1.0.22 → 1.0.24

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 CHANGED
@@ -56,7 +56,7 @@ If you are using Jest for unit testing, you will need to add the following to yo
56
56
  ```js
57
57
  {
58
58
  moduleNameMapper: {
59
- '^@pequity/squirrel$': '<rootDir>/node_modules/@pequity/squirrel/dist/squirrel.cjs.js'
59
+ '^@pequity/squirrel$': '<rootDir>/node_modules/@pequity/squirrel/dist/cjs',
60
60
  }
61
61
  }
62
62
  ```
package/dist/cjs/p-btn.js CHANGED
@@ -2,196 +2,8 @@
2
2
  const pRingLoader_vue_vue_type_script_setup_true_lang = require("./chunks/p-ring-loader.js");
3
3
  const tailwind = require("./tailwind.js");
4
4
  const vue = require("vue");
5
+ const vueRouter = require("vue-router");
5
6
  const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
6
- /*!
7
- * vue-router v4.3.0
8
- * (c) 2024 Eduardo San Martin Morote
9
- * @license MIT
10
- */
11
- const isBrowser = typeof document !== "undefined";
12
- const noop = () => {
13
- };
14
- const isArray = Array.isArray;
15
- function isSameRouteRecord(a, b) {
16
- return (a.aliasOf || a) === (b.aliasOf || b);
17
- }
18
- function isSameRouteLocationParams(a, b) {
19
- if (Object.keys(a).length !== Object.keys(b).length)
20
- return false;
21
- for (const key in a) {
22
- if (!isSameRouteLocationParamsValue(a[key], b[key]))
23
- return false;
24
- }
25
- return true;
26
- }
27
- function isSameRouteLocationParamsValue(a, b) {
28
- return isArray(a) ? isEquivalentArray(a, b) : isArray(b) ? isEquivalentArray(b, a) : a === b;
29
- }
30
- function isEquivalentArray(a, b) {
31
- return isArray(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
32
- }
33
- var NavigationType;
34
- (function(NavigationType2) {
35
- NavigationType2["pop"] = "pop";
36
- NavigationType2["push"] = "push";
37
- })(NavigationType || (NavigationType = {}));
38
- var NavigationDirection;
39
- (function(NavigationDirection2) {
40
- NavigationDirection2["back"] = "back";
41
- NavigationDirection2["forward"] = "forward";
42
- NavigationDirection2["unknown"] = "";
43
- })(NavigationDirection || (NavigationDirection = {}));
44
- Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
45
- var NavigationFailureType;
46
- (function(NavigationFailureType2) {
47
- NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
48
- NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
49
- NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
50
- })(NavigationFailureType || (NavigationFailureType = {}));
51
- Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
52
- Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
53
- const routerKey = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
54
- const routeLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
55
- Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
56
- function useLink(props) {
57
- const router = vue.inject(routerKey);
58
- const currentRoute = vue.inject(routeLocationKey);
59
- const route = vue.computed(() => router.resolve(vue.unref(props.to)));
60
- const activeRecordIndex = vue.computed(() => {
61
- const { matched } = route.value;
62
- const { length } = matched;
63
- const routeMatched = matched[length - 1];
64
- const currentMatched = currentRoute.matched;
65
- if (!routeMatched || !currentMatched.length)
66
- return -1;
67
- const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
68
- if (index > -1)
69
- return index;
70
- const parentRecordPath = getOriginalPath(matched[length - 2]);
71
- return (
72
- // we are dealing with nested routes
73
- length > 1 && // if the parent and matched route have the same path, this link is
74
- // referring to the empty child. Or we currently are on a different
75
- // child of the same parent
76
- getOriginalPath(routeMatched) === parentRecordPath && // avoid comparing the child with its parent
77
- currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index
78
- );
79
- });
80
- const isActive = vue.computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
81
- const isExactActive = vue.computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
82
- function navigate(e = {}) {
83
- if (guardEvent(e)) {
84
- return router[vue.unref(props.replace) ? "replace" : "push"](
85
- vue.unref(props.to)
86
- // avoid uncaught errors are they are logged anyway
87
- ).catch(noop);
88
- }
89
- return Promise.resolve();
90
- }
91
- if ((process.env.NODE_ENV !== "production" || false) && isBrowser) {
92
- const instance = vue.getCurrentInstance();
93
- if (instance) {
94
- const linkContextDevtools = {
95
- route: route.value,
96
- isActive: isActive.value,
97
- isExactActive: isExactActive.value
98
- };
99
- instance.__vrl_devtools = instance.__vrl_devtools || [];
100
- instance.__vrl_devtools.push(linkContextDevtools);
101
- vue.watchEffect(() => {
102
- linkContextDevtools.route = route.value;
103
- linkContextDevtools.isActive = isActive.value;
104
- linkContextDevtools.isExactActive = isExactActive.value;
105
- }, { flush: "post" });
106
- }
107
- }
108
- return {
109
- route,
110
- href: vue.computed(() => route.value.href),
111
- isActive,
112
- isExactActive,
113
- navigate
114
- };
115
- }
116
- const RouterLinkImpl = /* @__PURE__ */ vue.defineComponent({
117
- name: "RouterLink",
118
- compatConfig: { MODE: 3 },
119
- props: {
120
- to: {
121
- type: [String, Object],
122
- required: true
123
- },
124
- replace: Boolean,
125
- activeClass: String,
126
- // inactiveClass: String,
127
- exactActiveClass: String,
128
- custom: Boolean,
129
- ariaCurrentValue: {
130
- type: String,
131
- default: "page"
132
- }
133
- },
134
- useLink,
135
- setup(props, { slots }) {
136
- const link = vue.reactive(useLink(props));
137
- const { options } = vue.inject(routerKey);
138
- const elClass = vue.computed(() => ({
139
- [getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
140
- // [getLinkClass(
141
- // props.inactiveClass,
142
- // options.linkInactiveClass,
143
- // 'router-link-inactive'
144
- // )]: !link.isExactActive,
145
- [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
146
- }));
147
- return () => {
148
- const children = slots.default && slots.default(link);
149
- return props.custom ? children : vue.h("a", {
150
- "aria-current": link.isExactActive ? props.ariaCurrentValue : null,
151
- href: link.href,
152
- // this would override user added attrs but Vue will still add
153
- // the listener, so we end up triggering both
154
- onClick: link.navigate,
155
- class: elClass.value
156
- }, children);
157
- };
158
- }
159
- });
160
- const RouterLink = RouterLinkImpl;
161
- function guardEvent(e) {
162
- if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
163
- return;
164
- if (e.defaultPrevented)
165
- return;
166
- if (e.button !== void 0 && e.button !== 0)
167
- return;
168
- if (e.currentTarget && e.currentTarget.getAttribute) {
169
- const target = e.currentTarget.getAttribute("target");
170
- if (/\b_blank\b/i.test(target))
171
- return;
172
- }
173
- if (e.preventDefault)
174
- e.preventDefault();
175
- return true;
176
- }
177
- function includesParams(outer, inner) {
178
- for (const key in inner) {
179
- const innerValue = inner[key];
180
- const outerValue = outer[key];
181
- if (typeof innerValue === "string") {
182
- if (innerValue !== outerValue)
183
- return false;
184
- } else {
185
- if (!isArray(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i]))
186
- return false;
187
- }
188
- }
189
- return true;
190
- }
191
- function getOriginalPath(record) {
192
- return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
193
- }
194
- const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
195
7
  const BUTTON_TYPES = {
196
8
  PRIMARY: "primary",
197
9
  SECONDARY: "secondary",
@@ -244,7 +56,7 @@ const _sfc_main = vue.defineComponent({
244
56
  name: "PBtn",
245
57
  components: {
246
58
  PRingLoader: pRingLoader_vue_vue_type_script_setup_true_lang._sfc_main,
247
- RouterLink
59
+ RouterLink: vueRouter.RouterLink
248
60
  },
249
61
  inheritAttrs: false,
250
62
  props: {
@@ -3,7 +3,7 @@ const pAlert = require("./p-alert.js");
3
3
  const pCloseBtn = require("./p-close-btn.js");
4
4
  const vue = require("vue");
5
5
  const _pluginVue_exportHelper = require("./chunks/_plugin-vue_export-helper.js");
6
- const _sfc_main = vue.defineComponent({
6
+ const __default__ = vue.defineComponent({
7
7
  name: "PDrawer",
8
8
  components: {
9
9
  PAlert: pAlert,
@@ -69,6 +69,13 @@ const _sfc_main = vue.defineComponent({
69
69
  enableClose: {
70
70
  type: Boolean,
71
71
  default: true
72
+ },
73
+ width: {
74
+ type: String,
75
+ default: "460px",
76
+ validator: (value) => {
77
+ return !!value.match(/^[0-9]+px$/);
78
+ }
72
79
  }
73
80
  },
74
81
  emits: ["update:modelValue", "before-open", "opening", "opened", "before-close", "closing", "closed"],
@@ -85,6 +92,9 @@ const _sfc_main = vue.defineComponent({
85
92
  },
86
93
  transitionOutClass() {
87
94
  return this.outClass || this.position === "right" ? "slideOutRight" : "slideOutLeft";
95
+ },
96
+ animationDuration() {
97
+ return (parseInt(this.width, 10) / 1200).toFixed(2) + "s";
88
98
  }
89
99
  },
90
100
  created() {
@@ -140,6 +150,17 @@ const _sfc_main = vue.defineComponent({
140
150
  }
141
151
  }
142
152
  });
153
+ const __injectCSSVars__ = () => {
154
+ vue.useCssVars((_ctx) => ({
155
+ "4c0aead4": _ctx.width,
156
+ "59cfae08": _ctx.animationDuration
157
+ }));
158
+ };
159
+ const __setup__ = __default__.setup;
160
+ __default__.setup = __setup__ ? (props, ctx) => {
161
+ __injectCSSVars__();
162
+ return __setup__(props, ctx);
163
+ } : __injectCSSVars__;
143
164
  const _hoisted_1 = ["data-drawer-id", "aria-label", "aria-describedby", "aria-labelledby"];
144
165
  const _hoisted_2 = ["id"];
145
166
  const _hoisted_3 = {
@@ -213,7 +234,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
213
234
  _ctx.title ? (vue.openBlock(), vue.createElementBlock("h3", {
214
235
  key: 0,
215
236
  id: `${_ctx.id}-title`,
216
- class: vue.normalizeClass(["flex-1 text-xl font-medium", { "text-right": _ctx.position === "left" }])
237
+ class: vue.normalizeClass(["flex-1 text-xl font-medium leading-8", { "text-right": _ctx.position === "left" }])
217
238
  }, vue.toDisplayString(_ctx.title), 11, _hoisted_2)) : vue.createCommentVNode("", true)
218
239
  ], true)
219
240
  ], 2)
@@ -249,5 +270,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
249
270
  }, 8, ["enter-active-class", "leave-active-class", "onBeforeEnter", "onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])
250
271
  ], 8, ["to"])) : vue.createCommentVNode("", true);
251
272
  }
252
- const pDrawer = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a0b8be1e"]]);
273
+ const pDrawer = /* @__PURE__ */ _pluginVue_exportHelper._export_sfc(__default__, [["render", _sfc_render], ["__scopeId", "data-v-f474eec2"]]);
253
274
  module.exports = pDrawer;
package/dist/es/p-btn.js CHANGED
@@ -1,196 +1,8 @@
1
1
  import { _ as _sfc_main$1 } from "./chunks/p-ring-loader.js";
2
2
  import { getColorDeep } from "./tailwind.js";
3
- import { defineComponent, reactive, inject, computed, h, unref, getCurrentInstance, watchEffect, resolveComponent, openBlock, createElementBlock, mergeProps, renderSlot, createBlock, resolveDynamicComponent, withCtx, createElementVNode, normalizeClass, normalizeStyle, createCommentVNode } from "vue";
3
+ import { defineComponent, resolveComponent, openBlock, createElementBlock, mergeProps, renderSlot, createBlock, resolveDynamicComponent, withCtx, createElementVNode, normalizeClass, normalizeStyle, createCommentVNode } from "vue";
4
+ import { RouterLink } from "vue-router";
4
5
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
- /*!
6
- * vue-router v4.3.0
7
- * (c) 2024 Eduardo San Martin Morote
8
- * @license MIT
9
- */
10
- const isBrowser = typeof document !== "undefined";
11
- const noop = () => {
12
- };
13
- const isArray = Array.isArray;
14
- function isSameRouteRecord(a, b) {
15
- return (a.aliasOf || a) === (b.aliasOf || b);
16
- }
17
- function isSameRouteLocationParams(a, b) {
18
- if (Object.keys(a).length !== Object.keys(b).length)
19
- return false;
20
- for (const key in a) {
21
- if (!isSameRouteLocationParamsValue(a[key], b[key]))
22
- return false;
23
- }
24
- return true;
25
- }
26
- function isSameRouteLocationParamsValue(a, b) {
27
- return isArray(a) ? isEquivalentArray(a, b) : isArray(b) ? isEquivalentArray(b, a) : a === b;
28
- }
29
- function isEquivalentArray(a, b) {
30
- return isArray(b) ? a.length === b.length && a.every((value, i) => value === b[i]) : a.length === 1 && a[0] === b;
31
- }
32
- var NavigationType;
33
- (function(NavigationType2) {
34
- NavigationType2["pop"] = "pop";
35
- NavigationType2["push"] = "push";
36
- })(NavigationType || (NavigationType = {}));
37
- var NavigationDirection;
38
- (function(NavigationDirection2) {
39
- NavigationDirection2["back"] = "back";
40
- NavigationDirection2["forward"] = "forward";
41
- NavigationDirection2["unknown"] = "";
42
- })(NavigationDirection || (NavigationDirection = {}));
43
- Symbol(process.env.NODE_ENV !== "production" ? "navigation failure" : "");
44
- var NavigationFailureType;
45
- (function(NavigationFailureType2) {
46
- NavigationFailureType2[NavigationFailureType2["aborted"] = 4] = "aborted";
47
- NavigationFailureType2[NavigationFailureType2["cancelled"] = 8] = "cancelled";
48
- NavigationFailureType2[NavigationFailureType2["duplicated"] = 16] = "duplicated";
49
- })(NavigationFailureType || (NavigationFailureType = {}));
50
- Symbol(process.env.NODE_ENV !== "production" ? "router view location matched" : "");
51
- Symbol(process.env.NODE_ENV !== "production" ? "router view depth" : "");
52
- const routerKey = Symbol(process.env.NODE_ENV !== "production" ? "router" : "");
53
- const routeLocationKey = Symbol(process.env.NODE_ENV !== "production" ? "route location" : "");
54
- Symbol(process.env.NODE_ENV !== "production" ? "router view location" : "");
55
- function useLink(props) {
56
- const router = inject(routerKey);
57
- const currentRoute = inject(routeLocationKey);
58
- const route = computed(() => router.resolve(unref(props.to)));
59
- const activeRecordIndex = computed(() => {
60
- const { matched } = route.value;
61
- const { length } = matched;
62
- const routeMatched = matched[length - 1];
63
- const currentMatched = currentRoute.matched;
64
- if (!routeMatched || !currentMatched.length)
65
- return -1;
66
- const index = currentMatched.findIndex(isSameRouteRecord.bind(null, routeMatched));
67
- if (index > -1)
68
- return index;
69
- const parentRecordPath = getOriginalPath(matched[length - 2]);
70
- return (
71
- // we are dealing with nested routes
72
- length > 1 && // if the parent and matched route have the same path, this link is
73
- // referring to the empty child. Or we currently are on a different
74
- // child of the same parent
75
- getOriginalPath(routeMatched) === parentRecordPath && // avoid comparing the child with its parent
76
- currentMatched[currentMatched.length - 1].path !== parentRecordPath ? currentMatched.findIndex(isSameRouteRecord.bind(null, matched[length - 2])) : index
77
- );
78
- });
79
- const isActive = computed(() => activeRecordIndex.value > -1 && includesParams(currentRoute.params, route.value.params));
80
- const isExactActive = computed(() => activeRecordIndex.value > -1 && activeRecordIndex.value === currentRoute.matched.length - 1 && isSameRouteLocationParams(currentRoute.params, route.value.params));
81
- function navigate(e = {}) {
82
- if (guardEvent(e)) {
83
- return router[unref(props.replace) ? "replace" : "push"](
84
- unref(props.to)
85
- // avoid uncaught errors are they are logged anyway
86
- ).catch(noop);
87
- }
88
- return Promise.resolve();
89
- }
90
- if ((process.env.NODE_ENV !== "production" || false) && isBrowser) {
91
- const instance = getCurrentInstance();
92
- if (instance) {
93
- const linkContextDevtools = {
94
- route: route.value,
95
- isActive: isActive.value,
96
- isExactActive: isExactActive.value
97
- };
98
- instance.__vrl_devtools = instance.__vrl_devtools || [];
99
- instance.__vrl_devtools.push(linkContextDevtools);
100
- watchEffect(() => {
101
- linkContextDevtools.route = route.value;
102
- linkContextDevtools.isActive = isActive.value;
103
- linkContextDevtools.isExactActive = isExactActive.value;
104
- }, { flush: "post" });
105
- }
106
- }
107
- return {
108
- route,
109
- href: computed(() => route.value.href),
110
- isActive,
111
- isExactActive,
112
- navigate
113
- };
114
- }
115
- const RouterLinkImpl = /* @__PURE__ */ defineComponent({
116
- name: "RouterLink",
117
- compatConfig: { MODE: 3 },
118
- props: {
119
- to: {
120
- type: [String, Object],
121
- required: true
122
- },
123
- replace: Boolean,
124
- activeClass: String,
125
- // inactiveClass: String,
126
- exactActiveClass: String,
127
- custom: Boolean,
128
- ariaCurrentValue: {
129
- type: String,
130
- default: "page"
131
- }
132
- },
133
- useLink,
134
- setup(props, { slots }) {
135
- const link = reactive(useLink(props));
136
- const { options } = inject(routerKey);
137
- const elClass = computed(() => ({
138
- [getLinkClass(props.activeClass, options.linkActiveClass, "router-link-active")]: link.isActive,
139
- // [getLinkClass(
140
- // props.inactiveClass,
141
- // options.linkInactiveClass,
142
- // 'router-link-inactive'
143
- // )]: !link.isExactActive,
144
- [getLinkClass(props.exactActiveClass, options.linkExactActiveClass, "router-link-exact-active")]: link.isExactActive
145
- }));
146
- return () => {
147
- const children = slots.default && slots.default(link);
148
- return props.custom ? children : h("a", {
149
- "aria-current": link.isExactActive ? props.ariaCurrentValue : null,
150
- href: link.href,
151
- // this would override user added attrs but Vue will still add
152
- // the listener, so we end up triggering both
153
- onClick: link.navigate,
154
- class: elClass.value
155
- }, children);
156
- };
157
- }
158
- });
159
- const RouterLink = RouterLinkImpl;
160
- function guardEvent(e) {
161
- if (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)
162
- return;
163
- if (e.defaultPrevented)
164
- return;
165
- if (e.button !== void 0 && e.button !== 0)
166
- return;
167
- if (e.currentTarget && e.currentTarget.getAttribute) {
168
- const target = e.currentTarget.getAttribute("target");
169
- if (/\b_blank\b/i.test(target))
170
- return;
171
- }
172
- if (e.preventDefault)
173
- e.preventDefault();
174
- return true;
175
- }
176
- function includesParams(outer, inner) {
177
- for (const key in inner) {
178
- const innerValue = inner[key];
179
- const outerValue = outer[key];
180
- if (typeof innerValue === "string") {
181
- if (innerValue !== outerValue)
182
- return false;
183
- } else {
184
- if (!isArray(outerValue) || outerValue.length !== innerValue.length || innerValue.some((value, i) => value !== outerValue[i]))
185
- return false;
186
- }
187
- }
188
- return true;
189
- }
190
- function getOriginalPath(record) {
191
- return record ? record.aliasOf ? record.aliasOf.path : record.path : "";
192
- }
193
- const getLinkClass = (propClass, globalClass, defaultClass) => propClass != null ? propClass : globalClass != null ? globalClass : defaultClass;
194
6
  const BUTTON_TYPES = {
195
7
  PRIMARY: "primary",
196
8
  SECONDARY: "secondary",
@@ -1,8 +1,8 @@
1
1
  import PAlert from "./p-alert.js";
2
2
  import PCloseBtn from "./p-close-btn.js";
3
- import { defineComponent, resolveComponent, openBlock, createBlock, Teleport, createVNode, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, vShow, renderSlot, createCommentVNode, createElementBlock, toDisplayString } from "vue";
3
+ import { defineComponent, useCssVars, resolveComponent, openBlock, createBlock, Teleport, createVNode, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, vShow, renderSlot, createCommentVNode, createElementBlock, toDisplayString } from "vue";
4
4
  import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
5
- const _sfc_main = defineComponent({
5
+ const __default__ = defineComponent({
6
6
  name: "PDrawer",
7
7
  components: {
8
8
  PAlert,
@@ -68,6 +68,13 @@ const _sfc_main = defineComponent({
68
68
  enableClose: {
69
69
  type: Boolean,
70
70
  default: true
71
+ },
72
+ width: {
73
+ type: String,
74
+ default: "460px",
75
+ validator: (value) => {
76
+ return !!value.match(/^[0-9]+px$/);
77
+ }
71
78
  }
72
79
  },
73
80
  emits: ["update:modelValue", "before-open", "opening", "opened", "before-close", "closing", "closed"],
@@ -84,6 +91,9 @@ const _sfc_main = defineComponent({
84
91
  },
85
92
  transitionOutClass() {
86
93
  return this.outClass || this.position === "right" ? "slideOutRight" : "slideOutLeft";
94
+ },
95
+ animationDuration() {
96
+ return (parseInt(this.width, 10) / 1200).toFixed(2) + "s";
87
97
  }
88
98
  },
89
99
  created() {
@@ -139,6 +149,17 @@ const _sfc_main = defineComponent({
139
149
  }
140
150
  }
141
151
  });
152
+ const __injectCSSVars__ = () => {
153
+ useCssVars((_ctx) => ({
154
+ "4c0aead4": _ctx.width,
155
+ "59cfae08": _ctx.animationDuration
156
+ }));
157
+ };
158
+ const __setup__ = __default__.setup;
159
+ __default__.setup = __setup__ ? (props, ctx) => {
160
+ __injectCSSVars__();
161
+ return __setup__(props, ctx);
162
+ } : __injectCSSVars__;
142
163
  const _hoisted_1 = ["data-drawer-id", "aria-label", "aria-describedby", "aria-labelledby"];
143
164
  const _hoisted_2 = ["id"];
144
165
  const _hoisted_3 = {
@@ -212,7 +233,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
212
233
  _ctx.title ? (openBlock(), createElementBlock("h3", {
213
234
  key: 0,
214
235
  id: `${_ctx.id}-title`,
215
- class: normalizeClass(["flex-1 text-xl font-medium", { "text-right": _ctx.position === "left" }])
236
+ class: normalizeClass(["flex-1 text-xl font-medium leading-8", { "text-right": _ctx.position === "left" }])
216
237
  }, toDisplayString(_ctx.title), 11, _hoisted_2)) : createCommentVNode("", true)
217
238
  ], true)
218
239
  ], 2)
@@ -248,7 +269,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
248
269
  }, 8, ["enter-active-class", "leave-active-class", "onBeforeEnter", "onEnter", "onAfterEnter", "onBeforeLeave", "onLeave", "onAfterLeave"])
249
270
  ], 8, ["to"])) : createCommentVNode("", true);
250
271
  }
251
- const pDrawer = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a0b8be1e"]]);
272
+ const pDrawer = /* @__PURE__ */ _export_sfc(__default__, [["render", _sfc_render], ["__scopeId", "data-v-f474eec2"]]);
252
273
  export {
253
274
  pDrawer as default
254
275
  };
@@ -59,6 +59,11 @@ declare const _default: import("vue").DefineComponent<{
59
59
  type: BooleanConstructor;
60
60
  default: boolean;
61
61
  };
62
+ width: {
63
+ type: StringConstructor;
64
+ default: string;
65
+ validator: (value: string) => boolean;
66
+ };
62
67
  }, unknown, {
63
68
  id: string | null;
64
69
  show: boolean;
@@ -66,6 +71,7 @@ declare const _default: import("vue").DefineComponent<{
66
71
  }, {
67
72
  transitionInClass(): "slideInRight" | "slideInLeft";
68
73
  transitionOutClass(): "slideOutRight" | "slideOutLeft";
74
+ animationDuration(): string;
69
75
  }, {
70
76
  close(): void;
71
77
  beforeOpen(): void;
@@ -135,6 +141,11 @@ declare const _default: import("vue").DefineComponent<{
135
141
  type: BooleanConstructor;
136
142
  default: boolean;
137
143
  };
144
+ width: {
145
+ type: StringConstructor;
146
+ default: string;
147
+ validator: (value: string) => boolean;
148
+ };
138
149
  }>> & {
139
150
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
140
151
  "onBefore-open"?: ((...args: any[]) => any) | undefined;
@@ -145,6 +156,7 @@ declare const _default: import("vue").DefineComponent<{
145
156
  onClosed?: ((...args: any[]) => any) | undefined;
146
157
  }, {
147
158
  zIndex: number;
159
+ width: string;
148
160
  title: string;
149
161
  disabled: boolean;
150
162
  position: string;
package/dist/style.css CHANGED
@@ -9,7 +9,7 @@
9
9
  .bg-cross[data-v-cb511035] {
10
10
  background-image: url("data:image/svg+xml,%3csvg%20width='6'%20height='6'%20viewBox='0%200%206%206'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_2511_8629)'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M3%203.51667L5.42083%205.9375L5.9375%205.42083L3.51667%203L5.9375%200.57917L5.42083%200.0625L3%202.48333L0.57917%200.0625L0.0625%200.57917L2.48333%203L0.0625%205.42083L0.57917%205.9375L3%203.51667Z'%20fill='%231A123B'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='clip0_2511_8629'%3e%3crect%20width='6'%20height='6'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e");
11
11
  }
12
- .drawer[data-v-a0b8be1e] {
12
+ .drawer[data-v-f474eec2] {
13
13
  position: fixed;
14
14
  bottom: 0px;
15
15
  top: 0px;
@@ -21,17 +21,18 @@
21
21
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
22
22
  outline: 2px solid transparent;
23
23
  outline-offset: 2px;
24
- width: 460px;
24
+ max-width: var(--4c0aead4);
25
+ width: 100%;
25
26
  }
26
- .drawer.drawer-left[data-v-a0b8be1e] {
27
+ .drawer.drawer-left[data-v-f474eec2] {
27
28
  left: 0px;
28
29
  }
29
- .drawer.drawer-right[data-v-a0b8be1e] {
30
+ .drawer.drawer-right[data-v-f474eec2] {
30
31
  right: 0px;
31
32
  }
32
33
 
33
34
  /* Slide from right animations */
34
- @keyframes slideInRight-a0b8be1e {
35
+ @keyframes slideInRight-f474eec2 {
35
36
  0% {
36
37
  transform: translate3d(100%, 0, 0);
37
38
  visibility: visible;
@@ -40,12 +41,12 @@
40
41
  transform: translate3d(0, 0, 0);
41
42
  }
42
43
  }
43
- .slideInRight[data-v-a0b8be1e] {
44
- animation-duration: 0.4s;
44
+ .slideInRight[data-v-f474eec2] {
45
+ animation-duration: var(--59cfae08);
45
46
  animation-fill-mode: both;
46
- animation-name: slideInRight-a0b8be1e;
47
+ animation-name: slideInRight-f474eec2;
47
48
  }
48
- @keyframes slideOutRight-a0b8be1e {
49
+ @keyframes slideOutRight-f474eec2 {
49
50
  0% {
50
51
  transform: translate3d(0, 0, 0);
51
52
  }
@@ -54,14 +55,14 @@
54
55
  transform: translate3d(100%, 0, 0);
55
56
  }
56
57
  }
57
- .slideOutRight[data-v-a0b8be1e] {
58
- animation-duration: 0.4s;
58
+ .slideOutRight[data-v-f474eec2] {
59
+ animation-duration: var(--59cfae08);
59
60
  animation-fill-mode: both;
60
- animation-name: slideOutRight-a0b8be1e;
61
+ animation-name: slideOutRight-f474eec2;
61
62
  }
62
63
 
63
64
  /* Slide from left animations */
64
- @keyframes slideInLeft-a0b8be1e {
65
+ @keyframes slideInLeft-f474eec2 {
65
66
  0% {
66
67
  transform: translate3d(-100%, 0, 0);
67
68
  visibility: visible;
@@ -70,12 +71,12 @@
70
71
  transform: translate3d(0, 0, 0);
71
72
  }
72
73
  }
73
- .slideInLeft[data-v-a0b8be1e] {
74
- animation-duration: 0.4s;
74
+ .slideInLeft[data-v-f474eec2] {
75
+ animation-duration: var(--59cfae08);
75
76
  animation-fill-mode: both;
76
- animation-name: slideInLeft-a0b8be1e;
77
+ animation-name: slideInLeft-f474eec2;
77
78
  }
78
- @keyframes slideOutLeft-a0b8be1e {
79
+ @keyframes slideOutLeft-f474eec2 {
79
80
  0% {
80
81
  transform: translate3d(0, 0, 0);
81
82
  }
@@ -84,24 +85,25 @@
84
85
  transform: translate3d(-100%, 0, 0);
85
86
  }
86
87
  }
87
- .slideOutLeft[data-v-a0b8be1e] {
88
- animation-duration: 0.4s;
88
+ .slideOutLeft[data-v-f474eec2] {
89
+ animation-duration: var(--59cfae08);
89
90
  animation-fill-mode: both;
90
- animation-name: slideOutLeft-a0b8be1e;
91
+ animation-name: slideOutLeft-f474eec2;
91
92
  }
92
93
 
93
94
  /* Backdrop */
94
- .fadeIn[data-v-a0b8be1e] {
95
- animation-duration: 0.4s;
96
- animation-name: fadeInFrames-a0b8be1e;
97
- animation-fill-mode: both;
95
+ .fadeIn[data-v-f474eec2] {
96
+ animation-name: fadeInFrames-f474eec2;
98
97
  }
99
- .fadeOut[data-v-a0b8be1e] {
100
- animation-duration: 0.2s;
101
- animation-name: fadeOutFrames-a0b8be1e;
98
+ .fadeOut[data-v-f474eec2] {
99
+ animation-name: fadeOutFrames-f474eec2;
100
+ }
101
+ .fadeIn[data-v-f474eec2],
102
+ .fadeOut[data-v-f474eec2] {
103
+ animation-duration: 0.25s;
102
104
  animation-fill-mode: both;
103
105
  }
104
- @keyframes fadeInFrames-a0b8be1e {
106
+ @keyframes fadeInFrames-f474eec2 {
105
107
  from {
106
108
  opacity: 0;
107
109
  animation-timing-function: cubic-bezier(0, 0, 1, 1);
@@ -110,7 +112,7 @@ to {
110
112
  opacity: 1;
111
113
  }
112
114
  }
113
- @keyframes fadeOutFrames-a0b8be1e {
115
+ @keyframes fadeOutFrames-f474eec2 {
114
116
  from {
115
117
  opacity: 1;
116
118
  animation-timing-function: cubic-bezier(0.33, 0, 0.67, 1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pequity/squirrel",
3
3
  "description": "Squirrel component library",
4
- "version": "1.0.22",
4
+ "version": "1.0.24",
5
5
  "packageManager": "pnpm@8.9.2",
6
6
  "type": "module",
7
7
  "scripts": {
@@ -39,13 +39,14 @@
39
39
  "module": "./dist/es/index.js",
40
40
  "dependencies": {
41
41
  "@popperjs/core": "2.11.8",
42
- "@tanstack/vue-virtual": "3.2.0",
42
+ "@tanstack/vue-virtual": "3.3.0",
43
43
  "dayjs": "1.11.10",
44
44
  "floating-vue": "5.2.2",
45
45
  "lodash-es": "4.17.21",
46
46
  "v-calendar": "3.1.2",
47
- "vue": "3.4.21",
47
+ "vue": "3.4.23",
48
48
  "vue-currency-input": "3.1.0",
49
+ "vue-router": "4.3.0",
49
50
  "vue-toastification": "2.0.0-rc.5"
50
51
  },
51
52
  "peerDependencies": {
@@ -57,35 +58,36 @@
57
58
  "v-calendar": "^3.1.2",
58
59
  "vue": "^3.4.21",
59
60
  "vue-currency-input": "^3.1.0",
61
+ "vue-router": "^4.3.0",
60
62
  "vue-toastification": "^2.0.0-rc.5"
61
63
  },
62
64
  "devDependencies": {
63
65
  "@babel/core": "^7.24.4",
64
66
  "@babel/preset-env": "^7.24.4",
65
- "@commitlint/cli": "^19.2.1",
66
- "@commitlint/config-conventional": "^19.1.0",
67
+ "@commitlint/cli": "^19.2.2",
68
+ "@commitlint/config-conventional": "^19.2.2",
67
69
  "@pequity/eslint-config": "^0.0.12",
68
70
  "@semantic-release/changelog": "^6.0.3",
69
71
  "@semantic-release/git": "^10.0.1",
70
- "@storybook/addon-a11y": "^8.0.6",
71
- "@storybook/addon-actions": "^8.0.6",
72
- "@storybook/addon-essentials": "^8.0.6",
73
- "@storybook/addon-interactions": "^8.0.6",
74
- "@storybook/addon-links": "^8.0.6",
75
- "@storybook/blocks": "^8.0.6",
72
+ "@storybook/addon-a11y": "^8.0.8",
73
+ "@storybook/addon-actions": "^8.0.8",
74
+ "@storybook/addon-essentials": "^8.0.8",
75
+ "@storybook/addon-interactions": "^8.0.8",
76
+ "@storybook/addon-links": "^8.0.8",
77
+ "@storybook/blocks": "^8.0.8",
76
78
  "@storybook/jest": "^0.2.3",
77
- "@storybook/manager-api": "^8.0.6",
79
+ "@storybook/manager-api": "^8.0.8",
78
80
  "@storybook/test-runner": "^0.17.0",
79
81
  "@storybook/testing-library": "^0.2.2",
80
- "@storybook/theming": "^8.0.6",
81
- "@storybook/vue3": "^8.0.6",
82
- "@storybook/vue3-vite": "^8.0.6",
82
+ "@storybook/theming": "^8.0.8",
83
+ "@storybook/vue3": "^8.0.8",
84
+ "@storybook/vue3-vite": "^8.0.8",
83
85
  "@types/jest": "^29.5.12",
84
86
  "@types/jsdom": "^21.1.6",
85
87
  "@types/lodash-es": "^4.17.12",
86
- "@types/node": "^20.12.6",
88
+ "@types/node": "^20.12.7",
87
89
  "@vitejs/plugin-vue": "^5.0.4",
88
- "@vue/compiler-sfc": "3.4.21",
90
+ "@vue/compiler-sfc": "3.4.23",
89
91
  "@vue/test-utils": "^2.4.5",
90
92
  "@vue/vue3-jest": "^29.2.6",
91
93
  "autoprefixer": "^10.4.19",
@@ -100,18 +102,18 @@
100
102
  "make-coverage-badge": "^1.2.0",
101
103
  "postcss": "^8.4.38",
102
104
  "prettier": "^3.2.5",
103
- "prettier-plugin-tailwindcss": "^0.5.13",
105
+ "prettier-plugin-tailwindcss": "^0.5.14",
104
106
  "resolve-tspaths": "^0.8.18",
105
107
  "rimraf": "^5.0.5",
106
- "sass": "^1.74.1",
107
- "semantic-release": "^23.0.7",
108
- "storybook": "^8.0.6",
108
+ "sass": "^1.75.0",
109
+ "semantic-release": "^23.0.8",
110
+ "storybook": "^8.0.8",
109
111
  "svgo": "^3.2.0",
110
112
  "tailwindcss": "^3.4.3",
111
113
  "ts-jest": "^29.1.2",
112
- "typescript": "5.4.4",
113
- "vite": "^5.2.8",
114
+ "typescript": "5.4.5",
115
+ "vite": "^5.2.9",
114
116
  "vue-router": "^4.3.0",
115
- "vue-tsc": "2.0.7"
117
+ "vue-tsc": "2.0.13"
116
118
  }
117
119
  }
@@ -44,7 +44,7 @@
44
44
  <h3
45
45
  v-if="title"
46
46
  :id="`${id}-title`"
47
- class="flex-1 text-xl font-medium"
47
+ class="flex-1 text-xl font-medium leading-8"
48
48
  :class="{ 'text-right': position === 'left' }"
49
49
  >
50
50
  {{ title }}
@@ -151,6 +151,13 @@ export default defineComponent({
151
151
  type: Boolean,
152
152
  default: true,
153
153
  },
154
+ width: {
155
+ type: String,
156
+ default: '460px',
157
+ validator: (value: string) => {
158
+ return !!value.match(/^[0-9]+px$/);
159
+ },
160
+ },
154
161
  },
155
162
  emits: ['update:modelValue', 'before-open', 'opening', 'opened', 'before-close', 'closing', 'closed'],
156
163
  data() {
@@ -167,6 +174,9 @@ export default defineComponent({
167
174
  transitionOutClass() {
168
175
  return this.outClass || this.position === 'right' ? 'slideOutRight' : 'slideOutLeft';
169
176
  },
177
+ animationDuration() {
178
+ return (parseInt(this.width, 10) / 1200).toFixed(2) + 's';
179
+ },
170
180
  },
171
181
  created() {
172
182
  if (this.live) {
@@ -227,7 +237,8 @@ export default defineComponent({
227
237
  <style scoped lang="scss">
228
238
  .drawer {
229
239
  @apply fixed bottom-0 top-0 flex flex-col bg-surface shadow-lg outline-none;
230
- width: 460px;
240
+ max-width: v-bind('width');
241
+ width: 100%;
231
242
  }
232
243
  .drawer.drawer-left {
233
244
  @apply left-0;
@@ -247,7 +258,7 @@ export default defineComponent({
247
258
  }
248
259
  }
249
260
  .slideInRight {
250
- animation-duration: 0.4s;
261
+ animation-duration: v-bind('animationDuration');
251
262
  animation-fill-mode: both;
252
263
  animation-name: slideInRight;
253
264
  }
@@ -262,7 +273,7 @@ export default defineComponent({
262
273
  }
263
274
  }
264
275
  .slideOutRight {
265
- animation-duration: 0.4s;
276
+ animation-duration: v-bind('animationDuration');
266
277
  animation-fill-mode: both;
267
278
  animation-name: slideOutRight;
268
279
  }
@@ -278,7 +289,7 @@ export default defineComponent({
278
289
  }
279
290
  }
280
291
  .slideInLeft {
281
- animation-duration: 0.4s;
292
+ animation-duration: v-bind('animationDuration');
282
293
  animation-fill-mode: both;
283
294
  animation-name: slideInLeft;
284
295
  }
@@ -293,21 +304,23 @@ export default defineComponent({
293
304
  }
294
305
  }
295
306
  .slideOutLeft {
296
- animation-duration: 0.4s;
307
+ animation-duration: v-bind('animationDuration');
297
308
  animation-fill-mode: both;
298
309
  animation-name: slideOutLeft;
299
310
  }
300
311
 
301
312
  /* Backdrop */
302
313
  .fadeIn {
303
- animation-duration: 0.4s;
304
314
  animation-name: fadeInFrames;
305
- animation-fill-mode: both;
306
315
  }
307
316
 
308
317
  .fadeOut {
309
- animation-duration: 0.2s;
310
318
  animation-name: fadeOutFrames;
319
+ }
320
+
321
+ .fadeIn,
322
+ .fadeOut {
323
+ animation-duration: 0.25s;
311
324
  animation-fill-mode: both;
312
325
  }
313
326