@viasat/beam-shared 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -0
- package/chunks/SegmentedControl.B9dLCFSF.js +9 -0
- package/chunks/SegmentedControl.D0l_8a7O.js +1 -0
- package/chunks/accordion.C1LkPYXv.js +1 -0
- package/chunks/accordion.CCM7ddD5.js +11 -0
- package/chunks/actionList.LFHBSlrg.js +1 -0
- package/chunks/actionList.X99uHmXK.js +26 -0
- package/chunks/alert.B4q5-o6H.js +1 -0
- package/chunks/alert.BZ4L-6bC.js +32 -0
- package/chunks/avatar.BbM_sNXk.js +63 -0
- package/chunks/avatar.VNzxbOMa.js +1 -0
- package/chunks/badge.B_k2GBe6.js +1 -0
- package/chunks/badge.DZN0yrZh.js +44 -0
- package/chunks/badgeDot.ClhZtqzd.js +25 -0
- package/chunks/badgeDot.Dkqfk3zg.js +1 -0
- package/chunks/box.CsO__7hu.js +1 -0
- package/chunks/box._mFtvgTp.js +82 -0
- package/chunks/button.Bbz_mfWv.js +1 -0
- package/chunks/button.Dz8Zhr7J.js +51 -0
- package/chunks/card.CG-SDcm1.js +27 -0
- package/chunks/card.CLwQAceo.js +1 -0
- package/chunks/chips.DKEagIsp.js +1 -0
- package/chunks/chips.GU9UVEOU.js +13 -0
- package/chunks/closeButton.C1A3p88y.js +1 -0
- package/chunks/closeButton.g8_iRoUg.js +15 -0
- package/chunks/dialog.BTq-pLBf.js +28 -0
- package/chunks/dialog.DnkeApRr.js +1 -0
- package/chunks/divider.BYMLu6Wp.js +1 -0
- package/chunks/divider.DgP7kpLb.js +35 -0
- package/chunks/fileUpload.BbSIsjJv.js +240 -0
- package/chunks/fileUpload.C-l2YXzO.js +1 -0
- package/chunks/form.BRWIo59c.js +154 -0
- package/chunks/form.CIzlawbr.js +1 -0
- package/chunks/helperText.C-apoW8Z.js +1 -0
- package/chunks/helperText.CS5sun4r.js +16 -0
- package/chunks/icon.SiHuIfL8.js +1 -0
- package/chunks/icon.tCAxaKQh.js +28 -0
- package/chunks/inputChoiceGroup.BSousduj.js +1 -0
- package/chunks/inputChoiceGroup.DkDdA57f.js +10 -0
- package/chunks/link.DxTb3yhm.js +16 -0
- package/chunks/link.VyBRMFxS.js +1 -0
- package/chunks/list.CCq0lIzm.js +29 -0
- package/chunks/list.D6NIx1OS.js +1 -0
- package/chunks/logo.CLQZSaVN.js +1 -0
- package/chunks/logo.Cl29Chxj.js +11 -0
- package/chunks/nativeSelect.D9HZm9uJ.js +28 -0
- package/chunks/nativeSelect.Lz45VyQX.js +1 -0
- package/chunks/pageHeader.CbDGb6ot.js +1 -0
- package/chunks/pageHeader.fsTiHDRc.js +12 -0
- package/chunks/pagination.Br7vTt5b.js +1 -0
- package/chunks/pagination.DinViL55.js +38 -0
- package/chunks/progressBar.84w2qF8R.js +42 -0
- package/chunks/progressBar.DcG-X-RY.js +1 -0
- package/chunks/spinner.B6R6yphw.js +1 -0
- package/chunks/spinner.oNNLX64f.js +105 -0
- package/chunks/stepper.ByKqsxhz.js +1 -0
- package/chunks/stepper.FT6nDHjL.js +18 -0
- package/chunks/switch.Dalf8ccu.js +1 -0
- package/chunks/switch.hUukrKTd.js +11 -0
- package/chunks/tabs.C7SBQq_R.js +1 -0
- package/chunks/tabs.CIfcdjPn.js +13 -0
- package/chunks/text.CW-ftgoP.js +1 -0
- package/chunks/text.DpbJhMDB.js +152 -0
- package/chunks/textArea.CmtmGm_y.js +22 -0
- package/chunks/textArea.DF76BVU5.js +1 -0
- package/chunks/toast.Bs1t4Urq.js +36 -0
- package/chunks/toast.C-h1RUq_.js +1 -0
- package/chunks/tooltip.D1fCHa9d.js +16 -0
- package/chunks/tooltip.DZTJP5dS.js +1 -0
- package/index.cjs.js +1 -0
- package/index.d.ts +3 -0
- package/index.es.js +164 -0
- package/lib/components/SegmentedControl.cjs.js +1 -0
- package/lib/components/SegmentedControl.d.ts +2 -0
- package/lib/components/SegmentedControl.es.js +5 -0
- package/lib/components/accordion.cjs.js +1 -0
- package/lib/components/accordion.d.ts +3 -0
- package/lib/components/accordion.es.js +6 -0
- package/lib/components/actionList.cjs.js +1 -0
- package/lib/components/actionList.d.ts +15 -0
- package/lib/components/actionList.es.js +13 -0
- package/lib/components/alert.cjs.js +1 -0
- package/lib/components/alert.d.ts +17 -0
- package/lib/components/alert.es.js +11 -0
- package/lib/components/aspectRatio.cjs.js +1 -0
- package/lib/components/aspectRatio.d.ts +16 -0
- package/lib/components/aspectRatio.es.js +14 -0
- package/lib/components/avatar.cjs.js +1 -0
- package/lib/components/avatar.d.ts +17 -0
- package/lib/components/avatar.es.js +23 -0
- package/lib/components/badge.cjs.js +1 -0
- package/lib/components/badge.d.ts +17 -0
- package/lib/components/badge.es.js +15 -0
- package/lib/components/badgeDot.cjs.js +1 -0
- package/lib/components/badgeDot.d.ts +6 -0
- package/lib/components/badgeDot.es.js +7 -0
- package/lib/components/box.cjs.js +1 -0
- package/lib/components/box.d.ts +82 -0
- package/lib/components/box.es.js +8 -0
- package/lib/components/button.cjs.js +1 -0
- package/lib/components/button.d.ts +36 -0
- package/lib/components/button.es.js +16 -0
- package/lib/components/card.cjs.js +1 -0
- package/lib/components/card.d.ts +22 -0
- package/lib/components/card.es.js +7 -0
- package/lib/components/chips.cjs.js +1 -0
- package/lib/components/chips.d.ts +5 -0
- package/lib/components/chips.es.js +7 -0
- package/lib/components/closeButton.cjs.js +1 -0
- package/lib/components/closeButton.d.ts +2 -0
- package/lib/components/closeButton.es.js +5 -0
- package/lib/components/dialog.cjs.js +1 -0
- package/lib/components/dialog.d.ts +5 -0
- package/lib/components/dialog.es.js +7 -0
- package/lib/components/divider.cjs.js +1 -0
- package/lib/components/divider.d.ts +30 -0
- package/lib/components/divider.es.js +9 -0
- package/lib/components/fileUpload.cjs.js +1 -0
- package/lib/components/fileUpload.d.ts +90 -0
- package/lib/components/fileUpload.es.js +22 -0
- package/lib/components/floatingui.cjs.js +1 -0
- package/lib/components/floatingui.d.ts +71 -0
- package/lib/components/floatingui.es.js +608 -0
- package/lib/components/form.cjs.js +1 -0
- package/lib/components/form.d.ts +69 -0
- package/lib/components/form.es.js +9 -0
- package/lib/components/helperText.cjs.js +1 -0
- package/lib/components/helperText.d.ts +4 -0
- package/lib/components/helperText.es.js +6 -0
- package/lib/components/icon.cjs.js +1 -0
- package/lib/components/icon.d.ts +6 -0
- package/lib/components/icon.es.js +7 -0
- package/lib/components/index.cjs.js +1 -0
- package/lib/components/index.d.ts +34 -0
- package/lib/components/index.es.js +70 -0
- package/lib/components/inputChoiceGroup.cjs.js +1 -0
- package/lib/components/inputChoiceGroup.d.ts +10 -0
- package/lib/components/inputChoiceGroup.es.js +5 -0
- package/lib/components/link.cjs.js +1 -0
- package/lib/components/link.d.ts +4 -0
- package/lib/components/link.es.js +6 -0
- package/lib/components/list.cjs.js +1 -0
- package/lib/components/list.d.ts +14 -0
- package/lib/components/list.es.js +10 -0
- package/lib/components/logo.cjs.js +1 -0
- package/lib/components/logo.d.ts +5 -0
- package/lib/components/logo.es.js +6 -0
- package/lib/components/nativeSelect.cjs.js +1 -0
- package/lib/components/nativeSelect.d.ts +5 -0
- package/lib/components/nativeSelect.es.js +7 -0
- package/lib/components/pageHeader.cjs.js +1 -0
- package/lib/components/pageHeader.d.ts +5 -0
- package/lib/components/pageHeader.es.js +5 -0
- package/lib/components/pagination.cjs.js +1 -0
- package/lib/components/pagination.d.ts +69 -0
- package/lib/components/pagination.es.js +13 -0
- package/lib/components/progressBar.cjs.js +1 -0
- package/lib/components/progressBar.d.ts +14 -0
- package/lib/components/progressBar.es.js +11 -0
- package/lib/components/spinner.cjs.js +1 -0
- package/lib/components/spinner.d.ts +82 -0
- package/lib/components/spinner.es.js +19 -0
- package/lib/components/stepper.cjs.js +1 -0
- package/lib/components/stepper.d.ts +12 -0
- package/lib/components/stepper.es.js +5 -0
- package/lib/components/switch.cjs.js +1 -0
- package/lib/components/switch.d.ts +3 -0
- package/lib/components/switch.es.js +6 -0
- package/lib/components/tabs.cjs.js +1 -0
- package/lib/components/tabs.d.ts +6 -0
- package/lib/components/tabs.es.js +7 -0
- package/lib/components/text.cjs.js +1 -0
- package/lib/components/text.d.ts +15 -0
- package/lib/components/text.es.js +13 -0
- package/lib/components/textArea.cjs.js +1 -0
- package/lib/components/textArea.d.ts +2 -0
- package/lib/components/textArea.es.js +4 -0
- package/lib/components/toast.cjs.js +1 -0
- package/lib/components/toast.d.ts +14 -0
- package/lib/components/toast.es.js +9 -0
- package/lib/components/tooltip.cjs.js +1 -0
- package/lib/components/tooltip.d.ts +2 -0
- package/lib/components/tooltip.es.js +5 -0
- package/lib/shared.cjs.js +1 -0
- package/lib/shared.d.ts +4 -0
- package/lib/shared.es.js +6 -0
- package/lib/utils/CSSLookup.cjs.js +1 -0
- package/lib/utils/CSSLookup.d.ts +84 -0
- package/lib/utils/CSSLookup.es.js +110 -0
- package/lib/utils/classNames.cjs.js +1 -0
- package/lib/utils/classNames.d.ts +9 -0
- package/lib/utils/classNames.es.js +18 -0
- package/lib/utils/constants.cjs.js +1 -0
- package/lib/utils/constants.d.ts +174 -0
- package/lib/utils/constants.es.js +151 -0
- package/lib/utils/dom.cjs.js +1 -0
- package/lib/utils/dom.d.ts +18 -0
- package/lib/utils/dom.es.js +34 -0
- package/lib/utils/helpers.cjs.js +1 -0
- package/lib/utils/helpers.d.ts +66 -0
- package/lib/utils/helpers.es.js +154 -0
- package/lib/utils/index.cjs.js +1 -0
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/index.es.js +94 -0
- package/lib/utils/overflow.cjs.js +1 -0
- package/lib/utils/overflow.d.ts +34 -0
- package/lib/utils/overflow.es.js +34 -0
- package/lib/utils/raf.cjs.js +1 -0
- package/lib/utils/raf.d.ts +8 -0
- package/lib/utils/raf.es.js +14 -0
- package/lib/utils/styles.cjs.js +1 -0
- package/lib/utils/styles.d.ts +1 -0
- package/lib/utils/styles.es.js +5 -0
- package/lib/utils/types.cjs.js +1 -0
- package/lib/utils/types.d.ts +6 -0
- package/lib/utils/types.es.js +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./constants.cjs.js"),v=e=>e.charAt(0).toUpperCase()+e.slice(1),S=e=>Object.values(e),T=e=>Object.entries(e);function E(e,t=w.FPS_120){let o;const r=(...n)=>{o!==void 0&&clearTimeout(o),o=setTimeout(()=>e(...n),t)};return r.cancel=()=>{o!==void 0&&clearTimeout(o)},r}const y=e=>{var o;const t=e.target;try{return t.assignedNodes().length>0||((o=t.assignedNodes()[0].textContent)==null?void 0:o.trim())!==""}catch{return!1}},R=e=>{if(!e||e.length===0)return!1;for(const t of e)if(t.nodeType===Node.ELEMENT_NODE||t.nodeType===Node.TEXT_NODE&&t.data.trim()!=="")return!0;return!1},C=(e,t={})=>{const o=Object.entries(t).reduce((r,[n,a])=>`${r} ${n}='${a}'`,"");return e.replace("<svg",`<svg ${o}`)},x=(e,t)=>t.some(o=>e.has(o)),L=e=>({decorate:t=>{if(!e)return;Object.keys(t).forEach(r=>{e[r]=t[r]})}}),M=e=>{const o=e.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"])');return o||null},B=(e,t)=>!!e.composedPath().find(n=>n===t),A=(e,t)=>{if(!e||Object.keys(e).length===0)return[e,e];const o={},r={};return Object.keys(e).forEach(n=>{t.includes(n)?o[n]=e[n]:r[n]=e[n]}),[o,r]},D=()=>{if(typeof window>"u")return!1;const e=(navigator==null?void 0:navigator.userAgent)||(navigator==null?void 0:navigator.vendor)||(window==null?void 0:window.opera),t=["(android|bb\\d+|meego).+mobile","avantgo|bada\\/","blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)","iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront","opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/","plucker|pocket|psp|series([46])0|symbian|treo|up\\.(browser|link)","vodafone|wap|windows ce|xda|xiino"].join("|"),o=["1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)","ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)","as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)","bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\\/|capi|ccwa|cdm-","cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi","dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)","esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo","go(\\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)","hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)","i230|iac([ \\-\\/])"].join("|");return new RegExp(t,"i").test(e)||new RegExp(o,"i").test(e.substr(0,4))};var h=(e=>(e.TOP="top",e.LEFT="left",e.RIGHT="right",e.BOTTOM="bottom",e))(h||{});const F=(e,t=300)=>{let o,r,n;return function(){const a=this,i=arguments;o?(clearTimeout(r),r=setTimeout(()=>{Date.now()-n>=t&&(e.apply(a,i),n=Date.now())},Math.max(t-(Date.now()-n),0))):(e.apply(a,i),n=Date.now(),o=!0)}},P=(e,t,o)=>{const{innerHeight:r,innerWidth:n}=window,{top:a,left:i,right:g,bottom:b}=o;return{top:(d,m)=>{if(m){const c=r-b,u=c<e,f=a>c;return u&&f?"bottom":"top"}const s=r-b,l=a<e,p=s>e;return l&&p?"bottom":"top"},bottom:(d,m)=>{if(m){const c=r-b,u=a<e,f=c>e;return u&&f?"top":"bottom"}const s=r-b,l=s<e,p=a>s;return l&&p?"top":"bottom"},left:d=>{if(d){const p=n-g,c=t>p,u=i>t;return c&&u?"right":"left"}const m=n-g,s=i<t,l=m>t;return s&&l?"right":"left"},right:d=>{if(d){const p=n-g,c=i<t,u=p>t;return c&&u?"left":"right"}const s=n-g<t,l=i>t;return s&&l?"left":"right"}}};function I(e,t){return Math.random()*(t-e)+e}function N(e,t){return e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e}function k(e){return typeof window>"u"?!1:window.HTMLElement.prototype.hasOwnProperty(e)}const z=e=>e.replace(/^([A-Z])/,t=>t.toLowerCase()).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase();exports.Directions=h;exports.attributeDecorator=L;exports.camelCaseToKebabCase=z;exports.capitalizeFirstLetter=v;exports.debounce=E;exports.doesEventContainElement=B;exports.doesWebComponentSlotExist=y;exports.enrichSVGIcon=C;exports.findFirstFocusableElement=M;exports.getDirection=P;exports.getRandomArbitrary=I;exports.getRandomInt=N;exports.getTypedEntries=T;exports.getTypedValues=S;exports.isAPISupported=k;exports.isMobileDevice=D;exports.nodesHaveContent=R;exports.partitionProps=A;exports.propsChanged=x;exports.throttle=F;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
opera: string;
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
7
|
+
export declare const capitalizeFirstLetter: (str: string) => string;
|
|
8
|
+
export declare const getTypedValues: <T extends Record<string, unknown>>(obj: T) => Array<T[keyof T]>;
|
|
9
|
+
export declare const getTypedEntries: <T extends Record<string, unknown>>(obj: T) => Array<[keyof T, T[keyof T]]>;
|
|
10
|
+
export declare function debounce<F extends (...args: Parameters<F>) => ReturnType<F>>(func: F, waitFor?: number): F & {
|
|
11
|
+
cancel: () => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Use `nodesHaveContent` instead with a slot query pattern
|
|
15
|
+
*/
|
|
16
|
+
export declare const doesWebComponentSlotExist: (e: Event) => boolean;
|
|
17
|
+
export declare const nodesHaveContent: (nodes?: readonly Node[] | null) => boolean;
|
|
18
|
+
export declare const enrichSVGIcon: (icon: string, options?: Record<string, string>) => string;
|
|
19
|
+
export declare const propsChanged: (changedProperties: Map<string, unknown>, subscribedProperties: Array<string>) => boolean;
|
|
20
|
+
export declare const attributeDecorator: (element: HTMLElement) => {
|
|
21
|
+
decorate: (attributes: Record<string, unknown>) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const findFirstFocusableElement: (container: HTMLElement) => HTMLElement | null;
|
|
24
|
+
export declare const doesEventContainElement: (e: Event, element: HTMLElement) => boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Allows to create two groups of object properties: selected and left.
|
|
27
|
+
* Useful for taking props needed in component that might be generic
|
|
28
|
+
* (consider breakpoints) and passing all the rest to further down to the component.
|
|
29
|
+
* @param _filteredObj
|
|
30
|
+
* @param selectedKeys
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
export declare const partitionProps: <T extends Record<string, unknown>, U extends keyof T>(_filteredObj: T, selectedKeys: Readonly<Array<U>>) => [Pick<T, U>, Omit<T, U>];
|
|
34
|
+
/**
|
|
35
|
+
* Checks if the device is mobile
|
|
36
|
+
* @returns {boolean}
|
|
37
|
+
*/
|
|
38
|
+
export declare const isMobileDevice: () => boolean;
|
|
39
|
+
export declare enum Directions {
|
|
40
|
+
TOP = "top",
|
|
41
|
+
LEFT = "left",
|
|
42
|
+
RIGHT = "right",
|
|
43
|
+
BOTTOM = "bottom"
|
|
44
|
+
}
|
|
45
|
+
export declare const throttle: (fn: Function, wait?: number) => (this: unknown) => void;
|
|
46
|
+
export declare const getDirection: (totalHeight: number, totalWidth: number, triggerCoords: DOMRectReadOnly) => Record<Directions, (isStraight?: boolean, isAligned?: boolean) => Directions>;
|
|
47
|
+
/**
|
|
48
|
+
* Returns a random number between min (inclusive) and max (exclusive)
|
|
49
|
+
*/
|
|
50
|
+
export declare function getRandomArbitrary(min: number, max: number): number;
|
|
51
|
+
/**
|
|
52
|
+
* Returns a random integer between min (inclusive) and max (inclusive).
|
|
53
|
+
* The value is no lower than min (or the next integer greater than min
|
|
54
|
+
* if min isn't an integer) and no greater than max (or the next integer
|
|
55
|
+
* lower than max if max isn't an integer).
|
|
56
|
+
* Using Math.round() will give you a non-uniform distribution!
|
|
57
|
+
*/
|
|
58
|
+
export declare function getRandomInt(min: number, max: number): number;
|
|
59
|
+
/**
|
|
60
|
+
* SSR-safe check to see if an HTML API is supported
|
|
61
|
+
*/
|
|
62
|
+
export declare function isAPISupported(prop: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Converts a camelCase (or PascalCase) string to kebab-case
|
|
65
|
+
*/
|
|
66
|
+
export declare const camelCaseToKebabCase: (camelCaseString: string) => string;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { FPS_120 as h } from "./constants.es.js";
|
|
2
|
+
const T = (e) => e.charAt(0).toUpperCase() + e.slice(1), S = (e) => Object.values(e), E = (e) => Object.entries(e);
|
|
3
|
+
function y(e, t = h) {
|
|
4
|
+
let o;
|
|
5
|
+
const r = (...n) => {
|
|
6
|
+
o !== void 0 && clearTimeout(o), o = setTimeout(() => e(...n), t);
|
|
7
|
+
};
|
|
8
|
+
return r.cancel = () => {
|
|
9
|
+
o !== void 0 && clearTimeout(o);
|
|
10
|
+
}, r;
|
|
11
|
+
}
|
|
12
|
+
const R = (e) => {
|
|
13
|
+
var o;
|
|
14
|
+
const t = e.target;
|
|
15
|
+
try {
|
|
16
|
+
return t.assignedNodes().length > 0 || ((o = t.assignedNodes()[0].textContent) == null ? void 0 : o.trim()) !== "";
|
|
17
|
+
} catch {
|
|
18
|
+
return !1;
|
|
19
|
+
}
|
|
20
|
+
}, x = (e) => {
|
|
21
|
+
if (!e || e.length === 0) return !1;
|
|
22
|
+
for (const t of e)
|
|
23
|
+
if (t.nodeType === Node.ELEMENT_NODE || t.nodeType === Node.TEXT_NODE && t.data.trim() !== "") return !0;
|
|
24
|
+
return !1;
|
|
25
|
+
}, C = (e, t = {}) => {
|
|
26
|
+
const o = Object.entries(t).reduce(
|
|
27
|
+
(r, [n, a]) => `${r} ${n}='${a}'`,
|
|
28
|
+
""
|
|
29
|
+
);
|
|
30
|
+
return e.replace("<svg", `<svg ${o}`);
|
|
31
|
+
}, B = (e, t) => t.some((o) => e.has(o)), L = (e) => ({
|
|
32
|
+
decorate: (t) => {
|
|
33
|
+
if (!e) return;
|
|
34
|
+
Object.keys(t).forEach((r) => {
|
|
35
|
+
e[r] = t[r];
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}), M = (e) => {
|
|
39
|
+
const o = e.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable]:not([contenteditable="false"])');
|
|
40
|
+
return o || null;
|
|
41
|
+
}, A = (e, t) => !!e.composedPath().find((n) => n === t), N = (e, t) => {
|
|
42
|
+
if (!e || Object.keys(e).length === 0)
|
|
43
|
+
return [e, e];
|
|
44
|
+
const o = {}, r = {};
|
|
45
|
+
return Object.keys(e).forEach((n) => {
|
|
46
|
+
t.includes(n) ? o[n] = e[n] : r[n] = e[n];
|
|
47
|
+
}), [o, r];
|
|
48
|
+
}, k = () => {
|
|
49
|
+
if (typeof window > "u") return !1;
|
|
50
|
+
const e = (navigator == null ? void 0 : navigator.userAgent) || (navigator == null ? void 0 : navigator.vendor) || (window == null ? void 0 : window.opera), t = [
|
|
51
|
+
"(android|bb\\d+|meego).+mobile",
|
|
52
|
+
"avantgo|bada\\/",
|
|
53
|
+
"blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)",
|
|
54
|
+
"iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront",
|
|
55
|
+
"opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/",
|
|
56
|
+
"plucker|pocket|psp|series([46])0|symbian|treo|up\\.(browser|link)",
|
|
57
|
+
"vodafone|wap|windows ce|xda|xiino"
|
|
58
|
+
].join("|"), o = [
|
|
59
|
+
"1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)",
|
|
60
|
+
"ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)",
|
|
61
|
+
"as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)",
|
|
62
|
+
"bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\\/|capi|ccwa|cdm-",
|
|
63
|
+
"cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi",
|
|
64
|
+
"dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)",
|
|
65
|
+
"esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo",
|
|
66
|
+
"go(\\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)",
|
|
67
|
+
"hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)",
|
|
68
|
+
"i230|iac([ \\-\\/])"
|
|
69
|
+
].join("|");
|
|
70
|
+
return new RegExp(t, "i").test(e) || new RegExp(o, "i").test(e.substr(0, 4));
|
|
71
|
+
};
|
|
72
|
+
var w = /* @__PURE__ */ ((e) => (e.TOP = "top", e.LEFT = "left", e.RIGHT = "right", e.BOTTOM = "bottom", e))(w || {});
|
|
73
|
+
const z = (e, t = 300) => {
|
|
74
|
+
let o, r, n;
|
|
75
|
+
return function() {
|
|
76
|
+
const a = this, i = arguments;
|
|
77
|
+
o ? (clearTimeout(r), r = setTimeout(() => {
|
|
78
|
+
Date.now() - n >= t && (e.apply(a, i), n = Date.now());
|
|
79
|
+
}, Math.max(t - (Date.now() - n), 0))) : (e.apply(a, i), n = Date.now(), o = !0);
|
|
80
|
+
};
|
|
81
|
+
}, D = (e, t, o) => {
|
|
82
|
+
const { innerHeight: r, innerWidth: n } = window, {
|
|
83
|
+
top: a,
|
|
84
|
+
left: i,
|
|
85
|
+
right: d,
|
|
86
|
+
bottom: b
|
|
87
|
+
} = o;
|
|
88
|
+
return {
|
|
89
|
+
top: (g, m) => {
|
|
90
|
+
if (m) {
|
|
91
|
+
const c = r - b, u = c < e, f = a > c;
|
|
92
|
+
return u && f ? "bottom" : "top";
|
|
93
|
+
}
|
|
94
|
+
const s = r - b, l = a < e, p = s > e;
|
|
95
|
+
return l && p ? "bottom" : "top";
|
|
96
|
+
},
|
|
97
|
+
bottom: (g, m) => {
|
|
98
|
+
if (m) {
|
|
99
|
+
const c = r - b, u = a < e, f = c > e;
|
|
100
|
+
return u && f ? "top" : "bottom";
|
|
101
|
+
}
|
|
102
|
+
const s = r - b, l = s < e, p = a > s;
|
|
103
|
+
return l && p ? "top" : "bottom";
|
|
104
|
+
},
|
|
105
|
+
left: (g) => {
|
|
106
|
+
if (g) {
|
|
107
|
+
const p = n - d, c = t > p, u = i > t;
|
|
108
|
+
return c && u ? "right" : "left";
|
|
109
|
+
}
|
|
110
|
+
const m = n - d, s = i < t, l = m > t;
|
|
111
|
+
return s && l ? "right" : "left";
|
|
112
|
+
},
|
|
113
|
+
right: (g) => {
|
|
114
|
+
if (g) {
|
|
115
|
+
const p = n - d, c = i < t, u = p > t;
|
|
116
|
+
return c && u ? "left" : "right";
|
|
117
|
+
}
|
|
118
|
+
const s = n - d < t, l = i > t;
|
|
119
|
+
return s && l ? "left" : "right";
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
function F(e, t) {
|
|
124
|
+
return Math.random() * (t - e) + e;
|
|
125
|
+
}
|
|
126
|
+
function O(e, t) {
|
|
127
|
+
return e = Math.ceil(e), t = Math.floor(t), Math.floor(Math.random() * (t - e + 1)) + e;
|
|
128
|
+
}
|
|
129
|
+
function P(e) {
|
|
130
|
+
return typeof window > "u" ? !1 : window.HTMLElement.prototype.hasOwnProperty(e);
|
|
131
|
+
}
|
|
132
|
+
const $ = (e) => e.replace(/^([A-Z])/, (t) => t.toLowerCase()).replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
|
|
133
|
+
export {
|
|
134
|
+
w as Directions,
|
|
135
|
+
L as attributeDecorator,
|
|
136
|
+
$ as camelCaseToKebabCase,
|
|
137
|
+
T as capitalizeFirstLetter,
|
|
138
|
+
y as debounce,
|
|
139
|
+
A as doesEventContainElement,
|
|
140
|
+
R as doesWebComponentSlotExist,
|
|
141
|
+
C as enrichSVGIcon,
|
|
142
|
+
M as findFirstFocusableElement,
|
|
143
|
+
D as getDirection,
|
|
144
|
+
F as getRandomArbitrary,
|
|
145
|
+
O as getRandomInt,
|
|
146
|
+
E as getTypedEntries,
|
|
147
|
+
S as getTypedValues,
|
|
148
|
+
P as isAPISupported,
|
|
149
|
+
k as isMobileDevice,
|
|
150
|
+
x as nodesHaveContent,
|
|
151
|
+
N as partitionProps,
|
|
152
|
+
B as propsChanged,
|
|
153
|
+
z as throttle
|
|
154
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./classNames.cjs.js"),e=require("./constants.cjs.js"),s=require("./helpers.cjs.js"),i=require("./styles.cjs.js"),a=require("./dom.cjs.js"),n=require("./raf.cjs.js"),t=require("./overflow.cjs.js");exports.generateSpacingClasses=r.generateSpacingClasses;exports.getBEMClassNames=r.getBEMClassNames;exports.ACCENT=e.ACCENT;exports.ATTRIBUTE=e.ATTRIBUTE;exports.BASE_FONT_SIZE=e.BASE_FONT_SIZE;exports.BEAM_INVERSE=e.BEAM_INVERSE;exports.DEFAULT_ACCENT=e.DEFAULT_ACCENT;exports.DEFAULT_MODE=e.DEFAULT_MODE;exports.DEFAULT_PRODUCT_TYPE=e.DEFAULT_PRODUCT_TYPE;exports.DEFAULT_THEME=e.DEFAULT_THEME;exports.EXPRESSIVE_THEMES=e.EXPRESSIVE_THEMES;exports.FPS_1=e.FPS_1;exports.FPS_120=e.FPS_120;exports.FPS_30=e.FPS_30;exports.FPS_60=e.FPS_60;exports.PRODUCT_TYPE=e.PRODUCT_TYPE;exports.STORAGE_KEY=e.STORAGE_KEY;exports.SYSTEM_MODE_ENABLED_KEY=e.SYSTEM_MODE_ENABLED_KEY;exports.SpacingValues=e.SpacingValues;exports.SpacingValuesAsNumbers=e.SpacingValuesAsNumbers;exports.StaticAppearances=e.StaticAppearances;exports.accentThemeClassName=e.accentThemeClassName;exports.allColors=e.allColors;exports.allSizes=e.allSizes;exports.appearance=e.appearance;exports.appearances=e.appearances;exports.consumer=e.consumer;exports.emphases=e.emphases;exports.enterprise=e.enterprise;exports.expressiveThemeClassName=e.expressiveThemeClassName;exports.info=e.info;exports.infoPrimary=e.infoPrimary;exports.infoSecondary=e.infoSecondary;exports.information=e.information;exports.inverse=e.inverse;exports.lg=e.lg;exports.md=e.md;exports.negative=e.negative;exports.positive=e.positive;exports.prefix=e.prefix;exports.primary=e.primary;exports.productTypeThemeClassName=e.productTypeThemeClassName;exports.secondary=e.secondary;exports.secondaryInverse=e.secondaryInverse;exports.sizes=e.sizes;exports.sm=e.sm;exports.themeClassName=e.themeClassName;exports.themeTypeValues=e.themeTypeValues;exports.warning=e.warning;exports.xl=e.xl;exports.xs=e.xs;exports.xxs=e.xxs;exports.Directions=s.Directions;exports.attributeDecorator=s.attributeDecorator;exports.camelCaseToKebabCase=s.camelCaseToKebabCase;exports.capitalizeFirstLetter=s.capitalizeFirstLetter;exports.debounce=s.debounce;exports.doesEventContainElement=s.doesEventContainElement;exports.doesWebComponentSlotExist=s.doesWebComponentSlotExist;exports.enrichSVGIcon=s.enrichSVGIcon;exports.findFirstFocusableElement=s.findFirstFocusableElement;exports.getDirection=s.getDirection;exports.getRandomArbitrary=s.getRandomArbitrary;exports.getRandomInt=s.getRandomInt;exports.getTypedEntries=s.getTypedEntries;exports.getTypedValues=s.getTypedValues;exports.isAPISupported=s.isAPISupported;exports.isMobileDevice=s.isMobileDevice;exports.nodesHaveContent=s.nodesHaveContent;exports.partitionProps=s.partitionProps;exports.propsChanged=s.propsChanged;exports.throttle=s.throttle;exports.generateCssVarPrefix=i.generateCssVarPrefix;exports.addScrollToRect=a.addScrollToRect;exports.compareDomOrder=a.compareDomOrder;exports.findTopLevelSlottedWrapper=a.findTopLevelSlottedWrapper;exports.getElementScrollBoundingClientRect=a.getElementScrollBoundingClientRect;exports.readStringProp=a.readStringProp;exports.createRafScheduler=n.createRafScheduler;exports.computeFitCount=t.computeFitCount;exports.hasScrollOverflow=t.hasScrollOverflow;exports.isMultiLineClamped=t.isMultiLineClamped;exports.isOverFlowing=t.isOverFlowing;exports.isSingleLineClamped=t.isSingleLineClamped;exports.isTextWrapping=t.isTextWrapping;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { generateSpacingClasses as a, getBEMClassNames as t } from "./classNames.es.js";
|
|
2
|
+
import { ACCENT as s, ATTRIBUTE as i, BASE_FONT_SIZE as n, BEAM_INVERSE as p, DEFAULT_ACCENT as l, DEFAULT_MODE as m, DEFAULT_PRODUCT_TYPE as E, DEFAULT_THEME as c, EXPRESSIVE_THEMES as S, FPS_1 as T, FPS_120 as d, FPS_30 as C, FPS_60 as g, PRODUCT_TYPE as _, STORAGE_KEY as f, SYSTEM_MODE_ENABLED_KEY as u, SpacingValues as x, SpacingValuesAsNumbers as A, StaticAppearances as D, accentThemeClassName as F, allColors as P, allSizes as h, appearance as v, appearances as N, consumer as R, emphases as y, enterprise as b, expressiveThemeClassName as L, info as M, infoPrimary as O, infoSecondary as I, information as V, inverse as U, lg as B, md as Y, negative as w, positive as z, prefix as H, primary as K, productTypeThemeClassName as W, secondary as G, secondaryInverse as X, sizes as Z, sm as j, themeClassName as k, themeTypeValues as q, warning as J, xl as Q, xs as $, xxs as ee } from "./constants.es.js";
|
|
3
|
+
import { Directions as ae, attributeDecorator as te, camelCaseToKebabCase as oe, capitalizeFirstLetter as se, debounce as ie, doesEventContainElement as ne, doesWebComponentSlotExist as pe, enrichSVGIcon as le, findFirstFocusableElement as me, getDirection as Ee, getRandomArbitrary as ce, getRandomInt as Se, getTypedEntries as Te, getTypedValues as de, isAPISupported as Ce, isMobileDevice as ge, nodesHaveContent as _e, partitionProps as fe, propsChanged as ue, throttle as xe } from "./helpers.es.js";
|
|
4
|
+
import { generateCssVarPrefix as De } from "./styles.es.js";
|
|
5
|
+
import { addScrollToRect as Pe, compareDomOrder as he, findTopLevelSlottedWrapper as ve, getElementScrollBoundingClientRect as Ne, readStringProp as Re } from "./dom.es.js";
|
|
6
|
+
import { createRafScheduler as be } from "./raf.es.js";
|
|
7
|
+
import { computeFitCount as Me, hasScrollOverflow as Oe, isMultiLineClamped as Ie, isOverFlowing as Ve, isSingleLineClamped as Ue, isTextWrapping as Be } from "./overflow.es.js";
|
|
8
|
+
export {
|
|
9
|
+
s as ACCENT,
|
|
10
|
+
i as ATTRIBUTE,
|
|
11
|
+
n as BASE_FONT_SIZE,
|
|
12
|
+
p as BEAM_INVERSE,
|
|
13
|
+
l as DEFAULT_ACCENT,
|
|
14
|
+
m as DEFAULT_MODE,
|
|
15
|
+
E as DEFAULT_PRODUCT_TYPE,
|
|
16
|
+
c as DEFAULT_THEME,
|
|
17
|
+
ae as Directions,
|
|
18
|
+
S as EXPRESSIVE_THEMES,
|
|
19
|
+
T as FPS_1,
|
|
20
|
+
d as FPS_120,
|
|
21
|
+
C as FPS_30,
|
|
22
|
+
g as FPS_60,
|
|
23
|
+
_ as PRODUCT_TYPE,
|
|
24
|
+
f as STORAGE_KEY,
|
|
25
|
+
u as SYSTEM_MODE_ENABLED_KEY,
|
|
26
|
+
x as SpacingValues,
|
|
27
|
+
A as SpacingValuesAsNumbers,
|
|
28
|
+
D as StaticAppearances,
|
|
29
|
+
F as accentThemeClassName,
|
|
30
|
+
Pe as addScrollToRect,
|
|
31
|
+
P as allColors,
|
|
32
|
+
h as allSizes,
|
|
33
|
+
v as appearance,
|
|
34
|
+
N as appearances,
|
|
35
|
+
te as attributeDecorator,
|
|
36
|
+
oe as camelCaseToKebabCase,
|
|
37
|
+
se as capitalizeFirstLetter,
|
|
38
|
+
he as compareDomOrder,
|
|
39
|
+
Me as computeFitCount,
|
|
40
|
+
R as consumer,
|
|
41
|
+
be as createRafScheduler,
|
|
42
|
+
ie as debounce,
|
|
43
|
+
ne as doesEventContainElement,
|
|
44
|
+
pe as doesWebComponentSlotExist,
|
|
45
|
+
y as emphases,
|
|
46
|
+
le as enrichSVGIcon,
|
|
47
|
+
b as enterprise,
|
|
48
|
+
L as expressiveThemeClassName,
|
|
49
|
+
me as findFirstFocusableElement,
|
|
50
|
+
ve as findTopLevelSlottedWrapper,
|
|
51
|
+
De as generateCssVarPrefix,
|
|
52
|
+
a as generateSpacingClasses,
|
|
53
|
+
t as getBEMClassNames,
|
|
54
|
+
Ee as getDirection,
|
|
55
|
+
Ne as getElementScrollBoundingClientRect,
|
|
56
|
+
ce as getRandomArbitrary,
|
|
57
|
+
Se as getRandomInt,
|
|
58
|
+
Te as getTypedEntries,
|
|
59
|
+
de as getTypedValues,
|
|
60
|
+
Oe as hasScrollOverflow,
|
|
61
|
+
M as info,
|
|
62
|
+
O as infoPrimary,
|
|
63
|
+
I as infoSecondary,
|
|
64
|
+
V as information,
|
|
65
|
+
U as inverse,
|
|
66
|
+
Ce as isAPISupported,
|
|
67
|
+
ge as isMobileDevice,
|
|
68
|
+
Ie as isMultiLineClamped,
|
|
69
|
+
Ve as isOverFlowing,
|
|
70
|
+
Ue as isSingleLineClamped,
|
|
71
|
+
Be as isTextWrapping,
|
|
72
|
+
B as lg,
|
|
73
|
+
Y as md,
|
|
74
|
+
w as negative,
|
|
75
|
+
_e as nodesHaveContent,
|
|
76
|
+
fe as partitionProps,
|
|
77
|
+
z as positive,
|
|
78
|
+
H as prefix,
|
|
79
|
+
K as primary,
|
|
80
|
+
W as productTypeThemeClassName,
|
|
81
|
+
ue as propsChanged,
|
|
82
|
+
Re as readStringProp,
|
|
83
|
+
G as secondary,
|
|
84
|
+
X as secondaryInverse,
|
|
85
|
+
Z as sizes,
|
|
86
|
+
j as sm,
|
|
87
|
+
k as themeClassName,
|
|
88
|
+
q as themeTypeValues,
|
|
89
|
+
xe as throttle,
|
|
90
|
+
J as warning,
|
|
91
|
+
Q as xl,
|
|
92
|
+
$ as xs,
|
|
93
|
+
ee as xxs
|
|
94
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=(t,e,i=!1)=>e<=0?0:Math.max(0,Math.floor(t/e)+(i?1:0));function o(t,e=window.getComputedStyle(t)){return parseInt(e.getPropertyValue("-webkit-line-clamp"),10)>=1&&e.getPropertyValue("display")==="-webkit-box"&&e.getPropertyValue("overflow")==="hidden"}function r(t,e=window.getComputedStyle(t)){return e.getPropertyValue("text-overflow")==="ellipsis"&&e.getPropertyValue("white-space")==="nowrap"&&e.getPropertyValue("overflow")==="hidden"&&t.scrollWidth>t.clientWidth}function n(t){return t.scrollWidth>t.clientWidth||t.scrollHeight>t.clientHeight}function s(t){if(!t)return!1;if(n(t))return!0;const e=window.getComputedStyle(t);return o(t,e)||r(t,e)}const u=t=>{if(!t)return!1;const e=t.cloneNode(!0);e.style.position="absolute",e.style.whiteSpace="nowrap",e.style.width="auto",e.style.height="auto",e.style.visibility="hidden",document.body.appendChild(e);const i=e.offsetWidth>t.offsetWidth;return document.body.removeChild(e),i};exports.computeFitCount=l;exports.hasScrollOverflow=n;exports.isMultiLineClamped=o;exports.isOverFlowing=s;exports.isSingleLineClamped=r;exports.isTextWrapping=u;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compute how many items can fit given available width and per-item width,
|
|
3
|
+
* reserving one slot for an overflow indicator.
|
|
4
|
+
*/
|
|
5
|
+
export declare const computeFitCount: (availableWidthPx: number, perItemWidthPx: number, reserveOneSlot?: boolean) => number;
|
|
6
|
+
/**
|
|
7
|
+
* Multi-line truncation via `-webkit-line-clamp`.
|
|
8
|
+
* We consider it “clamped” when:
|
|
9
|
+
* • clamp ≥ 1
|
|
10
|
+
* • display is the special flex-box proxy
|
|
11
|
+
* • overflow is hidden (spec requires this)
|
|
12
|
+
*/
|
|
13
|
+
export declare function isMultiLineClamped(el: HTMLElement, style?: CSSStyleDeclaration): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Single-line truncation via `text-overflow: ellipsis`.
|
|
16
|
+
* We consider it “clamped” when:
|
|
17
|
+
* • text-overflow is ellipsis
|
|
18
|
+
* • white-space is nowrap
|
|
19
|
+
* • overflow is hidden (spec requires this)
|
|
20
|
+
* • scrollWidth > clientWidth
|
|
21
|
+
*/
|
|
22
|
+
export declare function isSingleLineClamped(el: HTMLElement, style?: CSSStyleDeclaration): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Check if an element has scroll overflow.
|
|
25
|
+
*/
|
|
26
|
+
export declare function hasScrollOverflow(el: HTMLElement): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Check if an element is overflowing.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isOverFlowing(el: HTMLElement | null): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check if an element is text wrapping.
|
|
33
|
+
*/
|
|
34
|
+
export declare const isTextWrapping: (element: HTMLElement | null) => boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const l = (t, e, i = !1) => e <= 0 ? 0 : Math.max(
|
|
2
|
+
0,
|
|
3
|
+
Math.floor(t / e) + (i ? 1 : 0)
|
|
4
|
+
);
|
|
5
|
+
function o(t, e = window.getComputedStyle(t)) {
|
|
6
|
+
return parseInt(e.getPropertyValue("-webkit-line-clamp"), 10) >= 1 && e.getPropertyValue("display") === "-webkit-box" && e.getPropertyValue("overflow") === "hidden";
|
|
7
|
+
}
|
|
8
|
+
function r(t, e = window.getComputedStyle(t)) {
|
|
9
|
+
return e.getPropertyValue("text-overflow") === "ellipsis" && e.getPropertyValue("white-space") === "nowrap" && e.getPropertyValue("overflow") === "hidden" && t.scrollWidth > t.clientWidth;
|
|
10
|
+
}
|
|
11
|
+
function n(t) {
|
|
12
|
+
return t.scrollWidth > t.clientWidth || t.scrollHeight > t.clientHeight;
|
|
13
|
+
}
|
|
14
|
+
function s(t) {
|
|
15
|
+
if (!t) return !1;
|
|
16
|
+
if (n(t)) return !0;
|
|
17
|
+
const e = window.getComputedStyle(t);
|
|
18
|
+
return o(t, e) || r(t, e);
|
|
19
|
+
}
|
|
20
|
+
const u = (t) => {
|
|
21
|
+
if (!t) return !1;
|
|
22
|
+
const e = t.cloneNode(!0);
|
|
23
|
+
e.style.position = "absolute", e.style.whiteSpace = "nowrap", e.style.width = "auto", e.style.height = "auto", e.style.visibility = "hidden", document.body.appendChild(e);
|
|
24
|
+
const i = e.offsetWidth > t.offsetWidth;
|
|
25
|
+
return document.body.removeChild(e), i;
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
l as computeFitCount,
|
|
29
|
+
n as hasScrollOverflow,
|
|
30
|
+
o as isMultiLineClamped,
|
|
31
|
+
s as isOverFlowing,
|
|
32
|
+
r as isSingleLineClamped,
|
|
33
|
+
u as isTextWrapping
|
|
34
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=n=>{let e=null;const l=()=>{e===null&&(e=requestAnimationFrame(()=>{e=null,n()}))};return l.cancel=()=>{e!==null&&(cancelAnimationFrame(e),e=null)},l};exports.createRafScheduler=r;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type RafScheduler = (() => void) & {
|
|
2
|
+
cancel: () => void;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Create a one-per-frame requestAnimationFrame scheduler for a callback.
|
|
6
|
+
* Re-entrant safe: multiple calls within a frame coalesce to one execution.
|
|
7
|
+
*/
|
|
8
|
+
export declare const createRafScheduler: (callback: () => void) => RafScheduler;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const r = (n) => {
|
|
2
|
+
let e = null;
|
|
3
|
+
const l = () => {
|
|
4
|
+
e === null && (e = requestAnimationFrame(() => {
|
|
5
|
+
e = null, n();
|
|
6
|
+
}));
|
|
7
|
+
};
|
|
8
|
+
return l.cancel = () => {
|
|
9
|
+
e !== null && (cancelAnimationFrame(e), e = null);
|
|
10
|
+
}, l;
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
r as createRafScheduler
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./constants.cjs.js"),t=e=>`--${r.prefix}comp-${e}`;exports.generateCssVarPrefix=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateCssVarPrefix: <T extends string>(componentName: T) => `--bm-comp-${T}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
2
|
+
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
3
|
+
export type Nullable<T> = T | null;
|
|
4
|
+
export type Optional<T> = T | undefined;
|
|
5
|
+
export type CSSObject = Partial<CSSStyleDeclaration>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@viasat/beam-shared",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Shared utilities, component definitions, and constants for the Beam Design System",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Viasat",
|
|
7
|
+
"homepage": "https://react.beam.viasat.com/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://git.viasat.com/vega/beam",
|
|
11
|
+
"directory": "libs/shared"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://git.viasat.com/vega/beam/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"design-system",
|
|
18
|
+
"beam",
|
|
19
|
+
"utilities",
|
|
20
|
+
"shared",
|
|
21
|
+
"constants"
|
|
22
|
+
],
|
|
23
|
+
"exports": {
|
|
24
|
+
".": {
|
|
25
|
+
"import": "./index.es.js",
|
|
26
|
+
"require": "./index.cjs.js",
|
|
27
|
+
"types": "./index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./components/*": {
|
|
30
|
+
"import": "./lib/components/*.es.js",
|
|
31
|
+
"require": "./lib/components/*.cjs.js",
|
|
32
|
+
"types": "./lib/components/*.d.ts"
|
|
33
|
+
},
|
|
34
|
+
"./utils/*": {
|
|
35
|
+
"import": "./lib/utils/*.es.js",
|
|
36
|
+
"require": "./lib/utils/*.cjs.js",
|
|
37
|
+
"types": "./lib/utils/*.d.ts"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"index.cjs.js",
|
|
42
|
+
"index.es.js",
|
|
43
|
+
"index.d.ts",
|
|
44
|
+
"lib/",
|
|
45
|
+
"chunks/",
|
|
46
|
+
"README.md"
|
|
47
|
+
],
|
|
48
|
+
"sideEffects": false,
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=18.0.0"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@floating-ui/dom": "^1.6.13",
|
|
57
|
+
"@floating-ui/utils": "^0.2.9",
|
|
58
|
+
"attr-accept": "^2.2.5"
|
|
59
|
+
}
|
|
60
|
+
}
|