@gurpinderjitsingh/recipe-ui 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-modal_7.cjs.entry.js +104 -13
- package/dist/cjs/app-toast.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/recipe-ui.cjs.js +1 -1
- package/dist/collection/components/app-toast/app-toast.js +1 -1
- package/dist/collection/components/recipe-card/recipe-card.js +1 -1
- package/dist/collection/components/recipe-filter-bar/recipe-filter-bar.js +1 -1
- package/dist/collection/components/recipe-form/recipe-form.css +139 -17
- package/dist/collection/components/recipe-form/recipe-form.js +158 -11
- package/dist/collection/components/recipe-rating/recipe-rating.js +1 -1
- package/dist/collection/components/recipe-search-bar/recipe-search-bar.js +1 -1
- package/dist/components/app-toast.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-vGdzhVB7.js → p-8_BMsNX-.js} +1 -1
- package/dist/components/{p-CWQoij-1.js → p-BUODh8vy.js} +1 -1
- package/dist/components/{p-Ckp6dPOc.js → p-CeTpiLnn.js} +1 -1
- package/dist/components/{p-CoCM6o6z.js → p-DnzGtyGi.js} +1 -1
- package/dist/components/p-HwvFQvUL.js +1 -0
- package/dist/components/{p-BIz6x-m7.js → p-Ux-pnuEm.js} +1 -1
- package/dist/components/recipe-card.js +1 -1
- package/dist/components/recipe-filter-bar.js +1 -1
- package/dist/components/recipe-form.js +1 -1
- package/dist/components/recipe-rating.js +1 -1
- package/dist/components/recipe-search-bar.js +1 -1
- package/dist/esm/app-modal_7.entry.js +104 -13
- package/dist/esm/app-toast.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/recipe-ui.js +1 -1
- package/dist/recipe-ui/p-5a28e09a.entry.js +1 -0
- package/dist/recipe-ui/{p-74151c7f.entry.js → p-8ed4bce8.entry.js} +1 -1
- package/dist/recipe-ui/recipe-ui.esm.js +1 -1
- package/dist/types/components/recipe-form/recipe-form.d.ts +14 -4
- package/dist/types/components.d.ts +26 -4
- package/package.json +1 -1
- package/dist/components/p-xcFZ4dcw.js +0 -1
- package/dist/recipe-ui/p-e912fdc5.entry.js +0 -1
|
@@ -19,7 +19,7 @@ const RecipeCard = class {
|
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
|
-
return (index.h("div", { key: '
|
|
22
|
+
return (index.h("div", { key: 'd84f83b5082a49a5a05b93678538bfcfecd92e47', class: "card", onClick: () => this.cardClick.emit() }, index.h("div", { key: 'a0e4f5fae6b7c14c750263f8de9bef9fbd8180a0', class: "image-wrap" }, this.image ? index.h("img", { src: this.image, alt: this.recipeTitle }) : index.h("div", { class: "placeholder" }), index.h("button", { key: '9266af379f6ebeb2624131e5c3f287d64cf4b3a5', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), index.h("div", { key: 'd0b5fa56b17c14763ecc6301864ef797565c6313', class: "body" }, index.h("h3", { key: '0c67db81d80a820cce2e6bfedd2df2611358d1e8' }, this.recipeTitle), this.category && index.h("span", { key: '30f89cf328a098be1c109d3e71b8f9f15827c6f1', class: "category" }, this.category), index.h("div", { key: '353b2663855e7ac53817d17acaf7b83908c17d85', class: "actions" }, index.h("slot", { key: '0a04fc5024751df45d744814f579100913dcd1fc', name: "actions" })))));
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
RecipeCard.style = recipeCardCss();
|
|
@@ -55,7 +55,7 @@ const RecipeSearchBar = class {
|
|
|
55
55
|
this.internalValue = newVal;
|
|
56
56
|
}
|
|
57
57
|
render() {
|
|
58
|
-
return (index.h("div", { key: '
|
|
58
|
+
return (index.h("div", { key: '00fa553cd92086a5cac70ca6b13792dfa41fc1dd', class: "wrap" }, index.h("input", { key: 'a116c51839c228d4daff54347e6b2d56c9dc2579', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), index.h("button", { key: 'e16a909061abd80889ad7b7646219a7428e4db4d', onClick: () => this.search.emit({ value: this.internalValue }), "aria-label": "Search" }, "\uD83D\uDD0D")));
|
|
59
59
|
}
|
|
60
60
|
static get watchers() { return {
|
|
61
61
|
"value": [{
|
|
@@ -79,7 +79,7 @@ const RecipeFilterBar = class {
|
|
|
79
79
|
}
|
|
80
80
|
render() {
|
|
81
81
|
const cats = Array.isArray(this.categories) ? this.categories : [];
|
|
82
|
-
return (index.h("div", { key: '
|
|
82
|
+
return (index.h("div", { key: '3088a84e81d49c06a12f93e491d4ae3e7022635f', class: "wrap" }, index.h("button", { key: '0e8b7455b1364eb76721d4f6c227a0803750c466', class: { chip: true, active: this.active === '' }, onClick: () => this.select('') }, "All"), cats.map((c) => (index.h("button", { class: { chip: true, active: this.active === c }, onClick: () => this.select(c) }, c)))));
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
RecipeFilterBar.style = recipeFilterBarCss();
|
|
@@ -96,13 +96,18 @@ const RecipeRating = class {
|
|
|
96
96
|
}
|
|
97
97
|
render() {
|
|
98
98
|
const stars = Array.from({ length: this.max }, (_, i) => i + 1);
|
|
99
|
-
return (index.h("div", { key: '
|
|
99
|
+
return (index.h("div", { key: '09bd2482d310e73993faea601d5ab86f20fc6fb7', class: "wrap", role: this.readonly ? undefined : 'radiogroup' }, stars.map((s) => (index.h("span", { class: { star: true, filled: s <= this.value, clickable: !this.readonly }, onClick: () => !this.readonly && this.ratingChange.emit({ value: s }) }, "\u2605")))));
|
|
100
100
|
}
|
|
101
101
|
};
|
|
102
102
|
RecipeRating.style = recipeRatingCss();
|
|
103
103
|
|
|
104
|
-
const recipeFormCss = () => `:host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}`;
|
|
104
|
+
const recipeFormCss = () => `:host{display:block;font-family:system-ui, sans-serif}form{display:flex;flex-direction:column;gap:14px}label{display:flex;flex-direction:column;gap:4px;font-size:13px;color:#333;font-weight:600}input,textarea,select{font-weight:400;padding:8px 10px;border:1px solid #ddd;border-radius:6px;font-size:14px;font-family:inherit;background:#fff;transition:border-color 0.15s ease, box-shadow 0.15s ease}input:focus,textarea:focus,select:focus{outline:none;border-color:#ff6b35;box-shadow:0 0 0 3px rgba(255, 107, 53, 0.14)}select{appearance:none;-webkit-appearance:none;-moz-appearance:none;padding-right:34px;cursor:pointer;color:#1f2937;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 10px center;background-size:14px}select:hover{border-color:#bbb}select:invalid,select option[value=""]{color:#9ca3af}.row{display:grid;grid-template-columns:1fr 1fr;gap:14px}@media (max-width: 480px){.row{grid-template-columns:1fr}}.field{display:flex;flex-direction:column;gap:6px;font-size:13px;font-weight:600}.ingredient-row{display:flex;gap:6px}.ingredient-row input{flex:1}.ingredient-row button{border:none;background:#f4f4f4;border-radius:6px;cursor:pointer;width:30px}.add-btn{align-self:flex-start;border:1px dashed #bbb;background:none;border-radius:6px;padding:6px 10px;cursor:pointer;font-size:13px;color:#555}.error{color:#e74c3c;font-size:12px;font-weight:400}.footer{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.cancel-btn{border:1px solid #ddd;background:#fff;border-radius:8px;padding:8px 16px;cursor:pointer}.save-btn{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:8px 18px;cursor:pointer;font-weight:600}`;
|
|
105
105
|
|
|
106
|
+
const DEFAULT_CATEGORIES = [
|
|
107
|
+
'Beef', 'Breakfast', 'Chicken', 'Dessert', 'Goat', 'Lamb',
|
|
108
|
+
'Miscellaneous', 'Pasta', 'Pork', 'Seafood', 'Side', 'Starter',
|
|
109
|
+
'Vegan', 'Vegetarian', 'Other',
|
|
110
|
+
];
|
|
106
111
|
const DEFAULT_AREAS = [
|
|
107
112
|
'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',
|
|
108
113
|
'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican',
|
|
@@ -115,12 +120,16 @@ const RecipeForm = class {
|
|
|
115
120
|
index.registerInstance(this, hostRef);
|
|
116
121
|
this.save = index.createEvent(this, "save");
|
|
117
122
|
this.cancel = index.createEvent(this, "cancel");
|
|
118
|
-
|
|
119
|
-
this.
|
|
123
|
+
this.categories = DEFAULT_CATEGORIES;
|
|
124
|
+
this.extraCategories = [];
|
|
125
|
+
this.areas = DEFAULT_AREAS;
|
|
126
|
+
this.extraAreas = [];
|
|
120
127
|
this.title = '';
|
|
121
128
|
this.image = '';
|
|
122
129
|
this.category = '';
|
|
123
|
-
this.
|
|
130
|
+
this.customCategory = '';
|
|
131
|
+
this.area = '';
|
|
132
|
+
this.customArea = '';
|
|
124
133
|
this.ingredients = [''];
|
|
125
134
|
this.instructions = '';
|
|
126
135
|
this.errors = {};
|
|
@@ -128,12 +137,14 @@ const RecipeForm = class {
|
|
|
128
137
|
e.preventDefault();
|
|
129
138
|
if (!this.validate())
|
|
130
139
|
return;
|
|
140
|
+
const resolvedCategory = this.category === 'Other' ? this.customCategory.trim() : this.category;
|
|
141
|
+
const resolvedArea = this.area === 'Other' ? this.customArea.trim() : this.area;
|
|
131
142
|
const data = {
|
|
132
143
|
id: this.initialData?.id,
|
|
133
144
|
title: this.title.trim(),
|
|
134
145
|
image: this.image.trim(),
|
|
135
|
-
category:
|
|
136
|
-
|
|
146
|
+
category: resolvedCategory,
|
|
147
|
+
area: resolvedArea,
|
|
137
148
|
ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
|
|
138
149
|
instructions: this.instructions.trim(),
|
|
139
150
|
};
|
|
@@ -144,6 +155,9 @@ const RecipeForm = class {
|
|
|
144
155
|
};
|
|
145
156
|
this.removeIngredient = (index) => {
|
|
146
157
|
this.ingredients = this.ingredients.filter((_, i) => i !== index);
|
|
158
|
+
const next = this.ingredients.filter((_, i) => i !== index);
|
|
159
|
+
this.ingredients = next;
|
|
160
|
+
this.clearErrorIf('ingredients', next.some((i) => i.trim()));
|
|
147
161
|
};
|
|
148
162
|
}
|
|
149
163
|
componentWillLoad() {
|
|
@@ -152,6 +166,31 @@ const RecipeForm = class {
|
|
|
152
166
|
onInitialDataChange() {
|
|
153
167
|
this.loadInitialData();
|
|
154
168
|
}
|
|
169
|
+
mergeList(base, extra) {
|
|
170
|
+
const withoutOther = base.filter((a) => a !== 'Other');
|
|
171
|
+
const merged = [...withoutOther];
|
|
172
|
+
for (const e of extra) {
|
|
173
|
+
if (e && !merged.includes(e))
|
|
174
|
+
merged.push(e);
|
|
175
|
+
}
|
|
176
|
+
merged.push('Other');
|
|
177
|
+
return merged;
|
|
178
|
+
}
|
|
179
|
+
get fullCategoryList() {
|
|
180
|
+
return this.mergeList(this.categories, this.extraCategories);
|
|
181
|
+
}
|
|
182
|
+
get fullAreaList() {
|
|
183
|
+
return this.mergeList(this.areas, this.extraAreas);
|
|
184
|
+
}
|
|
185
|
+
/** Removes a field's error as soon as it becomes valid, without waiting
|
|
186
|
+
* for the next full submit — called from each field's input handler. */
|
|
187
|
+
clearErrorIf(key, isNowValid) {
|
|
188
|
+
if (isNowValid && this.errors[key]) {
|
|
189
|
+
const next = { ...this.errors };
|
|
190
|
+
delete next[key];
|
|
191
|
+
this.errors = next;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
155
194
|
loadInitialData() {
|
|
156
195
|
let data;
|
|
157
196
|
if (typeof this.initialData === 'string' && this.initialData) {
|
|
@@ -168,10 +207,26 @@ const RecipeForm = class {
|
|
|
168
207
|
if (data) {
|
|
169
208
|
this.title = data.title ?? '';
|
|
170
209
|
this.image = data.image ?? '';
|
|
171
|
-
this.category = data.category ?? '';
|
|
172
|
-
this.cuisine = data.cuisine ?? '';
|
|
173
210
|
this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
|
|
174
211
|
this.instructions = data.instructions ?? '';
|
|
212
|
+
const knownCategories = this.fullCategoryList.filter((a) => a !== 'Other');
|
|
213
|
+
if (data.category && !knownCategories.includes(data.category)) {
|
|
214
|
+
this.category = 'Other';
|
|
215
|
+
this.customCategory = data.category;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
this.category = data.category ?? '';
|
|
219
|
+
this.customCategory = '';
|
|
220
|
+
}
|
|
221
|
+
const knownAreas = this.fullAreaList.filter((a) => a !== 'Other');
|
|
222
|
+
if (data.area && !knownAreas.includes(data.area)) {
|
|
223
|
+
this.area = 'Other';
|
|
224
|
+
this.customArea = data.area;
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
this.area = data.area ?? '';
|
|
228
|
+
this.customArea = '';
|
|
229
|
+
}
|
|
175
230
|
}
|
|
176
231
|
}
|
|
177
232
|
validate() {
|
|
@@ -183,6 +238,18 @@ const RecipeForm = class {
|
|
|
183
238
|
errors.ingredients = 'Add at least one ingredient.';
|
|
184
239
|
if (!this.instructions.trim())
|
|
185
240
|
errors.instructions = 'Instructions are required.';
|
|
241
|
+
if (!this.category.trim()) {
|
|
242
|
+
errors.category = 'Category is required.';
|
|
243
|
+
}
|
|
244
|
+
else if (this.category === 'Other' && !this.customCategory.trim()) {
|
|
245
|
+
errors.customCategory = 'Enter a category name.';
|
|
246
|
+
}
|
|
247
|
+
if (!this.area.trim()) {
|
|
248
|
+
errors.area = 'Cuisine / Area is required.';
|
|
249
|
+
}
|
|
250
|
+
else if (this.area === 'Other' && !this.customArea.trim()) {
|
|
251
|
+
errors.customArea = 'Enter a cuisine name.';
|
|
252
|
+
}
|
|
186
253
|
this.errors = errors;
|
|
187
254
|
return Object.keys(errors).length === 0;
|
|
188
255
|
}
|
|
@@ -190,9 +257,33 @@ const RecipeForm = class {
|
|
|
190
257
|
const next = [...this.ingredients];
|
|
191
258
|
next[index] = value;
|
|
192
259
|
this.ingredients = next;
|
|
260
|
+
this.clearErrorIf('ingredients', next.some((i) => i.trim()));
|
|
193
261
|
}
|
|
194
262
|
render() {
|
|
195
|
-
return (index.h("form", { key: '
|
|
263
|
+
return (index.h("form", { key: 'a6fd5f89975759b270bd41da834f364d11318033', onSubmit: this.onSubmit }, index.h("slot", { key: '263cc31f43b151d6c8c0a93d55adefd17a5ea293', name: "header" }), index.h("label", { key: '096dcfe6a821d4100f5a7988f4d993fb1808bb3e' }, "Title", index.h("input", { key: '36845960be21b66c2c0b54ae27203a6c778a1477', type: "text", value: this.title, onInput: (e) => {
|
|
264
|
+
(this.title = e.target.value);
|
|
265
|
+
this.clearErrorIf('title', !!this.title.trim());
|
|
266
|
+
} }), this.errors.title && index.h("span", { key: 'eea845094133a5372df59fd8e808c88c2c8d15d1', class: "error" }, this.errors.title)), index.h("label", { key: 'ac4aa2f034a22d255501e8de9c2f7ef2bd15cd58' }, "Image URL", index.h("input", { key: 'd9b1cc9221c842ec4390370e84ed7f7b5328c72f', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), index.h("div", { key: '2928e819a28ffa96bc3432804edd1c54e54aebdd', class: "row" }, index.h("label", { key: '57aca8b632ee87bdf546985ce23ee7ab3cd87a53' }, "Category", index.h("select", { key: '2b2e7d8bf2b6e01a6f1326cd99c60935b6584585', onInput: (e) => {
|
|
267
|
+
(this.category = e.target.value);
|
|
268
|
+
this.clearErrorIf('category', !!this.category);
|
|
269
|
+
if (this.category !== 'Other')
|
|
270
|
+
this.clearErrorIf('customCategory', true);
|
|
271
|
+
} }, index.h("option", { key: '40e6d1397afd47b58119f48290b2b2916b90958f', value: "", selected: this.category === '' }, "Select a category\u2026"), this.fullCategoryList.map((c) => (index.h("option", { value: c, selected: c === this.category }, c)))), this.errors.category && index.h("span", { key: 'd3633212048f29ac38cc7b10aedee51c7d5a0fe4', class: "error" }, this.errors.category)), index.h("label", { key: '04960f3ef4a8de34652f86d729838bafe2e1644e' }, "Cuisine / Area", index.h("select", { key: '4aeaedcebbc100d3166aa876bc2ea94ad9b2e74b', onInput: (e) => {
|
|
272
|
+
(this.area = e.target.value);
|
|
273
|
+
this.clearErrorIf('area', !!this.area);
|
|
274
|
+
if (this.area !== 'Other')
|
|
275
|
+
this.clearErrorIf('customArea', true);
|
|
276
|
+
} }, index.h("option", { key: '4945a5ee9b619807ca5e698fc82abb13b7437846', value: "", selected: this.area === '' }, "Select a cuisine\u2026"), this.fullAreaList.map((a) => (index.h("option", { value: a, selected: a === this.area }, a)))), this.errors.area && index.h("span", { key: '0e5f04ad9d214882e3d7e07b4d3f2ad9986f7c17', class: "error" }, this.errors.area))), (this.category === 'Other' || this.area === 'Other') && (index.h("div", { key: '92f8844bfd4dc85007746eb1d8679e06946922f3', class: "row" }, this.category === 'Other' && (index.h("label", { key: 'e8528349a8b9fa478b819d84f2f0b21ff87820b3', class: "custom-area-field" }, "Enter category name", index.h("input", { key: '9aae8f7a261f50ada7a79eeb553149b23d918e75', type: "text", placeholder: "e.g. Brunch", value: this.customCategory, onInput: (e) => {
|
|
277
|
+
(this.customCategory = e.target.value);
|
|
278
|
+
this.customCategory = e.target.value;
|
|
279
|
+
this.clearErrorIf('customCategory', !!this.customCategory.trim());
|
|
280
|
+
} }), this.errors.customCategory && index.h("span", { key: '9aa2a8ccd0a57816a7a0267e5e0f384d2cbf100f', class: "error" }, this.errors.customCategory))), this.area === 'Other' && (index.h("label", { key: '1d1f43fc855cf1b62e94b37032cdfe0b264c61f0', class: "custom-area-field" }, "Enter cuisine name", index.h("input", { key: '8a01e2c5c6168b2061ae95a3ae59611927e8776d', type: "text", placeholder: "e.g. Ethiopian", value: this.customArea, onInput: (e) => {
|
|
281
|
+
this.customArea = e.target.value;
|
|
282
|
+
this.clearErrorIf('customArea', !!this.customArea.trim());
|
|
283
|
+
} }), this.errors.customArea && index.h("span", { key: '0724a780a6c7f853dbf49aaa7c426abdf9dc763c', class: "error" }, this.errors.customArea))))), index.h("div", { key: '8eb6642721b9e82ef1e5e4becd0578248df9d6cc', class: "field" }, index.h("span", { key: 'b7bb449313eec9110c4dde9b63d3df682a7f4d31' }, "Ingredients"), this.ingredients.map((ing, i) => (index.h("div", { class: "ingredient-row" }, index.h("input", { type: "text", value: ing, onInput: (e) => this.updateIngredient(i, e.target.value) }), index.h("button", { type: "button", onClick: () => this.removeIngredient(i), "aria-label": "Remove" }, "\u2715")))), index.h("button", { key: '4de332018a519148d1fcb2fb32657bda5b706fe7', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && index.h("span", { key: 'fdddfe5ca60493295cdef4ecb17a17aa40684512', class: "error" }, this.errors.ingredients)), index.h("label", { key: 'af2b50576e4a53eeba69d4f19c9a6ea5e1e127c5' }, "Instructions", index.h("textarea", { key: '27e741c9f135c34e8418a596bbf6780a99ff9f95', rows: 5, onInput: (e) => {
|
|
284
|
+
this.instructions = e.target.value;
|
|
285
|
+
this.clearErrorIf('instructions', !!this.instructions.trim());
|
|
286
|
+
} }, this.instructions), this.errors.instructions && index.h("span", { key: 'db1cb5b3f667fcb3124a1bf418aac8910f5e53ab', class: "error" }, this.errors.instructions)), index.h("div", { key: '562a94f516173f714a2e5816498fc18de0e1476b', class: "footer" }, index.h("slot", { key: '3feeebb32283ef5d48652b532df4bfd939d1cafc', name: "footer" }), index.h("button", { key: 'a1f66c6c39989944b0445750c2d41602e10e60a9', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), index.h("button", { key: 'd420bf0d1d26319e53517de40df1339ffe68fadc', type: "submit", class: "save-btn" }, "Save Recipe"))));
|
|
196
287
|
}
|
|
197
288
|
static get watchers() { return {
|
|
198
289
|
"initialData": [{
|
|
@@ -18,7 +18,7 @@ const AppToast = class {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
return (index.h("div", { key: '
|
|
21
|
+
return (index.h("div", { key: '8b34f0098a8d17af8b9384ddf8838c8ad6eaf7f2', class: `toast ${this.type}` }, index.h("span", { key: '652ce04dad64022f77dbd0236ebfc1a0075ba121' }, this.message), index.h("button", { key: '760c2e84e1bf01c3b7a8c43addf983711453be3b', onClick: () => this.dismiss.emit(), "aria-label": "Dismiss" }, "\u2715")));
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
AppToast.style = appToastCss();
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
|
6
6
|
const defineCustomElements = async (win, options) => {
|
|
7
7
|
if (typeof window === 'undefined') return undefined;
|
|
8
8
|
await appGlobals.globalScripts();
|
|
9
|
-
return index.bootstrapLazy([["app-modal_7.cjs",[[257,"app-modal",{"open":[4],"modalTitle":[1,"modal-title"]}],[1,"meal-plan-day",{"day":[1],"meals":[16],"icon":[1]}],[257,"recipe-card",{"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"
|
|
9
|
+
return index.bootstrapLazy([["app-modal_7.cjs",[[257,"app-modal",{"open":[4],"modalTitle":[1,"modal-title"]}],[1,"meal-plan-day",{"day":[1],"meals":[16],"icon":[1]}],[257,"recipe-card",{"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"categories":[16],"extraCategories":[16],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[32],"customCategory":[32],"area":[32],"customArea":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast.cjs",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["app-modal_7.cjs",[[257,"app-modal",{"open":[4],"modalTitle":[1,"modal-title"]}],[1,"meal-plan-day",{"day":[1],"meals":[16],"icon":[1]}],[257,"recipe-card",{"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"
|
|
22
|
+
return index.bootstrapLazy([["app-modal_7.cjs",[[257,"app-modal",{"open":[4],"modalTitle":[1,"modal-title"]}],[1,"meal-plan-day",{"day":[1],"meals":[16],"icon":[1]}],[257,"recipe-card",{"recipeTitle":[1,"recipe-title"],"image":[1],"category":[1],"favorite":[4]}],[1,"recipe-filter-bar",{"categories":[16],"active":[1]}],[257,"recipe-form",{"initialData":[1,"initial-data"],"categories":[16],"extraCategories":[16],"areas":[16],"extraAreas":[16],"title":[32],"image":[32],"category":[32],"customCategory":[32],"area":[32],"customArea":[32],"ingredients":[32],"instructions":[32],"errors":[32]},null,{"initialData":[{"onInitialDataChange":0}]}],[1,"recipe-rating",{"value":[2],"readonly":[4],"max":[2]}],[1,"recipe-search-bar",{"placeholder":[1],"value":[1],"debounceMs":[2,"debounce-ms"],"internalValue":[32]},null,{"value":[{"onValuePropChange":0}]}]]],["app-toast.cjs",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -12,7 +12,7 @@ export class AppToast {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
render() {
|
|
15
|
-
return (h("div", { key: '
|
|
15
|
+
return (h("div", { key: '8b34f0098a8d17af8b9384ddf8838c8ad6eaf7f2', class: `toast ${this.type}` }, h("span", { key: '652ce04dad64022f77dbd0236ebfc1a0075ba121' }, this.message), h("button", { key: '760c2e84e1bf01c3b7a8c43addf983711453be3b', onClick: () => this.dismiss.emit(), "aria-label": "Dismiss" }, "\u2715")));
|
|
16
16
|
}
|
|
17
17
|
static get is() { return "app-toast"; }
|
|
18
18
|
static get encapsulation() { return "shadow"; }
|
|
@@ -17,7 +17,7 @@ export class RecipeCard {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
20
|
-
return (h("div", { key: '
|
|
20
|
+
return (h("div", { key: 'd84f83b5082a49a5a05b93678538bfcfecd92e47', class: "card", onClick: () => this.cardClick.emit() }, h("div", { key: 'a0e4f5fae6b7c14c750263f8de9bef9fbd8180a0', class: "image-wrap" }, this.image ? h("img", { src: this.image, alt: this.recipeTitle }) : h("div", { class: "placeholder" }), h("button", { key: '9266af379f6ebeb2624131e5c3f287d64cf4b3a5', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), h("div", { key: 'd0b5fa56b17c14763ecc6301864ef797565c6313', class: "body" }, h("h3", { key: '0c67db81d80a820cce2e6bfedd2df2611358d1e8' }, this.recipeTitle), this.category && h("span", { key: '30f89cf328a098be1c109d3e71b8f9f15827c6f1', class: "category" }, this.category), h("div", { key: '353b2663855e7ac53817d17acaf7b83908c17d85', class: "actions" }, h("slot", { key: '0a04fc5024751df45d744814f579100913dcd1fc', name: "actions" })))));
|
|
21
21
|
}
|
|
22
22
|
static get is() { return "recipe-card"; }
|
|
23
23
|
static get encapsulation() { return "shadow"; }
|
|
@@ -15,7 +15,7 @@ export class RecipeFilterBar {
|
|
|
15
15
|
}
|
|
16
16
|
render() {
|
|
17
17
|
const cats = Array.isArray(this.categories) ? this.categories : [];
|
|
18
|
-
return (h("div", { key: '
|
|
18
|
+
return (h("div", { key: '3088a84e81d49c06a12f93e491d4ae3e7022635f', class: "wrap" }, h("button", { key: '0e8b7455b1364eb76721d4f6c227a0803750c466', class: { chip: true, active: this.active === '' }, onClick: () => this.select('') }, "All"), cats.map((c) => (h("button", { class: { chip: true, active: this.active === c }, onClick: () => this.select(c) }, c)))));
|
|
19
19
|
}
|
|
20
20
|
static get is() { return "recipe-filter-bar"; }
|
|
21
21
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,19 +1,141 @@
|
|
|
1
|
-
:host {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
font-family: system-ui, sans-serif;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
form {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 14px;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
label {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 4px;
|
|
16
|
+
font-size: 13px;
|
|
17
|
+
color: #333;
|
|
18
|
+
font-weight: 600;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
input,
|
|
22
|
+
textarea,
|
|
23
|
+
select {
|
|
24
|
+
font-weight: 400;
|
|
25
|
+
padding: 8px 10px;
|
|
26
|
+
border: 1px solid #ddd;
|
|
27
|
+
border-radius: 6px;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
font-family: inherit;
|
|
30
|
+
background: #fff;
|
|
31
|
+
transition: border-color 0.15s ease, box-shadow 0.15s ease;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
input:focus,
|
|
35
|
+
textarea:focus,
|
|
36
|
+
select:focus {
|
|
37
|
+
outline: none;
|
|
38
|
+
border-color: #ff6b35;
|
|
39
|
+
box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.14);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
select {
|
|
43
|
+
appearance: none;
|
|
44
|
+
-webkit-appearance: none;
|
|
45
|
+
-moz-appearance: none;
|
|
46
|
+
padding-right: 34px;
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
color: #1f2937;
|
|
49
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
|
|
50
|
+
background-repeat: no-repeat;
|
|
51
|
+
background-position: right 10px center;
|
|
52
|
+
background-size: 14px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
select:hover {
|
|
56
|
+
border-color: #bbb;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
select:invalid,
|
|
60
|
+
select option[value=""] {
|
|
61
|
+
color: #9ca3af;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.row {
|
|
65
|
+
display: grid;
|
|
66
|
+
grid-template-columns: 1fr 1fr;
|
|
67
|
+
gap: 14px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@media (max-width: 480px) {
|
|
71
|
+
.row {
|
|
72
|
+
grid-template-columns: 1fr;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.field {
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: column;
|
|
79
|
+
gap: 6px;
|
|
80
|
+
font-size: 13px;
|
|
81
|
+
font-weight: 600;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ingredient-row {
|
|
85
|
+
display: flex;
|
|
86
|
+
gap: 6px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.ingredient-row input {
|
|
90
|
+
flex: 1;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.ingredient-row button {
|
|
94
|
+
border: none;
|
|
95
|
+
background: #f4f4f4;
|
|
96
|
+
border-radius: 6px;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
width: 30px;
|
|
99
|
+
}
|
|
100
|
+
|
|
12
101
|
.add-btn {
|
|
13
|
-
align-self: flex-start;
|
|
14
|
-
|
|
102
|
+
align-self: flex-start;
|
|
103
|
+
border: 1px dashed #bbb;
|
|
104
|
+
background: none;
|
|
105
|
+
border-radius: 6px;
|
|
106
|
+
padding: 6px 10px;
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
font-size: 13px;
|
|
109
|
+
color: #555;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.error {
|
|
113
|
+
color: #e74c3c;
|
|
114
|
+
font-size: 12px;
|
|
115
|
+
font-weight: 400;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.footer {
|
|
119
|
+
display: flex;
|
|
120
|
+
justify-content: flex-end;
|
|
121
|
+
gap: 10px;
|
|
122
|
+
margin-top: 6px;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.cancel-btn {
|
|
126
|
+
border: 1px solid #ddd;
|
|
127
|
+
background: #fff;
|
|
128
|
+
border-radius: 8px;
|
|
129
|
+
padding: 8px 16px;
|
|
130
|
+
cursor: pointer;
|
|
15
131
|
}
|
|
16
|
-
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
132
|
+
|
|
133
|
+
.save-btn {
|
|
134
|
+
border: none;
|
|
135
|
+
background: #ff6b35;
|
|
136
|
+
color: #fff;
|
|
137
|
+
border-radius: 8px;
|
|
138
|
+
padding: 8px 18px;
|
|
139
|
+
cursor: pointer;
|
|
140
|
+
font-weight: 600;
|
|
141
|
+
}
|