tgui-core 3.1.4 → 3.2.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.
Files changed (80) hide show
  1. package/README.md +6 -0
  2. package/dist/common/color.js +1 -1
  3. package/dist/common/constants.d.ts +42 -42
  4. package/dist/common/constants.js +1 -1
  5. package/dist/common/fp.d.ts +2 -1
  6. package/dist/common/fuzzysearch.d.ts +22 -0
  7. package/dist/common/fuzzysearch.js +1 -0
  8. package/dist/common/hotkeys.d.ts +2 -0
  9. package/dist/common/hotkeys.js +1 -1
  10. package/dist/common/string.d.ts +14 -7
  11. package/dist/common/string.js +1 -1
  12. package/dist/common/type-utils.d.ts +2 -1
  13. package/dist/common/ui.d.ts +1 -1
  14. package/dist/common/ui.js +1 -1
  15. package/dist/common/uuid.d.ts +2 -1
  16. package/dist/components/AnimatedNumber.d.ts +3 -0
  17. package/dist/components/Autofocus.d.ts +5 -1
  18. package/dist/components/Blink.d.ts +7 -0
  19. package/dist/components/BlockQuote.d.ts +3 -0
  20. package/dist/components/Box.d.ts +21 -16
  21. package/dist/components/Button.d.ts +3 -0
  22. package/dist/components/Button.js +1 -1
  23. package/dist/components/ByondUi.d.ts +5 -2
  24. package/dist/components/Chart.js +1 -1
  25. package/dist/components/Collapsible.d.ts +3 -0
  26. package/dist/components/Collapsible.js +1 -1
  27. package/dist/components/ColorBox.d.ts +3 -0
  28. package/dist/components/Dialog.d.ts +5 -1
  29. package/dist/components/Dialog.js +1 -1
  30. package/dist/components/Dimmer.d.ts +3 -0
  31. package/dist/components/Divider.d.ts +3 -0
  32. package/dist/components/DmIcon.d.ts +1 -0
  33. package/dist/components/DraggableControl.js +1 -1
  34. package/dist/components/Dropdown.d.ts +3 -0
  35. package/dist/components/Dropdown.js +1 -1
  36. package/dist/components/Flex.d.ts +5 -1
  37. package/dist/components/Flex.js +1 -1
  38. package/dist/components/Floating.d.ts +1 -0
  39. package/dist/components/Floating.js +1 -1
  40. package/dist/components/Icon.d.ts +10 -3
  41. package/dist/components/Image.d.ts +1 -0
  42. package/dist/components/ImageButton.d.ts +4 -0
  43. package/dist/components/ImageButton.js +1 -1
  44. package/dist/components/InfinitePlane.d.ts +5 -1
  45. package/dist/components/InfinitePlane.js +1 -1
  46. package/dist/components/Input.d.ts +5 -5
  47. package/dist/components/Input.js +1 -1
  48. package/dist/components/KeyListener.d.ts +3 -0
  49. package/dist/components/Knob.d.ts +3 -0
  50. package/dist/components/Knob.js +1 -1
  51. package/dist/components/LabeledControls.d.ts +6 -2
  52. package/dist/components/LabeledControls.js +1 -1
  53. package/dist/components/LabeledList.d.ts +7 -2
  54. package/dist/components/LabeledList.js +1 -1
  55. package/dist/components/MenuBar.js +1 -1
  56. package/dist/components/Modal.d.ts +7 -2
  57. package/dist/components/NoticeBox.d.ts +3 -0
  58. package/dist/components/NumberInput.d.ts +3 -0
  59. package/dist/components/NumberInput.js +1 -1
  60. package/dist/components/Popper.d.ts +3 -0
  61. package/dist/components/Popper.js +1 -1
  62. package/dist/components/ProgressBar.d.ts +3 -0
  63. package/dist/components/RestrictedInput.d.ts +2 -2
  64. package/dist/components/RestrictedInput.js +1 -1
  65. package/dist/components/RoundGauge.d.ts +4 -1
  66. package/dist/components/RoundGauge.js +1 -1
  67. package/dist/components/Section.d.ts +7 -0
  68. package/dist/components/Section.js +1 -1
  69. package/dist/components/Slider.d.ts +5 -1
  70. package/dist/components/Slider.js +1 -1
  71. package/dist/components/Stack.d.ts +8 -3
  72. package/dist/components/Table.d.ts +5 -1
  73. package/dist/components/Tabs.d.ts +12 -6
  74. package/dist/components/TextArea.d.ts +2 -2
  75. package/dist/components/TextArea.js +1 -1
  76. package/dist/components/TimeDisplay.d.ts +7 -0
  77. package/dist/components/Tooltip.d.ts +16 -0
  78. package/dist/components/Tooltip.js +1 -1
  79. package/dist/components/VirtualList.d.ts +4 -0
  80. package/package.json +48 -39
