@ttoss/ui 1.31.12 → 1.31.14

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/dist/esm/index.js CHANGED
@@ -185,7 +185,30 @@ var Input = /*#__PURE__*/React4.forwardRef(({
185
185
  Input.displayName = "Input";
186
186
 
187
187
  // src/components/Label.tsx
188
- import { Label } from "theme-ui";
188
+ import { Label as LabelUi } from "theme-ui";
189
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
190
+ var TOOLTIP_LABEL = "tooltip";
191
+ var Label = ({
192
+ children,
193
+ onTooltipClick,
194
+ tooltip,
195
+ ...props
196
+ }) => {
197
+ return /* @__PURE__ */jsxs5(LabelUi, {
198
+ ...props,
199
+ children: [children, tooltip && /* @__PURE__ */jsx6(Text, {
200
+ sx: {
201
+ color: "currentcolor"
202
+ },
203
+ onClick: onTooltipClick,
204
+ "aria-label": TOOLTIP_LABEL,
205
+ children: /* @__PURE__ */jsx6(Icon, {
206
+ inline: true,
207
+ icon: "info"
208
+ })
209
+ })]
210
+ });
211
+ };
189
212
 
190
213
  // src/components/Link.tsx
191
214
  import { Link } from "theme-ui";
@@ -197,7 +220,51 @@ import { Progress } from "theme-ui";
197
220
  import { Text } from "theme-ui";
198
221
 
199
222
  // src/components/Select.tsx
200
- import { Select } from "theme-ui";
223
+ import { Select as SelectUi } from "theme-ui";
224
+ import React5 from "react";
225
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
226
+ var Select = /*#__PURE__*/React5.forwardRef(({
227
+ arrow,
228
+ ...props
229
+ }, ref) => {
230
+ return /* @__PURE__ */jsx7(SelectUi, {
231
+ arrow: /* @__PURE__ */jsxs6(Fragment2, {
232
+ children: [arrow ?? /* @__PURE__ */jsx7(Text, {
233
+ sx: {
234
+ marginLeft: ({
235
+ space
236
+ }) => {
237
+ return space?.["2xl"] ? "-2xl" : "-28px";
238
+ },
239
+ alignSelf: "center",
240
+ pointerEvents: "none",
241
+ lineHeight: 0
242
+ },
243
+ children: /* @__PURE__ */jsx7(Icon, {
244
+ icon: "picker-down"
245
+ })
246
+ }), props["aria-invalid"] === "true" && /* @__PURE__ */jsx7(Text, {
247
+ className: "error-icon",
248
+ sx: {
249
+ marginLeft: ({
250
+ space
251
+ }) => {
252
+ return space?.["2xl"] ? `calc(-${space["2xl"]} - 10px)` : "-44px";
253
+ },
254
+ alignSelf: "center",
255
+ pointerEvents: "none",
256
+ lineHeight: 0
257
+ },
258
+ children: /* @__PURE__ */jsx7(Icon, {
259
+ icon: "error"
260
+ })
261
+ })]
262
+ }),
263
+ ref,
264
+ ...props
265
+ });
266
+ });
267
+ Select.displayName = "Select";
201
268
 
202
269
  // src/components/Spinner.tsx
203
270
  import { Spinner } from "theme-ui";
@@ -215,12 +282,12 @@ import { Slider } from "theme-ui";
215
282
  import { Checkbox } from "theme-ui";
216
283
 
217
284
  // src/components/InfiniteLinearProgress.tsx
218
- import * as React5 from "react";
219
- import { jsx as jsx6 } from "react/jsx-runtime";
285
+ import * as React6 from "react";
286
+ import { jsx as jsx8 } from "react/jsx-runtime";
220
287
  var MAX_PROGRESS = 100;
221
288
  var InfiniteLinearProgress = () => {
222
- const [progress, setProgress] = React5.useState(0);
223
- React5.useEffect(() => {
289
+ const [progress, setProgress] = React6.useState(0);
290
+ React6.useEffect(() => {
224
291
  const timer = setInterval(() => {
225
292
  setProgress(oldProgress => {
226
293
  if (oldProgress === MAX_PROGRESS) {
@@ -241,7 +308,7 @@ var InfiniteLinearProgress = () => {
241
308
  clearInterval(timer);
242
309
  };
243
310
  }, []);
244
- return /* @__PURE__ */jsx6(Progress, {
311
+ return /* @__PURE__ */jsx8(Progress, {
245
312
  max: MAX_PROGRESS,
246
313
  value: progress,
247
314
  role: "progressbar"
@@ -255,14 +322,14 @@ import { Textarea } from "theme-ui";
255
322
  import { Container } from "theme-ui";
256
323
 
257
324
  // src/components/HelpText.tsx
258
- import { jsx as jsx7 } from "react/jsx-runtime";
325
+ import { jsx as jsx9 } from "react/jsx-runtime";
259
326
  var HelpText = ({
260
327
  disabled,
261
328
  negative,
262
329
  ...props
263
330
  }) => {
264
331
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
265
- return /* @__PURE__ */jsx7(Text, {
332
+ return /* @__PURE__ */jsx9(Text, {
266
333
  variant,
267
334
  "aria-disabled": disabled ? "true" : void 0,
268
335
  ...props
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as theme_ui from 'theme-ui';
2
- import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, TextProps } from 'theme-ui';
3
- export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButton, IconButtonProps, Image, ImageProps, Label, LabelProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, Select, SelectProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Textarea, TextareaProps, Theme } from 'theme-ui';
2
+ import { Theme, BadgeProps as BadgeProps$1, ButtonProps as ButtonProps$1, InputProps as InputProps$1, LabelProps as LabelProps$1, SelectProps as SelectProps$1, TextProps } from 'theme-ui';
3
+ export { BaseStyles, Box, BoxProps, Card, CardProps, Checkbox, CheckboxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridProps, Heading, HeadingProps, IconButton, IconButtonProps, Image, ImageProps, Progress as LinearProgress, ProgressProps as LinearProgressProps, Link, LinkProps, Radio, RadioProps, Slider, SliderProps, Spinner, SpinnerProps, Text, TextProps, Textarea, TextareaProps, Theme } from 'theme-ui';
4
4
  export { useBreakpointIndex, useResponsiveValue } from '@theme-ui/match-media';
5
5
  import * as React from 'react';
6
6
  import React__default from 'react';
@@ -40,6 +40,15 @@ type InputProps = InputProps$1 & {
40
40
  };
41
41
  declare const Input: React__default.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React__default.RefAttributes<HTMLInputElement>>;
42
42
 
43
+ type LabelProps = LabelProps$1 & {
44
+ tooltip?: boolean;
45
+ onTooltipClick?: () => void;
46
+ };
47
+ declare const Label: ({ children, onTooltipClick, tooltip, ...props }: LabelProps) => JSX.Element;
48
+
49
+ type SelectProps = SelectProps$1;
50
+ declare const Select: React__default.ForwardRefExoticComponent<Omit<SelectProps$1, "ref"> & React__default.RefAttributes<HTMLSelectElement>>;
51
+
43
52
  declare const InfiniteLinearProgress: () => JSX.Element;
44
53
 
45
54
  type HelpTextProps = Omit<TextProps, 'variant'> & {
@@ -48,4 +57,4 @@ type HelpTextProps = Omit<TextProps, 'variant'> & {
48
57
  };
49
58
  declare const HelpText: ({ disabled, negative, ...props }: HelpTextProps) => JSX.Element;
50
59
 
51
- export { Badge, BadgeProps, Button, ButtonProps, HelpText, HelpTextProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, ThemeProvider, ThemeProviderProps, useTheme };
60
+ export { Badge, BadgeProps, Button, ButtonProps, HelpText, HelpTextProps, Icon, IconProps, IconType, InfiniteLinearProgress, Input, InputProps, Label, LabelProps, Select, SelectProps, ThemeProvider, ThemeProviderProps, useTheme };
package/dist/index.js CHANGED
@@ -55,11 +55,11 @@ __export(src_exports, {
55
55
  Image: () => import_theme_ui11.Image,
56
56
  InfiniteLinearProgress: () => InfiniteLinearProgress,
57
57
  Input: () => Input,
58
- Label: () => import_theme_ui13.Label,
58
+ Label: () => Label,
59
59
  LinearProgress: () => import_theme_ui15.Progress,
60
60
  Link: () => import_theme_ui14.Link,
61
61
  Radio: () => import_theme_ui19.Radio,
62
- Select: () => import_theme_ui17.Select,
62
+ Select: () => Select,
63
63
  Slider: () => import_theme_ui21.Slider,
64
64
  Spinner: () => import_theme_ui18.Spinner,
65
65
  Text: () => import_theme_ui16.Text,
@@ -255,6 +255,29 @@ Input.displayName = "Input";
255
255
 
256
256
  // src/components/Label.tsx
257
257
  var import_theme_ui13 = require("theme-ui");
258
+ var import_jsx_runtime6 = require("react/jsx-runtime");
259
+ var TOOLTIP_LABEL = "tooltip";
260
+ var Label = ({
261
+ children,
262
+ onTooltipClick,
263
+ tooltip,
264
+ ...props
265
+ }) => {
266
+ return /* @__PURE__ */(0, import_jsx_runtime6.jsxs)(import_theme_ui13.Label, {
267
+ ...props,
268
+ children: [children, tooltip && /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui16.Text, {
269
+ sx: {
270
+ color: "currentcolor"
271
+ },
272
+ onClick: onTooltipClick,
273
+ "aria-label": TOOLTIP_LABEL,
274
+ children: /* @__PURE__ */(0, import_jsx_runtime6.jsx)(Icon, {
275
+ inline: true,
276
+ icon: "info"
277
+ })
278
+ })]
279
+ });
280
+ };
258
281
 
259
282
  // src/components/Link.tsx
260
283
  var import_theme_ui14 = require("theme-ui");
@@ -267,6 +290,50 @@ var import_theme_ui16 = require("theme-ui");
267
290
 
268
291
  // src/components/Select.tsx
269
292
  var import_theme_ui17 = require("theme-ui");
293
+ var import_react4 = __toESM(require("react"));
294
+ var import_jsx_runtime7 = require("react/jsx-runtime");
295
+ var Select = import_react4.default.forwardRef(({
296
+ arrow,
297
+ ...props
298
+ }, ref) => {
299
+ return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui17.Select, {
300
+ arrow: /* @__PURE__ */(0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, {
301
+ children: [arrow ?? /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
302
+ sx: {
303
+ marginLeft: ({
304
+ space
305
+ }) => {
306
+ return space?.["2xl"] ? "-2xl" : "-28px";
307
+ },
308
+ alignSelf: "center",
309
+ pointerEvents: "none",
310
+ lineHeight: 0
311
+ },
312
+ children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(Icon, {
313
+ icon: "picker-down"
314
+ })
315
+ }), props["aria-invalid"] === "true" && /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
316
+ className: "error-icon",
317
+ sx: {
318
+ marginLeft: ({
319
+ space
320
+ }) => {
321
+ return space?.["2xl"] ? `calc(-${space["2xl"]} - 10px)` : "-44px";
322
+ },
323
+ alignSelf: "center",
324
+ pointerEvents: "none",
325
+ lineHeight: 0
326
+ },
327
+ children: /* @__PURE__ */(0, import_jsx_runtime7.jsx)(Icon, {
328
+ icon: "error"
329
+ })
330
+ })]
331
+ }),
332
+ ref,
333
+ ...props
334
+ });
335
+ });
336
+ Select.displayName = "Select";
270
337
 
271
338
  // src/components/Spinner.tsx
272
339
  var import_theme_ui18 = require("theme-ui");
@@ -284,12 +351,12 @@ var import_theme_ui21 = require("theme-ui");
284
351
  var import_theme_ui22 = require("theme-ui");
285
352
 
286
353
  // src/components/InfiniteLinearProgress.tsx
287
- var React5 = __toESM(require("react"));
288
- var import_jsx_runtime6 = require("react/jsx-runtime");
354
+ var React6 = __toESM(require("react"));
355
+ var import_jsx_runtime8 = require("react/jsx-runtime");
289
356
  var MAX_PROGRESS = 100;
290
357
  var InfiniteLinearProgress = () => {
291
- const [progress, setProgress] = React5.useState(0);
292
- React5.useEffect(() => {
358
+ const [progress, setProgress] = React6.useState(0);
359
+ React6.useEffect(() => {
293
360
  const timer = setInterval(() => {
294
361
  setProgress(oldProgress => {
295
362
  if (oldProgress === MAX_PROGRESS) {
@@ -310,7 +377,7 @@ var InfiniteLinearProgress = () => {
310
377
  clearInterval(timer);
311
378
  };
312
379
  }, []);
313
- return /* @__PURE__ */(0, import_jsx_runtime6.jsx)(import_theme_ui15.Progress, {
380
+ return /* @__PURE__ */(0, import_jsx_runtime8.jsx)(import_theme_ui15.Progress, {
314
381
  max: MAX_PROGRESS,
315
382
  value: progress,
316
383
  role: "progressbar"
@@ -324,14 +391,14 @@ var import_theme_ui23 = require("theme-ui");
324
391
  var import_theme_ui24 = require("theme-ui");
325
392
 
326
393
  // src/components/HelpText.tsx
327
- var import_jsx_runtime7 = require("react/jsx-runtime");
394
+ var import_jsx_runtime9 = require("react/jsx-runtime");
328
395
  var HelpText = ({
329
396
  disabled,
330
397
  negative,
331
398
  ...props
332
399
  }) => {
333
400
  const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
334
- return /* @__PURE__ */(0, import_jsx_runtime7.jsx)(import_theme_ui16.Text, {
401
+ return /* @__PURE__ */(0, import_jsx_runtime9.jsx)(import_theme_ui16.Text, {
335
402
  variant,
336
403
  "aria-disabled": disabled ? "true" : void 0,
337
404
  ...props
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/ui",
3
- "version": "1.31.12",
3
+ "version": "1.31.14",
4
4
  "description": "Primitive layout, typographic, and other components for styling applications.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ttoss",
@@ -24,7 +24,7 @@
24
24
  "@emotion/react": "^11.10.6",
25
25
  "@iconify-icon/react": "^1.0.7",
26
26
  "@theme-ui/match-media": "^0.15.5",
27
- "@ttoss/theme": "^1.4.11",
27
+ "@ttoss/theme": "^1.4.13",
28
28
  "theme-ui": "^0.15.5"
29
29
  },
30
30
  "peerDependencies": {
@@ -46,5 +46,5 @@
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "6f711c5bb31c7b7b347477910cc0da1fe165509e"
49
+ "gitHead": "8572bc7e98343a9780146a604b0d2f04ca4388e6"
50
50
  }
@@ -1 +1,32 @@
1
- export { Label, type LabelProps } from 'theme-ui';
1
+ import { Icon, Text } from '..';
2
+ import { type LabelProps as LabelPropsUi, Label as LabelUi } from 'theme-ui';
3
+
4
+ const TOOLTIP_LABEL = 'tooltip';
5
+
6
+ export type LabelProps = LabelPropsUi & {
7
+ tooltip?: boolean;
8
+ onTooltipClick?: () => void;
9
+ };
10
+
11
+ export const Label = ({
12
+ children,
13
+ onTooltipClick,
14
+ tooltip,
15
+ ...props
16
+ }: LabelProps) => {
17
+ return (
18
+ <LabelUi {...props}>
19
+ {children}
20
+
21
+ {tooltip && (
22
+ <Text
23
+ sx={{ color: 'currentcolor' }}
24
+ onClick={onTooltipClick}
25
+ aria-label={TOOLTIP_LABEL}
26
+ >
27
+ <Icon inline icon="info" />
28
+ </Text>
29
+ )}
30
+ </LabelUi>
31
+ );
32
+ };
@@ -1 +1,57 @@
1
- export { Select, type SelectProps } from 'theme-ui';
1
+ import { Icon, Text } from '..';
2
+ import {
3
+ type SelectProps as SelectPropsUi,
4
+ Select as SelectUi,
5
+ } from 'theme-ui';
6
+ import React from 'react';
7
+
8
+ export type SelectProps = SelectPropsUi;
9
+
10
+ export const Select = React.forwardRef<HTMLSelectElement, SelectProps>(
11
+ ({ arrow, ...props }, ref) => {
12
+ return (
13
+ <SelectUi
14
+ // https://theme-ui.com/components/select#custom-arrow-icon
15
+ arrow={
16
+ <>
17
+ {arrow ?? (
18
+ <Text
19
+ sx={{
20
+ marginLeft: ({ space }: any) => {
21
+ return space?.['2xl'] ? '-2xl' : '-28px';
22
+ },
23
+ alignSelf: 'center',
24
+ pointerEvents: 'none',
25
+ lineHeight: 0,
26
+ }}
27
+ >
28
+ <Icon icon="picker-down" />
29
+ </Text>
30
+ )}
31
+
32
+ {props['aria-invalid'] === 'true' && (
33
+ <Text
34
+ className="error-icon"
35
+ sx={{
36
+ marginLeft: ({ space }: any) => {
37
+ return space?.['2xl']
38
+ ? `calc(-${space['2xl']} - 10px)`
39
+ : '-44px';
40
+ },
41
+ alignSelf: 'center',
42
+ pointerEvents: 'none',
43
+ lineHeight: 0,
44
+ }}
45
+ >
46
+ <Icon icon="error" />
47
+ </Text>
48
+ )}
49
+ </>
50
+ }
51
+ ref={ref}
52
+ {...props}
53
+ />
54
+ );
55
+ }
56
+ );
57
+ Select.displayName = 'Select';