frey-ui 1.0.5 → 1.0.6

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.
@@ -0,0 +1,49 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+
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__oJKLC{background-color:#fff;border:1px solid grey;border-radius:1rem}.chip-module_chip_default__JyfE6,.chip-module_chip_outlined__oJKLC{align-items:center;color:#000;cursor:default;display:flex;font-size:.875rem;font-weight:500;justify-content:center;margin:auto;padding:.5rem .75rem;transition:background-color .3s}.chip-module_chip_default__JyfE6{background-color:#f1f1f1;border:none;border-radius:1rem}.chip-module_chip_default_clickable__yYH4s:hover{background-color:#e9e9e9;cursor:pointer}.chip-module_chip_outlined_clickable__zn7-w:hover{background-color:#f1f1f1;cursor:pointer}.chip-module_chip_text__F3fEt{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
32
+ var styles = {"chip_outlined":"chip-module_chip_outlined__oJKLC","chip_default":"chip-module_chip_default__JyfE6","chip_default_clickable":"chip-module_chip_default_clickable__yYH4s","chip_outlined_clickable":"chip-module_chip_outlined_clickable__zn7-w","chip_text":"chip-module_chip_text__F3fEt"};
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
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
+ }
48
+
49
+ export { Chip };
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var clsx = require('clsx');
5
+
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__oJKLC{background-color:#fff;border:1px solid grey;border-radius:1rem}.chip-module_chip_default__JyfE6,.chip-module_chip_outlined__oJKLC{align-items:center;color:#000;cursor:default;display:flex;font-size:.875rem;font-weight:500;justify-content:center;margin:auto;padding:.5rem .75rem;transition:background-color .3s}.chip-module_chip_default__JyfE6{background-color:#f1f1f1;border:none;border-radius:1rem}.chip-module_chip_default_clickable__yYH4s:hover{background-color:#e9e9e9;cursor:pointer}.chip-module_chip_outlined_clickable__zn7-w:hover{background-color:#f1f1f1;cursor:pointer}.chip-module_chip_text__F3fEt{display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}";
34
+ var styles = {"chip_outlined":"chip-module_chip_outlined__oJKLC","chip_default":"chip-module_chip_default__JyfE6","chip_default_clickable":"chip-module_chip_default_clickable__yYH4s","chip_outlined_clickable":"chip-module_chip_outlined_clickable__zn7-w","chip_text":"chip-module_chip_text__F3fEt"};
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
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
+ }
50
+
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;
@@ -0,0 +1,2 @@
1
+ export { default as Chip } from './Chip';
2
+ export type { ChipProps, Variant } from './Chip';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frey-ui",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -39,6 +39,7 @@
39
39
  "typescript-plugin-css-modules": "^5.1.0"
40
40
  },
41
41
  "scripts": {
42
- "build": "rollup -c"
42
+ "build": "rollup -c",
43
+ "pub": "pnpm run build && pnpm publish"
43
44
  }
44
45
  }