@cfx-dev/ui-components 2.1.4 → 2.1.5

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.
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { IconName } from '../Icon';
3
3
 
4
- export type ButtonTheme = 'primary' | 'secondary' | 'on-light' | 'default' | 'quicklink';
4
+ export type ButtonTheme = 'primary' | 'secondary' | 'on-light' | 'default' | 'linked' | 'quicklink';
5
5
  export interface ButtonProps<T = HTMLButtonElement> {
6
6
  text?: React.ReactNode;
7
7
  title?: string;
@@ -1,107 +1,108 @@
1
1
  import { jsx as r, jsxs as W, Fragment as g } from "react/jsx-runtime";
2
2
  import m from "react";
3
3
  import { Icon as B } from "../Icon/Icon.js";
4
- import { clsx as I } from "../../utils/clsx.js";
5
- import { noop as q } from "../../utils/functional.js";
6
- import '../../assets/Button.css';const M = "_root_1qqs9_1", j = "_fullWidth_1qqs9_35", w = "_primary_1qqs9_55", F = "_secondary_1qqs9_76", R = "_quicklink_1qqs9_118", v = "_icon_1qqs9_125", D = "_icononly_1qqs9_150", L = "_decorator_1qqs9_155", o = {
7
- root: M,
8
- fullWidth: j,
9
- primary: w,
4
+ import { clsx as q } from "../../utils/clsx.js";
5
+ import { noop as h } from "../../utils/functional.js";
6
+ import '../../assets/Button.css';const I = "_root_1hwl6_1", M = "_fullWidth_1hwl6_35", j = "_primary_1hwl6_55", F = "_secondary_1hwl6_76", R = "_linked_1hwl6_118", v = "_quicklink_1hwl6_143", D = "_icon_1hwl6_150", L = "_icononly_1hwl6_175", U = "_decorator_1hwl6_180", o = {
7
+ root: I,
8
+ fullWidth: M,
9
+ primary: j,
10
10
  secondary: F,
11
- "on-light": "_on-light_1qqs9_97",
12
- quicklink: R,
13
- icon: v,
14
- icononly: D,
15
- decorator: L
11
+ "on-light": "_on-light_1hwl6_97",
12
+ linked: R,
13
+ quicklink: v,
14
+ icon: D,
15
+ icononly: L,
16
+ decorator: U
16
17
  };
17
- function U(s) {
18
+ function z(c) {
18
19
  const {
19
20
  text: t = null,
20
- icon: e,
21
+ icon: l,
21
22
  decorator: n = null
22
- } = s;
23
+ } = c;
23
24
  return /* @__PURE__ */ W(g, { children: [
24
25
  t,
25
- !!e && /* @__PURE__ */ r(B, { name: e, className: o.icon }),
26
+ !!l && /* @__PURE__ */ r(B, { name: l, className: o.icon }),
26
27
  !!n && /* @__PURE__ */ r("div", { className: o.decorator, children: n })
27
28
  ] });
28
29
  }
29
- function z(s) {
30
+ function A(c) {
30
31
  const {
31
32
  text: t = null,
32
- icon: e,
33
+ icon: l,
33
34
  theme: n = "default",
34
- disabled: c = !1,
35
+ disabled: a = !1,
35
36
  className: u = "",
36
37
  autofocus: d = !1,
37
- fullWidth: a = !1,
38
- tabIndex: i
39
- } = s;
40
- return I(o.root, o[n], u, {
41
- [o.disabled]: c,
42
- [o.icononly]: !!e && (t === null || typeof t > "u"),
38
+ fullWidth: i = !1,
39
+ tabIndex: s
40
+ } = c;
41
+ return q(o.root, o[n], u, {
42
+ [o.disabled]: a,
43
+ [o.icononly]: !!l && (t === null || typeof t > "u"),
43
44
  [o.text]: !!t,
44
- [o.autofocus]: d || typeof i < "u",
45
- [o.fullWidth]: a
45
+ [o.autofocus]: d || typeof s < "u",
46
+ [o.fullWidth]: i
46
47
  });
47
48
  }
48
- const K = m.forwardRef(function(t, e) {
49
+ const O = m.forwardRef(function(t, l) {
49
50
  const {
50
51
  text: n = null,
51
- icon: c,
52
+ icon: a,
52
53
  title: u = "",
53
54
  type: d = "button",
54
- className: a = "",
55
- theme: i = "default",
56
- disabled: l = !1,
57
- onClick: h = q,
58
- onMouseDown: p = q,
59
- onMouseUp: b = q,
55
+ className: i = "",
56
+ theme: s = "default",
57
+ disabled: e = !1,
58
+ onClick: k = h,
59
+ onMouseDown: p = h,
60
+ onMouseUp: w = h,
60
61
  autofocus: f = !1,
61
62
  tabIndex: _,
62
63
  fullWidth: y = !1,
63
- ariaLabel: k = ""
64
- } = t, x = m.useMemo(() => z({
64
+ ariaLabel: b = ""
65
+ } = t, x = m.useMemo(() => A({
65
66
  text: n,
66
- icon: c,
67
- theme: i,
68
- disabled: l,
69
- className: a,
67
+ icon: a,
68
+ theme: s,
69
+ disabled: e,
70
+ className: i,
70
71
  autofocus: f,
71
72
  fullWidth: y,
72
73
  tabIndex: _
73
74
  }), [
74
75
  f,
75
- a,
76
+ i,
76
77
  y,
77
- l,
78
- c,
78
+ e,
79
+ a,
79
80
  _,
80
81
  n,
81
- i
82
+ s
82
83
  ]), C = m.useCallback((N) => {
83
- l || h(N);
84
- }, [l, h]);
84
+ e || k(N);
85
+ }, [e, k]);
85
86
  return /* @__PURE__ */ r(
86
87
  "button",
87
88
  {
88
- ref: e,
89
- disabled: l,
89
+ ref: l,
90
+ disabled: e,
90
91
  className: x,
91
92
  onClick: C,
92
93
  onMouseDown: p,
93
- onMouseUp: b,
94
+ onMouseUp: w,
94
95
  autoFocus: f,
95
96
  tabIndex: _,
96
97
  title: u,
97
98
  type: d,
98
- "aria-label": k,
99
- children: /* @__PURE__ */ r(U, { ...t })
99
+ "aria-label": b,
100
+ children: /* @__PURE__ */ r(z, { ...t })
100
101
  }
101
102
  );
102
103
  });
103
104
  export {
104
- K as Button,
105
- U as ButtonContent,
106
- z as getButtonClassName
105
+ O as Button,
106
+ z as ButtonContent,
107
+ A as getButtonClassName
107
108
  };
@@ -4,7 +4,7 @@ import { Flex as i } from "../Layout/Flex/Flex.js";
4
4
  import { Text as n } from "../Text/Text.js";
5
5
  import { Button as t } from "./Button.js";
6
6
  import { ButtonBar as c } from "./ButtonBar.js";
7
- function o() {
7
+ function a() {
8
8
  return /* @__PURE__ */ r(i, { gap: "large", vertical: !0, children: [
9
9
  /* @__PURE__ */ r(i, { gap: "normal", vertical: !0, children: [
10
10
  /* @__PURE__ */ e(n, { children: "Default" }),
@@ -83,6 +83,17 @@ function o() {
83
83
  }
84
84
  ) })
85
85
  ] }),
86
+ /* @__PURE__ */ r(i, { gap: "normal", vertical: !0, children: [
87
+ /* @__PURE__ */ e(n, { children: "Linked" }),
88
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
89
+ t,
90
+ {
91
+ text: "Sign In",
92
+ theme: "linked",
93
+ icon: "ExternalLink"
94
+ }
95
+ ) })
96
+ ] }),
86
97
  /* @__PURE__ */ r(i, { gap: "normal", vertical: !0, children: [
87
98
  /* @__PURE__ */ e(n, { children: "Button Bar" }),
88
99
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ r(c, { children: [
@@ -105,7 +116,7 @@ function o() {
105
116
  ] })
106
117
  ] });
107
118
  }
108
- const g = l.memo(o);
119
+ const g = l.memo(a);
109
120
  export {
110
121
  g as default
111
122
  };
@@ -3,7 +3,7 @@ import "react";
3
3
  import "../../Interactive/Interactive.js";
4
4
  import "../../../utils/clsx.js";
5
5
  import "../../../utils/math.js";
6
- import { R } from "../../../Rail-rtPENZs2.js";
6
+ import { R } from "../../../Rail-nVRissv6.js";
7
7
  export {
8
8
  R as Rail
9
9
  };
@@ -3,7 +3,7 @@ import r from "react";
3
3
  import { useContextualStyle as W } from "../../Style/Style.js";
4
4
  import { clsx as b } from "../../../utils/clsx.js";
5
5
  import { mergeRefs as k } from "../../../utils/mergeRefs.js";
6
- import { s as o, R as w } from "../../../Rail-rtPENZs2.js";
6
+ import { s as o, R as w } from "../../../Rail-nVRissv6.js";
7
7
  const N = {
8
8
  size: 0,
9
9
  scrollPos: 0,
@@ -3,7 +3,7 @@ import N, { createElement as k, PureComponent as re } from "react";
3
3
  import { _ as ie, a as ne } from "../../../inheritsLoose-CyjgKRgL.js";
4
4
  import { clsx as oe } from "../../../utils/clsx.js";
5
5
  import { Scrollable as le } from "./Scrollable.js";
6
- import { s as se } from "../../../Rail-rtPENZs2.js";
6
+ import { s as se } from "../../../Rail-nVRissv6.js";
7
7
  function $(r) {
8
8
  if (r === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
9
9
  return r;
@@ -1,4 +1,4 @@
1
- import { R as o } from "../../../Rail-rtPENZs2.js";
1
+ import { R as o } from "../../../Rail-nVRissv6.js";
2
2
  import { Scrollable as e } from "./Scrollable.js";
3
3
  import { VirtualScrollable as f } from "./VirtualScrollable.js";
4
4
  export {
package/dist/main.js CHANGED
@@ -46,7 +46,7 @@ import { Flex as lr } from "./components/Layout/Flex/Flex.js";
46
46
  import { FlexRestricter as ir } from "./components/Layout/Flex/FlexRestricter.js";
47
47
  import { Pad as cr } from "./components/Layout/Pad/Pad.js";
48
48
  import { Page as dr } from "./components/Layout/Page/Page.js";
49
- import { R as Tr } from "./Rail-rtPENZs2.js";
49
+ import { R as Tr } from "./Rail-nVRissv6.js";
50
50
  import { Scrollable as Lr } from "./components/Layout/Scrollable/Scrollable.js";
51
51
  import { VirtualScrollable as yr } from "./components/Layout/Scrollable/VirtualScrollable.js";
52
52
  import { Loaf as Sr } from "./components/Loaf/Loaf.js";
@@ -1,5 +1,6 @@
1
1
  @use "sass:math";
2
2
  @use "sass:map";
3
+ @use "sass:meta";
3
4
  @use "colors";
4
5
 
5
6
  @mixin def($var, $value) {
@@ -197,10 +198,24 @@ $cfxui-color-alpha: (
197
198
  }
198
199
 
199
200
  @mixin animated($props: 'all', $subClass: '&') {
200
- #{$subClass} {
201
- transition: #{$props} .25s ease,
202
- outline-offset 0s,
203
- outline 0s;
201
+ @if type-of($props) == 'list' {
202
+ $transition: ();
203
+ @each $property in $props {
204
+ $transition: append(
205
+ $transition, ($property .25s ease), $separator: comma
206
+ );
207
+ }
208
+ #{$subClass} {
209
+ transition: $transition,
210
+ outline-offset 0s,
211
+ outline 0s;
212
+ }
213
+ } @else {
214
+ #{$subClass} {
215
+ transition: #{$props} .25s ease,
216
+ outline-offset 0s,
217
+ outline 0s;
218
+ }
204
219
  }
205
220
  }
206
221
 
@@ -254,6 +254,19 @@ $control-heights: (
254
254
  @include ui.define-color-token('button-onlight-disabled-border', ui.color('bg-dark', $alpha: .4));
255
255
  @include ui.define-color-token('button-onlight-disabled-background', transparent);
256
256
 
257
+ @include ui.define-color-token('button-linked-text', ui.color('tertiary'));
258
+ @include ui.define-color-token('button-linked-border', transparent);
259
+ @include ui.define-color-token('button-linked-background', transparent);
260
+ @include ui.define-color-token('button-linked-hover-text', ui.color('red'));
261
+ @include ui.define-color-token('button-linked-hover-border', transparent);
262
+ @include ui.define-color-token('button-linked-hover-background', ui.color('bg-dark'));
263
+ @include ui.define-color-token('button-linked-active-text', ui.color('red'));
264
+ @include ui.define-color-token('button-linked-active-border', transparent);
265
+ @include ui.define-color-token('button-linked-active-background', ui.color('bg-dark'));
266
+ @include ui.define-color-token('button-linked-disabled-text', ui.color('tertiary', $alpha: .4));
267
+ @include ui.define-color-token('button-linked-disabled-border', transparent);
268
+ @include ui.define-color-token('button-linked-disabled-background', transparent);
269
+
257
270
  @include ui.define-color-token('button-quicklink-text', ui.color('primary'));
258
271
  @include ui.define-color-token('button-quicklink-border', transparent);
259
272
  @include ui.define-color-token('button-quicklink-background', ui.color('bg-light'));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cfx-dev/ui-components",
3
3
  "private": false,
4
- "version": "2.1.4",
4
+ "version": "2.1.5",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "dist/main.js",
@@ -1,81 +0,0 @@
1
- import { jsx as g } from "react/jsx-runtime";
2
- import r from "react";
3
- import { Interactive as C } from "./components/Interactive/Interactive.js";
4
- import { clsx as S } from "./utils/clsx.js";
5
- import { clamp01 as b } from "./utils/math.js";
6
- import './assets/Rail.css';const q = "_virtual_1ixqf_1", P = "_root_1ixqf_5", T = "_rail_1ixqf_12", R = "_active_1ixqf_12", M = "_scroller_1ixqf_15", y = "_content_1ixqf_25", z = "_thumb_1ixqf_39", a = {
7
- virtual: q,
8
- root: P,
9
- rail: T,
10
- active: R,
11
- scroller: M,
12
- "no-x-scroll": "_no-x-scroll_1ixqf_19",
13
- "no-y-scroll": "_no-y-scroll_1ixqf_22",
14
- content: y,
15
- thumb: z,
16
- "axis-x": "_axis-x_1ixqf_50",
17
- "axis-y": "_axis-y_1ixqf_59"
18
- }, E = {
19
- pos: 0,
20
- ratio: 1,
21
- height: 0,
22
- offset: 0,
23
- dragging: !1,
24
- dragStartAtCursor: 0,
25
- dragStartAtPos: 0,
26
- movementMultiplier: 1
27
- };
28
- function X(v) {
29
- const {
30
- axis: c,
31
- pos: s,
32
- size: o,
33
- scrollSize: m,
34
- rootRef: _,
35
- setRootActive: i,
36
- minThumbSize: n
37
- } = v, [h, x] = r.useState(!1), t = r.useRef({ ...E }), e = r.useMemo(() => c === "x" ? {
38
- sizeCSS: "width",
39
- offsetCSSTransform: "translateX",
40
- scrollToSide: "left",
41
- mousePosAxis: "clientX"
42
- } : {
43
- sizeCSS: "height",
44
- offsetCSSTransform: "translateY",
45
- scrollToSide: "top",
46
- mousePosAxis: "clientY"
47
- }, [c]), p = {
48
- [e.sizeCSS]: `${t.current.height}px`,
49
- transform: `${e.offsetCSSTransform}(${t.current.offset}px)`
50
- }, A = r.useCallback((f) => {
51
- t.current.dragging = !0, t.current.dragStartAtPos = t.current.pos, t.current.dragStartAtCursor = f[e.mousePosAxis], x(!0), i(!0);
52
- }, [e.mousePosAxis, i]), u = r.useCallback((f) => {
53
- var d;
54
- if (!t.current.dragging)
55
- return;
56
- const w = f[e.mousePosAxis] - t.current.dragStartAtCursor;
57
- (d = _.current) == null || d.scrollTo({
58
- [e.scrollToSide]: t.current.dragStartAtPos + w * t.current.movementMultiplier,
59
- behavior: "auto"
60
- });
61
- }, [e.mousePosAxis, e.scrollToSide, _]), l = r.useCallback(() => {
62
- t.current.dragging && (t.current.dragging = !1, x(!1), i(!1));
63
- }, [i]);
64
- return r.useEffect(() => {
65
- t.current.pos = s, t.current.ratio = b(o / m), t.current.height = o * t.current.ratio, t.current.offset = s * t.current.ratio, t.current.height < n && (t.current.height = n, t.current.offset = s * t.current.ratio * ((o - n) / o)), t.current.movementMultiplier = 1 / t.current.ratio;
66
- }, [n, s, m, o]), r.useEffect(() => (window.addEventListener("mousemove", u), window.addEventListener("mouseup", l), () => {
67
- window.removeEventListener("mousemove", u), window.removeEventListener("mouseup", l);
68
- }), [u, l]), /* @__PURE__ */ g("div", { className: S(a.rail, a[`axis-${c}`]), children: /* @__PURE__ */ g(
69
- C,
70
- {
71
- showPointer: !1,
72
- style: p,
73
- className: S(a.thumb, { [a.active]: h }),
74
- onMouseDown: A
75
- }
76
- ) });
77
- }
78
- export {
79
- X as R,
80
- a as s
81
- };