@@ -1 +1 @@
1
- import*as e from"react/jsx-runtime";import*as a from"../common/math.js";import*as s from"../common/react.js";import*as r from"../common/ui.js";import*as o from"./AnimatedNumber.js";function c(c){let{alertAfter:l,alertBefore:t,className:n,format:m,maxValue:i=1,minValue:u=1,ranges:d,size:x=1,style:g,value:j,...C}=c,p=(0,a.scale)(j,u,i),_=(0,a.clamp01)(p),f=d?{}:{primary:[0,1]};if(d)for(let e in d){let s=d[e];f[e]=[(0,a.scale)(s[0],u,i),(0,a.scale)(s[1],u,i)]}let h=(!!l&&!!t&&!!(j>l)&&!!(j<t)||!!l&&!!(j>l)||!!t&&!!(j<t))&&(0,a.keyOfMatchingRange)(_,f);return(0,e.jsxs)("div",{className:"RoundGauge__wrapper",children:[(0,e.jsx)("div",{className:(0,s.classes)(["RoundGauge",n,(0,r.computeBoxClassName)(C)]),...(0,r.computeBoxProps)({style:{fontSize:`${x}em`,...g},...C}),children:(0,e.jsxs)("svg",{viewBox:"0 0 100 50",children:[(l||t)&&(0,e.jsx)("g",{className:(0,s.classes)(["RoundGauge__alert",h?`active RoundGauge__alert--${h}`:""]),children:(0,e.jsx)("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"})}),(0,e.jsx)("g",{children:(0,e.jsx)("circle",{className:"RoundGauge__ringTrack",cx:"50",cy:"50",r:"45"})}),(0,e.jsx)("g",{children:Object.keys(f).map((a,s)=>{let r=f[a];return(0,e.jsx)("circle",{className:`RoundGauge__ringFill RoundGauge--color--${a}`,style:{strokeDashoffset:Math.max((2-(r[1]-r[0]))*Math.PI*50,0)},transform:`rotate(${180+180*r[0]} 50 50)`,cx:"50",cy:"50",r:"45"},s)})}),(0,e.jsxs)("g",{className:"RoundGauge__needle",transform:`rotate(${180*_-90} 50 50)`,children:[(0,e.jsx)("polygon",{className:"RoundGauge__needleLine",points:"46,50 50,0 54,50"}),(0,e.jsx)("circle",{className:"RoundGauge__needleMiddle",cx:"50",cy:"50",r:"8"})]}),(0,e.jsx)("title",{children:"alert"})]})}),(0,e.jsx)(o.AnimatedNumber,{value:j,format:m})]})}export{c as RoundGauge};
1
+ import*as e from"react/jsx-runtime";import*as a from"../common/math.js";import*as s from"../common/react.js";import*as r from"../common/ui.js";import*as o from"./AnimatedNumber.js";function c(c){let{alertAfter:l,alertBefore:t,className:n,format:m,maxValue:i=1,minValue:u=1,ranges:d,size:x=1,style:g,value:j,...C}=c,p=(0,a.scale)(j,u,i),_=(0,a.clamp01)(p),f=d?{}:{primary:[0,1]};if(d)for(let e in d){let s=d[e];f[e]=[(0,a.scale)(s[0],u,i),(0,a.scale)(s[1],u,i)]}let h=(!!l&&!!t&&!!(j>l)&&!!(j<t)||!!l&&!!(j>l)||!!t&&!!(j<t))&&(0,a.keyOfMatchingRange)(_,f);return(0,e.jsxs)("div",{className:"RoundGauge__wrapper",children:[(0,e.jsx)("div",{className:(0,s.classes)(["RoundGauge",n,(0,r.computeBoxClassName)(C)]),...(0,r.computeBoxProps)({style:{fontSize:`${x}em`,...g},...C}),children:(0,e.jsxs)("svg",{viewBox:"0 0 100 50",children:[(l||t)&&(0,e.jsx)("g",{className:(0,s.classes)(["RoundGauge__alert",h?`active RoundGauge__alert--${h}`:""]),children:(0,e.jsx)("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"})}),(0,e.jsx)("g",{children:(0,e.jsx)("circle",{className:"RoundGauge__ringTrack",cx:"50",cy:"50",r:"45"})}),(0,e.jsx)("g",{children:Object.keys(f).map((a,s)=>{let r=f[a];return(0,e.jsx)("circle",{className:`RoundGauge__ringFill RoundGauge--color--${a}`,cx:"50",cy:"50",r:"45",style:{strokeDashoffset:Math.max((2-(r[1]-r[0]))*Math.PI*50,0)},transform:`rotate(${180+180*r[0]} 50 50)`},s)})}),(0,e.jsxs)("g",{className:"RoundGauge__needle",transform:`rotate(${180*_-90} 50 50)`,children:[(0,e.jsx)("polygon",{className:"RoundGauge__needleLine",points:"46,50 50,0 54,50"}),(0,e.jsx)("circle",{className:"RoundGauge__needleMiddle",cx:"50",cy:"50",r:"8"})]}),(0,e.jsx)("title",{children:"alert"})]})}),(0,e.jsx)(o.AnimatedNumber,{format:m,value:j})]})}export{c as RoundGauge};
@@ -28,6 +28,7 @@ type Props = Partial<{
28
28
  }> & BoxProps;
