@sunggang/ui-lib 0.1.17 → 0.1.19

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/index.esm.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- ! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com
2
+ ! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com
3
3
  *//*
4
4
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
5
5
  2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
@@ -179,6 +179,7 @@ textarea {
179
179
  font-size: 100%; /* 1 */
180
180
  font-weight: inherit; /* 1 */
181
181
  line-height: inherit; /* 1 */
182
+ letter-spacing: inherit; /* 1 */
182
183
  color: inherit; /* 1 */
183
184
  margin: 0; /* 2 */
184
185
  padding: 0; /* 3 */
@@ -199,9 +200,9 @@ select {
199
200
  */
200
201
 
201
202
  button,
202
- [type='button'],
203
- [type='reset'],
204
- [type='submit'] {
203
+ input:where([type='button']),
204
+ input:where([type='reset']),
205
+ input:where([type='submit']) {
205
206
  -webkit-appearance: button; /* 1 */
206
207
  background-color: transparent; /* 2 */
207
208
  background-image: none; /* 2 */
@@ -514,6 +515,10 @@ video {
514
515
  --tw-backdrop-opacity: ;
515
516
  --tw-backdrop-saturate: ;
516
517
  --tw-backdrop-sepia: ;
518
+ --tw-contain-size: ;
519
+ --tw-contain-layout: ;
520
+ --tw-contain-paint: ;
521
+ --tw-contain-style: ;
517
522
  }
518
523
 
519
524
  ::backdrop {
@@ -564,6 +569,10 @@ video {
564
569
  --tw-backdrop-opacity: ;
565
570
  --tw-backdrop-saturate: ;
566
571
  --tw-backdrop-sepia: ;
572
+ --tw-contain-size: ;
573
+ --tw-contain-layout: ;
574
+ --tw-contain-paint: ;
575
+ --tw-contain-style: ;
567
576
  }
568
577
  .container {
569
578
  width: 100%;
@@ -625,6 +634,9 @@ video {
625
634
  .relative {
626
635
  position: relative;
627
636
  }
637
+ .bottom-0 {
638
+ bottom: 0px;
639
+ }
628
640
  .left-0 {
629
641
  left: 0px;
630
642
  }
@@ -735,6 +747,9 @@ video {
735
747
  .h-56 {
736
748
  height: 14rem;
737
749
  }
750
+ .h-6 {
751
+ height: 1.5rem;
752
+ }
738
753
  .h-7 {
739
754
  height: 1.75rem;
740
755
  }
@@ -762,6 +777,9 @@ video {
762
777
  .w-4 {
763
778
  width: 1rem;
764
779
  }
780
+ .w-6 {
781
+ width: 1.5rem;
782
+ }
765
783
  .w-64 {
766
784
  width: 16rem;
767
785
  }
@@ -786,6 +804,10 @@ video {
786
804
  .w-auto {
787
805
  width: auto;
788
806
  }
807
+ .w-fit {
808
+ width: -moz-fit-content;
809
+ width: fit-content;
810
+ }
789
811
  .w-full {
790
812
  width: 100%;
791
813
  }
@@ -831,6 +853,9 @@ video {
831
853
  .flex-col {
832
854
  flex-direction: column;
833
855
  }
856
+ .items-end {
857
+ align-items: flex-end;
858
+ }
834
859
  .items-center {
835
860
  align-items: center;
836
861
  }
@@ -1017,6 +1042,9 @@ video {
1017
1042
  .p-0 {
1018
1043
  padding: 0px;
1019
1044
  }
1045
+ .p-1 {
1046
+ padding: 0.25rem;
1047
+ }
1020
1048
  .p-2 {
1021
1049
  padding: 0.5rem;
1022
1050
  }
@@ -1158,6 +1186,10 @@ video {
1158
1186
  --tw-text-opacity: 1;
1159
1187
  color: rgb(0 0 0 / var(--tw-text-opacity));
1160
1188
  }
1189
+ .text-\[\#000\] {
1190
+ --tw-text-opacity: 1;
1191
+ color: rgb(0 0 0 / var(--tw-text-opacity));
1192
+ }
1161
1193
  .text-\[\#171A1F\] {
1162
1194
  --tw-text-opacity: 1;
1163
1195
  color: rgb(23 26 31 / var(--tw-text-opacity));
package/index.esm2.js CHANGED
@@ -5824,6 +5824,9 @@ function _array_like_to_array$3(arr, len) {
5824
5824
  function _array_with_holes$3(arr) {
5825
5825
  if (Array.isArray(arr)) return arr;
5826
5826
  }
5827
+ function _array_without_holes(arr) {
5828
+ if (Array.isArray(arr)) return _array_like_to_array$3(arr);
5829
+ }
5827
5830
  function _define_property$4(obj, key, value) {
5828
5831
  if (key in obj) {
5829
5832
  Object.defineProperty(obj, key, {
@@ -5837,6 +5840,9 @@ function _define_property$4(obj, key, value) {
5837
5840
  }
5838
5841
  return obj;
5839
5842
  }
5843
+ function _iterable_to_array(iter) {
5844
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
5845
+ }
5840
5846
  function _iterable_to_array_limit$3(arr, i) {
5841
5847
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
5842
5848
  if (_i == null) return;
@@ -5864,6 +5870,9 @@ function _iterable_to_array_limit$3(arr, i) {
5864
5870
  function _non_iterable_rest$3() {
5865
5871
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5866
5872
  }
5873
+ function _non_iterable_spread() {
5874
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5875
+ }
5867
5876
  function _object_spread$4(target) {
5868
5877
  for(var i = 1; i < arguments.length; i++){
5869
5878
  var source = arguments[i] != null ? arguments[i] : {};
@@ -5906,6 +5915,9 @@ function _object_spread_props$2(target, source) {
5906
5915
  function _sliced_to_array$3(arr, i) {
5907
5916
  return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
5908
5917
  }
5918
+ function _to_consumable_array(arr) {
5919
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$3(arr) || _non_iterable_spread();
5920
+ }
5909
5921
  function _unsupported_iterable_to_array$3(o, minLen) {
5910
5922
  if (!o) return;
5911
5923
  if (typeof o === "string") return _array_like_to_array$3(o, minLen);
@@ -5915,7 +5927,7 @@ function _unsupported_iterable_to_array$3(o, minLen) {
5915
5927
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
5916
5928
  }
5917
5929
  var DropImage = function(param) {
5918
- var _param_preview = param.preview, preview = _param_preview === void 0 ? true : _param_preview, setFiles = param.setFiles, imageUrls = param.imageUrls;
5930
+ var _param_preview = param.preview, preview = _param_preview === void 0 ? true : _param_preview, setFiles = param.setFiles, imageUrls = param.imageUrls, setImageUrls = param.setImageUrls;
5919
5931
  var _useState = _sliced_to_array$3(useState([]), 2), previewFiles = _useState[0], setPreviewFiles = _useState[1];
5920
5932
  var _useDropzone = useDropzone({
5921
5933
  accept: {
@@ -5942,6 +5954,16 @@ var DropImage = function(param) {
5942
5954
  });
5943
5955
  }
5944
5956
  }), getRootProps = _useDropzone.getRootProps, getInputProps = _useDropzone.getInputProps; _useDropzone.isDragActive; _useDropzone.isDragAccept; _useDropzone.isDragReject;
5957
+ var removePreviewFile = function(file) {
5958
+ var currentItem = previewFiles === null || previewFiles === void 0 ? void 0 : previewFiles.indexOf(file);
5959
+ previewFiles.splice(currentItem, 1);
5960
+ setPreviewFiles(_to_consumable_array(previewFiles));
5961
+ };
5962
+ var removeImageUrls = function(item) {
5963
+ var currentItem = imageUrls === null || imageUrls === void 0 ? void 0 : imageUrls.indexOf(item);
5964
+ imageUrls.splice(currentItem, 1);
5965
+ setImageUrls(_to_consumable_array(imageUrls));
5966
+ };
5945
5967
  return /*#__PURE__*/ jsxs("section", {
5946
5968
  className: "w-full",
5947
5969
  children: [
@@ -5987,20 +6009,48 @@ var DropImage = function(param) {
5987
6009
  preview && /*#__PURE__*/ jsx("div", {
5988
6010
  className: "flex pt-2 gap-2",
5989
6011
  children: (previewFiles === null || previewFiles === void 0 ? void 0 : previewFiles.length) ? previewFiles.length > 0 ? previewFiles.map(function(item) {
5990
- return /*#__PURE__*/ jsx("div", {
5991
- children: /*#__PURE__*/ jsx("img", {
5992
- className: "w-24 h-24 object-cover",
5993
- src: item === null || item === void 0 ? void 0 : item.preview,
5994
- alt: ""
5995
- })
6012
+ return /*#__PURE__*/ jsxs("div", {
6013
+ className: "relative",
6014
+ children: [
6015
+ /*#__PURE__*/ jsx("button", {
6016
+ className: "absolute bottom-0 right-0 bg-white rounded-full p-1 shadow-md",
6017
+ onClick: function() {
6018
+ return removePreviewFile(item);
6019
+ },
6020
+ children: /*#__PURE__*/ jsx(Icon, {
6021
+ icon: "mingcute:delete-2-line",
6022
+ width: "1.5rem",
6023
+ height: "1.5rem"
6024
+ })
6025
+ }),
6026
+ /*#__PURE__*/ jsx("img", {
6027
+ className: "w-24 h-24 object-cover",
6028
+ src: item === null || item === void 0 ? void 0 : item.preview,
6029
+ alt: ""
6030
+ })
6031
+ ]
5996
6032
  }, item === null || item === void 0 ? void 0 : item.uuid);
5997
6033
  }) : null : imageUrls && imageUrls.length ? imageUrls.map(function(item) {
5998
- return /*#__PURE__*/ jsx("div", {
5999
- children: /*#__PURE__*/ jsx("img", {
6000
- className: "w-24 h-24 object-cover",
6001
- src: item === null || item === void 0 ? void 0 : item.url,
6002
- alt: ""
6003
- })
6034
+ return /*#__PURE__*/ jsxs("div", {
6035
+ className: "relative",
6036
+ children: [
6037
+ /*#__PURE__*/ jsx("button", {
6038
+ className: "absolute bottom-0 right-0 bg-white rounded-full p-1 shadow-md",
6039
+ onClick: function() {
6040
+ return removeImageUrls(item);
6041
+ },
6042
+ children: /*#__PURE__*/ jsx(Icon, {
6043
+ icon: "mingcute:delete-2-line",
6044
+ width: "1.5rem",
6045
+ height: "1.5rem"
6046
+ })
6047
+ }),
6048
+ /*#__PURE__*/ jsx("img", {
6049
+ className: "w-24 h-24 object-cover",
6050
+ src: item === null || item === void 0 ? void 0 : item.url,
6051
+ alt: ""
6052
+ })
6053
+ ]
6004
6054
  }, item === null || item === void 0 ? void 0 : item.url);
6005
6055
  }) : null
6006
6056
  })
@@ -6261,7 +6311,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
6261
6311
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
6262
6312
  }
6263
6313
  var CustomUpload = function(param) {
6264
- var className = param.className, children = param.children, file = param.file, setFile = param.setFile, imageUrl = param.imageUrl;
6314
+ var className = param.className, children = param.children, file = param.file, setFile = param.setFile, imageUrl = param.imageUrl, setImageUrl = param.setImageUrl;
6265
6315
  var imageMimeType = /image\/(png|jpg|jpeg)/i;
6266
6316
  var DEFAULT_IMAGE_SIZE_LIMIT_IN_BYTES = 5120000; // 5000 KB
6267
6317
  var _useState = _sliced_to_array$1(useState(null), 2), modal = _useState[0], setModal = _useState[1];
@@ -6270,6 +6320,10 @@ var CustomUpload = function(param) {
6270
6320
  var _hiddenFileInput_current;
6271
6321
  (_hiddenFileInput_current = hiddenFileInput.current) === null || _hiddenFileInput_current === void 0 ? void 0 : _hiddenFileInput_current.click();
6272
6322
  };
6323
+ var handleRemove = function() {
6324
+ setFile(null);
6325
+ setImageUrl(null);
6326
+ };
6273
6327
  var handleImageChange = function(event) {
6274
6328
  var _event_target_files, _currentFile_type;
6275
6329
  var currentFile = (_event_target_files = event.target.files) === null || _event_target_files === void 0 ? void 0 : _event_target_files[0];
@@ -6304,27 +6358,44 @@ var CustomUpload = function(param) {
6304
6358
  }
6305
6359
  setFile(currentFile);
6306
6360
  };
6307
- return /*#__PURE__*/ jsxs(Fragment$1, {
6361
+ return /*#__PURE__*/ jsxs("div", {
6362
+ className: [
6363
+ "w-fit",
6364
+ className
6365
+ ].join(" "),
6308
6366
  children: [
6309
- /*#__PURE__*/ jsxs("button", {
6310
- className: className ? [
6311
- className
6312
- ].join(" ") : "",
6367
+ /*#__PURE__*/ jsx("div", {
6368
+ className: "mb-2",
6369
+ children: /*#__PURE__*/ jsxs("button", {
6370
+ type: "button",
6371
+ onClick: handleImageClick,
6372
+ children: [
6373
+ children || /*#__PURE__*/ jsx(BaseTemplate, {
6374
+ file: file,
6375
+ imageUrl: imageUrl
6376
+ }),
6377
+ /*#__PURE__*/ jsx("input", {
6378
+ type: "file",
6379
+ ref: hiddenFileInput,
6380
+ accept: ".png, .jpg, .jpeg",
6381
+ onChange: handleImageChange,
6382
+ className: "hidden"
6383
+ })
6384
+ ]
6385
+ })
6386
+ }),
6387
+ /*#__PURE__*/ jsx("button", {
6313
6388
  type: "button",
6314
- onClick: handleImageClick,
6315
- children: [
6316
- children || /*#__PURE__*/ jsx(BaseTemplate, {
6317
- file: file,
6318
- imageUrl: imageUrl
6319
- }),
6320
- /*#__PURE__*/ jsx("input", {
6321
- type: "file",
6322
- ref: hiddenFileInput,
6323
- accept: ".png, .jpg, .jpeg",
6324
- onChange: handleImageChange,
6325
- className: "hidden"
6326
- })
6327
- ]
6389
+ className: [
6390
+ "w-6 h-6 text-[#000]",
6391
+ file || imageUrl ? "visible" : "invisible"
6392
+ ].join(" "),
6393
+ onClick: handleRemove,
6394
+ children: /*#__PURE__*/ jsx(Icon, {
6395
+ icon: "mingcute:delete-2-line",
6396
+ width: "100%",
6397
+ height: "100%"
6398
+ })
6328
6399
  }),
6329
6400
  modal && /*#__PURE__*/ jsx(Modal, {
6330
6401
  modal: modal,
@@ -6811,7 +6882,6 @@ function _unsupported_iterable_to_array(o, minLen) {
6811
6882
  }
6812
6883
  function DateRangePicker(param) {
6813
6884
  var className = param.className, disable = param.disable, onChange = param.onChange, dates = param.dates;
6814
- console.log(dates);
6815
6885
  var _useState = _sliced_to_array(useState({
6816
6886
  from: (dates === null || dates === void 0 ? void 0 : dates.from) || undefined,
6817
6887
  to: (dates === null || dates === void 0 ? void 0 : dates.to) || undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunggang/ui-lib",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "dependencies": {
5
5
  "@radix-ui/react-popover": "^1.0.7",
6
6
  "@radix-ui/react-slot": "^1.0.2",
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import { type VariantProps } from "class-variance-authority";
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
3
  declare const buttonVariants: (props?: ({
4
4
  variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" | null | undefined;
5
5
  size?: "default" | "sm" | "lg" | "icon" | null | undefined;
@@ -1,14 +1,9 @@
1
1
  import React from 'react';
2
- interface ImageItem {
3
- map?: any;
4
- length?: ImageItem | undefined;
5
- url: string;
6
- book_items_category_id: string | null;
7
- }
8
2
  interface DropImageProps {
9
3
  preview?: boolean;
10
- imageUrls?: ImageItem[];
4
+ imageUrls?: any;
11
5
  setFiles: React.Dispatch<React.SetStateAction<File[]>>;
6
+ setImageUrls?: any;
12
7
  }
13
8
  export declare const DropImage: React.FC<DropImageProps>;
14
9
  export {};
@@ -1,7 +1,7 @@
1
1
  import { FC } from 'react';
2
2
  interface BaseTemplateProps {
3
3
  file?: File | null;
4
- imageUrl?: string;
4
+ imageUrl?: any;
5
5
  }
6
6
  declare const BaseTemplate: FC<BaseTemplateProps>;
7
7
  export default BaseTemplate;
@@ -4,7 +4,8 @@ interface CustomUploadProps {
4
4
  children?: React.ReactNode;
5
5
  file?: File | null;
6
6
  setFile?: any;
7
- imageUrl?: string;
7
+ imageUrl?: any;
8
+ setImageUrl?: any;
8
9
  }
9
10
  export declare const CustomUpload: React.FC<CustomUploadProps>;
10
11
  export default CustomUpload;