@recipe-book/react 0.0.1 → 0.0.3

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 (149) hide show
  1. package/dist/chunk-2S2Z4HLL.mjs +46 -0
  2. package/dist/chunk-2VMRVR3X.mjs +1 -0
  3. package/dist/chunk-36H6LM2B.mjs +14 -0
  4. package/dist/{chunk-JTZVD7JV.mjs → chunk-4IWVZEXX.mjs} +4 -4
  5. package/dist/chunk-4XBZKTOL.mjs +1 -0
  6. package/dist/chunk-6AGILC25.mjs +20 -0
  7. package/dist/chunk-6AXGEB5P.mjs +14 -0
  8. package/dist/chunk-6JEDN4VR.mjs +20 -0
  9. package/dist/chunk-6KLLMLNF.mjs +33 -0
  10. package/dist/chunk-6LTLY5K7.mjs +20 -0
  11. package/dist/chunk-6RA4EVIO.mjs +46 -0
  12. package/dist/chunk-75DF3E6L.mjs +50 -0
  13. package/dist/chunk-7BWMULSB.mjs +55 -0
  14. package/dist/chunk-7PPB3PM6.mjs +40 -0
  15. package/dist/chunk-7SBP7DC5.mjs +42 -0
  16. package/dist/chunk-7XJBP24U.mjs +20 -0
  17. package/dist/chunk-A5JAKCMG.mjs +44 -0
  18. package/dist/chunk-ATOAYKI3.mjs +26 -0
  19. package/dist/chunk-B5IXKKFC.mjs +38 -0
  20. package/dist/chunk-BEMMFA52.mjs +49 -0
  21. package/dist/chunk-BOG5DA6M.mjs +38 -0
  22. package/dist/chunk-BW4DYFBO.mjs +36 -0
  23. package/dist/chunk-CDQFOSWR.mjs +34 -0
  24. package/dist/chunk-CRQVP6PW.mjs +20 -0
  25. package/dist/chunk-CY27OHOG.mjs +1 -0
  26. package/dist/chunk-DACFJWGN.mjs +14 -0
  27. package/dist/chunk-DE5GUZKO.mjs +46 -0
  28. package/dist/chunk-DNZAFS5G.mjs +48 -0
  29. package/dist/chunk-DS3O5PAR.mjs +20 -0
  30. package/dist/chunk-ENGJXHYU.mjs +42 -0
  31. package/dist/chunk-FIFGRJKD.mjs +26 -0
  32. package/dist/chunk-FWOMIZEF.mjs +46 -0
  33. package/dist/{chunk-T6BBQT4K.mjs → chunk-G7XD4VBW.mjs} +5 -5
  34. package/dist/chunk-GBU6MVZL.mjs +14 -0
  35. package/dist/chunk-GM5F7IUT.mjs +2 -0
  36. package/dist/chunk-GSGRXRJP.mjs +38 -0
  37. package/dist/chunk-GZRNU24M.mjs +46 -0
  38. package/dist/{chunk-J5PZAYLW.mjs → chunk-HNDXCSZY.mjs} +5 -6
  39. package/dist/chunk-HXTUDCO2.mjs +49 -0
  40. package/dist/chunk-I5TR6PEA.mjs +0 -0
  41. package/dist/chunk-IXRYSEMS.mjs +30 -0
  42. package/dist/chunk-J5Q2Z2JG.mjs +38 -0
  43. package/dist/chunk-JBAAWEV6.mjs +1 -0
  44. package/dist/chunk-JCPPNN26.mjs +44 -0
  45. package/dist/chunk-JR3OTSZB.mjs +32 -0
  46. package/dist/chunk-JWS5RTU3.mjs +46 -0
  47. package/dist/chunk-K6EZ773Q.mjs +26 -0
  48. package/dist/chunk-KNXMYQVO.mjs +36 -0
  49. package/dist/chunk-KRUZ7OA7.mjs +44 -0
  50. package/dist/chunk-KXCIJBR6.mjs +14 -0
  51. package/dist/chunk-MASAOP7L.mjs +55 -0
  52. package/dist/chunk-MGBEDCLT.mjs +34 -0
  53. package/dist/chunk-MKBCBPVR.mjs +53 -0
  54. package/dist/chunk-N53TONLF.mjs +39 -0
  55. package/dist/chunk-NYDGFRPM.mjs +46 -0
  56. package/dist/chunk-OPOABKD6.mjs +23 -0
  57. package/dist/chunk-OX6ITS5C.mjs +20 -0
  58. package/dist/chunk-PAAVW47I.mjs +50 -0
  59. package/dist/chunk-PAF5HSSV.mjs +53 -0
  60. package/dist/chunk-PBENQR7Y.mjs +1 -0
  61. package/dist/chunk-PH3LQIHZ.mjs +26 -0
  62. package/dist/{chunk-FPLGEKN7.mjs → chunk-PIB3RAOO.mjs} +4 -4
  63. package/dist/chunk-PIXLJD7Y.mjs +37 -0
  64. package/dist/chunk-PTS3BZHK.mjs +1 -0
  65. package/dist/chunk-Q6I5J3IJ.mjs +1 -0
  66. package/dist/chunk-QOZCSS3B.mjs +44 -0
  67. package/dist/chunk-QSFPUODQ.mjs +34 -0
  68. package/dist/chunk-RY7QUBJI.mjs +34 -0
  69. package/dist/chunk-RZJRUG2I.mjs +55 -0
  70. package/dist/chunk-S3GGSQB5.mjs +1 -0
  71. package/dist/chunk-S3HRT5Z5.mjs +14 -0
  72. package/dist/chunk-SB7HBCCZ.mjs +49 -0
  73. package/dist/chunk-SEXTT3NJ.mjs +25 -0
  74. package/dist/chunk-SKEQCOPX.mjs +43 -0
  75. package/dist/chunk-TLBRVWD2.mjs +1 -0
  76. package/dist/chunk-TOOCHDUY.mjs +36 -0
  77. package/dist/chunk-TSKANLT4.mjs +37 -0
  78. package/dist/chunk-UAMZEZUI.mjs +36 -0
  79. package/dist/chunk-UQJ4XNWN.mjs +26 -0
  80. package/dist/chunk-VDSUUXCH.mjs +34 -0
  81. package/dist/chunk-VO7RY2ZK.mjs +44 -0
  82. package/dist/chunk-WJKDFBJ2.mjs +34 -0
  83. package/dist/chunk-WTC7PY7U.mjs +54 -0
  84. package/dist/chunk-WXDV7CMB.mjs +14 -0
  85. package/dist/chunk-X5FG3X6T.mjs +1 -0
  86. package/dist/chunk-X66DY4AZ.mjs +1 -0
  87. package/dist/chunk-XXSJXKWQ.mjs +44 -0
  88. package/dist/chunk-YZMVAQQG.mjs +1 -0
  89. package/dist/chunk-ZCXPZU7W.mjs +20 -0
  90. package/dist/chunk-ZJ4PNVYO.mjs +52 -0
  91. package/dist/chunk-ZU4QJLEY.mjs +53 -0
  92. package/dist/components/ingredients/ingredients-list.d.mts +4 -1
  93. package/dist/components/ingredients/ingredients-list.d.ts +4 -1
  94. package/dist/components/ingredients/ingredients-list.js +2 -1
  95. package/dist/components/ingredients/ingredients-list.mjs +1 -1
  96. package/dist/components/instructions/instruction-list.d.mts +4 -1
  97. package/dist/components/instructions/instruction-list.d.ts +4 -1
  98. package/dist/components/instructions/instruction-list.js +1 -1
  99. package/dist/components/instructions/instruction-list.mjs +1 -1
  100. package/dist/components/layouts/layout-default.d.mts +1 -1
  101. package/dist/components/layouts/layout-default.d.ts +1 -1
  102. package/dist/components/layouts/layout-types.d.mts +2 -2
  103. package/dist/components/layouts/layout-types.d.ts +2 -2
  104. package/dist/components/layouts/layout-types.js +1 -1
  105. package/dist/components/measurement-select.d.mts +13 -0
  106. package/dist/components/measurement-select.d.ts +13 -0
  107. package/dist/components/measurement-select.js +1 -0
  108. package/dist/components/measurement-select.mjs +1 -0
  109. package/dist/components/root.d.mts +2 -1
  110. package/dist/components/root.d.ts +2 -1
  111. package/dist/components/root.js +1 -1
  112. package/dist/components/root.mjs +1 -1
  113. package/dist/components/servings-select.d.mts +11 -0
  114. package/dist/components/servings-select.d.ts +11 -0
  115. package/dist/components/servings-select.js +1 -0
  116. package/dist/components/servings-select.mjs +1 -0
  117. package/dist/components/thumbnail.js +1 -1
  118. package/dist/components/thumbnail.mjs +1 -1
  119. package/dist/global-context.d.mts +17 -4
  120. package/dist/global-context.d.ts +17 -4
  121. package/dist/global-context.js +1 -1
  122. package/dist/global-context.mjs +1 -1
  123. package/dist/hooks/use-controllable.d.mts +15 -0
  124. package/dist/hooks/use-controllable.d.ts +15 -0
  125. package/dist/hooks/use-controllable.js +1 -0
  126. package/dist/hooks/use-controllable.mjs +1 -0
  127. package/dist/index.d.mts +3 -1
  128. package/dist/index.d.ts +3 -1
  129. package/dist/index.js +2 -1
  130. package/dist/index.mjs +1 -1
  131. package/dist/recipe-context.d.mts +22 -7
  132. package/dist/recipe-context.d.ts +22 -7
  133. package/dist/recipe-context.js +1 -1
  134. package/dist/recipe-context.mjs +1 -1
  135. package/dist/types-from-core.d.mts +1 -0
  136. package/dist/types-from-core.d.ts +1 -0
  137. package/dist/types-from-core.js +1 -0
  138. package/dist/types-from-core.mjs +1 -0
  139. package/package.json +2 -2
  140. package/dist/chunk-32VQC2BE.mjs +0 -1
  141. package/dist/chunk-6MAELCYD.mjs +0 -1
  142. package/dist/chunk-CB36WMX5.mjs +0 -24
  143. package/dist/chunk-GPTC24DR.mjs +0 -1
  144. package/dist/chunk-KYWBOSOP.mjs +0 -14
  145. package/dist/chunk-MBR257HS.mjs +0 -48
  146. package/dist/chunk-PLID2R4K.mjs +0 -48
  147. package/dist/chunk-PYOGNEQ3.mjs +0 -48
  148. package/dist/chunk-RZGBB6SL.mjs +0 -1
  149. package/dist/chunk-U7TL6PST.mjs +0 -1
