@md-code/components 0.0.0-stage → 0.0.1
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/CHANGELOG.md +12 -0
- package/README.md +11 -2
- package/dist/CentralModal-ButM9Ggi.js +159 -0
- package/dist/assets/favicon.ico +0 -0
- package/dist/assets/logo.png +0 -0
- package/dist/atoms/Loading/ouroboros.svg +41 -0
- package/dist/atoms/Logo/logo.jpg +0 -0
- package/dist/avatar.js +8 -0
- package/dist/badge.js +25 -0
- package/dist/breadcrumbs.js +60 -0
- package/dist/button.js +188 -0
- package/dist/calendar.js +100 -0
- package/dist/card.js +81 -0
- package/dist/carousel.js +110 -0
- package/dist/central-modal.js +1 -0
- package/dist/circle-image.js +22 -0
- package/dist/code-preview.js +38 -0
- package/dist/code-view.js +96 -0
- package/dist/conditional-wrapper.js +5 -0
- package/dist/containers.js +115 -0
- package/dist/dist-DD9Lv2Ja.js +130 -0
- package/dist/div-input.js +101 -0
- package/dist/form-label.js +19 -0
- package/dist/form.js +17 -0
- package/dist/full-screen-modal.js +1 -0
- package/dist/header.js +19 -0
- package/dist/html-editor.js +74 -0
- package/dist/icons.js +44 -0
- package/dist/input.js +62 -0
- package/dist/link.js +35 -0
- package/dist/loading.js +87 -0
- package/dist/logo.js +12 -0
- package/dist/modals.js +1 -0
- package/dist/molecules/Carousel/arrow.svg +5 -0
- package/dist/molecules/Select/arrow_down.svg +3 -0
- package/dist/pagination.js +119 -0
- package/dist/progress-bar.js +26 -0
- package/dist/radio.js +72 -0
- package/dist/report-ui.js +280 -0
- package/dist/search-input.js +78 -0
- package/dist/select.js +161 -0
- package/dist/separator.js +10 -0
- package/dist/status-label.js +59 -0
- package/dist/submit.js +57 -0
- package/dist/switch.js +98 -0
- package/dist/table.js +108 -0
- package/dist/tabs.js +155 -0
- package/dist/text-checkbox.js +64 -0
- package/dist/textarea.js +56 -0
- package/dist/textures/Cloud/clouds.svg +52 -0
- package/dist/textures.js +170 -0
- package/dist/themes-zS3KQYdw-DIqyzjFD.js +184 -0
- package/dist/toasts.js +79 -0
- package/dist/toggle.js +66 -0
- package/dist/token-input-field.js +56 -0
- package/dist/tooltip.js +93 -0
- package/dist/types/atoms/Avatar/index.d.ts +6 -0
- package/dist/types/atoms/Avatar/index.d.ts.map +1 -0
- package/dist/types/atoms/Breadcrumbs/index.d.ts +10 -0
- package/dist/types/atoms/Breadcrumbs/index.d.ts.map +1 -0
- package/dist/types/atoms/Breadcrumbs/styles.d.ts +95 -0
- package/dist/types/atoms/Breadcrumbs/styles.d.ts.map +1 -0
- package/dist/types/atoms/Calendar/index.d.ts +4 -0
- package/dist/types/atoms/Calendar/index.d.ts.map +1 -0
- package/dist/types/atoms/Calendar/styles.d.ts +12 -0
- package/dist/types/atoms/Calendar/styles.d.ts.map +1 -0
- package/dist/types/atoms/CentralModal/index.d.ts +3 -0
- package/dist/types/atoms/CentralModal/index.d.ts.map +1 -0
- package/dist/types/atoms/CircleImage/index.d.ts +13 -0
- package/dist/types/atoms/CircleImage/index.d.ts.map +1 -0
- package/dist/types/atoms/CodePreview/index.d.ts +23 -0
- package/dist/types/atoms/CodePreview/index.d.ts.map +1 -0
- package/dist/types/atoms/ConditionalWrapper/index.d.ts +8 -0
- package/dist/types/atoms/ConditionalWrapper/index.d.ts.map +1 -0
- package/dist/types/atoms/Containers/index.d.ts +3 -0
- package/dist/types/atoms/Containers/index.d.ts.map +1 -0
- package/dist/types/atoms/Containers/styles.d.ts +87 -0
- package/dist/types/atoms/Containers/styles.d.ts.map +1 -0
- package/dist/types/atoms/DivInput/index.d.ts +18 -0
- package/dist/types/atoms/DivInput/index.d.ts.map +1 -0
- package/dist/types/atoms/Form/Form.d.ts +15 -0
- package/dist/types/atoms/Form/Form.d.ts.map +1 -0
- package/dist/types/atoms/Form/index.d.ts +13 -0
- package/dist/types/atoms/Form/index.d.ts.map +1 -0
- package/dist/types/atoms/FormLabel/index.d.ts +13 -0
- package/dist/types/atoms/FormLabel/index.d.ts.map +1 -0
- package/dist/types/atoms/FullScreenModal/index.d.ts +3 -0
- package/dist/types/atoms/FullScreenModal/index.d.ts.map +1 -0
- package/dist/types/atoms/Header/index.d.ts +3 -0
- package/dist/types/atoms/Header/index.d.ts.map +1 -0
- package/dist/types/atoms/Header/styles.d.ts +18 -0
- package/dist/types/atoms/Header/styles.d.ts.map +1 -0
- package/dist/types/atoms/Icons/index.d.ts +28 -0
- package/dist/types/atoms/Icons/index.d.ts.map +1 -0
- package/dist/types/atoms/Input/index.d.ts +3 -0
- package/dist/types/atoms/Input/index.d.ts.map +1 -0
- package/dist/types/atoms/Input/styles.d.ts +20 -0
- package/dist/types/atoms/Input/styles.d.ts.map +1 -0
- package/dist/types/atoms/Link/index.d.ts +3 -0
- package/dist/types/atoms/Link/index.d.ts.map +1 -0
- package/dist/types/atoms/Link/styles.d.ts +133 -0
- package/dist/types/atoms/Link/styles.d.ts.map +1 -0
- package/dist/types/atoms/Loading/index.d.ts +21 -0
- package/dist/types/atoms/Loading/index.d.ts.map +1 -0
- package/dist/types/atoms/Loading/styles.d.ts +29 -0
- package/dist/types/atoms/Loading/styles.d.ts.map +1 -0
- package/dist/types/atoms/Logo/index.d.ts +3 -0
- package/dist/types/atoms/Logo/index.d.ts.map +1 -0
- package/dist/types/atoms/Pagination/index.d.ts +9 -0
- package/dist/types/atoms/Pagination/index.d.ts.map +1 -0
- package/dist/types/atoms/Pagination/styles.d.ts +38 -0
- package/dist/types/atoms/Pagination/styles.d.ts.map +1 -0
- package/dist/types/atoms/ProgressBar/index.d.ts +13 -0
- package/dist/types/atoms/ProgressBar/index.d.ts.map +1 -0
- package/dist/types/atoms/Radio/index.d.ts +12 -0
- package/dist/types/atoms/Radio/index.d.ts.map +1 -0
- package/dist/types/atoms/Separator/index.d.ts +12 -0
- package/dist/types/atoms/Separator/index.d.ts.map +1 -0
- package/dist/types/atoms/Submit/index.d.ts +10 -0
- package/dist/types/atoms/Submit/index.d.ts.map +1 -0
- package/dist/types/atoms/Switch/index.d.ts +12 -0
- package/dist/types/atoms/Switch/index.d.ts.map +1 -0
- package/dist/types/atoms/Switch/styles.d.ts +31 -0
- package/dist/types/atoms/Switch/styles.d.ts.map +1 -0
- package/dist/types/atoms/Tabs/index.d.ts +18 -0
- package/dist/types/atoms/Tabs/index.d.ts.map +1 -0
- package/dist/types/atoms/Tabs/styles.d.ts +40 -0
- package/dist/types/atoms/Tabs/styles.d.ts.map +1 -0
- package/dist/types/atoms/TextCheckbox/index.d.ts +9 -0
- package/dist/types/atoms/TextCheckbox/index.d.ts.map +1 -0
- package/dist/types/atoms/Textarea/index.d.ts +19 -0
- package/dist/types/atoms/Textarea/index.d.ts.map +1 -0
- package/dist/types/atoms/Toggle/index.d.ts +16 -0
- package/dist/types/atoms/Toggle/index.d.ts.map +1 -0
- package/dist/types/atoms/Toggle/styles.d.ts +32 -0
- package/dist/types/atoms/Toggle/styles.d.ts.map +1 -0
- package/dist/types/atoms/Tooltip/index.d.ts +15 -0
- package/dist/types/atoms/Tooltip/index.d.ts.map +1 -0
- package/dist/types/atoms/Tooltip/styles.d.ts +24 -0
- package/dist/types/atoms/Tooltip/styles.d.ts.map +1 -0
- package/dist/types/atoms/Typography/index.d.ts +3 -0
- package/dist/types/atoms/Typography/index.d.ts.map +1 -0
- package/dist/types/atoms/Typography/styles.d.ts +68 -0
- package/dist/types/atoms/Typography/styles.d.ts.map +1 -0
- package/dist/types/atoms/Validation/index.d.ts +9 -0
- package/dist/types/atoms/Validation/index.d.ts.map +1 -0
- package/dist/types/atoms/Validation/styles.d.ts +23 -0
- package/dist/types/atoms/Validation/styles.d.ts.map +1 -0
- package/dist/types/atoms/WideImage/index.d.ts +26 -0
- package/dist/types/atoms/WideImage/index.d.ts.map +1 -0
- package/dist/types/molecules/Badge/index.d.ts +25 -0
- package/dist/types/molecules/Badge/index.d.ts.map +1 -0
- package/dist/types/molecules/Button/index.d.ts +31 -0
- package/dist/types/molecules/Button/index.d.ts.map +1 -0
- package/dist/types/molecules/Button/styles.d.ts +15 -0
- package/dist/types/molecules/Button/styles.d.ts.map +1 -0
- package/dist/types/molecules/Card/index.d.ts +16 -0
- package/dist/types/molecules/Card/index.d.ts.map +1 -0
- package/dist/types/molecules/Card/styles.d.ts +70 -0
- package/dist/types/molecules/Card/styles.d.ts.map +1 -0
- package/dist/types/molecules/Carousel/index.d.ts +13 -0
- package/dist/types/molecules/Carousel/index.d.ts.map +1 -0
- package/dist/types/molecules/Carousel/styles.d.ts +31 -0
- package/dist/types/molecules/Carousel/styles.d.ts.map +1 -0
- package/dist/types/molecules/CodeView/highlight.d.ts +11 -0
- package/dist/types/molecules/CodeView/highlight.d.ts.map +1 -0
- package/dist/types/molecules/CodeView/index.d.ts +58 -0
- package/dist/types/molecules/CodeView/index.d.ts.map +1 -0
- package/dist/types/molecules/CodeView/styles.d.ts +44 -0
- package/dist/types/molecules/CodeView/styles.d.ts.map +1 -0
- package/dist/types/molecules/HtmlEditor/index.d.ts +16 -0
- package/dist/types/molecules/HtmlEditor/index.d.ts.map +1 -0
- package/dist/types/molecules/HtmlEditor/styles.d.ts +12 -0
- package/dist/types/molecules/HtmlEditor/styles.d.ts.map +1 -0
- package/dist/types/molecules/SearchInput/index.d.ts +11 -0
- package/dist/types/molecules/SearchInput/index.d.ts.map +1 -0
- package/dist/types/molecules/SearchInput/styles.d.ts +24 -0
- package/dist/types/molecules/SearchInput/styles.d.ts.map +1 -0
- package/dist/types/molecules/Select/index.d.ts +18 -0
- package/dist/types/molecules/Select/index.d.ts.map +1 -0
- package/dist/types/molecules/Select/styles.d.ts +51 -0
- package/dist/types/molecules/Select/styles.d.ts.map +1 -0
- package/dist/types/molecules/StatusLabel/index.d.ts +51 -0
- package/dist/types/molecules/StatusLabel/index.d.ts.map +1 -0
- package/dist/types/molecules/StatusLabel/styles.d.ts +18 -0
- package/dist/types/molecules/StatusLabel/styles.d.ts.map +1 -0
- package/dist/types/molecules/Table/TableCels/BrandCell.d.ts +9 -0
- package/dist/types/molecules/Table/TableCels/BrandCell.d.ts.map +1 -0
- package/dist/types/molecules/Table/TableCels/NavigationCell.d.ts +8 -0
- package/dist/types/molecules/Table/TableCels/NavigationCell.d.ts.map +1 -0
- package/dist/types/molecules/Table/TableCels/StatusCell.d.ts +9 -0
- package/dist/types/molecules/Table/TableCels/StatusCell.d.ts.map +1 -0
- package/dist/types/molecules/Table/TableCels/TextCell.d.ts +9 -0
- package/dist/types/molecules/Table/TableCels/TextCell.d.ts.map +1 -0
- package/dist/types/molecules/Table/TableCels/index.d.ts +7 -0
- package/dist/types/molecules/Table/TableCels/index.d.ts.map +1 -0
- package/dist/types/molecules/Table/TableCels/styles.d.ts +29 -0
- package/dist/types/molecules/Table/TableCels/styles.d.ts.map +1 -0
- package/dist/types/molecules/Table/index.d.ts +27 -0
- package/dist/types/molecules/Table/index.d.ts.map +1 -0
- package/dist/types/molecules/Table/styles.d.ts +15 -0
- package/dist/types/molecules/Table/styles.d.ts.map +1 -0
- package/dist/types/molecules/TokenInputField/index.d.ts +15 -0
- package/dist/types/molecules/TokenInputField/index.d.ts.map +1 -0
- package/dist/types/molecules/TokenInputField/styles.d.ts +24 -0
- package/dist/types/molecules/TokenInputField/styles.d.ts.map +1 -0
- package/dist/types/shared/modals/index.d.ts +33 -0
- package/dist/types/shared/modals/index.d.ts.map +1 -0
- package/dist/types/shared/modals/styles.d.ts +52 -0
- package/dist/types/shared/modals/styles.d.ts.map +1 -0
- package/dist/types/shared/modals/useModal.d.ts +4 -0
- package/dist/types/shared/modals/useModal.d.ts.map +1 -0
- package/dist/types/shared/report-ui/DecisionPanel.d.ts +53 -0
- package/dist/types/shared/report-ui/DecisionPanel.d.ts.map +1 -0
- package/dist/types/shared/report-ui/DecisionPanel.styles.d.ts +31 -0
- package/dist/types/shared/report-ui/DecisionPanel.styles.d.ts.map +1 -0
- package/dist/types/shared/report-ui/Shell.styles.d.ts +26 -0
- package/dist/types/shared/report-ui/Shell.styles.d.ts.map +1 -0
- package/dist/types/shared/report-ui/index.d.ts +6 -0
- package/dist/types/shared/report-ui/index.d.ts.map +1 -0
- package/dist/types/shared/report-ui/ui.d.ts +30 -0
- package/dist/types/shared/report-ui/ui.d.ts.map +1 -0
- package/dist/types/shared/report-ui/ui.styles.d.ts +50 -0
- package/dist/types/shared/report-ui/ui.styles.d.ts.map +1 -0
- package/dist/types/shared/toasts/index.d.ts +23 -0
- package/dist/types/shared/toasts/index.d.ts.map +1 -0
- package/dist/types/shared/toasts/styles.d.ts +18 -0
- package/dist/types/shared/toasts/styles.d.ts.map +1 -0
- package/dist/types/textures/Cloud/index.d.ts +29 -0
- package/dist/types/textures/Cloud/index.d.ts.map +1 -0
- package/dist/types/textures/Paper/index.d.ts +8 -0
- package/dist/types/textures/Paper/index.d.ts.map +1 -0
- package/dist/types/textures/index.d.ts +4 -0
- package/dist/types/textures/index.d.ts.map +1 -0
- package/dist/typography.js +81 -0
- package/dist/validation.js +20 -0
- package/dist/wide-image.js +94 -0
- package/package.json +443 -4
package/dist/select.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
2
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
|
+
import a, { css as o } from "styled-components";
|
|
4
|
+
import { Input as s } from "@md-code/components/input";
|
|
5
|
+
import { LucideIcon as c } from "@md-code/components/icons";
|
|
6
|
+
// molecules/Select/styles.ts
|
|
7
|
+
var l = a.div`
|
|
8
|
+
position: relative;
|
|
9
|
+
`, u = a.div`
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
padding: ${({ theme: e }) => e.offsets.elementContent};
|
|
14
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
15
|
+
border-style: solid;
|
|
16
|
+
border-width: ${({ theme: e }) => e.border.size};
|
|
17
|
+
border-color: ${({ theme: e }) => e.colors.sectionContent};
|
|
18
|
+
color: ${({ theme: e }) => e.colors.sectionContent};
|
|
19
|
+
background-color: ${({ theme: e }) => e.colors.section};
|
|
20
|
+
/*
|
|
21
|
+
* effects.texture is one string per theme (README §4.1, §5.3): noise themes
|
|
22
|
+
* supply a url() for background-image, glass themes supply blur() for
|
|
23
|
+
* backdrop-filter. The control cannot know which theme is active, so it
|
|
24
|
+
* hands the value to BOTH properties; each property keeps only the value it
|
|
25
|
+
* understands and ignores the other (blur() in background-image computes to
|
|
26
|
+
* none, and url() left in backdrop-filter is visually inert — verified in
|
|
27
|
+
* Chromium). Both themes therefore texture the control without a name check.
|
|
28
|
+
*/
|
|
29
|
+
background-image: ${({ theme: e }) => e.effects.texture};
|
|
30
|
+
backdrop-filter: ${({ theme: e }) => e.effects.texture};
|
|
31
|
+
clip-path: ${({ theme: e }) => e.geometry.shape};
|
|
32
|
+
box-shadow: ${({ theme: e }) => e.shadows.section};
|
|
33
|
+
cursor: ${({ $readOnly: e }) => e ? "default" : "pointer"};
|
|
34
|
+
transition: box-shadow ${({ theme: e }) => e.animation.speed.fast} ${({ theme: e }) => e.animation.easing.standard};
|
|
35
|
+
|
|
36
|
+
/* The former glow collapses into one weak accent glow (wave decision В2). */
|
|
37
|
+
&:hover {
|
|
38
|
+
box-shadow:
|
|
39
|
+
${({ theme: e }) => e.shadows.section},
|
|
40
|
+
${({ theme: e }) => `0 0 10px color-mix(in srgb, ${e.colors.highlighted} 20%, transparent)`};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${({ $readOnly: e, theme: t }) => e && o`${t.effects.interaction.disabled}`}
|
|
44
|
+
`, d = a.ul`
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 100%;
|
|
47
|
+
left: 0;
|
|
48
|
+
width: 100%;
|
|
49
|
+
border: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
50
|
+
max-height: calc(${({ theme: e }) => e.elements.form.height} * 6);
|
|
51
|
+
overflow-y: auto;
|
|
52
|
+
background-color: ${({ theme: e }) => e.colors.section};
|
|
53
|
+
/*
|
|
54
|
+
* effects.texture is one string per theme (README §4.1, §5.3): noise themes
|
|
55
|
+
* supply a url() for background-image, glass themes supply blur() for
|
|
56
|
+
* backdrop-filter. The list cannot know which theme is active, so it hands
|
|
57
|
+
* the value to BOTH properties; each property keeps only the value it
|
|
58
|
+
* understands and ignores the other (blur() in background-image computes to
|
|
59
|
+
* none, and url() left in backdrop-filter is visually inert — verified in
|
|
60
|
+
* Chromium). Both themes therefore texture the list without a name check.
|
|
61
|
+
*/
|
|
62
|
+
background-image: ${({ theme: e }) => e.effects.texture};
|
|
63
|
+
backdrop-filter: ${({ theme: e }) => e.effects.texture};
|
|
64
|
+
list-style-type: none;
|
|
65
|
+
padding: 0;
|
|
66
|
+
margin: 0;
|
|
67
|
+
margin-top: ${({ theme: e }) => e.offsets.betweenElements};
|
|
68
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
69
|
+
box-shadow: ${({ theme: e }) => e.shadows.notification};
|
|
70
|
+
z-index: ${({ theme: e }) => e.zIndex.alert};
|
|
71
|
+
`, f = a.li`
|
|
72
|
+
padding: ${({ theme: e }) => e.offsets.elementContent};
|
|
73
|
+
background-color: ${({ $highlighted: e, theme: t }) => e ? t.colors.highlighted : t.colors.section};
|
|
74
|
+
color: ${({ $highlighted: e, theme: t }) => e ? t.colors.highlightedContent : t.colors.sectionContent};
|
|
75
|
+
font-size: ${({ theme: e }) => e.font.sizes.regular};
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
|
|
78
|
+
&:hover {
|
|
79
|
+
background-color: ${({ theme: e }) => e.colors.highlighted};
|
|
80
|
+
color: ${({ theme: e }) => e.colors.highlightedContent};
|
|
81
|
+
}
|
|
82
|
+
`, p = a.div`
|
|
83
|
+
color: ${({ theme: e }) => e.colors.sectionContent};
|
|
84
|
+
display: flex;
|
|
85
|
+
gap: ${({ theme: e }) => e.offsets.betweenElements};
|
|
86
|
+
padding-left: ${({ theme: e }) => e.offsets.betweenElements};
|
|
87
|
+
`, m = a.li`
|
|
88
|
+
padding: ${({ theme: e }) => e.offsets.elementContent};
|
|
89
|
+
color: ${({ theme: e }) => e.colors.sectionContent};
|
|
90
|
+
`, h = a.button`
|
|
91
|
+
background: none;
|
|
92
|
+
border: none;
|
|
93
|
+
cursor: ${({ $readOnly: e }) => e ? "default" : "pointer"};
|
|
94
|
+
margin-left: ${({ theme: e }) => e.offsets.betweenElements};
|
|
95
|
+
font-size: ${({ theme: e }) => e.font.sizes.regular};
|
|
96
|
+
color: ${({ theme: e }) => e.colors.sectionContent};
|
|
97
|
+
`, g = a.div`
|
|
98
|
+
width: 0;
|
|
99
|
+
border-left: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
100
|
+
margin-bottom: ${({ theme: e }) => e.offsets.betweenElements};
|
|
101
|
+
margin-top: ${({ theme: e }) => e.offsets.betweenElements};
|
|
102
|
+
box-sizing: border-box;
|
|
103
|
+
`, _ = a.span`
|
|
104
|
+
color: ${({ theme: e }) => e.colors.sectionContent};
|
|
105
|
+
`, v = ({ options: a, value: o, onChange: v, isClearable: y = !1, readOnly: b = !1, placeholder: x = "Select an option", isSearchable: S = !1 }) => {
|
|
106
|
+
let [C, w] = n(!1), [T, E] = n(0), [D, O] = n(""), k = t(null), A = () => {
|
|
107
|
+
b || (w(!C), O(""));
|
|
108
|
+
}, j = (e) => {
|
|
109
|
+
b || (v(e), w(!1));
|
|
110
|
+
}, M = (e) => {
|
|
111
|
+
e.stopPropagation(), b || (v(null), w(!1));
|
|
112
|
+
}, N = (e) => {
|
|
113
|
+
if (!b) switch (e.key) {
|
|
114
|
+
case "ArrowDown":
|
|
115
|
+
E((e) => Math.min(e + 1, P.length - 1));
|
|
116
|
+
break;
|
|
117
|
+
case "ArrowUp":
|
|
118
|
+
E((e) => Math.max(e - 1, 0));
|
|
119
|
+
break;
|
|
120
|
+
case "Enter":
|
|
121
|
+
C && P[T] && j(P[T]);
|
|
122
|
+
break;
|
|
123
|
+
case "Escape": w(!1);
|
|
124
|
+
}
|
|
125
|
+
}, P = a.filter((e) => e.label?.toLowerCase()?.includes(D?.toLowerCase()));
|
|
126
|
+
return e(() => {
|
|
127
|
+
let e = (e) => {
|
|
128
|
+
k.current && !k.current.contains(e.target) && w(!1);
|
|
129
|
+
};
|
|
130
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
131
|
+
}, []), /* @__PURE__ */ i(l, {
|
|
132
|
+
ref: k,
|
|
133
|
+
children: [/* @__PURE__ */ i(u, {
|
|
134
|
+
onClick: A,
|
|
135
|
+
onKeyDown: N,
|
|
136
|
+
tabIndex: 0,
|
|
137
|
+
$readOnly: b,
|
|
138
|
+
children: [o ? o.label : /* @__PURE__ */ r(_, { children: x }), /* @__PURE__ */ i(p, { children: [
|
|
139
|
+
y && o && /* @__PURE__ */ r(h, {
|
|
140
|
+
onClick: M,
|
|
141
|
+
$readOnly: b,
|
|
142
|
+
children: /* @__PURE__ */ r(c, { name: "X" })
|
|
143
|
+
}),
|
|
144
|
+
/* @__PURE__ */ r(g, {}),
|
|
145
|
+
/* @__PURE__ */ r("span", { children: C ? /* @__PURE__ */ r(c, { name: "ChevronUp" }) : /* @__PURE__ */ r(c, { name: "ChevronDown" }) })
|
|
146
|
+
] })]
|
|
147
|
+
}), C && !b && /* @__PURE__ */ i(d, { children: [S && /* @__PURE__ */ r(s, {
|
|
148
|
+
type: "text",
|
|
149
|
+
value: D,
|
|
150
|
+
onKeyDown: N,
|
|
151
|
+
onChange: (e) => O(e.target.value),
|
|
152
|
+
placeholder: "Search..."
|
|
153
|
+
}), P?.length ? P.map((e, t) => /* @__PURE__ */ r(f, {
|
|
154
|
+
$highlighted: T === t,
|
|
155
|
+
onClick: () => j(e),
|
|
156
|
+
onMouseEnter: () => E(t),
|
|
157
|
+
children: e.label
|
|
158
|
+
}, e.value)) : /* @__PURE__ */ r(m, { children: "No options found" })] })]
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
export { v as Select, v as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import e from "styled-components";
|
|
2
|
+
// atoms/Separator/index.tsx
|
|
3
|
+
var t = e.div`
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 0;
|
|
6
|
+
border-top: ${({ theme: e }) => e.border.size} solid
|
|
7
|
+
color-mix(in srgb, ${({ theme: e }) => e.colors.sectionContent} 25%, transparent);
|
|
8
|
+
margin: ${({ theme: e }) => e.offsets.section} 0;
|
|
9
|
+
`;
|
|
10
|
+
export { t as Separator };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
3
|
+
import n from "styled-components";
|
|
4
|
+
import { Loader as r } from "@md-code/components/loading";
|
|
5
|
+
// molecules/StatusLabel/styles.ts
|
|
6
|
+
var i = n.div`
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: ${({ theme: e }) => e.offsets.elementContent};
|
|
10
|
+
position: relative;
|
|
11
|
+
padding: ${({ theme: e }) => e.offsets.elementContent};
|
|
12
|
+
/* The badge is a section surface separated from its neighbours by a border
|
|
13
|
+
in the section content colour (В3); the radius is the theme's. */
|
|
14
|
+
border: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
15
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
16
|
+
background-color: ${({ $status: e = "", theme: t }) => t.colors.status?.[e]?.background ?? t.colors.section};
|
|
17
|
+
color: ${({ $status: e = "", theme: t }) => t.colors.status?.[e]?.content ?? t.colors.sectionContent};
|
|
18
|
+
`, a = n.div`
|
|
19
|
+
width: ${({ theme: e }) => e.elements.icons.width};
|
|
20
|
+
height: ${({ theme: e }) => e.elements.icons.height};
|
|
21
|
+
/* The dot's silhouette is the theme's surface radius: viking (0) is square,
|
|
22
|
+
glass (12px, clamped to half the 20px dot) is round. */
|
|
23
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
24
|
+
background-color: currentColor;
|
|
25
|
+
/* The baseline viking dot carried a weak accent glow; glow is a shadow in
|
|
26
|
+
the accent colour, derived — the same pattern the Button uses (README §5.3).
|
|
27
|
+
The blur radius is derived from the dot size (half of it), not stored. */
|
|
28
|
+
box-shadow: 0 0 calc(${({ theme: e }) => e.elements.icons.width} / 2) color-mix(in srgb, ${({ theme: e }) => e.colors.highlighted} 20%, transparent);
|
|
29
|
+
position: relative;
|
|
30
|
+
flex-shrink: 0;
|
|
31
|
+
`, o = {
|
|
32
|
+
not_calculated: {
|
|
33
|
+
label: "Not Calculated",
|
|
34
|
+
status: "neutral"
|
|
35
|
+
},
|
|
36
|
+
queued: {
|
|
37
|
+
label: "Processing",
|
|
38
|
+
status: "pending"
|
|
39
|
+
},
|
|
40
|
+
processing: {
|
|
41
|
+
label: "Processing",
|
|
42
|
+
status: "pending"
|
|
43
|
+
},
|
|
44
|
+
failed: {
|
|
45
|
+
label: "Failed",
|
|
46
|
+
status: "failed"
|
|
47
|
+
},
|
|
48
|
+
success: {
|
|
49
|
+
label: "Success",
|
|
50
|
+
status: "success"
|
|
51
|
+
}
|
|
52
|
+
}, s = ({ label: n, $status: s, isLoading: c, state: l }) => {
|
|
53
|
+
let u = l ? o[l] : void 0, d = n, f = s, p = c;
|
|
54
|
+
return l && u ? (d === void 0 && (d = u.label), f === void 0 && (f = u.status), (l === "queued" || l === "processing") && (p = !0)) : l && d === void 0 && (d = l), /* @__PURE__ */ t(i, {
|
|
55
|
+
$status: f,
|
|
56
|
+
children: [p ? /* @__PURE__ */ e(r, { $size: "small" }) : /* @__PURE__ */ e(a, { className: "status-dot" }), /* @__PURE__ */ e("span", { children: d || "Unknown" })]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
export { s as StatusLabel };
|
package/dist/submit.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { a as e, r as t } from "./dist-DD9Lv2Ja.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
import r from "styled-components";
|
|
5
|
+
// atoms/Submit/index.tsx
|
|
6
|
+
var i = r.input`
|
|
7
|
+
display: block;
|
|
8
|
+
${({ $fullWidth: e }) => e ? "width: 100%;" : ""}
|
|
9
|
+
height: ${({ theme: e }) => e.elements.form.height};
|
|
10
|
+
margin-right: ${t};
|
|
11
|
+
margin-bottom: ${e};
|
|
12
|
+
padding: ${({ theme: e }) => `${e.offsets.elementContent} calc(${e.offsets.elementContent} * 2)`};
|
|
13
|
+
color: ${({ theme: e }) => e.colors.highlightedContent};
|
|
14
|
+
font-family: ${({ theme: e }) => e.font.family.text};
|
|
15
|
+
font-size: ${({ theme: e }) => e.font.sizes.regular};
|
|
16
|
+
font-weight: ${({ theme: e }) => e.font.weight.text};
|
|
17
|
+
text-transform: ${({ theme: e }) => e.font.transform.text};
|
|
18
|
+
letter-spacing: ${({ theme: e }) => e.font.spacing};
|
|
19
|
+
background-color: ${({ theme: e }) => e.colors.highlighted};
|
|
20
|
+
|
|
21
|
+
/*
|
|
22
|
+
* One texture string handed to both texture properties (README §4.1, §5.3):
|
|
23
|
+
* noise lands in background-image, glass blur in backdrop-filter.
|
|
24
|
+
*/
|
|
25
|
+
background-image: ${({ theme: e }) => e.effects.texture};
|
|
26
|
+
backdrop-filter: ${({ theme: e }) => e.effects.texture};
|
|
27
|
+
border: none;
|
|
28
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
29
|
+
clip-path: ${({ theme: e }) => e.geometry.shape};
|
|
30
|
+
box-shadow: ${({ theme: e }) => e.shadows.section};
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
position: relative;
|
|
33
|
+
transition: all ${({ theme: e }) => e.animation.speed.fast} ${({ theme: e }) => e.animation.easing.standard};
|
|
34
|
+
|
|
35
|
+
&:hover {
|
|
36
|
+
${({ theme: e }) => e.effects.interaction.hover}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:active {
|
|
40
|
+
${({ theme: e }) => e.effects.interaction.active}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:focus-visible {
|
|
44
|
+
${({ theme: e }) => e.effects.interaction.focus}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:disabled {
|
|
48
|
+
${({ theme: e }) => e.effects.interaction.disabled}
|
|
49
|
+
}
|
|
50
|
+
`, a = ({ $offsetBottom: e, $offsetRight: t, $fullWidth: r, ...a }) => /* @__PURE__ */ n(i, {
|
|
51
|
+
...a,
|
|
52
|
+
$offsetBottom: e,
|
|
53
|
+
$offsetRight: t,
|
|
54
|
+
$fullWidth: r,
|
|
55
|
+
type: "submit"
|
|
56
|
+
});
|
|
57
|
+
export { a as Submit };
|
package/dist/switch.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
3
|
+
import n from "styled-components";
|
|
4
|
+
// atoms/Switch/styles.ts
|
|
5
|
+
var r = n.label`
|
|
6
|
+
position: relative;
|
|
7
|
+
display: inline-block;
|
|
8
|
+
width: calc(${({ theme: e }) => e.elements.form.height} * 0.88);
|
|
9
|
+
height: calc(${({ theme: e }) => e.elements.form.height} * 0.48);
|
|
10
|
+
cursor: pointer;
|
|
11
|
+
background-color: ${({ theme: e }) => e.colors.overlay};
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* One texture string per theme handed to both texture properties (README
|
|
15
|
+
* §4.1, §5.3): the track keeps a noise url() or a glass blur(), whichever its
|
|
16
|
+
* theme supplies, without a name check.
|
|
17
|
+
*/
|
|
18
|
+
background-image: ${({ theme: e }) => e.effects.texture};
|
|
19
|
+
backdrop-filter: ${({ theme: e }) => e.effects.texture};
|
|
20
|
+
/*
|
|
21
|
+
* One shared mute for every muted border in the form wave: 25% of the
|
|
22
|
+
* content colour over the surface matches the legacy disabled outline
|
|
23
|
+
* (#374b4e on #0b0e0f) without reading a legacy palette token (§5.1).
|
|
24
|
+
*/
|
|
25
|
+
border: ${({ theme: e }) => e.border.size} solid
|
|
26
|
+
color-mix(in srgb, ${({ theme: e }) => e.colors.sectionContent} 25%, transparent);
|
|
27
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
28
|
+
clip-path: ${({ theme: e }) => e.geometry.shape};
|
|
29
|
+
transition: background-color ${({ theme: e }) => e.animation.speed.slow} ${({ theme: e }) => e.animation.easing.standard};
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
${({ theme: e }) => e.effects.interaction.hover}
|
|
33
|
+
}
|
|
34
|
+
`, i = n.input`
|
|
35
|
+
opacity: 0;
|
|
36
|
+
width: 0;
|
|
37
|
+
height: 0;
|
|
38
|
+
|
|
39
|
+
&:checked + .switch-slider {
|
|
40
|
+
background-color: ${({ theme: e }) => e.colors.highlighted};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:focus + .switch-slider {
|
|
44
|
+
box-shadow: ${({ theme: e }) => e.shadows.section};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&:checked + .switch-slider::before {
|
|
48
|
+
transform: translateX(
|
|
49
|
+
calc(${({ theme: e }) => e.elements.form.height} * 0.4)
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
`, a = n.span`
|
|
53
|
+
position: absolute;
|
|
54
|
+
inset: 0;
|
|
55
|
+
background-color: transparent;
|
|
56
|
+
transition: background-color ${({ theme: e }) => e.animation.speed.slow} ${({ theme: e }) => e.animation.easing.standard};
|
|
57
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
58
|
+
|
|
59
|
+
/* The Knob */
|
|
60
|
+
&::before {
|
|
61
|
+
position: absolute;
|
|
62
|
+
content: "";
|
|
63
|
+
height: calc(${({ theme: e }) => e.elements.form.height} * 0.4);
|
|
64
|
+
width: calc(${({ theme: e }) => e.elements.form.height} * 0.4);
|
|
65
|
+
left: ${({ theme: e }) => e.offsets.elementContent};
|
|
66
|
+
bottom: ${({ theme: e }) => e.offsets.elementContent};
|
|
67
|
+
background-color: ${({ theme: e }) => e.colors.sectionContent};
|
|
68
|
+
transition: transform ${({ theme: e }) => e.animation.speed.slow} ${({ theme: e }) => e.animation.easing.standard};
|
|
69
|
+
border-radius: 50%;
|
|
70
|
+
}
|
|
71
|
+
`, o = n.div`
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
gap: ${({ theme: e }) => e.offsets.betweenElements};
|
|
75
|
+
`, s = n.span`
|
|
76
|
+
font-family: ${({ theme: e }) => e.font.family.text};
|
|
77
|
+
font-size: ${({ theme: e }) => e.font.sizes.regular};
|
|
78
|
+
color: ${({ theme: e }) => e.colors.sectionContent};
|
|
79
|
+
`, c = ({ checked: n, onChange: c, leftLabel: l, rightLabel: u, size: d = "default", className: f }) => /* @__PURE__ */ t(o, {
|
|
80
|
+
className: f,
|
|
81
|
+
children: [
|
|
82
|
+
l && /* @__PURE__ */ e(s, { children: l }),
|
|
83
|
+
/* @__PURE__ */ t(r, {
|
|
84
|
+
$size: d,
|
|
85
|
+
children: [/* @__PURE__ */ e(i, {
|
|
86
|
+
type: "checkbox",
|
|
87
|
+
checked: n,
|
|
88
|
+
onChange: (e) => c(e.target.checked),
|
|
89
|
+
$size: d
|
|
90
|
+
}), /* @__PURE__ */ e(a, {
|
|
91
|
+
className: "switch-slider",
|
|
92
|
+
$size: d
|
|
93
|
+
})]
|
|
94
|
+
}),
|
|
95
|
+
u && /* @__PURE__ */ e(s, { children: u })
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
export { c as Switch };
|
package/dist/table.js
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
3
|
+
import n from "styled-components";
|
|
4
|
+
import { Select as r } from "@md-code/components/select";
|
|
5
|
+
import { SubTitle as i } from "@md-code/components/typography";
|
|
6
|
+
import { Pagination as a } from "@md-code/components/pagination";
|
|
7
|
+
// molecules/Table/TableCels/styles.ts
|
|
8
|
+
var o = n.div`
|
|
9
|
+
padding: ${({ theme: e }) => e.offsets.elementContent};
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: ${({ $align: e }) => e === "center" ? "center" : e === "right" ? "flex-end" : "flex-start"};
|
|
13
|
+
color: inherit;
|
|
14
|
+
|
|
15
|
+
a {
|
|
16
|
+
color: inherit;
|
|
17
|
+
text-decoration: underline;
|
|
18
|
+
opacity: 0.8;
|
|
19
|
+
|
|
20
|
+
&:hover {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`, s = n.th`
|
|
25
|
+
padding: ${({ theme: e }) => e.offsets.elementContent};
|
|
26
|
+
text-align: ${({ $align: e }) => e || "left"};
|
|
27
|
+
font-weight: 600;
|
|
28
|
+
color: ${({ theme: e }) => e.colors.sectionContent};
|
|
29
|
+
border-bottom: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
30
|
+
`;
|
|
31
|
+
n(o)`
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
text-overflow: ellipsis;
|
|
35
|
+
display: block;
|
|
36
|
+
`;
|
|
37
|
+
// molecules/Table/styles.ts
|
|
38
|
+
var c = n.div`
|
|
39
|
+
display: grid;
|
|
40
|
+
grid-template-columns: ${({ $colsTemplate: e }) => e};
|
|
41
|
+
width: 100%;
|
|
42
|
+
background-color: ${({ theme: e }) => e.colors.section};
|
|
43
|
+
/*
|
|
44
|
+
* effects.texture is one string per theme (README §4.1, §5.3): noise themes
|
|
45
|
+
* supply a url() for background-image, glass themes supply blur() for
|
|
46
|
+
* backdrop-filter. The grid cannot know which theme is active, so it hands
|
|
47
|
+
* the value to BOTH properties; each property keeps only the value it
|
|
48
|
+
* understands and ignores the other (blur() in background-image computes to
|
|
49
|
+
* none, and url() left in backdrop-filter is visually inert — verified in
|
|
50
|
+
* Chromium). Both themes therefore texture the grid without a name check.
|
|
51
|
+
*/
|
|
52
|
+
background-image: ${({ theme: e }) => e.effects.texture};
|
|
53
|
+
backdrop-filter: ${({ theme: e }) => e.effects.texture};
|
|
54
|
+
border: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
55
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
56
|
+
box-shadow: ${({ theme: e }) => e.shadows.section};
|
|
57
|
+
overflow: hidden;
|
|
58
|
+
|
|
59
|
+
/* The header sits on the same section surface; a content-colour underline
|
|
60
|
+
separates it from the body (В1, В3). */
|
|
61
|
+
.header-cell {
|
|
62
|
+
background-color: ${({ theme: e }) => e.colors.section};
|
|
63
|
+
color: ${({ theme: e }) => e.colors.sectionContent};
|
|
64
|
+
font-family: ${({ theme: e }) => e.font.family.title};
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
text-transform: uppercase;
|
|
67
|
+
font-size: ${({ theme: e }) => e.font.sizes.small};
|
|
68
|
+
letter-spacing: ${({ theme: e }) => e.font.spacing};
|
|
69
|
+
border-bottom: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
70
|
+
padding: ${({ theme: e }) => e.offsets.elementContent};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Each body row is separated by a content-colour rule; hover dims it with
|
|
74
|
+
the overlay layer. */
|
|
75
|
+
& > div:not(.header-cell) {
|
|
76
|
+
border-bottom: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
77
|
+
transition: background ${({ theme: e }) => e.animation.speed.normal} ${({ theme: e }) => e.animation.easing.standard};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
& > div:not(.header-cell):hover {
|
|
81
|
+
background-color: ${({ theme: e }) => e.colors.overlay};
|
|
82
|
+
}
|
|
83
|
+
`, l = n.div`
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-content: flex-end;
|
|
86
|
+
padding: ${({ theme: e }) => e.offsets.elementContent} 0;
|
|
87
|
+
gap: ${({ theme: e }) => e.offsets.elementContent};
|
|
88
|
+
align-items: center;
|
|
89
|
+
`, u = ({ children: n, headerCols: o, colsTemplate: u, pagination: d, rowsPerPage: f }) => /* @__PURE__ */ t("div", { children: [/* @__PURE__ */ t(c, {
|
|
90
|
+
$colsTemplate: u,
|
|
91
|
+
children: [o?.map(({ text: n, sort: r = () => {}, isSortable: a, align: o }) => /* @__PURE__ */ t(s, {
|
|
92
|
+
onClick: r,
|
|
93
|
+
$align: o,
|
|
94
|
+
className: "header-cell",
|
|
95
|
+
children: [/* @__PURE__ */ e(i, { children: n }), a && "⟠"]
|
|
96
|
+
}, n)), n]
|
|
97
|
+
}), (d || f) && /* @__PURE__ */ t(l, { children: [d && /* @__PURE__ */ e(a, {
|
|
98
|
+
totalPages: d.totalPages,
|
|
99
|
+
currentPage: d.current,
|
|
100
|
+
onPageChange: (e) => d.changePage(e)
|
|
101
|
+
}), f && /* @__PURE__ */ e(r, {
|
|
102
|
+
value: f.options[0],
|
|
103
|
+
options: f.options,
|
|
104
|
+
onChange: (e) => {
|
|
105
|
+
e && f?.changeElementsPerPage(Number(e.value));
|
|
106
|
+
}
|
|
107
|
+
})] })] });
|
|
108
|
+
export { u as default };
|
package/dist/tabs.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { useState as e } from "react";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import r, { css as i } from "styled-components";
|
|
4
|
+
// atoms/Tabs/styles.ts
|
|
5
|
+
var a = i`
|
|
6
|
+
height: 100vh;
|
|
7
|
+
padding-top: ${({ theme: e }) => e.elements.header.height};
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
`, o = i`
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-columns: calc(${({ theme: e }) => e.elements.form.height} * 5) 1fr;
|
|
12
|
+
${({ $expanded: e }) => e && a}
|
|
13
|
+
min-height: 0;
|
|
14
|
+
border: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
15
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
16
|
+
background: ${({ theme: e }) => e.colors.section};
|
|
17
|
+
/*
|
|
18
|
+
* effects.texture is one string per theme (README §4.1, §5.3): noise themes
|
|
19
|
+
* supply a url() for background-image, glass themes supply blur() for
|
|
20
|
+
* backdrop-filter. The shell cannot know which theme is active, so it hands
|
|
21
|
+
* the value to BOTH properties; each property keeps only the value it
|
|
22
|
+
* understands and ignores the other (blur() in background-image computes to
|
|
23
|
+
* none, and url() left in backdrop-filter is visually inert — verified in
|
|
24
|
+
* Chromium). Both themes therefore texture the shell without a name check.
|
|
25
|
+
*/
|
|
26
|
+
background-image: ${({ theme: e }) => e.effects.texture};
|
|
27
|
+
backdrop-filter: ${({ theme: e }) => e.effects.texture};
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
`, s = i`
|
|
30
|
+
border-right: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
31
|
+
background: ${({ theme: e }) => e.colors.overlay};
|
|
32
|
+
overflow-y: auto;
|
|
33
|
+
height: 100%;
|
|
34
|
+
min-width: calc(${({ theme: e }) => e.elements.form.height} * 5);
|
|
35
|
+
`, c = i`
|
|
36
|
+
border-bottom: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.sectionContent};
|
|
37
|
+
background: ${({ theme: e }) => e.colors.overlay};
|
|
38
|
+
`, l = i`
|
|
39
|
+
min-width: ${({ theme: e }) => e.elements.form.minWidth};
|
|
40
|
+
`, u = i`
|
|
41
|
+
border-bottom: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.highlighted};
|
|
42
|
+
`, d = i`
|
|
43
|
+
background-color: ${({ theme: e }) => e.colors.overlay};
|
|
44
|
+
`, f = i`
|
|
45
|
+
${d}
|
|
46
|
+
border-left: ${({ theme: e }) => e.border.size} solid ${({ theme: e }) => e.colors.highlighted};
|
|
47
|
+
`, p = i`
|
|
48
|
+
height: 100%;
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
`, m = i`
|
|
52
|
+
font-weight: bold;
|
|
53
|
+
${({ $orientation: e }) => e === "horizontal" && u}
|
|
54
|
+
${({ $orientation: e }) => e === "vertical" && f}
|
|
55
|
+
`, h = r.div`
|
|
56
|
+
width: 100%;
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: ${({ $orientation: e }) => e === "vertical" ? "row" : "column"};
|
|
59
|
+
${({ $orientation: e }) => e === "vertical" && o}
|
|
60
|
+
`, g = r.div`
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-direction: ${({ $orientation: e }) => e === "vertical" ? "column" : "row"};
|
|
63
|
+
${({ $orientation: e }) => e === "vertical" && s}
|
|
64
|
+
${({ $orientation: e }) => e === "horizontal" && c}
|
|
65
|
+
`, _ = r.button`
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
padding: ${({ theme: e }) => e.offsets.elementContent};
|
|
68
|
+
background-color: transparent;
|
|
69
|
+
color: ${({ theme: e }) => e.colors.sectionContent};
|
|
70
|
+
border: none;
|
|
71
|
+
font-family: ${({ theme: e }) => e.font.family.text};
|
|
72
|
+
|
|
73
|
+
/* Label weight is component semantics: normal at rest, only the selected tab
|
|
74
|
+
* is bold (the theme's text weight would embolden every viking tab and lose
|
|
75
|
+
* the selected-only emphasis of the baseline, documented deviation). */
|
|
76
|
+
font-weight: normal;
|
|
77
|
+
text-transform: ${({ theme: e }) => e.font.transform.text};
|
|
78
|
+
border-radius: ${({ theme: e }) => e.border.radius};
|
|
79
|
+
text-align: left;
|
|
80
|
+
display: flex;
|
|
81
|
+
align-items: center;
|
|
82
|
+
justify-content: ${({ $orientation: e }) => e === "vertical" ? "flex-start" : "center"};
|
|
83
|
+
transition:
|
|
84
|
+
color ${({ theme: e }) => e.animation.speed.normal} ${({ theme: e }) => e.animation.easing.standard},
|
|
85
|
+
background-color ${({ theme: e }) => e.animation.speed.normal} ${({ theme: e }) => e.animation.easing.standard};
|
|
86
|
+
${({ $orientation: e }) => e === "horizontal" && l}
|
|
87
|
+
|
|
88
|
+
&:hover {
|
|
89
|
+
${d}
|
|
90
|
+
color: ${({ theme: e }) => e.colors.highlighted};
|
|
91
|
+
text-shadow: ${({ theme: e }) => e.shadows.content};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
${({ $active: e }) => e && m}
|
|
95
|
+
`, v = r.div`
|
|
96
|
+
padding: ${({ theme: e }) => e.offsets.elementContent};
|
|
97
|
+
flex: 1;
|
|
98
|
+
overflow: auto;
|
|
99
|
+
${({ $orientation: e }) => e === "vertical" && p}
|
|
100
|
+
`, y = ({ tabs: r, orientation: i = "horizontal", defaultActiveTab: a = 0, onTabChange: o, containerStyle: s, className: c, expanded: l }) => {
|
|
101
|
+
let [u, d] = e(a), f = (e) => {
|
|
102
|
+
d(e), o && o(e);
|
|
103
|
+
}, p = (e, t) => {
|
|
104
|
+
if (e.key === "Enter" || e.key === " ") f(t);
|
|
105
|
+
else if (e.key === "ArrowRight" && i === "horizontal") {
|
|
106
|
+
let e = (t + 1) % r.length;
|
|
107
|
+
f(e);
|
|
108
|
+
} else if (e.key === "ArrowLeft" && i === "horizontal") {
|
|
109
|
+
let e = (t - 1 + r.length) % r.length;
|
|
110
|
+
f(e);
|
|
111
|
+
} else if (e.key === "ArrowDown" && i === "vertical") {
|
|
112
|
+
let e = (t + 1) % r.length;
|
|
113
|
+
f(e);
|
|
114
|
+
} else if (e.key === "ArrowUp" && i === "vertical") {
|
|
115
|
+
let e = (t - 1 + r.length) % r.length;
|
|
116
|
+
f(e);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return /* @__PURE__ */ n(h, {
|
|
120
|
+
className: c,
|
|
121
|
+
$orientation: i,
|
|
122
|
+
$expanded: l,
|
|
123
|
+
"data-orientation": i,
|
|
124
|
+
children: [/* @__PURE__ */ t(g, {
|
|
125
|
+
className: "tab-list",
|
|
126
|
+
$orientation: i,
|
|
127
|
+
role: "tablist",
|
|
128
|
+
"data-orientation": i,
|
|
129
|
+
children: r.map((e, n) => /* @__PURE__ */ t(_, {
|
|
130
|
+
className: "tab-button",
|
|
131
|
+
role: "tab",
|
|
132
|
+
$active: n === u,
|
|
133
|
+
$orientation: i,
|
|
134
|
+
onClick: () => f(n),
|
|
135
|
+
onKeyDown: (e) => p(e, n),
|
|
136
|
+
id: `tab-${n}`,
|
|
137
|
+
"aria-controls": `panel-${n}`,
|
|
138
|
+
"aria-selected": n === u,
|
|
139
|
+
tabIndex: n === u ? 0 : -1,
|
|
140
|
+
"data-state": n === u ? "active" : "inactive",
|
|
141
|
+
"data-orientation": i,
|
|
142
|
+
children: e.label
|
|
143
|
+
}, n))
|
|
144
|
+
}), r.map((e, n) => /* @__PURE__ */ t(v, {
|
|
145
|
+
role: "tabpanel",
|
|
146
|
+
id: `panel-${n}`,
|
|
147
|
+
"aria-labelledby": `tab-${n}`,
|
|
148
|
+
hidden: n !== u,
|
|
149
|
+
$orientation: i,
|
|
150
|
+
style: n === u ? s : { display: "none" },
|
|
151
|
+
children: e.content
|
|
152
|
+
}, n))]
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
export { y as Tabs };
|