29
29
  /**
30
30
  * ## Section
31
+ *
31
32
  * Section is a surface that displays content and actions on a single topic.
32
33
  *
33
34
  * They should be easy to scan for relevant and actionable information.
@@ -40,6 +41,8 @@ type Props = Partial<{
40
41
  *
41
42
  * Section can also be titled to clearly define its purpose.
42
43
  *
44
+ * Example:
45
+ *
43
46
  * ```tsx
44
47
  * <Section title="Cargo">Here you can order supply crates.</Section>
45
48
  * ```
@@ -47,11 +50,15 @@ type Props = Partial<{
47
50
  * If you want to have a button on the right side of an section title
48
51
  * (for example, to perform some sort of action), there is a way to do that:
49
52
  *
53
+ * Example:
54
+ *
50
55
  * ```tsx
51
56
  * <Section title="Cargo" buttons={<Button>Send shuttle</Button>}>
52
57
  * Here you can order supply crates.
53
58
  * </Section>
54
59
  * ```
60
+ *
61
+ * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-section--docs)
55
62
  */
56
63
  export declare function Section(props: Props): import("react/jsx-runtime").JSX.Element;
57
64
  export {};
@@ -1 +1 @@
1
- import*as e from"react/jsx-runtime";import*as t from"react";import*as o from"../common/events.js";import*as c from"../common/react.js";import*as n from"../common/ui.js";function s(s){let{buttons:r,children:i,className:l,container_id:a="",fill:m,fitted:d,flexGrow:S,noTopPadding:u,onScroll:_,ref:f,scrollable:x,scrollableHorizontal:p,stretchContents:j,title:N,...h}=s,v=(0,c.canRender)(N)||(0,c.canRender)(r),b=(0,t.useRef)(null),R=f??b;return(0,t.useEffect)(()=>(R.current&&(x||p)&&(0,o.addScrollableNode)(R.current),()=>{R.current&&(0,o.removeScrollableNode)(R.current)}),[]),(0,e.jsxs)("div",{id:a,className:(0,c.classes)(["Section",m&&"Section--fill",d&&"Section--fitted",x&&"Section--scrollable",p&&"Section--scrollableHorizontal",S&&"Section--flex",l,(0,n.computeBoxClassName)(h)]),...(0,n.computeBoxProps)(h),children:[v&&(0,e.jsxs)("div",{className:"Section__title",children:[(0,e.jsx)("span",{className:"Section__titleText",children:N}),(0,e.jsx)("div",{className:"Section__buttons",children:r})]}),(0,e.jsx)("div",{className:"Section__rest",children:(0,e.jsx)("div",{className:(0,c.classes)(["Section__content",j&&"Section__content--stretchContents",u&&"Section__content--noTopPadding"]),onScroll:_,ref:R,children:i})})]})}export{s as Section};
1
+ import*as e from"react/jsx-runtime";import*as t from"react";import*as o from"../common/events.js";import*as c from"../common/react.js";import*as n from"../common/ui.js";function s(s){let{buttons:r,children:i,className:l,container_id:a="",fill:m,fitted:d,flexGrow:S,noTopPadding:u,onScroll:_,ref:f,scrollable:x,scrollableHorizontal:p,stretchContents:j,title:N,...h}=s,v=(0,c.canRender)(N)||(0,c.canRender)(r),b=(0,t.useRef)(null),R=f??b;return(0,t.useEffect)(()=>(R.current&&(x||p)&&(0,o.addScrollableNode)(R.current),()=>{R.current&&(0,o.removeScrollableNode)(R.current)}),[]),(0,e.jsxs)("div",{className:(0,c.classes)(["Section",m&&"Section--fill",d&&"Section--fitted",x&&"Section--scrollable",p&&"Section--scrollableHorizontal",S&&"Section--flex",l,(0,n.computeBoxClassName)(h)]),id:a,...(0,n.computeBoxProps)(h),children:[v&&(0,e.jsxs)("div",{className:"Section__title",children:[(0,e.jsx)("span",{className:"Section__titleText",children:N}),(0,e.jsx)("div",{className:"Section__buttons",children:r})]}),(0,e.jsx)("div",{className:"Section__rest",children:(0,e.jsx)("div",{className:(0,c.classes)(["Section__content",j&&"Section__content--stretchContents",u&&"Section__content--noTopPadding"]),onScroll:_,ref:R,children:i})})]})}export{s as Section};
@@ -47,10 +47,14 @@ type Props = {
47
47
  }> & BoxProps & PropsWithChildren;