@@ -0,0 +1 @@
1
+ import{a as o}from"./chunk-YZMVAQQG.mjs";import{AspectRatio as l}from"@radix-ui/react-aspect-ratio";import{jsx as s}from"react/jsx-runtime";function h(t){var i,a;let{thumbnail:e,name:r}=o();if(!e)throw new Error("Missing thumbnail image. Did you forget to set one?");let n=(i=t.style)!=null?i:{};return s(l,{"recipe-thumbnail":"",className:t.className,style:{width:"100%",...n},ratio:t.aspectRatio||1,children:s("img",{"recipe-thumbnail-image":"",style:{objectFit:"cover",width:"100%",height:"100%"},src:e,alt:(a=t.alt)!=null?a:r})})}export{h as a};
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-PBENQR7Y.mjs";import{jsx as l,jsxs as c}from"react/jsx-runtime";var o=[.5,1,2,3];function i(n){let{servings:t,setServings:r}=s();return l("select",{className:n.className,"recipe-servings-select":"",value:t,onChange:e=>{r(Number(e.target.value))},children:o.map(e=>c("option",{value:e,children:[e," serving",e!==1?"s":""]},e))})}export{i as a};
@@ -0,0 +1,44 @@
1
+ import {
2
+ useRecipeContext
3
+ } from "./chunk-ENGJXHYU.mjs";
4
+
5
+ // src/components/thumbnail.tsx
6
+ import { AspectRatio } from "@radix-ui/react-aspect-ratio";
7
+ import { jsx } from "react/jsx-runtime";
8
+ function Thumbnail(props) {
9
+ var _a, _b;
10
+ const { thumbnail, name } = useRecipeContext();
11
+ if (!thumbnail) {
12
+ throw new Error("Missing thumbnail image. Did you forget to set one?");
13
+ }
14
+ const propStyle = (_a = props.style) != null ? _a : {};
15
+ return /* @__PURE__ */ jsx(
16
+ AspectRatio,
17
+ {
18
+ "recipe-thumbnail": "",
19
+ className: props.className,
20
+ style: {
21
+ width: "100%",
22
+ ...propStyle
23
+ },
24
+ ratio: props.aspectRatio || 1,
25
+ children: /* @__PURE__ */ jsx(
26
+ "img",
27
+ {
28
+ "recipe-thumbnail-image": "",
29
+ style: {
30
+ objectFit: "cover",
31
+ width: "100%",
32
+ height: "100%"
33
+ },
34
+ src: thumbnail,
35
+ alt: (_b = props.alt) != null ? _b : name
36
+ }
37
+ )
38
+ }
39
+ );
40
+ }
41
+
42
+ export {
43
+ Thumbnail
44
+ };
@@ -0,0 +1 @@
1
+ import{createContext as s,useContext as p,useState as C,useMemo as x}from"react";import{jsx as v}from"react/jsx-runtime";var i=s({});function a(){let e=p(i);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}function g({children:e,recipe:t}){let[o,n]=C(),r=x(()=>({...t,activeConversionKey:o,setConversionKey:c=>{n(c)}}),[t,o,n]);return v(i.Provider,{value:r,children:e})}export{a,g as b};
@@ -0,0 +1,20 @@
1
+ import {
2
+ useRecipeContext
3
+ } from "./chunk-A5JAKCMG.mjs";
4
+
5
+ // src/components/ingredients/ingredients-list.tsx
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ function IngredientList(props) {
8
+ const { ingredients, servings } = useRecipeContext();
9
+ return /* @__PURE__ */ jsx("ul", { "recipe-ingredient-list": "", className: props.className, children: ingredients.map((ingredient, i) => /* @__PURE__ */ jsxs("li", { "recipe-ingredient": "", children: [
10
+ ingredient.name,
11
+ " \u2014 ",
12
+ ingredient.amount.value,
13
+ " ",
14
+ ingredient.amount.unit
15
+ ] }, i)) });
16
+ }
17
+
18
+ export {
19
+ IngredientList
20
+ };
@@ -0,0 +1,52 @@
1
+ import {
2
+ useRecipeContext
3
+ } from "./chunk-7SBP7DC5.mjs";
4
+
5
+ // src/components/ingredients/ingredients-list.tsx
6
+ import {
7
+ IngredientUtils
8
+ } from "@recipe-book/core";
9
+ import { useMemo } from "react";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ function getIngredientAmount(ingredient, conversionKey) {
12
+ var _a;
13
+ if (!conversionKey) {
14
+ return ingredient.amount;
15
+ }
16
+ const conversion = (_a = ingredient.conversion) == null ? void 0 : _a[conversionKey];
17
+ if (!conversion) {
18
+ console.warn(
19
+ `No conversion found for ingredient "${ingredient.name}" with key "${conversionKey}"
20
+ Attempting conversion table lookup...`
21
+ );
22
+ const coerced = IngredientUtils.convert(
23
+ ingredient,
24
+ conversionKey
25
+ );
26
+ if (coerced) {
27
+ return coerced.amount;
28
+ }
29
+ return ingredient.amount;
30
+ }
31
+ return conversion;
32
+ }
33
+ function IngredientList(props) {
34
+ const { ingredients, activeConversionKey, measurements } = useRecipeContext();
35
+ const ingredientsWithAmounts = useMemo(() => {
36
+ ingredients.map((ingredient) => ({
37
+ ...ingredient,
38
+ amount: getIngredientAmount(ingredient, activeConversionKey)
39
+ }));
40
+ }, [ingredients, activeConversionKey, measurements]);
41
+ return /* @__PURE__ */ jsx("ul", { "recipe-ingredient-list": "", className: props.className, children: ingredientsWithAmounts.map((ingredient, i) => /* @__PURE__ */ jsxs("li", { "recipe-ingredient": "", children: [
42
+ ingredient.name,
43
+ " \u2014 ",
44
+ ingredient.amount.value,
45
+ " ",
46
+ ingredient.amount.unit
47
+ ] }, i)) });
48
+ }
49
+
50
+ export {
51
+ IngredientList
52
+ };
@@ -0,0 +1,53 @@
1
+ import {
2
+ useGlobalContext
3
+ } from "./chunk-SEXTT3NJ.mjs";
4
+ import {
5
+ RecipeContextProvider
6
+ } from "./chunk-ENGJXHYU.mjs";
7
+
8
+ // src/components/root.tsx
9
+ import { RecipeUtils } from "@recipe-book/core";
10
+ import { useMemo, useState } from "react";
11
+ import { jsx } from "react/jsx-runtime";
12
+ function Root(props) {
13
+ const [servings, setServings] = useState(1);
14
+ const { config: globalConfig } = useGlobalContext();
15
+ const recipe = useMemo(() => {
16
+ const finalConfig = {
17
+ ...globalConfig,
18
+ ...props.recipe
19
+ };
20
+ const _recipe = RecipeUtils.create(finalConfig);
21
+ return {
22
+ ..._recipe,
23
+ ingredients: _recipe.ingredients.map((ingredient) => ({
24
+ ...ingredient,
25
+ amount: {
26
+ ...ingredient.amount,
27
+ // scale the amount by the number of servings
28
+ value: ingredient.amount.value * servings
29
+ },
30
+ conversion: typeof ingredient.conversion === "object" ? {
31
+ ...ingredient.conversion,
32
+ [finalConfig.measurements]: ingredient.amount
33
+ } : (
34
+ // if conversion is a string, it's a unit key
35
+ ingredient.conversion
36
+ )
37
+ }))
38
+ };
39
+ }, [globalConfig, props.recipe, servings]);
40
+ return /* @__PURE__ */ jsx(
41
+ RecipeContextProvider,
42
+ {
43
+ recipe,
44
+ servings,
45
+ setServings,
46
+ children: props.children
47
+ }
48
+ );
49
+ }
50
+
51
+ export {
52
+ Root
53
+ };
@@ -1,3 +1,6 @@
1
+ type IngredientListProps = {
2
+ className?: string;
3
+ };
1
4
  /**
2
5
  * Renders a list of ingredients from the recipe context.
3
6
  *
@@ -5,6 +8,6 @@
5
8
  * - `recipe-ingredient-list` (wrapper element)
6
9
  * - `recipe-ingredient` (ingredient elements)
7
10
  */
