opui-css 3.3.5 → 4.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/CHANGELOG.md +235 -0
- package/LICENSE +21 -21
- package/MIGRATING.md +105 -0
- package/README.md +66 -29
- package/astro/index.ts +46 -0
- package/components/AGENTS.md +247 -0
- package/components/Accordion/Accordion.astro +42 -0
- package/components/Anchor/Anchor.astro +51 -0
- package/components/Avatar/Avatar.astro +44 -0
- package/components/Badge/Badge.astro +54 -0
- package/components/Button/Button.astro +45 -0
- package/components/ButtonGroup/ButtonGroup.astro +29 -0
- package/components/Callout/Callout.astro +75 -0
- package/components/Card/Card.astro +38 -0
- package/components/Checkbox/Checkbox.astro +76 -0
- package/components/Checkbox/CheckboxInput.astro +32 -0
- package/components/Chip/Chip.astro +37 -0
- package/components/ClassicSelect/ClassicSelect.astro +83 -0
- package/components/DescriptionList/Description.astro +12 -0
- package/components/DescriptionList/DescriptionList.astro +22 -0
- package/components/DescriptionList/Item.astro +12 -0
- package/components/DescriptionList/Term.astro +12 -0
- package/components/DescriptionList/index.ts +12 -0
- package/components/Dialog/Dialog.astro +43 -0
- package/components/Divider/Divider.astro +14 -0
- package/components/Drawer/Drawer.astro +49 -0
- package/components/Drawer/DrawerFooter.astro +14 -0
- package/components/Drawer/DrawerHeader.astro +31 -0
- package/components/FieldDescription/FieldDescription.astro +13 -0
- package/components/FieldGroup/FieldGroup.astro +31 -0
- package/components/FieldLegend/FieldLegend.astro +15 -0
- package/components/FieldSet/FieldSet.astro +15 -0
- package/components/Form/Form.astro +15 -0
- package/components/IconButton/IconButton.astro +26 -0
- package/components/List/List.astro +36 -0
- package/components/ListItem/ListItem.astro +118 -0
- package/components/Progress/Progress.astro +40 -0
- package/components/Radio/Radio.astro +70 -0
- package/components/Radio/RadioInput.astro +24 -0
- package/components/Range/Range.astro +136 -0
- package/components/Select/Select.astro +106 -0
- package/components/Switch/Switch.astro +101 -0
- package/components/Switch/SwitchInput.astro +25 -0
- package/components/Table/Body.astro +13 -0
- package/components/Table/Cell.astro +13 -0
- package/components/Table/Column.astro +15 -0
- package/components/Table/ColumnGroup.astro +13 -0
- package/components/Table/Head.astro +13 -0
- package/components/Table/HeaderCell.astro +13 -0
- package/components/Table/Row.astro +13 -0
- package/components/Table/Table.astro +15 -0
- package/components/Table/index.ts +20 -0
- package/components/Tabs/Tabs.astro +28 -0
- package/components/Tabs/TabsItem.astro +47 -0
- package/components/Tabs/TabsPanel.astro +21 -0
- package/components/Tabs/TabsTab.astro +19 -0
- package/components/Tabs/index.ts +14 -0
- package/components/TextField/TextField.astro +128 -0
- package/components/Textarea/Textarea.astro +106 -0
- package/components/Toast/Toast.astro +42 -0
- package/components/ToggleButton/ToggleButton.astro +53 -0
- package/components/ToggleGroup/ToggleGroup.astro +49 -0
- package/components/Tooltip/Tooltip.astro +30 -0
- package/{src/core → core}/normalize.css +194 -196
- package/core/palette.css +59 -0
- package/{src/core → core}/utils.css +71 -60
- package/css/components/accordion.css +174 -0
- package/css/components/anchor.css +27 -0
- package/{src/themes/theme-two → css}/components/avatar.css +65 -68
- package/css/components/badge.css +107 -0
- package/css/components/button-group.css +179 -0
- package/css/components/button.css +215 -0
- package/css/components/callout.css +109 -0
- package/css/components/card.css +117 -0
- package/css/components/checkbox.css +205 -0
- package/{src/themes/theme-one → css}/components/chip.css +87 -135
- package/{src/themes/theme-two/components/definition-list.css → css/components/description-list.css} +77 -68
- package/{src/themes/theme-two → css}/components/dialog.css +68 -59
- package/css/components/divider.css +20 -0
- package/css/components/drawer.css +171 -0
- package/css/components/form.css +146 -0
- package/css/components/icon-button.css +139 -0
- package/{src/themes/theme-two → css}/components/link.css +21 -21
- package/{src/themes/theme-two → css}/components/list.css +345 -318
- package/{src/themes/theme-one → css}/components/progress.css +97 -83
- package/css/components/radio.css +172 -0
- package/css/components/range.css +337 -0
- package/{src/themes/theme-two → css}/components/select.css +169 -162
- package/{src/themes/theme-two → css}/components/spinner.css +37 -38
- package/{src/themes/theme-two → css}/components/switch.css +268 -225
- package/css/components/table.css +179 -0
- package/css/components/tabs.css +77 -0
- package/css/components/text-field.css +450 -0
- package/css/components/text-input.css +53 -0
- package/{src/themes/theme-two → css}/components/textarea.css +24 -25
- package/css/components/toast.css +161 -0
- package/css/components/toggle-button.css +87 -0
- package/css/components/toggle-group.css +56 -0
- package/css/components/tooltip.css +67 -0
- package/css/components/typography.css +585 -0
- package/{src/themes/theme-two → css}/components.css +41 -37
- package/{src/themes/theme-two → css}/imports.css +16 -16
- package/css/js/checkbox.js +21 -0
- package/css/js/toast.js +94 -0
- package/css/theme.css +132 -0
- package/dist/op.css +1001 -32
- package/dist/op.css.map +1 -0
- package/dist/opui.components.css +5135 -0
- package/dist/opui.components.css.map +1 -0
- package/dist/opui.css +6604 -0
- package/dist/opui.css.map +1 -0
- package/env.d.ts +14 -0
- package/open-props.css +9 -0
- package/package.json +64 -56
- package/dist/theme-one/components.css +0 -3869
- package/dist/theme-one/theme-one.css +0 -4424
- package/dist/theme-two/components.css +0 -3591
- package/dist/theme-two/theme-two.css +0 -4141
- package/src/open-props.css +0 -10
- package/src/themes/theme-one/components/accordion.css +0 -172
- package/src/themes/theme-one/components/alert.css +0 -85
- package/src/themes/theme-one/components/avatar.css +0 -68
- package/src/themes/theme-one/components/badge.css +0 -101
- package/src/themes/theme-one/components/button-group.css +0 -69
- package/src/themes/theme-one/components/button.css +0 -281
- package/src/themes/theme-one/components/card.css +0 -82
- package/src/themes/theme-one/components/checkbox-radio.css +0 -123
- package/src/themes/theme-one/components/definition-list.css +0 -68
- package/src/themes/theme-one/components/dialog.css +0 -59
- package/src/themes/theme-one/components/divider.css +0 -7
- package/src/themes/theme-one/components/field-group.css +0 -83
- package/src/themes/theme-one/components/field.css +0 -494
- package/src/themes/theme-one/components/icon-button.css +0 -40
- package/src/themes/theme-one/components/link.css +0 -21
- package/src/themes/theme-one/components/list.css +0 -318
- package/src/themes/theme-one/components/range.css +0 -121
- package/src/themes/theme-one/components/rich-text.css +0 -210
- package/src/themes/theme-one/components/select.css +0 -163
- package/src/themes/theme-one/components/snackbar.css +0 -148
- package/src/themes/theme-one/components/spinner.css +0 -38
- package/src/themes/theme-one/components/switch.css +0 -225
- package/src/themes/theme-one/components/tab-buttons.css +0 -120
- package/src/themes/theme-one/components/table.css +0 -92
- package/src/themes/theme-one/components/text-field.css +0 -57
- package/src/themes/theme-one/components/textarea.css +0 -25
- package/src/themes/theme-one/components/toggle-button-group.css +0 -135
- package/src/themes/theme-one/components/tooltip.css +0 -94
- package/src/themes/theme-one/components/typography.css +0 -209
- package/src/themes/theme-one/components.css +0 -37
- package/src/themes/theme-one/imports.css +0 -16
- package/src/themes/theme-one/theme.css +0 -163
- package/src/themes/theme-two/components/accordion.css +0 -172
- package/src/themes/theme-two/components/alert.css +0 -85
- package/src/themes/theme-two/components/badge.css +0 -101
- package/src/themes/theme-two/components/button-group.css +0 -50
- package/src/themes/theme-two/components/button.css +0 -229
- package/src/themes/theme-two/components/card.css +0 -82
- package/src/themes/theme-two/components/checkbox-radio.css +0 -123
- package/src/themes/theme-two/components/chip.css +0 -135
- package/src/themes/theme-two/components/divider.css +0 -7
- package/src/themes/theme-two/components/field-group.css +0 -83
- package/src/themes/theme-two/components/field.css +0 -281
- package/src/themes/theme-two/components/icon-button.css +0 -40
- package/src/themes/theme-two/components/progress.css +0 -83
- package/src/themes/theme-two/components/range.css +0 -121
- package/src/themes/theme-two/components/rich-text.css +0 -210
- package/src/themes/theme-two/components/snackbar.css +0 -148
- package/src/themes/theme-two/components/tab-buttons.css +0 -120
- package/src/themes/theme-two/components/table.css +0 -99
- package/src/themes/theme-two/components/text-field.css +0 -57
- package/src/themes/theme-two/components/toggle-button-group.css +0 -135
- package/src/themes/theme-two/components/tooltip.css +0 -94
- package/src/themes/theme-two/components/typography.css +0 -209
- package/src/themes/theme-two/theme.css +0 -158
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = {
|
|
3
|
+
class?: string
|
|
4
|
+
name?: string
|
|
5
|
+
open?: boolean
|
|
6
|
+
tabId?: string
|
|
7
|
+
panelId?: string
|
|
8
|
+
[key: string]: any
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const { $id } = Astro.locals
|
|
12
|
+
const {
|
|
13
|
+
class: className,
|
|
14
|
+
name,
|
|
15
|
+
open,
|
|
16
|
+
tabId = $id("tab"),
|
|
17
|
+
panelId = $id("panel"),
|
|
18
|
+
...rest
|
|
19
|
+
} = Astro.props
|
|
20
|
+
|
|
21
|
+
const tabsGroupName = name || Astro.locals.tabsGroupName
|
|
22
|
+
const originalGroupName = Astro.locals.tabsGroupName
|
|
23
|
+
Astro.locals.tabsGroupName = tabsGroupName
|
|
24
|
+
|
|
25
|
+
const originalTabId = Astro.locals.currentTabId
|
|
26
|
+
const originalPanelId = Astro.locals.currentPanelId
|
|
27
|
+
|
|
28
|
+
Astro.locals.currentTabId = tabId
|
|
29
|
+
Astro.locals.currentPanelId = panelId
|
|
30
|
+
|
|
31
|
+
const html = await Astro.slots.render("default")
|
|
32
|
+
|
|
33
|
+
Astro.locals.currentTabId = originalTabId
|
|
34
|
+
Astro.locals.currentPanelId = originalPanelId
|
|
35
|
+
Astro.locals.tabsGroupName = originalGroupName
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
<input
|
|
39
|
+
aria-controls={panelId}
|
|
40
|
+
checked={open}
|
|
41
|
+
class:list={["tab-input", className]}
|
|
42
|
+
id={tabId}
|
|
43
|
+
name={tabsGroupName}
|
|
44
|
+
type="radio"
|
|
45
|
+
{...rest}
|
|
46
|
+
/>
|
|
47
|
+
<Fragment set:html={html} />
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = {
|
|
3
|
+
class?: string
|
|
4
|
+
panelId?: string
|
|
5
|
+
tabId?: string
|
|
6
|
+
[key: string]: any
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { class: className, panelId, tabId, ...rest } = Astro.props
|
|
10
|
+
const { currentPanelId, currentTabId } = Astro.locals
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
id={panelId || currentPanelId}
|
|
15
|
+
class:list={["tab-panel", className]}
|
|
16
|
+
role="tabpanel"
|
|
17
|
+
aria-labelledby={tabId || currentTabId}
|
|
18
|
+
{...rest}
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = {
|
|
3
|
+
class?: string
|
|
4
|
+
tabId?: string
|
|
5
|
+
[key: string]: any
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const { class: className, tabId, ...rest } = Astro.props
|
|
9
|
+
const { currentTabId } = Astro.locals
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<label
|
|
13
|
+
for={tabId || currentTabId}
|
|
14
|
+
class:list={["tab-label", className]}
|
|
15
|
+
role="tab"
|
|
16
|
+
{...rest}
|
|
17
|
+
>
|
|
18
|
+
<slot />
|
|
19
|
+
</label>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import TabsOrig from "./Tabs.astro"
|
|
2
|
+
import TabsItem from "./TabsItem.astro"
|
|
3
|
+
import TabsTab from "./TabsTab.astro"
|
|
4
|
+
import TabsPanel from "./TabsPanel.astro"
|
|
5
|
+
|
|
6
|
+
export { TabsItem, TabsTab as Tab, TabsPanel as Panel }
|
|
7
|
+
|
|
8
|
+
const Tabs = Object.assign(TabsOrig, {
|
|
9
|
+
Item: TabsItem,
|
|
10
|
+
Tab: TabsTab,
|
|
11
|
+
Panel: TabsPanel,
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export default Tabs as any
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = {
|
|
3
|
+
[key: string]: any
|
|
4
|
+
autoFit?: boolean
|
|
5
|
+
class?: string
|
|
6
|
+
critical?: boolean
|
|
7
|
+
description?: string
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
endText?: string
|
|
10
|
+
filled?: boolean
|
|
11
|
+
id?: string
|
|
12
|
+
label?: string
|
|
13
|
+
list?: string
|
|
14
|
+
max?: number | string
|
|
15
|
+
min?: number | string
|
|
16
|
+
name?: string
|
|
17
|
+
placeholder?: string
|
|
18
|
+
required?: boolean
|
|
19
|
+
small?: boolean
|
|
20
|
+
spread?: boolean
|
|
21
|
+
startText?: string
|
|
22
|
+
step?: number | string
|
|
23
|
+
type?:
|
|
24
|
+
| "color"
|
|
25
|
+
| "date"
|
|
26
|
+
| "datetime-local"
|
|
27
|
+
| "email"
|
|
28
|
+
| "file"
|
|
29
|
+
| "month"
|
|
30
|
+
| "numeric"
|
|
31
|
+
| "password"
|
|
32
|
+
| "search"
|
|
33
|
+
| "tel"
|
|
34
|
+
| "text"
|
|
35
|
+
| "time"
|
|
36
|
+
| "url"
|
|
37
|
+
| "week"
|
|
38
|
+
value?: string | number
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const title = "Text Field"
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
autoFit,
|
|
45
|
+
class: className,
|
|
46
|
+
critical,
|
|
47
|
+
description,
|
|
48
|
+
disabled,
|
|
49
|
+
endText,
|
|
50
|
+
filled,
|
|
51
|
+
id,
|
|
52
|
+
label,
|
|
53
|
+
list,
|
|
54
|
+
max,
|
|
55
|
+
min,
|
|
56
|
+
name,
|
|
57
|
+
placeholder,
|
|
58
|
+
required,
|
|
59
|
+
small,
|
|
60
|
+
spread,
|
|
61
|
+
startText,
|
|
62
|
+
step,
|
|
63
|
+
type = "text",
|
|
64
|
+
value,
|
|
65
|
+
...rest
|
|
66
|
+
} = Astro.props
|
|
67
|
+
|
|
68
|
+
const startTextValue = description || startText
|
|
69
|
+
const { $id, currentFieldName } = Astro.locals
|
|
70
|
+
const fieldId = id || $id("text-field")
|
|
71
|
+
const fieldName = name || currentFieldName
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
<label
|
|
75
|
+
class:list={[
|
|
76
|
+
"text-field",
|
|
77
|
+
{
|
|
78
|
+
"auto-fit": autoFit,
|
|
79
|
+
filled,
|
|
80
|
+
spread,
|
|
81
|
+
small,
|
|
82
|
+
},
|
|
83
|
+
className,
|
|
84
|
+
]}
|
|
85
|
+
data-invalid={critical || undefined}
|
|
86
|
+
{...rest}
|
|
87
|
+
>
|
|
88
|
+
{
|
|
89
|
+
(label || Astro.slots.has("label")) && (
|
|
90
|
+
<!-- prettier-ignore -->
|
|
91
|
+
<span class="label">{label}<slot name="label" /></span>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
{
|
|
95
|
+
(startTextValue || Astro.slots.has("description")) && (
|
|
96
|
+
<!-- prettier-ignore -->
|
|
97
|
+
<span class="start-text">{startTextValue}<slot name="description" /></span>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
<span class="field">
|
|
101
|
+
<input
|
|
102
|
+
disabled={disabled}
|
|
103
|
+
id={fieldId}
|
|
104
|
+
inputmode={type === "numeric" ? "numeric" : undefined}
|
|
105
|
+
list={list}
|
|
106
|
+
max={max}
|
|
107
|
+
min={min}
|
|
108
|
+
name={fieldName}
|
|
109
|
+
pattern={type === "numeric" ? "[0-9]*" : undefined}
|
|
110
|
+
placeholder={placeholder}
|
|
111
|
+
required={required}
|
|
112
|
+
step={step}
|
|
113
|
+
type={type === "numeric" ? "text" : type}
|
|
114
|
+
value={value}
|
|
115
|
+
/>
|
|
116
|
+
{Astro.slots.has("prefix") && <span class="prefix"><slot name="prefix" /></span>}
|
|
117
|
+
{Astro.slots.has("suffix") && <span class="suffix"><slot name="suffix" /></span>}
|
|
118
|
+
{Astro.slots.has("header") && <span class="header"><slot name="header" /></span>}
|
|
119
|
+
{Astro.slots.has("footer") && <span class="footer"><slot name="footer" /></span>}
|
|
120
|
+
</span>
|
|
121
|
+
{
|
|
122
|
+
(endText || Astro.slots.has("end-text") || Astro.slots.has("supporting-text")) && (
|
|
123
|
+
<!-- prettier-ignore -->
|
|
124
|
+
<span class="end-text">{endText}<slot name="end-text" /><slot name="supporting-text" /></span>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
<slot />
|
|
128
|
+
</label>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = {
|
|
3
|
+
[key: string]: any
|
|
4
|
+
autoFit?: boolean
|
|
5
|
+
class?: string
|
|
6
|
+
cols?: number
|
|
7
|
+
description?: string
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
critical?: boolean
|
|
10
|
+
filled?: boolean
|
|
11
|
+
id?: string
|
|
12
|
+
label?: string
|
|
13
|
+
maxlength?: number
|
|
14
|
+
minlength?: number
|
|
15
|
+
name?: string
|
|
16
|
+
spread?: boolean
|
|
17
|
+
placeholder?: string
|
|
18
|
+
required?: boolean
|
|
19
|
+
rows?: number
|
|
20
|
+
small?: boolean
|
|
21
|
+
endText?: string
|
|
22
|
+
value?: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const title = "Textarea"
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
autoFit,
|
|
29
|
+
class: className,
|
|
30
|
+
cols,
|
|
31
|
+
description,
|
|
32
|
+
disabled,
|
|
33
|
+
critical,
|
|
34
|
+
filled,
|
|
35
|
+
id,
|
|
36
|
+
label,
|
|
37
|
+
maxlength,
|
|
38
|
+
minlength,
|
|
39
|
+
name,
|
|
40
|
+
spread,
|
|
41
|
+
placeholder,
|
|
42
|
+
required,
|
|
43
|
+
rows,
|
|
44
|
+
small,
|
|
45
|
+
endText,
|
|
46
|
+
value,
|
|
47
|
+
...rest
|
|
48
|
+
} = Astro.props
|
|
49
|
+
|
|
50
|
+
const { $id, currentFieldName } = Astro.locals
|
|
51
|
+
const fieldId = id || $id("textarea")
|
|
52
|
+
const fieldName = name || currentFieldName
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
<label
|
|
56
|
+
class:list={[
|
|
57
|
+
"textarea",
|
|
58
|
+
{
|
|
59
|
+
"auto-fit": autoFit,
|
|
60
|
+
filled,
|
|
61
|
+
spread,
|
|
62
|
+
small,
|
|
63
|
+
},
|
|
64
|
+
className,
|
|
65
|
+
]}
|
|
66
|
+
data-invalid={critical || undefined}
|
|
67
|
+
{...rest}
|
|
68
|
+
>
|
|
69
|
+
{
|
|
70
|
+
(label || Astro.slots.has("label")) && (
|
|
71
|
+
<!-- prettier-ignore -->
|
|
72
|
+
<span class="label">{label}<slot name="label" /></span>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
{
|
|
77
|
+
(description || Astro.slots.has("description")) && (
|
|
78
|
+
<!-- prettier-ignore -->
|
|
79
|
+
<span class="start-text">{description}<slot name="description" /></span>
|
|
80
|
+
)
|
|
81
|
+
}
|
|
82
|
+
<span class="field">
|
|
83
|
+
<textarea
|
|
84
|
+
cols={cols}
|
|
85
|
+
disabled={disabled}
|
|
86
|
+
id={fieldId}
|
|
87
|
+
maxlength={maxlength}
|
|
88
|
+
minlength={minlength}
|
|
89
|
+
name={fieldName}
|
|
90
|
+
placeholder={placeholder}
|
|
91
|
+
required={required}
|
|
92
|
+
rows={rows}
|
|
93
|
+
value={value}></textarea>
|
|
94
|
+
{Astro.slots.has("prefix") && <span class="prefix"><slot name="prefix" /></span>}
|
|
95
|
+
{Astro.slots.has("suffix") && <span class="suffix"><slot name="suffix" /></span>}
|
|
96
|
+
{Astro.slots.has("header") && <span class="header"><slot name="header" /></span>}
|
|
97
|
+
{Astro.slots.has("footer") && <span class="footer"><slot name="footer" /></span>}
|
|
98
|
+
</span>
|
|
99
|
+
{
|
|
100
|
+
(endText || Astro.slots.has("end-text") || Astro.slots.has("supporting-text")) && (
|
|
101
|
+
<!-- prettier-ignore -->
|
|
102
|
+
<span class="end-text">{endText}<slot name="end-text" /><slot name="supporting-text" /></span>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
<slot />
|
|
106
|
+
</label>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
export const title = "Toast"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<output aria-live="polite" id="toast-manager" popover="manual" role="status"
|
|
6
|
+
></output>
|
|
7
|
+
|
|
8
|
+
<template id="toast-template">
|
|
9
|
+
<div class="toast" role="alert">
|
|
10
|
+
<span class="icon" data-toast-icon></span>
|
|
11
|
+
<div class="content">
|
|
12
|
+
<div class="title" data-toast-title></div>
|
|
13
|
+
<div class="description" data-toast-description></div>
|
|
14
|
+
</div>
|
|
15
|
+
<button
|
|
16
|
+
aria-label="Close"
|
|
17
|
+
class="close-button"
|
|
18
|
+
data-toast-close
|
|
19
|
+
type="button"
|
|
20
|
+
>
|
|
21
|
+
<svg
|
|
22
|
+
fill="none"
|
|
23
|
+
height="20"
|
|
24
|
+
stroke="currentColor"
|
|
25
|
+
stroke-linecap="round"
|
|
26
|
+
stroke-linejoin="round"
|
|
27
|
+
stroke-width="2"
|
|
28
|
+
viewBox="0 0 24 24"
|
|
29
|
+
width="20"
|
|
30
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
31
|
+
>
|
|
32
|
+
<path d="M18 6 6 18"></path>
|
|
33
|
+
<path d="m6 6 12 12"></path>
|
|
34
|
+
</svg>
|
|
35
|
+
</button>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script>
|
|
40
|
+
import { initToastManager } from "../../css/js/toast.js"
|
|
41
|
+
initToastManager()
|
|
42
|
+
</script>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = {
|
|
3
|
+
[key: string]: any
|
|
4
|
+
class?: string
|
|
5
|
+
disabled?: boolean
|
|
6
|
+
label?: string
|
|
7
|
+
name?: string
|
|
8
|
+
pressed?: boolean
|
|
9
|
+
size?: "small" | "x-small"
|
|
10
|
+
type?: "checkbox" | "radio"
|
|
11
|
+
value?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const title = "Toggle Button"
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
class: className,
|
|
18
|
+
disabled,
|
|
19
|
+
label,
|
|
20
|
+
name,
|
|
21
|
+
pressed,
|
|
22
|
+
size,
|
|
23
|
+
type,
|
|
24
|
+
value,
|
|
25
|
+
...rest
|
|
26
|
+
} = Astro.props
|
|
27
|
+
|
|
28
|
+
const { $id, currentToggleGroupName, currentToggleGroupType } = Astro.locals
|
|
29
|
+
const finalName = name || currentToggleGroupName
|
|
30
|
+
const finalType = type || currentToggleGroupType || "checkbox"
|
|
31
|
+
const id = rest.id || $id("toggle")
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
<label
|
|
35
|
+
class:list={[
|
|
36
|
+
"toggle-button",
|
|
37
|
+
{ selected: pressed, disabled },
|
|
38
|
+
size,
|
|
39
|
+
className,
|
|
40
|
+
]}
|
|
41
|
+
>
|
|
42
|
+
<input
|
|
43
|
+
aria-pressed={finalType === "checkbox" ? pressed : undefined}
|
|
44
|
+
checked={pressed}
|
|
45
|
+
disabled={disabled}
|
|
46
|
+
id={id}
|
|
47
|
+
name={finalName}
|
|
48
|
+
type={finalType}
|
|
49
|
+
value={value || label}
|
|
50
|
+
{...rest}
|
|
51
|
+
/>
|
|
52
|
+
<slot />
|
|
53
|
+
</label>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = {
|
|
3
|
+
[key: string]: any
|
|
4
|
+
class?: string
|
|
5
|
+
name?: string
|
|
6
|
+
orientation?: "vertical"
|
|
7
|
+
selection?: "single" | "multiple"
|
|
8
|
+
size?: "default" | "small" | "x-small"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const title = "Toggle Group"
|
|
12
|
+
|
|
13
|
+
const {
|
|
14
|
+
class: className,
|
|
15
|
+
name,
|
|
16
|
+
orientation,
|
|
17
|
+
selection = "multiple",
|
|
18
|
+
size = "default",
|
|
19
|
+
...rest
|
|
20
|
+
} = Astro.props
|
|
21
|
+
|
|
22
|
+
const { $id } = Astro.locals
|
|
23
|
+
const groupName = name || $id("toggle-group")
|
|
24
|
+
const inputType = selection === "single" ? "radio" : "checkbox"
|
|
25
|
+
|
|
26
|
+
const originalName = Astro.locals.currentToggleGroupName
|
|
27
|
+
const originalType = Astro.locals.currentToggleGroupType
|
|
28
|
+
|
|
29
|
+
Astro.locals.currentToggleGroupName = groupName
|
|
30
|
+
Astro.locals.currentToggleGroupType = inputType
|
|
31
|
+
|
|
32
|
+
const html = await Astro.slots.render("default")
|
|
33
|
+
|
|
34
|
+
Astro.locals.currentToggleGroupName = originalName
|
|
35
|
+
Astro.locals.currentToggleGroupType = originalType
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
<div
|
|
39
|
+
class:list={[
|
|
40
|
+
"toggle-group",
|
|
41
|
+
size !== "default" && size,
|
|
42
|
+
orientation,
|
|
43
|
+
className,
|
|
44
|
+
]}
|
|
45
|
+
role={selection === "single" ? "radiogroup" : "group"}
|
|
46
|
+
{...rest}
|
|
47
|
+
>
|
|
48
|
+
<Fragment set:html={html} />
|
|
49
|
+
</div>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Anchor from "../Anchor/Anchor.astro"
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
[key: string]: any
|
|
6
|
+
alignment?: string
|
|
7
|
+
arrow?: boolean
|
|
8
|
+
class?: string
|
|
9
|
+
id?: string
|
|
10
|
+
label?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const title = "Tooltip"
|
|
14
|
+
|
|
15
|
+
const { alignment, arrow, class: className, id, label, ...rest } = Astro.props
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<Anchor
|
|
19
|
+
alignment={alignment}
|
|
20
|
+
class:list={["tooltip", { "with-arrow": arrow }, className]}
|
|
21
|
+
id={id}
|
|
22
|
+
trigger="hover"
|
|
23
|
+
{...rest}
|
|
24
|
+
>
|
|
25
|
+
<slot />
|
|
26
|
+
<Fragment slot="anchored">
|
|
27
|
+
{label}
|
|
28
|
+
<slot name="content" />
|
|
29
|
+
</Fragment>
|
|
30
|
+
</Anchor>
|