48
48
  /**
49
49
  * ## Slider
50
- * A horizontal, [ProgressBar](https://github.com/tgstation/tgui-core/tree/main/lib/components/Progressbar.tsx)-like
50
+ *
51
+ * A horizontal,
52
+ * [ProgressBar](https://tgstation.github.io/tgui-core/?path=/docs/components-progressbar--docs)-like
51
53
  * control which allows dialing * in precise values by dragging it left and right.
52
54
  *
53
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)
54
58
  */
55
59
  export declare function Slider(props: Props): import("react/jsx-runtime").JSX.Element;
56
60
  export {};
@@ -1 +1 @@
1
- import*as s from"react/jsx-runtime";import*as r from"../common/math.js";import*as e from"../common/react.js";import*as a from"../common/ui.js";import*as l from"./DraggableControl.js";function o(o){let{animated:i,format:t,maxValue:c,minValue:m,onChange:d,onDrag:n,step:p,stepPixelSize:_,unit:j,value:u,className:x,fillValue:f,color:g,ranges:h={},children:v,...N}=o,B=void 0!==v;return(0,s.jsx)(l.DraggableControl,{dragMatrix:[1,0],animated:i,format:t,maxValue:c,minValue:m,onChange:d,onDrag:n,step:p,stepPixelSize:_,unit:j,value:u,children:l=>{let{displayElement:o,displayValue:i,dragging:t,handleDragStart:d,inputElement:n}=l,p=null!=f,_=(0,r.scale)(f??i,m,c),j=(0,r.scale)(i,m,c),P=g||(0,r.keyOfMatchingRange)(f??u,h)||"default";return(0,s.jsxs)("div",{className:(0,e.classes)(["Slider","ProgressBar",`ProgressBar--color--${P}`,x,(0,a.computeBoxClassName)(N)]),...(0,a.computeBoxProps)(N),onMouseDown:d,children:[(0,s.jsx)("div",{className:(0,e.classes)(["ProgressBar__fill",p&&"ProgressBar__fill--animated"]),style:{width:`${100*(0,r.clamp01)(_)}%`,opacity:.4}}),(0,s.jsx)("div",{className:"ProgressBar__fill",style:{width:`${100*(0,r.clamp01)(Math.min(_,j))}%`}}),(0,s.jsxs)("div",{className:"Slider__cursorOffset",style:{width:`${100*(0,r.clamp01)(j)}%`},children:[(0,s.jsx)("div",{className:"Slider__cursor"}),(0,s.jsx)("div",{className:"Slider__pointer"}),t&&(0,s.jsx)("div",{className:"Slider__popupValue",children:o})]}),(0,s.jsx)("div",{className:"ProgressBar__content",children:B?v:o}),n]})}})}export{o as Slider};
1
+ import*as s from"react/jsx-runtime";import*as r from"../common/math.js";import*as e from"../common/react.js";import*as a from"../common/ui.js";import*as l from"./DraggableControl.js";function o(o){let{animated:i,format:t,maxValue:c,minValue:m,onChange:d,onDrag:n,step:p,stepPixelSize:_,unit:j,value:u,className:x,fillValue:f,color:g,ranges:h={},children:v,...N}=o,B=void 0!==v;return(0,s.jsx)(l.DraggableControl,{dragMatrix:[1,0],animated:i,format:t,maxValue:c,minValue:m,onChange:d,onDrag:n,step:p,stepPixelSize:_,unit:j,value:u,children:l=>{let{displayElement:o,displayValue:i,dragging:t,handleDragStart:d,inputElement:n}=l,p=null!=f,_=(0,r.scale)(f??i,m,c),j=(0,r.scale)(i,m,c),P=g||(0,r.keyOfMatchingRange)(f??u,h)||"default";return(0,s.jsxs)("div",{className:(0,e.classes)(["Slider","ProgressBar",`ProgressBar--color--${P}`,x,(0,a.computeBoxClassName)(N)]),...(0,a.computeBoxProps)(N),onMouseDown:d,children:[(0,s.jsx)("div",{className:(0,e.classes)(["ProgressBar__fill",p&&"ProgressBar__fill--animated"]),style:{opacity:.4,width:`${100*(0,r.clamp01)(_)}%`}}),(0,s.jsx)("div",{className:"ProgressBar__fill",style:{width:`${100*(0,r.clamp01)(Math.min(_,j))}%`}}),(0,s.jsxs)("div",{className:"Slider__cursorOffset",style:{width:`${100*(0,r.clamp01)(j)}%`},children:[(0,s.jsx)("div",{className:"Slider__cursor"}),(0,s.jsx)("div",{className:"Slider__pointer"}),t&&(0,s.jsx)("div",{className:"Slider__popupValue",children:o})]}),(0,s.jsx)("div",{className:"ProgressBar__content",children:B?v:o}),n]})}})}export{o as Slider};
@@ -12,8 +12,9 @@ type Props = Partial<{
12
12
  }> & FlexProps;