8
- declare function IngredientList(): JSX.Element;
11
+ declare function IngredientList(props: IngredientListProps): JSX.Element;
9
12
 
10
13
  export { IngredientList };
@@ -1,3 +1,6 @@
1
+ type IngredientListProps = {
2
+ className?: string;
3
+ };
1
4
  /**
2
5
  * Renders a list of ingredients from the recipe context.
3
6
  *
@@ -5,6 +8,6 @@
5
8
  * - `recipe-ingredient-list` (wrapper element)
6
9
  * - `recipe-ingredient` (ingredient elements)
7
10
  */
8
- declare function IngredientList(): JSX.Element;
11
+ declare function IngredientList(props: IngredientListProps): JSX.Element;
9
12
 
10
13
  export { IngredientList };
@@ -1 +1,2 @@
1
- var c=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var o in e)c(t,o,{get:e[o],enumerable:!0})},d=(t,e,o,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of R(e))!u.call(t,n)&&n!==o&&c(t,n,{get:()=>e[n],enumerable:!(p=x(e,n))||p.enumerable});return t};var f=t=>d(c({},"__esModule",{value:!0}),t);var l={};C(l,{IngredientList:()=>m});module.exports=f(l);var i=require("react"),a=require("react/jsx-runtime"),g=(0,i.createContext)({});function s(){let t=(0,i.useContext)(g);if(!t)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return t}var r=require("react/jsx-runtime");function m(){let{config:t}=s();return(0,r.jsx)("ul",{"recipe-ingredient-list":"",children:t.ingredients.map((e,o)=>(0,r.jsxs)("li",{"recipe-ingredient":"",children:[e.name," \u2014 ",e.amount.value," ",e.amount.unit]},o))})}0&&(module.exports={IngredientList});
1
+ var u=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var f=(e,n)=>{for(var t in n)u(e,t,{get:n[t],enumerable:!0})},g=(e,n,t,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of l(n))!d.call(e,o)&&o!==t&&u(e,o,{get:()=>n[o],enumerable:!(r=C(n,o))||r.enumerable});return e};var x=e=>g(u({},"__esModule",{value:!0}),e);var P={};f(P,{IngredientList:()=>I});module.exports=x(P);var m=require("@recipe-book/core");var s=require("react"),b=require("react/jsx-runtime"),R=(0,s.createContext)({});function a(){let e=(0,s.useContext)(R);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}var p=require("react"),c=require("react/jsx-runtime");function y(e,n){var r;if(!n)return e.amount;let t=(r=e.conversion)==null?void 0:r[n];if(!t){console.warn(`No conversion found for ingredient "${e.name}" with key "${n}"
2
+ Attempting conversion table lookup...`);let o=m.IngredientUtils.convert(e,n);return o?o.amount:e.amount}return t}function I(e){let{ingredients:n,activeConversionKey:t,measurements:r}=a(),o=(0,p.useMemo)(()=>t===r?n:n.map(i=>({...i,amount:y(i,t)})),[n,t,r]);return(0,c.jsx)("ul",{"recipe-ingredient-list":"",className:e.className,children:o.map((i,v)=>(0,c.jsxs)("li",{"recipe-ingredient":"",children:[i.name," \u2014 ",i.amount.value," ",i.amount.unit]},v))})}0&&(module.exports={IngredientList});
@@ -1 +1 @@
1
- import{a}from"../../chunk-U7TL6PST.mjs";import"../../chunk-32VQC2BE.mjs";export{a as IngredientList};
1
+ import{a}from"../../chunk-GM5F7IUT.mjs";import"../../chunk-PBENQR7Y.mjs";export{a as IngredientList};
@@ -1,3 +1,6 @@
1
+ type InstructionListProps = {
2
+ className?: string;
3
+ };
1
4
  /**
2
5
  * Renders a list of instructions from the recipe context.
3
6
  *
@@ -5,6 +8,6 @@
5
8
  * - `recipe-instruction-list` (wrapper element)
6
9
  * - `recipe-instruction` (instruction elements, value is the instruction number)
7
10
  */
