webcoreui 1.4.0 → 1.5.0-beta.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/README.md +15 -1
- package/astro.d.ts +62 -56
- package/astro.js +4 -0
- package/components/Accordion/Accordion.astro +1 -1
- package/components/Accordion/Accordion.svelte +60 -58
- package/components/Accordion/Accordion.tsx +3 -1
- package/components/Alert/Alert.astro +2 -1
- package/components/Alert/Alert.svelte +12 -5
- package/components/Alert/Alert.tsx +10 -3
- package/components/Alert/alert.ts +2 -18
- package/components/AspectRatio/AspectRatio.astro +1 -1
- package/components/AspectRatio/AspectRatio.svelte +27 -22
- package/components/AspectRatio/AspectRatio.tsx +6 -3
- package/components/AspectRatio/aspectratio.ts +0 -10
- package/components/Avatar/Avatar.astro +1 -1
- package/components/Avatar/Avatar.svelte +7 -5
- package/components/Avatar/Avatar.tsx +3 -2
- package/components/Avatar/avatar.module.scss +3 -5
- package/components/Badge/Badge.astro +2 -1
- package/components/Badge/Badge.svelte +11 -4
- package/components/Badge/Badge.tsx +8 -3
- package/components/Badge/badge.module.scss +5 -6
- package/components/Badge/badge.ts +11 -13
- package/components/Banner/Banner.astro +1 -1
- package/components/Banner/Banner.svelte +11 -5
- package/components/Banner/Banner.tsx +6 -2
- package/components/Banner/banner.module.scss +4 -6
- package/components/Banner/banner.ts +0 -10
- package/components/BottomNavigation/BottomNavigation.astro +1 -1
- package/components/BottomNavigation/BottomNavigation.svelte +7 -4
- package/components/BottomNavigation/BottomNavigation.tsx +3 -2
- package/components/BottomNavigation/bottomnavigation.module.scss +68 -70
- package/components/Breadcrumb/Breadcrumb.astro +1 -1
- package/components/Breadcrumb/Breadcrumb.svelte +5 -3
- package/components/Breadcrumb/Breadcrumb.tsx +3 -1
- package/components/Button/Button.astro +2 -1
- package/components/Button/Button.svelte +11 -4
- package/components/Button/Button.tsx +7 -2
- package/components/Button/button.module.scss +9 -12
- package/components/Button/button.ts +23 -20
- package/components/Card/Card.astro +9 -2
- package/components/Card/Card.svelte +21 -8
- package/components/Card/Card.tsx +23 -6
- package/components/Card/card.module.scss +12 -9
- package/components/Card/card.ts +3 -16
- package/components/Carousel/Carousel.astro +3 -3
- package/components/Carousel/Carousel.svelte +24 -19
- package/components/Carousel/Carousel.tsx +9 -4
- package/components/Carousel/carousel.module.scss +3 -5
- package/components/Carousel/carousel.ts +0 -12
- package/components/CarouselItem/CarouselItem.astro +14 -0
- package/components/CarouselItem/CarouselItem.svelte +18 -0
- package/components/CarouselItem/CarouselItem.tsx +18 -0
- package/components/CarouselItem/carouselItem.ts +4 -0
- package/components/Checkbox/Checkbox.astro +3 -6
- package/components/Checkbox/Checkbox.svelte +13 -10
- package/components/Checkbox/Checkbox.tsx +8 -5
- package/components/Checkbox/checkbox.module.scss +4 -6
- package/components/Checkbox/checkbox.ts +2 -17
- package/components/Collapsible/Collapsible.astro +1 -1
- package/components/Collapsible/Collapsible.svelte +13 -6
- package/components/Collapsible/Collapsible.tsx +8 -2
- package/components/Collapsible/collapsible.module.scss +5 -5
- package/components/Collapsible/collapsible.ts +0 -15
- package/components/ConditionalWrapper/ConditionalWrapper.astro +1 -1
- package/components/ConditionalWrapper/ConditionalWrapper.svelte +8 -2
- package/components/ConditionalWrapper/ConditionalWrapper.tsx +7 -2
- package/components/ConditionalWrapper/conditionalwrapper.ts +2 -14
- package/components/ContextMenu/ContextMenu.astro +2 -1
- package/components/ContextMenu/ContextMenu.svelte +17 -9
- package/components/ContextMenu/ContextMenu.tsx +8 -2
- package/components/ContextMenu/contextmenu.ts +2 -17
- package/components/Copy/Copy.astro +2 -2
- package/components/Copy/Copy.svelte +10 -5
- package/components/Copy/Copy.tsx +7 -3
- package/components/Copy/copy.ts +2 -12
- package/components/Counter/Counter.astro +3 -2
- package/components/Counter/Counter.svelte +16 -10
- package/components/Counter/Counter.tsx +11 -7
- package/components/Counter/counter.module.scss +3 -5
- package/components/Counter/counter.ts +2 -11
- package/components/DataTable/DataTable.astro +1 -1
- package/components/DataTable/DataTable.svelte +23 -15
- package/components/DataTable/DataTable.tsx +7 -2
- package/components/DataTable/datatable.ts +0 -12
- package/components/Flex/Flex.astro +2 -1
- package/components/Flex/Flex.svelte +12 -6
- package/components/Flex/Flex.tsx +8 -3
- package/components/Flex/flex.ts +2 -15
- package/components/Footer/Footer.astro +1 -1
- package/components/Footer/Footer.svelte +13 -8
- package/components/Footer/Footer.tsx +6 -2
- package/components/Footer/footer.ts +0 -10
- package/components/Grid/Grid.astro +2 -1
- package/components/Grid/Grid.svelte +12 -6
- package/components/Grid/Grid.tsx +8 -3
- package/components/Grid/grid.ts +2 -15
- package/components/Group/Group.astro +1 -1
- package/components/Group/Group.svelte +9 -4
- package/components/Group/Group.tsx +6 -2
- package/components/Group/group.ts +0 -10
- package/components/Icon/Icon.astro +1 -1
- package/components/Icon/Icon.svelte +16 -9
- package/components/Icon/Icon.tsx +3 -2
- package/components/Image/Image.astro +2 -1
- package/components/Image/Image.svelte +54 -51
- package/components/Image/Image.tsx +3 -1
- package/components/Image/image.ts +2 -3
- package/components/ImageLoader/ImageLoader.astro +1 -1
- package/components/ImageLoader/ImageLoader.svelte +5 -3
- package/components/ImageLoader/ImageLoader.tsx +3 -1
- package/components/Input/Input.astro +3 -2
- package/components/Input/Input.svelte +19 -9
- package/components/Input/Input.tsx +11 -3
- package/components/Input/input.ts +26 -53
- package/components/Kbd/Kbd.astro +1 -1
- package/components/Kbd/Kbd.svelte +9 -4
- package/components/Kbd/Kbd.tsx +6 -2
- package/components/Kbd/kbd.ts +0 -10
- package/components/List/List.astro +1 -1
- package/components/List/List.svelte +13 -9
- package/components/List/List.tsx +10 -6
- package/components/List/list.ts +0 -8
- package/components/Masonry/Masonry.astro +1 -1
- package/components/Masonry/Masonry.svelte +14 -9
- package/components/Masonry/Masonry.tsx +7 -3
- package/components/Masonry/masonry.module.scss +4 -6
- package/components/Masonry/masonry.ts +2 -13
- package/components/Menu/Menu.astro +1 -1
- package/components/Menu/Menu.svelte +13 -7
- package/components/Menu/Menu.tsx +6 -2
- package/components/Menu/menu.ts +0 -10
- package/components/Modal/Modal.astro +2 -3
- package/components/Modal/Modal.svelte +12 -8
- package/components/Modal/Modal.tsx +6 -4
- package/components/Modal/modal.module.scss +5 -5
- package/components/Modal/modal.ts +2 -14
- package/components/OTPInput/OTPInput.astro +3 -5
- package/components/OTPInput/OTPInput.svelte +10 -10
- package/components/OTPInput/OTPInput.tsx +10 -8
- package/components/OTPInput/otpinput.module.scss +0 -12
- package/components/OTPInput/otpinput.ts +2 -4
- package/components/Pagination/Pagination.astro +1 -1
- package/components/Pagination/Pagination.svelte +8 -4
- package/components/Pagination/Pagination.tsx +6 -2
- package/components/Pagination/pagination.ts +0 -8
- package/components/Popover/Popover.astro +3 -7
- package/components/Popover/Popover.svelte +11 -10
- package/components/Popover/Popover.tsx +9 -12
- package/components/Popover/popover.ts +2 -15
- package/components/Progress/Progress.astro +1 -1
- package/components/Progress/Progress.svelte +8 -6
- package/components/Progress/Progress.tsx +3 -1
- package/components/Progress/progress.module.scss +15 -17
- package/components/Radio/Radio.astro +4 -4
- package/components/Radio/Radio.svelte +15 -8
- package/components/Radio/Radio.tsx +8 -5
- package/components/Radio/radio.module.scss +4 -6
- package/components/Radio/radio.ts +3 -14
- package/components/RangeSlider/RangeSlider.astro +5 -2
- package/components/RangeSlider/RangeSlider.svelte +20 -35
- package/components/RangeSlider/RangeSlider.tsx +11 -4
- package/components/RangeSlider/rangeslider.module.scss +14 -16
- package/components/RangeSlider/rangeslider.ts +1 -9
- package/components/Rating/Rating.astro +1 -1
- package/components/Rating/Rating.svelte +10 -7
- package/components/Rating/Rating.tsx +3 -1
- package/components/Rating/rating.module.scss +13 -15
- package/components/Ribbon/Ribbon.astro +1 -1
- package/components/Ribbon/Ribbon.svelte +9 -4
- package/components/Ribbon/Ribbon.tsx +6 -2
- package/components/Ribbon/ribbon.module.scss +9 -11
- package/components/Ribbon/ribbon.ts +0 -10
- package/components/Select/Select.astro +3 -1
- package/components/Select/Select.svelte +179 -171
- package/components/Select/Select.tsx +11 -4
- package/components/Select/select.ts +2 -12
- package/components/Sheet/Sheet.astro +2 -1
- package/components/Sheet/Sheet.svelte +7 -5
- package/components/Sheet/Sheet.tsx +5 -4
- package/components/Sheet/sheet.ts +3 -10
- package/components/Sidebar/Sidebar.astro +1 -1
- package/components/Sidebar/Sidebar.svelte +9 -4
- package/components/Sidebar/Sidebar.tsx +6 -2
- package/components/Sidebar/sidebar.ts +0 -10
- package/components/Skeleton/Skeleton.astro +1 -1
- package/components/Skeleton/Skeleton.svelte +7 -5
- package/components/Skeleton/Skeleton.tsx +3 -1
- package/components/Skeleton/skeleton.module.scss +6 -9
- package/components/Slider/Slider.astro +7 -5
- package/components/Slider/Slider.svelte +18 -10
- package/components/Slider/Slider.tsx +12 -6
- package/components/Slider/slider.module.scss +12 -14
- package/components/Slider/slider.ts +3 -12
- package/components/SpeedDial/SpeedDial.astro +1 -1
- package/components/SpeedDial/SpeedDial.svelte +6 -4
- package/components/SpeedDial/SpeedDial.tsx +4 -2
- package/components/SpeedDial/speeddial.module.scss +4 -6
- package/components/Spinner/Spinner.astro +1 -1
- package/components/Spinner/Spinner.svelte +7 -5
- package/components/Spinner/Spinner.tsx +3 -1
- package/components/Spinner/spinner.module.scss +13 -14
- package/components/Spoiler/Spoiler.astro +1 -1
- package/components/Spoiler/Spoiler.svelte +11 -5
- package/components/Spoiler/Spoiler.tsx +6 -2
- package/components/Spoiler/spoiler.module.scss +3 -5
- package/components/Spoiler/spoiler.ts +0 -10
- package/components/Stepper/Stepper.astro +1 -1
- package/components/Stepper/Stepper.svelte +7 -5
- package/components/Stepper/Stepper.tsx +3 -1
- package/components/Stepper/stepper.defaults.scss +5 -0
- package/components/Stepper/stepper.module.scss +11 -13
- package/components/Switch/Switch.astro +7 -2
- package/components/Switch/Switch.svelte +17 -8
- package/components/Switch/Switch.tsx +8 -4
- package/components/Switch/switch.module.scss +5 -7
- package/components/Switch/switch.ts +2 -16
- package/components/Tab/Tab.astro +25 -0
- package/components/Tab/Tab.svelte +28 -0
- package/components/Tab/Tab.tsx +30 -0
- package/components/Tab/tab.ts +6 -0
- package/components/Table/Table.astro +1 -1
- package/components/Table/Table.svelte +5 -3
- package/components/Table/Table.tsx +3 -1
- package/components/Tabs/Tabs.astro +58 -25
- package/components/Tabs/Tabs.svelte +47 -14
- package/components/Tabs/Tabs.tsx +42 -11
- package/components/Tabs/tabs.module.scss +7 -6
- package/components/Tabs/tabs.ts +0 -10
- package/components/Textarea/Textarea.astro +3 -6
- package/components/Textarea/Textarea.svelte +13 -10
- package/components/Textarea/Textarea.tsx +9 -7
- package/components/Textarea/textarea.ts +2 -17
- package/components/ThemeSwitcher/ThemeSwitcher.astro +1 -1
- package/components/ThemeSwitcher/ThemeSwitcher.svelte +14 -8
- package/components/ThemeSwitcher/ThemeSwitcher.tsx +7 -2
- package/components/ThemeSwitcher/themeswitcher.module.scss +10 -12
- package/components/ThemeSwitcher/themeswitcher.ts +0 -13
- package/components/Timeline/Timeline.astro +1 -1
- package/components/Timeline/Timeline.svelte +11 -6
- package/components/Timeline/Timeline.tsx +6 -2
- package/components/Timeline/timeline.module.scss +6 -8
- package/components/Timeline/timeline.ts +0 -10
- package/components/TimelineItem/TimelineItem.astro +1 -1
- package/components/TimelineItem/TimelineItem.svelte +9 -4
- package/components/TimelineItem/TimelineItem.tsx +8 -3
- package/components/TimelineItem/timelineitem.module.scss +4 -4
- package/components/TimelineItem/timelineitem.ts +0 -12
- package/components/Toast/Toast.astro +2 -1
- package/components/Toast/Toast.svelte +9 -7
- package/components/Toast/Toast.tsx +5 -4
- package/components/Toast/toast.ts +3 -11
- package/package.json +19 -19
- package/react.d.ts +145 -138
- package/react.js +4 -0
- package/scss/config/functions.scss +41 -0
- package/scss/config/mixins.scss +65 -0
- package/scss/config.scss +1 -0
- package/scss/global/theme.scss +209 -194
- package/scss/setup.scss +6 -3
- package/svelte.d.ts +145 -138
- package/svelte.js +4 -0
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-radio-color: var(--w-color-primary);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
3
|
.radio {
|
|
4
|
+
--color: var(--w-radio-color, var(--w-color-primary));
|
|
5
|
+
|
|
8
6
|
@include layout(flex, column, sm);
|
|
9
7
|
|
|
10
8
|
&.inline {
|
|
@@ -37,7 +35,7 @@ body {
|
|
|
37
35
|
@include position(absolute, 't50%', 'l50%');
|
|
38
36
|
@include size(8px);
|
|
39
37
|
@include border-radius(max);
|
|
40
|
-
@include background(var(--
|
|
38
|
+
@include background(var(--color));
|
|
41
39
|
|
|
42
40
|
content: '';
|
|
43
41
|
transform: translate(-50%, -50%) scale(0);
|
|
@@ -65,7 +63,7 @@ body {
|
|
|
65
63
|
|
|
66
64
|
display: inline-block;
|
|
67
65
|
min-width: 16px;
|
|
68
|
-
border: 1px solid var(--
|
|
66
|
+
border: 1px solid var(--color);
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
.subtext {
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type RadioProps = {
|
|
1
|
+
export type RadioProps<T extends object = object> = {
|
|
4
2
|
items: {
|
|
5
3
|
label: string
|
|
6
4
|
value: string
|
|
7
5
|
subText?: string
|
|
8
6
|
selected?: boolean
|
|
9
7
|
disabled?: boolean
|
|
8
|
+
required?: boolean
|
|
10
9
|
}[]
|
|
11
|
-
name: string
|
|
12
10
|
color?: string
|
|
13
11
|
inline?: boolean
|
|
14
12
|
className?: string
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type SvelteRadioProps = {
|
|
19
|
-
onChange?: (event: Event & InputTarget) => void
|
|
20
|
-
} & RadioProps
|
|
21
|
-
|
|
22
|
-
export type ReactRadioProps = {
|
|
23
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void
|
|
24
|
-
} & RadioProps
|
|
13
|
+
} & T
|
|
@@ -9,7 +9,7 @@ import { interpolate } from '../../utils/interpolate'
|
|
|
9
9
|
|
|
10
10
|
import styles from './rangeslider.module.scss'
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
export type Props = RangeSliderProps
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
min = 0,
|
|
@@ -31,7 +31,8 @@ const {
|
|
|
31
31
|
maxIcon,
|
|
32
32
|
interactiveLabels,
|
|
33
33
|
updateLabels,
|
|
34
|
-
className
|
|
34
|
+
className,
|
|
35
|
+
...rest
|
|
35
36
|
} = Astro.props
|
|
36
37
|
|
|
37
38
|
const styleVariables = classNames([
|
|
@@ -93,6 +94,7 @@ const labelStyle = updateLabels ? `min-width:${minLabelWidth};` : null
|
|
|
93
94
|
step={step}
|
|
94
95
|
disabled={disabled}
|
|
95
96
|
data-min="true"
|
|
97
|
+
{...rest}
|
|
96
98
|
/>
|
|
97
99
|
<input
|
|
98
100
|
type="range"
|
|
@@ -104,6 +106,7 @@ const labelStyle = updateLabels ? `min-width:${minLabelWidth};` : null
|
|
|
104
106
|
step={step}
|
|
105
107
|
disabled={disabled}
|
|
106
108
|
data-max="true"
|
|
109
|
+
{...rest}
|
|
107
110
|
/>
|
|
108
111
|
</div>
|
|
109
112
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { RangeSliderEventType, RangeSliderProps } from './rangeslider'
|
|
3
3
|
|
|
4
4
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.svelte'
|
|
5
5
|
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
import styles from './rangeslider.module.scss'
|
|
10
10
|
|
|
11
|
+
export type Props = RangeSliderProps & {
|
|
12
|
+
onChange?: (event: RangeSliderEventType) => void
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
const {
|
|
12
16
|
min = 0,
|
|
13
17
|
max = 100,
|
|
@@ -28,33 +32,26 @@
|
|
|
28
32
|
interactiveLabels,
|
|
29
33
|
updateLabels,
|
|
30
34
|
className,
|
|
31
|
-
onChange
|
|
32
|
-
|
|
35
|
+
onChange,
|
|
36
|
+
...rest
|
|
37
|
+
}: Props = $props()
|
|
33
38
|
|
|
34
|
-
const styleVariables = classNames([
|
|
39
|
+
const styleVariables = $derived(classNames([
|
|
35
40
|
color && `--w-range-slider-color: ${color};`,
|
|
36
41
|
background && `--w-range-slider-background: ${background};`,
|
|
37
42
|
thumb && `--w-range-slider-thumb: ${thumb};`
|
|
38
|
-
])
|
|
43
|
+
]))
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
let minValue = $derived(selectedMin ?? min)
|
|
46
|
+
let maxValue = $derived(selectedMax ?? max)
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
let dynamicMaxLabel = $state(maxLabel)
|
|
48
|
+
const labelStyle = $derived(updateLabels ? `min-width:${String(max).length}ch;` : null)
|
|
49
|
+
const dynamicMinLabel = $derived(minLabel?.replace(/\d+(\.\d+)?/, String(minValue)))
|
|
50
|
+
const dynamicMaxLabel = $derived(maxLabel?.replace(/\d+(\.\d+)?/, String(maxValue)))
|
|
47
51
|
|
|
48
52
|
const rangeLeftPercent = $derived(interpolate((minValue || min), [min, max], [0, 100]))
|
|
49
53
|
const rangeRightPercent = $derived(interpolate((maxValue || max), [min, max], [100, 0]))
|
|
50
54
|
|
|
51
|
-
const updateDynamicLabels = (minValue: number, maxValue: number) => {
|
|
52
|
-
if (dynamicMinLabel && dynamicMaxLabel) {
|
|
53
|
-
dynamicMinLabel = dynamicMinLabel.replace(/\d+(\.\d+)?/, String(minValue))
|
|
54
|
-
dynamicMaxLabel = dynamicMaxLabel.replace(/\d+(\.\d+)?/, String(maxValue))
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
55
|
const handleInput = (event: Event) => {
|
|
59
56
|
const target = event.target
|
|
60
57
|
|
|
@@ -63,10 +60,6 @@
|
|
|
63
60
|
}
|
|
64
61
|
|
|
65
62
|
if (maxValue - minValue >= minGap) {
|
|
66
|
-
if (updateLabels) {
|
|
67
|
-
updateDynamicLabels(minValue, maxValue)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
63
|
onChange?.({
|
|
71
64
|
min: minValue,
|
|
72
65
|
max: maxValue
|
|
@@ -80,13 +73,7 @@
|
|
|
80
73
|
}
|
|
81
74
|
}
|
|
82
75
|
|
|
83
|
-
const handleClick = (
|
|
84
|
-
const target = event.currentTarget
|
|
85
|
-
|
|
86
|
-
if (!(target instanceof HTMLButtonElement)) {
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
|
|
76
|
+
const handleClick = (direction: 'left' | 'right') => {
|
|
90
77
|
const dir = direction === 'left' ? -1 : 1
|
|
91
78
|
const updatedMinValue = Number(minValue) + (dir * step)
|
|
92
79
|
const updatedMaxValue = Number(maxValue) + (dir * step)
|
|
@@ -98,10 +85,6 @@
|
|
|
98
85
|
minValue = updatedMinValue
|
|
99
86
|
maxValue = updatedMaxValue
|
|
100
87
|
|
|
101
|
-
if (updateLabels) {
|
|
102
|
-
updateDynamicLabels(minValue, maxValue)
|
|
103
|
-
}
|
|
104
|
-
|
|
105
88
|
onChange?.({
|
|
106
89
|
min: minValue,
|
|
107
90
|
max: maxValue
|
|
@@ -125,7 +108,7 @@
|
|
|
125
108
|
<ConditionalWrapper
|
|
126
109
|
element="button"
|
|
127
110
|
condition={!!interactiveLabels}
|
|
128
|
-
onclick={(
|
|
111
|
+
onclick={() => handleClick('left')}
|
|
129
112
|
>
|
|
130
113
|
{#if minIcon}
|
|
131
114
|
{@html minIcon}
|
|
@@ -154,6 +137,7 @@
|
|
|
154
137
|
disabled={disabled}
|
|
155
138
|
oninput={handleInput}
|
|
156
139
|
data-min="true"
|
|
140
|
+
{...rest}
|
|
157
141
|
/>
|
|
158
142
|
<input
|
|
159
143
|
type="range"
|
|
@@ -165,13 +149,14 @@
|
|
|
165
149
|
disabled={disabled}
|
|
166
150
|
oninput={handleInput}
|
|
167
151
|
data-max="true"
|
|
152
|
+
{...rest}
|
|
168
153
|
/>
|
|
169
154
|
</div>
|
|
170
155
|
|
|
171
156
|
<ConditionalWrapper
|
|
172
157
|
element="button"
|
|
173
158
|
condition={!!interactiveLabels}
|
|
174
|
-
onclick={(
|
|
159
|
+
onclick={() => handleClick('right')}
|
|
175
160
|
>
|
|
176
161
|
{#if dynamicMaxLabel}
|
|
177
162
|
<span style={labelStyle}>{dynamicMaxLabel}</span>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable complexity */
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react'
|
|
3
|
-
import type {
|
|
3
|
+
import type { RangeSliderEventType, RangeSliderProps } from './rangeslider'
|
|
4
4
|
|
|
5
5
|
import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
6
6
|
|
|
@@ -9,6 +9,10 @@ import { interpolate } from '../../utils/interpolate'
|
|
|
9
9
|
|
|
10
10
|
import styles from './rangeslider.module.scss'
|
|
11
11
|
|
|
12
|
+
export type Props = RangeSliderProps & {
|
|
13
|
+
onChange?: (event: RangeSliderEventType) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
12
16
|
const RangeSlider = ({
|
|
13
17
|
min = 0,
|
|
14
18
|
max = 100,
|
|
@@ -29,8 +33,9 @@ const RangeSlider = ({
|
|
|
29
33
|
interactiveLabels,
|
|
30
34
|
updateLabels,
|
|
31
35
|
className,
|
|
32
|
-
onChange
|
|
33
|
-
|
|
36
|
+
onChange,
|
|
37
|
+
...rest
|
|
38
|
+
}: Props) => {
|
|
34
39
|
const [minValue, setMinValue] = useState(selectedMin || min)
|
|
35
40
|
const [maxValue, setMaxValue] = useState(selectedMax || max)
|
|
36
41
|
const [dynamicMinLabel, setDynamicMinLabel] = useState(minLabel)
|
|
@@ -54,7 +59,7 @@ const RangeSlider = ({
|
|
|
54
59
|
}
|
|
55
60
|
}
|
|
56
61
|
|
|
57
|
-
const handleInput = (event: React.
|
|
62
|
+
const handleInput = (event: React.InputEvent<HTMLInputElement>) => {
|
|
58
63
|
const target = event.target
|
|
59
64
|
|
|
60
65
|
if (!(target instanceof HTMLInputElement)) {
|
|
@@ -167,6 +172,7 @@ const RangeSlider = ({
|
|
|
167
172
|
disabled={disabled}
|
|
168
173
|
onInput={handleInput}
|
|
169
174
|
data-min="true"
|
|
175
|
+
{...rest}
|
|
170
176
|
/>
|
|
171
177
|
<input
|
|
172
178
|
type="range"
|
|
@@ -178,6 +184,7 @@ const RangeSlider = ({
|
|
|
178
184
|
disabled={disabled}
|
|
179
185
|
onInput={handleInput}
|
|
180
186
|
data-max="true"
|
|
187
|
+
{...rest}
|
|
181
188
|
/>
|
|
182
189
|
</div>
|
|
183
190
|
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-range-slider-background: var(--w-color-primary-50);
|
|
5
|
-
--w-range-slider-color: var(--w-color-primary);
|
|
6
|
-
--w-range-slider-thumb: var(--w-color-primary-50);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
3
|
.label {
|
|
10
4
|
@include layout(flex, column, xs);
|
|
11
5
|
|
|
@@ -13,6 +7,10 @@ body {
|
|
|
13
7
|
}
|
|
14
8
|
|
|
15
9
|
.container {
|
|
10
|
+
--bg: var(--w-range-slider-background, var(--w-color-primary-50));
|
|
11
|
+
--color: var(--w-range-slider-color, var(--w-color-primary));
|
|
12
|
+
--thumb: var(--w-range-slider-thumb, var(--w-color-primary-50));
|
|
13
|
+
|
|
16
14
|
@include layout(flex, v-center, xs);
|
|
17
15
|
|
|
18
16
|
svg {
|
|
@@ -33,7 +31,7 @@ body {
|
|
|
33
31
|
@include position(relative);
|
|
34
32
|
@include border-radius(xl);
|
|
35
33
|
@include size(h10px);
|
|
36
|
-
@include background(var(--
|
|
34
|
+
@include background(var(--bg));
|
|
37
35
|
@include visibility(hidden);
|
|
38
36
|
|
|
39
37
|
flex: 1;
|
|
@@ -41,7 +39,7 @@ body {
|
|
|
41
39
|
|
|
42
40
|
.range {
|
|
43
41
|
@include position(absolute);
|
|
44
|
-
@include background(var(--
|
|
42
|
+
@include background(var(--color));
|
|
45
43
|
@include size('h100%');
|
|
46
44
|
@include border-radius();
|
|
47
45
|
|
|
@@ -86,19 +84,19 @@ body {
|
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
&[data-min]::-webkit-slider-thumb {
|
|
89
|
-
box-shadow: 3px 0 0 3px var(--
|
|
87
|
+
box-shadow: 3px 0 0 3px var(--color);
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
&[data-max]::-webkit-slider-thumb {
|
|
93
|
-
box-shadow: -3px 0 0 3px var(--
|
|
91
|
+
box-shadow: -3px 0 0 3px var(--color);
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
&[data-min]::-moz-range-thumb {
|
|
97
|
-
box-shadow: 3px 0 0 3px var(--
|
|
95
|
+
box-shadow: 3px 0 0 3px var(--color);
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
&[data-max]::-moz-range-thumb {
|
|
101
|
-
box-shadow: -3px 0 0 3px var(--
|
|
99
|
+
box-shadow: -3px 0 0 3px var(--color);
|
|
102
100
|
}
|
|
103
101
|
|
|
104
102
|
|
|
@@ -120,10 +118,10 @@ body {
|
|
|
120
118
|
}
|
|
121
119
|
|
|
122
120
|
.input::-webkit-slider-thumb {
|
|
123
|
-
@include background(var(--
|
|
121
|
+
@include background(var(--thumb));
|
|
124
122
|
@include size(10px);
|
|
125
123
|
@include border-radius(max);
|
|
126
|
-
@include border(var(--
|
|
124
|
+
@include border(var(--color));
|
|
127
125
|
|
|
128
126
|
-webkit-appearance: none;
|
|
129
127
|
appearance: none;
|
|
@@ -132,10 +130,10 @@ body {
|
|
|
132
130
|
}
|
|
133
131
|
|
|
134
132
|
.input::-moz-range-thumb {
|
|
135
|
-
@include background(var(--
|
|
133
|
+
@include background(var(--thumb));
|
|
136
134
|
@include size(9px);
|
|
137
135
|
@include border-radius(max);
|
|
138
|
-
@include border(var(--
|
|
136
|
+
@include border(var(--color));
|
|
139
137
|
|
|
140
138
|
pointer-events: auto;
|
|
141
139
|
appearance: none;
|
|
@@ -13,6 +13,7 @@ export type RangeSliderProps = {
|
|
|
13
13
|
step?: number
|
|
14
14
|
minGap?: number
|
|
15
15
|
disabled?: boolean
|
|
16
|
+
required?: boolean
|
|
16
17
|
color?: string
|
|
17
18
|
background?: string
|
|
18
19
|
thumb?: string
|
|
@@ -27,12 +28,3 @@ export type RangeSliderProps = {
|
|
|
27
28
|
updateLabels?: boolean
|
|
28
29
|
className?: string
|
|
29
30
|
}
|
|
30
|
-
|
|
31
|
-
export type SvelteRangeSliderProps = {
|
|
32
|
-
onChange?: (event: RangeSliderEventType) => void
|
|
33
|
-
} & RangeSliderProps
|
|
34
|
-
|
|
35
|
-
export type ReactRangeSliderProps = {
|
|
36
|
-
onChange?: (event: RangeSliderEventType) => void
|
|
37
|
-
} & RangeSliderProps
|
|
38
|
-
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
8
|
import styles from './rating.module.scss'
|
|
9
|
+
|
|
10
|
+
export type Props = RatingProps
|
|
9
11
|
|
|
10
12
|
const {
|
|
11
13
|
score,
|
|
@@ -22,25 +24,26 @@
|
|
|
22
24
|
emptyColor,
|
|
23
25
|
size,
|
|
24
26
|
className
|
|
25
|
-
}:
|
|
27
|
+
}: Props = $props()
|
|
26
28
|
|
|
27
|
-
const classes = classNames([
|
|
29
|
+
const classes = $derived(classNames([
|
|
28
30
|
styles.rating,
|
|
29
31
|
outline && styles.outline,
|
|
30
32
|
className
|
|
31
|
-
])
|
|
33
|
+
]))
|
|
32
34
|
|
|
33
|
-
const styleVariables = classNames([
|
|
35
|
+
const styleVariables = $derived(classNames([
|
|
34
36
|
color && `--w-rating-color: ${color};`,
|
|
35
37
|
size && `--w-rating-size: ${size}px;`,
|
|
36
38
|
emptyColor && `--w-rating-empty-color: ${emptyColor};`
|
|
37
|
-
])
|
|
39
|
+
]))
|
|
38
40
|
|
|
39
|
-
const translatedText = text!
|
|
41
|
+
const translatedText = $derived(text!
|
|
40
42
|
.replace('{0}', `${score}`)
|
|
41
43
|
.replace('{1}', `${total}`)
|
|
44
|
+
)
|
|
42
45
|
|
|
43
|
-
const translatedReviewText = reviewText?.replace('{0}', `${reviewCount}`)
|
|
46
|
+
const translatedReviewText = $derived(reviewText?.replace('{0}', `${reviewCount}`))
|
|
44
47
|
</script>
|
|
45
48
|
|
|
46
49
|
|
|
@@ -6,6 +6,8 @@ import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
|
|
|
6
6
|
import { classNames } from '../../utils/classNames'
|
|
7
7
|
|
|
8
8
|
import styles from './rating.module.scss'
|
|
9
|
+
|
|
10
|
+
export type Props = RatingProps
|
|
9
11
|
|
|
10
12
|
const Rating = ({
|
|
11
13
|
score,
|
|
@@ -22,7 +24,7 @@ const Rating = ({
|
|
|
22
24
|
emptyColor,
|
|
23
25
|
size,
|
|
24
26
|
className
|
|
25
|
-
}:
|
|
27
|
+
}: Props) => {
|
|
26
28
|
const classes = classNames([
|
|
27
29
|
styles.rating,
|
|
28
30
|
outline && styles.outline,
|
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-rating-color: var(--w-color-primary);
|
|
5
|
-
--w-rating-empty-color: var(--w-color-primary);
|
|
6
|
-
--w-rating-empty-background: var(--w-color-primary-70);
|
|
7
|
-
--w-rating-size: 18px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
3
|
.rating {
|
|
4
|
+
--color: var(--w-rating-color, var(--w-color-primary));
|
|
5
|
+
--empty-color: var(--w-rating-empty-color, var(--w-color-primary));
|
|
6
|
+
--empty-background: var(--w-rating-empty-background, var(--w-color-primary-70));
|
|
7
|
+
--size: var(--w-rating-size, 18px);
|
|
8
|
+
|
|
11
9
|
@include layout(inline-flex, v-center);
|
|
12
10
|
|
|
13
|
-
color: var(--
|
|
14
|
-
font-size: var(--
|
|
11
|
+
color: var(--color);
|
|
12
|
+
font-size: var(--size);
|
|
15
13
|
|
|
16
14
|
&.outline .empty {
|
|
17
15
|
transform: scale(.9);
|
|
18
16
|
transform-origin: left;
|
|
19
|
-
color: var(--
|
|
17
|
+
color: var(--empty-background);
|
|
20
18
|
letter-spacing: 2px;
|
|
21
19
|
text-shadow:
|
|
22
|
-
-1px 0 var(--
|
|
23
|
-
0 1px var(--
|
|
24
|
-
1px 0 var(--
|
|
25
|
-
0 -1px var(--
|
|
20
|
+
-1px 0 var(--empty-color),
|
|
21
|
+
0 1px var(--empty-color),
|
|
22
|
+
1px 0 var(--empty-color),
|
|
23
|
+
0 -1px var(--empty-color);
|
|
26
24
|
}
|
|
27
25
|
|
|
28
26
|
.empty {
|
|
29
|
-
color: var(--
|
|
27
|
+
color: var(--empty-color);
|
|
30
28
|
}
|
|
31
29
|
|
|
32
30
|
a:hover .text {
|
|
@@ -1,24 +1,29 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { Snippet } from 'svelte'
|
|
3
|
+
import type { RibbonProps } from './ribbon'
|
|
3
4
|
|
|
4
5
|
import { classNames } from '../../utils/classNames'
|
|
5
6
|
|
|
6
7
|
import styles from './ribbon.module.scss'
|
|
7
8
|
|
|
9
|
+
export type Props = RibbonProps & {
|
|
10
|
+
children: Snippet
|
|
11
|
+
}
|
|
12
|
+
|
|
8
13
|
const {
|
|
9
14
|
offset,
|
|
10
15
|
type,
|
|
11
16
|
theme,
|
|
12
17
|
className,
|
|
13
18
|
children
|
|
14
|
-
}:
|
|
19
|
+
}: Props = $props()
|
|
15
20
|
|
|
16
|
-
const classes = classNames([
|
|
21
|
+
const classes = $derived(classNames([
|
|
17
22
|
styles.ribbon,
|
|
18
23
|
theme && styles[theme],
|
|
19
24
|
type && styles[type],
|
|
20
25
|
className
|
|
21
|
-
])
|
|
26
|
+
]))
|
|
22
27
|
</script>
|
|
23
28
|
|
|
24
29
|
<span
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { RibbonProps } from './ribbon'
|
|
3
3
|
|
|
4
4
|
import { classNames } from '../../utils/classNames'
|
|
5
5
|
|
|
6
6
|
import styles from './ribbon.module.scss'
|
|
7
7
|
|
|
8
|
+
export type Props = RibbonProps & {
|
|
9
|
+
children: React.ReactNode
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
const Ribbon = ({
|
|
9
13
|
offset,
|
|
10
14
|
type,
|
|
11
15
|
theme,
|
|
12
16
|
className,
|
|
13
17
|
children
|
|
14
|
-
}:
|
|
18
|
+
}: Props) => {
|
|
15
19
|
const classes = classNames([
|
|
16
20
|
styles.ribbon,
|
|
17
21
|
theme && styles[theme],
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
@use '../../scss/config.scss' as *;
|
|
2
2
|
|
|
3
|
-
body {
|
|
4
|
-
--w-ribbon-offset: 20px;
|
|
5
|
-
--w-ribbon-folded-offset: 10px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
3
|
.ribbon {
|
|
4
|
+
--offset: var(--w-ribbon-offset, 20px);
|
|
5
|
+
--folded-offset: var(--w-ribbon-folded-offset, 10px);
|
|
6
|
+
|
|
9
7
|
@include position(absolute);
|
|
10
8
|
@include typography(sm, primary-70);
|
|
11
9
|
@include background(primary);
|
|
12
10
|
@include spacing('px-5xl');
|
|
13
11
|
|
|
14
|
-
top: var(--
|
|
15
|
-
left: var(--
|
|
12
|
+
top: var(--offset);
|
|
13
|
+
left: var(--offset);
|
|
16
14
|
|
|
17
15
|
transform: rotate(-45deg) translate(-50%, -50%);
|
|
18
16
|
transform-origin: top left;
|
|
@@ -23,7 +21,7 @@ body {
|
|
|
23
21
|
@include spacing(px-sm);
|
|
24
22
|
|
|
25
23
|
transform: none;
|
|
26
|
-
left: calc(var(--
|
|
24
|
+
left: calc(var(--folded-offset) * -1);
|
|
27
25
|
|
|
28
26
|
&::before {
|
|
29
27
|
@include position(absolute, t15px, l0);
|
|
@@ -31,9 +29,9 @@ body {
|
|
|
31
29
|
|
|
32
30
|
content: '';
|
|
33
31
|
transform: translateY(-50%);
|
|
34
|
-
border-right: var(--
|
|
35
|
-
border-top: var(--
|
|
36
|
-
border-bottom: var(--
|
|
32
|
+
border-right: var(--folded-offset) solid var(--w-color-primary-20);
|
|
33
|
+
border-top: var(--folded-offset) solid transparent;
|
|
34
|
+
border-bottom: var(--folded-offset) solid transparent;
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { Snippet } from 'svelte'
|
|
2
|
-
|
|
3
1
|
export type RibbonProps = {
|
|
4
2
|
offset?: number
|
|
5
3
|
type?: 'folded' | null
|
|
@@ -12,11 +10,3 @@ export type RibbonProps = {
|
|
|
12
10
|
| undefined
|
|
13
11
|
className?: string
|
|
14
12
|
}
|
|
15
|
-
|
|
16
|
-
export type SvelteRibbonProps = {
|
|
17
|
-
children: Snippet
|
|
18
|
-
} & RibbonProps
|
|
19
|
-
|
|
20
|
-
export type ReactRibbonProps = {
|
|
21
|
-
children: React.ReactNode
|
|
22
|
-
} & RibbonProps
|
|
@@ -12,7 +12,7 @@ import ChevronDown from '../../icons/chevron-down.svg?raw'
|
|
|
12
12
|
|
|
13
13
|
import styles from './select.module.scss'
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
export type Props = SelectProps
|
|
16
16
|
|
|
17
17
|
const {
|
|
18
18
|
name,
|
|
@@ -21,6 +21,7 @@ const {
|
|
|
21
21
|
label,
|
|
22
22
|
subText,
|
|
23
23
|
disabled,
|
|
24
|
+
required,
|
|
24
25
|
position,
|
|
25
26
|
updateValue = true,
|
|
26
27
|
className,
|
|
@@ -47,6 +48,7 @@ const inputRestProps = Object.fromEntries(
|
|
|
47
48
|
value={(value && inferredValue) ? inferredValue : value}
|
|
48
49
|
readonly={true}
|
|
49
50
|
disabled={disabled}
|
|
51
|
+
required={required}
|
|
50
52
|
placeholder={placeholder}
|
|
51
53
|
label={label}
|
|
52
54
|
subText={subText}
|