@bikdotai/bik-component-library 0.0.23-tag.2 → 0.0.23

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.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const WorkingStepper: () => JSX.Element;
3
2
  export declare enum STEPENUM {
4
3
  STEP1 = "STEP1",
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { TagProps } from './model';
3
3
  export declare const Tag: {
4
- ({ tagText, LeadingIcon, TrailingIcon, onLeadingIconClicked, onTrailingIconClicked, theme, type, variant, }: TagProps): JSX.Element;
4
+ ({ tagText, LeadingIcon, TrailingIcon, theme, type, variant, }: TagProps): JSX.Element;
5
5
  displayName: string;
6
6
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("../TypographyStyle.js"),r=require("./model.js"),i=require("./Tag.styled.js"),n=require("./themes.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(t);const c=t=>{let{tagText:l,LeadingIcon:c,TrailingIcon:o,onLeadingIconClicked:d,onTrailingIconClicked:g,theme:u="light",type:j="neutral",variant:p="regular"}=t,y=l,h=u,m=j;r.ValidTagTypeMap[p][j]||(m="neutral"),"circle"===p&&(h="dark","number"==typeof y&&y>99&&(y="99+"));const b={height:16,width:16,color:n.getTagIconColor(u,m),style:{display:"block"}};return e.jsx(i.Tag,Object.assign({theme:h,type:j,variant:p},{children:e.jsxs("div",Object.assign({className:"container"},{children:[c&&e.jsx("button",Object.assign({className:"icon-leading",onClick:d},{children:s.default.createElement(c,b)})),e.jsx(a.BodyCaption,Object.assign({className:"text"},{children:y})),o&&e.jsx("button",Object.assign({className:"icon-trailing",onClick:g},{children:s.default.createElement(o,b)}))]}))}))};c.displayName="Tag",exports.Tag=c;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),a=require("../TypographyStyle.js"),r=require("./model.js"),i=require("./Tag.styled.js"),s=require("./themes.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(t);const c=t=>{let{tagText:n,LeadingIcon:c,TrailingIcon:o,theme:d="light",type:g="neutral",variant:u="regular"}=t,j=n,p=d,y=g;r.ValidTagTypeMap[u][g]||(y="neutral"),"circle"===u&&(p="dark","number"==typeof j&&j>99&&(j="99+"));const h={height:16,width:16,color:s.getTagIconColor(d,y),style:{display:"block"}};return e.jsx(i.Tag,Object.assign({theme:p,type:g,variant:u},{children:e.jsxs("div",Object.assign({className:"container"},{children:[c&&e.jsx("div",Object.assign({className:"icon-trailing"},{children:l.default.createElement(c,h)})),e.jsx(a.BodyCaption,Object.assign({className:"text"},{children:j})),o&&e.jsx("div",Object.assign({className:"icon-leading"},{children:l.default.createElement(o,h)}))]}))}))};c.displayName="Tag",exports.Tag=c;
@@ -1,28 +1,26 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("./themes.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=r(e).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("./themes.js");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const a=t(e).default.div`
2
2
  cursor: default;
3
3
  ${e=>"regular"===e.variant?"display: block;":""}
4
4
  ${e=>"circle"===e.variant&&"height: 20px;"}
5
5
  .container {
6
6
  display: flex;
7
7
  gap: 6px;
8
- padding: ${e=>t.getPadding(e.variant)};
8
+ padding: ${e=>r.getPadding(e.variant)};
9
9
 
10
- background-color: ${e=>t.getBackgroundColor(e.theme,e.type)};
10
+ background-color: ${e=>r.getBackgroundColor(e.theme,e.type)};
11
11
 
12
12
  border-radius: ${e=>"regular"===e.variant?"4px":"12px"};
13
13
 
14
- ${e=>"light"===e.theme&&`border: 1px solid ${t.generateBorder(e.type)};`}
14
+ ${e=>"light"===e.theme&&`border: 1px solid ${r.generateBorder(e.type)};`}
15
15
 
16
16
  .text {
17
- color: ${e=>t.getTextColor(e.theme,e.type)};
17
+ color: ${e=>r.getTextColor(e.theme,e.type)};
18
18
  }
19
19
 
20
20
  .icon-trailing {
21
- all: unset;
22
21
  }
23
22
 
24
23
  .icon-leading {
25
- all: unset;
26
24
  }
27
25
  }
28
26
  `;exports.Tag=a;
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { MouseEventHandler } from 'react';
1
+ /// <reference types="react" />
3
2
  export type TagTheme = 'light' | 'dark';
4
3
  export type TagVariant = 'regular' | 'circle';
5
4
  export type TagType = 'negative' | 'warning' | 'positive' | 'neutral' | 'white' | 'purple' | 'blue' | 'grey';
@@ -22,7 +21,7 @@ export declare const ValidTagTypeMap: {
22
21
  grey: boolean;
23
22
  };
24
23
  };
25
- export interface TagProps extends React.BaseHTMLAttributes<HTMLDivElement> {
24
+ export interface TagProps {
26
25
  /**
27
26
  * Set the theme of the Tag
28
27
  * @default default light
@@ -39,24 +38,16 @@ export interface TagProps extends React.BaseHTMLAttributes<HTMLDivElement> {
39
38
  */
40
39
  variant?: TagVariant;
41
40
  /**
42
- * The icon component that is the right of the text
41
+ * The icon component that is the left of the text
43
42
  * Referred to https://ozzie.sh/passing-icons-as-props-in-a-consistent-way-using-react
44
43
  * @default undefined
45
44
  */
46
45
  TrailingIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
47
46
  /**
48
- * The left icon on click event, defaults to () => {}
49
- */
50
- onTrailingIconClicked?: MouseEventHandler<HTMLButtonElement>;
51
- /**
52
- * The icon component that is to the left of the text
47
+ * The icon component that is to the right of the text
53
48
  * Referred to https://ozzie.sh/passing-icons-as-props-in-a-consistent-way-using-react
54
49
  * @default undefined
55
50
  */
56
51
  LeadingIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
57
- /**
58
- * The right icon on click event, defaults to () => {}
59
- */
60
- onLeadingIconClicked?: MouseEventHandler<HTMLButtonElement>;
61
52
  tagText: string | number;
62
53
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const WorkingStepper: () => JSX.Element;
3
2
  export declare enum STEPENUM {
4
3
  STEP1 = "STEP1",
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { TagProps } from './model';
3
3
  export declare const Tag: {
4
- ({ tagText, LeadingIcon, TrailingIcon, onLeadingIconClicked, onTrailingIconClicked, theme, type, variant, }: TagProps): JSX.Element;
4
+ ({ tagText, LeadingIcon, TrailingIcon, theme, type, variant, }: TagProps): JSX.Element;
5
5
  displayName: string;
6
6
  };
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import i from"react";import{BodyCaption as a}from"../TypographyStyle.js";import{ValidTagTypeMap as n}from"./model.js";import{Tag as r}from"./Tag.styled.js";import{getTagIconColor as c}from"./themes.js";const o=o=>{let{tagText:l,LeadingIcon:s,TrailingIcon:m,onLeadingIconClicked:g,onTrailingIconClicked:d,theme:p="light",type:h="neutral",variant:j="regular"}=o,y=l,b=p,u=h;n[j][h]||(u="neutral"),"circle"===j&&(b="dark","number"==typeof y&&y>99&&(y="99+"));const f={height:16,width:16,color:c(p,u),style:{display:"block"}};return e(r,Object.assign({theme:b,type:h,variant:j},{children:t("div",Object.assign({className:"container"},{children:[s&&e("button",Object.assign({className:"icon-leading",onClick:g},{children:i.createElement(s,f)})),e(a,Object.assign({className:"text"},{children:y})),m&&e("button",Object.assign({className:"icon-trailing",onClick:d},{children:i.createElement(m,f)}))]}))}))};o.displayName="Tag";export{o as Tag};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import a from"react";import{BodyCaption as r}from"../TypographyStyle.js";import{ValidTagTypeMap as i}from"./model.js";import{Tag as n}from"./Tag.styled.js";import{getTagIconColor as s}from"./themes.js";const c=c=>{let{tagText:l,LeadingIcon:o,TrailingIcon:m,theme:g="light",type:d="neutral",variant:p="regular"}=c,h=l,j=g,y=d;i[p][d]||(y="neutral"),"circle"===p&&(j="dark","number"==typeof h&&h>99&&(h="99+"));const b={height:16,width:16,color:s(g,y),style:{display:"block"}};return e(n,Object.assign({theme:j,type:d,variant:p},{children:t("div",Object.assign({className:"container"},{children:[o&&e("div",Object.assign({className:"icon-trailing"},{children:a.createElement(o,b)})),e(r,Object.assign({className:"text"},{children:h})),m&&e("div",Object.assign({className:"icon-leading"},{children:a.createElement(m,b)}))]}))}))};c.displayName="Tag";export{c as Tag};
@@ -1,28 +1,26 @@
1
- import e from"styled-components";import{getPadding as r,getBackgroundColor as t,generateBorder as a,getTextColor as i}from"./themes.js";const o=e.div`
1
+ import r from"styled-components";import{getPadding as e,getBackgroundColor as t,generateBorder as i,getTextColor as o}from"./themes.js";const a=r.div`
2
2
  cursor: default;
3
- ${e=>"regular"===e.variant?"display: block;":""}
4
- ${e=>"circle"===e.variant&&"height: 20px;"}
3
+ ${r=>"regular"===r.variant?"display: block;":""}
4
+ ${r=>"circle"===r.variant&&"height: 20px;"}
5
5
  .container {
6
6
  display: flex;
7
7
  gap: 6px;
8
- padding: ${e=>r(e.variant)};
8
+ padding: ${r=>e(r.variant)};
9
9
 
10
- background-color: ${e=>t(e.theme,e.type)};
10
+ background-color: ${r=>t(r.theme,r.type)};
11
11
 
12
- border-radius: ${e=>"regular"===e.variant?"4px":"12px"};
12
+ border-radius: ${r=>"regular"===r.variant?"4px":"12px"};
13
13
 
14
- ${e=>"light"===e.theme&&`border: 1px solid ${a(e.type)};`}
14
+ ${r=>"light"===r.theme&&`border: 1px solid ${i(r.type)};`}
15
15
 
16
16
  .text {
17
- color: ${e=>i(e.theme,e.type)};
17
+ color: ${r=>o(r.theme,r.type)};
18
18
  }
19
19
 
20
20
  .icon-trailing {
21
- all: unset;
22
21
  }
23
22
 
24
23
  .icon-leading {
25
- all: unset;
26
24
  }
27
25
  }
28
- `;export{o as Tag};
26
+ `;export{a as Tag};
@@ -1,5 +1,4 @@
1
- import React from 'react';
2
- import { MouseEventHandler } from 'react';
1
+ /// <reference types="react" />
3
2
  export type TagTheme = 'light' | 'dark';
4
3
  export type TagVariant = 'regular' | 'circle';
5
4
  export type TagType = 'negative' | 'warning' | 'positive' | 'neutral' | 'white' | 'purple' | 'blue' | 'grey';
@@ -22,7 +21,7 @@ export declare const ValidTagTypeMap: {
22
21
  grey: boolean;
23
22
  };
24
23
  };
25
- export interface TagProps extends React.BaseHTMLAttributes<HTMLDivElement> {
24
+ export interface TagProps {
26
25
  /**
27
26
  * Set the theme of the Tag
28
27
  * @default default light
@@ -39,24 +38,16 @@ export interface TagProps extends React.BaseHTMLAttributes<HTMLDivElement> {
39
38
  */
40
39
  variant?: TagVariant;
41
40
  /**
42
- * The icon component that is the right of the text
41
+ * The icon component that is the left of the text
43
42
  * Referred to https://ozzie.sh/passing-icons-as-props-in-a-consistent-way-using-react
44
43
  * @default undefined
45
44
  */
46
45
  TrailingIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
47
46
  /**
48
- * The left icon on click event, defaults to () => {}
49
- */
50
- onTrailingIconClicked?: MouseEventHandler<HTMLButtonElement>;
51
- /**
52
- * The icon component that is to the left of the text
47
+ * The icon component that is to the right of the text
53
48
  * Referred to https://ozzie.sh/passing-icons-as-props-in-a-consistent-way-using-react
54
49
  * @default undefined
55
50
  */
56
51
  LeadingIcon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
57
- /**
58
- * The right icon on click event, defaults to () => {}
59
- */
60
- onLeadingIconClicked?: MouseEventHandler<HTMLButtonElement>;
61
52
  tagText: string | number;
62
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.23-tag.2",
3
+ "version": "0.0.23",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",