13
13
  /**
14
14
  * ## Stack
15
+ *
15
16
  * A higher-level component that is based on
16
- * [Flex](https://github.com/tgstation/tgui-core/tree/main/lib/components/Flex.tsx).
17
+ * [Flex](https://tgstation.github.io/tgui-core/?path=/docs/components-flex--docs).
17
18
  *
18
19
  * The main difference from `Flex`, is that this component automatically adds
19
20
  * spacing between all stack items, reducing the boilerplate that you have to write!
@@ -22,7 +23,8 @@ type Props = Partial<{
22
23
  *
23
24
  * Stacks can be vertical by adding a `vertical` property.
24
25
  *
25
- * @example
26
+ * Example:
27
+ *
26
28
  * ```tsx
27
29
  * <Stack vertical>
28
30
  * <Stack.Item grow>Button description</Stack.Item>
@@ -36,7 +38,8 @@ type Props = Partial<{
36
38
  * Stacks can be used for high level window layout.
37
39
  * Make sure to use the `fill` property.
38
40
  *
39
- * @example
41
+ * Example:
42
+ *
40
43
  * ```tsx
41
44
  * <Window>
42
45
  * <Window.Content>
@@ -60,6 +63,8 @@ type Props = Partial<{
60
63
  * </Window.Content>
61
64
  * </Window>
62
65
  * ```
66
+ *
67
+ * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-stack--docs)
63
68
  */
64
69
  export declare function Stack(props: Props): import("react/jsx-runtime").JSX.Element;
