webcoreui 0.0.9 → 0.0.10

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.
Files changed (67) hide show
  1. package/README.md +8 -10
  2. package/astro.d.ts +26 -16
  3. package/astro.js +13 -1
  4. package/components/Alert/Alert.tsx +1 -8
  5. package/components/Alert/alert.scss +1 -0
  6. package/components/Alert/alert.ts +6 -0
  7. package/components/Avatar/Avatar.tsx +1 -0
  8. package/components/Badge/Badge.astro +3 -2
  9. package/components/Badge/Badge.svelte +1 -1
  10. package/components/Badge/Badge.tsx +3 -7
  11. package/components/Badge/badge.ts +4 -0
  12. package/components/Button/Button.tsx +1 -5
  13. package/components/Button/button.scss +0 -1
  14. package/components/Button/button.ts +5 -1
  15. package/components/Card/Card.tsx +1 -7
  16. package/components/Card/card.scss +1 -0
  17. package/components/Card/card.ts +6 -0
  18. package/components/Checkbox/Checkbox.tsx +2 -6
  19. package/components/Checkbox/checkbox.ts +4 -0
  20. package/components/ConditionalWrapper/ConditionalWrapper.tsx +2 -8
  21. package/components/ConditionalWrapper/conditionalwrapper.ts +5 -0
  22. package/components/Progress/Progress.astro +40 -0
  23. package/components/Progress/Progress.svelte +38 -0
  24. package/components/Progress/Progress.tsx +47 -0
  25. package/components/Progress/progress.scss +66 -0
  26. package/components/Progress/progress.ts +12 -0
  27. package/components/Radio/Radio.tsx +2 -6
  28. package/components/Radio/radio.ts +4 -0
  29. package/components/Spinner/Spinner.astro +42 -0
  30. package/components/Spinner/Spinner.svelte +38 -0
  31. package/components/Spinner/Spinner.tsx +44 -0
  32. package/components/Spinner/spinner.scss +41 -0
  33. package/components/Spinner/spinner.ts +7 -0
  34. package/components/Switch/Switch.tsx +2 -6
  35. package/components/Switch/switch.ts +4 -0
  36. package/components/Tabs/Tabs.astro +76 -0
  37. package/components/Tabs/Tabs.svelte +54 -0
  38. package/components/Tabs/Tabs.tsx +69 -0
  39. package/components/Tabs/tabs.scss +134 -0
  40. package/components/Tabs/tabs.ts +16 -0
  41. package/components/Timeline/Timeline.astro +34 -0
  42. package/components/Timeline/Timeline.svelte +30 -0
  43. package/components/Timeline/Timeline.tsx +37 -0
  44. package/components/Timeline/timeline.scss +71 -0
  45. package/components/Timeline/timeline.ts +61 -0
  46. package/components/TimelineItem/TimelineItem.astro +26 -0
  47. package/components/TimelineItem/TimelineItem.svelte +22 -0
  48. package/components/TimelineItem/TimelineItem.tsx +32 -0
  49. package/components/TimelineItem/timelineitem.scss +31 -0
  50. package/components/TimelineItem/timelineitem.ts +5 -0
  51. package/components/Toast/Toast.astro +30 -0
  52. package/components/Toast/Toast.svelte +21 -0
  53. package/components/Toast/Toast.tsx +28 -0
  54. package/components/Toast/toast.scss +43 -0
  55. package/components/Toast/toast.ts +11 -0
  56. package/index.js +1 -0
  57. package/package.json +3 -1
  58. package/react.d.ts +38 -27
  59. package/react.js +13 -1
  60. package/scss/global/tooltip.scss +133 -0
  61. package/scss/global/utility.scss +17 -0
  62. package/scss/global.scss +1 -0
  63. package/scss/resets.scss +4 -0
  64. package/scss/setup.scss +20 -1
  65. package/svelte.d.ts +26 -16
  66. package/svelte.js +13 -1
  67. package/utils/toast.ts +65 -0
