@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.
Files changed (36) hide show
  1. package/dist/cjs/app-modal_7.cjs.entry.js +104 -13
  2. package/dist/cjs/app-toast.cjs.entry.js +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/recipe-ui.cjs.js +1 -1
  5. package/dist/collection/components/app-toast/app-toast.js +1 -1
  6. package/dist/collection/components/recipe-card/recipe-card.js +1 -1
  7. package/dist/collection/components/recipe-filter-bar/recipe-filter-bar.js +1 -1
  8. package/dist/collection/components/recipe-form/recipe-form.css +139 -17
  9. package/dist/collection/components/recipe-form/recipe-form.js +158 -11
  10. package/dist/collection/components/recipe-rating/recipe-rating.js +1 -1
  11. package/dist/collection/components/recipe-search-bar/recipe-search-bar.js +1 -1
  12. package/dist/components/app-toast.js +1 -1
  13. package/dist/components/index.js +1 -1
  14. package/dist/components/{p-vGdzhVB7.js → p-8_BMsNX-.js} +1 -1
  15. package/dist/components/{p-CWQoij-1.js → p-BUODh8vy.js} +1 -1
  16. package/dist/components/{p-Ckp6dPOc.js → p-CeTpiLnn.js} +1 -1
  17. package/dist/components/{p-CoCM6o6z.js → p-DnzGtyGi.js} +1 -1
  18. package/dist/components/p-HwvFQvUL.js +1 -0
  19. package/dist/components/{p-BIz6x-m7.js → p-Ux-pnuEm.js} +1 -1
  20. package/dist/components/recipe-card.js +1 -1
  21. package/dist/components/recipe-filter-bar.js +1 -1
  22. package/dist/components/recipe-form.js +1 -1
  23. package/dist/components/recipe-rating.js +1 -1
  24. package/dist/components/recipe-search-bar.js +1 -1
  25. package/dist/esm/app-modal_7.entry.js +104 -13
  26. package/dist/esm/app-toast.entry.js +1 -1
  27. package/dist/esm/loader.js +1 -1
  28. package/dist/esm/recipe-ui.js +1 -1
  29. package/dist/recipe-ui/p-5a28e09a.entry.js +1 -0
  30. package/dist/recipe-ui/{p-74151c7f.entry.js → p-8ed4bce8.entry.js} +1 -1
  31. package/dist/recipe-ui/recipe-ui.esm.js +1 -1
  32. package/dist/types/components/recipe-form/recipe-form.d.ts +14 -4
  33. package/dist/types/components.d.ts +26 -4
  34. package/package.json +1 -1
  35. package/dist/components/p-xcFZ4dcw.js +0 -1
  36. package/dist/recipe-ui/p-e912fdc5.entry.js +0 -1
@@ -17,7 +17,7 @@ const RecipeCard = class {
17
17
  };
18
18
  }
19
19
  render() {
20
- return (h("div", { key: '1602604f99f17895a29343bf269cf5aa64db2ee1', class: "card", onClick: () => this.cardClick.emit() }, h("div", { key: 'b57ab7677ba357e3897f7dff5a2d8bb50a6af417', class: "image-wrap" }, this.image ? h("img", { src: this.image, alt: this.recipeTitle }) : h("div", { class: "placeholder" }), h("button", { key: '6720508f3723573e4fe4eef2504cffc442d3ffe1', class: { 'fav-btn': true, active: this.favorite }, onClick: this.onFavoriteClick, "aria-label": "Toggle favorite" }, this.favorite ? '★' : '☆')), h("div", { key: 'e30557f6fa8ca3117d7f239c1f14e07e009500a2', class: "body" }, h("h3", { key: '11c63ca021b1204c78783b53d9defb1eddbe15fa' }, this.recipeTitle), this.category && h("span", { key: 'b3d2b2ebd8997d662ade303736b4ddd494a0e273', class: "category" }, this.category), h("div", { key: '80cc820f78f3fd4cb64f802e69ba03cfb441ce6c', class: "actions" }, h("slot", { key: '318cfb3954ad5392d56af94ba8a0e3cb3c220fa7', name: "actions" })))));
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
  };
23
23
  RecipeCard.style = recipeCardCss();
@@ -53,7 +53,7 @@ const RecipeSearchBar = class {
53
53
  this.internalValue = newVal;
54
54
  }
55
55
  render() {
56
- return (h("div", { key: '65403c53fbbe3a809f1de94bb02b04a57e5b8cd1', class: "wrap" }, h("input", { key: '43fb8c2a103e9e700b62ad86de1a559fc3b71d5b', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), h("button", { key: '2399fce8ff18e60c83bf575454eeff0e74596c6b', onClick: () => this.search.emit({ value: this.internalValue }), "aria-label": "Search" }, "\uD83D\uDD0D")));
56
+ return (h("div", { key: '00fa553cd92086a5cac70ca6b13792dfa41fc1dd', class: "wrap" }, h("input", { key: 'a116c51839c228d4daff54347e6b2d56c9dc2579', type: "search", placeholder: this.placeholder, value: this.internalValue, onInput: this.onInput, onKeyDown: this.onKeyDown }), h("button", { key: 'e16a909061abd80889ad7b7646219a7428e4db4d', onClick: () => this.search.emit({ value: this.internalValue }), "aria-label": "Search" }, "\uD83D\uDD0D")));
57
57
  }
58
58
  static get watchers() { return {
59
59
  "value": [{
@@ -77,7 +77,7 @@ const RecipeFilterBar = class {
77
77
  }
78
78
  render() {
79
79
  const cats = Array.isArray(this.categories) ? this.categories : [];
80
- return (h("div", { key: '5d0c846f0a8df8aa178915d4ee6b6fa0009cba07', class: "wrap" }, h("button", { key: '49f9fa32d23122cdcee7f51869f3c158d0ce86c0', 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)))));
80
+ 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)))));
81
81
  }
82
82
  };
83
83
  RecipeFilterBar.style = recipeFilterBarCss();
@@ -94,13 +94,18 @@ const RecipeRating = class {
94
94
  }
95
95
  render() {
96
96
  const stars = Array.from({ length: this.max }, (_, i) => i + 1);
97
- return (h("div", { key: '37923bd59ca23e07af39ebaca47a3e613809c12b', class: "wrap", role: this.readonly ? undefined : 'radiogroup' }, stars.map((s) => (h("span", { class: { star: true, filled: s <= this.value, clickable: !this.readonly }, onClick: () => !this.readonly && this.ratingChange.emit({ value: s }) }, "\u2605")))));
97
+ return (h("div", { key: '09bd2482d310e73993faea601d5ab86f20fc6fb7', class: "wrap", role: this.readonly ? undefined : 'radiogroup' }, stars.map((s) => (h("span", { class: { star: true, filled: s <= this.value, clickable: !this.readonly }, onClick: () => !this.readonly && this.ratingChange.emit({ value: s }) }, "\u2605")))));
98
98
  }
99
99
  };
100
100
  RecipeRating.style = recipeRatingCss();
101
101
 
102
- 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}`;
102
+ 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}`;
103
103
 