8
- declare function InstructionList(): JSX.Element;
11
+ declare function InstructionList(props: InstructionListProps): JSX.Element;
9
12
 
10
13
  export { InstructionList };
@@ -1,3 +1,6 @@
1
+ type InstructionListProps = {
2
+ className?: string;
3
+ };
1
4
  /**
2
5
  * Renders a list of instructions from the recipe context.
3
6
  *
@@ -5,6 +8,6 @@
5
8
  * - `recipe-instruction-list` (wrapper element)
6
9
  * - `recipe-instruction` (instruction elements, value is the instruction number)
7
10
  */
8
- declare function InstructionList(): JSX.Element;
11
+ declare function InstructionList(props: InstructionListProps): JSX.Element;
9
12
 
10
13
  export { InstructionList };
@@ -1 +1 @@
1
- var r=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var o in t)r(e,o,{get:t[o],enumerable:!0})},f=(e,t,o,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of R(t))!u.call(e,i)&&i!==o&&r(e,i,{get:()=>t[i],enumerable:!(p=x(t,i))||p.enumerable});return e};var d=e=>f(r({},"__esModule",{value:!0}),e);var P={};C(P,{InstructionList:()=>l});module.exports=d(P);var n=require("react"),a=require("react/jsx-runtime"),g=(0,n.createContext)({});function s(){let e=(0,n.useContext)(g);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}var c=require("react/jsx-runtime");function l(){let{config:e}=s();return(0,c.jsx)("ul",{"recipe-instruction-list":"",children:e.instructions.map((t,o)=>(0,c.jsx)("li",{"recipe-instruction":o+1,children:t},o))})}0&&(module.exports={InstructionList});
1
+ var s=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var C=Object.prototype.hasOwnProperty;var a=(e,o)=>{for(var t in o)s(e,t,{get:o[t],enumerable:!0})},l=(e,o,t,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of v(o))!C.call(e,r)&&r!==t&&s(e,r,{get:()=>o[r],enumerable:!(i=u(o,r))||i.enumerable});return e};var x=e=>l(s({},"__esModule",{value:!0}),e);var f={};a(f,{InstructionList:()=>d});module.exports=x(f);var n=require("react"),m=require("react/jsx-runtime"),R=(0,n.createContext)({});function p(){let e=(0,n.useContext)(R);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}var c=require("react/jsx-runtime");function d(e){let{instructions:o}=p();return(0,c.jsx)("ol",{"recipe-instruction-list":"",className:e.className,children:o.map((t,i)=>(0,c.jsx)("li",{"recipe-instruction":i+1,children:t},i))})}0&&(module.exports={InstructionList});
@@ -1 +1 @@
1
- import{a}from"../../chunk-GPTC24DR.mjs";import"../../chunk-32VQC2BE.mjs";export{a as InstructionList};
1
+ import{a}from"../../chunk-2VMRVR3X.mjs";import"../../chunk-PBENQR7Y.mjs";export{a as InstructionList};
@@ -1,6 +1,6 @@
1
1
  import { LayoutProps } from './layout-types.mjs';
