webcoreui 0.0.9 → 0.0.11

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 (77) hide show
  1. package/README.md +10 -10
  2. package/astro.d.ts +30 -16
  3. package/astro.js +17 -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/Input/Input.astro +52 -0
  23. package/components/Input/Input.svelte +52 -0
  24. package/components/Input/Input.tsx +59 -0
  25. package/components/Input/input.scss +83 -0
  26. package/components/Input/input.ts +44 -0
  27. package/components/Progress/Progress.astro +40 -0
  28. package/components/Progress/Progress.svelte +38 -0
  29. package/components/Progress/Progress.tsx +47 -0
  30. package/components/Progress/progress.scss +66 -0
  31. package/components/Progress/progress.ts +12 -0
  32. package/components/Radio/Radio.tsx +2 -6
  33. package/components/Radio/radio.ts +4 -0
  34. package/components/Spinner/Spinner.astro +42 -0
  35. package/components/Spinner/Spinner.svelte +38 -0
  36. package/components/Spinner/Spinner.tsx +44 -0
  37. package/components/Spinner/spinner.scss +41 -0
  38. package/components/Spinner/spinner.ts +7 -0
  39. package/components/Switch/Switch.tsx +2 -6
  40. package/components/Switch/switch.ts +4 -0
  41. package/components/Table/Table.astro +60 -0
  42. package/components/Table/Table.svelte +54 -0
  43. package/components/Table/Table.tsx +63 -0
  44. package/components/Table/table.scss +65 -0
  45. package/components/Table/table.ts +10 -0
  46. package/components/Tabs/Tabs.astro +76 -0
  47. package/components/Tabs/Tabs.svelte +54 -0
  48. package/components/Tabs/Tabs.tsx +69 -0
  49. package/components/Tabs/tabs.scss +134 -0
  50. package/components/Tabs/tabs.ts +16 -0
  51. package/components/Timeline/Timeline.astro +34 -0
  52. package/components/Timeline/Timeline.svelte +30 -0
  53. package/components/Timeline/Timeline.tsx +37 -0
  54. package/components/Timeline/timeline.scss +71 -0
  55. package/components/Timeline/timeline.ts +61 -0
  56. package/components/TimelineItem/TimelineItem.astro +26 -0
  57. package/components/TimelineItem/TimelineItem.svelte +22 -0
  58. package/components/TimelineItem/TimelineItem.tsx +32 -0
  59. package/components/TimelineItem/timelineitem.scss +31 -0
  60. package/components/TimelineItem/timelineitem.ts +5 -0
  61. package/components/Toast/Toast.astro +30 -0
  62. package/components/Toast/Toast.svelte +21 -0
  63. package/components/Toast/Toast.tsx +28 -0
  64. package/components/Toast/toast.scss +43 -0
  65. package/components/Toast/toast.ts +11 -0
  66. package/index.js +1 -0
  67. package/package.json +3 -1
  68. package/react.d.ts +42 -27
  69. package/react.js +17 -1
  70. package/scss/global/tooltip.scss +133 -0
  71. package/scss/global/utility.scss +17 -0
  72. package/scss/global.scss +1 -0
  73. package/scss/resets.scss +4 -0
  74. package/scss/setup.scss +20 -1
  75. package/svelte.d.ts +30 -16
  76. package/svelte.js +17 -1
  77. 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,14 @@ 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
