tgui-core 5.5.1 → 5.5.9

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.
Files changed (145) hide show
  1. package/package.json +2 -1
  2. package/dist/common/collections.d.ts +0 -10
  3. package/dist/common/collections.js +0 -1
  4. package/dist/common/color.d.ts +0 -76
  5. package/dist/common/color.js +0 -1
  6. package/dist/common/constants.d.ts +0 -106
  7. package/dist/common/constants.js +0 -1
  8. package/dist/common/eventbus.d.ts +0 -69
  9. package/dist/common/eventbus.js +0 -1
  10. package/dist/common/events.d.ts +0 -32
  11. package/dist/common/events.js +0 -1
  12. package/dist/common/exhaustive.d.ts +0 -17
  13. package/dist/common/exhaustive.js +0 -1
  14. package/dist/common/format.d.ts +0 -10
  15. package/dist/common/format.js +0 -1
  16. package/dist/common/fp.d.ts +0 -18
  17. package/dist/common/fp.js +0 -1
  18. package/dist/common/fuzzysearch.d.ts +0 -26
  19. package/dist/common/fuzzysearch.js +0 -1
  20. package/dist/common/hotkeys.d.ts +0 -31
  21. package/dist/common/hotkeys.js +0 -1
  22. package/dist/common/http.d.ts +0 -2
  23. package/dist/common/http.js +0 -1
  24. package/dist/common/keycodes.d.ts +0 -95
  25. package/dist/common/keycodes.js +0 -1
  26. package/dist/common/keys.d.ts +0 -118
  27. package/dist/common/keys.js +0 -1
  28. package/dist/common/math.d.ts +0 -47
  29. package/dist/common/math.js +0 -1
  30. package/dist/common/random.d.ts +0 -16
  31. package/dist/common/random.js +0 -1
  32. package/dist/common/react.d.ts +0 -16
  33. package/dist/common/react.js +0 -1
  34. package/dist/common/string.d.ts +0 -87
  35. package/dist/common/string.js +0 -1
  36. package/dist/common/timer.d.ts +0 -18
  37. package/dist/common/timer.js +0 -1
  38. package/dist/common/type-utils.d.ts +0 -10
  39. package/dist/common/type-utils.js +0 -1
  40. package/dist/common/ui.d.ts +0 -123
  41. package/dist/common/ui.js +0 -1
  42. package/dist/common/uuid.d.ts +0 -10
  43. package/dist/common/uuid.js +0 -1
  44. package/dist/common/vector.d.ts +0 -18
  45. package/dist/common/vector.js +0 -1
  46. package/dist/components/AnimatedNumber.d.ts +0 -24
  47. package/dist/components/AnimatedNumber.js +0 -1
  48. package/dist/components/Autofocus.d.ts +0 -12
  49. package/dist/components/Autofocus.js +0 -1
  50. package/dist/components/Blink.d.ts +0 -19
  51. package/dist/components/Blink.js +0 -1
  52. package/dist/components/BlockQuote.d.ts +0 -11
  53. package/dist/components/BlockQuote.js +0 -1
  54. package/dist/components/Box.d.ts +0 -104
  55. package/dist/components/Box.js +0 -1
  56. package/dist/components/Button.d.ts +0 -123
  57. package/dist/components/Button.js +0 -1
  58. package/dist/components/ByondUi.d.ts +0 -61
  59. package/dist/components/ByondUi.js +0 -1
  60. package/dist/components/Chart.d.ts +0 -24
  61. package/dist/components/Chart.js +0 -1
  62. package/dist/components/Collapsible.d.ts +0 -28
  63. package/dist/components/Collapsible.js +0 -1
  64. package/dist/components/ColorBox.d.ts +0 -19
  65. package/dist/components/ColorBox.js +0 -1
  66. package/dist/components/Dialog.d.ts +0 -39
  67. package/dist/components/Dialog.js +0 -1
  68. package/dist/components/Dimmer.d.ts +0 -11
  69. package/dist/components/Dimmer.js +0 -1
  70. package/dist/components/Divider.d.ts +0 -17
  71. package/dist/components/Divider.js +0 -1
  72. package/dist/components/DmIcon.d.ts +0 -35
  73. package/dist/components/DmIcon.js +0 -1
  74. package/dist/components/DraggableControl.d.ts +0 -57
  75. package/dist/components/DraggableControl.js +0 -1
  76. package/dist/components/Dropdown.d.ts +0 -60
  77. package/dist/components/Dropdown.js +0 -1
  78. package/dist/components/FitText.d.ts +0 -21
  79. package/dist/components/FitText.js +0 -1
  80. package/dist/components/Flex.d.ts +0 -130
  81. package/dist/components/Flex.js +0 -1
  82. package/dist/components/Floating.d.ts +0 -87
  83. package/dist/components/Floating.js +0 -1
  84. package/dist/components/Icon.d.ts +0 -53
  85. package/dist/components/Icon.js +0 -1
  86. package/dist/components/Image.d.ts +0 -30
  87. package/dist/components/Image.js +0 -1
  88. package/dist/components/ImageButton.d.ts +0 -90
  89. package/dist/components/ImageButton.js +0 -1
  90. package/dist/components/InfinitePlane.d.ts +0 -64
  91. package/dist/components/InfinitePlane.js +0 -1
  92. package/dist/components/Input.d.ts +0 -98
  93. package/dist/components/Input.js +0 -1
  94. package/dist/components/Interactive.d.ts +0 -39
  95. package/dist/components/Interactive.js +0 -1
  96. package/dist/components/KeyListener.d.ts +0 -16
  97. package/dist/components/KeyListener.js +0 -1
  98. package/dist/components/Knob.d.ts +0 -65
  99. package/dist/components/Knob.js +0 -1
  100. package/dist/components/LabeledControls.d.ts +0 -31
  101. package/dist/components/LabeledControls.js +0 -1
  102. package/dist/components/LabeledList.d.ts +0 -95
  103. package/dist/components/LabeledList.js +0 -1
  104. package/dist/components/MenuBar.d.ts +0 -42
  105. package/dist/components/MenuBar.js +0 -1
  106. package/dist/components/Modal.d.ts +0 -21
  107. package/dist/components/Modal.js +0 -1
  108. package/dist/components/NoticeBox.d.ts +0 -27
  109. package/dist/components/NoticeBox.js +0 -1
  110. package/dist/components/NumberInput.d.ts +0 -60
  111. package/dist/components/NumberInput.js +0 -1
  112. package/dist/components/Pointer.d.ts +0 -20
  113. package/dist/components/Pointer.js +0 -1
  114. package/dist/components/Popper.d.ts +0 -33
  115. package/dist/components/Popper.js +0 -1
  116. package/dist/components/ProgressBar.d.ts +0 -57
  117. package/dist/components/ProgressBar.js +0 -1
  118. package/dist/components/RestrictedInput.d.ts +0 -72
  119. package/dist/components/RestrictedInput.js +0 -1
  120. package/dist/components/RoundGauge.d.ts +0 -57
  121. package/dist/components/RoundGauge.js +0 -1
  122. package/dist/components/Section.d.ts +0 -65
  123. package/dist/components/Section.js +0 -1
  124. package/dist/components/Slider.d.ts +0 -61
  125. package/dist/components/Slider.js +0 -1
  126. package/dist/components/Stack.d.ts +0 -83
  127. package/dist/components/Stack.js +0 -1
  128. package/dist/components/StyleableSection.d.ts +0 -10
  129. package/dist/components/StyleableSection.js +0 -1
  130. package/dist/components/Table.d.ts +0 -59
  131. package/dist/components/Table.js +0 -1
  132. package/dist/components/Tabs.d.ts +0 -110
  133. package/dist/components/Tabs.js +0 -1
  134. package/dist/components/TextArea.d.ts +0 -25
  135. package/dist/components/TextArea.js +0 -1
  136. package/dist/components/TimeDisplay.d.ts +0 -18
  137. package/dist/components/TimeDisplay.js +0 -1
  138. package/dist/components/Tooltip.d.ts +0 -29
  139. package/dist/components/Tooltip.js +0 -1
  140. package/dist/components/TrackOutsideClicks.d.ts +0 -34
  141. package/dist/components/TrackOutsideClicks.js +0 -1
  142. package/dist/components/VirtualList.d.ts +0 -11
  143. package/dist/components/VirtualList.js +0 -1
  144. package/dist/components/index.d.ts +0 -49
  145. package/dist/components/index.js +0 -1
