mtrl 0.2.6 → 0.2.8
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/demo/build.ts +349 -0
- package/demo/index.html +110 -0
- package/demo/main.js +448 -0
- package/demo/styles.css +239 -0
- package/index.ts +18 -0
- package/package.json +14 -3
- package/server.ts +86 -0
- package/src/components/badge/api.ts +70 -63
- package/src/components/badge/badge.ts +16 -2
- package/src/components/badge/config.ts +66 -13
- package/src/components/badge/features.ts +51 -42
- package/src/components/badge/index.ts +27 -2
- package/src/components/badge/types.ts +62 -30
- package/src/components/bottom-app-bar/bottom-app-bar.ts +154 -0
- package/src/components/bottom-app-bar/config.ts +29 -0
- package/src/components/bottom-app-bar/index.ts +17 -0
- package/src/components/bottom-app-bar/types.ts +114 -0
- package/src/components/button/api.ts +5 -0
- package/src/components/button/button.ts +0 -1
- package/src/components/button/config.ts +6 -2
- package/src/components/button/index.ts +10 -2
- package/src/components/button/types.ts +20 -2
- package/src/components/card/card.ts +13 -25
- package/src/components/card/config.ts +83 -30
- package/src/components/card/content.ts +8 -10
- package/src/components/card/features.ts +4 -3
- package/src/components/card/index.ts +29 -2
- package/src/components/card/types.ts +33 -22
- package/src/components/checkbox/config.ts +3 -4
- package/src/components/checkbox/index.ts +1 -2
- package/src/components/checkbox/types.ts +12 -3
- package/src/components/chip/api.ts +170 -221
- package/src/components/chip/chip.ts +34 -302
- package/src/components/chip/config.ts +1 -2
- package/src/components/chip/index.ts +10 -2
- package/src/components/chip/types.ts +224 -35
- package/src/components/datepicker/api.ts +265 -0
- package/src/components/datepicker/config.ts +141 -0
- package/src/components/datepicker/datepicker.ts +341 -0
- package/src/components/datepicker/index.ts +12 -0
- package/src/components/datepicker/render.ts +450 -0
- package/src/components/datepicker/types.ts +397 -0
- package/src/components/datepicker/utils.ts +289 -0
- package/src/components/dialog/api.ts +55 -21
- package/src/components/dialog/config.ts +12 -9
- package/src/components/dialog/dialog.ts +6 -3
- package/src/components/dialog/features.ts +345 -151
- package/src/components/dialog/index.ts +38 -8
- package/src/components/dialog/types.ts +40 -14
- package/src/components/divider/config.ts +81 -0
- package/src/components/divider/divider.ts +37 -0
- package/src/components/divider/features.ts +207 -0
- package/src/components/divider/index.ts +9 -0
- package/src/components/divider/types.ts +55 -0
- package/src/components/extended-fab/api.ts +141 -0
- package/src/components/extended-fab/config.ts +112 -0
- package/src/components/extended-fab/extended-fab.ts +125 -0
- package/src/components/extended-fab/index.ts +9 -0
- package/src/components/extended-fab/types.ts +304 -0
- package/src/components/fab/api.ts +97 -0
- package/src/components/fab/config.ts +93 -0
- package/src/components/fab/fab.ts +67 -0
- package/src/components/fab/index.ts +9 -0
- package/src/components/fab/types.ts +251 -0
- package/src/components/list/config.ts +4 -5
- package/src/components/list/features.ts +6 -7
- package/src/components/list/index.ts +7 -9
- package/src/components/list/list-item.ts +12 -13
- package/src/components/list/types.ts +50 -5
- package/src/components/list/utils.ts +30 -3
- package/src/components/menu/features/items-manager.ts +9 -9
- package/src/components/menu/features/positioning.ts +7 -7
- package/src/components/menu/features/visibility.ts +7 -7
- package/src/components/menu/index.ts +7 -9
- package/src/components/menu/menu-item.ts +6 -6
- package/src/components/menu/menu.ts +22 -0
- package/src/components/menu/types.ts +29 -10
- package/src/components/menu/utils.ts +67 -0
- package/src/components/navigation/api.ts +78 -50
- package/src/components/navigation/config.ts +22 -10
- package/src/components/navigation/features/items.ts +284 -0
- package/src/components/navigation/index.ts +0 -6
- package/src/components/navigation/nav-item.ts +70 -33
- package/src/components/navigation/navigation.ts +53 -3
- package/src/components/navigation/types.ts +117 -70
- package/src/components/progress/api.ts +2 -3
- package/src/components/progress/config.ts +2 -3
- package/src/components/progress/index.ts +0 -1
- package/src/components/progress/progress.ts +1 -2
- package/src/components/progress/types.ts +186 -33
- package/src/components/radios/config.ts +1 -1
- package/src/components/radios/index.ts +0 -1
- package/src/components/radios/types.ts +0 -7
- package/src/components/search/api.ts +203 -0
- package/src/components/search/config.ts +86 -0
- package/src/components/search/features/index.ts +4 -0
- package/src/components/search/features/search.ts +717 -0
- package/src/components/search/features/states.ts +169 -0
- package/src/components/search/features/structure.ts +197 -0
- package/src/components/search/index.ts +7 -0
- package/src/components/search/search.ts +52 -0
- package/src/components/search/types.ts +175 -0
- package/src/components/segmented-button/config.ts +80 -0
- package/src/components/segmented-button/index.ts +4 -0
- package/src/components/segmented-button/segment.ts +154 -0
- package/src/components/segmented-button/segmented-button.ts +249 -0
- package/src/components/segmented-button/types.ts +254 -0
- package/src/components/slider/accessibility.md +5 -5
- package/src/components/slider/api.ts +41 -120
- package/src/components/slider/config.ts +51 -47
- package/src/components/slider/features/handlers.ts +495 -0
- package/src/components/slider/features/index.ts +1 -2
- package/src/components/slider/features/slider.ts +66 -84
- package/src/components/slider/features/states.ts +195 -0
- package/src/components/slider/features/structure.ts +136 -206
- package/src/components/slider/features/ui.ts +145 -206
- package/src/components/slider/index.ts +2 -11
- package/src/components/slider/slider.ts +9 -12
- package/src/components/slider/types.ts +67 -26
- package/src/components/snackbar/config.ts +2 -3
- package/src/components/snackbar/constants.ts +0 -32
- package/src/components/snackbar/index.ts +0 -1
- package/src/components/snackbar/position.ts +9 -1
- package/src/components/snackbar/types.ts +122 -46
- package/src/components/switch/config.ts +2 -3
- package/src/components/switch/index.ts +0 -1
- package/src/components/switch/types.ts +3 -2
- package/src/components/tabs/config.ts +3 -4
- package/src/components/tabs/features.ts +4 -2
- package/src/components/tabs/index.ts +0 -15
- package/src/components/tabs/indicator.ts +73 -13
- package/src/components/tabs/tab-api.ts +12 -4
- package/src/components/tabs/tab.ts +18 -6
- package/src/components/tabs/types.ts +23 -5
- package/src/components/textfield/config.ts +2 -3
- package/src/components/textfield/index.ts +0 -1
- package/src/components/textfield/types.ts +17 -3
- package/src/components/timepicker/README.md +277 -0
- package/src/components/timepicker/api.ts +632 -0
- package/src/components/timepicker/clockdial.ts +482 -0
- package/src/components/timepicker/config.ts +228 -0
- package/src/components/timepicker/index.ts +3 -0
- package/src/components/timepicker/render.ts +613 -0
- package/src/components/timepicker/timepicker.ts +117 -0
- package/src/components/timepicker/types.ts +336 -0
- package/src/components/timepicker/utils.ts +241 -0
- package/src/components/tooltip/api.ts +1 -1
- package/src/components/tooltip/config.ts +27 -6
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/tooltip/types.ts +13 -3
- package/src/components/top-app-bar/config.ts +83 -0
- package/src/components/top-app-bar/index.ts +11 -0
- package/src/components/top-app-bar/top-app-bar.ts +316 -0
- package/src/components/top-app-bar/types.ts +140 -0
- package/src/core/build/_ripple.scss +6 -6
- package/src/core/build/ripple.ts +72 -95
- package/src/core/compose/features/icon.ts +3 -1
- package/src/core/compose/features/ripple.ts +4 -1
- package/src/core/compose/features/textlabel.ts +23 -2
- package/src/core/dom/create.ts +5 -0
- package/src/index.ts +9 -0
- package/src/styles/abstract/_theme.scss +9 -1
- package/src/styles/components/_badge.scss +182 -0
- package/src/styles/components/_bottom-app-bar.scss +103 -0
- package/src/{components/button/_styles.scss → styles/components/_button.scss} +0 -10
- package/src/{components/checkbox/_styles.scss → styles/components/_checkbox.scss} +0 -2
- package/src/styles/components/_datepicker.scss +358 -0
- package/src/styles/components/_dialog.scss +259 -0
- package/src/styles/components/_divider.scss +57 -0
- package/src/styles/components/_extended-fab.scss +267 -0
- package/src/styles/components/_fab.scss +225 -0
- package/src/{components/navigation/_styles.scss → styles/components/_navigation.scss} +1 -0
- package/src/styles/components/_search.scss +306 -0
- package/src/styles/components/_segmented-button.scss +117 -0
- package/src/{components/slider/_styles.scss → styles/components/_slider.scss} +83 -24
- package/src/{components/switch/_styles.scss → styles/components/_switch.scss} +0 -2
- package/src/{components/tabs/_styles.scss → styles/components/_tabs.scss} +95 -33
- package/src/{components/textfield/_styles.scss → styles/components/_textfield.scss} +70 -67
- package/src/styles/components/_timepicker.scss +451 -0
- package/src/styles/components/_top-app-bar.scss +225 -0
- package/src/styles/main.scss +98 -49
- package/src/styles/themes/_autumn.scss +21 -0
- package/src/styles/themes/_base-theme.scss +61 -0
- package/src/styles/themes/_baseline.scss +58 -0
- package/src/styles/themes/_bluekhaki.scss +125 -0
- package/src/styles/themes/_brownbeige.scss +125 -0
- package/src/styles/themes/_browngreen.scss +125 -0
- package/src/styles/themes/_forest.scss +6 -0
- package/src/styles/themes/_greenbeige.scss +125 -0
- package/src/styles/themes/_material.scss +125 -0
- package/src/styles/themes/_ocean.scss +6 -0
- package/src/styles/themes/_sageivory.scss +125 -0
- package/src/styles/themes/_spring.scss +6 -0
- package/src/styles/themes/_summer.scss +5 -0
- package/src/styles/themes/_sunset.scss +5 -0
- package/src/styles/themes/_tealcaramel.scss +125 -0
- package/src/styles/themes/_winter.scss +6 -0
- package/src/components/badge/_styles.scss +0 -174
- package/src/components/badge/constants.ts +0 -30
- package/src/components/button/constants.ts +0 -11
- package/src/components/card/constants.ts +0 -84
- package/src/components/dialog/_styles.scss +0 -213
- package/src/components/dialog/constants.ts +0 -32
- package/src/components/menu/constants.ts +0 -154
- package/src/components/navigation/constants.ts +0 -200
- package/src/components/navigation/features/items.js +0 -192
- package/src/components/progress/constants.ts +0 -29
- package/src/components/slider/features/appearance.ts +0 -94
- package/src/components/slider/features/disabled.ts +0 -68
- package/src/components/slider/features/events.ts +0 -164
- package/src/components/slider/features/interactions.ts +0 -396
- package/src/components/slider/features/keyboard.ts +0 -233
- package/src/components/switch/constants.ts +0 -80
- package/src/components/tabs/constants.ts +0 -89
- package/src/core/collection/adapters/mongodb.js +0 -232
- /package/src/{components/card/_styles.scss → styles/components/_card.scss} +0 -0
- /package/src/{components/carousel/_styles.scss → styles/components/_carousel.scss} +0 -0
- /package/src/{components/chip/_styles.scss → styles/components/_chip.scss} +0 -0
- /package/src/{components/list/_styles.scss → styles/components/_list.scss} +0 -0
- /package/src/{components/menu/_styles.scss → styles/components/_menu.scss} +0 -0
- /package/src/{components/progress/_styles.scss → styles/components/_progress.scss} +0 -0
- /package/src/{components/radios/_styles.scss → styles/components/_radios.scss} +0 -0
- /package/src/{components/sheet/_styles.scss → styles/components/_sheet.scss} +0 -0
- /package/src/{components/snackbar/_styles.scss → styles/components/_snackbar.scss} +0 -0
- /package/src/{components/tooltip/_styles.scss → styles/components/_tooltip.scss} +0 -0
- /package/src/styles/utilities/{_color.scss → _colors.scss} +0 -0
package/demo/main.js
ADDED
|
@@ -0,0 +1,448 @@
|
|
|
1
|
+
// Import all components from your library
|
|
2
|
+
import {
|
|
3
|
+
createBadge,
|
|
4
|
+
createBottomAppBar,
|
|
5
|
+
createButton,
|
|
6
|
+
createDatePicker,
|
|
7
|
+
createFab,
|
|
8
|
+
createExtendedFab,
|
|
9
|
+
createSegmentedButton,
|
|
10
|
+
createCard,
|
|
11
|
+
createCarousel,
|
|
12
|
+
createCheckbox,
|
|
13
|
+
createChip,
|
|
14
|
+
createDialog,
|
|
15
|
+
createDivider,
|
|
16
|
+
createList,
|
|
17
|
+
createMenu,
|
|
18
|
+
createNavigation,
|
|
19
|
+
createProgress,
|
|
20
|
+
createRadios,
|
|
21
|
+
createSearch,
|
|
22
|
+
createSheet,
|
|
23
|
+
createSlider,
|
|
24
|
+
createSnackbar,
|
|
25
|
+
createTabs,
|
|
26
|
+
createTextfield,
|
|
27
|
+
createTimePicker,
|
|
28
|
+
createTooltip,
|
|
29
|
+
createTopAppBar,
|
|
30
|
+
createSwitch
|
|
31
|
+
} from '../src/index.js'
|
|
32
|
+
|
|
33
|
+
// Helper function to get DOM element
|
|
34
|
+
const getContainer = (id) => document.getElementById(id)
|
|
35
|
+
|
|
36
|
+
// Initialize components when DOM is loaded
|
|
37
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
38
|
+
// Top App Bar
|
|
39
|
+
const topAppBar = createTopAppBar({
|
|
40
|
+
title: 'Material Components',
|
|
41
|
+
variant: 'center-aligned',
|
|
42
|
+
navigationIcon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z"/></svg>',
|
|
43
|
+
actions: [
|
|
44
|
+
{ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-120q-75 0-140.5-28.5t-114-77q-48.5-48.5-77-114T120-480q0-75 28.5-140.5t77-114q48.5-48.5 114-77T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm0-82q116 0 197-81t81-197q0-116-81-197t-197-81q-116 0-197 81t-81 197q0 116 81 197t197 81Zm0-278Z"/></svg>' },
|
|
45
|
+
{ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M234-276q51-39 114-61.5T480-360q69 0 132 22.5T726-276q35-41 54.5-93T800-480q0-133-93.5-226.5T480-800q-133 0-226.5 93.5T160-480q0 59 19.5 111t54.5 93Zm246-164q-59 0-99.5-40.5T340-580q0-59 40.5-99.5T480-720q59 0 99.5 40.5T620-580q0 59-40.5 99.5T480-440Zm0 360q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q53 0 100-15.5t86-44.5q-39-29-86-44.5T480-280q-53 0-100 15.5T294-220q39 29 86 44.5T480-160Zm0-360q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm0-60Zm0 420Z"/></svg>' }
|
|
46
|
+
]
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
topAppBar.element.classList.add('top-app-bar')
|
|
50
|
+
getContainer('top-app-bar').appendChild(topAppBar.element)
|
|
51
|
+
|
|
52
|
+
// Bottom App Bar
|
|
53
|
+
const bottomAppBar = createBottomAppBar({
|
|
54
|
+
fab: { icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"/></svg>' },
|
|
55
|
+
startActions: [
|
|
56
|
+
{ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z"/></svg>' },
|
|
57
|
+
{ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m323-205 157-94 157 95-42-178 138-120-182-16-71-168-71 167-182 16 138 120-42 178Zm157-48L316-139q-11 7-23 4.5T274-146q-6-10-5.5-21.5T278-189l77-148-146-127q-9-8-10.5-19.5t3.5-22.5q5-10 14.5-16t23.5-4l182 16 69-164q5-12 15.5-17.5T480-700q11 0 21.5 5.5T517-677l69 164 182 16q14-2 23.5 4t14.5 16q5 11 3.5 22.5T800-435L654-308l77 148q6 11 6.5 22.5T732-116q-9 11-21 13.5t-23-4.5L480-253Z"/></svg>' }
|
|
58
|
+
],
|
|
59
|
+
endActions: [
|
|
60
|
+
{ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M160-200v-360h80v360h-80Zm280 0v-360h80v360h-80ZM720-80q-33 0-56.5-23.5T640-160v-400H280v-80q0-17 11.5-28.5T320-680h160v-120q0-17 11.5-28.5T520-840h160q17 0 28.5 11.5T720-800v720h-80v-80h-80q-33 0-56.5-23.5T480-240q0-33 23.5-56.5T560-320h80v-240h80v480ZM600-320v160h40v-160h-40Z"/></svg>' },
|
|
61
|
+
{ icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>' }
|
|
62
|
+
]
|
|
63
|
+
})
|
|
64
|
+
getContainer('bottom-app-bar').appendChild(bottomAppBar.element)
|
|
65
|
+
|
|
66
|
+
// Buttons
|
|
67
|
+
const buttonContainer = getContainer('button-container')
|
|
68
|
+
|
|
69
|
+
// Regular Button
|
|
70
|
+
const primaryButton = createButton({ text: 'Primary', variant: 'filled' })
|
|
71
|
+
const secondaryButton = createButton({ text: 'Secondary', variant: 'outlined' })
|
|
72
|
+
const textButton = createButton({ text: 'Text', variant: 'text' })
|
|
73
|
+
const elevatedButton = createButton({ text: 'Elevated', variant: 'elevated' })
|
|
74
|
+
|
|
75
|
+
const iconButton = createButton({
|
|
76
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M360-240h240q17 0 28.5-11.5T640-280q0-17-11.5-28.5T600-320H360q-17 0-28.5 11.5T320-280q0 17 11.5 28.5T360-240Zm0-160h240q17 0 28.5-11.5T640-440q0-17-11.5-28.5T600-480H360q-17 0-28.5 11.5T320-440q0 17 11.5 28.5T360-400Zm0-160h240q17 0 28.5-11.5T640-600q0-17-11.5-28.5T600-640H360q-17 0-28.5 11.5T320-600q0 17 11.5 28.5T360-560ZM480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z"/></svg>',
|
|
77
|
+
variant: 'filled'
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
buttonContainer.appendChild(createDemoBlock('Standard Buttons', [
|
|
81
|
+
primaryButton.element,
|
|
82
|
+
secondaryButton.element,
|
|
83
|
+
textButton.element,
|
|
84
|
+
elevatedButton.element,
|
|
85
|
+
iconButton.element
|
|
86
|
+
]))
|
|
87
|
+
|
|
88
|
+
// Segmented Button
|
|
89
|
+
const segmentedButtonContainer = getContainer('segmented-button-container')
|
|
90
|
+
const segmentedButton = createSegmentedButton({
|
|
91
|
+
segments: [
|
|
92
|
+
{ text: 'Day', selected: true },
|
|
93
|
+
{ text: 'Week' },
|
|
94
|
+
{ text: 'Month' }
|
|
95
|
+
]
|
|
96
|
+
})
|
|
97
|
+
segmentedButtonContainer.appendChild(createDemoBlock('Segmented Button', [segmentedButton.element]))
|
|
98
|
+
|
|
99
|
+
// FABs
|
|
100
|
+
const fabContainer = getContainer('fab-container')
|
|
101
|
+
const fab = createFab({
|
|
102
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"/></svg>'
|
|
103
|
+
})
|
|
104
|
+
fabContainer.appendChild(createDemoBlock('Floating Action Button', [fab.element]))
|
|
105
|
+
|
|
106
|
+
// Extended FAB
|
|
107
|
+
const extendedFabContainer = getContainer('extended-fab-container')
|
|
108
|
+
const extendedFab = createExtendedFab({
|
|
109
|
+
icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M440-440H200v-80h240v-240h80v240h240v80H520v240h-80v-240Z"/></svg>',
|
|
110
|
+
text: 'Create'
|
|
111
|
+
})
|
|
112
|
+
extendedFabContainer.appendChild(createDemoBlock('Extended FAB', [extendedFab.element]))
|
|
113
|
+
|
|
114
|
+
// Checkbox
|
|
115
|
+
const checkboxContainer = getContainer('checkbox-container')
|
|
116
|
+
const checkbox1 = createCheckbox({ label: 'Unchecked', name: 'checkbox1' })
|
|
117
|
+
const checkbox2 = createCheckbox({ label: 'Checked', name: 'checkbox2', checked: true })
|
|
118
|
+
const checkbox3 = createCheckbox({ label: 'Disabled', name: 'checkbox3', disabled: true })
|
|
119
|
+
|
|
120
|
+
checkboxContainer.appendChild(createDemoBlock('Checkboxes', [
|
|
121
|
+
checkbox1.element,
|
|
122
|
+
checkbox2.element,
|
|
123
|
+
checkbox3.element
|
|
124
|
+
]))
|
|
125
|
+
|
|
126
|
+
// Switch
|
|
127
|
+
const switchContainer = getContainer('switch-container')
|
|
128
|
+
const switch1 = createSwitch({ label: 'Off', name: 'switch1' })
|
|
129
|
+
const switch2 = createSwitch({ label: 'On', name: 'switch2', checked: true })
|
|
130
|
+
const switch3 = createSwitch({ label: 'Disabled', name: 'switch3', disabled: true })
|
|
131
|
+
|
|
132
|
+
switchContainer.appendChild(createDemoBlock('Switches', [
|
|
133
|
+
switch1.element,
|
|
134
|
+
switch2.element,
|
|
135
|
+
switch3.element
|
|
136
|
+
]))
|
|
137
|
+
|
|
138
|
+
// Radio Buttons
|
|
139
|
+
const radioContainer = getContainer('radio-container')
|
|
140
|
+
const radios = createRadios({
|
|
141
|
+
name: 'fruits',
|
|
142
|
+
options: [
|
|
143
|
+
{ label: 'Apple', value: 'apple' },
|
|
144
|
+
{ label: 'Banana', value: 'banana', checked: true },
|
|
145
|
+
{ label: 'Cherry', value: 'cherry' }
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
radioContainer.appendChild(createDemoBlock('Radio Buttons', [radios.element]))
|
|
149
|
+
|
|
150
|
+
// Text Fields
|
|
151
|
+
const textfieldContainer = getContainer('textfield-container')
|
|
152
|
+
const textfield1 = createTextfield({ label: 'Standard' })
|
|
153
|
+
const textfield2 = createTextfield({ label: 'With placeholder', placeholder: 'Type here...' })
|
|
154
|
+
const textfield3 = createTextfield({ label: 'With helper text', helperText: 'Helper text' })
|
|
155
|
+
const textfield4 = createTextfield({ label: 'With error', error: true, errorText: 'This field has an error' })
|
|
156
|
+
const textfield5 = createTextfield({ label: 'Disabled', disabled: true })
|
|
157
|
+
|
|
158
|
+
textfieldContainer.appendChild(createDemoBlock('Text Fields', [
|
|
159
|
+
textfield1.element,
|
|
160
|
+
textfield2.element,
|
|
161
|
+
textfield3.element,
|
|
162
|
+
textfield4.element,
|
|
163
|
+
textfield5.element
|
|
164
|
+
]))
|
|
165
|
+
|
|
166
|
+
// Search
|
|
167
|
+
const searchContainer = getContainer('search-container')
|
|
168
|
+
const search = createSearch({ placeholder: 'Search...' })
|
|
169
|
+
searchContainer.appendChild(createDemoBlock('Search', [search.element]))
|
|
170
|
+
|
|
171
|
+
// Menu
|
|
172
|
+
const menuContainer = getContainer('menu-container')
|
|
173
|
+
const menuButton = createButton({ text: 'Open Menu', variant: 'filled' })
|
|
174
|
+
const menu = createMenu({
|
|
175
|
+
items: [
|
|
176
|
+
{ text: 'New' },
|
|
177
|
+
{ text: 'Open' },
|
|
178
|
+
{ text: 'Save' },
|
|
179
|
+
{ divider: true },
|
|
180
|
+
{ text: 'Exit' }
|
|
181
|
+
],
|
|
182
|
+
anchor: menuButton.element
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
menuButton.element.addEventListener('click', () => {
|
|
186
|
+
menu.open()
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
menuContainer.appendChild(createDemoBlock('Menu', [menuButton.element, menu.element]))
|
|
190
|
+
|
|
191
|
+
// Tabs
|
|
192
|
+
const tabsContainer = getContainer('tabs-container')
|
|
193
|
+
const tabs = createTabs({
|
|
194
|
+
tabs: [
|
|
195
|
+
{ label: 'Home', icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M240-200h120v-240h240v240h120v-360L480-740 240-560v360Zm-80 80v-480l320-240 320 240v480H520v-240h-80v240H160Zm320-350Z"/></svg>' },
|
|
196
|
+
{ label: 'Favorites', icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m480-120-58-52q-101-91-167-157T150-447.5Q111-500 95.5-544T80-634q0-94 63-157t157-63q52 0 99 22t81 62q34-40 81-62t99-22q94 0 157 63t63 157q0 46-15.5 90T810-447.5Q771-395 705-329T538-172l-58 52Zm0-108q96-86 158-147.5t98-107q36-45.5 50-81t14-70.5q0-60-40-100t-100-40q-47 0-87 26.5T518-680h-76q-15-41-55-67.5T300-774q-60 0-100 40t-40 100q0 35 14 70.5t50 81q36 45.5 98 107T480-228Zm0-273Z"/></svg>' },
|
|
197
|
+
{ label: 'Profile', icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-480q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47ZM160-160v-112q0-34 17.5-62.5T224-378q62-31 126-46.5T480-440q66 0 130 15.5T736-378q29 15 46.5 43.5T800-272v112H160Zm80-80h480v-32q0-11-5.5-20T700-306q-54-27-109-40.5T480-360q-56 0-111 13.5T260-306q-9 5-14.5 14t-5.5 20v32Zm240-320q33 0 56.5-23.5T560-640q0-33-23.5-56.5T480-720q-33 0-56.5 23.5T400-640q0 33 23.5 56.5T480-560Zm0-80Zm0 400Z"/></svg>' }
|
|
198
|
+
]
|
|
199
|
+
})
|
|
200
|
+
tabsContainer.appendChild(createDemoBlock('Tabs', [tabs.element]))
|
|
201
|
+
|
|
202
|
+
// Navigation
|
|
203
|
+
const navigationContainer = getContainer('navigation-container')
|
|
204
|
+
const navigation = createNavigation({
|
|
205
|
+
items: [
|
|
206
|
+
{ label: 'Home', icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M240-200h120v-240h240v240h120v-360L480-740 240-560v360Zm-80 80v-480l320-240 320 240v480H520v-240h-80v240H160Zm320-350Z"/></svg>', active: true },
|
|
207
|
+
{ label: 'Search', icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>' },
|
|
208
|
+
{ label: 'Favorites', icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m480-120-58-52q-101-91-167-157T150-447.5Q111-500 95.5-544T80-634q0-94 63-157t157-63q52 0 99 22t81 62q34-40 81-62t99-22q94 0 157 63t63 157q0 46-15.5 90T810-447.5Q771-395 705-329T538-172l-58 52Zm0-108q96-86 158-147.5t98-107q36-45.5 50-81t14-70.5q0-60-40-100t-100-40q-47 0-87 26.5T518-680h-76q-15-41-55-67.5T300-774q-60 0-100 40t-40 100q0 35 14 70.5t50 81q36 45.5 98 107T480-228Zm0-273Z"/></svg>' },
|
|
209
|
+
{ label: 'Settings', icon: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm112-260q58 0 99-41t41-99q0-58-41-99t-99-41q-58 0-99 41t-41 99q0 58 41 99t99 41Z"/></svg>' }
|
|
210
|
+
]
|
|
211
|
+
})
|
|
212
|
+
navigationContainer.appendChild(createDemoBlock('Navigation', [navigation.element]))
|
|
213
|
+
|
|
214
|
+
// Snackbar
|
|
215
|
+
const snackbarContainer = getContainer('snackbar-container')
|
|
216
|
+
const snackbarButton = createButton({ text: 'Show Snackbar', variant: 'filled' })
|
|
217
|
+
const snackbar = createSnackbar({
|
|
218
|
+
message: 'This is a snackbar message',
|
|
219
|
+
action: 'Dismiss',
|
|
220
|
+
duration: 4000
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
snackbarButton.element.addEventListener('click', () => {
|
|
224
|
+
snackbar.show()
|
|
225
|
+
})
|
|
226
|
+
|
|
227
|
+
snackbarContainer.appendChild(createDemoBlock('Snackbar', [snackbarButton.element, snackbar.element]))
|
|
228
|
+
|
|
229
|
+
// Tooltip
|
|
230
|
+
const tooltipContainer = getContainer('tooltip-container')
|
|
231
|
+
const tooltipButton = createButton({ text: 'Hover Me', variant: 'filled' })
|
|
232
|
+
const tooltip = createTooltip({
|
|
233
|
+
text: 'This is a tooltip',
|
|
234
|
+
target: tooltipButton.element
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
tooltipContainer.appendChild(createDemoBlock('Tooltip', [tooltipButton.element]))
|
|
238
|
+
|
|
239
|
+
// Progress
|
|
240
|
+
const progressContainer = getContainer('progress-container')
|
|
241
|
+
const linearProgress = createProgress({ type: 'linear' })
|
|
242
|
+
const circularProgress = createProgress({ type: 'circular' })
|
|
243
|
+
|
|
244
|
+
progressContainer.appendChild(createDemoBlock('Progress Indicators', [
|
|
245
|
+
linearProgress.element,
|
|
246
|
+
circularProgress.element
|
|
247
|
+
]))
|
|
248
|
+
|
|
249
|
+
// Card
|
|
250
|
+
const cardContainer = getContainer('card-container')
|
|
251
|
+
const card = createCard({
|
|
252
|
+
title: 'Card Title',
|
|
253
|
+
subtitle: 'Card Subtitle',
|
|
254
|
+
content: 'This is the content of the card which provides more detailed information about the subject.',
|
|
255
|
+
media: true,
|
|
256
|
+
mediaContent: '<div class="demo-card-media"></div>',
|
|
257
|
+
actions: [
|
|
258
|
+
{ text: 'Action 1' },
|
|
259
|
+
{ text: 'Action 2' }
|
|
260
|
+
]
|
|
261
|
+
})
|
|
262
|
+
cardContainer.appendChild(createDemoBlock('Card', [card.element]))
|
|
263
|
+
|
|
264
|
+
// Dialog
|
|
265
|
+
const dialogContainer = getContainer('dialog-container')
|
|
266
|
+
const dialogButton = createButton({ text: 'Open Dialog', variant: 'filled' })
|
|
267
|
+
const dialog = createDialog({
|
|
268
|
+
title: 'Dialog Title',
|
|
269
|
+
content: 'This is a dialog content. Dialogs inform users about a task and can contain critical information or require decisions.',
|
|
270
|
+
actions: [
|
|
271
|
+
{ text: 'Cancel', variant: 'text' },
|
|
272
|
+
{ text: 'OK', variant: 'filled' }
|
|
273
|
+
]
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
dialogButton.element.addEventListener('click', () => {
|
|
277
|
+
dialog.open()
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
dialogContainer.appendChild(createDemoBlock('Dialog', [dialogButton.element, dialog.element]))
|
|
281
|
+
|
|
282
|
+
// Sheet
|
|
283
|
+
const sheetContainer = getContainer('sheet-container')
|
|
284
|
+
const sheetButton = createButton({ text: 'Open Sheet', variant: 'filled' })
|
|
285
|
+
const sheet = createSheet({
|
|
286
|
+
title: 'Bottom Sheet',
|
|
287
|
+
content: 'This is the content of a bottom sheet, which slides up from the bottom of the screen.',
|
|
288
|
+
actions: [
|
|
289
|
+
{ text: 'Close', variant: 'text' }
|
|
290
|
+
]
|
|
291
|
+
})
|
|
292
|
+
|
|
293
|
+
sheetButton.element.addEventListener('click', () => {
|
|
294
|
+
sheet.open()
|
|
295
|
+
})
|
|
296
|
+
|
|
297
|
+
sheetContainer.appendChild(createDemoBlock('Bottom Sheet', [sheetButton.element, sheet.element]))
|
|
298
|
+
|
|
299
|
+
// Badge
|
|
300
|
+
const badgeContainer = getContainer('badge-container')
|
|
301
|
+
const badgeButton = createButton({ text: 'Notifications', variant: 'filled' })
|
|
302
|
+
const badge = createBadge({
|
|
303
|
+
content: '5',
|
|
304
|
+
target: badgeButton.element,
|
|
305
|
+
position: 'top-right'
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
badgeContainer.appendChild(createDemoBlock('Badge', [badgeButton.element]))
|
|
309
|
+
|
|
310
|
+
// Chip
|
|
311
|
+
const chipContainer = getContainer('chip-container')
|
|
312
|
+
const chip1 = createChip({ text: 'Basic Chip' })
|
|
313
|
+
const chip2 = createChip({
|
|
314
|
+
text: 'Deletable',
|
|
315
|
+
deletable: true,
|
|
316
|
+
onDelete: () => console.log('Chip deleted')
|
|
317
|
+
})
|
|
318
|
+
const chip3 = createChip({
|
|
319
|
+
text: 'With Icon',
|
|
320
|
+
leadingIcon: '<svg xmlns="http://www.w3.org/2000/svg" height="18" viewBox="0 -960 960 960" width="18"><path d="M480-120q-75 0-140.5-28.5t-114-77q-48.5-48.5-77-114T120-480q0-75 28.5-140.5t77-114q48.5-48.5 114-77T480-840q75 0 140.5 28.5t114 77q48.5 48.5 77 114T840-480q0 75-28.5 140.5t-77 114q-48.5 48.5-114 77T480-120Zm0-360Zm0 280q117 0 198.5-81.5T760-480q0-117-81.5-198.5T480-760q-117 0-198.5 81.5T200-480q0 117 81.5 198.5T480-200Zm-40-120-160-160 56-56 104 104 224-224 56 56-280 280Z"/></svg>'
|
|
321
|
+
})
|
|
322
|
+
|
|
323
|
+
chipContainer.appendChild(createDemoBlock('Chips', [chip1.element, chip2.element, chip3.element]))
|
|
324
|
+
|
|
325
|
+
// Divider
|
|
326
|
+
const dividerContainer = getContainer('divider-container')
|
|
327
|
+
const divider1 = createDivider({})
|
|
328
|
+
const divider2 = createDivider({ inset: true })
|
|
329
|
+
const divider3 = createDivider({ text: 'OR' })
|
|
330
|
+
|
|
331
|
+
dividerContainer.appendChild(createDemoBlock('Dividers', [
|
|
332
|
+
createTextElement('Regular divider:'),
|
|
333
|
+
divider1.element,
|
|
334
|
+
createTextElement('Inset divider:'),
|
|
335
|
+
divider2.element,
|
|
336
|
+
createTextElement('Text divider:'),
|
|
337
|
+
divider3.element
|
|
338
|
+
]))
|
|
339
|
+
|
|
340
|
+
// Carousel
|
|
341
|
+
const carouselContainer = getContainer('carousel-container')
|
|
342
|
+
const carousel = createCarousel({
|
|
343
|
+
items: [
|
|
344
|
+
{ content: '<div class="carousel-item">Slide 1</div>' },
|
|
345
|
+
{ content: '<div class="carousel-item">Slide 2</div>' },
|
|
346
|
+
{ content: '<div class="carousel-item">Slide 3</div>' }
|
|
347
|
+
],
|
|
348
|
+
autoplay: false,
|
|
349
|
+
indicators: true,
|
|
350
|
+
controls: true
|
|
351
|
+
})
|
|
352
|
+
carouselContainer.appendChild(createDemoBlock('Carousel', [carousel.element]))
|
|
353
|
+
|
|
354
|
+
// Date Picker
|
|
355
|
+
const datePickerContainer = getContainer('date-picker-container')
|
|
356
|
+
const datePickerButton = createButton({ text: 'Select Date', variant: 'filled' })
|
|
357
|
+
const datePicker = createDatePicker({
|
|
358
|
+
inline: false
|
|
359
|
+
})
|
|
360
|
+
|
|
361
|
+
datePickerButton.element.addEventListener('click', () => {
|
|
362
|
+
datePicker.open()
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
datePickerContainer.appendChild(createDemoBlock('Date Picker', [datePickerButton.element, datePicker.element]))
|
|
366
|
+
|
|
367
|
+
// Time Picker
|
|
368
|
+
const timePickerContainer = getContainer('time-picker-container')
|
|
369
|
+
const timePickerButton = createButton({ text: 'Select Time', variant: 'filled' })
|
|
370
|
+
const timePicker = createTimePicker({
|
|
371
|
+
inline: false
|
|
372
|
+
})
|
|
373
|
+
|
|
374
|
+
timePickerButton.element.addEventListener('click', () => {
|
|
375
|
+
timePicker.open()
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
timePickerContainer.appendChild(createDemoBlock('Time Picker', [timePickerButton.element, timePicker.element]))
|
|
379
|
+
|
|
380
|
+
// Slider
|
|
381
|
+
const sliderContainer = getContainer('slider-container')
|
|
382
|
+
const slider1 = createSlider({ min: 0, max: 100, value: 50 })
|
|
383
|
+
const slider2 = createSlider({
|
|
384
|
+
min: 0,
|
|
385
|
+
max: 100,
|
|
386
|
+
value: 40,
|
|
387
|
+
step: 10,
|
|
388
|
+
markers: true,
|
|
389
|
+
discrete: true
|
|
390
|
+
})
|
|
391
|
+
|
|
392
|
+
sliderContainer.appendChild(createDemoBlock('Sliders', [
|
|
393
|
+
slider1.element,
|
|
394
|
+
slider2.element
|
|
395
|
+
]))
|
|
396
|
+
|
|
397
|
+
// List
|
|
398
|
+
const listContainer = getContainer('list-container')
|
|
399
|
+
const list = createList({
|
|
400
|
+
items: [
|
|
401
|
+
{
|
|
402
|
+
primary: 'Item 1',
|
|
403
|
+
secondary: 'Secondary text',
|
|
404
|
+
leading: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M479.765-124Q434-124 398-145.5q-36-21.5-58-58q-42-1-79.5-14.5t-70-35.5q-32.5-22-58.5-54t-40-70q-17 6-35 10t-37 4q-17 0-28.5-11.5T-19-403q0-16 11.5-29.5T24-450q16-7 29-18.5t19-27.5q-7-16-17-36t-17.5-44.5Q31-601 38-628.5t29-43q13-10 30-10t30 8q13 8 20 23t10 33q13.5 0 25.75 1.5t26.25 4.5q-14-42-46.5-68t-77.5-26q-13 0-21.5-8.5T55-736q0-13 8.5-21.5T85-766q68 0 119 33.5T284-640q41-10 84-10 83 0 156 31.5T651-533q54 54 85.5 127T768-250q0 53-37.5 89.5T642-124q-22 0-42-5.5T564-148q-19 14-41 19t-43.235 5ZM272-444q-58-13-95-55.5T140-600q0-38 27-65t65-27q21 0 40 8t32 24q20-16 44.5-24.5T398-693q79 0 133.5 54.5T586-505q0 67-43 118t-110 62q-8 54-47 87.5T281-204q-62 0-106-44t-44-106q0-26 8-49t28-41h105Zm272 116q32-18 54-49t22-68q0-37-27-63.5T530-535q-17 0-32 5.5T474-514q-8-16-26.5-28.5T412-555q-29 0-47.5 18.5T346-490q0 18 18 36t42 30l138 76Zm55 124q16 0 27-11t11-27q0-16-11-27t-27-11q-16 0-27 11t-11 27q0 16 11 27t27 11Zm-16-160Z"/></svg>'
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
primary: 'Item 2',
|
|
408
|
+
secondary: 'Secondary text',
|
|
409
|
+
leading: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M140-160q-24 0-42-18t-18-42v-520q0-24 18-42t42-18h680q24 0 42 18t18 42v520q0 24-18 42t-42 18H140Zm0-60h680v-449H140v449Zm160-106q17 0 28.5-11.5T340-366q0-17-11.5-28.5T300-406q-17 0-28.5 11.5T260-366q0 17 11.5 28.5T300-326Zm180 0q17 0 28.5-11.5T520-366q0-17-11.5-28.5T480-406q-17 0-28.5 11.5T440-366q0 17 11.5 28.5T480-326Zm180 0q17 0 28.5-11.5T700-366q0-17-11.5-28.5T660-406q-17 0-28.5 11.5T620-366q0 17 11.5 28.5T660-326Z"/></svg>'
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
primary: 'Item 3',
|
|
413
|
+
secondary: 'Secondary text',
|
|
414
|
+
leading: '<svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m600-120-240-92-240 92v-680h480v680Zm-240-154 160 62v-528H200v528l160-62Zm0 0-160 62v-528h320v528l-160-62Zm0-294Z"/></svg>'
|
|
415
|
+
}
|
|
416
|
+
]
|
|
417
|
+
})
|
|
418
|
+
|
|
419
|
+
listContainer.appendChild(createDemoBlock('List', [list.element]))
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
// Helper function to create a demo block
|
|
423
|
+
function createDemoBlock (title, components) {
|
|
424
|
+
const block = document.createElement('div')
|
|
425
|
+
block.className = 'demo-block'
|
|
426
|
+
|
|
427
|
+
const blockTitle = document.createElement('h3')
|
|
428
|
+
blockTitle.textContent = title
|
|
429
|
+
block.appendChild(blockTitle)
|
|
430
|
+
|
|
431
|
+
const content = document.createElement('div')
|
|
432
|
+
content.className = 'demo-content'
|
|
433
|
+
|
|
434
|
+
components.forEach(component => {
|
|
435
|
+
content.appendChild(component)
|
|
436
|
+
})
|
|
437
|
+
|
|
438
|
+
block.appendChild(content)
|
|
439
|
+
return block
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
// Helper function to create a text element for demos
|
|
443
|
+
function createTextElement (text) {
|
|
444
|
+
const element = document.createElement('p')
|
|
445
|
+
element.textContent = text
|
|
446
|
+
element.className = 'demo-text'
|
|
447
|
+
return element
|
|
448
|
+
}
|
package/demo/styles.css
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// demo/styles.scss
|
|
2
|
+
|
|
3
|
+
// Import the main styles from the source code
|
|
4
|
+
@use '../src/styles/main.scss';
|
|
5
|
+
|
|
6
|
+
/* Base styles */
|
|
7
|
+
:root {
|
|
8
|
+
--primary-color: #6750a4;
|
|
9
|
+
--on-primary-color: #ffffff;
|
|
10
|
+
--primary-container-color: #eaddff;
|
|
11
|
+
--on-primary-container-color: #21005d;
|
|
12
|
+
--secondary-color: #625b71;
|
|
13
|
+
--on-secondary-color: #ffffff;
|
|
14
|
+
--secondary-container-color: #e8def8;
|
|
15
|
+
--on-secondary-container-color: #1d192b;
|
|
16
|
+
--tertiary-color: #7d5260;
|
|
17
|
+
--surface-color: #fffbfe;
|
|
18
|
+
--on-surface-color: #1c1b1f;
|
|
19
|
+
--surface-variant-color: #e7e0ec;
|
|
20
|
+
--on-surface-variant-color: #49454f;
|
|
21
|
+
--outline-color: #79747e;
|
|
22
|
+
--background-color: #fffbfe;
|
|
23
|
+
--error-color: #b3261e;
|
|
24
|
+
|
|
25
|
+
--elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);
|
|
26
|
+
--elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
|
|
27
|
+
--elevation-3: 0px 4px 8px 3px rgba(0, 0, 0, 0.15);
|
|
28
|
+
|
|
29
|
+
--spacing-1: 4px;
|
|
30
|
+
--spacing-2: 8px;
|
|
31
|
+
--spacing-3: 12px;
|
|
32
|
+
--spacing-4: 16px;
|
|
33
|
+
--spacing-5: 24px;
|
|
34
|
+
--spacing-6: 32px;
|
|
35
|
+
|
|
36
|
+
--border-radius-small: 4px;
|
|
37
|
+
--border-radius-medium: 8px;
|
|
38
|
+
--border-radius-large: 16px;
|
|
39
|
+
--border-radius-full: 9999px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/* Dark theme support */
|
|
43
|
+
@media (prefers-color-scheme: dark) {
|
|
44
|
+
:root {
|
|
45
|
+
--primary-color: #d0bcff;
|
|
46
|
+
--on-primary-color: #381e72;
|
|
47
|
+
--primary-container-color: #4f378b;
|
|
48
|
+
--on-primary-container-color: #eaddff;
|
|
49
|
+
--secondary-color: #ccc2dc;
|
|
50
|
+
--on-secondary-color: #332d41;
|
|
51
|
+
--secondary-container-color: #4a4458;
|
|
52
|
+
--on-secondary-container-color: #e8def8;
|
|
53
|
+
--tertiary-color: #efb8c8;
|
|
54
|
+
--surface-color: #1c1b1f;
|
|
55
|
+
--on-surface-color: #e6e1e5;
|
|
56
|
+
--surface-variant-color: #49454f;
|
|
57
|
+
--on-surface-variant-color: #cac4d0;
|
|
58
|
+
--outline-color: #938f99;
|
|
59
|
+
--background-color: #1c1b1f;
|
|
60
|
+
--error-color: #f2b8b5;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Core styles */
|
|
65
|
+
* {
|
|
66
|
+
box-sizing: border-box;
|
|
67
|
+
margin: 0;
|
|
68
|
+
padding: 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
body {
|
|
72
|
+
font-family: 'Roboto', sans-serif;
|
|
73
|
+
background-color: var(--background-color);
|
|
74
|
+
color: var(--on-surface-color);
|
|
75
|
+
line-height: 1.5;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Layout */
|
|
79
|
+
.content {
|
|
80
|
+
max-width: 1200px;
|
|
81
|
+
margin: 0 auto;
|
|
82
|
+
padding: var(--spacing-5);
|
|
83
|
+
margin-bottom: 120px; /* For bottom app bar */
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* Component Sections */
|
|
87
|
+
.component-section {
|
|
88
|
+
margin-bottom: var(--spacing-6);
|
|
89
|
+
padding: var(--spacing-4);
|
|
90
|
+
border-radius: var(--border-radius-medium);
|
|
91
|
+
background-color: var(--surface-color);
|
|
92
|
+
box-shadow: var(--elevation-1);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.component-section h2 {
|
|
96
|
+
color: var(--primary-color);
|
|
97
|
+
margin-bottom: var(--spacing-4);
|
|
98
|
+
font-size: 1.5rem;
|
|
99
|
+
border-bottom: 1px solid var(--outline-color);
|
|
100
|
+
padding-bottom: var(--spacing-2);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.component-row {
|
|
104
|
+
display: flex;
|
|
105
|
+
flex-wrap: wrap;
|
|
106
|
+
gap: var(--spacing-5);
|
|
107
|
+
align-items: flex-start;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.align-top {
|
|
111
|
+
align-items: flex-start;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Demo Blocks */
|
|
115
|
+
.demo-block {
|
|
116
|
+
flex: 1;
|
|
117
|
+
min-width: 300px;
|
|
118
|
+
margin-bottom: var(--spacing-4);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.demo-block h3 {
|
|
122
|
+
font-size: 1rem;
|
|
123
|
+
color: var(--on-surface-variant-color);
|
|
124
|
+
margin-bottom: var(--spacing-3);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.demo-content {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-direction: column;
|
|
130
|
+
gap: var(--spacing-3);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* Intro section */
|
|
134
|
+
#intro {
|
|
135
|
+
text-align: center;
|
|
136
|
+
margin-bottom: var(--spacing-6);
|
|
137
|
+
padding: var(--spacing-6) 0;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
#intro h1 {
|
|
141
|
+
color: var(--primary-color);
|
|
142
|
+
font-size: 2.5rem;
|
|
143
|
+
margin-bottom: var(--spacing-3);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
#intro p {
|
|
147
|
+
color: var(--on-surface-variant-color);
|
|
148
|
+
font-size: 1.2rem;
|
|
149
|
+
max-width: 600px;
|
|
150
|
+
margin: 0 auto;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* App Bars */
|
|
154
|
+
.top-app-bar {
|
|
155
|
+
position: sticky;
|
|
156
|
+
top: 0;
|
|
157
|
+
z-index: 1000;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/* Carousel */
|
|
161
|
+
.carousel-item {
|
|
162
|
+
height: 200px;
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
background-color: var(--primary-container-color);
|
|
167
|
+
color: var(--on-primary-container-color);
|
|
168
|
+
font-weight: bold;
|
|
169
|
+
border-radius: var(--border-radius-medium);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* Card Demo */
|
|
173
|
+
.demo-card-media {
|
|
174
|
+
height: 140px;
|
|
175
|
+
background-color: var(--primary-container-color);
|
|
176
|
+
background-image: linear-gradient(45deg, var(--primary-color) 25%, transparent 25%, transparent 50%, var(--primary-color) 50%, var(--primary-color) 75%, transparent 75%, transparent);
|
|
177
|
+
background-size: 20px 20px;
|
|
178
|
+
border-radius: var(--border-radius-medium) var(--border-radius-medium) 0 0;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Hack to ensure components like dialog, sheet, tooltip are visible in the demo */
|
|
182
|
+
.mtrl-dialog, .mtrl-sheet, .mtrl-tooltip {
|
|
183
|
+
position: absolute; /* Override fixed positioning for demo */
|
|
184
|
+
z-index: 2; /* Lower z-index for demo */
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Display helpers */
|
|
188
|
+
.demo-text {
|
|
189
|
+
margin: var(--spacing-2) 0;
|
|
190
|
+
color: var(--on-surface-variant-color);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* Responsive adjustments */
|
|
194
|
+
@media (max-width: 768px) {
|
|
195
|
+
.component-row {
|
|
196
|
+
flex-direction: column;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.demo-block {
|
|
200
|
+
width: 100%;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* Component-specific styling overrides for demo purposes */
|
|
205
|
+
.mtrl-button {
|
|
206
|
+
margin-right: var(--spacing-2);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
.mtrl-textfield {
|
|
210
|
+
width: 100%;
|
|
211
|
+
max-width: 300px;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.mtrl-card {
|
|
215
|
+
max-width: 320px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.mtrl-list {
|
|
219
|
+
max-width: 400px;
|
|
220
|
+
border: 1px solid var(--outline-color);
|
|
221
|
+
border-radius: var(--border-radius-medium);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.mtrl-slider {
|
|
225
|
+
width: 100%;
|
|
226
|
+
max-width: 300px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.mtrl-navigation {
|
|
230
|
+
width: 300px;
|
|
231
|
+
border: 1px solid var(--outline-color);
|
|
232
|
+
border-radius: var(--border-radius-medium);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.mtrl-tabs {
|
|
236
|
+
width: 100%;
|
|
237
|
+
max-width: 400px;
|
|
238
|
+
border-bottom: 1px solid var(--outline-color);
|
|
239
|
+
}
|