@ulu/frontend-vue 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/elements/UluCard.vue.d.ts +2 -0
- package/dist/components/elements/UluCard.vue.d.ts.map +1 -1
- package/dist/components/elements/UluCard.vue.js +76 -68
- package/dist/components/utils/UluPlaceholderImage.vue.d.ts +1 -1
- package/dist/components/utils/UluPlaceholderImage.vue.js +10 -9
- package/dist/utils/props.d.ts +8 -0
- package/dist/utils/props.d.ts.map +1 -1
- package/dist/utils/props.js +6 -2
- package/lib/components/elements/UluCard.vue +32 -4
- package/lib/components/utils/UluPlaceholderImage.vue +2 -1
- package/lib/utils/props.js +13 -0
- package/package.json +1 -1
|
@@ -22,6 +22,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
22
22
|
titleTo?: string | Record<string, any> | undefined;
|
|
23
23
|
titleHref?: string | undefined;
|
|
24
24
|
titleTarget?: string | undefined;
|
|
25
|
+
image?: string | Record<string, any> | undefined;
|
|
25
26
|
imageSrc?: string | undefined;
|
|
26
27
|
imageAlt?: string | undefined;
|
|
27
28
|
$props: {
|
|
@@ -42,6 +43,7 @@ declare const __VLS_component: import('vue').DefineComponent<{}, {
|
|
|
42
43
|
readonly titleTo?: string | Record<string, any> | undefined;
|
|
43
44
|
readonly titleHref?: string | undefined;
|
|
44
45
|
readonly titleTarget?: string | undefined;
|
|
46
|
+
readonly image?: string | Record<string, any> | undefined;
|
|
45
47
|
readonly imageSrc?: string | undefined;
|
|
46
48
|
readonly imageAlt?: string | undefined;
|
|
47
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UluCard.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluCard.vue"],"names":[],"mappings":"AA+EA;
|
|
1
|
+
{"version":3,"file":"UluCard.vue.d.ts","sourceRoot":"","sources":["../../../lib/components/elements/UluCard.vue"],"names":[],"mappings":"AA+EA;wBAitBqB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;;6BAEtE,CAAC,EAAE,CAAC;;;AAbjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAUG"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { useSlots as
|
|
2
|
-
import { RouterLink as
|
|
3
|
-
import { useModifiers as
|
|
4
|
-
import { refToElement as
|
|
5
|
-
|
|
1
|
+
import { useSlots as R, computed as r, ref as f, createBlock as k, openBlock as a, resolveDynamicComponent as z, normalizeStyle as V, normalizeClass as h, unref as n, withCtx as S, createElementVNode as $, createElementBlock as m, createCommentVNode as g, renderSlot as i, createTextVNode as C, toDisplayString as x, createVNode as I, normalizeProps as q, guardReactiveProps as L } from "vue";
|
|
2
|
+
import { RouterLink as B } from "vue-router";
|
|
3
|
+
import { useModifiers as F } from "../../composables/useModifiers.js";
|
|
4
|
+
import { refToElement as G } from "../../utils/dom.js";
|
|
5
|
+
import { warnDeprecatedProp as O } from "../../utils/props.js";
|
|
6
|
+
import J from "./UluImage.vue.js";
|
|
7
|
+
const K = { class: "card__body" }, Q = { class: "card__main" }, W = ["href", "target"], X = {
|
|
6
8
|
key: 0,
|
|
7
9
|
class: "card__aside"
|
|
8
|
-
},
|
|
10
|
+
}, Y = {
|
|
9
11
|
key: 1,
|
|
10
12
|
class: "card__footer"
|
|
11
|
-
},
|
|
13
|
+
}, oe = {
|
|
12
14
|
__name: "UluCard",
|
|
13
15
|
props: {
|
|
14
16
|
/**
|
|
@@ -82,11 +84,17 @@ const q = { class: "card__body" }, L = { class: "card__main" }, F = ["href", "ta
|
|
|
82
84
|
default: () => ({})
|
|
83
85
|
},
|
|
84
86
|
/**
|
|
85
|
-
*
|
|
87
|
+
* Unified image prop configuration passed to UluImage. Can be a string (src) or an object matching UluImage props.
|
|
88
|
+
*/
|
|
89
|
+
image: [String, Object],
|
|
90
|
+
/**
|
|
91
|
+
* This is deprecated and will be removed in future version use "image" prop or image slot
|
|
92
|
+
* @deprecated Use `image` instead.
|
|
86
93
|
*/
|
|
87
94
|
imageSrc: String,
|
|
88
95
|
/**
|
|
89
|
-
*
|
|
96
|
+
* This is deprecated and will be removed in future version use "image" prop or image slot
|
|
97
|
+
* @deprecated Use `image` (as an object with `alt`) instead.
|
|
90
98
|
*/
|
|
91
99
|
imageAlt: String,
|
|
92
100
|
/**
|
|
@@ -112,118 +120,118 @@ const q = { class: "card__body" }, L = { class: "card__main" }, F = ["href", "ta
|
|
|
112
120
|
modifiers: [Array, String]
|
|
113
121
|
},
|
|
114
122
|
emits: ["proxy-click"],
|
|
115
|
-
setup(
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
const
|
|
123
|
+
setup(t, { emit: p }) {
|
|
124
|
+
const e = t, H = p, s = R();
|
|
125
|
+
e.proxyClick && (e.to || e.href) && console.warn("UluCard: 'proxyClick' is ignored when 'to' or 'href' are present."), (e.titleTo || e.titleHref) && (e.to || e.href) && console.warn("UluCard: 'titleTo'/'titleHref' should not be used with 'to'/'href'."), O("UluCard", e, "imageSrc", "image"), O("UluCard", e, "imageAlt", "image");
|
|
126
|
+
const b = r(() => e.image ? typeof e.image == "string" ? { src: e.image } : e.image : e.imageSrc ? {
|
|
127
|
+
src: e.imageSrc,
|
|
128
|
+
alt: e.imageAlt || ""
|
|
129
|
+
} : null), T = f(null), y = f(null), { resolvedModifiers: M } = F({ props: e, baseClass: "card" }), w = f(null), c = f(!1), u = r(() => e.proxyClick && !e.to && !e.href), E = r(() => u.value && (e.titleTo || e.titleHref)), U = r(() => u.value && !E.value), v = r(() => u.value || null), P = r(() => ({
|
|
119
130
|
selectorPrevent: "input, select, textarea, button, a, [tabindex='-1']",
|
|
120
131
|
mousedownDurationPrevent: 250,
|
|
121
|
-
...
|
|
122
|
-
})), j = r(() => u.value ? "pointer" : null), D = r(() =>
|
|
123
|
-
function
|
|
124
|
-
if (!
|
|
125
|
-
const { selectorPrevent: o } =
|
|
126
|
-
c.value = !1, l.closest(o) || (c.value = !0,
|
|
132
|
+
...e.proxyClickOptions
|
|
133
|
+
})), j = r(() => u.value ? "pointer" : null), D = r(() => e.to ? B : e.href ? "a" : e.cardElement);
|
|
134
|
+
function A({ target: l, timeStamp: d }) {
|
|
135
|
+
if (!v.value) return;
|
|
136
|
+
const { selectorPrevent: o } = P.value;
|
|
137
|
+
c.value = !1, l.closest(o) || (c.value = !0, w.value = d);
|
|
127
138
|
}
|
|
128
|
-
function
|
|
129
|
-
if (!
|
|
130
|
-
const { mousedownDurationPrevent: d } =
|
|
131
|
-
if (l -
|
|
132
|
-
if (
|
|
133
|
-
const o =
|
|
139
|
+
function N({ timeStamp: l }) {
|
|
140
|
+
if (!v.value || !c.value) return;
|
|
141
|
+
const { mousedownDurationPrevent: d } = P.value;
|
|
142
|
+
if (l - w.value < d) {
|
|
143
|
+
if (E.value) {
|
|
144
|
+
const o = G(y.value);
|
|
134
145
|
o ? o.click() : console.warn("Unable to resolve title link ref");
|
|
135
|
-
} else if (
|
|
146
|
+
} else if (U.value) {
|
|
136
147
|
const o = T.value?.querySelector("[data-ulu-card-proxy-target]");
|
|
137
|
-
o ? o.click() :
|
|
148
|
+
o ? o.click() : H("proxy-click");
|
|
138
149
|
}
|
|
139
150
|
}
|
|
140
151
|
c.value = !1;
|
|
141
152
|
}
|
|
142
|
-
return (l, d) => (a(), k(
|
|
153
|
+
return (l, d) => (a(), k(z(D.value), {
|
|
143
154
|
ref_key: "cardRoot",
|
|
144
155
|
ref: T,
|
|
145
156
|
class: h(["card", [
|
|
146
157
|
{
|
|
147
|
-
"card--horizontal":
|
|
148
|
-
"card--horizontal-center":
|
|
149
|
-
"card--overlay":
|
|
158
|
+
"card--horizontal": t.horizontal || t.horizontalCenter,
|
|
159
|
+
"card--horizontal-center": t.horizontalCenter,
|
|
160
|
+
"card--overlay": t.overlay
|
|
150
161
|
},
|
|
151
|
-
n(
|
|
162
|
+
n(M)
|
|
152
163
|
]]),
|
|
153
|
-
onMousedown:
|
|
154
|
-
onMouseup:
|
|
155
|
-
style:
|
|
156
|
-
target:
|
|
157
|
-
to:
|
|
158
|
-
href:
|
|
159
|
-
"data-ulu-proxy-click-init":
|
|
164
|
+
onMousedown: A,
|
|
165
|
+
onMouseup: N,
|
|
166
|
+
style: V({ cursor: j.value }),
|
|
167
|
+
target: t.target,
|
|
168
|
+
to: t.to,
|
|
169
|
+
href: t.href,
|
|
170
|
+
"data-ulu-proxy-click-init": v.value
|
|
160
171
|
}, {
|
|
161
172
|
default: S(() => [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
173
|
+
$("div", K, [
|
|
174
|
+
$("div", Q, [
|
|
175
|
+
t.title || n(s).title ? (a(), k(z(t.titleElement), {
|
|
165
176
|
key: 0,
|
|
166
|
-
class: h(["card__title",
|
|
177
|
+
class: h(["card__title", t.classes.title])
|
|
167
178
|
}, {
|
|
168
179
|
default: S(() => [
|
|
169
|
-
|
|
180
|
+
t.titleTo ? (a(), k(n(B), {
|
|
170
181
|
key: 0,
|
|
171
182
|
class: "card__title-link",
|
|
172
|
-
to:
|
|
183
|
+
to: t.titleTo,
|
|
173
184
|
ref_key: "link",
|
|
174
|
-
ref:
|
|
185
|
+
ref: y
|
|
175
186
|
}, {
|
|
176
187
|
default: S(() => [
|
|
177
188
|
i(l.$slots, "title", {}, () => [
|
|
178
|
-
x(
|
|
189
|
+
C(x(t.title), 1)
|
|
179
190
|
])
|
|
180
191
|
]),
|
|
181
192
|
_: 3
|
|
182
|
-
}, 8, ["to"])) :
|
|
193
|
+
}, 8, ["to"])) : t.titleHref ? (a(), m("a", {
|
|
183
194
|
key: 1,
|
|
184
195
|
class: "card__title-link",
|
|
185
|
-
href:
|
|
186
|
-
target:
|
|
196
|
+
href: t.titleHref,
|
|
197
|
+
target: t.titleTarget,
|
|
187
198
|
ref_key: "link",
|
|
188
|
-
ref:
|
|
199
|
+
ref: y
|
|
189
200
|
}, [
|
|
190
201
|
i(l.$slots, "title", {}, () => [
|
|
191
|
-
x(
|
|
202
|
+
C(x(t.title), 1)
|
|
192
203
|
])
|
|
193
|
-
], 8,
|
|
194
|
-
x(
|
|
204
|
+
], 8, W)) : i(l.$slots, "title", { key: 2 }, () => [
|
|
205
|
+
C(x(t.title), 1)
|
|
195
206
|
])
|
|
196
207
|
]),
|
|
197
208
|
_: 3
|
|
198
|
-
}, 8, ["class"])) :
|
|
209
|
+
}, 8, ["class"])) : g("", !0),
|
|
199
210
|
i(l.$slots, "body")
|
|
200
211
|
]),
|
|
201
|
-
n(s).aside ? (a(), m("div",
|
|
212
|
+
n(s).aside ? (a(), m("div", X, [
|
|
202
213
|
i(l.$slots, "aside")
|
|
203
|
-
])) :
|
|
214
|
+
])) : g("", !0)
|
|
204
215
|
]),
|
|
205
|
-
n(s).image ||
|
|
216
|
+
n(s).image || b.value ? (a(), m("div", {
|
|
206
217
|
key: 0,
|
|
207
218
|
class: h(["card__image", [
|
|
208
|
-
{ "card__image--icon":
|
|
209
|
-
|
|
219
|
+
{ "card__image--icon": t.imageIcon },
|
|
220
|
+
t.classes.image
|
|
210
221
|
]])
|
|
211
222
|
}, [
|
|
212
223
|
i(l.$slots, "image", {}, () => [
|
|
213
|
-
|
|
214
|
-
src: e.imageSrc,
|
|
215
|
-
alt: e.imageAlt
|
|
216
|
-
}, null, 8, J)
|
|
224
|
+
I(J, q(L(b.value)), null, 16)
|
|
217
225
|
])
|
|
218
|
-
], 2)) :
|
|
219
|
-
n(s).footer ? (a(), m("div",
|
|
226
|
+
], 2)) : g("", !0),
|
|
227
|
+
n(s).footer ? (a(), m("div", Y, [
|
|
220
228
|
i(l.$slots, "footer")
|
|
221
|
-
])) :
|
|
229
|
+
])) : g("", !0)
|
|
222
230
|
]),
|
|
223
231
|
_: 3
|
|
224
232
|
}, 40, ["class", "style", "target", "to", "href", "data-ulu-proxy-click-init"]));
|
|
225
233
|
}
|
|
226
234
|
};
|
|
227
235
|
export {
|
|
228
|
-
|
|
236
|
+
oe as default
|
|
229
237
|
};
|
|
@@ -11,6 +11,6 @@ declare const _default: import('vue').DefineComponent<{}, {
|
|
|
11
11
|
readonly alt?: string | undefined;
|
|
12
12
|
readonly imageId?: string | undefined;
|
|
13
13
|
};
|
|
14
|
-
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {},
|
|
14
|
+
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
15
15
|
export default _default;
|
|
16
16
|
//# sourceMappingURL=UluPlaceholderImage.vue.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { randomInt as
|
|
3
|
-
|
|
1
|
+
import { computed as o, createBlock as m, openBlock as d } from "vue";
|
|
2
|
+
import { randomInt as n } from "@ulu/utils/random.js";
|
|
3
|
+
import h from "../elements/UluImage.vue.js";
|
|
4
|
+
const g = {
|
|
4
5
|
__name: "UluPlaceholderImage",
|
|
5
6
|
props: {
|
|
6
7
|
imageId: String,
|
|
@@ -28,17 +29,17 @@ const s = ["src", "alt"], g = {
|
|
|
28
29
|
random: Boolean
|
|
29
30
|
},
|
|
30
31
|
setup(e) {
|
|
31
|
-
const t = e, a =
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
34
|
-
} : { width: t.width, height: t.height }), c =
|
|
32
|
+
const t = e, a = o(() => t.random ? {
|
|
33
|
+
width: n(500, 1e3),
|
|
34
|
+
height: n(500, 1e3)
|
|
35
|
+
} : { width: t.width, height: t.height }), c = o(() => {
|
|
35
36
|
const { width: r, height: i } = a.value;
|
|
36
37
|
return `https://picsum.photos/${t.imageId ? `id/${t.imageId}/` : ""}${r}/${i}`;
|
|
37
38
|
});
|
|
38
|
-
return (r, i) => (
|
|
39
|
+
return (r, i) => (d(), m(h, {
|
|
39
40
|
src: c.value,
|
|
40
41
|
alt: e.alt
|
|
41
|
-
}, null, 8,
|
|
42
|
+
}, null, 8, ["src", "alt"]));
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
export {
|
package/dist/utils/props.d.ts
CHANGED
|
@@ -4,4 +4,12 @@
|
|
|
4
4
|
* @returns {Boolean} Whether all are objects within
|
|
5
5
|
*/
|
|
6
6
|
export function isArrayOfObjects(array: any[]): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Logs a deprecation warning for a component prop in non-production environments.
|
|
9
|
+
* @param {String} componentName The name of the component using the deprecated prop.
|
|
10
|
+
* @param {Object} props The component's props object.
|
|
11
|
+
* @param {String} oldProp The name of the deprecated prop.
|
|
12
|
+
* @param {String} newProp The name of the new prop to use instead.
|
|
13
|
+
*/
|
|
14
|
+
export function warnDeprecatedProp(componentName: string, props: Object, oldProp: string, newProp: string): void;
|
|
7
15
|
//# sourceMappingURL=props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../lib/utils/props.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wDAEC"}
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../lib/utils/props.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wDAEC;AAED;;;;;;GAMG;AACH,iEAJW,MAAM,0CAQhB"}
|
package/dist/utils/props.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
function t(e) {
|
|
2
|
-
return e.every((
|
|
2
|
+
return e.every((n) => typeof n == "object");
|
|
3
|
+
}
|
|
4
|
+
function i(e, n, r, o) {
|
|
5
|
+
n[r] !== void 0 && typeof process < "u" && process.env.NODE_ENV !== "production" && console.warn(`[${e}]: Prop '${r}' is deprecated and will be removed in future, Use '${o}' instead`);
|
|
3
6
|
}
|
|
4
7
|
export {
|
|
5
|
-
t as isArrayOfObjects
|
|
8
|
+
t as isArrayOfObjects,
|
|
9
|
+
i as warnDeprecatedProp
|
|
6
10
|
};
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</div>
|
|
62
62
|
</div>
|
|
63
63
|
<div
|
|
64
|
-
v-if="$slots.image ||
|
|
64
|
+
v-if="$slots.image || resolvedImage"
|
|
65
65
|
class="card__image"
|
|
66
66
|
:class="[
|
|
67
67
|
{ 'card__image--icon' : imageIcon },
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
]"
|
|
70
70
|
>
|
|
71
71
|
<slot name="image">
|
|
72
|
-
<
|
|
72
|
+
<UluImage v-bind="resolvedImage" />
|
|
73
73
|
</slot>
|
|
74
74
|
</div>
|
|
75
75
|
<div class="card__footer" v-if="$slots.footer">
|
|
@@ -83,6 +83,8 @@
|
|
|
83
83
|
import { RouterLink } from "vue-router";
|
|
84
84
|
import { useModifiers } from "../../composables/useModifiers.js";
|
|
85
85
|
import { refToElement } from '../../utils/dom.js';
|
|
86
|
+
import { warnDeprecatedProp } from '../../utils/props.js';
|
|
87
|
+
import UluImage from './UluImage.vue';
|
|
86
88
|
|
|
87
89
|
const props = defineProps({
|
|
88
90
|
/**
|
|
@@ -156,11 +158,17 @@
|
|
|
156
158
|
default: () => ({})
|
|
157
159
|
},
|
|
158
160
|
/**
|
|
159
|
-
*
|
|
161
|
+
* Unified image prop configuration passed to UluImage. Can be a string (src) or an object matching UluImage props.
|
|
162
|
+
*/
|
|
163
|
+
image: [String, Object],
|
|
164
|
+
/**
|
|
165
|
+
* This is deprecated and will be removed in future version use "image" prop or image slot
|
|
166
|
+
* @deprecated Use `image` instead.
|
|
160
167
|
*/
|
|
161
168
|
imageSrc: String,
|
|
162
169
|
/**
|
|
163
|
-
*
|
|
170
|
+
* This is deprecated and will be removed in future version use "image" prop or image slot
|
|
171
|
+
* @deprecated Use `image` (as an object with `alt`) instead.
|
|
164
172
|
*/
|
|
165
173
|
imageAlt: String,
|
|
166
174
|
/**
|
|
@@ -197,6 +205,26 @@
|
|
|
197
205
|
console.warn("UluCard: 'titleTo'/'titleHref' should not be used with 'to'/'href'.");
|
|
198
206
|
}
|
|
199
207
|
|
|
208
|
+
// Deprecation Warnings
|
|
209
|
+
// - Note these should be removed in the next minor or maybe major release
|
|
210
|
+
warnDeprecatedProp('UluCard', props, 'imageSrc', 'image');
|
|
211
|
+
warnDeprecatedProp('UluCard', props, 'imageAlt', 'image');
|
|
212
|
+
|
|
213
|
+
const resolvedImage = computed(() => {
|
|
214
|
+
if (props.image) {
|
|
215
|
+
if (typeof props.image === 'string') {
|
|
216
|
+
return { src: props.image };
|
|
217
|
+
}
|
|
218
|
+
return props.image;
|
|
219
|
+
} else if (props.imageSrc) {
|
|
220
|
+
return {
|
|
221
|
+
src: props.imageSrc,
|
|
222
|
+
alt: props.imageAlt || ''
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
return null;
|
|
226
|
+
});
|
|
227
|
+
|
|
200
228
|
// --- Template refs
|
|
201
229
|
const cardRoot = ref(null);
|
|
202
230
|
const link = ref(null);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<UluImage :src="src" :alt="alt" />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { computed } from 'vue';
|
|
7
7
|
import { randomInt } from "@ulu/utils/random.js";
|
|
8
|
+
import UluImage from "../elements/UluImage.vue";
|
|
8
9
|
|
|
9
10
|
const props = defineProps({
|
|
10
11
|
imageId: String,
|
package/lib/utils/props.js
CHANGED
|
@@ -5,4 +5,17 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export function isArrayOfObjects(array) {
|
|
7
7
|
return array.every(item => typeof item === "object");
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Logs a deprecation warning for a component prop in non-production environments.
|
|
12
|
+
* @param {String} componentName The name of the component using the deprecated prop.
|
|
13
|
+
* @param {Object} props The component's props object.
|
|
14
|
+
* @param {String} oldProp The name of the deprecated prop.
|
|
15
|
+
* @param {String} newProp The name of the new prop to use instead.
|
|
16
|
+
*/
|
|
17
|
+
export function warnDeprecatedProp(componentName, props, oldProp, newProp) {
|
|
18
|
+
if (props[oldProp] !== undefined && typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
19
|
+
console.warn(`[${ componentName }]: Prop '${ oldProp }' is deprecated and will be removed in future, Use '${ newProp }' instead`);
|
|
20
|
+
}
|
|
8
21
|
}
|
package/package.json
CHANGED