frey-ui 1.0.2 → 1.0.3

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/dist/index.esm.js CHANGED
@@ -1,7 +1,49 @@
1
- import React from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
2
3
 
3
- const MyComponent = ({ message }) => {
4
- return (React.createElement("div", { style: { backgroundColor: 'black', color: 'white' } }, message));
4
+ function styleInject(css, ref) {
5
+ if ( ref === undefined ) ref = {};
6
+ var insertAt = ref.insertAt;
7
+
8
+ if (typeof document === 'undefined') { return; }
9
+
10
+ var head = document.head || document.getElementsByTagName('head')[0];
11
+ var style = document.createElement('style');
12
+ style.type = 'text/css';
13
+
14
+ if (insertAt === 'top') {
15
+ if (head.firstChild) {
16
+ head.insertBefore(style, head.firstChild);
17
+ } else {
18
+ head.appendChild(style);
19
+ }
20
+ } else {
21
+ head.appendChild(style);
22
+ }
23
+
24
+ if (style.styleSheet) {
25
+ style.styleSheet.cssText = css;
26
+ } else {
27
+ style.appendChild(document.createTextNode(css));
28
+ }
29
+ }
30
+
31
+ var css_248z = ".Chip-module_chip_outlined__4LIzy{background-color:#fff;border:1px solid grey;border-radius:1rem}.Chip-module_chip_default__HKulX,.Chip-module_chip_outlined__4LIzy{align-items:center;color:#000;display:flex;font-size:.875rem;font-weight:500;justify-content:center;margin:auto;padding:.5rem .75rem}.Chip-module_chip_default__HKulX{background-color:#f1f1f1;border:none;border-radius:1rem}.Chip-module_chip_default_clickable__xoa6n:hover{background-color:#e9e9e9;cursor:pointer}.Chip-module_chip_outlined_clickable__JzWxJ:hover{background-color:#f1f1f1;cursor:pointer}.Chip-module_chip_text__jq7CH{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
32
+ var styles = {"chip_outlined":"Chip-module_chip_outlined__4LIzy","chip_default":"Chip-module_chip_default__HKulX","chip_default_clickable":"Chip-module_chip_default_clickable__xoa6n","chip_outlined_clickable":"Chip-module_chip_outlined_clickable__JzWxJ","chip_text":"Chip-module_chip_text__jq7CH"};
33
+ styleInject(css_248z);
34
+
35
+ const VariantDefaultMap = {
36
+ default: styles.chip_default,
37
+ outlined: styles.chip_outlined
38
+ };
39
+ const VariantClickableMap = {
40
+ default: styles.chip_default_clickable,
41
+ outlined: styles.chip_outlined_clickable
5
42
  };
43
+ function Chip({ label, onClick, style, className, variant = 'default' }) {
44
+ return (jsx("button", { className: clsx(VariantDefaultMap[variant], {
45
+ [VariantClickableMap[variant]]: onClick
46
+ }, className), onClick: onClick, type: 'button', style: style, children: jsx("span", { className: styles.chip_text, children: label }) }));
47
+ }
6
48
 
7
- export { MyComponent };
49
+ export { Chip };
package/dist/index.js CHANGED
@@ -1,9 +1,51 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var clsx = require('clsx');
4
5
 
5
- const MyComponent = ({ message }) => {
6
- return (React.createElement("div", { style: { backgroundColor: 'black', color: 'white' } }, message));
6
+ function styleInject(css, ref) {
7
+ if ( ref === undefined ) ref = {};
8
+ var insertAt = ref.insertAt;
9
+
10
+ if (typeof document === 'undefined') { return; }
11
+
12
+ var head = document.head || document.getElementsByTagName('head')[0];
13
+ var style = document.createElement('style');
14
+ style.type = 'text/css';
15
+
16
+ if (insertAt === 'top') {
17
+ if (head.firstChild) {
18
+ head.insertBefore(style, head.firstChild);
19
+ } else {
20
+ head.appendChild(style);
21
+ }
22
+ } else {
23
+ head.appendChild(style);
24
+ }
25
+
26
+ if (style.styleSheet) {
27
+ style.styleSheet.cssText = css;
28
+ } else {
29
+ style.appendChild(document.createTextNode(css));
30
+ }
31
+ }
32
+
33
+ var css_248z = ".Chip-module_chip_outlined__4LIzy{background-color:#fff;border:1px solid grey;border-radius:1rem}.Chip-module_chip_default__HKulX,.Chip-module_chip_outlined__4LIzy{align-items:center;color:#000;display:flex;font-size:.875rem;font-weight:500;justify-content:center;margin:auto;padding:.5rem .75rem}.Chip-module_chip_default__HKulX{background-color:#f1f1f1;border:none;border-radius:1rem}.Chip-module_chip_default_clickable__xoa6n:hover{background-color:#e9e9e9;cursor:pointer}.Chip-module_chip_outlined_clickable__JzWxJ:hover{background-color:#f1f1f1;cursor:pointer}.Chip-module_chip_text__jq7CH{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
34
+ var styles = {"chip_outlined":"Chip-module_chip_outlined__4LIzy","chip_default":"Chip-module_chip_default__HKulX","chip_default_clickable":"Chip-module_chip_default_clickable__xoa6n","chip_outlined_clickable":"Chip-module_chip_outlined_clickable__JzWxJ","chip_text":"Chip-module_chip_text__jq7CH"};
35
+ styleInject(css_248z);
36
+
37
+ const VariantDefaultMap = {
38
+ default: styles.chip_default,
39
+ outlined: styles.chip_outlined
40
+ };
41
+ const VariantClickableMap = {
42
+ default: styles.chip_default_clickable,
43
+ outlined: styles.chip_outlined_clickable
7
44
  };
45
+ function Chip({ label, onClick, style, className, variant = 'default' }) {
46
+ return (jsxRuntime.jsx("button", { className: clsx(VariantDefaultMap[variant], {
47
+ [VariantClickableMap[variant]]: onClick
48
+ }, className), onClick: onClick, type: 'button', style: style, children: jsxRuntime.jsx("span", { className: styles.chip_text, children: label }) }));
49
+ }
8
50
 
9
- exports.MyComponent = MyComponent;
51
+ exports.Chip = Chip;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ export type Variant = 'default' | 'outlined';
3
+ export type ChipProps = {
4
+ label: string;
5
+ onClick?: () => void;
6
+ style?: React.CSSProperties;
7
+ className?: string;
8
+ variant?: Variant;
9
+ };
10
+ declare function Chip({ label, onClick, style, className, variant }: Readonly<ChipProps>): import("react/jsx-runtime").JSX.Element;
11
+ export default Chip;
@@ -1,2 +1,2 @@
1
- export { default as MyComponent } from './MyComponent';
2
- export type { MyComponentProps } from './MyComponent';
1
+ export { default as Chip } from './Chip';
2
+ export type { ChipProps } from './Chip';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frey-ui",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- export interface MyComponentProps {
3
- message: string;
4
- }
5
- declare const MyComponent: React.FC<MyComponentProps>;
6
- export default MyComponent;