package/README.md CHANGED
@@ -43,7 +43,7 @@ Full documentation coming soon on [webcoreui.dev/docs](https://webcoreui.dev/doc
43
43
 
44
44
  ## Getting Started
45
45
 
46
- Webcore can be used as a standalone project, or it can be integrated into your existing Astro, Svelte, or React ecosystems.
46
+ Webcore can be used as a standalone project, or it can be integrated into your existing Astro, Svelte, or React ecosystems. The easiest way to get started is to clone the repository and run `npm run dev` to start building your pages with the components available.
47
47
 
48
48
  ### Prerequisites
49
49
 
@@ -79,15 +79,7 @@ yarn add webcoreui
79
79
 
80
80
  ### Setup
81
81
 
82
- 1. Add the following to your `tsconfig.json` to include TypeScript types:
83
-
84
- ```json
85
- {
86
- "include": ["webcoreui"]
87
- }
88
- ```
89
-
90
- 2. Setup default styles and fonts by calling the following in your global SCSS file:
82
+ Setup default styles and fonts by calling the following in your global SCSS file:
91
83
 
92
84
  ```scss
93
85
  @import 'webcoreui/styles';
@@ -152,6 +144,12 @@ import { Accordion } from 'webcoreui/react'
152
144
  - [Checkbox](https://github.com/Frontendland/webcoreui/tree/main/src/components/Checkbox)
153
145
  - [ConditionalWrapper](https://github.com/Frontendland/webcoreui/tree/main/src/components/ConditionalWrapper)
154
146
  - [Icon](https://github.com/Frontendland/webcoreui/tree/main/src/components/Icon)
147
+ - [Progress](https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress)
155
148
  - [Radio](https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio)
156
149
  - [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
150
+ - [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
157
151
  - [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
152
+ - [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
153
+ - [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
154
+ - [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
155
+ - [Tooltip](https://github.com/Frontendland/webcoreui/blob/main/src/pages/tooltip.astro)
package/astro.d.ts CHANGED
@@ -1,18 +1,23 @@
1
-
1
+ import type { AccordionProps } from './components/Accordion/accordion'
2
+ import type { AlertProps } from './components/Alert/alert'
3
+ import type { AvatarProps } from './components/Avatar/avatar'
4
+ import type { BadgeProps } from './components/Badge/badge'
5
+ import type { ButtonProps } from './components/Button/button'
6
+ import type { CardProps } from './components/Card/card'
7
+ import type { CheckboxProps } from './components/Checkbox/checkbox'
8
+ import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
9
+ import type { IconProps } from './components/Icon/icon'
10
+ import type { ProgressProps } from './components/Progress/progress'
11
+ import type { RadioProps } from './components/Radio/radio'
12
+ import type { RatingProps } from './components/Rating/rating'
13
+ import type { SpinnerProps } from './components/Spinner/spinner'
14
+ import type { SwitchProps } from './components/Switch/switch'
15
+ import type { TabsProps } from './components/Tabs/tabs'
16
+ import type { TimelineProps } from './components/Timeline/timeline'
17
+ import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
18
+ import type { ToastProps } from './components/Toast/toast'
19
+
2
20
  declare module 'webcoreui/astro' {
3
- import type { AccordionProps } from './components/Accordion/accordion'
4
- import type { AlertProps } from './components/Alert/alert'
5
- import type { AvatarProps } from './components/Avatar/avatar'
6
- import type { BadgeProps } from './components/Badge/badge'
7
- import type { ButtonProps } from './components/Button/button'
8
- import type { CardProps } from './components/Card/card'
9
- import type { CheckboxProps } from './components/Checkbox/checkbox'
10
- import type { ConditionalWrapperProps } from './components/ConditionalWrapper/conditionalwrapper'
11
- import type { IconProps } from './components/Icon/icon'
12
- import type { RadioProps } from './components/Radio/radio'
13
- import type { RatingProps } from './components/Rating/rating'
14
- import type { SwitchProps } from './components/Switch/switch'
15
-
16
21
  export function Accordion(_props: AccordionProps): any
17
22
  export function Alert(_props: AlertProps): any
18
23
  export function Avatar(_props: AvatarProps): any
@@ -22,8 +27,13 @@ declare module 'webcoreui/astro' {
22
27
  export function Checkbox(_props: CheckboxProps): any
23
28
  export function ConditionalWrapper(_props: ConditionalWrapperProps): any
24
29
  export function Icon(_props: IconProps): any
30
+ export function Progress(_props: ProgressProps): any
25
31
  export function Radio(_props: RadioProps): any
26
32
  export function Rating(_props: RatingProps): any
33
+ export function Spinner(_props: SpinnerProps): any
27
34
  export function Switch(_props: SwitchProps): any
28
- }
29
-
35
+ export function Tabs(_props: TabsProps): any
36
+ export function Timeline(_props: TimelineProps): any
37
+ export function TimelineItem(_props: TimelineItemProps): any
38
+ export function Toast(_props: ToastProps): any
39
+ }
package/astro.js CHANGED
@@ -7,9 +7,15 @@ import CardComponent from './components/Card/Card.astro'
7
7
  import CheckboxComponent from './components/Checkbox/Checkbox.astro'
8
8
  import ConditionalWrapperComponent from './components/ConditionalWrapper/ConditionalWrapper.astro'
9
9
  import IconComponent from './components/Icon/Icon.astro'
10
+ import ProgressComponent from './components/Progress/Progress.astro'
10
11
  import RadioComponent from './components/Radio/Radio.astro'
11
12
  import RatingComponent from './components/Rating/Rating.astro'
13
+ import SpinnerComponent from './components/Spinner/Spinner.astro'
12
14
  import SwitchComponent from './components/Switch/Switch.astro'
15
+ import TabsComponent from './components/Tabs/Tabs.astro'
16
+ import TimelineComponent from './components/Timeline/Timeline.astro'
17
+ import TimelineItemComponent from './components/TimelineItem/TimelineItem.astro'
18
+ import ToastComponent from './components/Toast/Toast.astro'
13
19
 
14
20
  export const Accordion = AccordionComponent
15
21
  export const Alert = AlertComponent
@@ -20,6 +26,12 @@ export const Card = CardComponent
20
26
  export const Checkbox = CheckboxComponent
21
27
  export const ConditionalWrapper = ConditionalWrapperComponent
22
28
  export const Icon = IconComponent
29
+ export const Progress = ProgressComponent
23
30
  export const Radio = RadioComponent
24
31
  export const Rating = RatingComponent
25
- export const Switch = SwitchComponent
32
+ export const Spinner = SpinnerComponent
33
+ export const Switch = SwitchComponent
34
+ export const Tabs = TabsComponent
35
+ export const Timeline = TimelineComponent
36
+ export const TimelineItem = TimelineItemComponent
37
+ export const Toast = ToastComponent
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import type { AlertProps } from './alert'
2
+ import type { ReactAlertProps } from './alert'
3
3
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
4
4
 
5
5
  import info from '../../icons/info.svg?raw'
@@ -16,13 +16,6 @@ const iconMap = {
16
16
  alert
17
17
  }
18
18
 
19
- type ReactAlertProps = {
20
- Element?: keyof JSX.IntrinsicElements
21
- TitleTag?: keyof JSX.IntrinsicElements
22
- children: React.ReactNode
23
- icon?: string
24
- } & AlertProps
25
-
26
19
  const Alert = ({
27
20
  Element = 'section',
28
21
  title,
@@ -48,5 +48,6 @@
48
48
  .alert-body {
49
49
  font-size: 16px;
50
50
  color: #BBB;
51
+ line-height: 1.5;
51
52
  }
52
53
  }
@@ -10,3 +10,9 @@ export type AlertProps = {
10
10
  | 'alert'
11
11
  | null
12
12
  }
13
+
14
+ export type ReactAlertProps = {
15
+ Element?: keyof JSX.IntrinsicElements
16
+ TitleTag?: keyof JSX.IntrinsicElements
17
+ children: React.ReactNode
18
+ } & Omit<AlertProps, 'titleTag' | 'element'>
@@ -33,6 +33,7 @@ const Avatar = ({
33
33
  >
34
34
  {img.map((img, index) => (
35
35
  <img
36
+ key={index}
36
37
  src={img}
37
38
  alt={Array.isArray(alt) ? alt[index] : alt}
38
39
  width={Array.isArray(size) ? size[index] : size}
@@ -8,7 +8,8 @@ interface Props extends BadgeProps {
8
8
 
9
9
  const {
10
10
  theme,
11
- interactive
11
+ interactive,
12
+ ...rest
12
13
  } = Astro.props
13
14
 
14
15
  const classes = [
@@ -18,6 +19,6 @@ const classes = [
18
19
  ]
19
20
  ---
20
21
 
21
- <span class:list={classes}>
22
+ <span class:list={classes} {...rest}>
22
23
  <slot />
23
24
  </span>
@@ -12,6 +12,6 @@
12
12
  ].filter(Boolean).join(' ')
13
13
  </script>
14
14
 
15
- <span class={classes} on:click={onClick}>
15
+ <span class={classes} on:click={onClick} {...$$restProps}>
16
16
  <slot />
17
17
  </span>
@@ -1,12 +1,8 @@
1
1
  import React from 'react'
2
- import type { BadgeProps } from './badge'
2
+ import type { ReactBadgeProps } from './badge'
3
3
  import './badge.scss'
4
4
 
5
- type ReactBadgeProps = {
6
- children: React.ReactNode
7
- } & BadgeProps
8
-
9
- const Badge = ({ theme, onClick, children }: ReactBadgeProps) => {
5
+ const Badge = ({ theme, onClick, children, ...rest }: ReactBadgeProps) => {
10
6
  const classes = [
11
7
  'w-badge',
12
8
  theme || null,
@@ -14,7 +10,7 @@ const Badge = ({ theme, onClick, children }: ReactBadgeProps) => {
14
10
  ].filter(Boolean).join(' ')
15
11
 
16
12
  return (
17
- <span className={classes} onClick={onClick}>
13
+ <span className={classes} onClick={onClick} {...rest}>
18
14
  {children}
19
15
  </span>
20
16
  )
@@ -9,3 +9,7 @@ export type BadgeProps = {
9
9
  | null
10
10
  onClick?: () => any
11
11
  }
12
+
13
+ export type ReactBadgeProps = {
14
+ children: React.ReactNode
15
+ } & BadgeProps
@@ -1,11 +1,7 @@
1
1
  import React from 'react'
2
- import type { ButtonProps } from './button'
2
+ import type { ReactButtonProps } from './button'
3
3
  import './button.scss'
4
4
 
5
- type ReactButtonProps = {
6
- children: React.ReactNode
7
- } & ButtonProps
8
-
9
5
  const Button = ({
10
6
  theme,
11
7
  bold,
@@ -9,7 +9,6 @@
9
9
  align-items: center;
10
10
  gap: 5px;
11
11
  font-size: 16px;
12
- font-family: Regular;
13
12
  cursor: pointer;
14
13
  border: 0;
15
14
  background: #FFF;
@@ -9,6 +9,10 @@ export type ButtonProps = {
9
9
  | null
10
10
  bold?: boolean
11
11
  href?: string
12
- target?: string
13
12
  onClick?: () => any
13
+ [key: string]: any
14
14
  }
15
+
16
+ export type ReactButtonProps = {
17
+ children: React.ReactNode
18
+ } & ButtonProps
@@ -1,13 +1,7 @@
1
1
  import React from 'react'
2
- import type { CardProps } from './card'
2
+ import type { ReactCardProps } from './card'
3
3
  import './card.scss'
4
4
 
5
- type ReactCardProps = {
6
- Element?: keyof JSX.IntrinsicElements
7
- TitleTag?: keyof JSX.IntrinsicElements
8
- children: React.ReactNode
9
- } & CardProps
10
-
11
5
  const Card = ({
12
6
  Element = 'section',
13
7
  title,
@@ -22,6 +22,7 @@
22
22
  .card-body {
23
23
  padding: 20px;
24
24
  height: 100%;
25
+ position: relative;
25
26
 
26
27
  &.compact {
27
28
  background: #111;
@@ -7,3 +7,9 @@ export type CardProps = {
7
7
  secondary?: boolean
8
8
  [key: string]: any
9
9
  }
10
+
11
+ export type ReactCardProps = {
12
+ Element?: keyof JSX.IntrinsicElements
13
+ TitleTag?: keyof JSX.IntrinsicElements
14
+ children: React.ReactNode
15
+ } & Omit<CardProps, 'titleTag' | 'element'>
@@ -1,15 +1,11 @@
1
1
  import React from 'react'
2
- import type { CheckboxProps } from './checkbox'
2
+ import type { ReactCheckboxProps } from './checkbox'
3
3
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
4
4
 
5
5
  import check from '../../icons/check.svg?raw'
6
6
 
7
7
  import './checkbox.scss'
8
8
 
9
- type ReactCheckboxProps = {
10
- onClick?: () => any
11
- } & CheckboxProps
12
-
13
9
  const Checkbox = ({
14
10
  checked,
15
11
  label,
@@ -41,7 +37,7 @@ const Checkbox = ({
41
37
  >
42
38
  <input
43
39
  type="checkbox"
44
- checked={checked}
40
+ defaultChecked={checked}
45
41
  disabled={disabled}
46
42
  onClick={onClick}
47
43
  />
@@ -6,3 +6,7 @@ export type CheckboxProps = {
6
6
  boxed?: boolean
7
7
  color?: string
8
8
  }
9
+
10
+ export type ReactCheckboxProps = {
11
+ onClick?: (key: any) => any
12
+ } & CheckboxProps
@@ -1,13 +1,7 @@
1
1
  import React from 'react'
2
- import type { ConditionalWrapperProps } from './conditionalwrapper'
2
+ import type { ReactConditionalWrapperProps } from './conditionalwrapper'
3
3
 
4
- type ExtendedConditionalWrapperProps = {
5
- condition: ConditionalWrapperProps['condition']
6
- wrapper: (_: React.ReactNode) => any
7
- children: React.ReactNode
8
- };
9
-
10
- const ConditionalWrapper = ({ condition, wrapper, children }: ExtendedConditionalWrapperProps) =>
4
+ const ConditionalWrapper = ({ condition, wrapper, children }: ReactConditionalWrapperProps) =>
11
5
  condition ? wrapper(children) : children
12
6
 
13
7
  export default ConditionalWrapper
@@ -1,3 +1,8 @@
1
1
  export type ConditionalWrapperProps = {
2
2
  condition: boolean
3
3
  }
4
+
5
+ export type ReactConditionalWrapperProps = {
6
+ wrapper: (_: React.ReactNode) => any
7
+ children: React.ReactNode
8
+ } & ConditionalWrapperProps
@@ -0,0 +1,40 @@
1
+ ---
2
+ import type { ProgressProps } from './progress'
3
+ import './progress.scss'
4
+
5
+ interface Props extends ProgressProps {}
6
+
7
+ const {
8
+ value,
9
+ size,
10
+ label,
11
+ color,
12
+ background,
13
+ square,
14
+ striped,
15
+ stripeLight,
16
+ stripeDark,
17
+ className
18
+ } = Astro.props
19
+
20
+ const classes = [
21
+ 'w-progress',
22
+ size,
23
+ striped && 'striped',
24
+ square && 'square',
25
+ className
26
+ ]
27
+
28
+ const styles = [
29
+ color && `--w-progress-color: ${color};`,
30
+ background && `--w-progress-background: ${background};`,
31
+ stripeLight && `--w-progress-stripe-light: ${stripeLight};`,
32
+ stripeDark && `--w-progress-stripe-dark: ${stripeDark};`
33
+ ].filter(Boolean).join('')
34
+ ---
35
+
36
+ <div class:list={classes} style={styles}>
37
+ <div class="progress" style={`--w-progress-width: ${value}%;`}>
38
+ {label && `${value}%`}
39
+ </div>
40
+ </div>
@@ -0,0 +1,38 @@
1
+ <script lang="ts">
2
+ import type { ProgressProps } from './progress'
3
+ import './progress.scss'
4
+
5
+ export let value: ProgressProps['value'] = 0
6
+ export let size: ProgressProps['size'] = null
7
+ export let label: ProgressProps['label'] = false
8
+ export let color: ProgressProps['color'] = ''
9
+ export let background: ProgressProps['background'] = ''
10
+ export let square: ProgressProps['square'] = false
11
+ export let striped: ProgressProps['striped'] = false
12
+ export let stripeLight: ProgressProps['stripeLight'] = ''
13
+ export let stripeDark: ProgressProps['stripeDark'] = ''
14
+ export let className: ProgressProps['className'] = ''
15
+
16
+ const classes = [
17
+ 'w-progress',
18
+ size,
19
+ striped && 'striped',
20
+ square && 'square',
21
+ className
22
+ ].filter(Boolean).join(' ')
23
+
24
+ const styles = [
25
+ color && `--w-progress-color: ${color};`,
26
+ background && `--w-progress-background: ${background};`,
27
+ stripeLight && `--w-progress-stripe-light: ${stripeLight};`,
28
+ stripeDark && `--w-progress-stripe-dark: ${stripeDark};`
29
+ ].filter(Boolean).join('')
30
+ </script>
31
+
32
+ <div class={classes} style={styles}>
33
+ <div class="progress" style={`--w-progress-width: ${value}%;`}>
34
+ {#if label}
35
+ {`${value}%`}
36
+ {/if}
37
+ </div>
38
+ </div>
@@ -0,0 +1,47 @@
1
+ import React from 'react'
2
+ import type { ProgressProps } from './progress'
3
+
4
+ import './progress.scss'
5
+
6
+ const Progress = ({
7
+ value,
8
+ size,
9
+ label,
10
+ color,
11
+ background,
12
+ square,
13
+ striped,
14
+ stripeLight,
15
+ stripeDark,
16
+ className
17
+ }: ProgressProps) => {
18
+ const classes = [
19
+ 'w-progress',
20
+ size,
21
+ striped && 'striped',
22
+ square && 'square',
23
+ className
24
+ ].filter(Boolean).join(' ')
25
+
26
+ const styles = {
27
+ ...(color && { '--w-progress-color': color }),
28
+ ...(background && { '--w-progress-background': background }),
29
+ ...(stripeLight && { '--w-progress-stripe-light': stripeLight }),
30
+ ...(stripeDark && { '--w-progress-stripe-dark': stripeDark }),
31
+ } as React.CSSProperties
32
+
33
+ const percent = {
34
+ '--w-progress-width': `${value}%`
35
+ } as React.CSSProperties
36
+
37
+ return (
38
+ <div className={classes} style={styles}>
39
+ <div className="progress" style={percent}>
40
+ {label && `${value}%`}
41
+ </div>
42
+ </div>
43
+ )
44
+ }
45
+
46
+ export default Progress
47
+
@@ -0,0 +1,66 @@
1
+ @import '../../scss/config.scss';
2
+
3
+ .w-progress {
4
+ width: 100%;
5
+ height: 10px;
6
+ background: var(--w-progress-background);
7
+ border-radius: 20px;
8
+ overflow: hidden;
9
+ color: var(--w-progress-background);
10
+ font-family: Bold;
11
+ font-size: 10px;
12
+
13
+ &.medium {
14
+ height: 15px;
15
+ font-size: 12px;
16
+ }
17
+
18
+ &.large {
19
+ height: 20px;
20
+ font-size: 14px;
21
+ }
22
+
23
+ &.square {
24
+ border-radius: 2px;
25
+
26
+ .progress {
27
+ border-radius: 2px;
28
+ }
29
+ }
30
+
31
+ &.striped {
32
+
33
+ .progress {
34
+ background-size: 10px 10px;
35
+ background-image: linear-gradient(
36
+ -45deg,
37
+ var(--w-progress-stripe-light) 25%,
38
+ var(--w-progress-stripe-dark) 25%,
39
+ var(--w-progress-stripe-dark) 50%,
40
+ var(--w-progress-stripe-light) 50%,
41
+ var(--w-progress-stripe-light) 75%,
42
+ var(--w-progress-stripe-dark) 75%,
43
+ var(--w-progress-stripe-dark)
44
+ );
45
+ }
46
+
47
+ &.medium .progress {
48
+ background-size: 15px 15px;
49
+ }
50
+
51
+ &.large .progress {
52
+ background-size: 20px 20px;
53
+ }
54
+ }
55
+
56
+ .progress {
57
+ @include Transition(width);
58
+ width: var(--w-progress-width);
59
+ height: 100%;
60
+ background: var(--w-progress-color);
61
+ border-radius: 20px;
62
+ display: flex;
63
+ align-items: center;
64
+ justify-content: center;
65
+ }
66
+ }
@@ -0,0 +1,12 @@
1
+ export type ProgressProps = {
2
+ value: number
3
+ size?: 'medium' | 'large' | null
4
+ label?: boolean
5
+ color?: string
6
+ background?: string
7
+ square?: boolean
8
+ striped?: boolean
9
+ stripeLight?: string
10
+ stripeDark?: string
11
+ className?: string
12
+ }
@@ -1,14 +1,10 @@
1
1
  import React from 'react'
2
- import type { RadioProps } from './radio'
2
+ import type { ReactRadioProps } from './radio'
3
3
 
4
4
  import ConditionalWrapper from '../ConditionalWrapper/ConditionalWrapper.tsx'
5
5
 
6
6
  import './radio.scss'
7
7
 
8
- type ReactRadioProps = {
9
- onChange?: () => any
10
- } & RadioProps
11
-
12
8
  const Radio = ({
13
9
  name,
14
10
  items,
@@ -46,7 +42,7 @@ const Radio = ({
46
42
  type="radio"
47
43
  name={name}
48
44
  value={item.value}
49
- checked={item.selected}
45
+ defaultChecked={item.selected}
50
46
  disabled={item.disabled}
51
47
  onChange={onChange}
52
48
  />
@@ -11,3 +11,7 @@ export type RadioProps = {
11
11
  inline?: boolean
12
12
  className?: string
13
13
  }
14
+
15
+ export type ReactRadioProps = {
16
+ onChange?: (key: any) => any
17
+ } & RadioProps
@@ -0,0 +1,42 @@
1
+ ---
2
+ import type { SpinnerProps } from './spinner'
3
+ import './spinner.scss'
4
+
5
+ interface Props extends SpinnerProps {}
6
+
7
+ const {
8
+ color,
9
+ width,
10
+ speed,
11
+ size,
12
+ dashArray,
13
+ } = Astro.props
14
+
15
+ const classes = [
16
+ 'w-spinner',
17
+ dashArray && 'dashed'
18
+ ]
19
+
20
+ const styles = [
21
+ color && `--w-spinner-color: ${color};`,
22
+ width && `--w-spinner-width: ${width}px;`,
23
+ speed && `--w-spinner-speed: ${speed}s;`,
24
+ size && `--w-spinner-size: ${size}px;`,
25
+ dashArray && `--w-spinner-dash: ${dashArray}`,
26
+ ].filter(Boolean).join(' ')
27
+ ---
28
+
29
+ <svg
30
+ class:list={classes}
31
+ viewBox="25 25 50 50"
32
+ role="status"
33
+ style={styles}
34
+ >
35
+ <circle
36
+ class="spinner-path"
37
+ cx="50"
38
+ cy="50"
39
+ r="20"
40
+ fill="none"
41
+ />
42
+ </svg>