@kolking/react-ui 1.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/LICENSE +21 -0
- package/README.md +131 -0
- package/dist/Input-Lz3ft8Tp.js +96 -0
- package/dist/ValidationTooltip-BgSwl0hJ.js +30 -0
- package/dist/_commonjsHelpers-B52_cu2H.js +26 -0
- package/dist/components/Button/Button.d.ts +26 -0
- package/dist/components/Button/Button.js +62 -0
- package/dist/components/Button/index.d.ts +1 -0
- package/dist/components/Button/index.js +4 -0
- package/dist/components/Dialog/Dialog.d.ts +10 -0
- package/dist/components/Dialog/Dialog.js +57 -0
- package/dist/components/Dialog/DialogFocusTrap.d.ts +2 -0
- package/dist/components/Dialog/DialogFocusTrap.js +765 -0
- package/dist/components/Dialog/index.d.ts +3 -0
- package/dist/components/Dialog/index.js +12 -0
- package/dist/components/Dialog/useDialog.d.ts +19 -0
- package/dist/components/Dialog/useDialog.js +52 -0
- package/dist/components/Dialog/withDialog.d.ts +11 -0
- package/dist/components/Dialog/withDialog.js +23 -0
- package/dist/components/Fields/Checkbox.d.ts +13 -0
- package/dist/components/Fields/Checkbox.js +28 -0
- package/dist/components/Fields/Field.d.ts +20 -0
- package/dist/components/Fields/Field.js +52 -0
- package/dist/components/Fields/Input.d.ts +11 -0
- package/dist/components/Fields/Input.js +9 -0
- package/dist/components/Fields/Quantity.d.ts +7 -0
- package/dist/components/Fields/Quantity.js +61 -0
- package/dist/components/Fields/Radio.d.ts +11 -0
- package/dist/components/Fields/Radio.js +23 -0
- package/dist/components/Fields/Select.d.ts +7 -0
- package/dist/components/Fields/Select.js +21 -0
- package/dist/components/Fields/Textarea.d.ts +12 -0
- package/dist/components/Fields/Textarea.js +185 -0
- package/dist/components/Fields/ValidationTooltip.d.ts +2 -0
- package/dist/components/Fields/ValidationTooltip.js +6 -0
- package/dist/components/Fields/index.d.ts +8 -0
- package/dist/components/Fields/index.js +20 -0
- package/dist/components/Flex/Flex.d.ts +22 -0
- package/dist/components/Flex/Flex.js +36 -0
- package/dist/components/Flex/index.d.ts +1 -0
- package/dist/components/Flex/index.js +4 -0
- package/dist/components/Heading/Heading.d.ts +12 -0
- package/dist/components/Heading/Heading.js +57 -0
- package/dist/components/Heading/index.d.ts +1 -0
- package/dist/components/Heading/index.js +4 -0
- package/dist/components/Icon/Icon.d.ts +16 -0
- package/dist/components/Icon/Icon.js +125 -0
- package/dist/components/Icon/icons.d.ts +2 -0
- package/dist/components/Icon/icons.js +91 -0
- package/dist/components/Icon/index.d.ts +1 -0
- package/dist/components/Icon/index.js +4 -0
- package/dist/components/Menu/Menu.d.ts +9 -0
- package/dist/components/Menu/Menu.js +77 -0
- package/dist/components/Menu/MenuContext.d.ts +8 -0
- package/dist/components/Menu/MenuContext.js +5 -0
- package/dist/components/Menu/MenuItem.d.ts +7 -0
- package/dist/components/Menu/MenuItem.js +50 -0
- package/dist/components/Menu/index.d.ts +2 -0
- package/dist/components/Menu/index.js +6 -0
- package/dist/components/Notice/Notice.d.ts +15 -0
- package/dist/components/Notice/Notice.js +56 -0
- package/dist/components/Notice/index.d.ts +1 -0
- package/dist/components/Notice/index.js +4 -0
- package/dist/components/Progress/ProgressBar.d.ts +21 -0
- package/dist/components/Progress/ProgressBar.js +47 -0
- package/dist/components/Progress/ProgressCircular.d.ts +25 -0
- package/dist/components/Progress/ProgressCircular.js +71 -0
- package/dist/components/Progress/index.d.ts +2 -0
- package/dist/components/Progress/index.js +6 -0
- package/dist/components/Segmented/Segmented.d.ts +9 -0
- package/dist/components/Segmented/Segmented.js +46 -0
- package/dist/components/Segmented/index.d.ts +1 -0
- package/dist/components/Segmented/index.js +4 -0
- package/dist/components/Spinner/Spinner.d.ts +13 -0
- package/dist/components/Spinner/Spinner.js +31 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +4 -0
- package/dist/components/Tooltip/Tooltip.d.ts +14 -0
- package/dist/components/Tooltip/Tooltip.js +78 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +4 -0
- package/dist/floating-ui.react-KLg1MUz0.js +22334 -0
- package/dist/index-DyIdU--j.js +45 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.esm-Dkuk1b-q.js +211 -0
- package/dist/index.js +54 -0
- package/dist/styles/_theme-default.scss +142 -0
- package/dist/styles/_theme.scss +40 -0
- package/dist/styles/_utils.scss +118 -0
- package/dist/styles/style.css +1 -0
- package/dist/styles.module-CUhWny5T.js +11 -0
- package/dist/utils/helpers.d.ts +13 -0
- package/dist/utils/helpers.js +34 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Nick Seryakov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# React UI
|
|
2
|
+
|
|
3
|
+
A React component library for building modern web apps. Its flexible theming system uses the SASS pre-processor and relies on CSS variables that can be customized to match your project's look and feel. The library is simple, lightweight and fast.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
yarn add @kolking/react-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Theming Setup
|
|
12
|
+
|
|
13
|
+
Add the following code at the beginning of your main SASS stylesheet to generate the global CSS variables required for the library components.
|
|
14
|
+
|
|
15
|
+
```scss
|
|
16
|
+
@use '@kolking/react-ui/styles/utils';
|
|
17
|
+
@use '@kolking/react-ui/styles/theme';
|
|
18
|
+
|
|
19
|
+
:root {
|
|
20
|
+
@include utils.vars(theme.$variables);
|
|
21
|
+
@include utils.vars(theme.$light-colors, 'color');
|
|
22
|
+
|
|
23
|
+
@media screen and (prefers-color-scheme: dark) {
|
|
24
|
+
@include utils.vars(theme.$dark-colors, 'color');
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
*, *::before, *::after {
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:focus-visible {
|
|
33
|
+
@include utils.focus-visible();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ... rest of your global styles
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Now import the library stylesheet along with your main stylesheet in the project's entry point.
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
import { createRoot } from 'react-dom/client';
|
|
43
|
+
import App from './App.tsx';
|
|
44
|
+
|
|
45
|
+
import '@kolking/react-ui/styles/style.css';
|
|
46
|
+
import './styles/main.scss';
|
|
47
|
+
|
|
48
|
+
createRoot(document.getElementById('root')!).render(<App />);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
This was a very basic setup with no customizations added to the default theme. Read below to understand what the default theme includes and learn how to modify it.
|
|
52
|
+
|
|
53
|
+
## Default Theme
|
|
54
|
+
|
|
55
|
+
The [default theme](https://github.com/kolking/react-ui/blob/main/lib/styles/_theme-default.scss) consists of several SASS maps that are combined into a [single map variable](https://github.com/kolking/react-ui/blob/main/lib/styles/_theme.scss#L20-L30) and then transformed into CSS variables using the [`utils.vars($var)`](https://github.com/kolking/react-ui/blob/main/lib/styles/_utils.scss#L8-L21) SASS mixin. For example:
|
|
56
|
+
|
|
57
|
+
```scss
|
|
58
|
+
// Map variable in the default theme
|
|
59
|
+
$font-family: (
|
|
60
|
+
body: (-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif),
|
|
61
|
+
mono: (Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace),
|
|
62
|
+
heading: var(--font-family-body),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
// CSS variables after transform
|
|
66
|
+
--font-family-body: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif;
|
|
67
|
+
--font-family-mono: Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
|
|
68
|
+
--font-family-heading: var(--font-family-body);
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Therefore, to modify the default theme, you need to override the values by adding [configuration](https://sass-lang.com/documentation/at-rules/use/#configuration) to the `@use` rule. You can also add new variables, and they will be included in the theme:
|
|
72
|
+
|
|
73
|
+
```scss
|
|
74
|
+
@use '@kolking/react-ui/styles/utils';
|
|
75
|
+
@use '@kolking/react-ui/styles/theme' with (
|
|
76
|
+
$font-family: (
|
|
77
|
+
body: ("Open Sans", sans-serif), // change --font-family-body variable
|
|
78
|
+
),
|
|
79
|
+
$light-palette: (
|
|
80
|
+
colors: (
|
|
81
|
+
accent: #669900, // change --color-accent-[50...800] variables
|
|
82
|
+
),
|
|
83
|
+
),
|
|
84
|
+
$light-colors: (
|
|
85
|
+
hotpink: #F565A5, // add new --color-hotpink variable
|
|
86
|
+
),
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
:root {
|
|
90
|
+
// the $variables and $light-colors now contain your modifications
|
|
91
|
+
@include utils.vars(theme.$variables);
|
|
92
|
+
@include utils.vars(theme.$light-colors, 'color');
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Color Variables
|
|
97
|
+
|
|
98
|
+
There are two types of color variables in the theme. First, the `$light-colors` and `$dark-colors`, which are transformed into CSS variables as they are. Second, the `$light-palette` and `$dark-palette` colors, which automatically generate 9 shades for each color. The naming convention is fairly common: `--color-name-[50|100|200|300|400|500|600|700|800]`, where `--color-name-500` is the original color, `50` to `400` are lighter tints, and `600` to `800` are darker shades.
|
|
99
|
+
|
|
100
|
+
```scss
|
|
101
|
+
// Base color in the light-palette
|
|
102
|
+
$light-palette: (
|
|
103
|
+
colors: (
|
|
104
|
+
blue: #007AFF,
|
|
105
|
+
),
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// Generated CSS variables
|
|
109
|
+
--color-blue-50: #F2F8FF;
|
|
110
|
+
--color-blue-100: #E6F2FF;
|
|
111
|
+
--color-blue-200: #CCE4FF;
|
|
112
|
+
--color-blue-300: #99CAFF;
|
|
113
|
+
--color-blue-400: #4DA2FF;
|
|
114
|
+
--color-blue-500: #007AFF;
|
|
115
|
+
--color-blue-600: #0567D1;
|
|
116
|
+
--color-blue-700: #0A53A3;
|
|
117
|
+
--color-blue-800: #0F4075;
|
|
118
|
+
```
|
|
119
|
+
## Component Variables
|
|
120
|
+
|
|
121
|
+
Some components, such as `Input`, also add [CSS variables](https://github.com/kolking/react-ui/blob/main/lib/components/Fields/styles/input.module.scss) to the global scope. You may want to redefine these variables in your stylesheet, or use them when building your own components. Refer to the component styles for their global and local CSS variables.
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
## Feedback
|
|
125
|
+
|
|
126
|
+
If you have a feature request, found a bug, or have ideas for improvement, please [open an issue](https://github.com/kolking/react-ui/issues).
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
Licensed under the MIT license.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { jsxs as f, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { c as u } from "./index-DyIdU--j.js";
|
|
3
|
+
import _ from "react";
|
|
4
|
+
import { cssProps as m } from "./utils/helpers.js";
|
|
5
|
+
import { s as t, V as h } from "./ValidationTooltip-BgSwl0hJ.js";
|
|
6
|
+
const x = "styles_checkbox_pxrU4", w = "styles_radio_0QV8R", v = "styles_label_K65D1", k = "styles_input_j6Qji", g = {
|
|
7
|
+
checkbox: x,
|
|
8
|
+
radio: w,
|
|
9
|
+
label: v,
|
|
10
|
+
input: k
|
|
11
|
+
};
|
|
12
|
+
function N(a) {
|
|
13
|
+
return ![
|
|
14
|
+
"button",
|
|
15
|
+
"checkbox",
|
|
16
|
+
"color",
|
|
17
|
+
"file",
|
|
18
|
+
"hidden",
|
|
19
|
+
"image",
|
|
20
|
+
"radio",
|
|
21
|
+
"range",
|
|
22
|
+
"reset",
|
|
23
|
+
"submit"
|
|
24
|
+
].includes(a);
|
|
25
|
+
}
|
|
26
|
+
function p(a) {
|
|
27
|
+
switch (a) {
|
|
28
|
+
case "checkbox":
|
|
29
|
+
case "radio":
|
|
30
|
+
return g.input;
|
|
31
|
+
case "date":
|
|
32
|
+
case "datetime":
|
|
33
|
+
case "datetime-local":
|
|
34
|
+
case "month":
|
|
35
|
+
case "week":
|
|
36
|
+
return t.date;
|
|
37
|
+
case "time":
|
|
38
|
+
case "number":
|
|
39
|
+
case "search":
|
|
40
|
+
case "range":
|
|
41
|
+
case "hidden":
|
|
42
|
+
case "button":
|
|
43
|
+
case "submit":
|
|
44
|
+
case "reset":
|
|
45
|
+
case "image":
|
|
46
|
+
case "color":
|
|
47
|
+
case "file":
|
|
48
|
+
return t[a];
|
|
49
|
+
default:
|
|
50
|
+
return t.input;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const Q = _.forwardRef(
|
|
54
|
+
({ size: a, error: c, type: e = "text", className: o, style: d, prefix: i, children: n, ...r }, l) => {
|
|
55
|
+
const b = N(e) && (i || n) ? /* @__PURE__ */ f(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
"data-input-wrapper": !0,
|
|
59
|
+
"data-disabled": r.disabled,
|
|
60
|
+
"data-invalid": c ? !0 : void 0,
|
|
61
|
+
className: u(t.wrapper, o),
|
|
62
|
+
style: { ...d, ...m({ size: a }) },
|
|
63
|
+
children: [
|
|
64
|
+
i && /* @__PURE__ */ s("div", { "data-input-prefix": !0, className: t.wrapper_prefix, children: i }),
|
|
65
|
+
/* @__PURE__ */ s(
|
|
66
|
+
"input",
|
|
67
|
+
{
|
|
68
|
+
...r,
|
|
69
|
+
ref: l,
|
|
70
|
+
type: e,
|
|
71
|
+
"data-input": e,
|
|
72
|
+
className: p(e)
|
|
73
|
+
}
|
|
74
|
+
),
|
|
75
|
+
n && /* @__PURE__ */ s("div", { "data-input-accessory": !0, className: t.wrapper_accessory, children: n })
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
) : /* @__PURE__ */ s(
|
|
79
|
+
"input",
|
|
80
|
+
{
|
|
81
|
+
...r,
|
|
82
|
+
ref: l,
|
|
83
|
+
type: e,
|
|
84
|
+
"data-input": e,
|
|
85
|
+
"data-invalid": c ? !0 : void 0,
|
|
86
|
+
className: u(p(e), o),
|
|
87
|
+
style: { ...d, ...m({ size: a }) }
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
return /* @__PURE__ */ s(h, { content: c, children: b });
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
export {
|
|
94
|
+
Q as I,
|
|
95
|
+
g as s
|
|
96
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Tooltip as s } from "./components/Tooltip/Tooltip.js";
|
|
3
|
+
const r = "styles_input_a-JHN", a = "styles_wrapper_b3-VW", o = "styles_date_S0YpO", p = "styles_time_3ywit", c = "styles_search_y6sAm", l = "styles_number_auDA-", _ = "styles_textarea_KRYGO", n = "styles_select_qhElj", i = "styles_tooltip_tBrt4", y = "styles_range_tSqtV", m = "styles_wrapper_prefix_KI25W", w = "styles_wrapper_accessory_yZjv0", u = {
|
|
4
|
+
input: r,
|
|
5
|
+
wrapper: a,
|
|
6
|
+
date: o,
|
|
7
|
+
time: p,
|
|
8
|
+
search: c,
|
|
9
|
+
number: l,
|
|
10
|
+
textarea: _,
|
|
11
|
+
select: n,
|
|
12
|
+
tooltip: i,
|
|
13
|
+
range: y,
|
|
14
|
+
wrapper_prefix: m,
|
|
15
|
+
wrapper_accessory: w
|
|
16
|
+
}, f = (t) => /* @__PURE__ */ e(
|
|
17
|
+
s,
|
|
18
|
+
{
|
|
19
|
+
...t,
|
|
20
|
+
"data-tooltip-validation": !0,
|
|
21
|
+
disabled: !t.content,
|
|
22
|
+
placement: "top-start",
|
|
23
|
+
trigger: "hover focus click",
|
|
24
|
+
className: u.tooltip
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
export {
|
|
28
|
+
f as V,
|
|
29
|
+
u as s
|
|
30
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function n(e) {
|
|
2
|
+
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
3
|
+
}
|
|
4
|
+
function c(e) {
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(e, "__esModule")) return e;
|
|
6
|
+
var o = e.default;
|
|
7
|
+
if (typeof o == "function") {
|
|
8
|
+
var t = function r() {
|
|
9
|
+
return this instanceof r ? Reflect.construct(o, arguments, this.constructor) : o.apply(this, arguments);
|
|
10
|
+
};
|
|
11
|
+
t.prototype = o.prototype;
|
|
12
|
+
} else t = {};
|
|
13
|
+
return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(e).forEach(function(r) {
|
|
14
|
+
var u = Object.getOwnPropertyDescriptor(e, r);
|
|
15
|
+
Object.defineProperty(t, r, u.get ? u : {
|
|
16
|
+
enumerable: !0,
|
|
17
|
+
get: function() {
|
|
18
|
+
return e[r];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}), t;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
c as a,
|
|
25
|
+
n as g
|
|
26
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PolymorphicProps } from '../../utils/helpers';
|
|
3
|
+
export type ButtonProps<T extends React.ElementType = 'button'> = PolymorphicProps<T, {
|
|
4
|
+
as?: T;
|
|
5
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
variant?: 'primary' | 'secondary' | 'tertiary';
|
|
7
|
+
scheme?: 'default' | 'negative' | 'positive' | 'warning';
|
|
8
|
+
minWidth?: React.CSSProperties['minWidth'];
|
|
9
|
+
maxWidth?: React.CSSProperties['maxWidth'];
|
|
10
|
+
busy?: boolean;
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
icon?: React.ReactElement;
|
|
13
|
+
iconPosition?: 'start' | 'end';
|
|
14
|
+
}>;
|
|
15
|
+
export declare const Button: <T extends React.ElementType = "button">(props: {
|
|
16
|
+
as?: T | undefined;
|
|
17
|
+
size?: "xs" | "sm" | "md" | "lg" | "xl";
|
|
18
|
+
variant?: "primary" | "secondary" | "tertiary";
|
|
19
|
+
scheme?: "default" | "negative" | "positive" | "warning";
|
|
20
|
+
minWidth?: React.CSSProperties["minWidth"];
|
|
21
|
+
maxWidth?: React.CSSProperties["maxWidth"];
|
|
22
|
+
busy?: boolean;
|
|
23
|
+
title?: React.ReactNode;
|
|
24
|
+
icon?: React.ReactElement;
|
|
25
|
+
iconPosition?: "start" | "end";
|
|
26
|
+
} & Omit<React.PropsWithoutRef<React.ComponentProps<T>>, "title" | "size" | "as" | "icon" | "minWidth" | "maxWidth" | "variant" | "scheme" | "busy" | "iconPosition"> & React.RefAttributes<unknown>) => React.ReactElement | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsxs as u, jsx as v, Fragment as B } from "react/jsx-runtime";
|
|
2
|
+
import { c as b } from "../../index-DyIdU--j.js";
|
|
3
|
+
import { fixedForwardRef as w, wrapNode as d, cssProps as x } from "../../utils/helpers.js";
|
|
4
|
+
import { Spinner as N } from "../Spinner/Spinner.js";
|
|
5
|
+
const h = "Button_button_WuG2z", y = {
|
|
6
|
+
button: h,
|
|
7
|
+
"primary-default": "Button_primary-default_lVt-V",
|
|
8
|
+
"secondary-default": "Button_secondary-default_yggNH",
|
|
9
|
+
"tertiary-default": "Button_tertiary-default_qSFa6",
|
|
10
|
+
"primary-negative": "Button_primary-negative_AupXJ",
|
|
11
|
+
"secondary-negative": "Button_secondary-negative_bZbAE",
|
|
12
|
+
"tertiary-negative": "Button_tertiary-negative_7Dh-3",
|
|
13
|
+
"primary-positive": "Button_primary-positive_4Mnfc",
|
|
14
|
+
"secondary-positive": "Button_secondary-positive_h1UJg",
|
|
15
|
+
"tertiary-positive": "Button_tertiary-positive_oTrM5",
|
|
16
|
+
"primary-warning": "Button_primary-warning_9A3NY",
|
|
17
|
+
"secondary-warning": "Button_secondary-warning_mbIUl",
|
|
18
|
+
"tertiary-warning": "Button_tertiary-warning_gM2um"
|
|
19
|
+
};
|
|
20
|
+
function A({
|
|
21
|
+
as: _,
|
|
22
|
+
variant: r = "primary",
|
|
23
|
+
scheme: a = "default",
|
|
24
|
+
size: p,
|
|
25
|
+
minWidth: m,
|
|
26
|
+
maxWidth: l,
|
|
27
|
+
busy: t,
|
|
28
|
+
title: e,
|
|
29
|
+
icon: n,
|
|
30
|
+
iconPosition: i = "start",
|
|
31
|
+
children: o,
|
|
32
|
+
className: c,
|
|
33
|
+
style: g,
|
|
34
|
+
...s
|
|
35
|
+
}, f) {
|
|
36
|
+
return /* @__PURE__ */ u(
|
|
37
|
+
_ ?? "button",
|
|
38
|
+
{
|
|
39
|
+
...s,
|
|
40
|
+
ref: f,
|
|
41
|
+
"data-busy": t,
|
|
42
|
+
"data-button": r,
|
|
43
|
+
"data-scheme": a,
|
|
44
|
+
"aria-disabled": s.disabled,
|
|
45
|
+
"aria-live": t ? "polite" : void 0,
|
|
46
|
+
className: b(y.button, y[`${r}-${a}`], c),
|
|
47
|
+
style: { ...g, ...x({ size: p, minWidth: m, maxWidth: l }) },
|
|
48
|
+
children: [
|
|
49
|
+
o ? d(o, "span") : /* @__PURE__ */ u(B, { children: [
|
|
50
|
+
i === "start" && n,
|
|
51
|
+
e && d(e, "span"),
|
|
52
|
+
i === "end" && n
|
|
53
|
+
] }),
|
|
54
|
+
t && /* @__PURE__ */ v(N, { overlay: !0 })
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
const S = w(A);
|
|
60
|
+
export {
|
|
61
|
+
S as Button
|
|
62
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonProps } from '../Button';
|
|
3
|
+
export type DialogProps = React.HTMLProps<HTMLDialogElement> & {
|
|
4
|
+
width?: React.CSSProperties['width'];
|
|
5
|
+
};
|
|
6
|
+
export declare const Dialog: React.ForwardRefExoticComponent<Omit<DialogProps, "ref"> & React.RefAttributes<HTMLDialogElement>>;
|
|
7
|
+
export declare const DialogTitle: ({ className, children, ...props }: React.HTMLProps<HTMLHeadingElement>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const DialogContent: ({ className, children, ...props }: React.HTMLProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const DialogFooter: ({ className, children, ...props }: React.HTMLProps<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const DialogClose: ({ className, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import d from "react";
|
|
3
|
+
import { c as l } from "../../index-DyIdU--j.js";
|
|
4
|
+
import { Icon as g } from "../Icon/Icon.js";
|
|
5
|
+
import { Button as m } from "../Button/Button.js";
|
|
6
|
+
import { DialogFocusTrap as f } from "./DialogFocusTrap.js";
|
|
7
|
+
import { cssProps as p } from "../../utils/helpers.js";
|
|
8
|
+
const D = "Dialog_title_2pDPQ", _ = "Dialog_dialog_G3gxL", u = "Dialog_content_7168G", N = "Dialog_footer_N-aEV", v = "Dialog_close_JSEkn", i = {
|
|
9
|
+
title: D,
|
|
10
|
+
dialog: _,
|
|
11
|
+
content: u,
|
|
12
|
+
footer: N,
|
|
13
|
+
close: v
|
|
14
|
+
}, G = d.forwardRef(
|
|
15
|
+
({ open: o = !1, width: t, style: a, className: s, children: c, ...r }, n) => /* @__PURE__ */ e(f, { active: o, children: /* @__PURE__ */ e(
|
|
16
|
+
"dialog",
|
|
17
|
+
{
|
|
18
|
+
...r,
|
|
19
|
+
ref: n,
|
|
20
|
+
"data-floating-root": !0,
|
|
21
|
+
"data-dialog": o ? "open" : "closed",
|
|
22
|
+
className: l(i.dialog, s),
|
|
23
|
+
style: { ...a, ...p({ width: t }) },
|
|
24
|
+
children: c
|
|
25
|
+
}
|
|
26
|
+
) })
|
|
27
|
+
), P = ({
|
|
28
|
+
className: o,
|
|
29
|
+
children: t,
|
|
30
|
+
...a
|
|
31
|
+
}) => /* @__PURE__ */ e("h4", { ...a, "data-dialog-title": !0, className: l(i.title, o), children: t }), R = ({
|
|
32
|
+
className: o,
|
|
33
|
+
children: t,
|
|
34
|
+
...a
|
|
35
|
+
}) => /* @__PURE__ */ e("div", { ...a, "data-dialog-content": !0, className: l(i.content, o), children: t }), T = ({
|
|
36
|
+
className: o,
|
|
37
|
+
children: t,
|
|
38
|
+
...a
|
|
39
|
+
}) => /* @__PURE__ */ e("div", { ...a, "data-dialog-footer": !0, className: l(i.footer, o), children: t }), j = ({ className: o, ...t }) => /* @__PURE__ */ e(
|
|
40
|
+
m,
|
|
41
|
+
{
|
|
42
|
+
...t,
|
|
43
|
+
type: "button",
|
|
44
|
+
variant: "tertiary",
|
|
45
|
+
"data-dialog-close": !0,
|
|
46
|
+
"aria-label": "dismiss dialog",
|
|
47
|
+
icon: /* @__PURE__ */ e(g, { name: "close" }),
|
|
48
|
+
className: l(i.close, o)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
export {
|
|
52
|
+
G as Dialog,
|
|
53
|
+
j as DialogClose,
|
|
54
|
+
R as DialogContent,
|
|
55
|
+
T as DialogFooter,
|
|
56
|
+
P as DialogTitle
|
|
57
|
+
};
|