+ - [Input](https://github.com/Frontendland/webcoreui/tree/main/src/components/Input)
148
+ - [Progress](https://github.com/Frontendland/webcoreui/tree/main/src/components/Progress)
155
149
  - [Radio](https://github.com/Frontendland/webcoreui/tree/main/src/components/Radio)
156
150
  - [Rating](https://github.com/Frontendland/webcoreui/tree/main/src/components/Rating)
151
+ - [Spinner](https://github.com/Frontendland/webcoreui/tree/main/src/components/Spinner)
157
152
  - [Switch](https://github.com/Frontendland/webcoreui/tree/main/src/components/Switch)
153
+ - [Table](https://github.com/Frontendland/webcoreui/tree/main/src/components/Table)
154
+ - [Tabs](https://github.com/Frontendland/webcoreui/tree/main/src/components/Tabs)
155
+ - [Timeline](https://github.com/Frontendland/webcoreui/blob/main/src/pages/timeline.astro)
156
+ - [Toast](https://github.com/Frontendland/webcoreui/tree/main/src/components/Toast)
157
+ - [Tooltip](https://github.com/Frontendland/webcoreui/blob/main/src/pages/tooltip.astro)
package/astro.d.ts CHANGED
@@ -1,18 +1,25 @@
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 { InputProps } from './components/Input/input'
11
+ import type { ProgressProps } from './components/Progress/progress'
12
+ import type { RadioProps } from './components/Radio/radio'
13
+ import type { RatingProps } from './components/Rating/rating'
14
+ import type { SpinnerProps } from './components/Spinner/spinner'
15
+ import type { SwitchProps } from './components/Switch/switch'
16
+ import type { TableProps } from './components/Table/table'
17
+ import type { TabsProps } from './components/Tabs/tabs'
18
+ import type { TimelineProps } from './components/Timeline/timeline'
19
+ import type { TimelineItemProps } from './components/TimelineItem/timelineitem'
20
+ import type { ToastProps } from './components/Toast/toast'
21
+
2
22
  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
23
  export function Accordion(_props: AccordionProps): any
17
24
  export function Alert(_props: AlertProps): any
18
25
  export function Avatar(_props: AvatarProps): any
@@ -22,8 +29,15 @@ declare module 'webcoreui/astro' {
22
29
  export function Checkbox(_props: CheckboxProps): any
23
30
  export function ConditionalWrapper(_props: ConditionalWrapperProps): any
24
31
  export function Icon(_props: IconProps): any
32
+ export function Input(_props: InputProps): any
33
+ export function Progress(_props: ProgressProps): any
25
34
  export function Radio(_props: RadioProps): any
26
35
  export function Rating(_props: RatingProps): any
36
+ export function Spinner(_props: SpinnerProps): any
27
37
  export function Switch(_props: SwitchProps): any
28
- }
29
-
38
+ export function Table(_props: TableProps): any
39
+ export function Tabs(_props: TabsProps): any
40
+ export function Timeline(_props: TimelineProps): any
41
+ export function TimelineItem(_props: TimelineItemProps): any
42
+ export function Toast(_props: ToastProps): any
43
+ }
package/astro.js CHANGED
@@ -7,9 +7,17 @@ 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 InputComponent from './components/Input/Input.astro'
11
+ import ProgressComponent from './components/Progress/Progress.astro'
10
12
  import RadioComponent from './components/Radio/Radio.astro'
11
13
  import RatingComponent from './components/Rating/Rating.astro'
14
+ import SpinnerComponent from './components/Spinner/Spinner.astro'
12
15
  import SwitchComponent from './components/Switch/Switch.astro'
16
+ import TableComponent from './components/Table/Table.astro'
17
+ import TabsComponent from './components/Tabs/Tabs.astro'
18
+ import TimelineComponent from './components/Timeline/Timeline.astro'
19
+ import TimelineItemComponent from './components/TimelineItem/TimelineItem.astro'
20
+ import ToastComponent from './components/Toast/Toast.astro'
13
21
 
14
22
  export const Accordion = AccordionComponent
15
23
  export const Alert = AlertComponent
@@ -20,6 +28,14 @@ export const Card = CardComponent
20
28
  export const Checkbox = CheckboxComponent
21
29
  export const ConditionalWrapper = ConditionalWrapperComponent
22
30
  export const Icon = IconComponent
31
+ export const Input = InputComponent
32
+ export const Progress = ProgressComponent
23
33
  export const Radio = RadioComponent
24
34
  export const Rating = RatingComponent
25
- export const Switch = SwitchComponent
35
+ export const Spinner = SpinnerComponent
36
+ export const Switch = SwitchComponent
37
+ export const Table = TableComponent
38
+ export const Tabs = TabsComponent
39
+ export const Timeline = TimelineComponent
40
+ export const TimelineItem = TimelineItemComponent
41
+ 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,52 @@
1
+ ---
2
+ import type { InputProps } from './input'
3
+ import ConditionalWrapper from '@components/ConditionalWrapper/ConditionalWrapper.astro'
4
+
5
+ import './input.scss'
6
+
7
+ interface Props extends InputProps {}
8
+
9
+ const {
10
+ type = 'text',
11
+ theme,
12
+ label,
13
+ subText,
14
+ fill,
15
+ className,
16
+ ...rest
17
+ } = Astro.props
18
+
19
+ const classes = [
20
+ 'w-input',
21
+ theme,
22
+ fill && 'fill',
23
+ className
24
+ ]
25
+
26
+ const useLabel = !!(label || subText || Astro.slots.has('icon'))
27
+ ---
28
+
29
+ <ConditionalWrapper condition={useLabel}>
30
+ <label slot="wrapper" class="w-input-label">
31
+ {label && (
32
+ <div class="label">{label}</div>
33
+ )}
34
+ <ConditionalWrapper condition={Astro.slots.has('icon')}>
35
+ <div class="input-wrapper" slot="wrapper">
36
+ children
37
+ </div>
38
+ <slot name="icon" />
39
+ children
40
+ </ConditionalWrapper>
41
+ {subText && (
42
+ <div class="subtext">
43
+ <Fragment set:html={subText} />
44
+ </div>
45
+ )}
46
+ </label>
47
+ <input
48
+ type={type}
49
+ class:list={classes}
50
+ {...rest}
51
+ />
52
+ </ConditionalWrapper>
@@ -0,0 +1,52 @@
1
+ <script lang="ts">
2
+ import type { InputProps } from './input'
3
+ import ConditionalWrapper from '@components/ConditionalWrapper/ConditionalWrapper.svelte'
4
+ import './input.scss'
5
+
6
+ export let type: InputProps['type'] = 'text'
7
+ export let theme: InputProps['theme'] = null
8
+ export let label: InputProps['label'] = ''
9
+ export let subText: InputProps['subText'] = ''
10
+ export let fill: InputProps['fill'] = false
11
+ export let className: InputProps['className'] = ''
12
+ export let onChange: (e: any) => any = () => {}
13
+ export let onKeyUp: (e: any) => any = () => {}
14
+
15
+ const classes = [
16
+ 'w-input',
17
+ theme,
18
+ fill && 'fill',
19
+ className
20
+ ].filter(Boolean).join(' ')
21
+
22
+ const useLabel = !!(label || subText || $$slots.icon)
23
+ </script>
24
+
25
+ <ConditionalWrapper
26
+ condition={useLabel}
27
+ element="label"
28
+ class="w-input-label"
29
+ >
30
+ {#if label}
31
+ <div class="label">{label}</div>
32
+ {/if}
33
+ <ConditionalWrapper
34
+ condition={$$slots.icon}
35
+ element="div"
36
+ class="input-wrapper"
37
+ >
38
+ <slot name="icon" />
39
+ <input
40
+ type={type}
41
+ class={classes}
42
+ on:change={onChange}
43
+ on:keyup={onKeyUp}
44
+ {...$$restProps}
45
+ />
46
+ </ConditionalWrapper>
47
+ {#if label}
48
+ <div class="subtext">
49
+ {@html subText}
50
+ </div>
51
+ {/if}
52
+ </ConditionalWrapper>
@@ -0,0 +1,59 @@
1
+ import React from 'react'
2
+ import type { ReactInputProps } from './input'
3
+ import ConditionalWrapper from '@components/ConditionalWrapper/ConditionalWrapper.tsx'
4
+
5
+ import './input.scss'
6
+
7
+ const Input = ({
8
+ type = 'text',
9
+ theme,
10
+ label,
11
+ subText,
12
+ fill,
13
+ icon,
14
+ value,
15
+ className,
16
+ ...rest
17
+ }: ReactInputProps) => {
18
+ const classes = [
19
+ 'w-input',
20
+ theme,
21
+ fill && 'fill',
22
+ className
23
+ ].filter(Boolean).join(' ')
24
+
25
+ const useLabel = !!(label || subText || icon)
26
+
27
+ return (
28
+ <ConditionalWrapper condition={useLabel} wrapper={children => (
29
+ <label className="w-input-label">
30
+ {children}
31
+ </label>
32
+ )}>
33
+ {label && (
34
+ <div className="label">{label}</div>
35
+ )}
36
+ <ConditionalWrapper condition={!!icon} wrapper={children => (
37
+ <div className="input-wrapper">
38
+ {children}
39
+ </div>
40
+ )}>
41
+ {icon && icon}
42
+ <input
43
+ type={type}
44
+ className={classes}
45
+ defaultValue={value}
46
+ {...rest}
47
+ />
48
+ </ConditionalWrapper>
49
+ {subText && (
50
+ <div
51
+ className="subtext"
52
+ dangerouslySetInnerHTML={{ __html: subText }}
53
+ />
54
+ )}
55
+ </ConditionalWrapper>
56
+ )
57
+ }
58
+
59
+ export default Input
@@ -0,0 +1,83 @@
1
+ @import '../../scss/config.scss';
2
+
3
+ .w-input {
4
+ border-radius: 2px;
5
+ padding: 5px 10px;
6
+ border: 1px solid #252525;
7
+ background: transparent;
8
+ font-family: Regular;
9
+ color: #FFF;
10
+ line-height: 20px;
11
+ width: 100%;
12
+ color-scheme: dark;
13
+
14
+ &[disabled] {
15
+ cursor: no-drop;
16
+ color: #555;
17
+ }
18
+
19
+ &::file-selector-button {
20
+ background: transparent;
21
+ border: 0;
22
+ color: #FFF;
23
+ }
24
+
25
+ &[type="color"] {
26
+ padding: 0;
27
+ }
28
+
29
+ &.info {
30
+ border-color: #48dbfb;
31
+ }
32
+
33
+ &.success {
34
+ border-color: #1dd1a1;
35
+ }
36
+
37
+ &.warning {
38
+ border-color: #f7aa61;
39
+ }
40
+
41
+ &.alert {
42
+ border-color: #ee5253;
43
+ }
44
+
45
+ &.fill {
46
+ background: #252525;
47
+ }
48
+ }
49
+
50
+ .w-input-label {
51
+ display: flex;
52
+ flex-direction: column;
53
+
54
+ .label {
55
+ font-size: 16px;
56
+ color: #BBB;
57
+ margin-bottom: 5px;
58
+ }
59
+
60
+ .input-wrapper {
61
+ display: flex;
62
+ gap: 10px;
63
+ align-items: center;
64
+ position: relative;
65
+
66
+ input {
67
+ padding-left: 40px;
68
+ }
69
+
70
+ svg {
71
+ position: absolute;
72
+ left: 10px;
73
+ width: 20px;
74
+ height: 20px;
75
+ }
76
+ }
77
+
78
+ .subtext {
79
+ font-size: 14px;
80
+ color: #555;
81
+ margin-top: 5px;
82
+ }
83
+ }
@@ -0,0 +1,44 @@
1
+ export type InputProps = {
2
+ type?: 'text'
3
+ | 'email'
4
+ | 'password'
5
+ | 'number'
6
+ | 'tel'
7
+ | 'url'
8
+ | 'search'
9
+ | 'file'
10
+ | 'date'
11
+ | 'datetime-local'
12
+ | 'month'
13
+ | 'week'
14
+ | 'time'
15
+ | 'color'
16
+ theme?: 'info'
17
+ | 'success'
18
+ | 'warning'
19
+ | 'alert'
20
+ | null
21
+ value?: string | number
22
+ name?: string
23
+ placeholder?: string
24
+ label?: string
25
+ disabled?: boolean
26
+ subText?: string
27
+ fill?: boolean
28
+ maxLength?: number
29
+ min?: number
30
+ max?: number
31
+ step?: number
32
+ multiple?: boolean
33
+ pattern?: string
34
+ required?: boolean
35
+ autofocus?: boolean
36
+ autocomplete?: 'on' | 'off'
37
+ className?: string
38
+ [key: string]: any
39
+ }
40
+
41
+ export type ReactInputProps = {
42
+ icon?: string
43
+ children?: React.ReactNode
44
+ } & InputProps