@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.
- package/dist/Rail-nVRissv6.js +81 -0
- package/dist/assets/Button.css +1 -1
- package/dist/assets/Rail.css +1 -1
- package/dist/assets/global.css +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.js +55 -54
- package/dist/components/Button/ButtonShowcase.js +13 -2
- package/dist/components/Layout/Scrollable/Rail.js +1 -1
- package/dist/components/Layout/Scrollable/Scrollable.js +1 -1
- package/dist/components/Layout/Scrollable/VirtualScrollable.js +1 -1
- package/dist/components/Layout/Scrollable/index.js +1 -1
- package/dist/main.js +1 -1
- package/dist/styles-scss/_ui.scss +19 -4
- package/dist/styles-scss/tokens.scss +13 -0
- package/package.json +1 -1
- package/dist/Rail-rtPENZs2.js +0 -81
|
@@ -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
|
|
5
|
-
import { noop as
|
|
6
|
-
import '../../assets/Button.css';const
|
|
7
|
-
root:
|
|
8
|
-
fullWidth:
|
|
9
|
-
primary:
|
|
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-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
18
|
+
function z(c) {
|
|
18
19
|
const {
|
|
19
20
|
text: t = null,
|
|
20
|
-
icon:
|
|
21
|
+
icon: l,
|
|
21
22
|
decorator: n = null
|
|
22
|
-
} =
|
|
23
|
+
} = c;
|
|
23
24
|
return /* @__PURE__ */ W(g, { children: [
|
|
24
25
|
t,
|
|
25
|
-
!!
|
|
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
|
|
30
|
+
function A(c) {
|
|
30
31
|
const {
|
|
31
32
|
text: t = null,
|
|
32
|
-
icon:
|
|
33
|
+
icon: l,
|
|
33
34
|
theme: n = "default",
|
|
34
|
-
disabled:
|
|
35
|
+
disabled: a = !1,
|
|
35
36
|
className: u = "",
|
|
36
37
|
autofocus: d = !1,
|
|
37
|
-
fullWidth:
|
|
38
|
-
tabIndex:
|
|
39
|
-
} =
|
|
40
|
-
return
|
|
41
|
-
[o.disabled]:
|
|
42
|
-
[o.icononly]: !!
|
|
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
|
|
45
|
-
[o.fullWidth]:
|
|
45
|
+
[o.autofocus]: d || typeof s < "u",
|
|
46
|
+
[o.fullWidth]: i
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
|
-
const
|
|
49
|
+
const O = m.forwardRef(function(t, l) {
|
|
49
50
|
const {
|
|
50
51
|
text: n = null,
|
|
51
|
-
icon:
|
|
52
|
+
icon: a,
|
|
52
53
|
title: u = "",
|
|
53
54
|
type: d = "button",
|
|
54
|
-
className:
|
|
55
|
-
theme:
|
|
56
|
-
disabled:
|
|
57
|
-
onClick:
|
|
58
|
-
onMouseDown: p =
|
|
59
|
-
onMouseUp:
|
|
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:
|
|
64
|
-
} = t, x = m.useMemo(() =>
|
|
64
|
+
ariaLabel: b = ""
|
|
65
|
+
} = t, x = m.useMemo(() => A({
|
|
65
66
|
text: n,
|
|
66
|
-
icon:
|
|
67
|
-
theme:
|
|
68
|
-
disabled:
|
|
69
|
-
className:
|
|
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
|
-
|
|
76
|
+
i,
|
|
76
77
|
y,
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
e,
|
|
79
|
+
a,
|
|
79
80
|
_,
|
|
80
81
|
n,
|
|
81
|
-
|
|
82
|
+
s
|
|
82
83
|
]), C = m.useCallback((N) => {
|
|
83
|
-
|
|
84
|
-
}, [
|
|
84
|
+
e || k(N);
|
|
85
|
+
}, [e, k]);
|
|
85
86
|
return /* @__PURE__ */ r(
|
|
86
87
|
"button",
|
|
87
88
|
{
|
|
88
|
-
ref:
|
|
89
|
-
disabled:
|
|
89
|
+
ref: l,
|
|
90
|
+
disabled: e,
|
|
90
91
|
className: x,
|
|
91
92
|
onClick: C,
|
|
92
93
|
onMouseDown: p,
|
|
93
|
-
onMouseUp:
|
|
94
|
+
onMouseUp: w,
|
|
94
95
|
autoFocus: f,
|
|
95
96
|
tabIndex: _,
|
|
96
97
|
title: u,
|
|
97
98
|
type: d,
|
|
98
|
-
"aria-label":
|
|
99
|
-
children: /* @__PURE__ */ r(
|
|
99
|
+
"aria-label": b,
|
|
100
|
+
children: /* @__PURE__ */ r(z, { ...t })
|
|
100
101
|
}
|
|
101
102
|
);
|
|
102
103
|
});
|
|
103
104
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|
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(
|
|
119
|
+
const g = l.memo(a);
|
|
109
120
|
export {
|
|
110
121
|
g as default
|
|
111
122
|
};
|
|
@@ -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-
|
|
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-
|
|
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;
|
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-
|
|
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
|
-
|
|
201
|
-
transition:
|
|
202
|
-
|
|
203
|
-
|
|
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
package/dist/Rail-rtPENZs2.js
DELETED
|
@@ -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
|
-
};
|