2
2
  import 'react';
3
- import 'recipe-core';
3
+ import '@recipe-book/core';
4
4
 
5
5
  declare function DefaultLayout({ children }: LayoutProps): JSX.Element;
6
6
 
@@ -1,6 +1,6 @@
1
1
  import { LayoutProps } from './layout-types.js';
2
2
  import 'react';
3
- import 'recipe-core';
3
+ import '@recipe-book/core';
4
4
 
5
5
  declare function DefaultLayout({ children }: LayoutProps): JSX.Element;
6
6
 
@@ -1,8 +1,8 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { Recipe } from 'recipe-core';
2
+ import { Recipe } from '@recipe-book/core';
3
3
 
4
4
  type LayoutProps = PropsWithChildren & {
5
- recipe: Recipe<any>;
5
+ recipe: Recipe;
6
6
  };
7
7
 
8
8
  export type { LayoutProps };
@@ -1,8 +1,8 @@
1
1
  import { PropsWithChildren } from 'react';
2
- import { Recipe } from 'recipe-core';
2
+ import { Recipe } from '@recipe-book/core';
3
3
 
4
4
  type LayoutProps = PropsWithChildren & {
5
- recipe: Recipe<any>;
5
+ recipe: Recipe;
6
6
  };
7
7
 
8
8
  export type { LayoutProps };
@@ -1 +1 @@
1
- var o=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var n=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of m(r))!c.call(e,p)&&p!==t&&o(e,p,{get:()=>r[p],enumerable:!(i=h(r,p))||i.enumerable});return e};var s=e=>n(o({},"__esModule",{value:!0}),e);var y={};module.exports=s(y);
1
+ var o=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var s=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let p of m(r))!c.call(e,p)&&p!==t&&o(e,p,{get:()=>r[p],enumerable:!(i=h(r,p))||i.enumerable});return e};var P=e=>s(o({},"__esModule",{value:!0}),e);var d={};module.exports=P(d);
@@ -0,0 +1,13 @@
1
+ type MeasurementSelectProps = {
2
+ className?: string;
3
+ };
4
+ /**
5
+ * A component that allows the user to select between US and metric
6
+ * measurements.
7
+ *
8
+ * TODO - Rename this component
9
+ * TODO - Allow more robust styling, fully composable with className
10
+ */
11
+ declare function MeasurementSelect(props: MeasurementSelectProps): JSX.Element;
12
+
13
+ export { MeasurementSelect };
@@ -0,0 +1,13 @@
1
+ type MeasurementSelectProps = {
2
+ className?: string;
3
+ };
4
+ /**
5
+ * A component that allows the user to select between US and metric
6
+ * measurements.
7
+ *
8
+ * TODO - Rename this component
9
+ * TODO - Allow more robust styling, fully composable with className
10
+ */
11
+ declare function MeasurementSelect(props: MeasurementSelectProps): JSX.Element;
12
+
13
+ export { MeasurementSelect };
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var v=(e,t)=>{for(var o in t)c(e,o,{get:t[o],enumerable:!0})},C=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of p(t))!m.call(e,r)&&r!==o&&c(e,r,{get:()=>t[r],enumerable:!(s=u(t,r))||s.enumerable});return e};var l=e=>C(c({},"__esModule",{value:!0}),e);var b={};v(b,{MeasurementSelect:()=>R});module.exports=l(b);var n=require("react"),x=require("react/jsx-runtime"),d=(0,n.createContext)({});function a(){let e=(0,n.useContext)(d);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}var i=require("react/jsx-runtime");function R(e){let{activeConversionKey:t,setConversionKey:o,measurements:s}=a();if(s===void 0)throw new Error("Cannot select measurement without base measurement");return(0,i.jsxs)("div",{"recipe-measurement-select":"",className:e.className,children:[(0,i.jsx)("button",{"recipe-measurement-option":"","data-active":t==="us-customary",onClick:()=>o("us-customary"),children:"US"}),(0,i.jsx)("button",{"recipe-measurement-option":"","data-active":t==="metric",onClick:()=>o("metric"),children:"Metric"})]})}0&&(module.exports={MeasurementSelect});
@@ -0,0 +1 @@
1
+ import{a}from"../chunk-TLBRVWD2.mjs";import"../chunk-PBENQR7Y.mjs";export{a as MeasurementSelect};
@@ -1,7 +1,8 @@
1
+ import { RecipeConfig } from '@recipe-book/core';
1
2
  import { PropsWithChildren } from 'react';
2
3
 
