@ttoss/ui 4.1.17 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  **@ttoss/ui** is a library of React low level components for building user interfaces and defining the design system of your application. It is built on top of [Theme UI: The Design Graph Framework](https://theme-ui.com/), so that you'll be able to consult the [Theme UI documentation](https://theme-ui.com/getting-started) to learn more about the design system and the components.
4
4
 
5
+ ## ESM Only
6
+
7
+ This package is [ESM only](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c).
8
+
5
9
  ## Installation
6
10
 
7
11
  ```shell
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "4.1.17",
3
+ "version": "5.0.0",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "author": "ttoss",
6
6
  "contributors": [
@@ -11,6 +11,7 @@
11
11
  "url": "https://github.com/ttoss/ttoss.git",
12
12
  "directory": "packages/ui"
13
13
  },
14
+ "type": "module",
14
15
  "exports": {
15
16
  ".": {
16
17
  "import": "./dist/esm/index.js",
@@ -26,12 +27,12 @@
26
27
  "@theme-ui/match-media": "^0.16.2",
27
28
  "react-select": "^5.8.0",
28
29
  "theme-ui": "^0.16.2",
29
- "@ttoss/theme": "^1.7.14"
30
+ "@ttoss/theme": "^1.7.15"
30
31
  },
31
32
  "peerDependencies": {
32
33
  "@emotion/react": "^11",
33
34
  "react": ">=16.8.0",
34
- "@ttoss/react-icons": "^0.3.13"
35
+ "@ttoss/react-icons": "^0.4.0"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@emotion/react": "^11.11.4",
@@ -43,7 +44,7 @@
43
44
  "tsup": "^8.2.4",
44
45
  "@ttoss/config": "^1.32.9",
45
46
  "@ttoss/test-utils": "^2.1.13",
46
- "@ttoss/react-icons": "^0.3.13"
47
+ "@ttoss/react-icons": "^0.4.0"
47
48
  },
48
49
  "keywords": [
49
50
  "React",
package/dist/index.d.mts DELETED
@@ -1,143 +0,0 @@
1
- import * as theme_ui from 'theme-ui';
2
- import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, LinkProps as LinkProps$1, SxProp, IconButtonProps, CheckboxProps as CheckboxProps$1, TextareaProps as TextareaProps$1, TextProps, FlexProps } from 'theme-ui';
3
- export { BaseStyles, Box, BoxProps, Card, CardProps, ContainerProps, Divider, DividerProps, Flex, FlexProps, Global, Grid, GridProps, Heading, HeadingProps, IconButtonProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Paragraph, ParagraphProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, SxProp, Text, TextProps, Theme, ThemeUIStyleObject } from 'theme-ui';
4
- export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
5
- export { Keyframes, keyframes } from '@emotion/react';
6
- import * as react_jsx_runtime from 'react/jsx-runtime';
7
- import * as React from 'react';
8
- import { IconType } from '@ttoss/react-icons';
9
- import { Props } from 'react-select';
10
-
11
- type ThemeProviderProps = {
12
- children?: React.ReactNode;
13
- theme?: Theme;
14
- /**
15
- * Fonts URLs.
16
- */
17
- fonts?: string[];
18
- };
19
- declare const ThemeProvider: ({ children, theme, fonts, }: ThemeProviderProps) => react_jsx_runtime.JSX.Element;
20
-
21
- declare const useTheme: () => theme_ui.ThemeUIContextValue;
22
-
23
- type BadgeProps = BadgeProps$1 & {
24
- icon?: IconType;
25
- chip?: boolean;
26
- onDelete?: () => void;
27
- };
28
- declare const Badge: ({ icon, children, sx, chip, onDelete, ...props }: BadgeProps) => react_jsx_runtime.JSX.Element;
29
-
30
- type ButtonProps = ButtonProps$1 & {
31
- leftIcon?: IconType;
32
- rightIcon?: IconType;
33
- loading?: boolean;
34
- };
35
- declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
36
-
37
- interface InputProps extends InputProps$1 {
38
- leadingIcon?: IconType;
39
- onLeadingIconClick?: () => void;
40
- trailingIcon?: IconType;
41
- onTrailingIconClick?: () => void;
42
- }
43
- declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
44
-
45
- type LabelProps = LabelProps$1 & {
46
- tooltip?: boolean;
47
- onTooltipClick?: () => void;
48
- };
49
- declare const Label: ({ children, onTooltipClick, tooltip, sx, ...props }: LabelProps) => react_jsx_runtime.JSX.Element;
50
-
51
- type LinkProps = LinkProps$1 & {
52
- quiet?: boolean;
53
- };
54
- declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
55
-
56
- /**
57
- * We're using React Select component to build ttoss Select.
58
- * More info about React Select: https://react-select.com/home
59
- * ttoss Figma: https://www.figma.com/file/VrB76VkH4hKCDUe9iYhpYu/_Component-%2F-Forms-%2F-Select?type=design&mode=design&t=ZBIeOpqcvQn3yq2t-0
60
- */
61
-
62
- type SelectOptionValue = string | number | boolean;
63
- type SelectOption = {
64
- label: string;
65
- value: SelectOptionValue;
66
- };
67
- type SelectOptions = SelectOption[];
68
- /**
69
- * TODO: remove this when we accept multi select.
70
- */
71
- type IsMulti = false;
72
- type SelectProps = Omit<Props<SelectOption, IsMulti>, 'styles' | 'value' | 'onChange' | 'components'> & SxProp & {
73
- value?: SelectOptionValue;
74
- onChange?: (value: SelectOptionValue | undefined) => void;
75
- disabled?: boolean;
76
- leadingIcon?: IconType;
77
- trailingIcon?: IconType;
78
- };
79
- /**
80
- * https://react-select.com/home
81
- */
82
- declare const Select: React.ForwardRefExoticComponent<Omit<Props<SelectOption, false>, "value" | "onChange" | "styles" | "components"> & SxProp & {
83
- value?: SelectOptionValue;
84
- onChange?: (value: SelectOptionValue | undefined) => void;
85
- disabled?: boolean;
86
- leadingIcon?: IconType;
87
- trailingIcon?: IconType;
88
- } & React.RefAttributes<any>>;
89
-
90
- declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
91
-
92
- interface CheckboxProps extends CheckboxProps$1 {
93
- indeterminate?: boolean;
94
- }
95
- declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
96
-
97
- declare const InfiniteLinearProgress: () => react_jsx_runtime.JSX.Element;
98
-
99
- interface TextareaProps extends TextareaProps$1 {
100
- trailingIcon?: IconType;
101
- }
102
- declare const Textarea: React.ForwardRefExoticComponent<Omit<TextareaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
103
-
104
- declare const Container: React.ForwardRefExoticComponent<theme_ui.BoxProps & React.RefAttributes<HTMLDivElement>>;
105
-
106
- type HelpTextProps = Omit<TextProps, 'variant'> & {
107
- disabled?: boolean;
108
- negative?: boolean;
109
- };
110
- declare const HelpText: ({ sx, disabled, negative, ...props }: HelpTextProps) => react_jsx_runtime.JSX.Element;
111
-
112
- type CloseButtonProps = ButtonProps & {
113
- label?: string;
114
- onlyText?: boolean;
115
- };
116
- declare const CloseButton: React.ForwardRefExoticComponent<Omit<CloseButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
117
-
118
- type InputNumberProps = Omit<InputProps$1, 'type' | 'variant' | 'onChange'> & {
119
- onChange: (value: number) => void;
120
- value?: number;
121
- infoIcon?: boolean;
122
- onClickInfoIcon?: () => void;
123
- };
124
- declare const InputNumber: React.ForwardRefExoticComponent<Omit<InputNumberProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
125
-
126
- type StackProps = FlexProps;
127
- /**
128
- * A component that renders its children in a column.
129
- */
130
- declare const Stack: React.ForwardRefExoticComponent<theme_ui.BoxProps & React.RefAttributes<HTMLElement>>;
131
-
132
- type InputPasswordProps = Omit<InputProps, 'trailingIcon' | 'onTrailingIconClick' | 'type'> & {
133
- showPasswordByDefault?: boolean;
134
- };
135
- declare const InputPassword: React.ForwardRefExoticComponent<Omit<InputPasswordProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
136
-
137
- type ActionButtonProps = Omit<ButtonProps, 'rightIcon' | 'leftIcon' | 'variant'> & {
138
- icon: ButtonProps['leftIcon'];
139
- variant?: 'default' | 'accent' | 'quiet';
140
- };
141
- declare const ActionButton: ({ icon, variant, sx, ...props }: ActionButtonProps) => react_jsx_runtime.JSX.Element;
142
-
143
- export { ActionButton, type ActionButtonProps, Badge, type BadgeProps, Button, type ButtonProps, Checkbox, type CheckboxProps, CloseButton, type CloseButtonProps, Container, HelpText, type HelpTextProps, IconButton, InfiniteLinearProgress, Input, InputNumber, type InputNumberProps, InputPassword, type InputPasswordProps, type InputProps, Label, type LabelProps, Link, type LinkProps, Select, type SelectOption, type SelectOptions, type SelectProps, Stack, type StackProps, Textarea, type TextareaProps, ThemeProvider, type ThemeProviderProps, useTheme };
package/dist/index.js DELETED
@@ -1,1017 +0,0 @@
1
- /** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
2
- "use strict";
3
-
4
- var __create = Object.create;
5
- var __defProp = Object.defineProperty;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getProtoOf = Object.getPrototypeOf;
9
- var __hasOwnProp = Object.prototype.hasOwnProperty;
10
- var __export = (target, all) => {
11
- for (var name in all) __defProp(target, name, {
12
- get: all[name],
13
- enumerable: true
14
- });
15
- };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
19
- get: () => from[key],
20
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
21
- });
22
- }
23
- return to;
24
- };
25
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
26
- // If the importer is in node compatibility mode or this is not an ESM
27
- // file that has been converted to a CommonJS file using a Babel-
28
- // compatible transform (i.e. "__esModule" has not been set), then set
29
- // "default" to the CommonJS "module.exports" for node compatibility.
30
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
31
- value: mod,
32
- enumerable: true
33
- }) : target, mod));
34
- var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
35
- value: true
36
- }), mod);
37
-
38
- // src/index.ts
39
- var src_exports = {};
40
- __export(src_exports, {
41
- ActionButton: () => ActionButton,
42
- Badge: () => Badge,
43
- BaseStyles: () => import_theme_ui26.BaseStyles,
44
- Box: () => import_theme_ui5.Box,
45
- Button: () => Button,
46
- Card: () => import_theme_ui7.Card,
47
- Checkbox: () => Checkbox,
48
- CloseButton: () => CloseButton,
49
- Container: () => Container,
50
- Divider: () => import_theme_ui8.Divider,
51
- Flex: () => import_theme_ui9.Flex,
52
- Global: () => import_theme_ui26.Global,
53
- Grid: () => import_theme_ui10.Grid,
54
- Heading: () => import_theme_ui11.Heading,
55
- HelpText: () => HelpText,
56
- IconButton: () => IconButton,
57
- Image: () => import_theme_ui12.Image,
58
- InfiniteLinearProgress: () => InfiniteLinearProgress,
59
- Input: () => Input,
60
- InputNumber: () => InputNumber,
61
- InputPassword: () => InputPassword,
62
- Label: () => Label,
63
- LinearProgress: () => import_theme_ui16.Progress,
64
- Link: () => Link,
65
- Paragraph: () => import_theme_ui25.Paragraph,
66
- Radio: () => import_theme_ui18.Radio,
67
- Select: () => Select,
68
- Slider: () => import_theme_ui20.Slider,
69
- Spinner: () => import_theme_ui17.Spinner,
70
- Stack: () => Stack,
71
- Text: () => import_theme_ui3.Text,
72
- Textarea: () => Textarea,
73
- ThemeProvider: () => ThemeProvider,
74
- keyframes: () => import_react2.keyframes,
75
- useBreakpointIndex: () => import_match_media.useBreakpointIndex,
76
- useResponsiveValue: () => import_match_media.useResponsiveValue,
77
- useTheme: () => useTheme
78
- });
79
- module.exports = __toCommonJS(src_exports);
80
- var import_theme_ui26 = require("theme-ui");
81
- var import_match_media = require("@theme-ui/match-media");
82
- var import_react2 = require("@emotion/react");
83
-
84
- // src/theme/ThemeProvider.tsx
85
- var import_Bruttal = require("@ttoss/theme/Bruttal");
86
- var import_react = require("@emotion/react");
87
- var import_theme_ui = require("theme-ui");
88
- var import_jsx_runtime = require("react/jsx-runtime");
89
- var ThemeProvider = ({
90
- children,
91
- theme = import_Bruttal.BruttalTheme,
92
- fonts = import_Bruttal.BruttalFonts
93
- }) => {
94
- return /* @__PURE__ */(0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {
95
- children: /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_theme_ui.ThemeUIProvider, {
96
- theme,
97
- children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)(import_react.Global, {
98
- styles: import_react.css`
99
- ${fonts.map(url => {
100
- return `@import url('${url}');`;
101
- }).join("\n")}
102
- `
103
- }), children]
104
- })
105
- });
106
- };
107
-
108
- // src/theme/useTheme.ts
109
- var import_theme_ui2 = require("theme-ui");
110
- var useTheme = import_theme_ui2.useThemeUI;
111
-
112
- // src/components/Badge.tsx
113
- var import_theme_ui4 = require("theme-ui");
114
- var import_react_icons = require("@ttoss/react-icons");
115
-
116
- // src/components/Text.tsx
117
- var import_theme_ui3 = require("theme-ui");
118
-
119
- // src/components/Badge.tsx
120
- var import_jsx_runtime2 = require("react/jsx-runtime");
121
- var Badge = ({
122
- icon,
123
- children,
124
- sx,
125
- chip,
126
- onDelete,
127
- ...props
128
- }) => {
129
- return /* @__PURE__ */(0, import_jsx_runtime2.jsxs)(import_theme_ui4.Badge, {
130
- sx: {
131
- display: "flex",
132
- alignItems: "center",
133
- fontFamily: "caption",
134
- fontWeight: "normal",
135
- lineHeight: "base",
136
- fontSize: "sm",
137
- paddingX: "xs",
138
- borderRadius: "informative",
139
- paddingY: "2xs",
140
- gap: "xs",
141
- ...sx
142
- },
143
- ...props,
144
- children: [icon && /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_react_icons.Icon, {
145
- inline: true,
146
- icon
147
- }), children, chip && /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_theme_ui3.Text, {
148
- sx: {
149
- cursor: "pointer",
150
- lineHeight: 0,
151
- color: "currentcolor",
152
- alignSelf: "center"
153
- },
154
- children: /* @__PURE__ */(0, import_jsx_runtime2.jsx)(import_react_icons.Icon, {
155
- onClick: onDelete,
156
- inline: true,
157
- icon: "close"
158
- })
159
- })]
160
- });
161
- };
162
-
163
- // src/components/Box.tsx
164
- var import_theme_ui5 = require("theme-ui");
165
-
166
- // src/components/Button.tsx
167
- var React = __toESM(require("react"));
168
- var import_theme_ui6 = require("theme-ui");
169
- var import_react_icons2 = require("@ttoss/react-icons");
170
- var import_jsx_runtime3 = require("react/jsx-runtime");
171
- var Button = React.forwardRef((props, ref) => {
172
- const {
173
- children,
174
- leftIcon,
175
- rightIcon,
176
- loading,
177
- ...restProps
178
- } = props;
179
- return /* @__PURE__ */(0, import_jsx_runtime3.jsxs)(import_theme_ui6.Button, {
180
- type: "button",
181
- ...restProps,
182
- ref,
183
- sx: {
184
- cursor: "pointer",
185
- paddingX: "xl",
186
- paddingY: "lg",
187
- fontFamily: "body",
188
- display: "inline-flex",
189
- alignItems: "center",
190
- gap: "lg",
191
- ...restProps.sx
192
- },
193
- children: [loading && /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_react_icons2.Icon, {
194
- inline: true,
195
- icon: "three-dots-loading"
196
- }), !loading && leftIcon && /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_react_icons2.Icon, {
197
- inline: true,
198
- icon: leftIcon
199
- }), children, rightIcon && /* @__PURE__ */(0, import_jsx_runtime3.jsx)(import_react_icons2.Icon, {
200
- inline: true,
201
- icon: rightIcon
202
- })]
203
- });
204
- });
205
- Button.displayName = "Button";
206
-
207
- // src/components/Card.tsx
208
- var import_theme_ui7 = require("theme-ui");
209
-
210
- // src/components/Divider.tsx
211
- var import_theme_ui8 = require("theme-ui");
212
-
213
- // src/components/Flex.tsx
214
- var import_theme_ui9 = require("theme-ui");
215
-
216
- // src/components/Grid.tsx
217
- var import_theme_ui10 = require("theme-ui");
218
-
219
- // src/components/Heading.tsx
220
- var import_theme_ui11 = require("theme-ui");
221
-
222
- // src/components/Image.tsx
223
- var import_theme_ui12 = require("theme-ui");
224
-
225
- // src/components/Input.tsx
226
- var React2 = __toESM(require("react"));
227
- var import_react_icons3 = require("@ttoss/react-icons");
228
- var import_theme_ui13 = require("theme-ui");
229
- var import_jsx_runtime4 = require("react/jsx-runtime");
230
- var Input = React2.forwardRef(({
231
- leadingIcon,
232
- trailingIcon: trailingIconProp,
233
- onLeadingIconClick,
234
- onTrailingIconClick,
235
- className,
236
- sx,
237
- ...inputProps
238
- }, ref) => {
239
- const trailingIcon = inputProps["aria-invalid"] ? "warning-alt" : trailingIconProp;
240
- return /* @__PURE__ */(0, import_jsx_runtime4.jsxs)(import_theme_ui9.Flex, {
241
- className,
242
- sx: {
243
- ...sx,
244
- position: "relative",
245
- padding: 0,
246
- border: "none"
247
- },
248
- children: [leadingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui3.Text, {
249
- sx: {
250
- position: "absolute",
251
- alignSelf: "center",
252
- left: "1rem",
253
- cursor: onLeadingIconClick ? "pointer" : "default"
254
- },
255
- onClick: onLeadingIconClick,
256
- variant: "leading-icon",
257
- children: /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_react_icons3.Icon, {
258
- inline: true,
259
- icon: leadingIcon
260
- })
261
- }), /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui13.Input, {
262
- ref,
263
- sx: {
264
- fontFamily: "body",
265
- paddingY: "lg",
266
- paddingX: "xl",
267
- ...sx,
268
- paddingLeft: leadingIcon ? "3xl" : void 0,
269
- paddingRight: trailingIcon ? "3xl" : void 0,
270
- margin: 0
271
- },
272
- className,
273
- ...inputProps
274
- }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_theme_ui3.Text, {
275
- sx: {
276
- position: "absolute",
277
- right: "1rem",
278
- alignSelf: "center",
279
- cursor: onTrailingIconClick ? "pointer" : "default"
280
- },
281
- variant: "trailing-icon",
282
- onClick: onTrailingIconClick,
283
- children: /* @__PURE__ */(0, import_jsx_runtime4.jsx)(import_react_icons3.Icon, {
284
- inline: true,
285
- icon: trailingIcon
286
- })
287
- })]
288
- });
289
- });
290
- Input.displayName = "Input";
291
-
292
- // src/components/Label.tsx
293
- var import_react_icons4 = require("@ttoss/react-icons");
294
- var import_theme_ui14 = require("theme-ui");
295
- var import_jsx_runtime5 = require("react/jsx-runtime");
296
- var TOOLTIP_LABEL = "tooltip";
297
- var Label = ({
298
- children,
299
- onTooltipClick,
300
- tooltip,
301
- sx,
302
- ...props
303
- }) => {
304
- return /* @__PURE__ */(0, import_jsx_runtime5.jsxs)(import_theme_ui14.Label, {
305
- sx: {
306
- fontFamily: "caption",
307
- alignItems: "center",
308
- fontSize: "sm",
309
- lineHeight: "base",
310
- ...sx
311
- },
312
- ...props,
313
- children: [children, tooltip && /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_theme_ui3.Text, {
314
- sx: {
315
- color: "currentcolor",
316
- cursor: onTooltipClick ? "pointer" : void 0
317
- },
318
- onClick: onTooltipClick,
319
- "aria-label": TOOLTIP_LABEL,
320
- children: /* @__PURE__ */(0, import_jsx_runtime5.jsx)(import_react_icons4.Icon, {
321
- inline: true,
322
- icon: "info"
323
- })
324
- })]
325
- });
326
- };
327
-
328
- // src/components/Link.tsx
329
- var React3 = __toESM(require("react"));
330
- var import_theme_ui15 = require("theme-ui");
331
- var import_jsx_runtime6 = require("react/jsx-runtime");
332
- var Link = React3.forwardRef(({
333
- quiet,
334
- className,
335
- ...props
336
- }, ref) => {
337
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui15.Link, {
338
- className: `${quiet ? "quiet" : ""} ${className ?? ""}`,
339
- ...props,
340
- ref
341
- });
342
- });
343
- Link.displayName = "Link";
344
-
345
- // src/components/LinearProgress.tsx
346
- var import_theme_ui16 = require("theme-ui");
347
-
348
- // src/components/Select.tsx
349
- var React4 = __toESM(require("react"));
350
- var import_react_icons5 = require("@ttoss/react-icons");
351
- var import_react_select = __toESM(require("react-select"));
352
- var import_jsx_runtime7 = require("react/jsx-runtime");
353
- var Control = props => {
354
- const isDisabled = props.selectProps.isDisabled;
355
- const hasError = props.selectProps["aria-invalid"] === "true";
356
- const border = (() => {
357
- if (isDisabled) {
358
- return "muted";
359
- }
360
- if (hasError) {
361
- return "danger";
362
- }
363
- return "interaction";
364
- })();
365
- const backgroundColor = (() => {
366
- if (isDisabled) {
367
- return "muted";
368
- }
369
- return "surface";
370
- })();
371
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui5.Box, {
372
- sx: {
373
- ".react-select__control": {
374
- border,
375
- backgroundColor,
376
- paddingX: "xl",
377
- paddingY: "lg",
378
- borderRadius: "action"
379
- }
380
- },
381
- children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_select.components.Control, {
382
- ...props
383
- })
384
- });
385
- };
386
- var DropdownIndicator = props => {
387
- const isDisabled = props.selectProps.isDisabled;
388
- const color = (() => {
389
- if (isDisabled) {
390
- return "onMuted";
391
- }
392
- return "text";
393
- })();
394
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui3.Text, {
395
- sx: {
396
- fontSize: "base",
397
- color,
398
- alignSelf: "center",
399
- display: "flex",
400
- alignItems: "center"
401
- },
402
- children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_icons5.Icon, {
403
- icon: "picker-down"
404
- })
405
- });
406
- };
407
- var IndicatorsContainer = ({
408
- children
409
- }) => {
410
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui5.Box, {
411
- sx: {
412
- marginLeft: "lg",
413
- border: "none"
414
- },
415
- children
416
- });
417
- };
418
- var Placeholder = ({
419
- children
420
- }) => {
421
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui3.Text, {
422
- sx: {
423
- color: "onMuted",
424
- alignSelf: "center"
425
- },
426
- children
427
- });
428
- };
429
- var SelectContainer = ({
430
- children,
431
- ...props
432
- }) => {
433
- const {
434
- sx,
435
- css: css2
436
- } = props.selectProps;
437
- return (
438
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
439
- /* @__PURE__ */
440
- (0, import_jsx_runtime7.jsx)(import_theme_ui5.Box, {
441
- sx,
442
- css: css2,
443
- children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_select.components.SelectContainer, {
444
- ...props,
445
- children
446
- })
447
- })
448
- );
449
- };
450
- var ValueContainer = ({
451
- children,
452
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
453
- ...props
454
- }) => {
455
- const {
456
- leadingIcon,
457
- trailingIcon,
458
- isSearchable
459
- } = props.selectProps;
460
- const hasError = props.selectProps["aria-invalid"] === "true";
461
- const trailingIconColor = (() => {
462
- if (hasError) {
463
- return "danger";
464
- }
465
- return "text";
466
- })();
467
- const finalLeadingIcon = (() => {
468
- if (!isSearchable) {
469
- return leadingIcon;
470
- }
471
- return leadingIcon || "search";
472
- })();
473
- return /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_theme_ui9.Flex, {
474
- sx: {
475
- gap: "lg",
476
- flex: 1
477
- },
478
- children: [finalLeadingIcon && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui3.Text, {
479
- sx: {
480
- alignSelf: "center",
481
- pointerEvents: "none",
482
- lineHeight: 0,
483
- fontSize: "base"
484
- },
485
- children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_icons5.Icon, {
486
- icon: finalLeadingIcon
487
- })
488
- }), /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui9.Flex, {
489
- sx: {
490
- flex: 1,
491
- alignItems: "center"
492
- },
493
- children
494
- }), (trailingIcon || hasError) && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui3.Text, {
495
- className: hasError ? "error-icon" : "",
496
- sx: {
497
- alignSelf: "center",
498
- pointerEvents: "none",
499
- lineHeight: 0,
500
- fontSize: "base",
501
- color: trailingIconColor
502
- },
503
- children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_icons5.Icon, {
504
- icon: hasError ? "warning-alt" : trailingIcon
505
- })
506
- })]
507
- });
508
- };
509
- var Select = React4.forwardRef(({
510
- ...props
511
- }, ref) => {
512
- const value = props.options?.find(option => {
513
- if ("value" in option) {
514
- return option.value === props.value;
515
- }
516
- return false;
517
- });
518
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_react_select.default, {
519
- ref,
520
- components: {
521
- Control,
522
- DropdownIndicator,
523
- IndicatorsContainer,
524
- Placeholder,
525
- SelectContainer,
526
- ValueContainer
527
- },
528
- isDisabled: props.disabled,
529
- ...props,
530
- value,
531
- onChange: value2 => {
532
- props.onChange?.(value2?.value);
533
- },
534
- styles: {
535
- input: baseStyles => {
536
- return {
537
- ...baseStyles,
538
- position: "absolute"
539
- };
540
- }
541
- },
542
- classNamePrefix: "react-select"
543
- });
544
- });
545
- Select.displayName = "Select";
546
-
547
- // src/components/Spinner.tsx
548
- var import_theme_ui17 = require("theme-ui");
549
-
550
- // src/components/Radio.tsx
551
- var import_theme_ui18 = require("theme-ui");
552
-
553
- // src/components/IconButton.tsx
554
- var React5 = __toESM(require("react"));
555
- var import_theme_ui19 = require("theme-ui");
556
- var import_jsx_runtime8 = require("react/jsx-runtime");
557
- var IconButton = React5.forwardRef((props, ref) => {
558
- return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui19.IconButton, {
559
- type: "button",
560
- ...props,
561
- ref
562
- });
563
- });
564
- IconButton.displayName = "IconButton";
565
-
566
- // src/components/Slider.tsx
567
- var import_theme_ui20 = require("theme-ui");
568
-
569
- // src/components/Checkbox.tsx
570
- var React6 = __toESM(require("react"));
571
- var import_theme_ui21 = require("theme-ui");
572
- var import_jsx_runtime9 = require("react/jsx-runtime");
573
- var Checkbox = React6.forwardRef(({
574
- indeterminate = false,
575
- ...rest
576
- }, ref) => {
577
- const innerRef = React6.useRef(null);
578
- React6.useImperativeHandle(ref, () => {
579
- return innerRef.current;
580
- });
581
- React6.useEffect(() => {
582
- if (innerRef.current) {
583
- innerRef.current.indeterminate = indeterminate;
584
- }
585
- }, [indeterminate]);
586
- if (indeterminate) {
587
- return /* @__PURE__ */(0, import_jsx_runtime9.jsx)("input", {
588
- type: "checkbox",
589
- ref: innerRef,
590
- ...rest
591
- });
592
- }
593
- return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_theme_ui21.Checkbox, {
594
- ref: innerRef,
595
- ...rest
596
- });
597
- });
598
- Checkbox.displayName = "Checkbox";
599
-
600
- // src/components/InfiniteLinearProgress.tsx
601
- var React7 = __toESM(require("react"));
602
- var import_jsx_runtime10 = require("react/jsx-runtime");
603
- var MAX_PROGRESS = 100;
604
- var InfiniteLinearProgress = () => {
605
- const [progress, setProgress] = React7.useState(0);
606
- React7.useEffect(() => {
607
- const timer = setInterval(() => {
608
- setProgress(oldProgress => {
609
- if (oldProgress === MAX_PROGRESS) {
610
- return 0;
611
- }
612
- let diff = 0;
613
- if (oldProgress > 0.97 * MAX_PROGRESS) {
614
- diff -= 0.75 * MAX_PROGRESS;
615
- } else if (oldProgress > 0.6 * MAX_PROGRESS) {
616
- diff = Math.random() * (MAX_PROGRESS - oldProgress) * 0.1;
617
- } else {
618
- diff = Math.random() * (MAX_PROGRESS * 0.02);
619
- }
620
- return Math.min(oldProgress + diff, MAX_PROGRESS);
621
- });
622
- }, 100);
623
- return () => {
624
- clearInterval(timer);
625
- };
626
- }, []);
627
- return /* @__PURE__ */(0, import_jsx_runtime10.jsx)(import_theme_ui16.Progress, {
628
- max: MAX_PROGRESS,
629
- value: progress,
630
- role: "progressbar"
631
- });
632
- };
633
-
634
- // src/components/Textarea.tsx
635
- var React8 = __toESM(require("react"));
636
- var import_react_icons6 = require("@ttoss/react-icons");
637
- var import_theme_ui22 = require("theme-ui");
638
- var import_jsx_runtime11 = require("react/jsx-runtime");
639
- var Textarea = React8.forwardRef(({
640
- trailingIcon,
641
- className,
642
- sx,
643
- ...textareaProps
644
- }, ref) => {
645
- return /* @__PURE__ */(0, import_jsx_runtime11.jsxs)(import_theme_ui9.Flex, {
646
- className,
647
- sx: {
648
- ...sx,
649
- position: "relative",
650
- padding: 0,
651
- border: "none"
652
- },
653
- children: [/* @__PURE__ */(0, import_jsx_runtime11.jsx)(import_theme_ui22.Textarea, {
654
- ref,
655
- sx: {
656
- fontFamily: "body",
657
- paddingY: "lg",
658
- paddingX: "xl",
659
- ...sx,
660
- paddingRight: trailingIcon ? "3xl" : void 0,
661
- margin: 0
662
- },
663
- className,
664
- ...textareaProps
665
- }), trailingIcon && /* @__PURE__ */(0, import_jsx_runtime11.jsx)(import_theme_ui3.Text, {
666
- sx: {
667
- position: "absolute",
668
- right: "1.25rem",
669
- top: "0.75rem"
670
- },
671
- children: /* @__PURE__ */(0, import_jsx_runtime11.jsx)(import_react_icons6.Icon, {
672
- inline: true,
673
- icon: trailingIcon
674
- })
675
- })]
676
- });
677
- });
678
- Textarea.displayName = "Textarea";
679
-
680
- // src/components/Container.tsx
681
- var React9 = __toESM(require("react"));
682
- var import_theme_ui23 = require("theme-ui");
683
- var import_jsx_runtime12 = require("react/jsx-runtime");
684
- var Container = React9.forwardRef((props, ref) => {
685
- return /* @__PURE__ */(0, import_jsx_runtime12.jsx)(import_theme_ui23.Container, {
686
- ref,
687
- ...props
688
- });
689
- });
690
- Container.displayName = "Container";
691
-
692
- // src/components/HelpText.tsx
693
- var import_jsx_runtime13 = require("react/jsx-runtime");
694
- var HelpText = ({
695
- sx,
696
- disabled,
697
- negative,
698
- ...props
699
- }) => {
700
- const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
701
- return /* @__PURE__ */(0, import_jsx_runtime13.jsx)(import_theme_ui3.Text, {
702
- variant,
703
- sx: {
704
- fontSize: "sm",
705
- fontFamily: "caption",
706
- lineHeight: "base",
707
- ...sx
708
- },
709
- "aria-disabled": disabled ? "true" : void 0,
710
- ...props
711
- });
712
- };
713
-
714
- // src/components/CloseButton.tsx
715
- var React10 = __toESM(require("react"));
716
- var import_react_icons7 = require("@ttoss/react-icons");
717
- var import_jsx_runtime14 = require("react/jsx-runtime");
718
- var CloseButton = React10.forwardRef(({
719
- label,
720
- sx,
721
- onlyText,
722
- ...props
723
- }, ref) => {
724
- if (onlyText && !label) {
725
- return null;
726
- }
727
- return /* @__PURE__ */(0, import_jsx_runtime14.jsxs)(Button, {
728
- variant: "buttons.closeButton",
729
- type: "button",
730
- "aria-label": label,
731
- sx: {
732
- fontFamily: "caption",
733
- fontSize: "xs",
734
- display: "inline-flex",
735
- alignItems: "center",
736
- cursor: "pointer",
737
- lineHeight: "normal",
738
- gap: "sm",
739
- padding: "sm",
740
- width: "fit-content",
741
- transition: "all 0.2s",
742
- "& > iconify-icon": {
743
- fontSize: "base"
744
- },
745
- ...sx
746
- },
747
- ...props,
748
- ref,
749
- children: [label, !onlyText && /* @__PURE__ */(0, import_jsx_runtime14.jsx)(import_react_icons7.Icon, {
750
- icon: "close"
751
- })]
752
- });
753
- });
754
- CloseButton.displayName = "CloseButton";
755
-
756
- // src/components/InputNumber.tsx
757
- var React11 = __toESM(require("react"));
758
- var import_react_icons8 = require("@ttoss/react-icons");
759
- var import_theme_ui24 = require("theme-ui");
760
- var import_jsx_runtime15 = require("react/jsx-runtime");
761
- var InputNumber = React11.forwardRef(({
762
- sx,
763
- value,
764
- infoIcon,
765
- onChange,
766
- onClickInfoIcon,
767
- ...inputProps
768
- }, ref) => {
769
- const sxProps = React11.useMemo(() => {
770
- const size = String(typeof value === "undefined" ? 0 : value).length;
771
- if (inputProps["aria-invalid"] === "true") {
772
- return {
773
- width: `calc(139px + ${size > 1 ? size * 10 : 0}px)`,
774
- textAlign: "left",
775
- "&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button": {
776
- WebkitAppearance: "none",
777
- margin: 0
778
- },
779
- ...sx,
780
- paddingLeft: "3xl",
781
- paddingRight: "2xl",
782
- margin: 0
783
- };
784
- }
785
- return {
786
- width: `calc(108px + ${size > 1 ? size * 10 : 0}px)`,
787
- textAlign: "center",
788
- "&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button": {
789
- WebkitAppearance: "none",
790
- margin: 0
791
- },
792
- fontFamily: "body",
793
- paddingY: "lg",
794
- paddingX: "xl",
795
- ...sx,
796
- paddingLeft: "2xl",
797
- paddingRight: "2xl",
798
- margin: 0
799
- };
800
- }, [inputProps, value, sx]);
801
- const handleChangeUp = () => {
802
- if (inputProps.disabled) {
803
- return;
804
- }
805
- if (typeof value !== "number") {
806
- onChange(-1);
807
- return;
808
- }
809
- onChange(value - 1);
810
- };
811
- const handleChangeDown = () => {
812
- if (inputProps.disabled) {
813
- return;
814
- }
815
- if (typeof value !== "number") {
816
- onChange(1);
817
- return;
818
- }
819
- onChange(value + 1);
820
- };
821
- return /* @__PURE__ */(0, import_jsx_runtime15.jsxs)(import_theme_ui9.Flex, {
822
- sx: {
823
- width: "fit-content",
824
- ...sx,
825
- position: "relative",
826
- padding: 0,
827
- border: "none"
828
- },
829
- ref,
830
- "aria-invalid": inputProps["aria-invalid"],
831
- children: [/* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_theme_ui24.Input, {
832
- ref,
833
- variant: "forms.inputNumber",
834
- sx: sxProps,
835
- type: "number",
836
- onChange: e => {
837
- onChange(Number(e.target.value));
838
- },
839
- value,
840
- ...inputProps
841
- }), /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_theme_ui3.Text, {
842
- sx: {
843
- position: "absolute",
844
- alignSelf: "center",
845
- left: "1rem",
846
- zIndex: 1,
847
- cursor: "pointer"
848
- },
849
- onClick: handleChangeUp,
850
- children: /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_react_icons8.Icon, {
851
- icon: "picker-down"
852
- })
853
- }), infoIcon && /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_theme_ui3.Text, {
854
- sx: {
855
- position: "absolute",
856
- alignSelf: "center",
857
- right: "2.5rem",
858
- zIndex: 1,
859
- cursor: onClickInfoIcon ? "pointer" : "default"
860
- },
861
- onClick: onClickInfoIcon,
862
- children: /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_react_icons8.Icon, {
863
- icon: "info"
864
- })
865
- }), /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_theme_ui3.Text, {
866
- sx: {
867
- position: "absolute",
868
- alignSelf: "center",
869
- right: "1rem",
870
- zIndex: 1,
871
- cursor: "pointer"
872
- },
873
- onClick: handleChangeDown,
874
- children: /* @__PURE__ */(0, import_jsx_runtime15.jsx)(import_react_icons8.Icon, {
875
- icon: "picker-up"
876
- })
877
- })]
878
- });
879
- });
880
- InputNumber.displayName = "InputNumber";
881
-
882
- // src/components/Stack.tsx
883
- var React12 = __toESM(require("react"));
884
- var import_jsx_runtime16 = require("react/jsx-runtime");
885
- var Stack = React12.forwardRef((props, ref) => {
886
- return /* @__PURE__ */(0, import_jsx_runtime16.jsx)(import_theme_ui9.Flex, {
887
- ref,
888
- ...props,
889
- sx: {
890
- flexDirection: "column",
891
- ...props.sx
892
- }
893
- });
894
- });
895
- Stack.displayName = "Stack";
896
-
897
- // src/components/Paragraph.tsx
898
- var import_theme_ui25 = require("theme-ui");
899
-
900
- // src/components/InputPassword/InputPassword.tsx
901
- var React14 = __toESM(require("react"));
902
-
903
- // src/components/InputPassword/useHidePassInput.ts
904
- var React13 = __toESM(require("react"));
905
- var useHidePassInput = (defaultValue = true) => {
906
- const [hidePass, setHidePass] = React13.useState(Boolean(defaultValue));
907
- const {
908
- icon,
909
- inputType
910
- } = React13.useMemo(() => {
911
- return {
912
- icon: hidePass ? "view-off" : "view-on",
913
- inputType: hidePass ? "password" : "text"
914
- };
915
- }, [hidePass]);
916
- const handleClick = () => {
917
- setHidePass(prev => {
918
- return !prev;
919
- });
920
- };
921
- return {
922
- handleClick,
923
- icon,
924
- inputType
925
- };
926
- };
927
-
928
- // src/components/InputPassword/InputPassword.tsx
929
- var import_jsx_runtime17 = require("react/jsx-runtime");
930
- var InputPassword = React14.forwardRef(({
931
- showPasswordByDefault,
932
- ...inputPasswordProps
933
- }, ref) => {
934
- const {
935
- handleClick,
936
- icon,
937
- inputType
938
- } = useHidePassInput(!showPasswordByDefault);
939
- return /* @__PURE__ */(0, import_jsx_runtime17.jsx)(Input, {
940
- ref,
941
- ...inputPasswordProps,
942
- trailingIcon: icon,
943
- onTrailingIconClick: handleClick,
944
- type: inputType
945
- });
946
- });
947
- InputPassword.displayName = "InputPassword";
948
-
949
- // src/components/ActionButton.tsx
950
- var import_jsx_runtime18 = require("react/jsx-runtime");
951
- var ActionButton = ({
952
- icon,
953
- variant = "default",
954
- sx,
955
- ...props
956
- }) => {
957
- return /* @__PURE__ */(0, import_jsx_runtime18.jsx)(Button, {
958
- variant: `buttons.actionButton.${variant}`,
959
- leftIcon: icon,
960
- sx: {
961
- padding: "sm",
962
- gap: "xs",
963
- fontFamily: "caption",
964
- borderRadius: "action",
965
- outlineColor: "transparent",
966
- ":disabled": props.disabled ? {
967
- backgroundColor: "muted",
968
- color: "onMuted",
969
- cursor: "not-allowed",
970
- border: "muted",
971
- borderColor: "onMuted"
972
- } : void 0,
973
- ...sx
974
- },
975
- ...props
976
- });
977
- };
978
- // Annotate the CommonJS export names for ESM import in node:
979
- 0 && (module.exports = {
980
- ActionButton,
981
- Badge,
982
- BaseStyles,
983
- Box,
984
- Button,
985
- Card,
986
- Checkbox,
987
- CloseButton,
988
- Container,
989
- Divider,
990
- Flex,
991
- Global,
992
- Grid,
993
- Heading,
994
- HelpText,
995
- IconButton,
996
- Image,
997
- InfiniteLinearProgress,
998
- Input,
999
- InputNumber,
1000
- InputPassword,
1001
- Label,
1002
- LinearProgress,
1003
- Link,
1004
- Paragraph,
1005
- Radio,
1006
- Select,
1007
- Slider,
1008
- Spinner,
1009
- Stack,
1010
- Text,
1011
- Textarea,
1012
- ThemeProvider,
1013
- keyframes,
1014
- useBreakpointIndex,
1015
- useResponsiveValue,
1016
- useTheme
1017
- });