65
70
  export declare namespace Stack {
@@ -23,11 +23,13 @@ type CellProps = Partial<{
23
23
  declare function TableCell(props: CellProps): import("react/jsx-runtime").JSX.Element;
24
24
  /**
25
25
  * ## Table
26
+ *
26
27
  * A straight forward mapping to a standard html table, which is slightly
27
28
  * simplified (does not need a `<tbody>` tag) and with sane default styles
28
29
  * (e.g. table width is 100% by default).
29
30
  *
30
- * @example
31
+ * Example:
32
+ *
31
33
  * ```tsx
32
34
  * <Table>
33
35
  * <Table.Row>
@@ -38,6 +40,8 @@ declare function TableCell(props: CellProps): import("react/jsx-runtime").JSX.El
38
40
  * </Table.Row>
39
41
  * </Table>
40
42
  * ```
43
+ *
44
+ * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-table--docs)
41
45
  */
42
46
  export declare namespace Table {
43
47
  /**
@@ -30,12 +30,14 @@ type TabProps = Partial<{
30
30
  }> & BoxProps;
31
31
  declare function TabItem(props: TabProps): import("react/jsx-runtime").JSX.Element;
32
32
  /**
33
- * ## Tabs
33
+ * ## Tabs
34
+ *
34
35
  * Tabs make it easy to explore and switch between different views.
35
36
  *
36
37
  * Here is an example of how you would construct a simple tabbed view:
37
38
  *
38
- * @example
39
+ * Example:
40
+ *
39
41
  * ```tsx
40
42
  * <Tabs>
41
43
  * <Tabs.Tab
@@ -59,10 +61,11 @@ declare function TabItem(props: TabProps): import("react/jsx-runtime").JSX.Eleme
59
61
  * a lot of flexibility in regards to how you can layout your tabs.
60
62
  *
61
63
  * Tabs also support a vertical configuration. This is usually paired with
62
- * [Stack](https://github.com/tgstation/tgui-core/tree/main/lib/components/Stack.tsx)
64
+ * [Stack](https://tgstation.github.io/tgui-core/?path=/docs/components-stack--docs)
63
65
  * to render tab content to the right.
64
66
  *
65
- * @example
67
+ * Example:
68
+ *
66
69
  * ```tsx
67
70
  * <Stack>
68
71
  * <Stack.Item>
@@ -76,16 +79,19 @@ declare function TabItem(props: TabProps): import("react/jsx-runtime").JSX.Eleme
76
79
  *
77
80
  * If you need to combine a tab section with other elements, or if you want to
78
81
  * add scrollable functionality to tabs, pair them with the
79
- * [Section](https://github.com/tgstation/tgui-core/tree/main/lib/components/Section.tsx)
82
+ * [Section](https://tgstation.github.io/tgui-core/?path=/docs/components-section--docs)
80
83
  * component:
81
84
  *
82
- * @example
85
+ * Example:
86
+ *
83
87
  * ```tsx
84
88
  * <Section fill fitted scrollable width="128px">
85
89
  * <Tabs vertical>...</Tabs>
86
90
  * ... other things ...
87
91
  * </Section>
88
92
  * ```
93
+ *
94
+ * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-tabs--docs)
89
95
  */
90
96
  export declare namespace Tabs {
91
97
  /**
@@ -11,14 +11,14 @@ type Props = Partial<{
11
11
  * character
12
12
  */
13
13
  userMarkup: Record<string, string>;
14
- }> & TextInputProps;
14
+ }> & TextInputProps<HTMLTextAreaElement>;
15
15
  /**
16
16
  * ## Textarea
17
17
  *
18
18
  * An input for larger amounts of text. Use this when you want inputs larger
19
19
  * than one row.
20
20
  *
21
- * @see https://github.com/tgstation/tgui-core/blob/main/lib/components/TextArea.tsx
21
+ * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-textarea--docs)
22
22
  */
23
23
  export declare function TextArea(props: Props): import("react/jsx-runtime").JSX.Element;
24
24
  export {};
@@ -1 +1 @@
1
- import*as e from"react/jsx-runtime";import*as t from"../common/timer.js";import*as r from"react";import*as n from"../common/keys.js";import*as u from"../common/react.js";import*as a from"../common/ui.js";let o=(0,t.debounce)(e=>e(),250);function s(t){let{autoFocus:s,autoSelect:c,className:l,disabled:m,dontUseTabForIndent:i,expensive:f,fluid:p,maxLength:g,monospace:T,onBlur:b,onChange:v,onEnter:y,onEscape:x,placeholder:E,ref:d,selfClear:k,userMarkup:$,value:h,...j}=t,K=(0,r.useRef)(null),C=d??K,[D,I]=(0,r.useState)(h??"");(0,r.useEffect)(()=>{(s||c)&&setTimeout(()=>{C.current?.focus(),c&&C.current?.select()},1)},[]),(0,r.useEffect)(()=>{C.current&&document.activeElement!==C.current&&h!==D&&I(h??"")},[h]);let B=(0,a.computeBoxProps)(j),A=(0,u.classes)(["Input","TextArea",p&&"Input--fluid",T&&"Input--monospace",m&&"Input--disabled",(0,a.computeBoxClassName)(j),l]);return(0,e.jsx)("textarea",{...B,autoComplete:"off",className:A,maxLength:g,onBlur:function(e){b?.(D)},onChange:function(e){let t=e.currentTarget.value;I(t),v&&(f?o(()=>v(t)):v(t))},onKeyDown:function(e){if(e.key===n.KEY.Enter&&!e.shiftKey){e.preventDefault(),y?.(e.currentTarget.value),k&&I(""),e.currentTarget.blur();return}if((0,n.isEscape)(e.key)){x?.(e.currentTarget.value),e.currentTarget.blur();return}if(!i&&e.key===n.KEY.Tab){e.preventDefault();let{value:t,selectionStart:r,selectionEnd:n}=e.currentTarget;I(`${t.substring(0,r)} ${t.substring(n)}`),e.currentTarget.selectionEnd=r+1,v?.(e.currentTarget.value);return}if($&&(e.ctrlKey||e.metaKey)&&$[e.key]){e.preventDefault();let{selectionStart:t,selectionEnd:r,value:n}=e.currentTarget,u=$[e.key];I(`${n.substring(0,t)}${u}${n.substring(t,r)}${u}${n.substring(r)}`),e.currentTarget.selectionEnd=r+2*u.length,v?.(e.currentTarget.value);return}},placeholder:E,ref:C,spellCheck:!1,value:D})}export{s as TextArea};
1
+ import*as e from"react/jsx-runtime";import*as t from"../common/timer.js";import*as r from"react";import*as n from"../common/keys.js";import*as u from"../common/react.js";import*as a from"../common/ui.js";let o=(0,t.debounce)(e=>e(),250);function s(t){let{autoFocus:s,autoSelect:c,className:l,disabled:m,dontUseTabForIndent:i,expensive:f,fluid:p,maxLength:g,monospace:T,onBlur:b,onChange:v,onEnter:y,onEscape:x,onKeyDown:E,placeholder:d,ref:k,selfClear:$,userMarkup:h,value:j,...K}=t,C=(0,r.useRef)(null),D=k??C,[I,B]=(0,r.useState)(j??"");(0,r.useEffect)(()=>{(s||c)&&setTimeout(()=>{D.current?.focus(),c&&D.current?.select()},1)},[]),(0,r.useEffect)(()=>{D.current&&document.activeElement!==D.current&&j!==I&&B(j??"")},[j]);let A=(0,a.computeBoxProps)(K),N=(0,u.classes)(["Input","TextArea",p&&"Input--fluid",T&&"Input--monospace",m&&"Input--disabled",(0,a.computeBoxClassName)(K),l]);return(0,e.jsx)("textarea",{...A,autoComplete:"off",className:N,maxLength:g,onBlur:function(e){b?.(I)},onChange:function(e){let t=e.currentTarget.value;B(t),v&&(f?o(()=>v(t)):v(t))},onKeyDown:function(e){if(E?.(e),e.key===n.KEY.Enter&&!e.shiftKey){e.preventDefault(),y?.(e.currentTarget.value),$&&B(""),e.currentTarget.blur();return}if((0,n.isEscape)(e.key)){x?.(e.currentTarget.value),e.currentTarget.blur();return}if(!i&&e.key===n.KEY.Tab){e.preventDefault();let{value:t,selectionStart:r,selectionEnd:n}=e.currentTarget;B(`${t.substring(0,r)} ${t.substring(n)}`),e.currentTarget.selectionEnd=r+1,v?.(e.currentTarget.value);return}if(h&&(e.ctrlKey||e.metaKey)&&h[e.key]){e.preventDefault();let{selectionStart:t,selectionEnd:r,value:n}=e.currentTarget,u=h[e.key];B(`${n.substring(0,t)}${u}${n.substring(t,r)}${u}${n.substring(r)}`),e.currentTarget.selectionEnd=r+2*u.length,v?.(e.currentTarget.value);return}},placeholder:d,ref:D,spellCheck:!1,value:I})}export{s as TextArea};
@@ -7,5 +7,12 @@ type TimeDisplayProps = {
7
7
  /** An optional function to format the value */
8
8
  format: (value: number) => string;
9
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
+ */
10
17
  export declare function TimeDisplay(props: TimeDisplayProps): string | number | null;
11
18
  export {};
@@ -9,5 +9,21 @@ type Props = {
9
9
  /** Where to place the tooltip relative to the reference element */
10
10
  position: Placement;
11
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
+ */
12
28
  export declare function Tooltip(props: Props): import("react/jsx-runtime").JSX.Element;
13
29
  export {};
@@ -1 +1 @@
1
- import*as t from"react/jsx-runtime";import*as o from"./Floating.js";function e(e){let{content:n,children:r,position:i}=e;return(0,t.jsx)(o.Floating,{hoverOpen:!0,content:n,contentClasses:"Tooltip",placement:i,children:r})}export{e as Tooltip};
1
+ import*as t from"react/jsx-runtime";import*as o from"./Floating.js";function e(e){let{content:n,children:r,position:i}=e;return(0,t.jsx)(o.Floating,{content:n,contentClasses:"Tooltip",hoverOpen:!0,placement:i,children:r})}export{e as Tooltip};
@@ -1,7 +1,11 @@
1
1
  import { type PropsWithChildren } from 'react';
2
2
  /**
3
+ * ## VirtualList
4
+ *
3
5
  * A vertical list that renders items to fill space up to the extents of the
4
6
  * current window, and then defers rendering of other items until they come
5
7
  * into view.
8
+ *
9
+ * - [View documentation on tgui core](https://tgstation.github.io/tgui-core/?path=/docs/components-virtuallist--docs)
6
10
  */
7
11
  export declare function VirtualList(props: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,10 +1,36 @@
1
1
  {
2
- "name": "tgui-core",
3
- "version": "3.1.4",
2
+ "author": "jlsnow301",
3
+ "dependencies": {
4
+ "@floating-ui/react": "^0.27.8",
5
+ "@nozbe/microfuzz": "^1.0.0"
6
+ },
4
7
  "description": "TGUI core component library",
5
- "keywords": ["TGUI", "library", "typescript"],
6
- "files": ["dist", "styles"],
8
+ "devDependencies": {
9
+ "@biomejs/biome": "2.0.0-beta.2",
10
+ "@rsbuild/core": "^1.3.18",
11
+ "@rsbuild/plugin-react": "^1.3.1",
12
+ "@rsbuild/plugin-sass": "^1.3.1",
13
+ "@rslib/core": "^0.6.9",
14
+ "@storybook/addon-console": "^3.0.0",
15
+ "@storybook/addon-essentials": "^8.6.12",
16
+ "@storybook/blocks": "^8.6.12",
17
+ "@storybook/react": "^8.6.12",
18
+ "@storybook/theming": "^8.6.12",
19
+ "@types/node": "^22.15.17",
20
+ "@types/react": "^19.1.3",
21
+ "@types/react-dom": "^19.1.3",
22
+ "prettier": "^3.5.3",
23
+ "sass": "^1.81.0",
24
+ "storybook": "^8.6.12",
25
+ "storybook-addon-sass-postcss": "^0.3.2",
26
+ "storybook-react-rsbuild": "^1.0.1",
27
+ "typescript": "^5.8.3"
28
+ },
7
29
  "exports": {
30
+ "./*": {
31
+ "import": "./dist/common/*.js",
32
+ "require": "./dist/common/*.cjs"
33
+ },
8
34
  "./components": {
9
35
  "import": "./dist/components/index.js",
10
36
  "require": "./dist/components/index.cjs"
@@ -15,53 +41,36 @@
15
41
  },
16
42
  "./styles/components/*": {
17
43
  "sass": "./styles/components/*"
18
- },
19
- "./*": {
20
- "import": "./dist/common/*.js",
21
- "require": "./dist/common/*.cjs"
22
44
  }
23
45
  },
46
+ "files": [
47
+ "dist",
48
+ "styles"
49
+ ],
50
+ "keywords": [
51
+ "TGUI",
52
+ "library",
53
+ "typescript"
54
+ ],
55
+ "license": "MIT",
56
+ "name": "tgui-core",
57
+ "packageManager": "pnpm@10.10.0",
58
+ "peerDependencies": {
59
+ "react": "^19.1.0",
60
+ "react-dom": "^19.1.0"
61
+ },
24
62
  "repository": {
25
63
  "type": "git",
26
64
  "url": "https://github.com/tgstation/tgui-core.git"
27
65
  },
28
66
  "scripts": {
29
67
  "build": "rslib build",
68
+ "build-storybook": "storybook build",
30
69
  "lint": "biome check lib",
31
70
  "lint:fix": "prettier . --write && biome check . --fix",
32
71
  "storybook": "storybook dev -p 6006",
33
- "build-storybook": "storybook build",
34
72
  "test": "node --experimental-strip-types --experimental-test-coverage --test ./tests/*.test.ts"
35
73
  },
36
- "author": "jlsnow301",
37
- "license": "MIT",
38
74
  "type": "module",
39
- "dependencies": {
40
- "@floating-ui/react": "^0.27.6"
41
- },
42
- "devDependencies": {
43
- "@biomejs/biome": "1.9.4",
44
- "@rsbuild/core": "^1.3.5",
45
- "@rsbuild/plugin-react": "^1.2.0",
46
- "@rsbuild/plugin-sass": "^1.3.1",
47
- "@rslib/core": "^0.6.2",
48
- "@storybook/addon-console": "^3.0.0",
49
- "@storybook/addon-essentials": "^8.6.12",
50
- "@storybook/react": "^8.6.12",
51
- "@storybook/theming": "^8.6.12",
52
- "@types/node": "^22.14.0",
53
- "@types/react": "^19.1.0",
54
- "@types/react-dom": "^19.1.1",
55
- "prettier": "^3.5.3",
56
- "sass": "^1.81.0",
57
- "storybook": "^8.6.12",
58
- "storybook-addon-sass-postcss": "^0.3.2",
59
- "storybook-react-rsbuild": "^1.0.1",
60
- "typescript": "^5.8.3"
61
- },
62
- "peerDependencies": {
63
- "react": "^19.1.0",
64
- "react-dom": "^19.1.0"
65
- },
66
- "packageManager": "pnpm@10.7.0"
75
+ "version": "3.2.0"
67
76
  }