3
4
  type RootProps = PropsWithChildren & {
4
- config?: any;
5
+ recipe?: RecipeConfig;
5
6
  };
6
7
  /**
7
8
  * Provides recipe data to children for rendering. Inherits configuration
@@ -1,7 +1,8 @@
1
+ import { RecipeConfig } from '@recipe-book/core';
1
2
  import { PropsWithChildren } from 'react';
2
3
 
3
4
  type RootProps = PropsWithChildren & {
4
- config?: any;
5
+ recipe?: RecipeConfig;
5
6
  };
6
7
  /**
7
8
  * Provides recipe data to children for rendering. Inherits configuration
@@ -1 +1 @@
1
- var i=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(o,e)=>{for(var t in e)i(o,t,{get:e[t],enumerable:!0})},P=(o,e,t,p)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of s(e))!d.call(o,n)&&n!==t&&i(o,n,{get:()=>e[n],enumerable:!(p=R(e,n))||p.enumerable});return o};var u=o=>P(i({},"__esModule",{value:!0}),o);var y={};g(y,{Root:()=>m});module.exports=u(y);var f=require("react");var c=require("react"),C=require("react/jsx-runtime"),b=(0,c.createContext)({});function l({children:o,config:e}){return(0,C.jsx)(b.Provider,{value:{config:e},children:o})}var r=require("react"),G=require("react/jsx-runtime"),v=(0,r.createContext)({});function x(){return(0,r.useContext)(v)}var a=require("react/jsx-runtime");function m(o){let{config:e}=x(),t=(0,f.useMemo)(()=>({...e,...o.config}),[e,o.config]);return(0,a.jsx)(l,{config:t,children:o.children})}0&&(module.exports={Root});
1
+ var C=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var P=(o,e)=>{for(var n in e)C(o,n,{get:e[n],enumerable:!0})},g=(o,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of b(e))!d.call(o,t)&&t!==n&&C(o,t,{get:()=>e[t],enumerable:!(i=R(e,t))||i.enumerable});return o};var G=o=>g(C({},"__esModule",{value:!0}),o);var T={};P(T,{Root:()=>S});module.exports=G(T);var f=require("@recipe-book/core"),a=require("react");var s=require("react"),u=require("react/jsx-runtime"),y=(0,s.createContext)({});function v({children:o,recipe:e,servings:n,setServings:i}){let[t,c]=(0,s.useState)(e.measurements),p=(0,s.useMemo)(()=>({...e,activeConversionKey:t,setConversionKey:r=>{c(r)},servings:n,setServings:i}),[e,t,c,n,i]);return(0,u.jsx)(y.Provider,{value:p,children:o})}var l=require("react"),K=require("react/jsx-runtime"),h=(0,l.createContext)({});function x(){let o=(0,l.useContext)(h);return o||{config:{}}}var m=require("react/jsx-runtime");function S(o){let[e,n]=(0,a.useState)(1),{config:i}=x(),t=(0,a.useMemo)(()=>{let c={...i,...o.recipe},p=f.RecipeUtils.create(c);return{...p,ingredients:p.ingredients.map(r=>({...r,amount:{...r.amount,value:r.amount.value*e},conversion:typeof r.conversion=="object"?{...r.conversion,[c.measurements]:r.amount.value*e}:r.conversion}))}},[i,o.recipe,e]);return(0,m.jsx)(v,{recipe:t,servings:e,setServings:n,children:o.children})}0&&(module.exports={Root});
@@ -1 +1 @@
1
- import{a}from"../chunk-6MAELCYD.mjs";import"../chunk-QOCKR2HO.mjs";import"../chunk-32VQC2BE.mjs";export{a as Root};
1
+ import{a}from"../chunk-PTS3BZHK.mjs";import"../chunk-Q6I5J3IJ.mjs";import"../chunk-PBENQR7Y.mjs";export{a as Root};
@@ -0,0 +1,11 @@
1
+ type ServingsSelectProps = {
2
+ className?: string | undefined;
3
+ };
4
+ /**
5
+ * Select component for choosing the number of servings.
6
+ * TODO: Rename this component
7
+ * TODO: Add preset props, inherit from global
8
+ */
9
+ declare function ServingsSelect(props: ServingsSelectProps): JSX.Element;
10
+
11
+ export { ServingsSelect };
@@ -0,0 +1,11 @@
1
+ type ServingsSelectProps = {
2
+ className?: string | undefined;
3
+ };
4
+ /**
5
+ * Select component for choosing the number of servings.
6
+ * TODO: Rename this component
7
+ * TODO: Add preset props, inherit from global
8
+ */
9
+ declare function ServingsSelect(props: ServingsSelectProps): JSX.Element;
10
+
11
+ export { ServingsSelect };
@@ -0,0 +1 @@
1
+ var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var a=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var C=(e,o)=>{for(var t in o)c(e,t,{get:o[t],enumerable:!0})},l=(e,o,t,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of a(o))!u.call(e,i)&&i!==t&&c(e,i,{get:()=>o[i],enumerable:!(n=p(o,i))||n.enumerable});return e};var x=e=>l(c({},"__esModule",{value:!0}),e);var f={};C(f,{ServingsSelect:()=>d});module.exports=x(f);var r=require("react"),g=require("react/jsx-runtime"),R=(0,r.createContext)({});function v(){let e=(0,r.useContext)(R);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}var s=require("react/jsx-runtime"),m=[.5,1,2,3];function d(e){let{servings:o,setServings:t}=v();return(0,s.jsx)("select",{className:e.className,"recipe-servings-select":"",value:o,onChange:n=>{t(Number(n.target.value))},children:m.map(n=>(0,s.jsxs)("option",{value:n,children:[n," serving",n!==1?"s":""]},n))})}0&&(module.exports={ServingsSelect});
@@ -0,0 +1 @@
1
+ import{a}from"../chunk-X66DY4AZ.mjs";import"../chunk-PBENQR7Y.mjs";export{a as ServingsSelect};
@@ -1 +1 @@
1
- var c=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var u=(e,t)=>{for(var o in t)c(e,o,{get:t[o],enumerable:!0})},f=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of R(t))!l.call(e,i)&&i!==o&&c(e,i,{get:()=>t[i],enumerable:!(n=m(t,i))||n.enumerable});return e};var g=e=>f(c({},"__esModule",{value:!0}),e);var h={};u(h,{Thumbnail:()=>d});module.exports=g(h);var p=require("@radix-ui/react-aspect-ratio");var r=require("react"),C=require("react/jsx-runtime"),x=(0,r.createContext)({});function a(){let e=(0,r.useContext)(x);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}var s=require("react/jsx-runtime");function d(e){var n,i;let{config:t}=a();if(!t.thumbnail)throw new Error("Missing thumbnail image. Did you forget to set one?");let o=(n=e.style)!=null?n:{};return(0,s.jsx)(p.AspectRatio,{"recipe-thumbnail":"",className:e.className,style:{width:"100%",...o},ratio:e.aspectRatio||1,children:(0,s.jsx)("img",{"recipe-thumbnail-image":"",style:{objectFit:"cover",width:"100%",height:"100%"},src:t.thumbnail,alt:(i=e.alt)!=null?i:t.name})})}0&&(module.exports={Thumbnail});
1
+ var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var C=(e,t)=>{for(var i in t)s(e,i,{get:t[i],enumerable:!0})},R=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of m(t))!v.call(e,o)&&o!==i&&s(e,o,{get:()=>t[o],enumerable:!(r=l(t,o))||r.enumerable});return e};var b=e=>R(s({},"__esModule",{value:!0}),e);var g={};C(g,{Thumbnail:()=>d});module.exports=b(g);var u=require("@radix-ui/react-aspect-ratio");var n=require("react"),y=require("react/jsx-runtime"),x=(0,n.createContext)({});function p(){let e=(0,n.useContext)(x);if(!e)throw new Error("Missing recipe context. Are you using <Recipe.Root />?");return e}var c=require("react/jsx-runtime");function d(e){var o,a;let{thumbnail:t,name:i}=p();if(!t)throw new Error("Missing thumbnail image. Did you forget to set one?");let r=(o=e.style)!=null?o:{};return(0,c.jsx)(u.AspectRatio,{"recipe-thumbnail":"",className:e.className,style:{width:"100%",...r},ratio:e.aspectRatio||1,children:(0,c.jsx)("img",{"recipe-thumbnail-image":"",style:{objectFit:"cover",width:"100%",height:"100%"},src:t,alt:(a=e.alt)!=null?a:i})})}0&&(module.exports={Thumbnail});
@@ -1 +1 @@
1
- import{a}from"../chunk-RZGBB6SL.mjs";import"../chunk-32VQC2BE.mjs";export{a as Thumbnail};
1
+ import{a}from"../chunk-4XBZKTOL.mjs";import"../chunk-PBENQR7Y.mjs";export{a as Thumbnail};
@@ -1,16 +1,29 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { GlobalRecipeConfig } from 'recipe-core';
3
+ import { GlobalRecipeConfig } from '@recipe-book/core';
4
4
 
