@ssingh465/recipe-ui 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/day-picker.js +1 -1
- package/dist/components/planner-day.js +1 -1
- package/dist/components/recipe-card.js +1 -1
- package/dist/components/recipe-grid.js +1 -1
- package/dist/components/skeleton-card.js +1 -1
- package/dist/types/components/day-picker/day-picker.d.ts +8 -1
- package/dist/types/components/planner-day/planner-day.d.ts +3 -0
- package/dist/types/components.d.ts +18 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as s,createEvent as i,h as
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as s,createEvent as i,h as t,Host as r,transformTag as a}from"@stencil/core/internal/client";import{C as n,a as o}from"./icons.js";const c=e(class extends s{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.planassign=i(this,"planassign",7),this.pickerclose=i(this,"pickerclose",7)}recipeId;days;label;planassign;pickerclose;isOpen=!1;activeIndex=0;async open(){this.openPanel()}triggerEl;panelEl;dayEls=[];reposition=()=>this.positionPanel();handleOutsideClick=e=>{const s=e.composedPath();this.triggerEl&&this.panelEl&&(s.includes(this.triggerEl)||s.includes(this.panelEl)||this.closePanel(!1))};disconnectedCallback(){window.removeEventListener("resize",this.reposition),window.removeEventListener("scroll",this.reposition,!0),document.removeEventListener("pointerdown",this.handleOutsideClick,!0)}positionPanel(){if(!this.triggerEl||!this.panelEl)return;const e=this.triggerEl.getBoundingClientRect(),s=window.innerHeight-e.bottom<320?e.top-(this.panelEl.offsetHeight||324)-4:e.bottom+4;this.panelEl.style.left=e.left+"px",this.panelEl.style.top=s+"px"}openPanel=()=>{this.isOpen=!0,this.activeIndex=0,requestAnimationFrame((()=>{this.panelEl?.showPopover?.(),this.positionPanel(),this.dayEls[0]?.focus(),window.addEventListener("resize",this.reposition),window.addEventListener("scroll",this.reposition,!0),document.addEventListener("pointerdown",this.handleOutsideClick,!0)}))};closePanel=e=>{this.isOpen&&(this.isOpen=!1,this.panelEl?.hidePopover?.(),window.removeEventListener("resize",this.reposition),window.removeEventListener("scroll",this.reposition,!0),document.removeEventListener("pointerdown",this.handleOutsideClick,!0),this.pickerclose.emit({}),e&&this.triggerEl?.focus())};get safeDays(){return Array.isArray(this.days)?this.days:[]}selectDay(e){e.occupied||(this.planassign.emit({recipeId:this.recipeId,day:e.day}),this.closePanel(!0))}focusIndex(e){const s=this.safeDays.length;0!==s&&(this.activeIndex=(e+s)%s,this.dayEls[this.activeIndex]?.focus())}handlePanelKeydown=e=>{switch(e.key){case"ArrowDown":e.preventDefault(),this.focusIndex(this.activeIndex+1);break;case"ArrowUp":e.preventDefault(),this.focusIndex(this.activeIndex-1);break;case"Home":e.preventDefault(),this.focusIndex(0);break;case"End":e.preventDefault(),this.focusIndex(this.safeDays.length-1);break;case"Tab":e.preventDefault();break;case"Escape":e.preventDefault(),this.closePanel(!0)}};render(){const{isOpen:e,activeIndex:s}=this,i=this.safeDays;return t(r,{key:"9c0028bf4d040fe92afc70ba0f11d60d8f3c007c"},t("button",{key:"339f7b550c1107c8e2b4fa4a4f5f7db53b9027f2",type:"button",part:"trigger",class:"trigger",ref:e=>this.triggerEl=e,"aria-haspopup":"true","aria-expanded":e?"true":"false",onClick:()=>this.isOpen?this.closePanel(!0):this.openPanel()},n(),t("span",{key:"777a8b33570cd791b9e325b2bb5642e9aaa67518"},this.label)),t("div",{key:"813813afe66c7082d47fb39ad8aefffc4ccc850c",part:"panel",class:"panel",popover:"manual",role:"group","aria-label":this.label,ref:e=>this.panelEl=e,onKeyDown:this.handlePanelKeydown},i.map(((e,i)=>t("button",{type:"button",part:"day",class:{day:!0,occupied:e.occupied},tabIndex:i===s?0:-1,"aria-disabled":e.occupied?"true":"false",ref:e=>{e&&(this.dayEls[i]=e)},onClick:()=>this.selectDay(e)},t("span",{class:"day-label"},e.label),e.occupied&&t("span",{class:"occupied-tag"},o(),"Already added"))))))}static get style(){return":host{display:inline-block;font-family:var(--rc-font-text, system-ui, sans-serif)}.trigger{display:inline-flex;align-items:center;gap:var(--rc-s-2, 0.5rem);height:36px;padding-inline:var(--rc-s-3, 0.75rem);min-width:44px;min-height:44px;background:transparent;color:var(--rc-text, #2a2420);border:1px solid var(--rc-border-strong, #d4c8b8);border-radius:var(--rc-radius-sm, 6px);font-size:var(--rc-fs-sm, 0.875rem);cursor:pointer}.trigger:focus-visible{outline:none;box-shadow:var(--rc-focus-ring, 0 0 0 2px #fff, 0 0 0 4px #2a2420)}.panel{position:fixed;width:14rem;margin:0;padding:var(--rc-s-2, 0.5rem);border:1px solid var(--rc-border, #e7dfd3);border-radius:var(--rc-radius-sm, 6px);background:var(--rc-surface, #fff);box-shadow:var(--rc-shadow-hover, 0 8px 24px rgba(0, 0, 0, 0.12));color:var(--rc-text, #2a2420);font-family:var(--rc-font-text, system-ui, sans-serif)}.panel:not(:popover-open){display:none}.day{display:flex;align-items:center;justify-content:space-between;width:100%;height:44px;padding-inline:var(--rc-s-2, 0.5rem);border:none;border-radius:var(--rc-radius-sm, 6px);background:transparent;color:var(--rc-text, #2a2420);font-size:var(--rc-fs-body, 1rem);text-align:start;cursor:pointer}.day:hover,.day:focus-visible{background:var(--rc-accent-subtle, #fbede4)}.day:focus-visible{outline:none;box-shadow:var(--rc-focus-ring, 0 0 0 2px #fff, 0 0 0 4px #2a2420)}.day.occupied{color:var(--rc-text-subtle, #8f8377);cursor:default}.day.occupied:hover{background:transparent}.occupied-tag{display:inline-flex;align-items:center;gap:var(--rc-s-1, 0.25rem);font-size:var(--rc-fs-xs, 0.75rem)}"}},[513,"day-picker",{recipeId:[1,"recipe-id"],days:[16],label:[1],isOpen:[32],activeIndex:[32],open:[64]}]),d=c,l=function(){"undefined"!=typeof customElements&&["day-picker"].forEach((e=>{"day-picker"===e&&(customElements.get(a(e))||customElements.define(a(e),c))}))};export{d as DayPicker,l as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as r,createEvent as a,h as t,Host as s,transformTag as n}from"@stencil/core/internal/client";import{A as i,T as o,b as c}from"./icons.js";const d=e(class extends r{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.entryremove=a(this,"entryremove",7),this.entrymoverequest=a(this,"entrymoverequest",7),this.daytoggle=a(this,"daytoggle",7)}day;dayLabel;entries=[];collapsed=!1;entryremove;entrymoverequest;daytoggle;handleToggle=()=>{this.daytoggle.emit({day:this.day,collapsed:!this.collapsed})};renderEntry(e){return t("li",{part:"entry",class:"entry",key:e.recipeId},e.thumbnail?t("img",{class:"thumb",src:e.thumbnail,alt:"",loading:"lazy",decoding:"async"}):t("span",{class:"thumb placeholder","aria-hidden":"true"}),t("
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as r,createEvent as a,h as t,Host as s,transformTag as n}from"@stencil/core/internal/client";import{A as i,T as o,b as c}from"./icons.js";const d=e(class extends r{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.entryremove=a(this,"entryremove",7),this.entrymoverequest=a(this,"entrymoverequest",7),this.daytoggle=a(this,"daytoggle",7),this.recipeselect=a(this,"recipeselect",7)}day;dayLabel;entries=[];collapsed=!1;entryremove;entrymoverequest;daytoggle;recipeselect;handleToggle=()=>{this.daytoggle.emit({day:this.day,collapsed:!this.collapsed})};renderEntry(e){return t("li",{part:"entry",class:"entry",key:e.recipeId},e.thumbnail?t("img",{class:"thumb",src:e.thumbnail,alt:"",loading:"lazy",decoding:"async"}):t("span",{class:"thumb placeholder","aria-hidden":"true"}),t("button",{type:"button",class:"name",onClick:()=>this.recipeselect.emit({recipeId:e.recipeId})},e.name),t("div",{class:"row-actions"},t("button",{type:"button",class:"icon-button","aria-label":"Move "+e.name,onClick:()=>this.entrymoverequest.emit({recipeId:e.recipeId,fromDay:this.day})},i()),t("button",{type:"button",class:"icon-button","aria-label":`Remove ${e.name} from ${this.dayLabel}`,onClick:()=>this.entryremove.emit({recipeId:e.recipeId,day:this.day})},o())))}render(){const{collapsed:e,dayLabel:r}=this,a=Array.isArray(this.entries)?this.entries:[];return t(s,{key:"e6b3560cfbc696ca0c4902cc74bb40cb9c5bf6d5"},t("section",{key:"9b7fdbee72bcc92cd9b621988269133e5d9e287e",part:"region",class:"region",role:"region","aria-label":r},t("div",{key:"a9ce34dd506ece4907bc9bc68e52f3a570ff774d",part:"header",class:"header"},t("h3",{key:"3959df89c98ce8b92893bd0464d9691d085a4fd3",class:"day-name"},r),t("span",{key:"45390ce9f831aeaf049a4656de62ea95eb92173a",class:"count"},a.length),t("button",{key:"91244baaaf01c45374813c77935dddc837b35559",type:"button",class:{toggle:!0,"is-collapsed":e},"aria-expanded":e?"false":"true","aria-label":e?"Expand "+r:"Collapse "+r,onClick:this.handleToggle},c())),!e&&(a.length?t("ul",{class:"entries"},a.map((e=>this.renderEntry(e)))):t("div",{class:"empty"},t("slot",{name:"empty"})))))}static get style(){return":host{display:block;font-family:var(--rc-font-text, system-ui, sans-serif)}.region{display:flex;flex-direction:column;height:100%;min-height:20rem;background:var(--rc-surface-sunken, #f6f1e9);border:1px solid var(--rc-border, #e7dfd3);border-radius:var(--rc-radius, 14px);padding:var(--rc-s-4, 1rem);gap:var(--rc-s-3, 0.75rem);color:var(--rc-text, #2a2420)}.header{display:flex;align-items:center;gap:var(--rc-s-2, 0.5rem)}.day-name{margin:0;flex:1;font-family:var(--rc-font-display, Georgia, serif);font-size:var(--rc-fs-h3, 1.25rem)}.count{color:var(--rc-text-muted, #6b5f55);font-size:var(--rc-fs-sm, 0.875rem)}.toggle{display:flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:none;background:transparent;color:var(--rc-text-muted, #6b5f55);cursor:pointer;transition:transform var(--rc-duration, 180ms) var(--rc-ease, ease)}.toggle.is-collapsed{transform:rotate(-90deg)}.toggle:focus-visible{outline:none;box-shadow:var(--rc-focus-ring, 0 0 0 2px #fff, 0 0 0 4px #2a2420);border-radius:var(--rc-radius-sm, 6px)}.entries{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:var(--rc-s-2, 0.5rem)}.entry{display:flex;align-items:center;gap:var(--rc-s-2, 0.5rem);padding:var(--rc-s-2, 0.5rem);background:var(--rc-surface, #fff);border:1px solid var(--rc-border, #e7dfd3);border-radius:var(--rc-radius-sm, 6px)}.thumb{flex:none;width:40px;height:40px;border-radius:var(--rc-radius-sm, 6px);object-fit:cover}.thumb.placeholder{background:var(--rc-border, #e7dfd3)}.name{flex:1;min-width:0;font-family:inherit;font-size:var(--rc-fs-sm, 0.875rem);color:inherit;background:transparent;border:none;padding:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:start;cursor:pointer}.name:hover{text-decoration:underline}.name:focus-visible{outline:none;box-shadow:var(--rc-focus-ring, 0 0 0 2px #fff, 0 0 0 4px #2a2420);border-radius:var(--rc-radius-sm, 6px)}.row-actions{display:flex;gap:var(--rc-s-1, 0.25rem)}.icon-button{display:flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:none;background:transparent;color:var(--rc-text-muted, #6b5f55);cursor:pointer}.icon-button:focus-visible{outline:none;box-shadow:var(--rc-focus-ring, 0 0 0 2px #fff, 0 0 0 4px #2a2420);border-radius:var(--rc-radius-sm, 6px)}.empty{flex:1;display:flex;align-items:center;justify-content:center;color:var(--rc-text-subtle, #8f8377);font-size:var(--rc-fs-sm, 0.875rem)}"}},[769,"planner-day",{day:[1],dayLabel:[1,"day-label"],entries:[16],collapsed:[4]}]),l=d,f=function(){"undefined"!=typeof customElements&&["planner-day"].forEach((e=>{"planner-day"===e&&(customElements.get(n(e))||customElements.define(n(e),d))}))};export{l as PlannerDay,f as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as r,createEvent as
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as r,createEvent as t,h as a,Host as i,transformTag as o}from"@stencil/core/internal/client";import{H as s}from"./icons.js";const c=[18,34,96,168,262,344],n=e(class extends r{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow(),this.favoritetoggle=t(this,"favoritetoggle",7),this.recipeselect=t(this,"recipeselect",7)}recipe;favorited=!1;href;favoritetoggle;recipeselect;handleTitleClick=e=>{0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),this.recipeselect.emit({recipeId:this.recipe.id}))};handleFavoriteClick=()=>{this.favoritetoggle.emit({recipeId:this.recipe.id})};renderMedia(){const{thumbnail:e,name:r}=this.recipe;if(e)return a("img",{part:"media",class:"media",src:e,alt:"",loading:"lazy",decoding:"async"});const t=function(e){let r=0;for(let t=0;t<e.length;t++)r+=e.charCodeAt(t);return c[r%c.length]}(r);return a("div",{part:"media",class:"media tile",style:{"--tile-h":t+""}},a("span",{class:"tile-name"},r))}render(){const{recipe:e,favorited:r,href:t}=this;return e&&"object"==typeof e?a(i,null,a("article",{part:"card",class:"card"},this.renderMedia(),a("div",{class:"body"},a("a",{part:"title",class:"title",href:t,onClick:this.handleTitleClick},e.name),a("p",{class:"meta"},[e.category,e.area].filter(Boolean).join(" · ")),a("div",{class:"actions-row"},a("button",{type:"button",class:"favorite","aria-pressed":r?"true":"false","aria-label":r?`Remove ${e.name} from favorites`:`Add ${e.name} to favorites`,onClick:this.handleFavoriteClick},s(r)),a("div",{part:"actions",class:"actions"},a("slot",{name:"actions"})))))):a(i,null)}static get style(){return":host{display:block;height:22rem;font-family:var(--rc-font-text, system-ui, sans-serif)}.card{display:flex;flex-direction:column;height:100%;background:var(--rc-surface, #fff);border:1px solid var(--rc-border, #e7dfd3);border-radius:var(--rc-radius, 14px);box-shadow:var(--rc-shadow, 0 1px 2px rgba(0, 0, 0, 0.06));overflow:hidden;transition:box-shadow var(--rc-duration, 180ms) var(--rc-ease, ease), border-color var(--rc-duration, 180ms) var(--rc-ease, ease), transform var(--rc-duration, 180ms) var(--rc-ease, ease)}.card:hover{box-shadow:var(--rc-shadow-hover, 0 2px 8px rgba(0, 0, 0, 0.08));border-color:var(--rc-border-strong, #d4c8b8);transform:translateY(-2px)}.media{height:12rem;flex:none;margin:0}img.media{width:100%;object-fit:cover}.media.tile{display:flex;align-items:center;justify-content:center;padding:var(--rc-s-4, 1rem);text-align:center;background:hsl(var(--tile-h) 42% 88%);color:hsl(var(--tile-h) 45% 28%)}@media (prefers-color-scheme: dark){.media.tile{background:hsl(var(--tile-h) 30% 22%);color:hsl(var(--tile-h) 35% 82%)}}.tile-name{font-family:var(--rc-font-display, Georgia, serif);font-size:var(--rc-fs-h3, 1.25rem);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.body{flex:1;min-height:0;display:flex;flex-direction:column;padding:var(--rc-s-4, 1rem);gap:var(--rc-s-2, 0.5rem)}.title{font-family:var(--rc-font-display, Georgia, serif);font-size:var(--rc-fs-h3, 1.25rem);color:var(--rc-text, #2a2420);text-decoration:none;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis}.title:focus-visible{outline:none;box-shadow:var(--rc-focus-ring, 0 0 0 2px #fff, 0 0 0 4px #2a2420);border-radius:var(--rc-radius-sm, 6px)}.meta{margin:0;font-size:var(--rc-fs-sm, 0.875rem);color:var(--rc-text-muted, #6b5f55)}.actions-row{margin-top:auto;display:flex;align-items:center;gap:var(--rc-s-2, 0.5rem)}.favorite{flex:none;display:flex;align-items:center;justify-content:center;width:44px;height:44px;padding:0;border:none;background:transparent;color:var(--rc-text-muted, #6b5f55);cursor:pointer;border-radius:var(--rc-radius-sm, 6px)}.favorite[aria-pressed='true']{color:var(--rc-accent, #bc4e1c)}.favorite:focus-visible{outline:none;box-shadow:var(--rc-focus-ring, 0 0 0 2px #fff, 0 0 0 4px #2a2420)}.actions{display:flex;align-items:center;gap:var(--rc-s-2, 0.5rem)}"}},[769,"recipe-card",{recipe:[16],favorited:[4],href:[1]}]),l=n,d=function(){"undefined"!=typeof customElements&&["recipe-card"].forEach((e=>{"recipe-card"===e&&(customElements.get(o(e))||customElements.define(o(e),n))}))};export{l as RecipeCard,d as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as t,h as r,Host as s,transformTag as c}from"@stencil/core/internal/client";const
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as t,h as r,Host as s,transformTag as c}from"@stencil/core/internal/client";const d=e(class extends t{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}columns=4;render(){return r(s,{key:"b307b429803a61d0163905e8e0752ffd276f0eca"},r("div",{key:"cf95edd18bc679d3aa8be431a12bf8ad87191202",part:"grid",class:"grid",style:{"--columns":this.columns+""}},r("slot",{key:"1e28d0a6e7fb180925e1cdf88dcf1bb5c2b8fef8"})))}static get style(){return":host{display:block}.grid{display:grid;grid-template-columns:repeat(var(--columns), 1fr);gap:var(--rc-s-4, 1rem)}"}},[769,"recipe-grid",{columns:[2]}]),i=d,n=function(){"undefined"!=typeof customElements&&["recipe-grid"].forEach((e=>{"recipe-grid"===e&&(customElements.get(c(e))||customElements.define(c(e),d))}))};export{i as RecipeGrid,n as defineCustomElement}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{proxyCustomElement as e,HTMLElement as r,h as t,Host as n,transformTag as a}from"@stencil/core/internal/client";const i=e(class extends r{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}count=1;render(){const e=Array.from({length:Math.max(1,this.count)});return t(n,{key:"
|
|
1
|
+
import{proxyCustomElement as e,HTMLElement as r,h as t,Host as n,transformTag as a}from"@stencil/core/internal/client";const i=e(class extends r{constructor(e){super(),!1!==e&&this.__registerHost(),this.__attachShadow()}count=1;render(){const e=Array.from({length:Math.max(1,this.count)});return t(n,{key:"d072f5e79cacb78baafc69a2e52e070fa5934805"},e.map(((e,r)=>t("div",{part:"skeleton",class:"skeleton",key:r,"aria-hidden":"true"},t("div",{class:"media"}),t("div",{class:"body"},t("div",{class:"line title"}),t("div",{class:"line meta"}))))))}static get style(){return":host{display:contents}.skeleton{height:22rem;display:flex;flex-direction:column;background:var(--rc-surface, #fff);border:1px solid var(--rc-border, #e7dfd3);border-radius:var(--rc-radius, 14px);overflow:hidden}.media{height:12rem;flex:none;background:var(--rc-surface-sunken, #f6f1e9);position:relative;overflow:hidden}.body{flex:1;padding:var(--rc-s-4, 1rem);display:flex;flex-direction:column;gap:var(--rc-s-2, 0.5rem)}.line{border-radius:var(--rc-radius-sm, 6px);background:var(--rc-surface-sunken, #f6f1e9);position:relative;overflow:hidden}.line.title{height:1.25rem;width:70%}.line.meta{height:0.875rem;width:45%}.media::after,.line::after{content:'';position:absolute;inset:0;background:linear-gradient(90deg, transparent, var(--rc-border, #e7dfd3) 50%, transparent);opacity:0.3;animation:shimmer 1.4s infinite}@keyframes shimmer{from{transform:translateX(-100%)}to{transform:translateX(100%)}}@media (prefers-reduced-motion: reduce){.media::after,.line::after{animation:none;transform:none;opacity:0.2}}"}},[513,"skeleton-card",{count:[2]}]),s=i,o=function(){"undefined"!=typeof customElements&&["skeleton-card"].forEach((e=>{"skeleton-card"===e&&(customElements.get(a(e))||customElements.define(a(e),i))}))};export{s as SkeletonCard,o as defineCustomElement}
|
|
@@ -8,6 +8,10 @@ import type { DayOfWeek, DayOption } from '../../utils/types';
|
|
|
8
8
|
* in the browser's top layer — the one mechanism that reliably escapes a
|
|
9
9
|
* card's `overflow: hidden` and any transformed ancestor's containing
|
|
10
10
|
* block, which plain `position: fixed` inside a shadow tree does not.
|
|
11
|
+
*
|
|
12
|
+
* `open()` lets a host open the panel without a user click on the trigger —
|
|
13
|
+
* needed when the picker is surfaced in response to some other control (the
|
|
14
|
+
* planner's `Move` action) rather than being the primary affordance on screen.
|
|
11
15
|
*/
|
|
12
16
|
export declare class DayPicker {
|
|
13
17
|
recipeId: string;
|
|
@@ -18,8 +22,10 @@ export declare class DayPicker {
|
|
|
18
22
|
day: DayOfWeek;
|
|
19
23
|
}>;
|
|
20
24
|
pickerclose: EventEmitter<Record<string, never>>;
|
|
21
|
-
|
|
25
|
+
isOpen: boolean;
|
|
22
26
|
activeIndex: number;
|
|
27
|
+
/** Opens the panel programmatically, exactly as a trigger click would. */
|
|
28
|
+
open(): Promise<void>;
|
|
23
29
|
private triggerEl?;
|
|
24
30
|
private panelEl?;
|
|
25
31
|
private dayEls;
|
|
@@ -29,6 +35,7 @@ export declare class DayPicker {
|
|
|
29
35
|
private positionPanel;
|
|
30
36
|
private openPanel;
|
|
31
37
|
private closePanel;
|
|
38
|
+
private get safeDays();
|
|
32
39
|
private selectDay;
|
|
33
40
|
private focusIndex;
|
|
34
41
|
private handlePanelKeydown;
|
|
@@ -17,10 +17,17 @@ export namespace Components {
|
|
|
17
17
|
* in the browser's top layer — the one mechanism that reliably escapes a
|
|
18
18
|
* card's `overflow: hidden` and any transformed ancestor's containing
|
|
19
19
|
* block, which plain `position: fixed` inside a shadow tree does not.
|
|
20
|
+
* `open()` lets a host open the panel without a user click on the trigger —
|
|
21
|
+
* needed when the picker is surfaced in response to some other control (the
|
|
22
|
+
* planner's `Move` action) rather than being the primary affordance on screen.
|
|
20
23
|
*/
|
|
21
24
|
interface DayPicker {
|
|
22
25
|
"days": DayOption[];
|
|
23
26
|
"label": string;
|
|
27
|
+
/**
|
|
28
|
+
* Opens the panel programmatically, exactly as a trigger click would.
|
|
29
|
+
*/
|
|
30
|
+
"open": () => Promise<void>;
|
|
24
31
|
"recipeId": string;
|
|
25
32
|
}
|
|
26
33
|
/**
|
|
@@ -138,6 +145,9 @@ declare global {
|
|
|
138
145
|
* in the browser's top layer — the one mechanism that reliably escapes a
|
|
139
146
|
* card's `overflow: hidden` and any transformed ancestor's containing
|
|
140
147
|
* block, which plain `position: fixed` inside a shadow tree does not.
|
|
148
|
+
* `open()` lets a host open the panel without a user click on the trigger —
|
|
149
|
+
* needed when the picker is surfaced in response to some other control (the
|
|
150
|
+
* planner's `Move` action) rather than being the primary affordance on screen.
|
|
141
151
|
*/
|
|
142
152
|
interface HTMLDayPickerElement extends Components.DayPicker, HTMLStencilElement {
|
|
143
153
|
addEventListener<K extends keyof HTMLDayPickerElementEventMap>(type: K, listener: (this: HTMLDayPickerElement, ev: DayPickerCustomEvent<HTMLDayPickerElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
|
@@ -189,6 +199,7 @@ declare global {
|
|
|
189
199
|
"entryremove": { recipeId: string; day: DayOfWeek };
|
|
190
200
|
"entrymoverequest": { recipeId: string; fromDay: DayOfWeek };
|
|
191
201
|
"daytoggle": { day: DayOfWeek; collapsed: boolean };
|
|
202
|
+
"recipeselect": { recipeId: string };
|
|
192
203
|
}
|
|
193
204
|
/**
|
|
194
205
|
* One day's column/section in the planner. Owns its complete accessible
|
|
@@ -299,6 +310,9 @@ declare namespace LocalJSX {
|
|
|
299
310
|
* in the browser's top layer — the one mechanism that reliably escapes a
|
|
300
311
|
* card's `overflow: hidden` and any transformed ancestor's containing
|
|
301
312
|
* block, which plain `position: fixed` inside a shadow tree does not.
|
|
313
|
+
* `open()` lets a host open the panel without a user click on the trigger —
|
|
314
|
+
* needed when the picker is surfaced in response to some other control (the
|
|
315
|
+
* planner's `Move` action) rather than being the primary affordance on screen.
|
|
302
316
|
*/
|
|
303
317
|
interface DayPicker {
|
|
304
318
|
"days": DayOption[];
|
|
@@ -346,6 +360,7 @@ declare namespace LocalJSX {
|
|
|
346
360
|
"onDaytoggle"?: (event: PlannerDayCustomEvent<{ day: DayOfWeek; collapsed: boolean }>) => void;
|
|
347
361
|
"onEntrymoverequest"?: (event: PlannerDayCustomEvent<{ recipeId: string; fromDay: DayOfWeek }>) => void;
|
|
348
362
|
"onEntryremove"?: (event: PlannerDayCustomEvent<{ recipeId: string; day: DayOfWeek }>) => void;
|
|
363
|
+
"onRecipeselect"?: (event: PlannerDayCustomEvent<{ recipeId: string }>) => void;
|
|
349
364
|
}
|
|
350
365
|
/**
|
|
351
366
|
* The app's primary discovery/favorites/planner unit. Fixed 22rem height
|
|
@@ -450,6 +465,9 @@ declare module "@stencil/core" {
|
|
|
450
465
|
* in the browser's top layer — the one mechanism that reliably escapes a
|
|
451
466
|
* card's `overflow: hidden` and any transformed ancestor's containing
|
|
452
467
|
* block, which plain `position: fixed` inside a shadow tree does not.
|
|
468
|
+
* `open()` lets a host open the panel without a user click on the trigger —
|
|
469
|
+
* needed when the picker is surfaced in response to some other control (the
|
|
470
|
+
* planner's `Move` action) rather than being the primary affordance on screen.
|
|
453
471
|
*/
|
|
454
472
|
"day-picker": LocalJSX.IntrinsicElements["day-picker"] & JSXBase.HTMLAttributes<HTMLDayPickerElement>;
|
|
455
473
|
/**
|