forstok-ui-lib 1.0.1 → 1.0.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forstok-ui-lib",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Forstok UI Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -30,13 +30,18 @@
30
30
  "@rollup/plugin-node-resolve": "^16.0.0",
31
31
  "@rollup/plugin-terser": "^0.4.4",
32
32
  "@rollup/plugin-typescript": "^12.1.2",
33
- "@types/react": "^19.0.8",
33
+ "@types/react": "^19.0.2",
34
+ "@types/react-dom": "^19.0.2",
34
35
  "react": "^19.0.0",
36
+ "react-dom": "^19.0.0",
37
+ "react-router-dom": "^7.1.1",
35
38
  "rollup-plugin-dts": "^6.1.1",
36
39
  "rollup-plugin-peer-deps-external": "^2.2.4",
37
40
  "rollup-plugin-postcss": "^4.0.2",
41
+ "rollup-plugin-typescript2": "^0.36.0",
38
42
  "styled-components": "^6.1.15",
39
43
  "tslib": "^2.8.1",
40
- "typescript": "^5.7.3"
44
+ "typescript": "^5.7.2",
45
+ "typescript-plugin-styled-components": "^3.0.0"
41
46
  }
42
47
  }
package/rollup.config.js CHANGED
@@ -1,10 +1,10 @@
1
- import PeerDepsExternal from 'rollup-plugin-peer-deps-external';
1
+ import PeerDepsExternalPlugin from 'rollup-plugin-peer-deps-external'
2
2
  import resolve from '@rollup/plugin-node-resolve';
3
3
  import commonjs from '@rollup/plugin-commonjs';
4
- import typescript from '@rollup/plugin-typescript';
5
4
  import terser from '@rollup/plugin-terser';
6
5
  import postcss from 'rollup-plugin-postcss';
7
6
  import dts from 'rollup-plugin-dts';
7
+ import typescript from "@rollup/plugin-typescript";
8
8
 
9
9
  const packageJson = require('./package.json');
10
10
 
@@ -16,18 +16,20 @@ export default [
16
16
  file: packageJson.main,
17
17
  format: 'cjs',
18
18
  sourcemap: true,
19
+ interop: "auto",
19
20
  },
20
21
  {
21
22
  file: packageJson.module,
22
23
  format: 'esm',
23
24
  sourcemap: true,
25
+ interop: "auto",
24
26
  },
25
27
  ],