104
+ const DEFAULT_CATEGORIES = [
105
+ 'Beef', 'Breakfast', 'Chicken', 'Dessert', 'Goat', 'Lamb',
106
+ 'Miscellaneous', 'Pasta', 'Pork', 'Seafood', 'Side', 'Starter',
107
+ 'Vegan', 'Vegetarian', 'Other',
108
+ ];
104
109
  const DEFAULT_AREAS = [
105
110
  'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian',
106
111
  'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican',
@@ -113,12 +118,16 @@ const RecipeForm = class {
113
118
  registerInstance(this, hostRef);
114
119
  this.save = createEvent(this, "save");
115
120
  this.cancel = createEvent(this, "cancel");
116
- /** Cuisine/cuisine options for the dropdown — override to supply your own list */
117
- this.cuisines = DEFAULT_AREAS;
121
+ this.categories = DEFAULT_CATEGORIES;
122
+ this.extraCategories = [];
123
+ this.areas = DEFAULT_AREAS;
124
+ this.extraAreas = [];
118
125
  this.title = '';
119
126
  this.image = '';
120
127
  this.category = '';
121
- this.cuisine = '';
128
+ this.customCategory = '';
129
+ this.area = '';
130
+ this.customArea = '';
122
131
  this.ingredients = [''];
123
132
  this.instructions = '';
124
133
  this.errors = {};
@@ -126,12 +135,14 @@ const RecipeForm = class {
126
135
  e.preventDefault();
127
136
  if (!this.validate())
128
137
  return;
138
+ const resolvedCategory = this.category === 'Other' ? this.customCategory.trim() : this.category;
139
+ const resolvedArea = this.area === 'Other' ? this.customArea.trim() : this.area;
129
140
  const data = {
130
141
  id: this.initialData?.id,
131
142
  title: this.title.trim(),
132
143
  image: this.image.trim(),
133
- category: this.category.trim(),
134
- cuisine: this.cuisine.trim(),
144
+ category: resolvedCategory,
145
+ area: resolvedArea,
135
146
  ingredients: this.ingredients.map((i) => i.trim()).filter(Boolean),
136
147
  instructions: this.instructions.trim(),
137
148
  };
@@ -142,6 +153,9 @@ const RecipeForm = class {
142
153
  };
143
154
  this.removeIngredient = (index) => {
144
155
  this.ingredients = this.ingredients.filter((_, i) => i !== index);
156
+ const next = this.ingredients.filter((_, i) => i !== index);
157
+ this.ingredients = next;
158
+ this.clearErrorIf('ingredients', next.some((i) => i.trim()));
145
159
  };
146
160
  }
147
161
  componentWillLoad() {
@@ -150,6 +164,31 @@ const RecipeForm = class {
150
164
  onInitialDataChange() {
151
165
  this.loadInitialData();
152
166
  }
167
+ mergeList(base, extra) {
168
+ const withoutOther = base.filter((a) => a !== 'Other');
169
+ const merged = [...withoutOther];
170
+ for (const e of extra) {
171
+ if (e && !merged.includes(e))
172
+ merged.push(e);
173
+ }
174
+ merged.push('Other');
175
+ return merged;
176
+ }
177
+ get fullCategoryList() {
178
+ return this.mergeList(this.categories, this.extraCategories);
179
+ }
180
+ get fullAreaList() {
181
+ return this.mergeList(this.areas, this.extraAreas);
182
+ }
183
+ /** Removes a field's error as soon as it becomes valid, without waiting
184
+ * for the next full submit — called from each field's input handler. */
185
+ clearErrorIf(key, isNowValid) {
186
+ if (isNowValid && this.errors[key]) {
187
+ const next = { ...this.errors };
188
+ delete next[key];
189
+ this.errors = next;
190
+ }
191
+ }
153
192
  loadInitialData() {
154
193
  let data;
155
194
  if (typeof this.initialData === 'string' && this.initialData) {
@@ -166,10 +205,26 @@ const RecipeForm = class {
166
205
  if (data) {
167
206
  this.title = data.title ?? '';
168
207
  this.image = data.image ?? '';
169
- this.category = data.category ?? '';
170
- this.cuisine = data.cuisine ?? '';
171
208
  this.ingredients = data.ingredients?.length ? [...data.ingredients] : [''];
172
209
  this.instructions = data.instructions ?? '';
210
+ const knownCategories = this.fullCategoryList.filter((a) => a !== 'Other');
211
+ if (data.category && !knownCategories.includes(data.category)) {
212
+ this.category = 'Other';
213
+ this.customCategory = data.category;
214
+ }
215
+ else {
216
+ this.category = data.category ?? '';
217
+ this.customCategory = '';
218
+ }
219
+ const knownAreas = this.fullAreaList.filter((a) => a !== 'Other');
220
+ if (data.area && !knownAreas.includes(data.area)) {
221
+ this.area = 'Other';
222
+ this.customArea = data.area;
223
+ }
224
+ else {
225
+ this.area = data.area ?? '';
226
+ this.customArea = '';
227
+ }
173
228
  }
174
229
  }
175
230
  validate() {
@@ -181,6 +236,18 @@ const RecipeForm = class {
181
236
  errors.ingredients = 'Add at least one ingredient.';
182
237
  if (!this.instructions.trim())
183
238
  errors.instructions = 'Instructions are required.';
239
+ if (!this.category.trim()) {
240
+ errors.category = 'Category is required.';
241
+ }
242
+ else if (this.category === 'Other' && !this.customCategory.trim()) {
243
+ errors.customCategory = 'Enter a category name.';
244
+ }
245
+ if (!this.area.trim()) {
246
+ errors.area = 'Cuisine / Area is required.';
247
+ }
248
+ else if (this.area === 'Other' && !this.customArea.trim()) {
249
+ errors.customArea = 'Enter a cuisine name.';
250
+ }
184
251
  this.errors = errors;
185
252
  return Object.keys(errors).length === 0;
186
253
  }
@@ -188,9 +255,33 @@ const RecipeForm = class {
188
255
  const next = [...this.ingredients];
189
256
  next[index] = value;
190
257
  this.ingredients = next;
258
+ this.clearErrorIf('ingredients', next.some((i) => i.trim()));
191
259
  }
192
260
  render() {
193
- return (h("form", { key: '7268362cd88d1d924f4bf5e4061b136454935f7b', onSubmit: this.onSubmit }, h("slot", { key: '913490a0ba22ca884bcc1cac49c07573f2e8c214', name: "header" }), h("label", { key: 'cdc71ed3a3d297e7f111f7ec67c111818fe0fdf8' }, "Title", h("input", { key: 'c17da6820f298ee9fc786fa206ef3bc97e361735', type: "text", value: this.title, onInput: (e) => (this.title = e.target.value) }), this.errors.title && h("span", { key: '2c61cc6f37f87536e72fe281b50a3c6a2bdfd9f2', class: "error" }, this.errors.title)), h("label", { key: '28aca3cb1ffeae0f471477d3e564598fe0459cc7' }, "Image URL", h("input", { key: 'd523a018b35b7160061db9dc8059ee5ce3f58433', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), h("div", { key: 'c01339651af391405999f3081ee98ad2be33d6da', class: "row" }, h("label", { key: '656b72f2ccb9488d22900f1b26f0907ece8190af' }, "Category", h("input", { key: '1b973a0c12b3c66e3c585e92930b4bdbb7240b0e', type: "text", value: this.category, onInput: (e) => (this.category = e.target.value) })), h("label", { key: '9e25bad33d00c3285fd948f3e7535e5c9d8d45f9' }, "Cuisine / Area", h("select", { key: '52365ebccaa5fa2e2361ab8102b1151eb60cb5d6', onInput: (e) => (this.cuisine = e.target.value) }, h("option", { key: 'ad40fd1dde5cae8e241fced55455dbadfede6734', value: "", selected: this.cuisine === '' }, "Select a cuisine\u2026"), this.cuisines.map((a) => (h("option", { value: a, selected: a === this.cuisine }, a)))))), h("div", { key: '53173a3fbea53dad5625e28a67aebbbe9880c490', class: "field" }, h("span", { key: 'e5699c07f862027afa73ce59c1f450df48504f37' }, "Ingredients"), this.ingredients.map((ing, i) => (h("div", { class: "ingredient-row" }, h("input", { type: "text", value: ing, onInput: (e) => this.updateIngredient(i, e.target.value) }), h("button", { type: "button", onClick: () => this.removeIngredient(i), "aria-label": "Remove" }, "\u2715")))), h("button", { key: 'c37385b611c3b05eeb32a4f1a6de110b8a3b6be4', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && h("span", { key: '1e7c662423b1915bbfc7d2aeea9cea3cfef9d002', class: "error" }, this.errors.ingredients)), h("label", { key: '267e09ca2bb1a91ef552dc3522105d079570499d' }, "Instructions", h("textarea", { key: '99f4aa91fba6c3d499c4efa904794a6de75e62cd', rows: 5, onInput: (e) => (this.instructions = e.target.value) }, this.instructions), this.errors.instructions && h("span", { key: 'cde019552bf691ee8e5a737c8a8d3c493961b0f9', class: "error" }, this.errors.instructions)), h("div", { key: 'b4f40cb9ab323bcc27088e7d6c7609f26b6fd9cb', class: "footer" }, h("slot", { key: '150b900bcadc7f51cfdfd7fe9667c22c55a745fb', name: "footer" }), h("button", { key: '94e6ca7f8c291051f59b8fa4794c59833884d433', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), h("button", { key: '462f42ddfdd000af25066a1d4dbfc07be95abdd6', type: "submit", class: "save-btn" }, "Save Recipe"))));
261
+ return (h("form", { key: 'a6fd5f89975759b270bd41da834f364d11318033', onSubmit: this.onSubmit }, h("slot", { key: '263cc31f43b151d6c8c0a93d55adefd17a5ea293', name: "header" }), h("label", { key: '096dcfe6a821d4100f5a7988f4d993fb1808bb3e' }, "Title", h("input", { key: '36845960be21b66c2c0b54ae27203a6c778a1477', type: "text", value: this.title, onInput: (e) => {
262
+ (this.title = e.target.value);
263
+ this.clearErrorIf('title', !!this.title.trim());
264
+ } }), this.errors.title && h("span", { key: 'eea845094133a5372df59fd8e808c88c2c8d15d1', class: "error" }, this.errors.title)), h("label", { key: 'ac4aa2f034a22d255501e8de9c2f7ef2bd15cd58' }, "Image URL", h("input", { key: 'd9b1cc9221c842ec4390370e84ed7f7b5328c72f', type: "text", value: this.image, onInput: (e) => (this.image = e.target.value) })), h("div", { key: '2928e819a28ffa96bc3432804edd1c54e54aebdd', class: "row" }, h("label", { key: '57aca8b632ee87bdf546985ce23ee7ab3cd87a53' }, "Category", h("select", { key: '2b2e7d8bf2b6e01a6f1326cd99c60935b6584585', onInput: (e) => {
265
+ (this.category = e.target.value);
266
+ this.clearErrorIf('category', !!this.category);
267
+ if (this.category !== 'Other')
268
+ this.clearErrorIf('customCategory', true);
269
+ } }, h("option", { key: '40e6d1397afd47b58119f48290b2b2916b90958f', value: "", selected: this.category === '' }, "Select a category\u2026"), this.fullCategoryList.map((c) => (h("option", { value: c, selected: c === this.category }, c)))), this.errors.category && h("span", { key: 'd3633212048f29ac38cc7b10aedee51c7d5a0fe4', class: "error" }, this.errors.category)), h("label", { key: '04960f3ef4a8de34652f86d729838bafe2e1644e' }, "Cuisine / Area", h("select", { key: '4aeaedcebbc100d3166aa876bc2ea94ad9b2e74b', onInput: (e) => {
270
+ (this.area = e.target.value);
271
+ this.clearErrorIf('area', !!this.area);
272
+ if (this.area !== 'Other')
273
+ this.clearErrorIf('customArea', true);
274
+ } }, h("option", { key: '4945a5ee9b619807ca5e698fc82abb13b7437846', value: "", selected: this.area === '' }, "Select a cuisine\u2026"), this.fullAreaList.map((a) => (h("option", { value: a, selected: a === this.area }, a)))), this.errors.area && h("span", { key: '0e5f04ad9d214882e3d7e07b4d3f2ad9986f7c17', class: "error" }, this.errors.area))), (this.category === 'Other' || this.area === 'Other') && (h("div", { key: '92f8844bfd4dc85007746eb1d8679e06946922f3', class: "row" }, this.category === 'Other' && (h("label", { key: 'e8528349a8b9fa478b819d84f2f0b21ff87820b3', class: "custom-area-field" }, "Enter category name", h("input", { key: '9aae8f7a261f50ada7a79eeb553149b23d918e75', type: "text", placeholder: "e.g. Brunch", value: this.customCategory, onInput: (e) => {
275
+ (this.customCategory = e.target.value);
276
+ this.customCategory = e.target.value;
277
+ this.clearErrorIf('customCategory', !!this.customCategory.trim());
278
+ } }), this.errors.customCategory && h("span", { key: '9aa2a8ccd0a57816a7a0267e5e0f384d2cbf100f', class: "error" }, this.errors.customCategory))), this.area === 'Other' && (h("label", { key: '1d1f43fc855cf1b62e94b37032cdfe0b264c61f0', class: "custom-area-field" }, "Enter cuisine name", h("input", { key: '8a01e2c5c6168b2061ae95a3ae59611927e8776d', type: "text", placeholder: "e.g. Ethiopian", value: this.customArea, onInput: (e) => {
279
+ this.customArea = e.target.value;
280
+ this.clearErrorIf('customArea', !!this.customArea.trim());
281
+ } }), this.errors.customArea && h("span", { key: '0724a780a6c7f853dbf49aaa7c426abdf9dc763c', class: "error" }, this.errors.customArea))))), h("div", { key: '8eb6642721b9e82ef1e5e4becd0578248df9d6cc', class: "field" }, h("span", { key: 'b7bb449313eec9110c4dde9b63d3df682a7f4d31' }, "Ingredients"), this.ingredients.map((ing, i) => (h("div", { class: "ingredient-row" }, h("input", { type: "text", value: ing, onInput: (e) => this.updateIngredient(i, e.target.value) }), h("button", { type: "button", onClick: () => this.removeIngredient(i), "aria-label": "Remove" }, "\u2715")))), h("button", { key: '4de332018a519148d1fcb2fb32657bda5b706fe7', type: "button", class: "add-btn", onClick: this.addIngredient }, "+ Add ingredient"), this.errors.ingredients && h("span", { key: 'fdddfe5ca60493295cdef4ecb17a17aa40684512', class: "error" }, this.errors.ingredients)), h("label", { key: 'af2b50576e4a53eeba69d4f19c9a6ea5e1e127c5' }, "Instructions", h("textarea", { key: '27e741c9f135c34e8418a596bbf6780a99ff9f95', rows: 5, onInput: (e) => {
282
+ this.instructions = e.target.value;
283
+ this.clearErrorIf('instructions', !!this.instructions.trim());
284
+ } }, this.instructions), this.errors.instructions && h("span", { key: 'db1cb5b3f667fcb3124a1bf418aac8910f5e53ab', class: "error" }, this.errors.instructions)), h("div", { key: '562a94f516173f714a2e5816498fc18de0e1476b', class: "footer" }, h("slot", { key: '3feeebb32283ef5d48652b532df4bfd939d1cafc', name: "footer" }), h("button", { key: 'a1f66c6c39989944b0445750c2d41602e10e60a9', type: "button", class: "cancel-btn", onClick: () => this.cancel.emit() }, "Cancel"), h("button", { key: 'd420bf0d1d26319e53517de40df1339ffe68fadc', type: "submit", class: "save-btn" }, "Save Recipe"))));
194
285
  }
195
286
  static get watchers() { return {
196
287
  "initialData": [{
@@ -16,7 +16,7 @@ const AppToast = class {
16
16
  }
17
17
  }
18
18
  render() {
19
- return (h("div", { key: '77c3d328a79659573feaaabe30b8c53c2023fb06', class: `toast ${this.type}` }, h("span", { key: '0056d61321beb80bdebd957be4322516282fd07e' }, this.message), h("button", { key: 'f9b6161dcd74223f3241311e54ab5e2736dcbd3b', onClick: () => this.dismiss.emit(), "aria-label": "Dismiss" }, "\u2715")));
19
+ 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")));
20
20
  }
21
21
  };
22
22
  AppToast.style = appToastCss();
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-DQuL1Twl.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["app-modal_7",[[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"],"cuisines":[16],"title":[32],"image":[32],"category":[32],"cuisine":[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",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
8
+ return bootstrapLazy([["app-modal_7",[[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",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -17,5 +17,5 @@ var patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(async (options) => {
19
19
  await globalScripts();
20
- return bootstrapLazy([["app-modal_7",[[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"],"cuisines":[16],"title":[32],"image":[32],"category":[32],"cuisine":[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",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
20
+ return bootstrapLazy([["app-modal_7",[[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",[[1,"app-toast",{"message":[1],"type":[1],"duration":[2]}]]]], options);
21
21
  });
@@ -0,0 +1 @@
1
+ import{r as e,c as t,h as i}from"./p-CrZUP9M-.js";const s=class{constructor(i){e(this,i),this.favoriteToggle=t(this,"favoriteToggle"),this.cardClick=t(this,"cardClick"),this.category="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return i("div",{key:"d84f83b5082a49a5a05b93678538bfcfecd92e47",class:"card",onClick:()=>this.cardClick.emit()},i("div",{key:"a0e4f5fae6b7c14c750263f8de9bef9fbd8180a0",class:"image-wrap"},this.image?i("img",{src:this.image,alt:this.recipeTitle}):i("div",{class:"placeholder"}),i("button",{key:"9266af379f6ebeb2624131e5c3f287d64cf4b3a5",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),i("div",{key:"d0b5fa56b17c14763ecc6301864ef797565c6313",class:"body"},i("h3",{key:"0c67db81d80a820cce2e6bfedd2df2611358d1e8"},this.recipeTitle),this.category&&i("span",{key:"30f89cf328a098be1c109d3e71b8f9f15827c6f1",class:"category"},this.category),i("div",{key:"353b2663855e7ac53817d17acaf7b83908c17d85",class:"actions"},i("slot",{key:"0a04fc5024751df45d744814f579100913dcd1fc",name:"actions"}))))}};s.style=":host{display:block;font-family:system-ui, sans-serif}.card{border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;cursor:pointer;background:#fff;transition:box-shadow 0.15s ease, transform 0.15s ease}.card:hover{box-shadow:0 4px 16px rgba(0, 0, 0, 0.08);transform:translateY(-2px)}.image-wrap{position:relative;aspect-ratio:4 / 3;background:#f2f2f2}.image-wrap img{width:100%;height:100%;object-fit:cover;display:block}.placeholder{width:100%;height:100%;background:linear-gradient(135deg, #eee, #ddd)}.fav-btn{position:absolute;top:8px;right:8px;border:none;background:rgba(255, 255, 255, 0.9);border-radius:50%;width:32px;height:32px;font-size:16px;cursor:pointer;color:#f5a623}.fav-btn.active{color:#ff6b35}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.category{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em}.actions{margin-top:8px}";const a=class{constructor(i){e(this,i),this.search=t(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,this.internalValue="",this.onInput=e=>{this.internalValue=e.target.value,clearTimeout(this.timer),this.timer=setTimeout((()=>{this.search.emit({value:this.internalValue})}),this.debounceMs)},this.onKeyDown=e=>{"Enter"===e.key&&(clearTimeout(this.timer),this.search.emit({value:this.internalValue}))}}componentWillLoad(){this.internalValue=this.value}onValuePropChange(e){this.internalValue=e}render(){return i("div",{key:"00fa553cd92086a5cac70ca6b13792dfa41fc1dd",class:"wrap"},i("input",{key:"a116c51839c228d4daff54347e6b2d56c9dc2579",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),i("button",{key:"e16a909061abd80889ad7b7646219a7428e4db4d",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}};a.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:6px}input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid #ddd;font-size:14px;outline:none}input:focus{border-color:#ff6b35}button{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:0 16px;cursor:pointer;font-size:15px}";const o=class{constructor(i){e(this,i),this.filterChange=t(this,"filterChange"),this.categories=[],this.active=""}select(e){this.filterChange.emit({value:e})}render(){const e=Array.isArray(this.categories)?this.categories:[];return i("div",{key:"3088a84e81d49c06a12f93e491d4ae3e7022635f",class:"wrap"},i("button",{key:"0e8b7455b1364eb76721d4f6c227a0803750c466",class:{chip:!0,active:""===this.active},onClick:()=>this.select("")},"All"),e.map((e=>i("button",{class:{chip:!0,active:this.active===e},onClick:()=>this.select(e)},e))))}};o.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;flex-wrap:wrap;gap:8px}.chip{border:1px solid #ddd;background:#fff;border-radius:999px;padding:6px 14px;font-size:13px;cursor:pointer;color:#444}.chip.active{background:#ff6b35;border-color:#ff6b35;color:#fff}";const r=class{constructor(i){e(this,i),this.ratingChange=t(this,"ratingChange"),this.value=0,this.readonly=!1,this.max=5}render(){const e=Array.from({length:this.max},((e,t)=>t+1));return i("div",{key:"09bd2482d310e73993faea601d5ab86f20fc6fb7",class:"wrap",role:this.readonly?void 0:"radiogroup"},e.map((e=>i("span",{class:{star:!0,filled:e<=this.value,clickable:!this.readonly},onClick:()=>!this.readonly&&this.ratingChange.emit({value:e})},"★"))))}};r.style=":host{display:inline-block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:2px}.star{font-size:18px;color:#ddd}.star.filled{color:#f5a623}.star.clickable{cursor:pointer}";const n=["Beef","Breakfast","Chicken","Dessert","Goat","Lamb","Miscellaneous","Pasta","Pork","Seafood","Side","Starter","Vegan","Vegetarian","Other"],c=["American","British","Chinese","Croatian","Dutch","Egyptian","Filipino","French","Greek","Indian","Irish","Italian","Jamaican","Japanese","Kenyan","Malaysian","Mexican","Moroccan","Polish","Portuguese","Russian","Spanish","Thai","Tunisian","Turkish","Vietnamese","Other"],d=class{constructor(i){e(this,i),this.save=t(this,"save"),this.cancel=t(this,"cancel"),this.categories=n,this.extraCategories=[],this.areas=c,this.extraAreas=[],this.title="",this.image="",this.category="",this.customCategory="",this.area="",this.customArea="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t="Other"===this.category?this.customCategory.trim():this.category,i="Other"===this.area?this.customArea.trim():this.area,s={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:t,area:i,ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(s)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e));const t=this.ingredients.filter(((t,i)=>i!==e));this.ingredients=t,this.clearErrorIf("ingredients",t.some((e=>e.trim())))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}mergeList(e,t){const i=[...e.filter((e=>"Other"!==e))];for(const e of t)e&&!i.includes(e)&&i.push(e);return i.push("Other"),i}get fullCategoryList(){return this.mergeList(this.categories,this.extraCategories)}get fullAreaList(){return this.mergeList(this.areas,this.extraAreas)}clearErrorIf(e,t){if(t&&this.errors[e]){const t={...this.errors};delete t[e],this.errors=t}}loadInitialData(){let e;if("string"==typeof this.initialData&&this.initialData)try{e=JSON.parse(this.initialData)}catch{e=void 0}else this.initialData&&"object"==typeof this.initialData&&(e=this.initialData);if(e){this.title=e.title??"",this.image=e.image??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"";const t=this.fullCategoryList.filter((e=>"Other"!==e));e.category&&!t.includes(e.category)?(this.category="Other",this.customCategory=e.category):(this.category=e.category??"",this.customCategory="");const i=this.fullAreaList.filter((e=>"Other"!==e));e.area&&!i.includes(e.area)?(this.area="Other",this.customArea=e.area):(this.area=e.area??"",this.customArea="")}}validate(){const e={};return this.title.trim()||(e.title="Title is required."),0===this.ingredients.map((e=>e.trim())).filter(Boolean).length&&(e.ingredients="Add at least one ingredient."),this.instructions.trim()||(e.instructions="Instructions are required."),this.category.trim()?"Other"!==this.category||this.customCategory.trim()||(e.customCategory="Enter a category name."):e.category="Category is required.",this.area.trim()?"Other"!==this.area||this.customArea.trim()||(e.customArea="Enter a cuisine name."):e.area="Cuisine / Area is required.",this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i,this.clearErrorIf("ingredients",i.some((e=>e.trim())))}render(){return i("form",{key:"a6fd5f89975759b270bd41da834f364d11318033",onSubmit:this.onSubmit},i("slot",{key:"263cc31f43b151d6c8c0a93d55adefd17a5ea293",name:"header"}),i("label",{key:"096dcfe6a821d4100f5a7988f4d993fb1808bb3e"},"Title",i("input",{key:"36845960be21b66c2c0b54ae27203a6c778a1477",type:"text",value:this.title,onInput:e=>{this.title=e.target.value,this.clearErrorIf("title",!!this.title.trim())}}),this.errors.title&&i("span",{key:"eea845094133a5372df59fd8e808c88c2c8d15d1",class:"error"},this.errors.title)),i("label",{key:"ac4aa2f034a22d255501e8de9c2f7ef2bd15cd58"},"Image URL",i("input",{key:"d9b1cc9221c842ec4390370e84ed7f7b5328c72f",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),i("div",{key:"2928e819a28ffa96bc3432804edd1c54e54aebdd",class:"row"},i("label",{key:"57aca8b632ee87bdf546985ce23ee7ab3cd87a53"},"Category",i("select",{key:"2b2e7d8bf2b6e01a6f1326cd99c60935b6584585",onInput:e=>{this.category=e.target.value,this.clearErrorIf("category",!!this.category),"Other"!==this.category&&this.clearErrorIf("customCategory",!0)}},i("option",{key:"40e6d1397afd47b58119f48290b2b2916b90958f",value:"",selected:""===this.category},"Select a category…"),this.fullCategoryList.map((e=>i("option",{value:e,selected:e===this.category},e)))),this.errors.category&&i("span",{key:"d3633212048f29ac38cc7b10aedee51c7d5a0fe4",class:"error"},this.errors.category)),i("label",{key:"04960f3ef4a8de34652f86d729838bafe2e1644e"},"Cuisine / Area",i("select",{key:"4aeaedcebbc100d3166aa876bc2ea94ad9b2e74b",onInput:e=>{this.area=e.target.value,this.clearErrorIf("area",!!this.area),"Other"!==this.area&&this.clearErrorIf("customArea",!0)}},i("option",{key:"4945a5ee9b619807ca5e698fc82abb13b7437846",value:"",selected:""===this.area},"Select a cuisine…"),this.fullAreaList.map((e=>i("option",{value:e,selected:e===this.area},e)))),this.errors.area&&i("span",{key:"0e5f04ad9d214882e3d7e07b4d3f2ad9986f7c17",class:"error"},this.errors.area))),("Other"===this.category||"Other"===this.area)&&i("div",{key:"92f8844bfd4dc85007746eb1d8679e06946922f3",class:"row"},"Other"===this.category&&i("label",{key:"e8528349a8b9fa478b819d84f2f0b21ff87820b3",class:"custom-area-field"},"Enter category name",i("input",{key:"9aae8f7a261f50ada7a79eeb553149b23d918e75",type:"text",placeholder:"e.g. Brunch",value:this.customCategory,onInput:e=>{this.customCategory=e.target.value,this.customCategory=e.target.value,this.clearErrorIf("customCategory",!!this.customCategory.trim())}}),this.errors.customCategory&&i("span",{key:"9aa2a8ccd0a57816a7a0267e5e0f384d2cbf100f",class:"error"},this.errors.customCategory)),"Other"===this.area&&i("label",{key:"1d1f43fc855cf1b62e94b37032cdfe0b264c61f0",class:"custom-area-field"},"Enter cuisine name",i("input",{key:"8a01e2c5c6168b2061ae95a3ae59611927e8776d",type:"text",placeholder:"e.g. Ethiopian",value:this.customArea,onInput:e=>{this.customArea=e.target.value,this.clearErrorIf("customArea",!!this.customArea.trim())}}),this.errors.customArea&&i("span",{key:"0724a780a6c7f853dbf49aaa7c426abdf9dc763c",class:"error"},this.errors.customArea))),i("div",{key:"8eb6642721b9e82ef1e5e4becd0578248df9d6cc",class:"field"},i("span",{key:"b7bb449313eec9110c4dde9b63d3df682a7f4d31"},"Ingredients"),this.ingredients.map(((e,t)=>i("div",{class:"ingredient-row"},i("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),i("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),i("button",{key:"4de332018a519148d1fcb2fb32657bda5b706fe7",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&i("span",{key:"fdddfe5ca60493295cdef4ecb17a17aa40684512",class:"error"},this.errors.ingredients)),i("label",{key:"af2b50576e4a53eeba69d4f19c9a6ea5e1e127c5"},"Instructions",i("textarea",{key:"27e741c9f135c34e8418a596bbf6780a99ff9f95",rows:5,onInput:e=>{this.instructions=e.target.value,this.clearErrorIf("instructions",!!this.instructions.trim())}},this.instructions),this.errors.instructions&&i("span",{key:"db1cb5b3f667fcb3124a1bf418aac8910f5e53ab",class:"error"},this.errors.instructions)),i("div",{key:"562a94f516173f714a2e5816498fc18de0e1476b",class:"footer"},i("slot",{key:"3feeebb32283ef5d48652b532df4bfd939d1cafc",name:"footer"}),i("button",{key:"a1f66c6c39989944b0445750c2d41602e10e60a9",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),i("button",{key:"d420bf0d1d26319e53517de40df1339ffe68fadc",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}};d.style=":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}";const l=class{constructor(i){e(this,i),this.assignMeal=t(this,"assignMeal"),this.removeMeal=t(this,"removeMeal"),this.day="",this.meals=[],this.icon=""}render(){const e=Array.isArray(this.meals)?this.meals:[];return i("div",{key:"cd4f194f1eeb5f53a029f380c40aa0b4ec2f32f4",class:"day-col"},i("div",{key:"d88966142d5101fc522d5de89b6d4cab72cbbbf3",class:"col-header"},this.icon&&i("span",{key:"5a9a27a3a1909bcf7295ec7eeccf309e5e2d1ae0",class:"icon"},this.icon),i("h3",{key:"fd1fa2f1274cc1f6bd8917959015722cb69002ba"},this.day),e.length>0&&i("span",{key:"feff3bc91b52203dba19f7a87c56d3813fc95cdd",class:"count-badge"},e.length)),i("div",{key:"4afee9ce77bf1447bf9e32efc7e2f9b9571873e7",class:"meals"},e.map((e=>i("div",{class:"meal-chip"},i("div",{class:"thumb"},e.image&&i("img",{src:e.image,alt:e.title})),i("span",{class:"title"},e.title),i("button",{class:"remove-btn",onClick:()=>this.removeMeal.emit({day:this.day,mealId:e.id}),"aria-label":`Remove ${e.title}`},"✕")))),0===e.length&&i("p",{key:"9a4002b1b4516fc5ff6ef8f9a2e0a7f5e8465cbd",class:"empty"},"No meal planned")),i("button",{key:"2cef3c5f7d0e89303cb8989f78eefb95c426683f",class:"add-btn",onClick:()=>this.assignMeal.emit({day:this.day})},i("span",{key:"ae54b56f8f0b01f45029e36919764ae31f3a38b9",class:"plus"},"+")," Add meal"))}};l.style=":host{display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif}.day-col{background:#ffffff;border:1px solid #e8eaed;border-radius:12px;padding:14px;min-width:160px;display:flex;flex-direction:column;gap:10px;box-shadow:0 1px 2px rgba(16, 24, 40, 0.04);transition:box-shadow 0.15s ease, border-color 0.15s ease}.day-col:hover{box-shadow:0 4px 12px rgba(16, 24, 40, 0.08);border-color:#d8dce1}.col-header{display:flex;align-items:center;gap:6px;padding-bottom:8px;border-bottom:1px solid #f0f1f3}.col-header .icon{font-size:15px;line-height:1}.col-header h3{margin:0;font-size:12.5px;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#4b5563;flex:1}.count-badge{background:#eef2ff;color:#4338ca;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:999px;line-height:1.5}.meals{display:flex;flex-direction:column;gap:6px;min-height:44px}.meal-chip{display:flex;align-items:center;gap:8px;background:#f9fafb;border:1px solid #eef0f2;border-radius:9px;padding:6px 8px;font-size:12.5px;transition:background 0.12s ease}.meal-chip:hover{background:#f3f4f6}.thumb{width:28px;height:28px;border-radius:6px;overflow:hidden;flex-shrink:0;background:#e5e7eb}.thumb img{width:100%;height:100%;object-fit:cover;display:block}.meal-chip .title{flex:1;color:#1f2937;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.remove-btn{border:none;background:none;cursor:pointer;color:#9ca3af;font-size:11px;line-height:1;padding:3px;border-radius:5px;transition:color 0.12s ease, background 0.12s ease}.remove-btn:hover{color:#dc2626;background:#fef2f2}.empty{font-size:12px;color:#9ca3af;margin:6px 0;text-align:center;font-style:italic}.add-btn{display:flex;align-items:center;justify-content:center;gap:4px;border:1.5px dashed #d1d5db;background:none;border-radius:9px;padding:7px;font-size:12px;font-weight:600;cursor:pointer;color:#6b7280;transition:border-color 0.12s ease, color 0.12s ease, background 0.12s ease}.add-btn:hover{border-color:#6366f1;color:#4f46e5;background:#f5f5ff}.plus{font-size:14px;line-height:1}";const h=class{constructor(i){e(this,i),this.close=t(this,"close"),this.open=!1,this.modalTitle=""}render(){return this.open?i("div",{class:"overlay",onClick:()=>this.close.emit()},i("div",{class:"dialog",onClick:e=>e.stopPropagation()},i("div",{class:"header"},i("h2",null,this.modalTitle),i("button",{class:"close-btn",onClick:()=>this.close.emit(),"aria-label":"Close"},"✕")),i("div",{class:"body"},i("slot",null)))):null}};h.style=":host{font-family:system-ui, sans-serif}.overlay{position:fixed;inset:0;background:rgba(0, 0, 0, 0.45);display:flex;align-items:center;justify-content:center;z-index:1000}.dialog{background:#fff;border-radius:12px;min-width:320px;max-width:90vw;max-height:85vh;overflow-y:auto;padding:20px;box-shadow:0 10px 40px rgba(0,0,0,0.2)}.header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.header h2{margin:0;font-size:18px}.close-btn{border:none;background:none;font-size:16px;cursor:pointer;color:#666}";export{h as app_modal,l as meal_plan_day,s as recipe_card,o as recipe_filter_bar,d as recipe_form,r as recipe_rating,a as recipe_search_bar}
@@ -1 +1 @@
1
- import{r as s,c as t,h as o}from"./p-CrZUP9M-.js";const a=class{constructor(o){s(this,o),this.dismiss=t(this,"dismiss"),this.message="",this.type="info",this.duration=3e3}componentDidLoad(){this.duration>0&&setTimeout((()=>this.dismiss.emit()),this.duration)}render(){return o("div",{key:"77c3d328a79659573feaaabe30b8c53c2023fb06",class:`toast ${this.type}`},o("span",{key:"0056d61321beb80bdebd957be4322516282fd07e"},this.message),o("button",{key:"f9b6161dcd74223f3241311e54ab5e2736dcbd3b",onClick:()=>this.dismiss.emit(),"aria-label":"Dismiss"},"✕"))}};a.style=":host{font-family:system-ui, sans-serif;display:block}.toast{display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:8px;color:#fff;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,0.15)}.toast.success{background:#2ecc71}.toast.error{background:#e74c3c}.toast.info{background:#3498db}button{border:none;background:none;color:inherit;cursor:pointer;margin-left:auto}";export{a as app_toast}
1
+ import{r as s,c as t,h as o}from"./p-CrZUP9M-.js";const a=class{constructor(o){s(this,o),this.dismiss=t(this,"dismiss"),this.message="",this.type="info",this.duration=3e3}componentDidLoad(){this.duration>0&&setTimeout((()=>this.dismiss.emit()),this.duration)}render(){return o("div",{key:"8b34f0098a8d17af8b9384ddf8838c8ad6eaf7f2",class:`toast ${this.type}`},o("span",{key:"652ce04dad64022f77dbd0236ebfc1a0075ba121"},this.message),o("button",{key:"760c2e84e1bf01c3b7a8c43addf983711453be3b",onClick:()=>this.dismiss.emit(),"aria-label":"Dismiss"},"✕"))}};a.style=":host{font-family:system-ui, sans-serif;display:block}.toast{display:flex;align-items:center;gap:10px;padding:10px 16px;border-radius:8px;color:#fff;font-size:14px;box-shadow:0 4px 12px rgba(0,0,0,0.15)}.toast.success{background:#2ecc71}.toast.error{background:#e74c3c}.toast.info{background:#3498db}button{border:none;background:none;color:inherit;cursor:pointer;margin-left:auto}";export{a as app_toast}
@@ -1 +1 @@
1
- import{p as e,b as a}from"./p-CrZUP9M-.js";export{s as setNonce}from"./p-CrZUP9M-.js";import{g as i}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,i={};return""!==a&&(i.resourcesUrl=new URL(".",a).href),e(i)})().then((async e=>(await i(),a([["p-e912fdc5",[[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"],cuisines:[16],title:[32],image:[32],category:[32],cuisine:[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}]}]]],["p-74151c7f",[[1,"app-toast",{message:[1],type:[1],duration:[2]}]]]],e))));
1
+ import{p as e,b as a}from"./p-CrZUP9M-.js";export{s as setNonce}from"./p-CrZUP9M-.js";import{g as r}from"./p-DQuL1Twl.js";(()=>{const a=import.meta.url,r={};return""!==a&&(r.resourcesUrl=new URL(".",a).href),e(r)})().then((async e=>(await r(),a([["p-5a28e09a",[[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}]}]]],["p-8ed4bce8",[[1,"app-toast",{message:[1],type:[1],duration:[2]}]]]],e))));
@@ -4,18 +4,22 @@ export interface RecipeFormData {
4
4
  title: string;
5
5
  image: string;
6
6
  category: string;
7
- cuisine?: string;
7
+ area?: string;
8
8
  ingredients: string[];
9
9
  instructions: string;
10
10
  }
11
11
  export declare class RecipeForm {
12
12
  initialData: RecipeFormData | string;
13
- /** Cuisine/cuisine options for the dropdown — override to supply your own list */
14
- cuisines: string[];
13
+ categories: string[];
14
+ extraCategories: string[];
15
+ areas: string[];
16
+ extraAreas: string[];
15
17
  title: string;
16
18
  image: string;
17
19
  category: string;
18
- cuisine: string;
20
+ customCategory: string;
21
+ area: string;
22
+ customArea: string;
19
23
  ingredients: string[];
20
24
  instructions: string;
21
25
  errors: Record<string, string>;
@@ -23,6 +27,12 @@ export declare class RecipeForm {
23
27
  cancel: EventEmitter<void>;
24
28
  componentWillLoad(): void;
25
29
  onInitialDataChange(): void;
30
+ private mergeList;
31
+ private get fullCategoryList();
32
+ private get fullAreaList();
33
+ /** Removes a field's error as soon as it becomes valid, without waiting
34
+ * for the next full submit — called from each field's input handler. */
35
+ private clearErrorIf;
26
36
  private loadInitialData;
27
37
  private validate;
28
38
  private onSubmit;
@@ -99,10 +99,21 @@ export namespace Components {
99
99
  }
100
100
  interface RecipeForm {
101
101
  /**
102
- * Cuisine/cuisine options for the dropdown — override to supply your own list
103
102
  * @default [ 'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian', 'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican', 'Japanese', 'Kenyan', 'Malaysian', 'Mexican', 'Moroccan', 'Polish', 'Portuguese', 'Russian', 'Spanish', 'Thai', 'Tunisian', 'Turkish', 'Vietnamese', 'Other', ]
104
103
  */
105
- "cuisines": string[];
104
+ "areas": string[];
105
+ /**
106
+ * @default [ 'Beef', 'Breakfast', 'Chicken', 'Dessert', 'Goat', 'Lamb', 'Miscellaneous', 'Pasta', 'Pork', 'Seafood', 'Side', 'Starter', 'Vegan', 'Vegetarian', 'Other', ]
107
+ */
108
+ "categories": string[];
109
+ /**
110
+ * @default []
111
+ */
112
+ "extraAreas": string[];
113
+ /**
114
+ * @default []
115
+ */
116
+ "extraCategories": string[];
106
117
  "initialData": RecipeFormData | string;
107
118
  }
108
119
  /**
@@ -452,10 +463,21 @@ declare namespace LocalJSX {
452
463
  }
453
464
  interface RecipeForm {
454
465
  /**
455
- * Cuisine/cuisine options for the dropdown — override to supply your own list
456
466
  * @default [ 'American', 'British', 'Chinese', 'Croatian', 'Dutch', 'Egyptian', 'Filipino', 'French', 'Greek', 'Indian', 'Irish', 'Italian', 'Jamaican', 'Japanese', 'Kenyan', 'Malaysian', 'Mexican', 'Moroccan', 'Polish', 'Portuguese', 'Russian', 'Spanish', 'Thai', 'Tunisian', 'Turkish', 'Vietnamese', 'Other', ]
457
467
  */
458
- "cuisines"?: string[];
468
+ "areas"?: string[];
469
+ /**
470
+ * @default [ 'Beef', 'Breakfast', 'Chicken', 'Dessert', 'Goat', 'Lamb', 'Miscellaneous', 'Pasta', 'Pork', 'Seafood', 'Side', 'Starter', 'Vegan', 'Vegetarian', 'Other', ]
471
+ */
472
+ "categories"?: string[];
473
+ /**
474
+ * @default []
475
+ */
476
+ "extraAreas"?: string[];
477
+ /**
478
+ * @default []
479
+ */
480
+ "extraCategories"?: string[];
459
481
  "initialData"?: RecipeFormData | string;
460
482
  "onCancel"?: (event: RecipeFormCustomEvent<void>) => void;
461
483
  "onSave"?: (event: RecipeFormCustomEvent<RecipeFormData>) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gurpinderjitsingh/recipe-ui",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Reusable web component library for the Recipe Finder & Meal Planner app, built with StencilJS.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- import{t as e,p as t,H as i,c as a,h as s}from"./p-BJU3HdRm.js";const n=["American","British","Chinese","Croatian","Dutch","Egyptian","Filipino","French","Greek","Indian","Irish","Italian","Jamaican","Japanese","Kenyan","Malaysian","Mexican","Moroccan","Polish","Portuguese","Russian","Spanish","Thai","Tunisian","Turkish","Vietnamese","Other"],c=t(class extends i{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.save=a(this,"save"),this.cancel=a(this,"cancel"),this.cuisines=n,this.title="",this.image="",this.category="",this.cuisine="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:this.category.trim(),cuisine:this.cuisine.trim(),ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(t)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}loadInitialData(){let e;if("string"==typeof this.initialData&&this.initialData)try{e=JSON.parse(this.initialData)}catch{e=void 0}else this.initialData&&"object"==typeof this.initialData&&(e=this.initialData);e&&(this.title=e.title??"",this.image=e.image??"",this.category=e.category??"",this.cuisine=e.cuisine??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"")}validate(){const e={};return this.title.trim()||(e.title="Title is required."),0===this.ingredients.map((e=>e.trim())).filter(Boolean).length&&(e.ingredients="Add at least one ingredient."),this.instructions.trim()||(e.instructions="Instructions are required."),this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i}render(){return s("form",{key:"7268362cd88d1d924f4bf5e4061b136454935f7b",onSubmit:this.onSubmit},s("slot",{key:"913490a0ba22ca884bcc1cac49c07573f2e8c214",name:"header"}),s("label",{key:"cdc71ed3a3d297e7f111f7ec67c111818fe0fdf8"},"Title",s("input",{key:"c17da6820f298ee9fc786fa206ef3bc97e361735",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&s("span",{key:"2c61cc6f37f87536e72fe281b50a3c6a2bdfd9f2",class:"error"},this.errors.title)),s("label",{key:"28aca3cb1ffeae0f471477d3e564598fe0459cc7"},"Image URL",s("input",{key:"d523a018b35b7160061db9dc8059ee5ce3f58433",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),s("div",{key:"c01339651af391405999f3081ee98ad2be33d6da",class:"row"},s("label",{key:"656b72f2ccb9488d22900f1b26f0907ece8190af"},"Category",s("input",{key:"1b973a0c12b3c66e3c585e92930b4bdbb7240b0e",type:"text",value:this.category,onInput:e=>this.category=e.target.value})),s("label",{key:"9e25bad33d00c3285fd948f3e7535e5c9d8d45f9"},"Cuisine / Area",s("select",{key:"52365ebccaa5fa2e2361ab8102b1151eb60cb5d6",onInput:e=>this.cuisine=e.target.value},s("option",{key:"ad40fd1dde5cae8e241fced55455dbadfede6734",value:"",selected:""===this.cuisine},"Select a cuisine…"),this.cuisines.map((e=>s("option",{value:e,selected:e===this.cuisine},e)))))),s("div",{key:"53173a3fbea53dad5625e28a67aebbbe9880c490",class:"field"},s("span",{key:"e5699c07f862027afa73ce59c1f450df48504f37"},"Ingredients"),this.ingredients.map(((e,t)=>s("div",{class:"ingredient-row"},s("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),s("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),s("button",{key:"c37385b611c3b05eeb32a4f1a6de110b8a3b6be4",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&s("span",{key:"1e7c662423b1915bbfc7d2aeea9cea3cfef9d002",class:"error"},this.errors.ingredients)),s("label",{key:"267e09ca2bb1a91ef552dc3522105d079570499d"},"Instructions",s("textarea",{key:"99f4aa91fba6c3d499c4efa904794a6de75e62cd",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&s("span",{key:"cde019552bf691ee8e5a737c8a8d3c493961b0f9",class:"error"},this.errors.instructions)),s("div",{key:"b4f40cb9ab323bcc27088e7d6c7609f26b6fd9cb",class:"footer"},s("slot",{key:"150b900bcadc7f51cfdfd7fe9667c22c55a745fb",name:"footer"}),s("button",{key:"94e6ca7f8c291051f59b8fa4794c59833884d433",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),s("button",{key:"462f42ddfdd000af25066a1d4dbfc07be95abdd6",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}static get style(){return":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}"}},[257,"recipe-form",{initialData:[1,"initial-data"],cuisines:[16],title:[32],image:[32],category:[32],cuisine:[32],ingredients:[32],instructions:[32],errors:[32]},void 0,{initialData:[{onInitialDataChange:0}]}]);function d(){"undefined"!=typeof customElements&&["recipe-form"].forEach((t=>{"recipe-form"===t&&(customElements.get(e(t))||customElements.define(e(t),c))}))}d();export{c as R,d}
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as i}from"./p-CrZUP9M-.js";const a=class{constructor(i){e(this,i),this.favoriteToggle=t(this,"favoriteToggle"),this.cardClick=t(this,"cardClick"),this.category="",this.favorite=!1,this.onFavoriteClick=e=>{e.stopPropagation(),this.favoriteToggle.emit({favorite:!this.favorite})}}render(){return i("div",{key:"1602604f99f17895a29343bf269cf5aa64db2ee1",class:"card",onClick:()=>this.cardClick.emit()},i("div",{key:"b57ab7677ba357e3897f7dff5a2d8bb50a6af417",class:"image-wrap"},this.image?i("img",{src:this.image,alt:this.recipeTitle}):i("div",{class:"placeholder"}),i("button",{key:"6720508f3723573e4fe4eef2504cffc442d3ffe1",class:{"fav-btn":!0,active:this.favorite},onClick:this.onFavoriteClick,"aria-label":"Toggle favorite"},this.favorite?"★":"☆")),i("div",{key:"e30557f6fa8ca3117d7f239c1f14e07e009500a2",class:"body"},i("h3",{key:"11c63ca021b1204c78783b53d9defb1eddbe15fa"},this.recipeTitle),this.category&&i("span",{key:"b3d2b2ebd8997d662ade303736b4ddd494a0e273",class:"category"},this.category),i("div",{key:"80cc820f78f3fd4cb64f802e69ba03cfb441ce6c",class:"actions"},i("slot",{key:"318cfb3954ad5392d56af94ba8a0e3cb3c220fa7",name:"actions"}))))}};a.style=":host{display:block;font-family:system-ui, sans-serif}.card{border:1px solid #e5e5e5;border-radius:12px;overflow:hidden;cursor:pointer;background:#fff;transition:box-shadow 0.15s ease, transform 0.15s ease}.card:hover{box-shadow:0 4px 16px rgba(0, 0, 0, 0.08);transform:translateY(-2px)}.image-wrap{position:relative;aspect-ratio:4 / 3;background:#f2f2f2}.image-wrap img{width:100%;height:100%;object-fit:cover;display:block}.placeholder{width:100%;height:100%;background:linear-gradient(135deg, #eee, #ddd)}.fav-btn{position:absolute;top:8px;right:8px;border:none;background:rgba(255, 255, 255, 0.9);border-radius:50%;width:32px;height:32px;font-size:16px;cursor:pointer;color:#f5a623}.fav-btn.active{color:#ff6b35}.body{padding:12px 14px}h3{margin:0 0 4px;font-size:15px;line-height:1.3}.category{font-size:12px;color:#777;text-transform:uppercase;letter-spacing:0.03em}.actions{margin-top:8px}";const s=class{constructor(i){e(this,i),this.search=t(this,"search"),this.placeholder="Search recipes...",this.value="",this.debounceMs=350,this.internalValue="",this.onInput=e=>{this.internalValue=e.target.value,clearTimeout(this.timer),this.timer=setTimeout((()=>{this.search.emit({value:this.internalValue})}),this.debounceMs)},this.onKeyDown=e=>{"Enter"===e.key&&(clearTimeout(this.timer),this.search.emit({value:this.internalValue}))}}componentWillLoad(){this.internalValue=this.value}onValuePropChange(e){this.internalValue=e}render(){return i("div",{key:"65403c53fbbe3a809f1de94bb02b04a57e5b8cd1",class:"wrap"},i("input",{key:"43fb8c2a103e9e700b62ad86de1a559fc3b71d5b",type:"search",placeholder:this.placeholder,value:this.internalValue,onInput:this.onInput,onKeyDown:this.onKeyDown}),i("button",{key:"2399fce8ff18e60c83bf575454eeff0e74596c6b",onClick:()=>this.search.emit({value:this.internalValue}),"aria-label":"Search"},"🔍"))}static get watchers(){return{value:[{onValuePropChange:0}]}}};s.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:6px}input{flex:1;padding:10px 14px;border-radius:8px;border:1px solid #ddd;font-size:14px;outline:none}input:focus{border-color:#ff6b35}button{border:none;background:#ff6b35;color:#fff;border-radius:8px;padding:0 16px;cursor:pointer;font-size:15px}";const o=class{constructor(i){e(this,i),this.filterChange=t(this,"filterChange"),this.categories=[],this.active=""}select(e){this.filterChange.emit({value:e})}render(){const e=Array.isArray(this.categories)?this.categories:[];return i("div",{key:"5d0c846f0a8df8aa178915d4ee6b6fa0009cba07",class:"wrap"},i("button",{key:"49f9fa32d23122cdcee7f51869f3c158d0ce86c0",class:{chip:!0,active:""===this.active},onClick:()=>this.select("")},"All"),e.map((e=>i("button",{class:{chip:!0,active:this.active===e},onClick:()=>this.select(e)},e))))}};o.style=":host{display:block;font-family:system-ui, sans-serif}.wrap{display:flex;flex-wrap:wrap;gap:8px}.chip{border:1px solid #ddd;background:#fff;border-radius:999px;padding:6px 14px;font-size:13px;cursor:pointer;color:#444}.chip.active{background:#ff6b35;border-color:#ff6b35;color:#fff}";const r=class{constructor(i){e(this,i),this.ratingChange=t(this,"ratingChange"),this.value=0,this.readonly=!1,this.max=5}render(){const e=Array.from({length:this.max},((e,t)=>t+1));return i("div",{key:"37923bd59ca23e07af39ebaca47a3e613809c12b",class:"wrap",role:this.readonly?void 0:"radiogroup"},e.map((e=>i("span",{class:{star:!0,filled:e<=this.value,clickable:!this.readonly},onClick:()=>!this.readonly&&this.ratingChange.emit({value:e})},"★"))))}};r.style=":host{display:inline-block;font-family:system-ui, sans-serif}.wrap{display:flex;gap:2px}.star{font-size:18px;color:#ddd}.star.filled{color:#f5a623}.star.clickable{cursor:pointer}";const c=["American","British","Chinese","Croatian","Dutch","Egyptian","Filipino","French","Greek","Indian","Irish","Italian","Jamaican","Japanese","Kenyan","Malaysian","Mexican","Moroccan","Polish","Portuguese","Russian","Spanish","Thai","Tunisian","Turkish","Vietnamese","Other"],n=class{constructor(i){e(this,i),this.save=t(this,"save"),this.cancel=t(this,"cancel"),this.cuisines=c,this.title="",this.image="",this.category="",this.cuisine="",this.ingredients=[""],this.instructions="",this.errors={},this.onSubmit=e=>{if(e.preventDefault(),!this.validate())return;const t={id:this.initialData?.id,title:this.title.trim(),image:this.image.trim(),category:this.category.trim(),cuisine:this.cuisine.trim(),ingredients:this.ingredients.map((e=>e.trim())).filter(Boolean),instructions:this.instructions.trim()};this.save.emit(t)},this.addIngredient=()=>{this.ingredients=[...this.ingredients,""]},this.removeIngredient=e=>{this.ingredients=this.ingredients.filter(((t,i)=>i!==e))}}componentWillLoad(){this.loadInitialData()}onInitialDataChange(){this.loadInitialData()}loadInitialData(){let e;if("string"==typeof this.initialData&&this.initialData)try{e=JSON.parse(this.initialData)}catch{e=void 0}else this.initialData&&"object"==typeof this.initialData&&(e=this.initialData);e&&(this.title=e.title??"",this.image=e.image??"",this.category=e.category??"",this.cuisine=e.cuisine??"",this.ingredients=e.ingredients?.length?[...e.ingredients]:[""],this.instructions=e.instructions??"")}validate(){const e={};return this.title.trim()||(e.title="Title is required."),0===this.ingredients.map((e=>e.trim())).filter(Boolean).length&&(e.ingredients="Add at least one ingredient."),this.instructions.trim()||(e.instructions="Instructions are required."),this.errors=e,0===Object.keys(e).length}updateIngredient(e,t){const i=[...this.ingredients];i[e]=t,this.ingredients=i}render(){return i("form",{key:"7268362cd88d1d924f4bf5e4061b136454935f7b",onSubmit:this.onSubmit},i("slot",{key:"913490a0ba22ca884bcc1cac49c07573f2e8c214",name:"header"}),i("label",{key:"cdc71ed3a3d297e7f111f7ec67c111818fe0fdf8"},"Title",i("input",{key:"c17da6820f298ee9fc786fa206ef3bc97e361735",type:"text",value:this.title,onInput:e=>this.title=e.target.value}),this.errors.title&&i("span",{key:"2c61cc6f37f87536e72fe281b50a3c6a2bdfd9f2",class:"error"},this.errors.title)),i("label",{key:"28aca3cb1ffeae0f471477d3e564598fe0459cc7"},"Image URL",i("input",{key:"d523a018b35b7160061db9dc8059ee5ce3f58433",type:"text",value:this.image,onInput:e=>this.image=e.target.value})),i("div",{key:"c01339651af391405999f3081ee98ad2be33d6da",class:"row"},i("label",{key:"656b72f2ccb9488d22900f1b26f0907ece8190af"},"Category",i("input",{key:"1b973a0c12b3c66e3c585e92930b4bdbb7240b0e",type:"text",value:this.category,onInput:e=>this.category=e.target.value})),i("label",{key:"9e25bad33d00c3285fd948f3e7535e5c9d8d45f9"},"Cuisine / Area",i("select",{key:"52365ebccaa5fa2e2361ab8102b1151eb60cb5d6",onInput:e=>this.cuisine=e.target.value},i("option",{key:"ad40fd1dde5cae8e241fced55455dbadfede6734",value:"",selected:""===this.cuisine},"Select a cuisine…"),this.cuisines.map((e=>i("option",{value:e,selected:e===this.cuisine},e)))))),i("div",{key:"53173a3fbea53dad5625e28a67aebbbe9880c490",class:"field"},i("span",{key:"e5699c07f862027afa73ce59c1f450df48504f37"},"Ingredients"),this.ingredients.map(((e,t)=>i("div",{class:"ingredient-row"},i("input",{type:"text",value:e,onInput:e=>this.updateIngredient(t,e.target.value)}),i("button",{type:"button",onClick:()=>this.removeIngredient(t),"aria-label":"Remove"},"✕")))),i("button",{key:"c37385b611c3b05eeb32a4f1a6de110b8a3b6be4",type:"button",class:"add-btn",onClick:this.addIngredient},"+ Add ingredient"),this.errors.ingredients&&i("span",{key:"1e7c662423b1915bbfc7d2aeea9cea3cfef9d002",class:"error"},this.errors.ingredients)),i("label",{key:"267e09ca2bb1a91ef552dc3522105d079570499d"},"Instructions",i("textarea",{key:"99f4aa91fba6c3d499c4efa904794a6de75e62cd",rows:5,onInput:e=>this.instructions=e.target.value},this.instructions),this.errors.instructions&&i("span",{key:"cde019552bf691ee8e5a737c8a8d3c493961b0f9",class:"error"},this.errors.instructions)),i("div",{key:"b4f40cb9ab323bcc27088e7d6c7609f26b6fd9cb",class:"footer"},i("slot",{key:"150b900bcadc7f51cfdfd7fe9667c22c55a745fb",name:"footer"}),i("button",{key:"94e6ca7f8c291051f59b8fa4794c59833884d433",type:"button",class:"cancel-btn",onClick:()=>this.cancel.emit()},"Cancel"),i("button",{key:"462f42ddfdd000af25066a1d4dbfc07be95abdd6",type:"submit",class:"save-btn"},"Save Recipe")))}static get watchers(){return{initialData:[{onInitialDataChange:0}]}}};n.style=":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}";const d=class{constructor(i){e(this,i),this.assignMeal=t(this,"assignMeal"),this.removeMeal=t(this,"removeMeal"),this.day="",this.meals=[],this.icon=""}render(){const e=Array.isArray(this.meals)?this.meals:[];return i("div",{key:"cd4f194f1eeb5f53a029f380c40aa0b4ec2f32f4",class:"day-col"},i("div",{key:"d88966142d5101fc522d5de89b6d4cab72cbbbf3",class:"col-header"},this.icon&&i("span",{key:"5a9a27a3a1909bcf7295ec7eeccf309e5e2d1ae0",class:"icon"},this.icon),i("h3",{key:"fd1fa2f1274cc1f6bd8917959015722cb69002ba"},this.day),e.length>0&&i("span",{key:"feff3bc91b52203dba19f7a87c56d3813fc95cdd",class:"count-badge"},e.length)),i("div",{key:"4afee9ce77bf1447bf9e32efc7e2f9b9571873e7",class:"meals"},e.map((e=>i("div",{class:"meal-chip"},i("div",{class:"thumb"},e.image&&i("img",{src:e.image,alt:e.title})),i("span",{class:"title"},e.title),i("button",{class:"remove-btn",onClick:()=>this.removeMeal.emit({day:this.day,mealId:e.id}),"aria-label":`Remove ${e.title}`},"✕")))),0===e.length&&i("p",{key:"9a4002b1b4516fc5ff6ef8f9a2e0a7f5e8465cbd",class:"empty"},"No meal planned")),i("button",{key:"2cef3c5f7d0e89303cb8989f78eefb95c426683f",class:"add-btn",onClick:()=>this.assignMeal.emit({day:this.day})},i("span",{key:"ae54b56f8f0b01f45029e36919764ae31f3a38b9",class:"plus"},"+")," Add meal"))}};d.style=":host{display:block;font-family:-apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif}.day-col{background:#ffffff;border:1px solid #e8eaed;border-radius:12px;padding:14px;min-width:160px;display:flex;flex-direction:column;gap:10px;box-shadow:0 1px 2px rgba(16, 24, 40, 0.04);transition:box-shadow 0.15s ease, border-color 0.15s ease}.day-col:hover{box-shadow:0 4px 12px rgba(16, 24, 40, 0.08);border-color:#d8dce1}.col-header{display:flex;align-items:center;gap:6px;padding-bottom:8px;border-bottom:1px solid #f0f1f3}.col-header .icon{font-size:15px;line-height:1}.col-header h3{margin:0;font-size:12.5px;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#4b5563;flex:1}.count-badge{background:#eef2ff;color:#4338ca;font-size:10.5px;font-weight:700;padding:1px 7px;border-radius:999px;line-height:1.5}.meals{display:flex;flex-direction:column;gap:6px;min-height:44px}.meal-chip{display:flex;align-items:center;gap:8px;background:#f9fafb;border:1px solid #eef0f2;border-radius:9px;padding:6px 8px;font-size:12.5px;transition:background 0.12s ease}.meal-chip:hover{background:#f3f4f6}.thumb{width:28px;height:28px;border-radius:6px;overflow:hidden;flex-shrink:0;background:#e5e7eb}.thumb img{width:100%;height:100%;object-fit:cover;display:block}.meal-chip .title{flex:1;color:#1f2937;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.remove-btn{border:none;background:none;cursor:pointer;color:#9ca3af;font-size:11px;line-height:1;padding:3px;border-radius:5px;transition:color 0.12s ease, background 0.12s ease}.remove-btn:hover{color:#dc2626;background:#fef2f2}.empty{font-size:12px;color:#9ca3af;margin:6px 0;text-align:center;font-style:italic}.add-btn{display:flex;align-items:center;justify-content:center;gap:4px;border:1.5px dashed #d1d5db;background:none;border-radius:9px;padding:7px;font-size:12px;font-weight:600;cursor:pointer;color:#6b7280;transition:border-color 0.12s ease, color 0.12s ease, background 0.12s ease}.add-btn:hover{border-color:#6366f1;color:#4f46e5;background:#f5f5ff}.plus{font-size:14px;line-height:1}";const f=class{constructor(i){e(this,i),this.close=t(this,"close"),this.open=!1,this.modalTitle=""}render(){return this.open?i("div",{class:"overlay",onClick:()=>this.close.emit()},i("div",{class:"dialog",onClick:e=>e.stopPropagation()},i("div",{class:"header"},i("h2",null,this.modalTitle),i("button",{class:"close-btn",onClick:()=>this.close.emit(),"aria-label":"Close"},"✕")),i("div",{class:"body"},i("slot",null)))):null}};f.style=":host{font-family:system-ui, sans-serif}.overlay{position:fixed;inset:0;background:rgba(0, 0, 0, 0.45);display:flex;align-items:center;justify-content:center;z-index:1000}.dialog{background:#fff;border-radius:12px;min-width:320px;max-width:90vw;max-height:85vh;overflow-y:auto;padding:20px;box-shadow:0 10px 40px rgba(0,0,0,0.2)}.header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.header h2{margin:0;font-size:18px}.close-btn{border:none;background:none;font-size:16px;cursor:pointer;color:#666}";export{f as app_modal,d as meal_plan_day,a as recipe_card,o as recipe_filter_bar,n as recipe_form,r as recipe_rating,s as recipe_search_bar}