tgui-core 4.0.3 → 4.1.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 +7 -0
- package/dist/common/constants.d.ts +1 -1
- package/dist/common/constants.js +1 -1
- package/dist/common/events.js +1 -1
- package/dist/common/fuzzysearch.js +1 -1
- package/dist/common/hotkeys.js +1 -1
- package/dist/common/random.js +1 -1
- package/dist/common/ui.js +1 -1
- package/dist/common/uuid.js +1 -1
- package/dist/common/vector.js +1 -1
- package/dist/components/AnimatedNumber.d.ts +2 -42
- package/dist/components/AnimatedNumber.js +1 -1
- package/dist/components/Autofocus.js +1 -1
- package/dist/components/Blink.js +1 -1
- package/dist/components/BlockQuote.js +1 -1
- package/dist/components/Box.d.ts +2 -2
- package/dist/components/Box.js +1 -1
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/ByondUi.js +1 -1
- package/dist/components/Chart.js +1 -1
- package/dist/components/Collapsible.js +1 -1
- package/dist/components/ColorBox.js +1 -1
- package/dist/components/Dialog.js +1 -1
- package/dist/components/Dimmer.js +1 -1
- package/dist/components/Divider.js +1 -1
- package/dist/components/DmIcon.js +1 -1
- package/dist/components/DraggableControl.d.ts +4 -1
- package/dist/components/DraggableControl.js +1 -1
- package/dist/components/Dropdown.d.ts +2 -0
- package/dist/components/Dropdown.js +1 -1
- package/dist/components/FitText.js +1 -1
- package/dist/components/Flex.d.ts +1 -1
- package/dist/components/Flex.js +1 -1
- package/dist/components/Floating.d.ts +2 -1
- package/dist/components/Floating.js +1 -1
- package/dist/components/Icon.d.ts +1 -1
- package/dist/components/Icon.js +1 -1
- package/dist/components/Image.d.ts +7 -1
- package/dist/components/Image.js +1 -1
- package/dist/components/ImageButton.d.ts +1 -1
- package/dist/components/ImageButton.js +1 -1
- package/dist/components/InfinitePlane.js +1 -1
- package/dist/components/Input.js +1 -1
- package/dist/components/KeyListener.d.ts +1 -1
- package/dist/components/KeyListener.js +1 -1
- package/dist/components/Knob.d.ts +5 -5
- package/dist/components/Knob.js +1 -1
- package/dist/components/LabeledControls.js +1 -1
- package/dist/components/LabeledList.d.ts +1 -1
- package/dist/components/LabeledList.js +1 -1
- package/dist/components/MenuBar.js +1 -1
- package/dist/components/Modal.d.ts +2 -3
- package/dist/components/Modal.js +1 -1
- package/dist/components/NoticeBox.js +1 -1
- package/dist/components/NumberInput.d.ts +3 -3
- package/dist/components/NumberInput.js +1 -1
- package/dist/components/Popper.js +1 -1
- package/dist/components/ProgressBar.js +1 -1
- package/dist/components/RestrictedInput.js +1 -1
- package/dist/components/RoundGauge.js +1 -1
- package/dist/components/Section.js +1 -1
- package/dist/components/Slider.d.ts +4 -4
- package/dist/components/Slider.js +1 -1
- package/dist/components/Stack.js +1 -1
- package/dist/components/StyleableSection.js +1 -1
- package/dist/components/Table.js +1 -1
- package/dist/components/Tabs.js +1 -1
- package/dist/components/TextArea.js +1 -1
- package/dist/components/TimeDisplay.js +1 -1
- package/dist/components/Tooltip.js +1 -1
- package/dist/components/TrackOutsideClicks.js +1 -1
- package/dist/components/VirtualList.js +1 -1
- package/dist/components/index.js +1 -1
- package/package.json +15 -20
- package/styles/atomic/candystripe.scss +8 -0
- package/styles/atomic/centered-image.scss +7 -0
- package/styles/atomic/color.scss +17 -0
- package/styles/atomic/debug-layout.scss +12 -0
- package/styles/atomic/fit-text.scss +15 -0
- package/styles/atomic/links.scss +21 -0
- package/styles/atomic/outline.scss +43 -0
- package/styles/atomic/text.scss +39 -0
- package/styles/atomic.scss +11 -0
- package/styles/components/BlockQuote.scss +0 -2
- package/styles/components/Button.scss +83 -84
- package/styles/components/Dimmer.scss +0 -2
- package/styles/components/Divider.scss +0 -5
- package/styles/components/Dropdown.scss +8 -0
- package/styles/components/ImageButton.scss +104 -102
- package/styles/components/Input.scss +4 -1
- package/styles/components/Knob.scss +5 -21
- package/styles/components/LabeledList.scss +0 -2
- package/styles/components/NoticeBox.scss +15 -21
- package/styles/components/NumberInput.scss +1 -9
- package/styles/components/ProgressBar.scss +27 -48
- package/styles/components/RestrictedInput.scss +3 -0
- package/styles/components/RoundGauge.scss +8 -13
- package/styles/components/Section.scss +0 -7
- package/styles/components/Slider.scss +49 -42
- package/styles/components/Tabs.scss +1 -12
- package/styles/components/TextArea.scss +3 -0
- package/styles/components/Tooltip.scss +0 -4
- package/styles/functions.scss +10 -0
- package/styles/main.scss +0 -1
- package/styles/reset.scss +1 -0
- package/styles/vars-components.scss +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{classes as n}from"../common/react.js";import{computeBoxProps as o}from"../common/ui.js";import{DmIcon as a}from"./DmIcon.js";import{Icon as i}from"./Icon.js";import{Image as m}from"./Image.js";import{Tooltip as s}from"./Tooltip.js";function c(i){let{asset:c,assetSize:r=32,base64:u,buttons:p,buttonsAlt:d,children:g,className:_,color:h,disabled:I,dmFallback:B,dmIcon:f,dmIconState:x,fluid:$,fallbackIcon:y,imageSize:N=64,imageSrc:b,onClick:v,onRightClick:w,selected:j,title:k,tooltip:z,tooltipPosition:D,...C}=i,q=e("div",{className:"ImageButton__container",onClick:t=>{!I&&v&&v(t)},onContextMenu:t=>{t.preventDefault(),!I&&w&&w(t)},onKeyDown:t=>{"Enter"===t.key&&!I&&v&&v(t)},style:{width:$?"auto":`calc(${N}px + 0.5em + 2px)`},tabIndex:I?void 0:0,children:[t("div",{className:"ImageButton__image",children:u||b?t(m,{height:`${N}px`,src:u?`data:image/png;base64,${u}`:b,width:`${N}px`}):f&&x?t(a,{fallback:B||t(l,{icon:"spinner",size:N,spin:!0}),height:`${N}px`,icon:f,icon_state:x,width:`${N}px`}):c?t(m,{className:n(c||[]),height:`${N}px`,style:{transform:`scale(${N/r})`,transformOrigin:"top left"},width:`${N}px`}):t(l,{icon:y||"question",size:N})}),$?e("div",{className:"ImageButton__content",children:[k&&t("span",{className:n(["ImageButton__content--title",!!g&&"ImageButton__content--divider"]),children:k}),g&&t("span",{className:"ImageButton__content--text",children:g})]}):!!g&&t("span",{className:"ImageButton__content",children:g})]});return z&&(q=t(s,{content:z,position:D,children:q})),e("div",{className:n(["ImageButton",$&&"ImageButton--fluid",j&&"ImageButton--selected",I&&"ImageButton--disabled",!g&&"ImageButton--empty",!(v||w)&&"ImageButton--noAction",h&&"string"==typeof h?`ImageButton__color--${h}`:"ImageButton__color--default",_]),...o(C),children:[q,p&&t("div",{className:n(["ImageButton__buttons",!g&&"ImageButton__buttons--empty"]),style:{width:"auto"},children:p}),d&&t("div",{className:n(["ImageButton__buttons","ImageButton__buttons--alt",!g&&"ImageButton__buttons--empty"]),style:{maxWidth:$?"auto":`calc(${N}px + 0.5em)`,width:`calc(${N}px + ${.5*!$}em)`},children:d})]})}function l(e){let{icon:n,spin:o,size:a=64}=e;return t(i,{className:"ImageButton__image--fallback",height:`${a}px`,name:n,spin:o,style:{fontSize:`${a}px`},width:`${a}px`})}export{c as ImageButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{computeBoxProps as t}from"../common/ui.js";import{useEffect as i,useState as o}from"react";import{Button as r}from"./Button.js";import{ProgressBar as l}from"./ProgressBar.js";import{Stack as s}from"./Stack.js";function a(r){let{backgroundImage:l,children:s,imageWidth:a,zoomPadding:d=0,initialLeft:u=0,initialTop:m=0,onBackgroundMoved:p,onZoomChange:f,...h}=r,[g,v]=o(0),[w,b]=o(0),[x,k]=o(0),[M,$]=o(!1),[j,y]=o(0),[I,Y]=o(1);function C(e){v(e.clientX-x),b(e.clientY-j),$(!0)}function D(e){if(!M)return;let n=e.clientX-g,t=e.clientY-w;p?.(n+u,t+m),k(n),y(t)}function P(){$(!1)}function z(e){if("increase"===e&&I>=1.5||"decrease"===e&&I<=.5)return;let n=Math.round((I+("increase"===e?.1:-.1))*10)/10;Y(n),f?.(n)}i(()=>(window.addEventListener("mouseup",P),()=>{window.removeEventListener("mouseup",P)}),[]);let B=u+x,E=m+j;return n("div",{...t({...h,style:{...h.style,height:"100%",overflow:"hidden",position:"relative",width:"100%"}}),children:[e("div",{onMouseDown:C,onMouseMove:D,onWheel:function(e){0!==e.deltaY&&(e.preventDefault(),z(e.deltaY<0?"increase":"decrease"))},style:{backgroundImage:`url("${l}")`,backgroundPosition:`${B}px ${E}px`,backgroundRepeat:"repeat",backgroundSize:`${I*a}px`,height:"100%",inset:0,position:"absolute",width:"100%"}}),e("div",{onMouseDown:C,onMouseMove:D,style:{height:"100%",inset:0,position:"absolute",transform:`translate(${B}px, ${E}px) scale(${I})`,transformOrigin:"top left",width:"100%"},children:s}),e(c,{padding:d,onZoomClick:z,zoom:I})]})}function c(t){let{zoom:i,padding:o,onZoomClick:a}=t;return e("div",{style:{left:5,position:"absolute",right:5+o,top:5},children:n(s,{children:[e(s.Item,{children:e(r,{disabled:i<=.5,icon:"minus",onClick:()=>a("decrease")})}),e(s.Item,{grow:!0,children:n(l,{maxValue:1.5,minValue:.5,value:i,children:[i,"x"]})}),e(s.Item,{children:e(r,{disabled:i>=1.5,icon:"plus",onClick:()=>a("increase")})})]})})}export{a as InfinitePlane};
|
package/dist/components/Input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{KEY as t,isEscape as r}from"../common/keys.js";import{classes as n}from"../common/react.js";import{debounce as u}from"../common/timer.js";import{computeBoxClassName as o,computeBoxProps as m}from"../common/ui.js";import{useEffect as c,useRef as l,useState as a}from"react";let i=u(e=>e(),250);function p(u){let{autoFocus:p,autoSelect:f,className:s,disabled:d,expensive:g,fluid:v,maxLength:T,monospace:j,onBlur:y,onChange:I,onEnter:b,onEscape:h,onKeyDown:k,placeholder:x,ref:C,selfClear:D,value:E,...w}=u,B=l(null),K=C??B,[L,N]=a(E??"");c(()=>{let e;return(p||f)&&(e=setTimeout(()=>{K.current?.focus(),f&&K.current?.select()},1)),()=>clearTimeout(e)},[]),c(()=>{K.current&&document.activeElement!==K.current&&E!==L&&N(E??"")},[E]);let q=m(w),z=n(["Input",d&&"Input--disabled",v&&"Input--fluid",j&&"Input--monospace",o(w),s]);return e("input",{...q,autoComplete:"off",className:z,disabled:d,maxLength:T,onBlur:()=>y?.(L),onChange:function(e){let t=e.currentTarget.value;N(t),g?i(()=>I?.(t)):I?.(t)},onKeyDown:function(e){if(k?.(e),e.key===t.Enter){e.preventDefault(),b?.(e.currentTarget.value),D&&N(""),e.currentTarget.blur();return}r(e.key)&&(e.preventDefault(),h?.(e.currentTarget.value),e.currentTarget.blur())},placeholder:x,ref:K,spellCheck:!1,type:"text",value:L})}export{p as Input};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{listenForKeyEvents as o}from"../common/hotkeys.js";import{useEffect as n}from"react";function e(e){return n(()=>{let n=o(o=>{e.onKey&&e.onKey(o),o.isDown()&&e.onKeyDown&&e.onKeyDown(o),o.isUp()&&e.onKeyUp&&e.onKeyUp(o)});return()=>{n()}},[]),null}export{e as KeyListener};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { type BooleanLike } from '../common/react.ts';
|
|
1
2
|
import type { Placement } from '@floating-ui/react';
|
|
2
|
-
import { type BooleanLike } from '../common/react';
|
|
3
3
|
import type { BoxProps } from './Box';
|
|
4
4
|
type Props = {
|
|
5
5
|
/** Value itself, controls the position of the cursor. */
|
|
@@ -22,12 +22,12 @@ type Props = {
|
|
|
22
22
|
maxValue: number;
|
|
23
23
|
/** Lowest possible value. */
|
|
24
24
|
minValue: number;
|
|
25
|
-
/** Adjust value by this amount when dragging the input. */
|
|
26
|
-
onChange: (event: Event, value: number) => void;
|
|
27
25
|
/**
|
|
28
|
-
* An event
|
|
29
|
-
*
|
|
26
|
+
* An event which fires when release the knob or enter a number. This is the
|
|
27
|
+
* default value event for controls.
|
|
30
28
|
*/
|
|
29
|
+
onChange: (event: Event, value: number) => void;
|
|
30
|
+
/** An event which fires about every 500ms while dragging the input */
|
|
31
31
|
onDrag: (event: Event, value: number) => void;
|
|
32
32
|
/**
|
|
33
33
|
* Applies a `color` to the outer ring around the knob based on whether the
|
package/dist/components/Knob.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as o,jsxs as r}from"react/jsx-runtime";import{keyOfMatchingRange as e,scale as n}from"../common/math.js";import{classes as t}from"../common/react.js";import{computeBoxClassName as i,computeBoxProps as l}from"../common/ui.js";import{DraggableControl as c}from"./DraggableControl.js";import{Floating as a}from"./Floating.js";function s(s){let{animated:m,format:_,maxValue:d,minValue:b,onChange:h,onDrag:p,step:K,stepPixelSize:f,unclamped:g,unit:u,value:v,bipolar:x,popupPosition:N,className:j,color:y,fillValue:M,ranges:k={},size:P=1,style:w,...B}=s;return o(c,{dragMatrix:[0,-1],animated:m,format:_,maxValue:d,minValue:b,onChange:h,onDrag:p,step:K,stepPixelSize:f,unclamped:g,unit:u,value:v,children:c=>{let{displayElement:s,displayValue:m,dragging:_,handleDragStart:h,inputElement:p}=c,K=n(M??m,b,d),f=n(m,b,d),g=y||e(M??v,k)||"default",u=Math.min((f-.5)*270,225);return o(a,{content:s,contentClasses:"Knob__popupValue",handleOpen:_,placement:N||"top",preventPortal:!0,children:r("div",{className:t(["Knob",`Knob--color--${g}`,x&&"Knob--bipolar",j,i(B)]),...l({style:{fontSize:`${P}em`,...w},...B}),onMouseDown:h,children:[o("div",{className:"Knob__circle",children:o("div",{className:"Knob__cursorBox",style:{transform:`rotate(${u}deg)`},children:o("div",{className:"Knob__cursor"})})}),r("svg",{className:"Knob__ring Knob__ringTrackPivot",viewBox:"0 0 100 100",children:[o("circle",{className:"Knob__ringTrack",cx:"50",cy:"50",r:"50"}),o("title",{children:"track"})]}),r("svg",{className:"Knob__ring Knob__ringFillPivot",viewBox:"0 0 100 100",children:[o("title",{children:"fill"}),o("circle",{className:"Knob__ringFill",cx:"50",cy:"50",r:"50",style:{strokeDashoffset:Math.max(((x?2.75:2)-1.5*K)*Math.PI*50,0)}})]}),p]})})}})}export{s as Knob};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Flex as r}from"./Flex.js";function n(t){let{children:n,wrap:i,...l}=t;return e(r,{align:"stretch",justify:"space-between",mx:-.5,wrap:i,...l,children:n})}n.Item=function(n){let{label:i,children:l,mx:c=1,...m}=n;return e(r.Item,{mx:c,children:t(r,{align:"center",direction:"column",height:"100%",justify:"space-between",textAlign:"center",...m,children:[e(r.Item,{}),e(r.Item,{children:l}),e(r.Item,{color:"label",children:i})]})})};export{n as LabeledControls};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { type BooleanLike } from '../common/react.ts';
|
|
1
2
|
import type { Placement } from '@floating-ui/react';
|
|
2
3
|
import type { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
import { type BooleanLike } from '../common/react';
|
|
4
4
|
export declare function LabeledList(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
type LabeledListItemProps = Partial<{
|
|
6
6
|
/** Buttons to render aside the content. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;import
|
|
1
|
+
var e;import{jsx as t,jsxs as l}from"react/jsx-runtime";import{classes as i}from"../common/react.js";import{unit as r}from"../common/ui.js";import{Box as o}from"./Box.js";import{Divider as a}from"./Divider.js";import{Tooltip as s}from"./Tooltip.js";function d(e){let{children:l}=e;return t("table",{className:"LabeledList",children:t("tbody",{children:l})})}(e=d||(d={})).Divider=function(e){let l=e.size?r(Math.max(0,e.size-1)):0;return t("tr",{className:"LabeledList__row",children:t("td",{colSpan:3,style:{paddingBottom:l,paddingTop:l},children:t(a,{})})})},e.Item=function(e){let r,{className:a,label:d,labelColor:n="label",labelWrap:c,color:m,textAlign:L,buttons:p,content:b,children:_,verticalAlign:h="baseline",preserveWhitespace:f,tooltip:u,tooltipPosition:v}=e;d&&(r=d,"string"==typeof d&&(r+=":")),void 0!==u&&(r=t(s,{content:u,position:v,children:t(o,{as:"span",style:{borderBottom:"2px dotted rgba(255, 255, 255, 0.8)"},children:r})}));let g=t(o,{as:"td",className:i(["LabeledList__cell",!c&&"LabeledList__label--nowrap"]),color:n,preserveWhitespace:f,verticalAlign:h,children:r});return l("tr",{className:i(["LabeledList__row",a]),children:[g,l(o,{as:"td",className:"LabeledList__cell",color:m,colSpan:p?void 0:2,textAlign:L,verticalAlign:h,children:[b,_]}),p&&t("td",{className:"LabeledList__cell LabeledList__buttons",children:p})]})};export{d as LabeledList};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e,jsxs as n}from"react/jsx-runtime";import{classes as r}from"../common/react.js";import{useRef as a}from"react";import{Box as t}from"./Box.js";import{Floating as o}from"./Floating.js";import{Icon as u}from"./Icon.js";function l(n){let{children:u,className:l,disabled:i,display:c,onClick:s,onMouseOver:m,open:_,openWidth:M,onOutsideClick:d,...B}=n,h=a(null);return e(o,{allowedOutsideClasses:".Menubar_inner",content:e("div",{className:"MenuBar__menu",style:{width:M},children:u}),children:e("div",{className:"Menubar_inner",ref:h,children:e(t,{className:r(["MenuBar__MenuBarButton","MenuBar__font","MenuBar__hover",l]),...B,onClick:i?()=>null:s,onMouseOver:m,children:e("span",{className:"MenuBar__MenuBarButton-text",children:c})})})})}function i(n){let{entry:r,children:a,openWidth:t,display:o,setOpenMenuBar:u,openMenuBar:i,setOpenOnHover:c,openOnHover:s,disabled:m,className:_}=n;return e(l,{className:_,disabled:m,display:o,onClick:()=>{u(i===r?null:r),c(!s)},onMouseOver:()=>{s&&u(r)},onOutsideClick:()=>{u(null),c(!1)},open:i===r,openWidth:t,children:a})}function c(n){let{children:r}=n;return e(t,{className:"MenuBar",children:r})}c.Dropdown=i,i.MenuItemToggle=function(a){let{value:o,displayText:l,onClick:i,checked:c}=a;return n(t,{className:r(["MenuBar__font","MenuBar__MenuItem","MenuBar__MenuItemToggle","MenuBar__hover"]),onClick:()=>i(o),children:[e("div",{className:"MenuBar__MenuItemToggle__check",children:e(u,{name:c?"check":"",size:1.3})}),l]})},i.MenuItem=function(n){let{value:a,displayText:o,onClick:u}=n;return e(t,{className:r(["MenuBar__font","MenuBar__MenuItem","MenuBar__hover"]),onClick:()=>u?.(a),children:o})},i.Separator=function(){return e("div",{className:"MenuBar__Separator"})};export{c as MenuBar};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type { KeyboardEvent } from 'react';
|
|
2
1
|
import type { BoxProps } from './Box';
|
|
3
2
|
export type ModalProps = Partial<{
|
|
4
3
|
/** Fires once the enter key is pressed */
|
|
5
|
-
onEnter: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
4
|
+
onEnter: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
6
5
|
/** Fires once the escape key is pressed */
|
|
7
|
-
onEscape: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
6
|
+
onEscape: (e: React.KeyboardEvent<HTMLInputElement>) => void;
|
|
8
7
|
}> & BoxProps;
|
|
9
8
|
/**
|
|
10
9
|
* ## Modal
|
package/dist/components/Modal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{KEY as m,isEscape as r}from"../common/keys.js";import{classes as e}from"../common/react.js";import{computeBoxClassName as i,computeBoxProps as n}from"../common/ui.js";import{Dimmer as t}from"./Dimmer.js";function c(c){let{className:s,children:a,onEnter:l,onEscape:d,...f}=c;return o(t,{className:"Modal__dimmer",onKeyDown:function(o){o.key===m.Enter&&l?.(o),r(o.key)&&d?.(o)},children:o("div",{className:e(["Modal",s,i(f)]),...n(f),children:a})})}export{c as Modal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{classes as t}from"../common/react.js";import{Box as e}from"./Box.js";function c(c){let{className:r,color:i,info:m,success:x,danger:s,...n}=c;return o(e,{className:t(["NoticeBox",i&&`NoticeBox--color--${i}`,m&&"NoticeBox--type--info",x&&"NoticeBox--type--success",s&&"NoticeBox--type--danger",r]),...n})}export{c as NoticeBox};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { type
|
|
1
|
+
import { type BooleanLike } from '../common/react.ts';
|
|
2
|
+
import { Component, type FocusEventHandler, type KeyboardEventHandler } from 'react';
|
|
3
3
|
import { type BoxProps } from './Box';
|
|
4
4
|
type Props = Required<{
|
|
5
5
|
/** Highest possible value. */
|
|
@@ -49,7 +49,7 @@ export declare class NumberInput extends Component<Props, State> {
|
|
|
49
49
|
dragInterval: NodeJS.Timeout;
|
|
50
50
|
state: State;
|
|
51
51
|
componentDidMount(): void;
|
|
52
|
-
handleDragStart: MouseEventHandler<HTMLDivElement>;
|
|
52
|
+
handleDragStart: React.MouseEventHandler<HTMLDivElement>;
|
|
53
53
|
handleDragMove: (event: MouseEvent) => void;
|
|
54
54
|
handleDragEnd: (_event: MouseEvent) => void;
|
|
55
55
|
handleBlur: FocusEventHandler<HTMLInputElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{KEY as r,isEscape as i}from"../common/keys.js";import{clamp as n,round as s}from"../common/math.js";import{classes as a}from"../common/react.js";import{Component as o,createRef as u}from"react";import{AnimatedNumber as l}from"./AnimatedNumber.js";import{Box as m}from"./Box.js";class h extends o{inputRef=u();dragTimeout;dragInterval;state={currentValue:0,dragging:!1,editing:!1,origin:0,previousValue:0};componentDidMount(){let e=Number.parseFloat(this.props.value.toString());this.setState({currentValue:e,previousValue:e})}handleDragStart=e=>{let{value:t,disabled:r}=this.props,{editing:i}=this.state;if(r||i)return;document.body.style["pointer-events"]="none";let n=Number.parseFloat(t.toString());this.setState({currentValue:n,dragging:!1,origin:e.screenY,previousValue:n}),this.dragTimeout=setTimeout(()=>{this.setState({dragging:!0})},250),this.dragInterval=setInterval(()=>{let{dragging:e,currentValue:t,previousValue:r}=this.state,{onDrag:i}=this.props;e&&t!==r&&(this.setState({previousValue:t}),i?.(t))},400),document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd)};handleDragMove=e=>{let{minValue:t,maxValue:r,step:i,stepPixelSize:a,disabled:o}=this.props;o||this.setState(o=>{let u={...o},l=u.origin-e.screenY;if(o.dragging){let o=a||1,m=n(u.currentValue+l*i/o,t-i,r+i);Math.abs(m-u.currentValue)>=i?(u.currentValue=n(s(m/i,0)*i,t,r),u.origin=e.screenY):Math.abs(l)>o&&(u.origin=e.screenY)}else Math.abs(l)>4&&(u.dragging=!0);return u})};handleDragEnd=e=>{let{dragging:t,currentValue:r}=this.state,{onDrag:i,onChange:n,disabled:s}=this.props;if(!s){if(document.body.style["pointer-events"]="auto",clearInterval(this.dragInterval),clearTimeout(this.dragTimeout),this.setState({dragging:!1,editing:!t,previousValue:r}),t)n?.(r),i?.(r);else if(this.inputRef){let e=this.inputRef.current;e&&(e.value=`${r}`,setTimeout(()=>{e.focus(),e.select()},10))}document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd)}};handleBlur=e=>{let{editing:t,previousValue:r}=this.state,{minValue:i,maxValue:s,onChange:a,onDrag:o,disabled:u}=this.props;if(u||!t)return;let l=n(Number.parseFloat(e.target.value),i,s);if(Number.isNaN(l))return void this.setState({editing:!1});this.setState({currentValue:l,editing:!1,previousValue:l}),r!==l&&(a?.(l),o?.(l))};handleKeyDown=e=>{let{minValue:t,maxValue:s,onChange:a,onDrag:o,disabled:u}=this.props;if(u)return;let{previousValue:l}=this.state;if(e.key===r.Enter){let r=n(Number.parseFloat(e.currentTarget.value),t,s);if(Number.isNaN(r))return void this.setState({editing:!1});this.setState({currentValue:r,editing:!1,previousValue:r}),l!==r&&(a?.(r),o?.(r))}else i(e.key)&&this.setState({editing:!1})};render(){let{dragging:r,editing:i,currentValue:s}=this.state,{className:o,fluid:u,animated:h,unit:d,value:p,minValue:g,maxValue:c,height:v,width:f,lineHeight:N,fontSize:b,format:S}=this.props,V=Number.parseFloat(p.toString());r&&(V=s);let y=t("div",{className:"NumberInput__content",children:[h&&!r?e(l,{format:S,value:V}):S?S(V):V,d?` ${d}`:""]});return t(m,{className:a(["NumberInput",u&&"NumberInput--fluid",o]),fontSize:b,lineHeight:N,minHeight:v,minWidth:f,onMouseDown:this.handleDragStart,children:[e("div",{className:"NumberInput__barContainer",children:e("div",{className:"NumberInput__bar",style:{height:`${n((V-g)/(c-g)*100,0,100)}%`}})}),y,e("input",{className:"NumberInput__input",onBlur:this.handleBlur,onKeyDown:this.handleKeyDown,ref:this.inputRef,style:{display:i?"inline":"none",fontSize:b,height:v,lineHeight:N}})]})}}export{h as NumberInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{Fragment as e,jsx as r,jsxs as n}from"react/jsx-runtime";import{autoUpdate as t,flip as i,offset as o,shift as l,useDismiss as d,useFloating as c,useInteractions as f}from"@floating-ui/react";function m(m){let{baseZIndex:p=5,children:a,content:h,isOpen:s,onClickOutside:u,placement:g}=m,{refs:x,floatingStyles:v,context:w}=c({middleware:[o(5),i(),l()],onOpenChange:u,open:s,placement:g,whileElementsMounted:t}),{getReferenceProps:j,getFloatingProps:y}=f([d(w)]);return n(e,{children:[r("div",{ref:x.setReference,...j(),children:a}),s&&r("div",{ref:x.setFloating,style:{...v,zIndex:p},...y(),children:h})]})}export{m as Popper};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as r,jsxs as o}from"react/jsx-runtime";import{CSS_COLORS as s}from"../common/constants.js";import{clamp01 as e,keyOfMatchingRange as m,scale as t,toFixed as a}from"../common/math.js";import{classes as i}from"../common/react.js";import{computeBoxClassName as l,computeBoxProps as c}from"../common/ui.js";function n(n){let{className:d,value:f,minValue:u=0,maxValue:g=1,color:p,ranges:B={},empty:P,children:_,...h}=n,j=t(f,u,g),v=void 0!==_,y=p||m(f,B)||"default",N=c(h),$=["ProgressBar",d,l(h)],b={width:`${100*e(j)}%`};return s.includes(y)||"default"===y?$.push(`ProgressBar--color--${y}`):(N.style={...N.style,borderColor:y},b.backgroundColor=y),o("div",{className:i($),...N,children:[r("div",{className:"ProgressBar__fill ProgressBar__fill--animated",style:b}),r("div",{className:"ProgressBar__content",children:v?_:!P&&`${a(100*j)}%`})]})}export{n as ProgressBar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{KEY as t,isEscape as r}from"../common/keys.js";import{classes as n}from"../common/react.js";import{debounce as u}from"../common/timer.js";import{computeBoxClassName as o,computeBoxProps as i}from"../common/ui.js";import{useEffect as m,useRef as c,useState as l}from"react";let a=u(e=>e(),250);function f(u){let{allowFloats:f,autoFocus:p,autoSelect:s,className:d,disabled:v,expensive:y,fluid:I,maxValue:b=1e4,minValue:j=0,monospace:k,onBlur:D,onChange:x,onEnter:C,onEscape:R,onKeyDown:g,onValidationChange:h,value:E,...N}=u,T=c(null),[w,B]=l(E??j),[K,M]=l(!0);function q(e){x&&(y?a(()=>x(e)):x(e))}m(()=>{let e;return(p||s)&&(e=setTimeout(()=>{T.current?.focus(),s&&T.current?.select()},1)),()=>clearTimeout(e)},[]),m(()=>{if(T.current){let e=T.current.validity.valid;K!==e&&(M(e),h?.(e))}},[w]),m(()=>{T.current&&document.activeElement!==T.current&&E!==w&&B(E??j)},[E]);let z=i(N),A=n(["Input","RestrictedInput",v&&"Input--disabled",I&&"Input--fluid",k&&"Input--monospace",o(N),d,!K&&"RestrictedInput--invalid"]);return e("input",{...z,autoComplete:"off",className:A,disabled:v,max:b,min:j,onBlur:function(e){D?.(w)},onChange:function(e){let t=Number(e.target.value);B(t),q(t)},onKeyDown:function(e){if(g?.(e),e.key===t.Enter){e.preventDefault(),C?.(w),T.current?.blur();return}if(r(e.key)){e.preventDefault(),R?.(w),T.current?.blur();return}if(e.key===t.Minus){e.preventDefault();let t=-1*w;B(t),q(t);return}},ref:T,spellCheck:!1,step:f?"any":"1",type:"number",value:w})}export{f as RestrictedInput};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e,jsxs as r}from"react/jsx-runtime";import{clamp01 as a,keyOfMatchingRange as o,scale as t}from"../common/math.js";import{classes as n}from"../common/react.js";import{computeBoxClassName as l,computeBoxProps as c}from"../common/ui.js";import{AnimatedNumber as i}from"./AnimatedNumber.js";function m(m){let{alertAfter:s,alertBefore:u,className:d,format:g,maxValue:C=1,minValue:_=1,ranges:f,size:h=1,style:p,value:G,...R}=m,N=a(t(G,_,C)),y=f?{}:{primary:[0,1]};if(f)for(let e in f){let r=f[e];y[e]=[t(r[0],_,C),t(r[1],_,C)]}let x=(!!s&&!!u&&!!(G>s)&&!!(G<u)||!!s&&!!(G>s)||!!u&&!!(G<u))&&o(N,y);return r("div",{className:"RoundGauge__wrapper",children:[e("div",{className:n(["RoundGauge",d,l(R)]),...c({style:{fontSize:`${h}em`,...p},...R}),children:r("svg",{viewBox:"0 0 100 50",children:[(s||u)&&e("g",{className:n(["RoundGauge__alert",x?`active RoundGauge__alert--${x}`:""]),children:e("path",{d:"M48.211,14.578C48.55,13.9 49.242,13.472 50,13.472C50.758,13.472 51.45,13.9 51.789,14.578C54.793,20.587 60.795,32.589 63.553,38.106C63.863,38.726 63.83,39.462 63.465,40.051C63.101,40.641 62.457,41 61.764,41C55.996,41 44.004,41 38.236,41C37.543,41 36.899,40.641 36.535,40.051C36.17,39.462 36.137,38.726 36.447,38.106C39.205,32.589 45.207,20.587 48.211,14.578ZM50,34.417C51.426,34.417 52.583,35.574 52.583,37C52.583,38.426 51.426,39.583 50,39.583C48.574,39.583 47.417,38.426 47.417,37C47.417,35.574 48.574,34.417 50,34.417ZM50,32.75C50,32.75 53,31.805 53,22.25C53,20.594 51.656,19.25 50,19.25C48.344,19.25 47,20.594 47,22.25C47,31.805 50,32.75 50,32.75Z"})}),e("g",{children:e("circle",{className:"RoundGauge__ringTrack",cx:"50",cy:"50",r:"45"})}),e("g",{children:Object.keys(y).map((r,a)=>{let o=y[r];return e("circle",{className:`RoundGauge__ringFill RoundGauge--color--${r}`,cx:"50",cy:"50",r:"45",style:{strokeDashoffset:Math.max((2-(o[1]-o[0]))*Math.PI*50,0)},transform:`rotate(${180+180*o[0]} 50 50)`},a)})}),r("g",{className:"RoundGauge__needle",transform:`rotate(${180*N-90} 50 50)`,children:[e("polygon",{className:"RoundGauge__needleLine",points:"46,50 50,0 54,50"}),e("circle",{className:"RoundGauge__needleMiddle",cx:"50",cy:"50",r:"8"})]}),e("title",{children:"alert"})]})}),e(i,{format:g,value:G})]})}export{m as RoundGauge};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{addScrollableNode as n,removeScrollableNode as o}from"../common/events.js";import{canRender as c,classes as i}from"../common/react.js";import{computeBoxClassName as r,computeBoxProps as l}from"../common/ui.js";import{useEffect as s,useRef as m}from"react";function a(a){let{buttons:d,children:S,className:_,container_id:f="",fill:u,fitted:p,flexGrow:h,noTopPadding:v,onScroll:N,ref:j,scrollable:x,scrollableHorizontal:b,stretchContents:T,title:g,...z}=a,C=c(g)||c(d),H=m(null),P=j??H;return s(()=>(P.current&&(x||b)&&n(P.current),()=>{P.current&&o(P.current)}),[]),t("div",{className:i(["Section",u&&"Section--fill",p&&"Section--fitted",x&&"Section--scrollable",b&&"Section--scrollableHorizontal",h&&"Section--flex",_,r(z)]),id:f,...l(z),children:[C&&t("div",{className:"Section__title",children:[e("span",{className:"Section__titleText",children:g}),e("div",{className:"Section__buttons",children:d})]}),e("div",{className:"Section__rest",children:e("div",{className:i(["Section__content",T&&"Section__content--stretchContents",v&&"Section__content--noTopPadding"]),onScroll:N,ref:P,children:S})})]})}export{a as Section};
|
|
@@ -23,12 +23,12 @@ type Props = {
|
|
|
23
23
|
fillValue: number;
|
|
24
24
|
/** Format value using this function before displaying it. */
|
|
25
25
|
format: (value: number) => string;
|
|
26
|
-
/** Adjust value by this amount when dragging the input. */
|
|
27
|
-
onChange: (event: Event, value: number) => void;
|
|
28
26
|
/**
|
|
29
|
-
* An event which fires when you release the
|
|
30
|
-
*
|
|
27
|
+
* An event which fires when you release the slider or enter a number. This is
|
|
28
|
+
* the default value event for controls.
|
|
31
29
|
*/
|
|
30
|
+
onChange: (event: Event, value: number) => void;
|
|
31
|
+
/** An event which fires only while dragging the slider. */
|
|
32
32
|
onDrag: (event: Event, value: number) => void;
|
|
33
33
|
/**
|
|
34
34
|
* Applies a `color` to the slider based on whether the value lands in the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as r,jsxs as e}from"react/jsx-runtime";import{clamp01 as i,keyOfMatchingRange as s,scale as l}from"../common/math.js";import{classes as a}from"../common/react.js";import{computeBoxClassName as o,computeBoxProps as t}from"../common/ui.js";import{DraggableControl as m}from"./DraggableControl.js";function d(d){let{animated:c,format:n,maxValue:_,minValue:f,onChange:h,onDrag:u,step:g,stepPixelSize:p,unit:v,value:B,className:N,fillValue:P,color:S,ranges:j={},children:w,...x}=d,y=void 0!==w;return r(m,{dragMatrix:[1,0],animated:c,format:n,maxValue:_,minValue:f,onChange:h,onDrag:u,step:g,stepPixelSize:p,unit:v,value:B,children:m=>{let{displayElement:d,displayValue:c,dragging:n,editing:h,handleDragStart:u,inputElement:g}=m,p=null!=P,v=i(l(P??c,f,_)),M=i(l(c,f,_)),$=S||s(P??B,j)||"default";return e("div",{className:a(["Slider",h&&"Slider--editing","ProgressBar",`ProgressBar--color--${$}`,N,o(x)]),...t(x),onMouseDown:u,children:[r("div",{className:a(["ProgressBar__fill",p&&!n&&"ProgressBar__fill--animated"]),style:{opacity:.4,width:`${100*Math.max(v,M)}%`}}),r("div",{className:a(["ProgressBar__fill",!n&&"ProgressBar__fill--animated"]),style:{width:`${100*Math.min(v,M)}%`}}),r("div",{className:"Slider__cursorOffset",style:{width:`${100*M}%`},children:r("div",{className:"Slider__cursor",children:n&&r("div",{className:"Slider__popupValue",children:d})})}),r("div",{className:"ProgressBar__content",children:y?w:d}),g]})}})}export{d as Slider};
|
package/dist/components/Stack.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{classes as r}from"../common/react.js";import{computeBoxClassName as e}from"../common/ui.js";import{useRef as i}from"react";import{computeFlexClassName as c,computeFlexItemProps as a,computeFlexProps as o}from"./Flex.js";function m(e){let{className:i,vertical:a,fill:m,reverse:n,zebra:l,...s}=e,d=n?"-reverse":"";return t("div",{className:r(["Stack",m&&"Stack--fill",a?"Stack--vertical":"Stack--horizontal",l&&"Stack--zebra",n&&`Stack--reverse${a?"--vertical":""}`,i,c(e)]),...o({direction:`${a?"column":"row"}${d}`,...s})})}m.Item=function(c){let{className:o,innerRef:m,...n}=c,l=i(m?.current??null);return t("div",{className:r(["Stack__item",o,e(n)]),ref:l,...a(n)})},m.Divider=function(i){let{className:c,hidden:o,...m}=i;return t("div",{className:r(["Stack__item","Stack__divider",o&&"Stack__divider--hidden",c,e(m)]),...a(m)})};export{m as Stack};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Box as c}from"./Box.js";function i(i){let{children:l,titleStyle:n,titleSubtext:s,title:r,textStyle:o,style:a}=i;return t(c,{style:a,children:[t(c,{className:"Section__title",style:n,children:[e(c,{className:"Section__titleText",style:o,children:r}),e("div",{className:"Section__buttons",children:s})," "]}),e(c,{className:"Section__rest",children:e(c,{className:"Section__content",children:l})})]})}export{i as StyleableSection};
|
package/dist/components/Table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e;import
|
|
1
|
+
var e;import{jsx as l}from"react/jsx-runtime";import{classes as a}from"../common/react.js";import{computeBoxClassName as r,computeBoxProps as o}from"../common/ui.js";function t(e){let{className:t,collapsing:c,children:n,...m}=e;return l("table",{className:a(["Table",c&&"Table--collapsing",t,r(m)]),...o(m),children:l("tbody",{children:n})})}(e=t||(t={})).Cell=function(e){let{className:t,collapsing:c,colSpan:n,header:m,...b}=e;return l("td",{className:a(["Table__cell",c&&"Table__cell--collapsing",m&&"Table__cell--header",t,r(e)]),colSpan:n,...o(b)})},e.Row=function(e){let{className:t,header:c,...n}=e;return l("tr",{className:a(["Table__row",c&&"Table__row--header",t,r(e)]),...o(n)})};export{t as Table};
|
package/dist/components/Tabs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as a,jsxs as e}from"react/jsx-runtime";import{canRender as s,classes as i}from"../common/react.js";import{computeBoxClassName as r,computeBoxProps as l}from"../common/ui.js";import{Icon as c}from"./Icon.js";function t(e){let{className:s,vertical:c,fill:t,fluid:o,children:m,...n}=e;return a("div",{className:i(["Tabs",c?"Tabs--vertical":"Tabs--horizontal",t&&"Tabs--fill",o&&"Tabs--fluid",s,r(n)]),...l(n),children:m})}(t||(t={})).Tab=function(t){let{className:o,selected:m,color:n,icon:b,iconSpin:T,leftSlot:d,rightSlot:_,children:f,onClick:h,...u}=t;return e("div",{className:i(["Tab","Tabs__Tab",`Tab--color--${n}`,m&&"Tab--selected",o,r(u)]),onClick:a=>h?.(a),...l(u),children:[s(d)&&a("div",{className:"Tab__left",children:d})||!!b&&a("div",{className:"Tab__left",children:a(c,{name:b,spin:T})}),a("div",{className:"Tab__text",children:f}),s(_)&&a("div",{className:"Tab__right",children:_})]})};export{t as Tabs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{KEY as t,isEscape as r}from"../common/keys.js";import{classes as n}from"../common/react.js";import{computeBoxClassName as u,computeBoxProps as o}from"../common/ui.js";import{debounce as a}from"../common/timer.js";import{useEffect as c,useRef as l,useState as m}from"react";let i=a(e=>e(),250);function s(a){let{autoFocus:s,autoSelect:f,className:g,disabled:p,dontUseTabForIndent:T,expensive:v,fluid:y,maxLength:b,monospace:d,onBlur:k,onChange:$,onEnter:h,onEscape:x,onKeyDown:j,placeholder:D,ref:E,selfClear:I,userMarkup:K,value:C,...A}=a,w=l(null),B=E??w,[L,N]=m(C??"");c(()=>{(s||f)&&setTimeout(()=>{B.current?.focus(),f&&B.current?.select()},1)},[]),c(()=>{B.current&&document.activeElement!==B.current&&C!==L&&N(C??"")},[C]);let q=o(A),z=n(["Input","TextArea",y&&"Input--fluid",d&&"Input--monospace",p&&"Input--disabled",u(A),g]);return e("textarea",{...q,autoComplete:"off",className:z,maxLength:b,onBlur:function(e){k?.(L)},onChange:function(e){let t=e.currentTarget.value;N(t),$&&(v?i(()=>$(t)):$(t))},onKeyDown:function(e){if(j?.(e),e.key===t.Enter&&!e.shiftKey){e.preventDefault(),h?.(e.currentTarget.value),I&&N(""),e.currentTarget.blur();return}if(r(e.key)){x?.(e.currentTarget.value),e.currentTarget.blur();return}if(!T&&e.key===t.Tab){e.preventDefault();let{value:t,selectionStart:r,selectionEnd:n}=e.currentTarget;N(`${t.substring(0,r)} ${t.substring(n)}`),e.currentTarget.selectionEnd=r+1,$?.(e.currentTarget.value);return}if(K&&(e.ctrlKey||e.metaKey)&&K[e.key]){e.preventDefault();let{selectionStart:t,selectionEnd:r,value:n}=e.currentTarget,u=K[e.key];N(`${n.substring(0,t)}${u}${n.substring(t,r)}${u}${n.substring(r)}`),e.currentTarget.selectionEnd=r+2*u.length,$?.(e.currentTarget.value);return}},placeholder:D,ref:B,spellCheck:!1,value:L})}export{s as TextArea};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{formatTime as r}from"../common/format.js";import{isSafeNumber as t}from"../common/math.js";import{useEffect as e,useRef as o,useState as m}from"react";function n(n){let{value:l=0,auto:a,format:u}=n,[c,i]=m(()=>t(l)?l:0),[p,f]=m(t(l)?l:void 0),v=o(null);return(e(()=>(void 0!==a&&(v.current=setInterval(()=>{let r="up"===a?10:-10;i(t=>Math.max(0,t+r))},1e3)),()=>{v.current&&clearInterval(v.current)}),[a]),e(()=>{l!==p&&(f(l),i(l))},[l,p]),t(l))?u?u(c):r(c):l||null}export{n as TimeDisplay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{Floating as o}from"./Floating.js";function e(e){let{content:n,children:r,position:i}=e;return t(o,{content:n,contentAutoWidth:!1,contentClasses:"Tooltip",hoverOpen:!0,placement:i,children:r})}export{e as Tooltip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{createRef as t,useEffect as r}from"react";function n(n){let{children:c,onOutsideClick:i}=n,o=t();function u(e){e.target instanceof Node&&o.current&&!o.current.contains(e.target)&&i()}return r(()=>(document.addEventListener("click",u),()=>{document.removeEventListener("click",u)}),[]),e("div",{ref:o,style:{userSelect:"none"},children:c})}export{n as TrackOutsideClicks};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useCallback as r,useEffect as i,useRef as l,useState as a}from"react";function n(n){let{children:s}=n,o=l(null),[c,m]=a(1),[u,d]=a(0),h=r(()=>{let{current:t}=o;if(!s||!Array.isArray(s)||!t||c>=s.length)return;let e=document.body.offsetHeight-t.getBoundingClientRect().bottom,r=Math.ceil(t.offsetHeight/c);if(e>0){let t=Math.min(s.length,c+Math.max(1,Math.ceil(e/r)));m(t),d((s.length-t)*r)}},[o,c,s]);return i(()=>{h();let t=setInterval(h,100);return()=>clearInterval(t)},[h]),e("div",{className:"VirtualList",children:[t("div",{className:"VirtualList__Container",ref:o,children:Array.isArray(s)?s.slice(0,c):null}),t("div",{className:"VirtualList__Padding",style:{paddingBottom:`${u}px`}})]})}export{n as VirtualList};
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{AnimatedNumber as o}from"./AnimatedNumber.js";import{Autofocus as r}from"./Autofocus.js";import{Blink as m}from"./Blink.js";import{BlockQuote as t}from"./BlockQuote.js";import{Box as i}from"./Box.js";import{Button as e}from"./Button.js";import{ByondUi as s}from"./ByondUi.js";import{Chart as p}from"./Chart.js";import{Collapsible as f}from"./Collapsible.js";import{ColorBox as a}from"./ColorBox.js";import{Dialog as l}from"./Dialog.js";import{Dimmer as j}from"./Dimmer.js";import{Divider as n}from"./Divider.js";import{DmIcon as u}from"./DmIcon.js";import{DraggableControl as c}from"./DraggableControl.js";import{Dropdown as d}from"./Dropdown.js";import{FitText as b}from"./FitText.js";import{Flex as B}from"./Flex.js";import{Floating as g}from"./Floating.js";import{Icon as I}from"./Icon.js";import{Image as D}from"./Image.js";import{ImageButton as T}from"./ImageButton.js";import{InfinitePlane as x}from"./InfinitePlane.js";import{Input as C}from"./Input.js";import{KeyListener as k}from"./KeyListener.js";import{Knob as L}from"./Knob.js";import{LabeledControls as S}from"./LabeledControls.js";import{LabeledList as y}from"./LabeledList.js";import{MenuBar as A}from"./MenuBar.js";import{Modal as F}from"./Modal.js";import{NoticeBox as N}from"./NoticeBox.js";import{NumberInput as P}from"./NumberInput.js";import{Popper as K}from"./Popper.js";import{ProgressBar as M}from"./ProgressBar.js";import{RestrictedInput as R}from"./RestrictedInput.js";import{RoundGauge as h}from"./RoundGauge.js";import{Section as v}from"./Section.js";import{Slider as w}from"./Slider.js";import{Stack as G}from"./Stack.js";import{StyleableSection as O}from"./StyleableSection.js";import{Table as Q}from"./Table.js";import{Tabs as U}from"./Tabs.js";import{TextArea as V}from"./TextArea.js";import{TimeDisplay as q}from"./TimeDisplay.js";import{Tooltip as z}from"./Tooltip.js";import{TrackOutsideClicks as E}from"./TrackOutsideClicks.js";import{VirtualList as H}from"./VirtualList.js";export{o as AnimatedNumber,r as Autofocus,m as Blink,t as BlockQuote,i as Box,e as Button,s as ByondUi,p as Chart,f as Collapsible,a as ColorBox,l as Dialog,j as Dimmer,n as Divider,u as DmIcon,c as DraggableControl,d as Dropdown,b as FitText,B as Flex,g as Floating,I as Icon,D as Image,T as ImageButton,x as InfinitePlane,C as Input,k as KeyListener,L as Knob,S as LabeledControls,y as LabeledList,A as MenuBar,F as Modal,N as NoticeBox,P as NumberInput,K as Popper,M as ProgressBar,R as RestrictedInput,h as RoundGauge,v as Section,w as Slider,G as Stack,O as StyleableSection,Q as Table,U as Tabs,V as TextArea,q as TimeDisplay,z as Tooltip,E as TrackOutsideClicks,H as VirtualList};
|
package/package.json
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "jlsnow301",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@floating-ui/react": "^0.27.
|
|
4
|
+
"@floating-ui/react": "^0.27.12",
|
|
5
5
|
"@nozbe/microfuzz": "^1.0.0"
|
|
6
6
|
},
|
|
7
7
|
"description": "TGUI core component library",
|
|
8
8
|
"devDependencies": {
|
|
9
|
-
"@biomejs/biome": "^2.0.0-beta.
|
|
10
|
-
"@rsbuild/core": "^1.3.
|
|
11
|
-
"@rsbuild/plugin-react": "^1.3.
|
|
12
|
-
"@rsbuild/plugin-sass": "^1.3.
|
|
13
|
-
"@rslib/core": "^0.
|
|
14
|
-
"@storybook/addon-
|
|
15
|
-
"@
|
|
16
|
-
"@
|
|
17
|
-
"@
|
|
18
|
-
"@storybook/test": "^8.6.14",
|
|
19
|
-
"@storybook/theming": "^8.6.14",
|
|
20
|
-
"@types/bun": "^1.2.13",
|
|
21
|
-
"@types/react": "^19.1.4",
|
|
22
|
-
"@types/react-dom": "^19.1.5",
|
|
9
|
+
"@biomejs/biome": "^2.0.0-beta.6",
|
|
10
|
+
"@rsbuild/core": "^1.3.22",
|
|
11
|
+
"@rsbuild/plugin-react": "^1.3.2",
|
|
12
|
+
"@rsbuild/plugin-sass": "^1.3.2",
|
|
13
|
+
"@rslib/core": "^0.9.2",
|
|
14
|
+
"@storybook/addon-docs": "^9.0.9",
|
|
15
|
+
"@types/bun": "^1.2.15",
|
|
16
|
+
"@types/react": "^19.1.7",
|
|
17
|
+
"@types/react-dom": "^19.1.6",
|
|
23
18
|
"prettier": "^3.5.3",
|
|
24
|
-
"sass": "^1.89.
|
|
25
|
-
"storybook": "^
|
|
19
|
+
"sass": "^1.89.2",
|
|
20
|
+
"storybook": "^9.0.9",
|
|
26
21
|
"storybook-addon-sass-postcss": "^0.3.2",
|
|
27
|
-
"storybook-react-rsbuild": "^
|
|
22
|
+
"storybook-react-rsbuild": "^2.0.1",
|
|
28
23
|
"typescript": "^5.8.3"
|
|
29
24
|
},
|
|
30
25
|
"exports": {
|
|
@@ -55,7 +50,7 @@
|
|
|
55
50
|
],
|
|
56
51
|
"license": "MIT",
|
|
57
52
|
"name": "tgui-core",
|
|
58
|
-
"packageManager": "bun@1.2.
|
|
53
|
+
"packageManager": "bun@1.2.15",
|
|
59
54
|
"peerDependencies": {
|
|
60
55
|
"react": "^19.1.0",
|
|
61
56
|
"react-dom": "^19.1.0"
|
|
@@ -73,5 +68,5 @@
|
|
|
73
68
|
"test": "bun test"
|
|
74
69
|
},
|
|
75
70
|
"type": "module",
|
|
76
|
-
"version": "4.0
|
|
71
|
+
"version": "4.1.0"
|
|
77
72
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* Using :where for 0 specificity - https://developer.mozilla.org/en-US/docs/Web/CSS/:where */
|
|
2
|
+
:where(.candystripe:nth-child(odd)) {
|
|
3
|
+
background-color: var(--candystripe-odd);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
:where(.candystripe:nth-child(even)) {
|
|
7
|
+
background-color: var(--candystripe-even);
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
@use "../colors.scss";
|
|
2
|
+
|
|
3
|
+
$map-keys: colors.$color-map !default;
|
|
4
|
+
|
|
5
|
+
@each $color-name, $color-value in $map-keys {
|
|
6
|
+
.color-#{$color-name} {
|
|
7
|
+
color: hsl(from $color-value h s calc(l + var(--adjust-color))) !important;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@each $color-name, $color-value in $map-keys {
|
|
12
|
+
.color-bg-#{$color-name} {
|
|
13
|
+
background-color: hsl(
|
|
14
|
+
from $color-value h s calc(l - var(--adjust-color))
|
|
15
|
+
) !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.debug-layout,
|
|
2
|
+
.debug-layout *:not(g):not(path) {
|
|
3
|
+
color: hsla(0, 0%, 100%, 0.9) !important;
|
|
4
|
+
background: transparent !important;
|
|
5
|
+
outline: 1px solid hsla(0, 0%, 100%, 0.5) !important;
|
|
6
|
+
box-shadow: none !important;
|
|
7
|
+
filter: none !important;
|
|
8
|
+
|
|
9
|
+
&:hover {
|
|
10
|
+
outline-color: hsla(0, 0%, 100%, 0.8) !important;
|
|
11
|
+
}
|
|
12
|
+
}
|