26
28
  plugins: [
27
- PeerDepsExternal(),
29
+ PeerDepsExternalPlugin(),
28
30
  resolve(),
29
31
  commonjs(),
30
- typescript({tsconfig: './tsconfig.json'}),
32
+ typescript({ tsconfig: "./tsconfig.json" }),
31
33
  terser(),
32
34
  postcss({
33
35
  extract: true,
@@ -40,7 +42,8 @@ export default [
40
42
  input: 'src/index.ts',
41
43
  output: [
42
44
  {
43
- file: packageJson.types
45
+ file: packageJson.types,
46
+ format: 'esm'
44
47
  },
45
48
  ],
46
49
  plugins: [
@@ -0,0 +1,62 @@
1
+ import { css } from 'styled-components'
2
+
3
+ export const clearList = css`
4
+ list-style: none;
5
+ padding: 0;
6
+ margin: 0;
7
+ `
8
+ export const responseWidth = css `
9
+ width: 100%;
10
+ `
11
+ export const elipsis = css `
12
+ overflow: hidden;
13
+ text-overflow: ellipsis;
14
+ white-space: nowrap;
15
+ display: block;
16
+ max-width: 100%;
17
+ width: auto;
18
+ `
19
+ export const multiElipsis = css`
20
+ display: -webkit-box !important;
21
+ -webkit-line-clamp: 2;
22
+ -webkit-box-orient: vertical;
23
+ overflow: hidden;
24
+ white-space: pre-wrap;
25
+ overflow-wrap: anywhere;
26
+ word-break: break-all;
27
+ line-height: 16px;
28
+ `
29
+ export const thirdElipsis = css`
30
+ display: -webkit-box !important;
31
+ -webkit-line-clamp: 3 !important;
32
+ -webkit-box-orient: vertical !important;
33
+ overflow: hidden !important;
34
+ white-space: pre-wrap !important;
35
+ overflow-wrap: anywhere !important;
36
+ word-break: break-word !important;
37
+ line-height: 16px;
38
+ `
39
+ export const boxBase = css`
40
+ background-color: var(--pri-clr-bg);
41
+ box-shadow: var(--pri-shd-bx);
42
+ border-radius: var(--pri-rd);
43
+ border: 1px solid var(--lay-clr-ln);
44
+ `
45
+ export const dropBase = css`
46
+ background-color: var(--pri-clr-bg);
47
+ border: 1px solid var(--sec-clr-ln);
48
+ box-shadow: var(--sec-shd-bx);
49
+ border-radius: var(--sec-rd);
50
+ `
51
+ export const headTable = css`
52
+ font-size: 12px;
53
+ font-weight: 600;
54
+ letter-spacing: 0.3px;
55
+ text-transform: capitalize;
56
+ `
57
+ export const formLabel = css`
58
+ color: var(--hd-clr);
59
+ font-weight: 600;
60
+ font-size: 13px;
61
+ text-transform: capitalize;
62
+ `
@@ -0,0 +1,2 @@
1
+ export { default as TextComponent } from './text/text';
2
+ export { default as LinkComponent } from './link/link';
@@ -0,0 +1,162 @@
1
+ import { Link } from 'react-router-dom';
2
+ import styled, { css } from 'styled-components';
3
+ import { multiElipsis } from '../../assets/stylesheets/bases.styles';
4
+
5
+ const ClearStyles = css`
6
+ color: var(--pri-clr-lnk);
7
+ &,
8
+ &:hover {
9
+ text-decoration: none;
10
+ }
11
+ &:hover {
12
+ color: var(--pri-clr-lnk__hvr);
13
+ }
14
+ `
15
+ const ClearRStyles = css`
16
+ color: var(--pri-clr-lnk);
17
+ &,
18
+ &:hover {
19
+ text-decoration: none;
20
+ }
21
+ &:hover {
22
+ color: var(--sec-clr-lnk__hvr);
23
+ }
24
+ `
25
+ const ButtonStyles = css`
26
+ position: relative;
27
+ display: inline-grid;
28
+ padding: 0 16px;
29
+ border-radius: var(--sec-rd);
30
+ outline: none;
31
+ height: 30px;
32
+ align-items: center;
33
+ transform-origin: 100% 0%;
34
+ transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out,-webkit-box-shadow .15s ease-in-out;
35
+ &,
36
+ &:hover {
37
+ text-decoration: none;
38
+ }
39
+ `
40
+ const getLinkModifiedStyled = ({ mode, $elipsis, $activated, $shadow, disabled }:{ mode?: string, $elipsis: boolean, $activated: boolean, $shadow: boolean, disabled: boolean }) => {
41
+ let style = ``;
42
+ if (mode === 'clear') {
43
+ style += ClearStyles
44
+ } else if (mode === 'clearR') {
45
+ style += ClearRStyles
46
+ } else if (mode === 'blue') {
47
+ style += `
48
+ &, &:hover {
49
+ color: var(--pri-clr-lnk__hvr);
50
+ text-decoration: none;
51
+ }
52
+ `
53
+ } else if (mode === 'trans') {
54
+ style += ButtonStyles + `
55
+ height: auto;
56
+ padding: 0;
57
+ opacity: 1;
58
+ &,
59
+ &:hover {
60
+ color: var(--pri-clr-lnk__hvr);
61
+ text-decoration: none;
62
+ }
63
+ &:hover {
64
+ opacity: .9;
65
+ }
66
+ `
67
+ } else if (mode === 'hover') {
68
+ style += ButtonStyles + `
69
+ height: auto;
70
+ width: max-content;
71
+ padding: 3px 6px;
72
+ position: relative;
73
+ left: -6px;
74
+ color: initial;
75
+ grid-gap: 4px;
76
+ &:hover {
77
+ border-radius: var(--ter-rd);
78
+ box-shadow: 1px 1px var(--pri-clr-ln);
79
+ background-color: var(--mt-clr-bg__fc);
80
+ text-decoration: none;
81
+ }
82
+ `
83
+ } else if (mode === 'whiteB') {
84
+ style += ButtonStyles + `
85
+ color: var(--ter-clr);
86
+ background-color: var(--cl-clr-bg);
87
+ border: 1px solid var(--sec-clr-ln);
88
+ &,
89
+ &:hover {
90
+ background-color: var(--cl-clr-bg__hvr);
91
+ }
92
+ `
93
+ } else if (mode === 'redB') {
94
+ style += ButtonStyles + `
95
+ color: var(--act-clr);
96
+ background-color: var(--act-clr-bg);
97
+ &:hover {
98
+ background-color: var(--act-clr-bg__hvr);
99
+ }
100
+ `
101
+ } else if (mode === 'greyB') {
102
+ style += ButtonStyles + `
103
+ color: var(--act-clr);
104
+ background-color: var(--mt-clr-bg__fc);
105
+ &:hover {
106
+ background-color: var(--cl-clr-bg__hvr);
107
+ }
108
+ `
109
+ }
110
+ if ($activated) {
111
+ style += `
112
+ color: var(--sta-clr);
113
+ font-weight: 400;
114
+ `
115
+ if (mode === 'clear' || mode === 'clearR') {
116
+ style += `
117
+ color: var(--pri-clr-lnk__act);
118
+ font-weight: 600;
119
+ `
120
+ }
121
+ }
122
+ if ($elipsis) {
123
+ style += `
124
+ overflow: hidden;
125
+ text-overflow: ellipsis;
126
+ white-space: nowrap;
127
+ display: block;
128
+ max-width: 100%;
129
+ width: auto;
130
+ ${multiElipsis}
131
+ `
132
+ }
133
+ if ($shadow) {
134
+ style += `
135
+ box-shadow: var(--act-shd-bx);
136
+ `
137
+ }
138
+ if(disabled) {
139
+ style += `
140
+ color: #A9A9A9;
141
+ opacity: 0.7;
142
+ pointer-events: none;
143
+ `
144
+ }
145
+ return style;
146
+ }
147
+
148
+ export const LinkContainer = styled(Link)<{ mode?: string, $elipsis: boolean, $activated: boolean, $shadow: boolean, disabled: boolean }>`
149
+ &._refHoverLink {
150
+ padding: 3px 0px 0px 6px;
151
+ position: relative;
152
+ top: -3px;
153
+ }
154
+ ${getLinkModifiedStyled}
155
+ `
156
+ export const AnchorLinkContainer = styled.a<{ mode?: string, $elipsis: boolean, $activated: boolean, $shadow: boolean, disabled: boolean }>`
157
+ ${getLinkModifiedStyled}
158
+ `
159
+ export const ElLinkContainer = styled.span<{ mode?: string, $elipsis: boolean, $activated: boolean, $shadow: boolean, disabled: boolean }>`
160
+ cursor:pointer;
161
+ ${getLinkModifiedStyled}
162
+ `
@@ -0,0 +1,38 @@
1
+ import type { AnchorHTMLAttributes, ReactNode, MouseEvent, HTMLAttributes } from 'react';
2
+ import { AnchorLinkContainer, ElLinkContainer } from './link.styles';
3
+ import LinkRouteComponent from './link_route';
4
+ import type { Path } from 'react-router-dom';
5
+
6
+ type TLinkBase = {
7
+ children: ReactNode
8
+ mode?: string
9
+ $activated?: boolean
10
+ $elipsis?: boolean
11
+ $shadow?: boolean
12
+ disabled?: boolean
13
+ } & (
14
+ (AnchorHTMLAttributes<HTMLAnchorElement> & {
15
+ href?: string
16
+ to?: undefined
17
+ onClick?: (e: MouseEvent<HTMLAnchorElement>) => void
18
+ }) |
19
+ (AnchorHTMLAttributes<HTMLAnchorElement> & {
20
+ href?: undefined
21
+ to: string | Partial<Path>
22
+ onClick?: (e: MouseEvent<HTMLAnchorElement>) => void
23
+ }) |
24
+ (HTMLAttributes<HTMLSpanElement> & {
25
+ href?: undefined
26
+ to?: undefined
27
+ onClick?: (e: MouseEvent<HTMLSpanElement>) => void
28
+ })
29
+ );
30
+
31
+ const LinkComponent = ({ children, mode, $activated=false, href, to, $elipsis=false, $shadow=false, disabled=false, ...props }: TLinkBase) => {
32
+ const { onClick } = props
33
+ return (
34
+ href ? <AnchorLinkContainer className='_refLink' mode={mode} $activated={$activated ? true : false} $elipsis={$elipsis ? true : false} $shadow={$shadow ? true : false} disabled={disabled ? true : false} href={href} {...props}>{children}</AnchorLinkContainer> : (to ? <LinkRouteComponent to={to} className='_refLink' mode={mode} $activated={$activated && true} $elipsis={$elipsis ? true : false} $shadow={$shadow ? true : false} disabled={disabled ? true : false} {...props}>{children}</LinkRouteComponent> : <ElLinkContainer className='_refLink' mode={mode} $activated={$activated ? true : false} $elipsis={$elipsis ? true : false} $shadow={$shadow ? true : false} disabled={disabled ? true : false} onClick={onClick} {...props}>{children}</ElLinkContainer>)
35
+ );
36
+ };
37
+
38
+ export default LinkComponent;
@@ -0,0 +1,21 @@
1
+ import type { ReactNode, AnchorHTMLAttributes } from 'react';
2
+ import type { LinkProps, Path } from 'react-router-dom';
3
+ import { LinkContainer } from './link.styles';
4
+
5
+ type TLinkBase = {
6
+ children: ReactNode
7
+ mode?: string
8
+ $activated: boolean
9
+ $elipsis: boolean
10
+ $shadow: boolean
11
+ disabled: boolean
12
+ to: string | Partial<Path>
13
+ };
14
+
15
+ type TLink = LinkProps & AnchorHTMLAttributes<HTMLAnchorElement> & TLinkBase;
16
+
17
+ const LinkRouteComponent = ({ children, mode, $activated, $elipsis, to, $shadow, disabled, ...props }: TLink) => {
18
+ return <LinkContainer className='_refLink' to={to} mode={mode} $activated={$activated ? true : false} $elipsis={$elipsis ? true : false} $shadow={$shadow ? true : false} disabled={disabled ? true : false} {...props}>{children}</LinkContainer>;
19
+ };
20
+
21
+ export default LinkRouteComponent;
package/src/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  //index.ts
2
2
 
3
3
  // Text Component
4
- import TextComponent from './components/text/text';
5
- export { TextComponent };
4
+ export * from './components';