@mattilsynet/design 0.2.5 → 0.2.6
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/mtds/badge/badge.stories.d.ts +3 -0
- package/mtds/card/card.stories.d.ts +1 -0
- package/mtds/field/field.stories.d.ts +1 -0
- package/mtds/index.d.ts +28 -25
- package/mtds/index.iife.js +1 -3
- package/mtds/index.iife.js.map +1 -1
- package/mtds/popover/popover.d.ts +0 -1
- package/mtds/popover/popover.js +32 -37
- package/mtds/popover/popover.js.map +1 -1
- package/mtds/skeleton/skeleton.stories.d.ts +9 -0
- package/mtds/styles.css +1 -1
- package/mtds/styles.json +33 -30
- package/mtds/styles.module.css.js +68 -62
- package/mtds/styles.module.css.js.map +1 -1
- package/mtds/table/table.js +3 -3
- package/mtds/table/table.js.map +1 -1
- package/mtds/table/table.stories.d.ts +2 -1
- package/mtds/utils.d.ts +1 -1
- package/mtds/utils.js.map +1 -1
- package/package.json +10 -10
- package/mtds/nanopop.d.ts +0 -49
- package/mtds/nanopop.js +0 -65
- package/mtds/nanopop.js.map +0 -1
|
@@ -5,6 +5,7 @@ declare const meta: {
|
|
|
5
5
|
export default meta;
|
|
6
6
|
type Story = StoryObj<typeof meta>;
|
|
7
7
|
export declare const Default: Story;
|
|
8
|
+
export declare const Required: Story;
|
|
8
9
|
export declare const Toggles: Story;
|
|
9
10
|
export declare const WithValidation: Story;
|
|
10
11
|
export declare const WithAffixes: Story;
|
package/mtds/index.d.ts
CHANGED
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
export { pagination } from './pagination/pagination';
|
|
2
2
|
export declare const styles: {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
validation: string;
|
|
4
|
+
tag: string;
|
|
5
|
+
tabs: string;
|
|
6
|
+
table: string;
|
|
7
|
+
scrollShadow: string;
|
|
8
|
+
tableChildAdded: string;
|
|
9
|
+
skeleton: string;
|
|
10
|
+
popover: string;
|
|
11
|
+
pagination: string;
|
|
12
|
+
modal: string;
|
|
13
|
+
logo: string;
|
|
14
|
+
link: string;
|
|
15
|
+
grid: string;
|
|
16
|
+
flex: string;
|
|
17
|
+
box: string;
|
|
18
|
+
input: string;
|
|
19
|
+
fieldset: string;
|
|
20
|
+
fieldsetValidationAdded: string;
|
|
11
21
|
field: string;
|
|
12
22
|
fieldChildAdded: string;
|
|
13
23
|
affixes: string;
|
|
14
24
|
count: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
popover: string;
|
|
26
|
-
table: string;
|
|
27
|
-
scrollShadow: string;
|
|
28
|
-
tableChildAdded: string;
|
|
29
|
-
tabs: string;
|
|
30
|
-
tag: string;
|
|
31
|
-
validation: string;
|
|
25
|
+
errorsummary: string;
|
|
26
|
+
details: string;
|
|
27
|
+
chip: string;
|
|
28
|
+
card: string;
|
|
29
|
+
info: string;
|
|
30
|
+
button: string;
|
|
31
|
+
breadcrumbs: string;
|
|
32
|
+
badge: string;
|
|
33
|
+
avatar: string;
|
|
34
|
+
alert: string;
|
|
32
35
|
body: string;
|
|
33
36
|
};
|
|
34
37
|
export declare function observe(el: Element | Document): void;
|
package/mtds/index.iife.js
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var mtds=function(
|
|
2
|
-
- It must be [top|right|bottom|left]-[start|middle|end]
|
|
3
|
-
- Found on element:`,o);const i=()=>Ot(t,o,{container:{...Bt,bottom:window.innerHeight,right:window.innerWidth},margin:4,padding:16,position:e}),n=({newState:d})=>{d!=="open"&&(_(document,"DOMContentReady",i,r),_(o,"toggle",n,r),_(window,"load,resize,scroll",i,r))};document.fonts.ready.then(i),f(document,"DOMContentReady",i,r),f(o,"toggle",n,r),f(window,"load,resize,scroll",i,r)}function st({target:t,newState:o}){var n;const i=o==="open"&&t instanceof HTMLElement&&t.classList.contains(Nt)&&((n=t.getRootNode())==null?void 0:n.querySelector(`[popovertarget="${t.id}"]`));i&&kt(i,t)}function dt({target:t}){var e;const o=t instanceof Element&&t.closest("a[popovertarget]");if(o){const i=o.getRootNode(),n=(e=i.getElementById)==null?void 0:e.call(i,o.getAttribute("popovertarget")||""),d=o.getAttribute("popovertargetaction")||"toggle";n==null||n.togglePopover(d==="show"||(d==="hide"?!1:void 0))}}function Dt(t){f(t,"click",dt),f(t,"toggle",st,r)}function Ft(t){_(t,"click",dt),_(t,"toggle",st,r)}const Pt=l.table.split(" ")[0],at=new WeakMap;function Rt(t){var o,e;for(const i of t)if(i instanceof HTMLTableElement){const n=Array.from(((e=(o=i.tHead)==null?void 0:o.rows[0])==null?void 0:e.cells)||[],d=>{var s;return(s=d.innerText)==null?void 0:s.trim()});for(const d of i.tBodies)for(const s of d.rows)for(const m of s.cells)m.setAttribute("data-th",n[m.cellIndex]||"")}}function Vt(t){const o=t.getElementsByClassName(Pt),e=y(l.tableChildAdded,()=>Rt(o));at.set(t,e),e.observe(t)}function Ht(t){var o;(o=at.get(t))==null||o.disconnect(t)}const Wt=(t,o,e)=>{const i=(e-1)/2,n=Math.min(Math.max(t-Math.floor(i),1),o-e+1),d=Math.min(Math.max(t+Math.ceil(i),e),o),s=Array.from({length:d+1-n},(m,S)=>S+n);return e>4&&n>1&&s.splice(0,2,1,0),e>3&&d<o&&s.splice(-2,2,0,o),s},Ut=({current:t=1,total:o=10,show:e=7})=>({prev:t>1?t-1:0,next:t<o?t+1:0,pages:Wt(t,o,e).map((i,n)=>({current:i===t&&"page",key:`key-${i}-${n}`,page:i}))});pt&&rt(document);function rt(t){zt(t),Mt(t),Dt(t),Vt(t)}function jt(t){wt(t),It(t),Ft(t),Ht(t)}return u.observe=rt,u.pagination=Ut,u.styles=bt,u.unobserve=jt,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"}),u}({});
|
|
1
|
+
var mtds=function(b){"use strict";const h="_validation_12jx5_1 _ds-validation-message_14y6r_1",j="_tag_12jx5_1 _ds-tag_14y6r_1",A="_tabs_12jx5_1",S="_table_12jx5_1 _ds-table_14y6r_1",$="_scrollShadow_12jx5_1",M="_tableChildAdded_12jx5_1",E="_skeleton_12jx5_1 _ds-skeleton_14y6r_1",C="_popover_12jx5_1",T="_pagination_12jx5_1 _ds-pagination_14y6r_1",w="_modal_12jx5_1 _ds-modal_14y6r_1",I="_logo_12jx5_1 _ds-focus_14y6r_1",k="_link_12jx5_1",N="_grid_12jx5_1",L="_flex_12jx5_1",B="_box_12jx5_1",O="_input_12jx5_1 _ds-input_14y6r_1",D="_fieldset_12jx5_1 _ds-fieldset_14y6r_1",H="_fieldsetValidationAdded_12jx5_1",P="_field_12jx5_1 _ds-field_14y6r_1",V="_fieldChildAdded_12jx5_1",U="_affixes_12jx5_1 _ds-field-affixes_14y6r_1",W="_count_12jx5_1",F="_errorsummary_12jx5_1 _ds-error-summary_14y6r_1",z="_details_12jx5_1 _ds-details_14y6r_1",X="_chip_12jx5_1 _ds-chip_14y6r_1",Y="_card_12jx5_1",q="_info_12jx5_1",K="_button_12jx5_1 _ds-button_14y6r_1",Q="_breadcrumbs_12jx5_1 _ds-breadcrumbs_14y6r_1",R="_badge_12jx5_1",G="_avatar_12jx5_1 _ds-avatar_14y6r_1",J="_alert_12jx5_1 _ds-alert_14y6r_1",Z="_body_12jx5_84",r={validation:h,tag:j,tabs:A,table:S,scrollShadow:$,tableChildAdded:M,skeleton:E,popover:C,pagination:T,modal:w,logo:I,link:k,grid:N,flex:L,box:B,input:O,fieldset:D,fieldsetValidationAdded:H,field:P,fieldChildAdded:V,affixes:U,count:W,errorsummary:F,details:z,chip:X,card:Y,info:q,button:K,breadcrumbs:Q,badge:R,avatar:G,alert:J,body:Z},ut=Object.freeze(Object.defineProperty({__proto__:null,affixes:U,alert:J,avatar:G,badge:R,body:Z,box:B,breadcrumbs:Q,button:K,card:Y,chip:X,count:W,default:r,details:z,errorsummary:F,field:P,fieldChildAdded:V,fieldset:D,fieldsetValidationAdded:H,flex:L,grid:N,info:q,input:O,link:k,logo:I,modal:w,pagination:T,popover:C,scrollShadow:$,skeleton:E,table:S,tableChildAdded:M,tabs:A,tag:j,validation:h},Symbol.toStringTag,{value:"Module"})),tt=typeof window<"u"&&typeof document<"u",d={capture:!0,passive:!0};let pt=0;const bt=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`;function g(t){return t.id||(t.id=`${bt}${++pt}`),t.id}const et=(t,e,n)=>{for(const s of n[0].split(","))n[0]=s,Element.prototype[`${t}EventListener`].apply(e,n)},u=(t,...e)=>et("add",t,e),p=(t,...e)=>et("remove",t,e),v=(t,e)=>{let n=0;const s=o=>{o.animationName===t&&(cancelAnimationFrame(n),n=requestAnimationFrame(e))};return{observe:o=>u(o,"animationend",s,d),disconnect:o=>p(o,"animationstart",s,d)}},y=t=>t instanceof HTMLElement&&"validity"in t&&!(t instanceof HTMLButtonElement),gt=r.field.split(" ")[0],ot=r.validation.split(" "),mt=ot[0],nt=new WeakMap;function vt(t){for(const e of t){const n=[],s=[];let o=null,a=!0;for(const i of e.getElementsByTagName("*"))i instanceof HTMLLabelElement?n.push(i):y(i)?o=i:i.classList.contains(mt)?(a=i.getAttribute("data-color")==="success",s.unshift(g(i))):i instanceof HTMLParagraphElement&&s.push(g(i));if(o)for(const i of n)i.htmlFor=g(o);o&&it(o),o==null||o.setAttribute("aria-describedby",s.join(" ")),o==null||o.setAttribute("aria-invalid",`${!a}`)}}function st({target:t}){y(t)&&it(t)}function it(t){const e=t==null?void 0:t.nextElementSibling,n=e==null?void 0:e.getAttribute("data-count");if(e&&n){const s=Number(n)-t.value.length,o=s<0;if(e.getAttribute("aria-live")==="polite"!==o){e.setAttribute("aria-live",o?"polite":"off");for(const i of ot)e.classList.toggle(i,o)}e.textContent=`${Math.abs(s)} tegn ${o?"for mye":"igjen"}`}}function yt(t){const e=t.getElementsByClassName(gt),n=v(r.fieldChildAdded,()=>vt(e));nt.set(t,n),n.observe(t),u(t,"input",st,d)}function xt(t){var e;(e=nt.get(t))==null||e.disconnect(t),p(t,"input",st,d)}const ht=r.fieldset.split(" ")[0],jt=r.validation.split(" ")[0],at=new WeakMap;function At(t){for(const e of t){const n=[];let s="";for(const o of e.getElementsByTagName("*"))o.classList.contains(jt)?s=g(o):y(o)&&n.push(o);if(s)for(const o of n)o.setAttribute("aria-describedby",s),o.setAttribute("aria-invalid","true")}}function St(t){const e=t.getElementsByClassName(ht),n=v(r.fieldsetValidationAdded,()=>At(e));at.set(t,n),n.observe(t)}function $t(t){var e;(e=at.get(t))==null||e.disconnect(t)}function Mt(t){u(t,"click",ct),u(t,"toggle",dt,d)}function Et(t){p(t,"click",ct),p(t,"toggle",dt,d)}const Ct=r.popover.split(" ")[0],l=tt?document.createElement("div"):null;l&&(l.style.cssText="position:absolute;padding:1px");function dt({target:t,newState:e}){var o;const s=e==="open"&&t instanceof HTMLElement&&t.classList.contains(Ct)&&((o=t.getRootNode())==null?void 0:o.querySelector(`[popovertarget="${t.id}"]`));if(s){const a=t.getAttribute("data-position")==="over",i=()=>Tt(s,t,a),_=({newState:f})=>{f!=="open"&&(p(document,"DOMContentReady",i,d),p(t,"toggle",_,d),p(window,"load,resize,scroll",i,d),l==null||l.remove())};document.body.append(l||""),document.fonts.ready.then(i),u(window,"load,resize,scroll",i,d),u(document,"DOMContentReady",i,d),u(t,"toggle",_,d)}}function ct({target:t}){var n;const e=t instanceof Element&&t.closest("a[popovertarget]");if(e){const s=e.getRootNode(),o=(n=s.getElementById)==null?void 0:n.call(s,e.getAttribute("popovertarget")||""),a=e.getAttribute("popovertargetaction")||"toggle";o==null||o.togglePopover(a==="show"||(a==="hide"?!1:void 0))}}function Tt(t,e,n=!1){const{innerWidth:s,innerHeight:o,scrollY:a,scrollX:i}=window,{offsetWidth:_,offsetHeight:f}=e;let _t=-i,m=-a,c=t;do _t+=(c==null?void 0:c.offsetLeft)||0,m+=(c==null?void 0:c.offsetTop)||0,c=(c==null?void 0:c.offsetParent)||null;while(c);const x=m+((t==null?void 0:t.offsetHeight)||0),Dt=x+f<o,Ht=m-f>0,ft=!n&&Dt||!Ht,Pt=ft?a+x+f+30:0;e.style.left=`${Math.round(Math.min(Math.max(10,_t),s-_-10))}px`,e.style.top=`${Math.round(ft?x:m-f)}px`,l==null||l.style.setProperty("top",`${Math.round(Pt)}px`)}const wt=r.table.split(" ")[0],rt=new WeakMap;function It(t){var e,n;for(const s of t)if(s instanceof HTMLTableElement){const o=Array.from(((n=(e=s.tHead)==null?void 0:e.rows[0])==null?void 0:n.cells)||[],a=>{var i;return(i=a.innerText)==null?void 0:i.trim()});for(const a of s.tBodies)for(const i of a.rows)for(const _ of i.cells)_.setAttribute("data-th",o[_.cellIndex]||":empty")}}function kt(t){const e=t.getElementsByClassName(wt),n=v(r.tableChildAdded,()=>It(e));rt.set(t,n),n.observe(t)}function Nt(t){var e;(e=rt.get(t))==null||e.disconnect(t)}const Lt=(t,e,n)=>{const s=(n-1)/2,o=Math.min(Math.max(t-Math.floor(s),1),e-n+1),a=Math.min(Math.max(t+Math.ceil(s),n),e),i=Array.from({length:a+1-o},(_,f)=>f+o);return n>4&&o>1&&i.splice(0,2,1,0),n>3&&a<e&&i.splice(-2,2,0,e),i},Bt=({current:t=1,total:e=10,show:n=7})=>({prev:t>1?t-1:0,next:t<e?t+1:0,pages:Lt(t,e,n).map((s,o)=>({current:s===t&&"page",key:`key-${s}-${o}`,page:s}))});tt&<(document);function lt(t){yt(t),St(t),Mt(t),kt(t)}function Ot(t){xt(t),$t(t),Et(t),Nt(t)}return b.observe=lt,b.pagination=Bt,b.styles=ut,b.unobserve=Ot,Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}),b}({});
|
|
4
2
|
//# sourceMappingURL=index.iife.js.map
|
package/mtds/index.iife.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.iife.js","sources":["../designsystem/utils.ts","../designsystem/field/field.ts","../designsystem/fieldset/fieldset.ts","../designsystem/nanopop.ts","../designsystem/popover/popover.ts","../designsystem/table/table.ts","../designsystem/pagination/pagination.ts","../designsystem/index.ts"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';\nexport const QUICK_EVENT = { capture: true, passive: true };\n\n/**\n * useId\n * @return A generated unique ID\n */\nlet id = 0;\nconst UUID = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;\nexport function useId (el: Element) {\n if (!el.id) el.id = `${UUID}${++id}`;\n\treturn el.id;\n};\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nexport function createOptimizedMutationObserver(callback: MutationCallback) {\n const queue: MutationRecord[] = [];\n const observer = new MutationObserver((mutations) => {\n if (!queue[0]) requestAnimationFrame(process);\n queue.push(...mutations);\n });\n\n const process = () => {\n callback(queue, observer);\n queue.length = 0; // Reset queue\n };\n\n return observer;\n}\n\n// Internal helper for on / off\nconst events = (\n\taction: \"add\" | \"remove\",\n\telement: Node | Window,\n\trest: Parameters<typeof Element.prototype.addEventListener>,\n): void => {\n\tfor (const type of rest[0].split(\",\")) {\n\t\trest[0] = type;\n\t\tElement.prototype[`${action}EventListener`].apply(element, rest);\n\t}\n};\n\n/**\n * on\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.addEventListener>\n): void => events(\"add\", element, rest);\n\n/**\n * off\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => events(\"remove\", element, rest);\n\n/**\n * Child added event inspired by:\n * https://davidwalsh.name/detect-node-insertion\n */\nexport const onAdd = (animationName: string, callback: () => void) => {\n let timer: ReturnType<typeof requestAnimationFrame> | number = 0;\n const onAnimation = (event: Event & { animationName?: string }) => {\n if (event.animationName === animationName) {\n cancelAnimationFrame(timer);\n timer = requestAnimationFrame(callback);\n }\n };\n\n\treturn {\n\t\tobserve: (el: Element | Document, ) => on(el, 'animationend', onAnimation, QUICK_EVENT),\n\t\tdisconnect: (el: Element | Document, ) => off(el, 'animationstart', onAnimation, QUICK_EVENT)\n\t};\n}\n\nexport const isInputLike = (el: unknown): el is HTMLInputElement =>\n\tel instanceof HTMLElement && 'validity' in el && !(el instanceof HTMLButtonElement);\n\n// Make React support popover=\"\"target attribute\n// https://github.com/facebook/react/issues/27479\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicAttributes {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: string | boolean;\n\t\t}\n\t}\n\tnamespace React {\n\t\tinterface HTMLAttributes<T> {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: string | boolean;\n\t\t}\n\t}\n}","import styles from '../styles.module.css';\nimport { QUICK_EVENT, isInputLike, off, on, onAdd, useId } from '../utils';\n\nconst CSS_FIELD = styles.field.split(' ')[0];\nconst CSS_VALIDATIONS = styles.validation.split(' ');\nconst CSS_VALIDATION = CSS_VALIDATIONS[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\n\nfunction renderAria(fields: HTMLCollectionOf<Element>) {\n for(const field of fields) {\n const labels: HTMLLabelElement[] = [];\n const descs: string[] = [];\n let input: HTMLInputElement | null = null;\n let valid = true;\n\n for (const el of field.getElementsByTagName('*')) {\n if (el instanceof HTMLLabelElement) labels.push(el);\n else if (isInputLike(el)) input = el;\n else if (el.classList.contains(CSS_VALIDATION)) { // Must be before instanceof HTMLParagraphElement since validation can also be a <p>\n valid = el.getAttribute('data-color') === 'success';\n descs.unshift(useId(el));\n } else if (el instanceof HTMLParagraphElement) descs.push(useId(el));\n }\n\n if (input) for (const label of labels) label.htmlFor = useId(input);\n if (input) renderCounter(input);\n\n input?.setAttribute('aria-describedby', descs.join(' '));\n input?.setAttribute('aria-invalid', `${!valid}`);\n }\n}\nfunction handleInput({ target }: Event) {\n if (isInputLike(target)) renderCounter(target);\n}\n\nfunction renderCounter(input: HTMLInputElement) {\n const el = input?.nextElementSibling;\n const limit = el?.getAttribute('data-count');\n\n if (el && limit) {\n const remainder = Number(limit) - input.value.length;\n const nextInvalid = remainder < 0;\n const prevInvalid = el.getAttribute('aria-live') === 'polite';\n\n if (prevInvalid !== nextInvalid) {\n el.setAttribute('aria-live', nextInvalid ? 'polite' : 'off');\n for (const css of CSS_VALIDATIONS) el.classList.toggle(css, nextInvalid);\n }\n el.textContent = `${Math.abs(remainder)} tegn ${nextInvalid ? 'for mye' : 'igjen'}`;\n }\n}\n\nexport function observe (el: Element | Document) {\n const fields = el.getElementsByClassName(CSS_FIELD);\n const add = onAdd(styles.fieldChildAdded, () => renderAria(fields));\n BOUND.set(el, add);\n add.observe(el);\n on(el, 'input', handleInput, QUICK_EVENT);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n off(el, 'input', handleInput, QUICK_EVENT);\n}\n","import styles from '../styles.module.css';\nimport { isInputLike, onAdd, useId } from '../utils';\nconst CSS_FIELDSET = styles.fieldset.split(' ')[0];\nconst CSS_VALIDATION = styles.validation.split(' ')[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\n\nfunction process(fieldsets: HTMLCollectionOf<Element>) {\n for(const fieldset of fieldsets) {\n const inputs: HTMLInputElement[] = [];\n let validationId = '';\n\n for (const el of fieldset.getElementsByTagName('*')) {\n if (el.classList.contains(CSS_VALIDATION)) validationId = useId(el);\n else if (isInputLike(el)) inputs.push(el);\n }\n\n if (validationId) \n for(const input of inputs) {\n input.setAttribute('aria-describedby', validationId);\n input.setAttribute('aria-invalid', 'true');\n }\n }\n}\n\nexport function observe (el: Element | Document) {\n const fields = el.getElementsByClassName(CSS_FIELDSET);\n const add = onAdd(styles.fieldsetValidationAdded, () => process(fields));\n BOUND.set(el, add);\n add.observe(el);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n}\n","// Inspired by https://github.com/simonwep/nanopop/\n\ntype Direction = 'top' | 'left' | 'bottom' | 'right';\ntype Alignment = 'start' | 'middle' | 'end';\n\nexport type VariantFlipOrder = {\n start: string;\n middle: string;\n end: string;\n};\n\nexport type PositionFlipOrder = {\n top: string;\n right: string;\n bottom: string;\n left: string;\n};\n\nexport type NanoPopPosition = `${Direction}-${Alignment}` | Direction;\n\nexport type NanoPopOptions = {\n container: DOMRect;\n position: NanoPopPosition;\n variantFlipOrder: VariantFlipOrder;\n positionFlipOrder: PositionFlipOrder;\n margin: number;\n reference?: HTMLElement;\n popper?: HTMLElement;\n padding?: number;\n};\n\ntype AvailablePositions = {\n t: number;\n b: number;\n l: number;\n r: number;\n};\n\ntype AvailableVariants = {\n vs: number;\n vm: number;\n ve: number;\n hs: number;\n hm: number;\n he: number;\n};\n\ntype PositionPairs = [Direction, Direction];\n\nexport type PositionMatch = 'ts' | 'tm' | 'te' | 'bs' | 'bm' | 'be' | 'ls' | 'lm' | 'le' | 'rs' | 'rm' | 're';\n\n// Export default\nexport const defaults = {\n variantFlipOrder: {start: 'sme', middle: 'mse', end: 'ems'},\n positionFlipOrder: {top: 'tbrl', right: 'rltb', bottom: 'btrl', left: 'lrbt'},\n position: 'bottom',\n margin: 8,\n padding: 0\n};\n\nconst getBoundingClientRectWithoutTransform = (element: HTMLElement | null) => {\n let el = element;\n const rect = { \n bottom: 0,\n height: el?.offsetHeight || 0,\n left: -window.scrollX,\n right: 0,\n top: -window.scrollY,\n width: el?.offsetWidth || 0\n };\n\n do {\n rect.left += el?.offsetLeft || 0;\n rect.top += el?.offsetTop || 0;\n el = (el?.offsetParent || null) as HTMLElement | null;\n } while (el);\n\n rect.bottom = rect.top + rect.height;\n rect.right = rect.left + rect.width;\n\n return rect;\n}\n\n/**\n * Repositions an element once using the provided options and elements.\n * @param reference Reference element\n * @param popper Popper element\n * @param opt Optional, additional options\n */\nexport const reposition = (\n reference: HTMLElement,\n popper: HTMLElement,\n opt?: Partial<NanoPopOptions>\n): PositionMatch | null => {\n const {\n container,\n margin,\n padding,\n position,\n variantFlipOrder,\n positionFlipOrder\n } = {\n container: document.documentElement.getBoundingClientRect(),\n ...defaults,\n ...opt\n };\n\n /**\n * Reset position to resolve viewport\n * See https://developer.mozilla.org/en-US/docs/Web/CSS/position#fixed\n */\n const {left: originalLeft, top: originalTop} = popper.style;\n popper.style.left = '0';\n popper.style.top = '0';\n\n const refBox = getBoundingClientRectWithoutTransform(reference);\n const popBox = popper.getBoundingClientRect();\n\n /**\n * Holds coordinates of top, left, bottom and right alignment\n */\n const positionStore: AvailablePositions = {\n t: refBox.top - popBox.height - margin,\n b: refBox.bottom + margin,\n r: refBox.right + margin,\n l: refBox.left - popBox.width - margin\n };\n\n /**\n * Holds corresponding variants (start, middle, end).\n * The values depend on horizontal / vertical orientation\n */\n const variantStore: AvailableVariants = {\n vs: refBox.left,\n vm: refBox.left + refBox.width / 2 - popBox.width / 2,\n ve: refBox.left + refBox.width - popBox.width,\n hs: refBox.top,\n hm: refBox.bottom - refBox.height / 2 - popBox.height / 2,\n he: refBox.bottom - popBox.height\n };\n\n // Extract position and variant\n // Top-start -> top is \"position\" and \"start\" is the variant\n const [posKey, varKey = 'middle'] = position.split('-');\n const positions = positionFlipOrder[posKey as keyof PositionFlipOrder];\n const variants = variantFlipOrder[varKey as keyof VariantFlipOrder];\n\n // Try out all possible combinations, starting with the preferred one.\n const {top, left, bottom, right} = container;\n\n for (const p of positions) {\n const vertical = (p === 't' || p === 'b');\n\n // The position-value\n let positionVal = positionStore[p as keyof AvailablePositions];\n\n // Which property has to be changes.\n const [positionKey, variantKey] = (vertical ? ['top', 'left'] : ['left', 'top']) as PositionPairs;\n\n /**\n * box refers to the size of the popper element. Depending on the orientation this is width or height.\n * The limit is the corresponding, maximum value for this position.\n */\n const [positionSize, variantSize] = vertical ? [popBox.height, popBox.width] : [popBox.width, popBox.height];\n const [positionMaximum, variantMaximum] = vertical ? [bottom, right] : [right, bottom];\n const [positionMinimum, variantMinimum] = vertical ? [top, left] : [left, top];\n\n // Skip pre-clipped values\n if (positionVal < positionMinimum || (positionVal + positionSize + padding) > positionMaximum) continue;\n\n for (const v of variants) {\n // The position-value, the related size value of the popper and the limit\n let variantVal = variantStore[((vertical ? 'v' : 'h') + v) as keyof AvailableVariants];\n if (variantVal < variantMinimum || (variantVal + variantSize + padding) > variantMaximum) continue;\n\n // Subtract popBox's initial position\n variantVal -= popBox[variantKey];\n positionVal -= popBox[positionKey];\n\n // Apply styles and normalize viewport\n popper.style[variantKey] = `${variantVal}px`;\n popper.style[positionKey] = `${positionVal}px`;\n\n return (p + v) as PositionMatch;\n }\n }\n\n // Revert style values (won't work with styled-elements or similar systems)\n // \"Fix\" for https://github.com/Simonwep/nanopop/issues/7\n popper.style.left = originalLeft;\n popper.style.top = originalTop;\n\n return null;\n};\n","import { type NanoPopPosition, reposition } from '../nanopop';\nimport styles from '../styles.module.css';\nimport { QUICK_EVENT, off, on } from '../utils';\n\nconst CSS_POPOVER = styles.popover.split(' ')[0];\nconst CONTAINER = { toJSON: () => '', bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 };\nconst POSITIONS = /(top|right|bottom|left)-(start|middle|end)/;\ntype Toggle = Event & { newState?: string };\n\n// Not exposed as a hook, as it is nice to allow consuming components to use it as a callback\nexport function anchorPosition(anchor: HTMLElement, popover: HTMLElement) {\n const position = (popover.getAttribute('data-position') || 'bottom-start') as NanoPopPosition;\n if (!POSITIONS.test(position)) return console.error(`Found invalid data-position=\"${position}\"\\n- It must be [top|right|bottom|left]-[start|middle|end]\\n- Found on element:`, popover);\n\n const update = () =>\n reposition(anchor, popover, {\n container: { ...CONTAINER, bottom: window.innerHeight, right: window.innerWidth },\n margin: 4, // Margin between the popper element and the reference\n padding: 16, // Minimum space between the popper and the container\n position // [top|right|bottom|left]-[start|middle|end]\n });\n\n const removeEvent = ({ newState }: Toggle) => {\n if (newState === 'open') return;\n off(document, 'DOMContentReady', update, QUICK_EVENT);\n off(popover, 'toggle', removeEvent, QUICK_EVENT);\n off(window, 'load,resize,scroll', update, QUICK_EVENT);\n }\n \n\n document.fonts.ready.then(update); // Inital render and when fonts load\n on(document, 'DOMContentReady', update, QUICK_EVENT);\n on(popover, 'toggle', removeEvent, QUICK_EVENT);\n on(window, 'load,resize,scroll', update, QUICK_EVENT);\n}\n\nfunction handleToggle ({ target: el, newState }: Toggle){\n const isPopping = newState === 'open' && el instanceof HTMLElement && el.classList.contains(CSS_POPOVER);\n const anchor = isPopping && (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(`[popovertarget=\"${el.id}\"]`);\n\n if (anchor) anchorPosition(anchor, el);\n}\n\n// Polyfill popovertarget for <a> (not supported by native)\nfunction handleLinkClick ({ target }: Event){\n const el = target instanceof Element && target.closest('a[popovertarget]');\n\n if (el) {\n const root = el.getRootNode() as ShadowRoot;\n const target = root.getElementById?.(el.getAttribute('popovertarget') || '');\n const action = el.getAttribute('popovertargetaction') || 'toggle';\n\n target?.togglePopover(action === 'show' || (action === 'hide' ? false : undefined));\n }\n}\n\n\nexport function observe(el: Node) {\n on(el, 'click', handleLinkClick); // Allow `<a>` to use `popovertarget` as well\n on(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n}\nexport function unobserve(el: Node) {\n off(el, 'click', handleLinkClick);\n off(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n}","import styles from '../styles.module.css';\nimport { onAdd } from '../utils';\nconst CSS_TABLE = styles.table.split(' ')[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\n\nfunction process(tables: HTMLCollectionOf<Element>) {\n for(const table of tables) if (table instanceof HTMLTableElement) {\n const ths = Array.from(table.tHead?.rows[0]?.cells || [], (el) => el.innerText?.trim()); // Using innerText to only include visible text\n for (const tbody of table.tBodies) {\n for (const row of tbody.rows) {\n for (const cell of row.cells) {\n cell.setAttribute('data-th', ths[cell.cellIndex] || '');\n }\n }\n }\n }\n}\n\nexport function observe (el: Element | Document) {\n const tables = el.getElementsByClassName(CSS_TABLE);\n const add = onAdd(styles.tableChildAdded, () => process(tables));\n BOUND.set(el, add);\n add.observe(el);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n}\n","const getSteps = (now: number, max: number, show: number) => {\n const offset = (show - 1) / 2;\n const start = Math.min(Math.max(now - Math.floor(offset), 1), max - show + 1);\n const end = Math.min(Math.max(now + Math.ceil(offset), show), max);\n const pages = Array.from({ length: end + 1 - start }, (_, i) => i + start);\n\n if (show > 4 && start > 1) pages.splice(0, 2, 1, 0);\n if (show > 3 && end < max) pages.splice(-2, 2, 0, max);\n return pages;\n};\n\nexport const pagination = ({\n current = 1,\n total = 10,\n show = 7,\n}) => ({\n prev: current > 1 ? current - 1 : 0,\n next: current < total ? current + 1 : 0,\n pages: getSteps(current, total, show).map((page, index) => ({\n current: page === current && 'page' as const,\n key: `key-${page}-${index}`,\n page,\n })),\n});\n","import * as field from './field/field';\nimport * as fieldset from './fieldset/fieldset';\nimport * as popover from './popover/popover';\nimport * as table from './table/table';\nimport { IS_BROWSER } from './utils';\nexport { pagination } from './pagination/pagination';\nexport * as styles from './styles.module.css';\n\nif (IS_BROWSER) observe(document); // Automatic observe on browser\n\nexport function observe(el: Element | Document) {\n field.observe(el);\n fieldset.observe(el);\n popover.observe(el);\n table.observe(el);\n}\n\nexport function unobserve(el: Element | Document) {\n field.unobserve(el);\n fieldset.unobserve(el);\n popover.unobserve(el);\n table.unobserve(el);\n}"],"names":["IS_BROWSER","QUICK_EVENT","id","UUID","useId","el","events","action","element","rest","type","on","off","onAdd","animationName","callback","timer","onAnimation","event","isInputLike","CSS_FIELD","styles","CSS_VALIDATIONS","CSS_VALIDATION","BOUND","renderAria","fields","field","labels","descs","input","valid","label","handleInput","target","renderCounter","limit","remainder","nextInvalid","css","observe","add","unobserve","CSS_FIELDSET","process","fieldsets","fieldset","inputs","validationId","defaults","getBoundingClientRectWithoutTransform","rect","reposition","reference","popper","opt","container","margin","padding","position","variantFlipOrder","positionFlipOrder","originalLeft","originalTop","refBox","popBox","positionStore","variantStore","posKey","varKey","positions","variants","top","left","bottom","right","vertical","positionVal","positionKey","variantKey","positionSize","variantSize","positionMaximum","variantMaximum","positionMinimum","variantMinimum","v","variantVal","CSS_POPOVER","CONTAINER","POSITIONS","anchorPosition","anchor","popover","update","removeEvent","newState","handleToggle","_a","handleLinkClick","root","CSS_TABLE","tables","table","ths","_b","tbody","row","cell","getSteps","now","max","show","offset","start","end","pages","_","i","pagination","current","total","page","index","field.observe","fieldset.observe","popover.observe","table.observe","field.unobserve","fieldset.unobserve","popover.unobserve","table.unobserve"],"mappings":"uuDAAaA,GAAa,OAAO,OAAW,KAAe,OAAO,SAAa,IAClEC,EAAc,CAAE,QAAS,GAAM,QAAS,EAAK,EAM1D,IAAIC,GAAK,EACT,MAAMC,GAAO,GAAG,KAAK,IAAM,EAAA,SAAS,EAAE,CAAC,GAAG,KAAK,SAAS,SAAS,EAAE,EAAE,MAAM,EAAG,CAAC,CAAC,GACzE,SAASC,EAAOC,EAAa,CAC9B,OAACA,EAAG,KAAIA,EAAG,GAAK,GAAGF,EAAI,GAAG,EAAED,EAAE,IAC5BG,EAAG,EACX,CAsBA,MAAMC,EAAS,CACdC,EACAC,EACAC,IACU,CACV,UAAWC,KAAQD,EAAK,CAAC,EAAE,MAAM,GAAG,EACnCA,EAAK,CAAC,EAAIC,EACV,QAAQ,UAAU,GAAGH,CAAM,eAAe,EAAE,MAAMC,EAASC,CAAI,CAEjE,EAQaE,EAAK,CACjBH,KACGC,IACOH,EAAO,MAAOE,EAASC,CAAI,EAQzBG,EAAM,CAClBJ,KACGC,IACOH,EAAO,SAAUE,EAASC,CAAI,EAM5BI,EAAQ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,CACzB,QAAAC,EAAU,EACV,MAAAC,EAAQ,GACR,KAAAT,EAAO,CACT,KAAO,CACL,KAAMQ,EAAU,EAAIA,EAAU,EAAI,EAClC,KAAMA,EAAUC,EAAQD,EAAU,EAAI,EACtC,MAAOX,GAASW,EAASC,EAAOT,CAAI,EAAE,IAAI,CAACU,EAAMC,KAAW,CAC1D,QAASD,IAASF,GAAW,OAC7B,IAAK,OAAOE,CAAI,IAAIC,CAAK,GACzB,KAAAD,CAAA,EACA,CACJ,GCfI1H,OAAoB,QAAQ,EAEzB,SAASwC,GAAQnC,EAAwB,CAC9CuH,GAAcvH,CAAE,EAChBwH,GAAiBxH,CAAE,EACnByH,GAAgBzH,CAAE,EAClB0H,GAAc1H,CAAE,CAClB,CAEO,SAASqC,GAAUrC,EAAwB,CAChD2H,GAAgB3H,CAAE,EAClB4H,GAAmB5H,CAAE,EACrB6H,GAAkB7H,CAAE,EACpB8H,GAAgB9H,CAAE,CACpB"}
|
|
1
|
+
{"version":3,"file":"index.iife.js","sources":["../designsystem/utils.ts","../designsystem/field/field.ts","../designsystem/fieldset/fieldset.ts","../designsystem/popover/popover.ts","../designsystem/table/table.ts","../designsystem/pagination/pagination.ts","../designsystem/index.ts"],"sourcesContent":["export const IS_BROWSER = typeof window !== 'undefined' && typeof document !== 'undefined';\nexport const QUICK_EVENT = { capture: true, passive: true };\n\n/**\n * useId\n * @return A generated unique ID\n */\nlet id = 0;\nconst UUID = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;\nexport function useId (el: Element) {\n if (!el.id) el.id = `${UUID}${++id}`;\n\treturn el.id;\n};\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nexport function createOptimizedMutationObserver(callback: MutationCallback) {\n const queue: MutationRecord[] = [];\n const observer = new MutationObserver((mutations) => {\n if (!queue[0]) requestAnimationFrame(process);\n queue.push(...mutations);\n });\n\n const process = () => {\n callback(queue, observer);\n queue.length = 0; // Reset queue\n };\n\n return observer;\n}\n\n// Internal helper for on / off\nconst events = (\n\taction: \"add\" | \"remove\",\n\telement: Node | Window,\n\trest: Parameters<typeof Element.prototype.addEventListener>,\n): void => {\n\tfor (const type of rest[0].split(\",\")) {\n\t\trest[0] = type;\n\t\tElement.prototype[`${action}EventListener`].apply(element, rest);\n\t}\n};\n\n/**\n * on\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.addEventListener>\n): void => events(\"add\", element, rest);\n\n/**\n * off\n * @param element The Element to use as EventTarget\n * @param types A comma separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n\telement: Node | Window,\n\t...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => events(\"remove\", element, rest);\n\n/**\n * Child added event inspired by:\n * https://davidwalsh.name/detect-node-insertion\n */\nexport const onAdd = (animationName: string, callback: () => void) => {\n let timer: ReturnType<typeof requestAnimationFrame> | number = 0;\n const onAnimation = (event: Event & { animationName?: string }) => {\n if (event.animationName === animationName) {\n cancelAnimationFrame(timer);\n timer = requestAnimationFrame(callback);\n }\n };\n\n\treturn {\n\t\tobserve: (el: Element | Document, ) => on(el, 'animationend', onAnimation, QUICK_EVENT),\n\t\tdisconnect: (el: Element | Document, ) => off(el, 'animationstart', onAnimation, QUICK_EVENT)\n\t};\n}\n\nexport const isInputLike = (el: unknown): el is HTMLInputElement =>\n\tel instanceof HTMLElement && 'validity' in el && !(el instanceof HTMLButtonElement);\n\n// Make React support popover=\"\"target attribute\n// https://github.com/facebook/react/issues/27479\ndeclare global {\n\tnamespace React.JSX {\n\t\tinterface IntrinsicAttributes {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: string | boolean;\n\t\t}\n\t}\n\tnamespace React {\n\t\tinterface HTMLAttributes<T> {\n\t\t\tpopovertargetaction?: string;\n\t\t\tpopovertarget?: string;\n\t\t\tpopover?: \"\" | \"auto\" | \"manual\" | undefined;\n\t\t}\n\t}\n}","import styles from '../styles.module.css';\nimport { QUICK_EVENT, isInputLike, off, on, onAdd, useId } from '../utils';\n\nconst CSS_FIELD = styles.field.split(' ')[0];\nconst CSS_VALIDATIONS = styles.validation.split(' ');\nconst CSS_VALIDATION = CSS_VALIDATIONS[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\n\nfunction renderAria(fields: HTMLCollectionOf<Element>) {\n for(const field of fields) {\n const labels: HTMLLabelElement[] = [];\n const descs: string[] = [];\n let input: HTMLInputElement | null = null;\n let valid = true;\n\n for (const el of field.getElementsByTagName('*')) {\n if (el instanceof HTMLLabelElement) labels.push(el);\n else if (isInputLike(el)) input = el;\n else if (el.classList.contains(CSS_VALIDATION)) { // Must be before instanceof HTMLParagraphElement since validation can also be a <p>\n valid = el.getAttribute('data-color') === 'success';\n descs.unshift(useId(el));\n } else if (el instanceof HTMLParagraphElement) descs.push(useId(el));\n }\n\n if (input) for (const label of labels) label.htmlFor = useId(input);\n if (input) renderCounter(input);\n\n input?.setAttribute('aria-describedby', descs.join(' '));\n input?.setAttribute('aria-invalid', `${!valid}`);\n }\n}\nfunction handleInput({ target }: Event) {\n if (isInputLike(target)) renderCounter(target);\n}\n\nfunction renderCounter(input: HTMLInputElement) {\n const el = input?.nextElementSibling;\n const limit = el?.getAttribute('data-count');\n\n if (el && limit) {\n const remainder = Number(limit) - input.value.length;\n const nextInvalid = remainder < 0;\n const prevInvalid = el.getAttribute('aria-live') === 'polite';\n\n if (prevInvalid !== nextInvalid) {\n el.setAttribute('aria-live', nextInvalid ? 'polite' : 'off');\n for (const css of CSS_VALIDATIONS) el.classList.toggle(css, nextInvalid);\n }\n el.textContent = `${Math.abs(remainder)} tegn ${nextInvalid ? 'for mye' : 'igjen'}`;\n }\n}\n\nexport function observe (el: Element | Document) {\n const fields = el.getElementsByClassName(CSS_FIELD);\n const add = onAdd(styles.fieldChildAdded, () => renderAria(fields));\n BOUND.set(el, add);\n add.observe(el);\n on(el, 'input', handleInput, QUICK_EVENT);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n off(el, 'input', handleInput, QUICK_EVENT);\n}\n","import styles from '../styles.module.css';\nimport { isInputLike, onAdd, useId } from '../utils';\nconst CSS_FIELDSET = styles.fieldset.split(' ')[0];\nconst CSS_VALIDATION = styles.validation.split(' ')[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\n\nfunction process(fieldsets: HTMLCollectionOf<Element>) {\n for(const fieldset of fieldsets) {\n const inputs: HTMLInputElement[] = [];\n let validationId = '';\n\n for (const el of fieldset.getElementsByTagName('*')) {\n if (el.classList.contains(CSS_VALIDATION)) validationId = useId(el);\n else if (isInputLike(el)) inputs.push(el);\n }\n\n if (validationId) \n for(const input of inputs) {\n input.setAttribute('aria-describedby', validationId);\n input.setAttribute('aria-invalid', 'true');\n }\n }\n}\n\nexport function observe (el: Element | Document) {\n const fields = el.getElementsByClassName(CSS_FIELDSET);\n const add = onAdd(styles.fieldsetValidationAdded, () => process(fields));\n BOUND.set(el, add);\n add.observe(el);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n}\n","import styles from '../styles.module.css';\nimport { IS_BROWSER, QUICK_EVENT, off, on } from '../utils';\n\nexport function observe(el: Node) {\n on(el, 'click', handleLinkClick); // Allow `<a>` to use `popovertarget` as well\n on(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n}\nexport function unobserve(el: Node) {\n off(el, 'click', handleLinkClick);\n off(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n}\n\ntype Toggle = Event & { newState?: string };\nconst CSS_POPOVER = styles.popover.split(' ')[0];\nconst SCROLLER = IS_BROWSER ? document.createElement('div') : null // Used to ensure we have scrollability under\nif (SCROLLER) SCROLLER.style.cssText = 'position:absolute;padding:1px';\n\nfunction handleToggle ({ target: el, newState }: Toggle){\n const isPopping = newState === 'open' && el instanceof HTMLElement && el.classList.contains(CSS_POPOVER);\n const anchor = isPopping && (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(`[popovertarget=\"${el.id}\"]`);\n\n if (anchor) {\n const isOver = el.getAttribute('data-position') === 'over';\n const update = () => place(anchor, el, isOver);\n const removeEvent = ({ newState }: Toggle) => {\n if (newState === 'open') return;\n off(document, 'DOMContentReady', update, QUICK_EVENT);\n off(el, 'toggle', removeEvent, QUICK_EVENT);\n off(window, 'load,resize,scroll', update, QUICK_EVENT);\n SCROLLER?.remove();\n }\n\n document.body.append(SCROLLER || '');\n document.fonts.ready.then(update); // Inital render and when fonts load\n on(window, 'load,resize,scroll', update, QUICK_EVENT);\n on(document, 'DOMContentReady', update, QUICK_EVENT);\n on(el, 'toggle', removeEvent, QUICK_EVENT);\n }\n}\n\n// Polyfill popovertarget for <a> (not supported by native)\nfunction handleLinkClick ({ target }: Event){\n const el = target instanceof Element && target.closest('a[popovertarget]');\n\n if (el) {\n const root = el.getRootNode() as ShadowRoot;\n const target = root.getElementById?.(el.getAttribute('popovertarget') || '');\n const action = el.getAttribute('popovertargetaction') || 'toggle';\n\n target?.togglePopover(action === 'show' || (action === 'hide' ? false : undefined));\n }\n}\n\nfunction place (anchor: HTMLElement | null, poppe: HTMLElement, isOver = false) {\n const { innerWidth: winW, innerHeight: winH, scrollY: winY, scrollX: winX } = window;\n const { offsetWidth: popperW, offsetHeight: popperH } = poppe;\n let anchorX = -winX;\n let anchorY = -winY;\n let el = anchor;\n\n do {\n anchorX += el?.offsetLeft || 0;\n anchorY += el?.offsetTop || 0;\n el = (el?.offsetParent || null) as HTMLElement | null;\n } while (el);\n\n const anchorBottom = anchorY + (anchor?.offsetHeight || 0);\n const hasSpaceUnder = anchorBottom + popperH < winH;\n const hasSpaceOver = anchorY - popperH > 0\n const placeUnder = (!isOver && hasSpaceUnder) || !hasSpaceOver // Always place under when no hasSpaceOver, as no OS can scroll further up than 0\n const scroll = placeUnder ? winY + anchorBottom + popperH + 30 : 0\n\n poppe.style.left = `${Math.round(Math.min(Math.max(10, anchorX), winW - popperW - 10))}px`\n poppe.style.top = `${Math.round(placeUnder ? anchorBottom : anchorY - popperH)}px`\n SCROLLER?.style.setProperty('top', `${Math.round(scroll)}px`);\n}\n","import styles from '../styles.module.css';\nimport { onAdd } from '../utils';\nconst CSS_TABLE = styles.table.split(' ')[0];\nconst BOUND = new WeakMap<Element | Document, ReturnType<typeof onAdd>>();\n\nfunction process(tables: HTMLCollectionOf<Element>) {\n for(const table of tables) if (table instanceof HTMLTableElement) {\n const ths = Array.from(table.tHead?.rows[0]?.cells || [], (el) => el.innerText?.trim()); // Using innerText to only include visible text\n for (const tbody of table.tBodies) {\n for (const row of tbody.rows) {\n for (const cell of row.cells) {\n cell.setAttribute('data-th', ths[cell.cellIndex] || ':empty'); // Using U+200B to prevent empty string from collapsing\n }\n }\n }\n }\n}\n\nexport function observe (el: Element | Document) {\n const tables = el.getElementsByClassName(CSS_TABLE);\n const add = onAdd(styles.tableChildAdded, () => process(tables));\n BOUND.set(el, add);\n add.observe(el);\n}\n\nexport function unobserve (el: Element | Document) {\n BOUND.get(el)?.disconnect(el);\n}\n","const getSteps = (now: number, max: number, show: number) => {\n const offset = (show - 1) / 2;\n const start = Math.min(Math.max(now - Math.floor(offset), 1), max - show + 1);\n const end = Math.min(Math.max(now + Math.ceil(offset), show), max);\n const pages = Array.from({ length: end + 1 - start }, (_, i) => i + start);\n\n if (show > 4 && start > 1) pages.splice(0, 2, 1, 0);\n if (show > 3 && end < max) pages.splice(-2, 2, 0, max);\n return pages;\n};\n\nexport const pagination = ({\n current = 1,\n total = 10,\n show = 7,\n}) => ({\n prev: current > 1 ? current - 1 : 0,\n next: current < total ? current + 1 : 0,\n pages: getSteps(current, total, show).map((page, index) => ({\n current: page === current && 'page' as const,\n key: `key-${page}-${index}`,\n page,\n })),\n});\n","import * as field from './field/field';\nimport * as fieldset from './fieldset/fieldset';\nimport * as popover from './popover/popover';\nimport * as table from './table/table';\nimport { IS_BROWSER } from './utils';\nexport { pagination } from './pagination/pagination';\nexport * as styles from './styles.module.css';\n\nif (IS_BROWSER) observe(document); // Automatic observe on browser\n\nexport function observe(el: Element | Document) {\n field.observe(el);\n fieldset.observe(el);\n popover.observe(el);\n table.observe(el);\n}\n\nexport function unobserve(el: Element | Document) {\n field.unobserve(el);\n fieldset.unobserve(el);\n popover.unobserve(el);\n table.unobserve(el);\n}"],"names":["IS_BROWSER","QUICK_EVENT","id","UUID","useId","el","events","action","element","rest","type","on","off","onAdd","animationName","callback","timer","onAnimation","event","isInputLike","CSS_FIELD","styles","CSS_VALIDATIONS","CSS_VALIDATION","BOUND","renderAria","fields","field","labels","descs","input","valid","label","handleInput","target","renderCounter","limit","remainder","nextInvalid","css","observe","add","unobserve","CSS_FIELDSET","process","fieldsets","fieldset","inputs","validationId","handleLinkClick","handleToggle","CSS_POPOVER","SCROLLER","newState","anchor","_a","isOver","update","place","removeEvent","root","poppe","winW","winH","winY","winX","popperW","popperH","anchorX","anchorY","anchorBottom","hasSpaceUnder","hasSpaceOver","placeUnder","scroll","CSS_TABLE","tables","table","ths","_b","tbody","row","cell","getSteps","now","max","show","offset","start","end","pages","i","pagination","current","total","page","index","field.observe","fieldset.observe","popover.observe","table.observe","field.unobserve","fieldset.unobserve","popover.unobserve","table.unobserve"],"mappings":"01DAAaA,GAAa,OAAO,OAAW,KAAe,OAAO,SAAa,IAClEC,EAAc,CAAE,QAAS,GAAM,QAAS,EAAK,EAM1D,IAAIC,GAAK,EACT,MAAMC,GAAO,GAAG,KAAK,IAAM,EAAA,SAAS,EAAE,CAAC,GAAG,KAAK,SAAS,SAAS,EAAE,EAAE,MAAM,EAAG,CAAC,CAAC,GACzE,SAASC,EAAOC,EAAa,CAC9B,OAACA,EAAG,KAAIA,EAAG,GAAK,GAAGF,EAAI,GAAG,EAAED,EAAE,IAC5BG,EAAG,EACX,CAsBA,MAAMC,GAAS,CACdC,EACAC,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SAASqC,GAAUrC,EAAwB,CAChDgG,GAAgBhG,CAAE,EAClBiG,GAAmBjG,CAAE,EACrBkG,GAAkBlG,CAAE,EACpBmG,GAAgBnG,CAAE,CACpB"}
|
package/mtds/popover/popover.js
CHANGED
|
@@ -1,47 +1,42 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function h(t, o) {
|
|
6
|
-
const r = o.getAttribute("data-position") || "bottom-start";
|
|
7
|
-
if (!u.test(r)) return console.error(`Found invalid data-position="${r}"
|
|
8
|
-
- It must be [top|right|bottom|left]-[start|middle|end]
|
|
9
|
-
- Found on element:`, o);
|
|
10
|
-
const e = () => l(t, o, {
|
|
11
|
-
container: { ...f, bottom: window.innerHeight, right: window.innerWidth },
|
|
12
|
-
margin: 4,
|
|
13
|
-
// Margin between the popper element and the reference
|
|
14
|
-
padding: 16,
|
|
15
|
-
// Minimum space between the popper and the container
|
|
16
|
-
position: r
|
|
17
|
-
// [top|right|bottom|left]-[start|middle|end]
|
|
18
|
-
}), n = ({ newState: d }) => {
|
|
19
|
-
d !== "open" && (c(document, "DOMContentReady", e, i), c(o, "toggle", n, i), c(window, "load,resize,scroll", e, i));
|
|
20
|
-
};
|
|
21
|
-
document.fonts.ready.then(e), s(document, "DOMContentReady", e, i), s(o, "toggle", n, i), s(window, "load,resize,scroll", e, i);
|
|
1
|
+
import P from "../styles.module.css.js";
|
|
2
|
+
import { IS_BROWSER as E, on as d, QUICK_EVENT as c, off as f } from "../utils.js";
|
|
3
|
+
function k(t) {
|
|
4
|
+
d(t, "click", y), d(t, "toggle", w, c);
|
|
22
5
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
const e = o === "open" && t instanceof HTMLElement && t.classList.contains(p) && ((n = t.getRootNode()) == null ? void 0 : n.querySelector(`[popovertarget="${t.id}"]`));
|
|
26
|
-
e && h(e, t);
|
|
6
|
+
function O(t) {
|
|
7
|
+
f(t, "click", y), f(t, "toggle", w, c);
|
|
27
8
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
const H = P.popover.split(" ")[0], n = E ? document.createElement("div") : null;
|
|
10
|
+
n && (n.style.cssText = "position:absolute;padding:1px");
|
|
11
|
+
function w({ target: t, newState: e }) {
|
|
12
|
+
var i;
|
|
13
|
+
const s = e === "open" && t instanceof HTMLElement && t.classList.contains(H) && ((i = t.getRootNode()) == null ? void 0 : i.querySelector(`[popovertarget="${t.id}"]`));
|
|
14
|
+
if (s) {
|
|
15
|
+
const r = t.getAttribute("data-position") === "over", a = () => S(s, t, r), g = ({ newState: p }) => {
|
|
16
|
+
p !== "open" && (f(document, "DOMContentReady", a, c), f(t, "toggle", g, c), f(window, "load,resize,scroll", a, c), n == null || n.remove());
|
|
17
|
+
};
|
|
18
|
+
document.body.append(n || ""), document.fonts.ready.then(a), d(window, "load,resize,scroll", a, c), d(document, "DOMContentReady", a, c), d(t, "toggle", g, c);
|
|
34
19
|
}
|
|
35
20
|
}
|
|
36
|
-
function
|
|
37
|
-
|
|
21
|
+
function y({ target: t }) {
|
|
22
|
+
var l;
|
|
23
|
+
const e = t instanceof Element && t.closest("a[popovertarget]");
|
|
24
|
+
if (e) {
|
|
25
|
+
const s = e.getRootNode(), i = (l = s.getElementById) == null ? void 0 : l.call(s, e.getAttribute("popovertarget") || ""), r = e.getAttribute("popovertargetaction") || "toggle";
|
|
26
|
+
i == null || i.togglePopover(r === "show" || (r === "hide" ? !1 : void 0));
|
|
27
|
+
}
|
|
38
28
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
29
|
+
function S(t, e, l = !1) {
|
|
30
|
+
const { innerWidth: s, innerHeight: i, scrollY: r, scrollX: a } = window, { offsetWidth: g, offsetHeight: p } = e;
|
|
31
|
+
let h = -a, u = -r, o = t;
|
|
32
|
+
do
|
|
33
|
+
h += (o == null ? void 0 : o.offsetLeft) || 0, u += (o == null ? void 0 : o.offsetTop) || 0, o = (o == null ? void 0 : o.offsetParent) || null;
|
|
34
|
+
while (o);
|
|
35
|
+
const m = u + ((t == null ? void 0 : t.offsetHeight) || 0), M = m + p < i, b = u - p > 0, v = !l && M || !b, x = v ? r + m + p + 30 : 0;
|
|
36
|
+
e.style.left = `${Math.round(Math.min(Math.max(10, h), s - g - 10))}px`, e.style.top = `${Math.round(v ? m : u - p)}px`, n == null || n.style.setProperty("top", `${Math.round(x)}px`);
|
|
41
37
|
}
|
|
42
38
|
export {
|
|
43
|
-
|
|
44
|
-
E as observe,
|
|
39
|
+
k as observe,
|
|
45
40
|
O as unobserve
|
|
46
41
|
};
|
|
47
42
|
//# sourceMappingURL=popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover.js","sources":["../../designsystem/popover/popover.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"popover.js","sources":["../../designsystem/popover/popover.ts"],"sourcesContent":["import styles from '../styles.module.css';\nimport { IS_BROWSER, QUICK_EVENT, off, on } from '../utils';\n\nexport function observe(el: Node) {\n on(el, 'click', handleLinkClick); // Allow `<a>` to use `popovertarget` as well\n on(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n}\nexport function unobserve(el: Node) {\n off(el, 'click', handleLinkClick);\n off(el, 'toggle', handleToggle, QUICK_EVENT); // Use capture since toggle does not bubble\n}\n\ntype Toggle = Event & { newState?: string };\nconst CSS_POPOVER = styles.popover.split(' ')[0];\nconst SCROLLER = IS_BROWSER ? document.createElement('div') : null // Used to ensure we have scrollability under\nif (SCROLLER) SCROLLER.style.cssText = 'position:absolute;padding:1px';\n\nfunction handleToggle ({ target: el, newState }: Toggle){\n const isPopping = newState === 'open' && el instanceof HTMLElement && el.classList.contains(CSS_POPOVER);\n const anchor = isPopping && (el.getRootNode() as ShadowRoot)?.querySelector<HTMLElement>(`[popovertarget=\"${el.id}\"]`);\n\n if (anchor) {\n const isOver = el.getAttribute('data-position') === 'over';\n const update = () => place(anchor, el, isOver);\n const removeEvent = ({ newState }: Toggle) => {\n if (newState === 'open') return;\n off(document, 'DOMContentReady', update, QUICK_EVENT);\n off(el, 'toggle', removeEvent, QUICK_EVENT);\n off(window, 'load,resize,scroll', update, QUICK_EVENT);\n SCROLLER?.remove();\n }\n\n document.body.append(SCROLLER || '');\n document.fonts.ready.then(update); // Inital render and when fonts load\n on(window, 'load,resize,scroll', update, QUICK_EVENT);\n on(document, 'DOMContentReady', update, QUICK_EVENT);\n on(el, 'toggle', removeEvent, QUICK_EVENT);\n }\n}\n\n// Polyfill popovertarget for <a> (not supported by native)\nfunction handleLinkClick ({ target }: Event){\n const el = target instanceof Element && target.closest('a[popovertarget]');\n\n if (el) {\n const root = el.getRootNode() as ShadowRoot;\n const target = root.getElementById?.(el.getAttribute('popovertarget') || '');\n const action = el.getAttribute('popovertargetaction') || 'toggle';\n\n target?.togglePopover(action === 'show' || (action === 'hide' ? false : undefined));\n }\n}\n\nfunction place (anchor: HTMLElement | null, poppe: HTMLElement, isOver = false) {\n const { innerWidth: winW, innerHeight: winH, scrollY: winY, scrollX: winX } = window;\n const { offsetWidth: popperW, offsetHeight: popperH } = poppe;\n let anchorX = -winX;\n let anchorY = -winY;\n let el = anchor;\n\n do {\n anchorX += el?.offsetLeft || 0;\n anchorY += el?.offsetTop || 0;\n el = (el?.offsetParent || null) as HTMLElement | null;\n } while (el);\n\n const anchorBottom = anchorY + (anchor?.offsetHeight || 0);\n const hasSpaceUnder = anchorBottom + popperH < winH;\n const hasSpaceOver = anchorY - popperH > 0\n const placeUnder = (!isOver && hasSpaceUnder) || !hasSpaceOver // Always place under when no hasSpaceOver, as no OS can scroll further up than 0\n const scroll = placeUnder ? winY + anchorBottom + popperH + 30 : 0\n\n poppe.style.left = `${Math.round(Math.min(Math.max(10, anchorX), winW - popperW - 10))}px`\n poppe.style.top = `${Math.round(placeUnder ? anchorBottom : anchorY - popperH)}px`\n SCROLLER?.style.setProperty('top', `${Math.round(scroll)}px`);\n}\n"],"names":["observe","el","on","handleLinkClick","handleToggle","QUICK_EVENT","unobserve","off","CSS_POPOVER","styles","SCROLLER","IS_BROWSER","newState","anchor","_a","isOver","update","place","removeEvent","target","root","action","poppe","winW","winH","winY","winX","popperW","popperH","anchorX","anchorY","anchorBottom","hasSpaceUnder","hasSpaceOver","placeUnder","scroll"],"mappings":";;AAGO,SAASA,EAAQC,GAAU;AAC7B,EAAAC,EAAAD,GAAI,SAASE,CAAe,GAC5BD,EAAAD,GAAI,UAAUG,GAAcC,CAAW;AAC5C;AACO,SAASC,EAAUL,GAAU;AAC9B,EAAAM,EAAAN,GAAI,SAASE,CAAe,GAC5BI,EAAAN,GAAI,UAAUG,GAAcC,CAAW;AAC7C;AAGA,MAAMG,IAAcC,EAAO,QAAQ,MAAM,GAAG,EAAE,CAAC,GACzCC,IAAWC,IAAa,SAAS,cAAc,KAAK,IAAI;AAC1DD,MAAmBA,EAAA,MAAM,UAAU;AAEvC,SAASN,EAAc,EAAE,QAAQH,GAAI,UAAAW,KAAmB;;AAEhD,QAAAC,IADYD,MAAa,UAAUX,aAAc,eAAeA,EAAG,UAAU,SAASO,CAAW,OAC1EM,IAAAb,EAAG,kBAAH,gBAAAa,EAAiC,cAA2B,mBAAmBb,EAAG,EAAE;AAEjH,MAAIY,GAAQ;AACV,UAAME,IAASd,EAAG,aAAa,eAAe,MAAM,QAC9Ce,IAAS,MAAMC,EAAMJ,GAAQZ,GAAIc,CAAM,GACvCG,IAAc,CAAC,EAAE,UAAAN,QAAuB;AAC5C,MAAIA,MAAa,WACbL,EAAA,UAAU,mBAAmBS,GAAQX,CAAW,GAChDE,EAAAN,GAAI,UAAUiB,GAAab,CAAW,GACtCE,EAAA,QAAQ,sBAAsBS,GAAQX,CAAW,GACrDK,KAAA,QAAAA,EAAU;AAAA,IACZ;AAES,aAAA,KAAK,OAAOA,KAAY,EAAE,GAC1B,SAAA,MAAM,MAAM,KAAKM,CAAM,GAC7Bd,EAAA,QAAQ,sBAA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AChFL,EAAA,MAAM,MAAM,GAAG,KAAK,MAAMY,IAAaH,IAAeD,IAAUF,CAAO,CAAC,MACpElB,KAAA,QAAAA,EAAA,MAAM,YAAY,OAAO,GAAG,KAAK,MAAMyB,CAAM,CAAC;AAC1D;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof meta>;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export declare const Circle: Story;
|
|
9
|
+
export declare const Text: Story;
|