5
5
  type GlobalContext = {
6
- config: GlobalRecipeConfig<any>;
6
+ config: GlobalRecipeConfig;
7
7
  };
8
+ /** The global `recipe-book` context. */
8
9
  declare const GlobalContext: react.Context<GlobalContext>;
9
- declare function useGlobalContext(): GlobalContext;
10
+ /**
11
+ * Hook to access the global `recipe-book` context.
12
+ */
13
+ declare function useGlobalContext(): {
14
+ readonly config: {};
15
+ };
10
16
  interface GlobalContextProviderProps {
11
17
  children: ReactNode;
12
- config: GlobalRecipeConfig<any>;
18
+ config: GlobalRecipeConfig;
13
19
  }
20
+ /**
21
+ * Provider for the global `recipe-book` context. This provider
22
+ * is used to create a global configuration that is inherited
23
+ * by individual recipe `Root`s.
24
+ *
25
+ * @param props -- The global configuration to be used by all recipes
26
+ */
14
27
  declare function GlobalContextProvider({ children, config, }: GlobalContextProviderProps): JSX.Element;
15
28
 
16
29
  export { GlobalContext, GlobalContextProvider, useGlobalContext };
@@ -1,16 +1,29 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { GlobalRecipeConfig } from 'recipe-core';
3
+ import { GlobalRecipeConfig } from '@recipe-book/core';
4
4
 
5
5
  type GlobalContext = {
6
- config: GlobalRecipeConfig<any>;
6
+ config: GlobalRecipeConfig;
7
7
  };
8
+ /** The global `recipe-book` context. */
8
9
  declare const GlobalContext: react.Context<GlobalContext>;
9
- declare function useGlobalContext(): GlobalContext;
10
+ /**
11
+ * Hook to access the global `recipe-book` context.
12
+ */
13
+ declare function useGlobalContext(): {
14
+ readonly config: {};
15
+ };
10
16
  interface GlobalContextProviderProps {
11
17
  children: ReactNode;
12
- config: GlobalRecipeConfig<any>;
18
+ config: GlobalRecipeConfig;
13
19
  }
20
+ /**
21
+ * Provider for the global `recipe-book` context. This provider
22
+ * is used to create a global configuration that is inherited
23
+ * by individual recipe `Root`s.
24
+ *
25
+ * @param props -- The global configuration to be used by all recipes
26
+ */
14
27
  declare function GlobalContextProvider({ children, config, }: GlobalContextProviderProps): JSX.Element;
15
28
 
16
29
  export { GlobalContext, GlobalContextProvider, useGlobalContext };