@@ -1,57 +0,0 @@
1
- import type { CSSProperties } from 'react';
2
- import type { BoxProps } from './Box';
3
- type Props = {
4
- /** The current value of the metric. */
5
- value: number;
6
- } & Partial<{
7
- /** When provided, will cause an alert symbol on the gauge to begin flashing in the color upon which the needle currently rests, as defined in `ranges`. */
8
- alertAfter: number;
9
- /** As with alertAfter, but alerts below a value. If both are set, and alertAfter comes earlier, the alert will only flash when the needle is between both values. Otherwise, the alert will flash when on the active side of either threshold. */
10
- alertBefore: number;
11
- /** CSS style. */
12
- className: string;
13
- /** When provided, will be used to format the value of the metric for display. */
14
- format: (value: number) => string;
15
- /** The upper bound of the gauge. */
16
- maxValue: number;
17
- /** The lower bound of the gauge. */
18
- minValue: number;
19
- /** Provide regions of the gauge to color between two specified values of the metric. */
20
- ranges: Record<string, [number, number]>;
21
- /** When provided scales the gauge. */
22
- size: number;
23
- /** Custom css */
24
- style: CSSProperties;
25
- }> & BoxProps;
26
- /**
27
- * ## RoundGauge
28
- *
29
- * The RoundGauge component provides a visual representation of a single metric, as well as being capable of showing
30
- * informational or cautionary boundaries related to that metric.
31
- *
32
- * Example:
33
- *
34
- * ```tsx
35
- * <RoundGauge
36
- * size={1.75}
37
- * value={tankPressure}
38
- * minValue={0}
39
- * maxValue={pressureLimit}
40
- * alertAfter={pressureLimit * 0.7}
41
- * ranges={{
42
- * good: [0, pressureLimit * 0.7],
43
- * average: [pressureLimit * 0.7, pressureLimit * 0.85],
44
- * bad: [pressureLimit * 0.85, pressureLimit],
45
- * }}
46
- * format={formatPressure}
47
- * />
48
- * ```
49
- *
50
- * The alert on the gauge is optional, and will only be shown if the `alertAfter` prop is defined. When defined, the alert
51
- * will begin to flash the respective color upon which the needle currently rests, as defined in the `ranges` prop.
52
- *
53
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-roundgauge--docs)
54
- * - [View inherited Box props](https://tgstation.github.io/tgui-core/?path=/docs/components-box--docs)
55
- */
56
- export declare function RoundGauge(props: Props): import("react/jsx-runtime").JSX.Element;
57
- export {};
@@ -1 +0,0 @@
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,65 +0,0 @@
1
- import { type ReactNode, type RefObject } from 'react';
2
- import type { BoxProps } from './Box';
3
- type Props = Partial<{
4
- /** Buttons to render aside the section title. */
5
- buttons: ReactNode;
6
- /** id to assosiate with the parent div element used by this section, for uses with procs like getElementByID */
7
- container_id: string;
8
- /** If true, fills all available vertical space. */
9
- fill: boolean;
10
- /** If true, removes all section padding. */
11
- fitted: boolean;
12
- /** If true, fills the area without forcing height to 100% */
13
- flexGrow: boolean;
14
- /** If true, removes the section top padding */
15
- noTopPadding: boolean;
16
- /** @member Callback function for the `scroll` event */
17
- onScroll: ((this: GlobalEventHandlers, ev: Event) => any) | null;
18
- /** Ref to the section element. */
19
- ref: RefObject<HTMLDivElement | null>;
20
- /** Shows or hides the scrollbar. */
21
- scrollable: boolean;
22
- /** Shows or hides the horizontal scrollbar. */
23
- scrollableHorizontal: boolean;
24
- /** If true, filly the area except for -3rem */
25
- stretchContents: boolean;
26
- /** Title of the section. */
27
- title: ReactNode;
28
- }> & BoxProps;
29
- /**
30
- * ## Section
31
- *
32
- * Section is a surface that displays content and actions on a single topic.
33
- *
34
- * They should be easy to scan for relevant and actionable information.
35
- * Elements, like text and images, should be placed in them in a way that
36
- * clearly indicates hierarchy.
37
- *
38
- * Sections can now be nested, and will automatically font size of the
39
- * header according to their nesting level. Previously this was done via `level`
40
- * prop, but now it is automatically calculated.
41
- *
42
- * Section can also be titled to clearly define its purpose.
43
- *
44
- * Example:
45
- *
46
- * ```tsx
47
- * <Section title="Cargo">Here you can order supply crates.</Section>
48
- * ```
49
- *
50
- * If you want to have a button on the right side of an section title
51
- * (for example, to perform some sort of action), there is a way to do that:
52
- *
53
- * Example:
54
- *
55
- * ```tsx
56
- * <Section title="Cargo" buttons={<Button>Send shuttle</Button>}>
57
- * Here you can order supply crates.
58
- * </Section>
59
- * ```
60
- *
61
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-section--docs)
62
- * - [View inherited Box props](https://tgstation.github.io/tgui-core/?path=/docs/components-box--docs)
63
- */
64
- export declare function Section(props: Props): import("react/jsx-runtime").JSX.Element;
65
- export {};
@@ -1 +0,0 @@
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};
@@ -1,61 +0,0 @@
1
- import type { PropsWithChildren } from 'react';
2
- import type { BoxProps } from './Box';
3
- type Props = {
4
- /** Highest possible value. */
5
- maxValue: number;
6
- /** Lowest possible value. */
7
- minValue: number;
8
- /** Value itself, controls the position of the cursor. */
9
- value: number;
10
- } & Partial<{
11
- /** Animates the value if it was changed externally. */
12
- animated: boolean;
13
- /** Custom css */
14
- className: string;
15
- /** Color of the slider. */
16
- color: string;
17
- /** Disables the slider. */
18
- disabled: boolean;
19
- /** onChange also fires when you drag the input. */
20
- tickWhileDragging: boolean;
21
- /**
22
- * If set, this value will be used to set the fill percentage of the
23
- * progress bar filler independently of the main value.
24
- */
25
- fillValue: number;
26
- /** Format value using this function before displaying it. */
27
- format: (value: number) => string;
28
- /**
29
- * An event which fires when you release the slider or enter a number. This is
30
- * the default value event for controls.
31
- */
32
- onChange: (event: Event, value: number) => void;
33
- /**
34
- * Applies a `color` to the slider based on whether the value lands in the
35
- * range between `from` and `to`.
36
- */
37
- ranges: Record<string, [number, number]>;
38
- /** Screen distance mouse needs to travel to adjust value by one `step`. */
39
- step: number;
40
- /**
41
- * The sensitivity of the slider. Adjust this if it feels too slow/fast
42
- * while dragging. Use higher for larger sliders. Default is 1.
43
- */
44
- stepPixelSize: number;
45
- /** Unit to display to the right of value. */
46
- unit: string;
47
- }> & BoxProps & PropsWithChildren;
48
- /**
49
- * ## Slider
50
- *
51
- * A horizontal,
52
- * [ProgressBar](https://tgstation.github.io/tgui-core/?path=/docs/components-progressbar--docs)-like
53
- * control which allows dialing * in precise values by dragging it left and right.
54
- *
55
- * Single click opens an input box to manually type in a number.
56
- *
57
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-slider--docs)
58
- * - [View inherited Box props](https://tgstation.github.io/tgui-core/?path=/docs/components-box--docs)
59
- */
60
- export declare function Slider(props: Props): import("react/jsx-runtime").JSX.Element;
61
- export {};
@@ -1 +0,0 @@
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,tickWhileDragging:n,format:_,maxValue:f,minValue:h,onChange: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,tickWhileDragging:n,format:_,maxValue:f,minValue:h,onChange:u,step:g,stepPixelSize:p,unit:v,value:B,children:m=>{let{displayElement:d,displayValue:c,dragging:n,editing:_,handleDragStart:u,inputElement:g}=m,p=null!=P,v=i(l(P??c,h,f)),M=i(l(c,h,f)),$=S||s(P??B,j)||"default";return e("div",{className:a(["Slider",_&&"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};
@@ -1,83 +0,0 @@
1
- import { type RefObject } from 'react';
2
- import { type FlexItemProps, type FlexProps } from './Flex';
3
- type Props = Partial<{
4
- /** Fills available space. */
5
- fill: boolean;
6
- /** Reverses the stack. */
7
- reverse: boolean;
8
- /** Flex column */
9
- vertical: boolean;
10
- /** Adds zebra striping to the stack. */
11
- zebra: boolean;
12
- }> & FlexProps;
13
- /**
14
- * ## Stack
15
- *
16
- * A higher-level component that is based on
17
- * [Flex](https://tgstation.github.io/tgui-core/?path=/docs/components-flex--docs).
18
- *
19
- * The main difference from `Flex`, is that this component automatically adds
20
- * spacing between all stack items, reducing the boilerplate that you have to write!
21
- *
22
- * Consists of two elements: `<Stack>` and `<Stack.Item>`.
23
- *
24
- * Stacks can be vertical by adding a `vertical` property.
25
- *
26
- * Example:
27
- *
28
- * ```tsx
29
- * <Stack vertical>
30
- * <Stack.Item grow>Button description</Stack.Item>
31
- * <Stack.Item>
32
- * <Button>Perform an action</Button>
33
- * </Stack.Item>
34
- * </Stack>
35
- * ```
36
- *
37
- * **High level window layout**
38
- * Stacks can be used for high level window layout.
39
- * Make sure to use the `fill` property.
40
- *
41
- * Example:
42
- *
43
- * ```tsx
44
- * <Window>
45
- * <Window.Content>
46
- * <Stack fill>
47
- * <Stack.Item>
48
- * <Section fill>Sidebar</Section>
49
- * </Stack.Item>
50
- * <Stack.Item grow>
51
- * <Stack fill vertical>
52
- * <Stack.Item grow>
53
- * <Section fill scrollable>
54
- * Main content
55
- * </Section>
56
- * </Stack.Item>
57
- * <Stack.Item>
58
- * <Section>Bottom pane</Section>
59
- * </Stack.Item>
60
- * </Stack>
61
- * </Stack.Item>
62
- * </Stack>
63
- * </Window.Content>
64
- * </Window>
65
- * ```
66
- *
67
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-stack--docs)
68
- * - [View inherited Box props](https://tgstation.github.io/tgui-core/?path=/docs/components-box--docs)
69
- */
70
- export declare function Stack(props: Props): import("react/jsx-runtime").JSX.Element;
71
- export declare namespace Stack {
72
- var Item: typeof StackItem;
73
- var Divider: typeof StackDivider;
74
- }
75
- type StackItemProps = FlexItemProps & Partial<{
76
- innerRef: RefObject<HTMLDivElement | null>;
77
- }>;
78
- declare function StackItem(props: StackItemProps): import("react/jsx-runtime").JSX.Element;
79
- type StackDividerProps = FlexItemProps & Partial<{
80
- hidden: boolean;
81
- }>;
82
- declare function StackDivider(props: StackDividerProps): import("react/jsx-runtime").JSX.Element;
83
- export {};
@@ -1 +0,0 @@
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,10 +0,0 @@
1
- import type { PropsWithChildren, ReactNode } from 'react';
2
- type Props = Partial<{
3
- style: Record<string, any>;
4
- textStyle: Record<string, any>;
5
- title: ReactNode;
6
- titleStyle: Record<string, any>;
7
- titleSubtext: string;
8
- }> & PropsWithChildren;
9
- export declare function StyleableSection(props: Props): import("react/jsx-runtime").JSX.Element;
10
- export {};
@@ -1 +0,0 @@
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};
@@ -1,59 +0,0 @@
1
- import type { BoxProps } from './Box';
2
- type Props = Partial<{
3
- /** Collapses table to the smallest possible size. */
4
- collapsing: boolean;
5
- }> & BoxProps;
6
- export declare function Table(props: Props): import("react/jsx-runtime").JSX.Element;
7
- type RowProps = Partial<{
8
- /** Whether this is a header cell. */
9
- header: boolean;
10
- }> & BoxProps;
11
- declare function TableRow(props: RowProps): import("react/jsx-runtime").JSX.Element;
12
- type CellProps = Partial<{
13
- /** Additional columns for this cell to expand, assuming there is room. */
14
- colSpan: number;
15
- /** Collapses table cell to the smallest possible size,
16
- and stops any text inside from wrapping. */
17
- collapsing: boolean;
18
- /** Whether this is a header cell. */
19
- header: boolean;
20
- /** Rows for this cell to expand, assuming there is room. */
21
- rowSpan: number;
22
- }> & BoxProps;
23
- declare function TableCell(props: CellProps): import("react/jsx-runtime").JSX.Element;
24
- /**
25
- * ## Table
26
- *
27
- * A straight forward mapping to a standard html table, which is slightly
28
- * simplified (does not need a `<tbody>` tag) and with sane default styles
29
- * (e.g. table width is 100% by default).
30
- *
31
- * Example:
32
- *
33
- * ```tsx
34
- * <Table>
35
- * <Table.Row>
36
- * <Table.Cell bold>Hello world!</Table.Cell>
37
- * <Table.Cell collapsing color="label">
38
- * Label
39
- * </Table.Cell>
40
- * </Table.Row>
41
- * </Table>
42
- * ```
43
- *
44
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-table--docs)
45
- * - [View inherited Box props](https://tgstation.github.io/tgui-core/?path=/docs/components-box--docs)
46
- */
47
- export declare namespace Table {
48
- /**
49
- * ## Table.Cell
50
- * A straight forward mapping to `<td>` element.
51
- */
52
- const Cell: typeof TableCell;
53
- /**
54
- * ## Table.Row
55
- * A straight forward mapping to `<tr>` element.
56
- */
57
- const Row: typeof TableRow;
58
- }
59
- export {};
@@ -1 +0,0 @@
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};
@@ -1,110 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- import type { BoxProps } from './Box';
3
- type Props = Partial<{
4
- /**
5
- * Similarly to `fill` on
6
- * [Section](https://github.com/tgstation/tgui-core/tree/main/lib/components/Section.tsx),
7
- * tabs will fill all available vertical space. Only makes sense in a vertical
8
- * configuration.
9
- */
10
- fill: boolean;
11
- /** If true, tabs will take all available horizontal space. */
12
- fluid: boolean;
13
- /** Use a vertical configuration, where tabs will be stacked vertically. */
14
- vertical: boolean;
15
- /**
16
- * Allows you to scroll horizontal tabs, and adds special buttons for it.
17
- * Has no effect on vertical tabs.
18
- */
19
- scrollable: boolean;
20
- }> & BoxProps;
21
- export declare function Tabs(props: Props): import("react/jsx-runtime").JSX.Element;
22
- type TabProps = Partial<{
23
- /** Font awesome icon. @see https://fontawesome.com/v6/search?o=r&m=free */
24
- icon: string;
25
- /** Causes the icon to spin */
26
- iconSpin: boolean;
27
- /** Left slot content */
28
- leftSlot: ReactNode;
29
- /** Called when element is clicked */
30
- onClick: (e?: any) => void;
31
- /** Right slot content */
32
- rightSlot: ReactNode;
33
- /** Whether the tab is selected */
34
- selected: boolean;
35
- }> & BoxProps;
36
- declare function TabItem(props: TabProps): import("react/jsx-runtime").JSX.Element;
37
- /**
38
- * ## Tabs
39
- *
40
- * Tabs make it easy to explore and switch between different views.
41
- *
42
- * Here is an example of how you would construct a simple tabbed view:
43
- *
44
- * Example:
45
- *
46
- * ```tsx
47
- * <Tabs>
48
- * <Tabs.Tab
49
- * selected={tabIndex === 1}
50
- * onClick={() => setTabIndex(1)}>
51
- * Tab one
52
- * </Tabs.Tab>
53
- * <Tabs.Tab
54
- * selected={tabIndex === 2}
55
- * onClick={() => setTabIndex(2)}>
56
- * Tab two
57
- * </Tabs.Tab>
58
- * </Tabs>
59
- * <Box>
60
- * Tab selected: {tabIndex}
61
- * </Box>
62
- * ```
63
- *
64
- * Notice that tabs do not contain state. It is your job to track the selected
65
- * tab, handle clicks and place tab content where you need it. In return, you get
66
- * a lot of flexibility in regards to how you can layout your tabs.
67
- *
68
- * Tabs also support a vertical configuration. This is usually paired with
69
- * [Stack](https://tgstation.github.io/tgui-core/?path=/docs/components-stack--docs)
70
- * to render tab content to the right.
71
- *
72
- * Example:
73
- *
74
- * ```tsx
75
- * <Stack>
76
- * <Stack.Item>
77
- * <Tabs vertical>...</Tabs>
78
- * </Stack.Item>
79
- * <Stack.Item grow basis={0}>
80
- * Tab content.
81
- * </Stack.Item>
82
- * </Stack>
83
- * ```
84
- *
85
- * If you need to combine a tab section with other elements, or if you want to
86
- * add scrollable functionality to tabs, pair them with the
87
- * [Section](https://tgstation.github.io/tgui-core/?path=/docs/components-section--docs)
88
- * component:
89
- *
90
- * Example:
91
- *
92
- * ```tsx
93
- * <Section fill fitted scrollable width="128px">
94
- * <Tabs vertical>...</Tabs>
95
- * ... other things ...
96
- * </Section>
97
- * ```
98
- *
99
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-tabs--docs)
100
- * - [View inherited Box props](https://tgstation.github.io/tgui-core/?path=/docs/components-box--docs)
101
- */
102
- export declare namespace Tabs {
103
- /**
104
- * ## Tabs.Tab
105
- * An individual tab element. Tabs function like buttons, so they inherit
106
- * a lot of `Button` props.
107
- */
108
- const Tab: typeof TabItem;
109
- }
110
- export {};
@@ -1 +0,0 @@
1
- import{Fragment as e,jsx as r,jsxs as t}from"react/jsx-runtime";import{canRender as l,classes as n}from"../common/react.js";import{computeBoxClassName as i,computeBoxProps as c}from"../common/ui.js";import{useEffect as a,useRef as o,useState as s}from"react";import{Button as d}from"./Button.js";import{Icon as m}from"./Icon.js";function b(l){let{className:d,vertical:m,scrollable:b,fill:f,fluid:h,children:T,...v}=l,_=o(!0),p=o(null),L=o(null),[N,w]=s(!1),[E,j]=s(!1);function W(e){if(!p.current)return;let r=p.current,t=.5*r.clientWidth;r.scrollBy({left:"left"===e?-t:t,behavior:"smooth"})}a(()=>{if(!b||m||!p.current)return;let e=p.current;if(e.scrollWidth<e.clientWidth)return;function r(){w(e.scrollLeft>0),j(e.scrollLeft+e.clientWidth<e.scrollWidth)}function t(r){Math.abs(r.deltaY)>Math.abs(r.deltaX)&&(e.scrollLeft+=r.deltaY)}let l=e.querySelector(".Tab--selected");if(l)return L.current!==l&&(L.current=l,l.scrollIntoView({behavior:_.current?"auto":"smooth",inline:"center"})),_.current=!1,e.addEventListener("wheel",t,{passive:!0}),e.addEventListener("scroll",r),window.addEventListener("resize",r),r(),()=>{e.removeEventListener("wheel",t),e.removeEventListener("scroll",r),window.removeEventListener("resize",r)}},[b,m,T]);let g=T;return b&&!m&&(g=t(e,{children:[N&&r(u,{direction:"left",makeScroll:W}),r("div",{ref:p,className:n(["Tabs--scrollable-content",N&&"scrollable-left",E&&"scrollable-right"]),children:T}),E&&r(u,{direction:"right",makeScroll:W})]})),r("div",{className:n(["Tabs",m?"Tabs--vertical":"Tabs--horizontal",f&&"Tabs--fill",h&&"Tabs--fluid",!m&&b&&"Tabs--scrollable",d,i(v)]),...c(v),children:g})}function u(e){let{direction:t,makeScroll:l}=e;return r(d,{className:`scroll-${t}`,color:"transparent",icon:`angle-${t}`,onClick:()=>l(t)})}(b||(b={})).Tab=function(e){let{className:a,selected:o,color:s,icon:d,iconSpin:b,leftSlot:u,rightSlot:f,children:h,onClick:T,...v}=e;return t("div",{className:n(["Tab","Tabs__Tab",`Tab--color--${s}`,o&&"Tab--selected",a,i(v)]),onClick:e=>T?.(e),...c(v),children:[l(u)&&r("div",{className:"Tab__left",children:u})||!!d&&r("div",{className:"Tab__left",children:r(m,{name:d,spin:b})}),r("div",{className:"Tab__text",children:h}),l(f)&&r("div",{className:"Tab__right",children:f})]})};export{b as Tabs};
@@ -1,25 +0,0 @@
1
- import type { RefObject } from 'react';
2
- import type { TextInputProps } from './Input';
3
- type Props = Partial<{
4
- /** Don't use tab for indent */
5
- dontUseTabForIndent: boolean;
6
- /** Ref to the textarea element. */
7
- ref: RefObject<HTMLTextAreaElement | null>;
8
- /**
9
- * Provides a Record with key: markupChar entries which can be used for
10
- * ctrl + key combinations to surround a selected text with the markup
11
- * character
12
- */
13
- userMarkup: Record<string, string>;
14
- }> & TextInputProps<HTMLTextAreaElement>;
15
- /**
16
- * ## Textarea
17
- *
18
- * An input for larger amounts of text. Use this when you want inputs larger
19
- * than one row.
20
- *
21
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-textarea--docs)
22
- * - [View inherited Box props](https://tgstation.github.io/tgui-core/?path=/docs/components-box--docs)
23
- */
24
- export declare function TextArea(props: Props): import("react/jsx-runtime").JSX.Element;
25
- export {};
@@ -1 +0,0 @@
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,spellcheck:K=!1,userMarkup:C,value:A,...w}=a,B=l(null),L=E??B,[N,q]=m(A??"");c(()=>{(s||f)&&setTimeout(()=>{L.current?.focus(),f&&L.current?.select()},1)},[]),c(()=>{L.current&&document.activeElement!==L.current&&A!==N&&q(A??"")},[A]);let z=o(w),F=n(["Input","TextArea",y&&"Input--fluid",d&&"Input--monospace",p&&"Input--disabled",u(w),g]);return e("textarea",{...z,autoComplete:"off",className:F,maxLength:b,onBlur:function(e){k?.(N)},onChange:function(e){let t=e.currentTarget.value;q(t),$&&(v?i(()=>$(t)):$(t))},onKeyDown:function(e){if(j?.(e),e.key===t.Enter&&!e.shiftKey){e.preventDefault(),h?.(e.currentTarget.value),I&&q(""),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;q(`${t.substring(0,r)} ${t.substring(n)}`),e.currentTarget.selectionEnd=r+1,$?.(e.currentTarget.value);return}if(C&&(e.ctrlKey||e.metaKey)&&C[e.key]){e.preventDefault();let{selectionStart:t,selectionEnd:r,value:n}=e.currentTarget,u=C[e.key];q(`${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:L,spellCheck:K,value:N})}export{s as TextArea};
@@ -1,18 +0,0 @@
1
- type TimeDisplayProps = {
2
- /** The value that the TimeDisplay needs to render - if you pass a wrong type it will be rendered directly */
3
- value: number;
4
- } & Partial<{
5
- /** Whether the TimeDisplay should automatically increment or decrement (plain prop to dec.) */
6
- auto: 'up' | 'down' | true;
7
- /** An optional function to format the value */
8
- format: (value: number) => string;
9
- }>;
10
- /**
11
- * ## TimeDisplay
12
- *
13
- * A simple component to format and display time values.
14
- *
15
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-timedisplay--docs)
16
- */
17
- export declare function TimeDisplay(props: TimeDisplayProps): string | number | null;
18
- export {};
@@ -1 +0,0 @@
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,29 +0,0 @@
1
- import type { Placement } from '@floating-ui/react';
2
- import type { ReactNode } from 'react';
3
- type Props = {
4
- /** The content to display in the tooltip */
5
- content: ReactNode;
6
- } & Partial<{
7
- /** Hovering this element will show the tooltip */
8
- children: ReactNode;
9
- /** Where to place the tooltip relative to the reference element */
10
- position: Placement;
11
- }>;
12
- /**
13
- * ## Tooltip
14
- *
15
- * Displays a tooltip when hovering over the element. The tooltip
16
- * can be customized with a custom content and position.
17
- *
18
- * Example:
19
- *
20
- * ```tsx
21
- * <Tooltip content="This is a tooltip" position="top">
22
- * <Box>Hover over me</Box>
23
- * </Tooltip>
24
- * ```
25
- *
26
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-tooltip--docs)
27
- */
28
- export declare function Tooltip(props: Props): import("react/jsx-runtime").JSX.Element;
29
- export {};
@@ -1 +0,0 @@
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,contentClasses:"Tooltip",hoverOpen:!0,placement:i,children:r})}export{e as Tooltip};
@@ -1,34 +0,0 @@
1
- import { type ReactElement } from 'react';
2
- type Props = {
3
- /** The excluded element that CAN be clicked */
4
- children: ReactElement<HTMLElement>;
5
- /** Callback that fires whenever the user clicks something else */
6
- onOutsideClick: () => void;
7
- };
8
- /**
9
- * ## TrackOutsideClicks
10
- *
11
- * Allows you to track when the user clicks outside of a specific element.
12
- *
13
- * Example:
14
- *
15
- * ```tsx
16
- * import { TrackOutsideClicks } from 'tgui-core/components';
17
- *
18
- * function MyComponent() {
19
- * const [isOpen, setIsOpen] = useState(false);
20
- *
21
- * return (
22
- * <TrackOutsideClicks onOutsideClick={() => setIsOpen(false)}>
23
- * <div>
24
- * Hello world!
25
- * </div>
26
- * </TrackOutsideClicks>
27
- * );
28
- * }
29
- * ```
30
- *
31
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-trackoutsideclicks--docs)
32
- */
33
- export declare function TrackOutsideClicks(props: Props): import("react/jsx-runtime").JSX.Element;
34
- export {};
@@ -1 +0,0 @@
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,11 +0,0 @@
1
- import { type PropsWithChildren } from 'react';
2
- /**
3
- * ## VirtualList
4
- *
5
- * A vertical list that renders items to fill space up to the extents of the
6
- * current window, and then defers rendering of other items until they come
7
- * into view.
8
- *
9
- * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-virtuallist--docs)
10
- */
11
- export declare function VirtualList(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
@@ -1 +0,0 @@
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};