@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,9 @@
|
|
|
1
|
+
import "../utils/constants.es.js";
|
|
2
|
+
import { D as o, T as t, p as A, b as i, a as p } from "../../chunks/toast.Bs1t4Urq.js";
|
|
3
|
+
export {
|
|
4
|
+
o as DEFAULT_TOAST_TIMEOUT_DURATION,
|
|
5
|
+
t as TOAST_ANIMATION_DURATION,
|
|
6
|
+
A as positions,
|
|
7
|
+
i as toastAppearances,
|
|
8
|
+
p as toastContainerPositions
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../utils/constants.cjs.js");const e=require("../../chunks/tooltip.DZTJP5dS.js");exports.tooltipSizes=e.tooltipSizes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(){return"shared"}exports.shared=e;
|
package/lib/shared.d.ts
ADDED
package/lib/shared.es.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var S=n=>{throw TypeError(n)};var g=(n,e,t)=>e.has(n)||S("Cannot "+t);var o=(n,e,t)=>(g(n,e,"read from private field"),t?t.call(n):e.get(n)),c=(n,e,t)=>e.has(n)?S("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),a=(n,e,t,r)=>(g(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("./constants.cjs.js"),h=typeof window>"u",m=5e3,b=5,I=h?P.BASE_FONT_SIZE:parseFloat(getComputedStyle(document.documentElement).fontSize),E=n=>n*I,R=n=>{const e=O(n);return window.getComputedStyle(document.documentElement).getPropertyValue(e)},M=n=>{const e=parseFloat(n)??0;return n.includes("rem")?E(e):n.includes("px")?e:0},O=n=>{const e=n.match(/var\((.*)\)/);if(!e)return console.warn(`Are you sure you're passing the right arguments? This function isdesigned to accept strings in the format var(--var-name) as found in the tokens file. Received: ${n}`),n;let t=e[0];return e.length>1&&(t=e[1]),t};var l,d,u,f;const i=class i{constructor(){c(this,l);c(this,d);c(this,u);c(this,f);this.lookupMap=new Map,this.subscribers=new Map,a(this,l,(e,t)=>{const r=this.subscribers.get(e);return r?(t&&r.push(t),!0):!1}),a(this,d,(e,t)=>{const r=this.subscribers.get(e);r==null||r.forEach(s=>s(t)),o(this,u).call(this,e)}),a(this,u,e=>{this.subscribers.delete(e)}),a(this,f,(e,t,r)=>{t===0&&this.subscribers.set(e,[r]),setTimeout(()=>{this.findVarHelper(e,t+1,r)},m)})}static getInstance(){return i.instance||(i.instance=new i),i.instance}findVar(e,t){if(h)return"";const r=this.lookupMap.get(e);return o(this,l).call(this,e,t)||r!==void 0&&r!==""||r===""&&!t?r:this.findVarHelper(e,0,t)}findVarHelper(e,t,r){t>b&&(o(this,u).call(this,e),console.warn(`Failed to find CSS variable '${e}' after ${b} retries`));const s=R(e);return this.lookupMap.set(e,s),s?(o(this,d).call(this,e,s),s):(r&&o(this,f).call(this,e,t,r),"")}unsubscribe(e,t){const r=this.subscribers.get(e);if(!r)return;const s=r.indexOf(t);s!==-1&&r.splice(s,1)}};l=new WeakMap,d=new WeakMap,u=new WeakMap,f=new WeakMap,i.instance=null;let p=i;const v=Object.freeze(p.getInstance());exports.CSSManager=v;exports.IS_SERVER=h;exports.LOOKUP_FREQUENCY=m;exports.LOOKUP_MAX_RETRIES=b;exports.convertRemToPixels=E;exports.getCSSVar=R;exports.parseSizeString=M;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
type OnChange = (value: string) => void;
|
|
2
|
+
export declare const IS_SERVER: boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Frequency of retries for CSS variable lookup in milliseconds
|
|
5
|
+
*/
|
|
6
|
+
export declare const LOOKUP_FREQUENCY = 5000;
|
|
7
|
+
/**
|
|
8
|
+
* Maximum number of retries for a CSS variable lookup
|
|
9
|
+
*/
|
|
10
|
+
export declare const LOOKUP_MAX_RETRIES = 5;
|
|
11
|
+
export declare const convertRemToPixels: (rem: number) => number;
|
|
12
|
+
/**
|
|
13
|
+
* Parse CSS variable declared on root to number
|
|
14
|
+
*
|
|
15
|
+
* @precondition CSS variable must be declared on root
|
|
16
|
+
*
|
|
17
|
+
* @param cssVar - CSS variable string to parse
|
|
18
|
+
*
|
|
19
|
+
* @returns string - value of the CSS variable. If not found, returns empty string
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
export declare const getCSSVar: (cssVar: string) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Parse size string to number
|
|
25
|
+
*
|
|
26
|
+
* @param size - size string to parse
|
|
27
|
+
*
|
|
28
|
+
* @precondition size must be in rem or px
|
|
29
|
+
*
|
|
30
|
+
* @returns number - parsed value of the size in px
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
export declare const parseSizeString: (size: string) => number;
|
|
34
|
+
/**
|
|
35
|
+
* CSSLookup is a singleton class that provides a way to lookup CSS variables
|
|
36
|
+
*
|
|
37
|
+
* Recommended not to use this class with variables that depend on light/dark theme
|
|
38
|
+
* as this class returns memoized values
|
|
39
|
+
*/
|
|
40
|
+
declare class CSSLookup {
|
|
41
|
+
#private;
|
|
42
|
+
lookupMap: Map<string, string>;
|
|
43
|
+
subscribers: Map<string, OnChange[]>;
|
|
44
|
+
private static instance;
|
|
45
|
+
private constructor();
|
|
46
|
+
/**
|
|
47
|
+
* Returns the singleton instance of the CSSLookup class.
|
|
48
|
+
* If the instance does not exist, it creates one.
|
|
49
|
+
*/
|
|
50
|
+
static getInstance(): CSSLookup;
|
|
51
|
+
/**
|
|
52
|
+
* Find CSS variable value. Takes in a CSS variable string of format var(--varName)
|
|
53
|
+
* or --varName. If the value is not found, it will retry the lookup every second
|
|
54
|
+
* and will call the onChange function with the value once it is found.
|
|
55
|
+
*
|
|
56
|
+
* @param cssVar
|
|
57
|
+
* @param onChange - callback to call when value is found. if not specified, will
|
|
58
|
+
* not retry lookup
|
|
59
|
+
*/
|
|
60
|
+
findVar(cssVar: string, onChange?: OnChange): string | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Find CSS variable value. Retries if not found initially.
|
|
63
|
+
*
|
|
64
|
+
* Lookup max retries and interval specified by LOOKUP_MAX_RETRIES and LOOKUP_FREQUENCY
|
|
65
|
+
*
|
|
66
|
+
* If callback is not specified, retries will not be attempted. This is useful for
|
|
67
|
+
* cursory lookups where the value is not critical (like initial value of useState
|
|
68
|
+
* hook)
|
|
69
|
+
*
|
|
70
|
+
* @param cssVar CSS variable to find
|
|
71
|
+
* @param onChange callback to call when value is found
|
|
72
|
+
* @param prevRetries previous number of retries
|
|
73
|
+
*/
|
|
74
|
+
findVarHelper(cssVar: string, prevRetries: number, onChange?: OnChange): string;
|
|
75
|
+
/**
|
|
76
|
+
* Unsubscribe from CSS variable value
|
|
77
|
+
*
|
|
78
|
+
* @param cssVar
|
|
79
|
+
* @param onChange
|
|
80
|
+
*/
|
|
81
|
+
unsubscribe(cssVar: string, onChange: OnChange): void;
|
|
82
|
+
}
|
|
83
|
+
export declare const CSSManager: Readonly<CSSLookup>;
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
var p = (n) => {
|
|
2
|
+
throw TypeError(n);
|
|
3
|
+
};
|
|
4
|
+
var h = (n, e, t) => e.has(n) || p("Cannot " + t);
|
|
5
|
+
var o = (n, e, t) => (h(n, e, "read from private field"), t ? t.call(n) : e.get(n)), c = (n, e, t) => e.has(n) ? p("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), a = (n, e, t, r) => (h(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t);
|
|
6
|
+
import { BASE_FONT_SIZE as S } from "./constants.es.js";
|
|
7
|
+
const m = typeof window > "u", E = 5e3, g = 5, I = m ? S : parseFloat(getComputedStyle(document.documentElement).fontSize), w = (n) => n * I, F = (n) => {
|
|
8
|
+
const e = M(n);
|
|
9
|
+
return window.getComputedStyle(document.documentElement).getPropertyValue(e);
|
|
10
|
+
}, x = (n) => {
|
|
11
|
+
const e = parseFloat(n) ?? 0;
|
|
12
|
+
return n.includes("rem") ? w(e) : n.includes("px") ? e : 0;
|
|
13
|
+
}, M = (n) => {
|
|
14
|
+
const e = n.match(/var\((.*)\)/);
|
|
15
|
+
if (!e)
|
|
16
|
+
return console.warn(
|
|
17
|
+
`Are you sure you're passing the right arguments? This function isdesigned to accept strings in the format var(--var-name) as found in the tokens file. Received: ${n}`
|
|
18
|
+
), n;
|
|
19
|
+
let t = e[0];
|
|
20
|
+
return e.length > 1 && (t = e[1]), t;
|
|
21
|
+
};
|
|
22
|
+
var l, f, u, d;
|
|
23
|
+
const i = class i {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
25
|
+
constructor() {
|
|
26
|
+
c(this, l);
|
|
27
|
+
c(this, f);
|
|
28
|
+
c(this, u);
|
|
29
|
+
c(this, d);
|
|
30
|
+
this.lookupMap = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), a(this, l, (e, t) => {
|
|
31
|
+
const r = this.subscribers.get(e);
|
|
32
|
+
return r ? (t && r.push(t), !0) : !1;
|
|
33
|
+
}), a(this, f, (e, t) => {
|
|
34
|
+
const r = this.subscribers.get(e);
|
|
35
|
+
r == null || r.forEach((s) => s(t)), o(this, u).call(this, e);
|
|
36
|
+
}), a(this, u, (e) => {
|
|
37
|
+
this.subscribers.delete(e);
|
|
38
|
+
}), a(this, d, (e, t, r) => {
|
|
39
|
+
t === 0 && this.subscribers.set(e, [r]), setTimeout(() => {
|
|
40
|
+
this.findVarHelper(e, t + 1, r);
|
|
41
|
+
}, E);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Returns the singleton instance of the CSSLookup class.
|
|
46
|
+
* If the instance does not exist, it creates one.
|
|
47
|
+
*/
|
|
48
|
+
static getInstance() {
|
|
49
|
+
return i.instance || (i.instance = new i()), i.instance;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Find CSS variable value. Takes in a CSS variable string of format var(--varName)
|
|
53
|
+
* or --varName. If the value is not found, it will retry the lookup every second
|
|
54
|
+
* and will call the onChange function with the value once it is found.
|
|
55
|
+
*
|
|
56
|
+
* @param cssVar
|
|
57
|
+
* @param onChange - callback to call when value is found. if not specified, will
|
|
58
|
+
* not retry lookup
|
|
59
|
+
*/
|
|
60
|
+
findVar(e, t) {
|
|
61
|
+
if (m) return "";
|
|
62
|
+
const r = this.lookupMap.get(e);
|
|
63
|
+
return o(this, l).call(this, e, t) || r !== void 0 && r !== "" || r === "" && !t ? r : this.findVarHelper(e, 0, t);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Find CSS variable value. Retries if not found initially.
|
|
67
|
+
*
|
|
68
|
+
* Lookup max retries and interval specified by LOOKUP_MAX_RETRIES and LOOKUP_FREQUENCY
|
|
69
|
+
*
|
|
70
|
+
* If callback is not specified, retries will not be attempted. This is useful for
|
|
71
|
+
* cursory lookups where the value is not critical (like initial value of useState
|
|
72
|
+
* hook)
|
|
73
|
+
*
|
|
74
|
+
* @param cssVar CSS variable to find
|
|
75
|
+
* @param onChange callback to call when value is found
|
|
76
|
+
* @param prevRetries previous number of retries
|
|
77
|
+
*/
|
|
78
|
+
findVarHelper(e, t, r) {
|
|
79
|
+
t > g && (o(this, u).call(this, e), console.warn(
|
|
80
|
+
`Failed to find CSS variable '${e}' after ${g} retries`
|
|
81
|
+
));
|
|
82
|
+
const s = F(e);
|
|
83
|
+
return this.lookupMap.set(e, s), s ? (o(this, f).call(this, e, s), s) : (r && o(this, d).call(this, e, t, r), "");
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Unsubscribe from CSS variable value
|
|
87
|
+
*
|
|
88
|
+
* @param cssVar
|
|
89
|
+
* @param onChange
|
|
90
|
+
*/
|
|
91
|
+
unsubscribe(e, t) {
|
|
92
|
+
const r = this.subscribers.get(e);
|
|
93
|
+
if (!r)
|
|
94
|
+
return;
|
|
95
|
+
const s = r.indexOf(t);
|
|
96
|
+
s !== -1 && r.splice(s, 1);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
l = new WeakMap(), f = new WeakMap(), u = new WeakMap(), d = new WeakMap(), i.instance = null;
|
|
100
|
+
let b = i;
|
|
101
|
+
const y = Object.freeze(b.getInstance());
|
|
102
|
+
export {
|
|
103
|
+
y as CSSManager,
|
|
104
|
+
m as IS_SERVER,
|
|
105
|
+
E as LOOKUP_FREQUENCY,
|
|
106
|
+
g as LOOKUP_MAX_RETRIES,
|
|
107
|
+
w as convertRemToPixels,
|
|
108
|
+
F as getCSSVar,
|
|
109
|
+
x as parseSizeString
|
|
110
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./constants.cjs.js"),n=require("./helpers.cjs.js"),c=s=>{const e=`${i.prefix}${s}`,t=`${e}__`,r=`${e}--`,a=`--${i.prefix}comp-${s}`;return{baseClassNamePrefix:e,subElementClassPrefix:t,classModifierPrefix:r,variablePrefix:a,variable(l){return`${a}-${l}`}}},o=s=>n.getTypedEntries(s).reduce((e,[t,r])=>(r&&e.push(`${i.prefix}-${n.camelCaseToKebabCase(`${t}`)}-${r}`),e),[]);exports.generateSpacingClasses=o;exports.getBEMClassNames=c;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Spacing } from '../utils/constants';
|
|
2
|
+
export declare const getBEMClassNames: <T extends string>(componentName: T) => {
|
|
3
|
+
readonly baseClassNamePrefix: `bm-${T}`;
|
|
4
|
+
readonly subElementClassPrefix: `bm-${T}__`;
|
|
5
|
+
readonly classModifierPrefix: `bm-${T}--`;
|
|
6
|
+
readonly variablePrefix: `--bm-comp-${T}`;
|
|
7
|
+
readonly variable: (variableName: string) => keyof CSSStyleDeclaration;
|
|
8
|
+
};
|
|
9
|
+
export declare const generateSpacingClasses: (spacingMap: Record<string, Spacing | undefined>) => string[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { prefix as a } from "./constants.es.js";
|
|
2
|
+
import { getTypedEntries as o, camelCaseToKebabCase as $ } from "./helpers.es.js";
|
|
3
|
+
const l = (r) => {
|
|
4
|
+
const e = `${a}${r}`, t = `${e}__`, s = `${e}--`, i = `--${a}comp-${r}`;
|
|
5
|
+
return {
|
|
6
|
+
baseClassNamePrefix: e,
|
|
7
|
+
subElementClassPrefix: t,
|
|
8
|
+
classModifierPrefix: s,
|
|
9
|
+
variablePrefix: i,
|
|
10
|
+
variable(n) {
|
|
11
|
+
return `${i}-${n}`;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}, m = (r) => o(r).reduce((e, [t, s]) => (s && e.push(`${a}-${$(`${t}`)}-${s}`), e), []);
|
|
15
|
+
export {
|
|
16
|
+
m as generateSpacingClasses,
|
|
17
|
+
l as getBEMClassNames
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n="bm-",u=Math.floor(1e3/120),f=Math.floor(1e3/60),N=Math.floor(1e3/30),x=1e3,I=16,h=["light","dark"],D=e=>`${n}${e}`,F=`data-${n}theme`,R=`${n}theme`,M=`${n}system-mode-enabled`,v="light",A="teal",d="enterprise",O={mode:v,accent:A,productType:d},U=`${n}inverse`,b={accent:"accent",blue:"blue",gray:"gray",green:"green",orange:"orange",pink:"pink",red:"red",teal:"teal",violet:"violet"},L=e=>`${n}expressive-${e}`,$={ENTERPRISE:"enterprise",CONSUMER:"consumer"},V=e=>`${n}${e}`,Y={TEAL:"teal",BLUE:"blue",GREEN:"green",NEUTRAL:"neutral",ORANGE:"orange",PINK:"pink",VIOLET:"violet"},B=e=>`${n}${e}`,s="xxs",r="xs",o="sm",t="md",a="lg",i="xl",w={xxs:s,xs:r,sm:o,md:t,lg:a,xl:i},K=[s,r,o,t,a,i],c="primary",E="secondary",P="info",S="infoPrimary",p="infoSecondary",l="positive",m="warning",T="negative",_="inverse",y="information",g="secondaryInverse",k={primary:c,secondary:E,info:P,infoPrimary:S,infoSecondary:p,positive:l,warning:m,negative:T,inverse:_,information:y,secondaryInverse:g},z=[c,E,S,p,l,m,T,_,g],G="strong",H="medium",j="subtle",X={strong:G,medium:H,subtle:j},Z="default",q={default:Z},J="enterprise",Q="consumer",W={primary:"primary",secondary:"secondary",positive:"positive",warning:"warning",negative:"negative",infoPrimary:"infoPrimary",infoSecondary:"infoSecondary",positiveStrong:"positiveStrong",warningStrong:"warningStrong",negativeStrong:"negativeStrong",infoPrimaryStrong:"infoPrimaryStrong",infoSecondaryStrong:"infoSecondaryStrong",selected:"selected",disabled:"disabled",primaryInverse:"primaryInverse",secondaryInverse:"secondaryInverse",expressive:"expressive",expressiveStronger:"expressiveStronger",expressiveInverse:"expressiveInverse",expressiveInverseStronger:"expressiveInverseStronger"},C={SPACE_0:"0",SPACE_12:"12",SPACE_25:"25",SPACE_50:"50",SPACE_75:"75",SPACE_100:"100",SPACE_125:"125",SPACE_150:"150",SPACE_200:"200",SPACE_300:"300",SPACE_400:"400",SPACE_500:"500",SPACE_700:"700",SPACE_800:"800"},ee=Object.values(C).map(e=>parseFloat(e));exports.ACCENT=Y;exports.ATTRIBUTE=F;exports.BASE_FONT_SIZE=I;exports.BEAM_INVERSE=U;exports.DEFAULT_ACCENT=A;exports.DEFAULT_MODE=v;exports.DEFAULT_PRODUCT_TYPE=d;exports.DEFAULT_THEME=O;exports.EXPRESSIVE_THEMES=b;exports.FPS_1=x;exports.FPS_120=u;exports.FPS_30=N;exports.FPS_60=f;exports.PRODUCT_TYPE=$;exports.STORAGE_KEY=R;exports.SYSTEM_MODE_ENABLED_KEY=M;exports.SpacingValues=C;exports.SpacingValuesAsNumbers=ee;exports.StaticAppearances=q;exports.accentThemeClassName=B;exports.allColors=W;exports.allSizes=w;exports.appearance=z;exports.appearances=k;exports.consumer=Q;exports.emphases=X;exports.enterprise=J;exports.expressiveThemeClassName=L;exports.info=P;exports.infoPrimary=S;exports.infoSecondary=p;exports.information=y;exports.inverse=_;exports.lg=a;exports.md=t;exports.negative=T;exports.positive=l;exports.prefix=n;exports.primary=c;exports.productTypeThemeClassName=V;exports.secondary=E;exports.secondaryInverse=g;exports.sizes=K;exports.sm=o;exports.themeClassName=D;exports.themeTypeValues=h;exports.warning=m;exports.xl=i;exports.xs=r;exports.xxs=s;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export declare const prefix: "bm-";
|
|
2
|
+
export declare const FPS_120: number;
|
|
3
|
+
export declare const FPS_60: number;
|
|
4
|
+
export declare const FPS_30: number;
|
|
5
|
+
export declare const FPS_1 = 1000;
|
|
6
|
+
export declare const BASE_FONT_SIZE = 16;
|
|
7
|
+
/**
|
|
8
|
+
* Theme
|
|
9
|
+
*/
|
|
10
|
+
export interface BeamTheme {
|
|
11
|
+
mode: ThemeTypes;
|
|
12
|
+
accent: Accent;
|
|
13
|
+
productType: ProductType;
|
|
14
|
+
}
|
|
15
|
+
export declare const themeTypeValues: readonly ["light", "dark"];
|
|
16
|
+
export type ThemeTypes = typeof themeTypeValues[number];
|
|
17
|
+
export declare const themeClassName: (theme: ThemeTypes) => string;
|
|
18
|
+
export declare const ATTRIBUTE: "data-bm-theme";
|
|
19
|
+
export declare const STORAGE_KEY: string;
|
|
20
|
+
export declare const SYSTEM_MODE_ENABLED_KEY: string;
|
|
21
|
+
export declare const DEFAULT_MODE = "light";
|
|
22
|
+
export declare const DEFAULT_ACCENT = "teal";
|
|
23
|
+
export declare const DEFAULT_PRODUCT_TYPE = "enterprise";
|
|
24
|
+
export declare const DEFAULT_THEME: BeamTheme;
|
|
25
|
+
/**
|
|
26
|
+
* Inverse Theme
|
|
27
|
+
*/
|
|
28
|
+
export declare const BEAM_INVERSE: "bm-inverse";
|
|
29
|
+
/**
|
|
30
|
+
* Expressive Theme
|
|
31
|
+
*/
|
|
32
|
+
export declare const EXPRESSIVE_THEMES: {
|
|
33
|
+
readonly accent: "accent";
|
|
34
|
+
readonly blue: "blue";
|
|
35
|
+
readonly gray: "gray";
|
|
36
|
+
readonly green: "green";
|
|
37
|
+
readonly orange: "orange";
|
|
38
|
+
readonly pink: "pink";
|
|
39
|
+
readonly red: "red";
|
|
40
|
+
readonly teal: "teal";
|
|
41
|
+
readonly violet: "violet";
|
|
42
|
+
};
|
|
43
|
+
export type ExpressThemes = typeof EXPRESSIVE_THEMES[keyof typeof EXPRESSIVE_THEMES];
|
|
44
|
+
export declare const expressiveThemeClassName: (theme: ExpressThemes) => string;
|
|
45
|
+
/**
|
|
46
|
+
* Product Type Theme
|
|
47
|
+
*/
|
|
48
|
+
export declare const PRODUCT_TYPE: {
|
|
49
|
+
readonly ENTERPRISE: "enterprise";
|
|
50
|
+
readonly CONSUMER: "consumer";
|
|
51
|
+
};
|
|
52
|
+
export type ProductType = typeof PRODUCT_TYPE[keyof typeof PRODUCT_TYPE];
|
|
53
|
+
export declare const productTypeThemeClassName: (theme: ProductType) => string;
|
|
54
|
+
export declare const ACCENT: {
|
|
55
|
+
readonly TEAL: "teal";
|
|
56
|
+
readonly BLUE: "blue";
|
|
57
|
+
readonly GREEN: "green";
|
|
58
|
+
readonly NEUTRAL: "neutral";
|
|
59
|
+
readonly ORANGE: "orange";
|
|
60
|
+
readonly PINK: "pink";
|
|
61
|
+
readonly VIOLET: "violet";
|
|
62
|
+
};
|
|
63
|
+
export type Accent = typeof ACCENT[keyof typeof ACCENT];
|
|
64
|
+
export declare const accentThemeClassName: (accent: Accent) => string;
|
|
65
|
+
/**
|
|
66
|
+
* Size
|
|
67
|
+
*/
|
|
68
|
+
export declare const xxs: "xxs";
|
|
69
|
+
export declare const xs: "xs";
|
|
70
|
+
export declare const sm: "sm";
|
|
71
|
+
export declare const md: "md";
|
|
72
|
+
export declare const lg: "lg";
|
|
73
|
+
export declare const xl: "xl";
|
|
74
|
+
export declare const allSizes: {
|
|
75
|
+
readonly xxs: "xxs";
|
|
76
|
+
readonly xs: "xs";
|
|
77
|
+
readonly sm: "sm";
|
|
78
|
+
readonly md: "md";
|
|
79
|
+
readonly lg: "lg";
|
|
80
|
+
readonly xl: "xl";
|
|
81
|
+
};
|
|
82
|
+
export declare const sizes: readonly ["xxs", "xs", "sm", "md", "lg", "xl"];
|
|
83
|
+
export type Size = typeof sizes[number];
|
|
84
|
+
/**
|
|
85
|
+
* Appearances
|
|
86
|
+
*/
|
|
87
|
+
export declare const primary: "primary";
|
|
88
|
+
export declare const secondary: "secondary";
|
|
89
|
+
export declare const info: "info";
|
|
90
|
+
export declare const infoPrimary: "infoPrimary";
|
|
91
|
+
export declare const infoSecondary: "infoSecondary";
|
|
92
|
+
export declare const positive: "positive";
|
|
93
|
+
export declare const warning: "warning";
|
|
94
|
+
export declare const negative: "negative";
|
|
95
|
+
export declare const inverse: "inverse";
|
|
96
|
+
export declare const information: "information";
|
|
97
|
+
export declare const secondaryInverse: "secondaryInverse";
|
|
98
|
+
export declare const appearances: {
|
|
99
|
+
readonly primary: "primary";
|
|
100
|
+
readonly secondary: "secondary";
|
|
101
|
+
readonly info: "info";
|
|
102
|
+
readonly infoPrimary: "infoPrimary";
|
|
103
|
+
readonly infoSecondary: "infoSecondary";
|
|
104
|
+
readonly positive: "positive";
|
|
105
|
+
readonly warning: "warning";
|
|
106
|
+
readonly negative: "negative";
|
|
107
|
+
readonly inverse: "inverse";
|
|
108
|
+
readonly information: "information";
|
|
109
|
+
readonly secondaryInverse: "secondaryInverse";
|
|
110
|
+
};
|
|
111
|
+
export declare const appearance: readonly ["primary", "secondary", "infoPrimary", "infoSecondary", "positive", "warning", "negative", "inverse", "secondaryInverse"];
|
|
112
|
+
export type Appearance = typeof appearance[number];
|
|
113
|
+
export type AppearanceTo<T> = Record<Appearance, T>;
|
|
114
|
+
export declare const emphases: {
|
|
115
|
+
readonly strong: "strong";
|
|
116
|
+
readonly medium: "medium";
|
|
117
|
+
readonly subtle: "subtle";
|
|
118
|
+
};
|
|
119
|
+
export declare const StaticAppearances: {
|
|
120
|
+
readonly default: "default";
|
|
121
|
+
};
|
|
122
|
+
export type StaticAppearance = typeof StaticAppearances[keyof typeof StaticAppearances];
|
|
123
|
+
export type VoidFunction = (...args: unknown[]) => void;
|
|
124
|
+
/**
|
|
125
|
+
* Shapes
|
|
126
|
+
*/
|
|
127
|
+
export declare const enterprise: "enterprise";
|
|
128
|
+
export declare const consumer: "consumer";
|
|
129
|
+
/**
|
|
130
|
+
* Colors
|
|
131
|
+
*/
|
|
132
|
+
export declare const allColors: {
|
|
133
|
+
readonly primary: "primary";
|
|
134
|
+
readonly secondary: "secondary";
|
|
135
|
+
readonly positive: "positive";
|
|
136
|
+
readonly warning: "warning";
|
|
137
|
+
readonly negative: "negative";
|
|
138
|
+
readonly infoPrimary: "infoPrimary";
|
|
139
|
+
readonly infoSecondary: "infoSecondary";
|
|
140
|
+
readonly positiveStrong: "positiveStrong";
|
|
141
|
+
readonly warningStrong: "warningStrong";
|
|
142
|
+
readonly negativeStrong: "negativeStrong";
|
|
143
|
+
readonly infoPrimaryStrong: "infoPrimaryStrong";
|
|
144
|
+
readonly infoSecondaryStrong: "infoSecondaryStrong";
|
|
145
|
+
readonly selected: "selected";
|
|
146
|
+
readonly disabled: "disabled";
|
|
147
|
+
readonly primaryInverse: "primaryInverse";
|
|
148
|
+
readonly secondaryInverse: "secondaryInverse";
|
|
149
|
+
readonly expressive: "expressive";
|
|
150
|
+
readonly expressiveStronger: "expressiveStronger";
|
|
151
|
+
readonly expressiveInverse: "expressiveInverse";
|
|
152
|
+
readonly expressiveInverseStronger: "expressiveInverseStronger";
|
|
153
|
+
};
|
|
154
|
+
export type AllColors = typeof allColors;
|
|
155
|
+
export declare const SpacingValues: {
|
|
156
|
+
readonly SPACE_0: "0";
|
|
157
|
+
readonly SPACE_12: "12";
|
|
158
|
+
readonly SPACE_25: "25";
|
|
159
|
+
readonly SPACE_50: "50";
|
|
160
|
+
readonly SPACE_75: "75";
|
|
161
|
+
readonly SPACE_100: "100";
|
|
162
|
+
readonly SPACE_125: "125";
|
|
163
|
+
readonly SPACE_150: "150";
|
|
164
|
+
readonly SPACE_200: "200";
|
|
165
|
+
readonly SPACE_300: "300";
|
|
166
|
+
readonly SPACE_400: "400";
|
|
167
|
+
readonly SPACE_500: "500";
|
|
168
|
+
readonly SPACE_700: "700";
|
|
169
|
+
readonly SPACE_800: "800";
|
|
170
|
+
};
|
|
171
|
+
export declare const SpacingValuesAsNumbers: number[];
|
|
172
|
+
type SpacingKeys = keyof typeof SpacingValues;
|
|
173
|
+
export type Spacing = typeof SpacingValues[SpacingKeys];
|
|
174
|
+
export {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
const n = "bm-", N = Math.floor(8.333333333333334), h = Math.floor(1e3 / 60), R = Math.floor(1e3 / 30), $ = 1e3, b = 16, D = ["light", "dark"], F = (e) => `${n}${e}`, M = `data-${n}theme`, O = `${n}theme`, U = `${n}system-mode-enabled`, y = "light", _ = "teal", P = "enterprise", L = {
|
|
2
|
+
mode: y,
|
|
3
|
+
accent: _,
|
|
4
|
+
productType: P
|
|
5
|
+
}, w = `${n}inverse`, V = {
|
|
6
|
+
accent: "accent",
|
|
7
|
+
blue: "blue",
|
|
8
|
+
gray: "gray",
|
|
9
|
+
green: "green",
|
|
10
|
+
orange: "orange",
|
|
11
|
+
pink: "pink",
|
|
12
|
+
red: "red",
|
|
13
|
+
teal: "teal",
|
|
14
|
+
violet: "violet"
|
|
15
|
+
}, B = (e) => `${n}expressive-${e}`, Y = {
|
|
16
|
+
ENTERPRISE: "enterprise",
|
|
17
|
+
CONSUMER: "consumer"
|
|
18
|
+
}, k = (e) => `${n}${e}`, G = {
|
|
19
|
+
TEAL: "teal",
|
|
20
|
+
BLUE: "blue",
|
|
21
|
+
GREEN: "green",
|
|
22
|
+
NEUTRAL: "neutral",
|
|
23
|
+
ORANGE: "orange",
|
|
24
|
+
PINK: "pink",
|
|
25
|
+
VIOLET: "violet"
|
|
26
|
+
}, K = (e) => `${n}${e}`, s = "xxs", o = "xs", t = "sm", r = "md", a = "lg", c = "xl", z = {
|
|
27
|
+
xxs: s,
|
|
28
|
+
xs: o,
|
|
29
|
+
sm: t,
|
|
30
|
+
md: r,
|
|
31
|
+
lg: a,
|
|
32
|
+
xl: c
|
|
33
|
+
}, H = [s, o, t, r, a, c], i = "primary", E = "secondary", A = "info", S = "infoPrimary", p = "infoSecondary", l = "positive", m = "warning", g = "negative", v = "inverse", T = "information", d = "secondaryInverse", j = {
|
|
34
|
+
primary: i,
|
|
35
|
+
secondary: E,
|
|
36
|
+
info: A,
|
|
37
|
+
infoPrimary: S,
|
|
38
|
+
infoSecondary: p,
|
|
39
|
+
positive: l,
|
|
40
|
+
warning: m,
|
|
41
|
+
negative: g,
|
|
42
|
+
inverse: v,
|
|
43
|
+
information: T,
|
|
44
|
+
secondaryInverse: d
|
|
45
|
+
}, X = [
|
|
46
|
+
i,
|
|
47
|
+
E,
|
|
48
|
+
S,
|
|
49
|
+
p,
|
|
50
|
+
l,
|
|
51
|
+
m,
|
|
52
|
+
g,
|
|
53
|
+
v,
|
|
54
|
+
d
|
|
55
|
+
], C = "strong", f = "medium", u = "subtle", Z = {
|
|
56
|
+
strong: C,
|
|
57
|
+
medium: f,
|
|
58
|
+
subtle: u
|
|
59
|
+
}, x = "default", q = {
|
|
60
|
+
default: x
|
|
61
|
+
}, J = "enterprise", Q = "consumer", W = {
|
|
62
|
+
primary: "primary",
|
|
63
|
+
secondary: "secondary",
|
|
64
|
+
positive: "positive",
|
|
65
|
+
warning: "warning",
|
|
66
|
+
negative: "negative",
|
|
67
|
+
infoPrimary: "infoPrimary",
|
|
68
|
+
infoSecondary: "infoSecondary",
|
|
69
|
+
positiveStrong: "positiveStrong",
|
|
70
|
+
warningStrong: "warningStrong",
|
|
71
|
+
negativeStrong: "negativeStrong",
|
|
72
|
+
infoPrimaryStrong: "infoPrimaryStrong",
|
|
73
|
+
infoSecondaryStrong: "infoSecondaryStrong",
|
|
74
|
+
selected: "selected",
|
|
75
|
+
disabled: "disabled",
|
|
76
|
+
primaryInverse: "primaryInverse",
|
|
77
|
+
secondaryInverse: "secondaryInverse",
|
|
78
|
+
expressive: "expressive",
|
|
79
|
+
expressiveStronger: "expressiveStronger",
|
|
80
|
+
expressiveInverse: "expressiveInverse",
|
|
81
|
+
expressiveInverseStronger: "expressiveInverseStronger"
|
|
82
|
+
}, I = {
|
|
83
|
+
SPACE_0: "0",
|
|
84
|
+
SPACE_12: "12",
|
|
85
|
+
SPACE_25: "25",
|
|
86
|
+
SPACE_50: "50",
|
|
87
|
+
SPACE_75: "75",
|
|
88
|
+
SPACE_100: "100",
|
|
89
|
+
SPACE_125: "125",
|
|
90
|
+
SPACE_150: "150",
|
|
91
|
+
SPACE_200: "200",
|
|
92
|
+
SPACE_300: "300",
|
|
93
|
+
SPACE_400: "400",
|
|
94
|
+
SPACE_500: "500",
|
|
95
|
+
SPACE_700: "700",
|
|
96
|
+
SPACE_800: "800"
|
|
97
|
+
}, ee = Object.values(I).map(
|
|
98
|
+
(e) => parseFloat(e)
|
|
99
|
+
);
|
|
100
|
+
export {
|
|
101
|
+
G as ACCENT,
|
|
102
|
+
M as ATTRIBUTE,
|
|
103
|
+
b as BASE_FONT_SIZE,
|
|
104
|
+
w as BEAM_INVERSE,
|
|
105
|
+
_ as DEFAULT_ACCENT,
|
|
106
|
+
y as DEFAULT_MODE,
|
|
107
|
+
P as DEFAULT_PRODUCT_TYPE,
|
|
108
|
+
L as DEFAULT_THEME,
|
|
109
|
+
V as EXPRESSIVE_THEMES,
|
|
110
|
+
$ as FPS_1,
|
|
111
|
+
N as FPS_120,
|
|
112
|
+
R as FPS_30,
|
|
113
|
+
h as FPS_60,
|
|
114
|
+
Y as PRODUCT_TYPE,
|
|
115
|
+
O as STORAGE_KEY,
|
|
116
|
+
U as SYSTEM_MODE_ENABLED_KEY,
|
|
117
|
+
I as SpacingValues,
|
|
118
|
+
ee as SpacingValuesAsNumbers,
|
|
119
|
+
q as StaticAppearances,
|
|
120
|
+
K as accentThemeClassName,
|
|
121
|
+
W as allColors,
|
|
122
|
+
z as allSizes,
|
|
123
|
+
X as appearance,
|
|
124
|
+
j as appearances,
|
|
125
|
+
Q as consumer,
|
|
126
|
+
Z as emphases,
|
|
127
|
+
J as enterprise,
|
|
128
|
+
B as expressiveThemeClassName,
|
|
129
|
+
A as info,
|
|
130
|
+
S as infoPrimary,
|
|
131
|
+
p as infoSecondary,
|
|
132
|
+
T as information,
|
|
133
|
+
v as inverse,
|
|
134
|
+
a as lg,
|
|
135
|
+
r as md,
|
|
136
|
+
g as negative,
|
|
137
|
+
l as positive,
|
|
138
|
+
n as prefix,
|
|
139
|
+
i as primary,
|
|
140
|
+
k as productTypeThemeClassName,
|
|
141
|
+
E as secondary,
|
|
142
|
+
d as secondaryInverse,
|
|
143
|
+
H as sizes,
|
|
144
|
+
t as sm,
|
|
145
|
+
F as themeClassName,
|
|
146
|
+
D as themeTypeValues,
|
|
147
|
+
m as warning,
|
|
148
|
+
c as xl,
|
|
149
|
+
o as xs,
|
|
150
|
+
s as xxs
|
|
151
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=(e,n)=>{const t=e,l=t[n];if(typeof l=="string"&&l.length>0)return l;const r=t.getAttribute(n);return r!==null&&r!==""?r:void 0},d=(e,n,t)=>{const l=t==null?void 0:t.assignedElements({flatten:!0}),r=l?new Set(l):void 0;let o=e;for(;o;){if(r!=null&&r.has(o)||o.parentElement===n)return o;o=o.parentElement}return e},u=(e,n)=>{const t=e.compareDocumentPosition(n);return t&Node.DOCUMENT_POSITION_FOLLOWING?-1:t&Node.DOCUMENT_POSITION_PRECEDING?1:0},i=e=>new DOMRect(e.x+window.scrollX,e.y+window.scrollY,e.width,e.height),s=e=>{if(!e)return null;const n=e.getBoundingClientRect();return i(n)};exports.addScrollToRect=i;exports.compareDomOrder=u;exports.findTopLevelSlottedWrapper=d;exports.getElementScrollBoundingClientRect=s;exports.readStringProp=c;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read a string-valued property from an element, with framework compatibility.
|
|
3
|
+
* Prefers the DOM property (set by Angular/React bindings), and falls back to
|
|
4
|
+
* the attribute when the property is unset.
|
|
5
|
+
*/
|
|
6
|
+
export declare const readStringProp: <T extends HTMLElement>(el: T, prop: string) => string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Given a light-DOM child that is assigned to a Shadow DOM <slot> of `host`,
|
|
9
|
+
* find the top-level wrapper element that is directly slotted into `host`.
|
|
10
|
+
* Falls back to climbing parents until reaching `host`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const findTopLevelSlottedWrapper: (child: HTMLElement, host: HTMLElement, slot?: HTMLSlotElement | null) => HTMLElement;
|
|
13
|
+
/**
|
|
14
|
+
* Compare two nodes by their position in the document for stable ordering.
|
|
15
|
+
*/
|
|
16
|
+
export declare const compareDomOrder: (a: Node, b: Node) => number;
|
|
17
|
+
export declare const addScrollToRect: (rect: DOMRect) => DOMRect;
|
|
18
|
+
export declare const getElementScrollBoundingClientRect: (element?: HTMLElement | null) => DOMRect | null;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const l = (t, n) => {
|
|
2
|
+
const e = t, i = e[n];
|
|
3
|
+
if (typeof i == "string" && i.length > 0) return i;
|
|
4
|
+
const r = e.getAttribute(n);
|
|
5
|
+
return r !== null && r !== "" ? r : void 0;
|
|
6
|
+
}, u = (t, n, e) => {
|
|
7
|
+
const i = e == null ? void 0 : e.assignedElements({ flatten: !0 }), r = i ? new Set(i) : void 0;
|
|
8
|
+
let o = t;
|
|
9
|
+
for (; o; ) {
|
|
10
|
+
if (r != null && r.has(o) || o.parentElement === n) return o;
|
|
11
|
+
o = o.parentElement;
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
}, s = (t, n) => {
|
|
15
|
+
const e = t.compareDocumentPosition(n);
|
|
16
|
+
return e & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : e & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
|
|
17
|
+
}, c = (t) => new DOMRect(
|
|
18
|
+
t.x + window.scrollX,
|
|
19
|
+
t.y + window.scrollY,
|
|
20
|
+
t.width,
|
|
21
|
+
t.height
|
|
22
|
+
), d = (t) => {
|
|
23
|
+
if (!t)
|
|
24
|
+
return null;
|
|
25
|
+
const n = t.getBoundingClientRect();
|
|
26
|
+
return c(n);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
c as addScrollToRect,
|
|
30
|
+
s as compareDomOrder,
|
|
31
|
+
u as findTopLevelSlottedWrapper,
|
|
32
|
+
d as getElementScrollBoundingClientRect,
|
|
33
|
+
l as readStringProp
|
|
34
|
+
};
|