@@ -1 +1 @@
1
- var r=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var G=(e,o)=>{for(var l in o)r(e,l,{get:o[l],enumerable:!0})},p=(e,o,l,i)=>{if(o&&typeof o=="object"||typeof o=="function")for(let t of b(o))!c.call(e,t)&&t!==l&&r(e,t,{get:()=>o[t],enumerable:!(i=x(o,t))||i.enumerable});return e};var f=e=>p(r({},"__esModule",{value:!0}),e);var u={};G(u,{GlobalContext:()=>a,GlobalContextProvider:()=>P,useGlobalContext:()=>d});module.exports=f(u);var n=require("react"),C=require("react/jsx-runtime"),a=(0,n.createContext)({});function d(){return(0,n.useContext)(a)}function P({children:e,config:o}){return(0,C.jsx)(a.Provider,{value:{config:o},children:e})}0&&(module.exports={GlobalContext,GlobalContextProvider,useGlobalContext});
1
+ var r=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var G=(o,t)=>{for(var n in t)r(o,n,{get:t[n],enumerable:!0})},f=(o,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of C(t))!b.call(o,e)&&e!==n&&r(o,e,{get:()=>t[e],enumerable:!(a=x(t,e))||a.enumerable});return o};var p=o=>f(r({},"__esModule",{value:!0}),o);var u={};G(u,{GlobalContext:()=>i,GlobalContextProvider:()=>s,useGlobalContext:()=>d});module.exports=p(u);var l=require("react"),c=require("react/jsx-runtime"),i=(0,l.createContext)({});function d(){let o=(0,l.useContext)(i);return o||{config:{}}}function s({children:o,config:t}){return(0,c.jsx)(i.Provider,{value:{config:t},children:o})}0&&(module.exports={GlobalContext,GlobalContextProvider,useGlobalContext});
@@ -1 +1 @@
1
- import{a,b,c}from"./chunk-QOCKR2HO.mjs";export{a as GlobalContext,c as GlobalContextProvider,b as useGlobalContext};
1
+ import{a,b,c}from"./chunk-Q6I5J3IJ.mjs";export{a as GlobalContext,c as GlobalContextProvider,b as useGlobalContext};
@@ -0,0 +1,15 @@
1
+ type UseControllableParams<T> = {
2
+ props?: T | undefined;
3
+ defaultProps?: T | undefined;
4
+ onChange?: (value: T) => void | undefined;
5
+ };
6
+ /**
7
+ * Hook for creating a controlled component. This hook is used to create
8
+ * controlled components that can be used with or without a value prop.
9
+ */
10
+ declare function useControllable<T>({ props, defaultProps, onChange, }: UseControllableParams<T>): {
11
+ value: T;
12
+ onChange: (value: T) => void;
13
+ };
14
+
15
+ export { useControllable };
@@ -0,0 +1,15 @@
1
+ type UseControllableParams<T> = {
2
+ props?: T | undefined;
3
+ defaultProps?: T | undefined;
4
+ onChange?: (value: T) => void | undefined;
5
+ };
6
+ /**
7
+ * Hook for creating a controlled component. This hook is used to create
8
+ * controlled components that can be used with or without a value prop.
9
+ */
10
+ declare function useControllable<T>({ props, defaultProps, onChange, }: UseControllableParams<T>): {
11
+ value: T;
12
+ onChange: (value: T) => void;
13
+ };
14
+
15
+ export { useControllable };
@@ -0,0 +1 @@
1
+ var t=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var T=(n,e)=>{for(var l in e)t(n,l,{get:e[l],enumerable:!0})},C=(n,e,l,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of i(e))!f.call(n,o)&&o!==l&&t(n,o,{get:()=>e[o],enumerable:!(a=s(e,o))||a.enumerable});return n};var c=n=>C(t({},"__esModule",{value:!0}),n);var m={};T(m,{useControllable:()=>h});module.exports=c(m);var r=require("react");function h({props:n,defaultProps:e,onChange:l}){let[a,o]=(0,r.useState)(e),d=n!==void 0;return{value:d?n:a,onChange:d?l:u=>{o(u),l&&l(u)}}}0&&(module.exports={useControllable});
@@ -0,0 +1 @@
1
+ import{useState as u}from"react";function i({props:n,defaultProps:a,onChange:e}){let[t,d]=u(a),l=n!==void 0;return{value:l?n:t,onChange:l?e:o=>{d(o),e&&e(o)}}}export{i as useControllable};
package/dist/index.d.mts CHANGED
@@ -2,7 +2,9 @@ export { Root as RecipeRoot, Root } from './components/root.mjs';
2
2
  export { IngredientList, IngredientList as RecipeIngredientList } from './components/ingredients/ingredients-list.mjs';
3
3
  export { InstructionList, InstructionList as RecipeInstructionList } from './components/instructions/instruction-list.mjs';
4
4
  export { Thumbnail as RecipeThumbnail, Thumbnail } from './components/thumbnail.mjs';
5
+ export { ServingsSelect as RecipeServingsSelect, ServingsSelect } from './components/servings-select.mjs';
6
+ export { MeasurementSelect, MeasurementSelect as RecipeMeasurementSelect } from './components/measurement-select.mjs';
5
7
  export { useRecipeContext as useRecipe } from './recipe-context.mjs';
6
8
  export { GlobalContextProvider as Provider } from './global-context.mjs';
9
+ export { GlobalRecipeConfig, Ingredient, IngredientAmount, Recipe, RecipeConfig, Unit, UnitAbbreviation, UnitKey, UnitName } from '@recipe-book/core';
7
10
  import 'react';
8
- import 'recipe-core';
package/dist/index.d.ts CHANGED
@@ -2,7 +2,9 @@ export { Root as RecipeRoot, Root } from './components/root.js';
2
2
  export { IngredientList, IngredientList as RecipeIngredientList } from './components/ingredients/ingredients-list.js';
3
3
  export { InstructionList, InstructionList as RecipeInstructionList } from './components/instructions/instruction-list.js';
4
4
  export { Thumbnail as RecipeThumbnail, Thumbnail } from './components/thumbnail.js';
5
+ export { ServingsSelect as RecipeServingsSelect, ServingsSelect } from './components/servings-select.js';
6
+ export { MeasurementSelect, MeasurementSelect as RecipeMeasurementSelect } from './components/measurement-select.js';
5
7
  export { useRecipeContext as useRecipe } from './recipe-context.js';
6
8
  export { GlobalContextProvider as Provider } from './global-context.js';
9
+ export { GlobalRecipeConfig, Ingredient, IngredientAmount, Recipe, RecipeConfig, Unit, UnitAbbreviation, UnitKey, UnitName } from '@recipe-book/core';
7
10
  import 'react';
8
- import 'recipe-core';