@sunggang/ui-lib 0.1.16 → 0.1.18

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%;
@@ -735,6 +744,9 @@ video {
735
744
  .h-56 {
736
745
  height: 14rem;
737
746
  }
747
+ .h-6 {
748
+ height: 1.5rem;
749
+ }
738
750
  .h-7 {
739
751
  height: 1.75rem;
740
752
  }
@@ -762,6 +774,9 @@ video {
762
774
  .w-4 {
763
775
  width: 1rem;
764
776
  }
777
+ .w-6 {
778
+ width: 1.5rem;
779
+ }
765
780
  .w-64 {
766
781
  width: 16rem;
767
782
  }
@@ -786,6 +801,10 @@ video {
786
801
  .w-auto {
787
802
  width: auto;
788
803
  }
804
+ .w-fit {
805
+ width: -moz-fit-content;
806
+ width: fit-content;
807
+ }
789
808
  .w-full {
790
809
  width: 100%;
791
810
  }
@@ -831,6 +850,9 @@ video {
831
850
  .flex-col {
832
851
  flex-direction: column;
833
852
  }
853
+ .items-end {
854
+ align-items: flex-end;
855
+ }
834
856
  .items-center {
835
857
  align-items: center;
836
858
  }
@@ -1158,6 +1180,10 @@ video {
1158
1180
  --tw-text-opacity: 1;
1159
1181
  color: rgb(0 0 0 / var(--tw-text-opacity));
1160
1182
  }
1183
+ .text-\[\#000\] {
1184
+ --tw-text-opacity: 1;
1185
+ color: rgb(0 0 0 / var(--tw-text-opacity));
1186
+ }
1161
1187
  .text-\[\#171A1F\] {
1162
1188
  --tw-text-opacity: 1;
1163
1189
  color: rgb(23 26 31 / var(--tw-text-opacity));
package/index.esm2.js CHANGED
@@ -4,7 +4,7 @@ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
4
4
  import * as SwitchPrimitives from '@radix-ui/react-switch';
5
5
  import { clsx } from 'clsx';
6
6
  import { twMerge } from 'tailwind-merge';
7
- import { addDays, format } from 'date-fns';
7
+ import { format } from 'date-fns';
8
8
  import { Calendar as Calendar$1 } from 'lucide-react';
9
9
  import { Slot } from '@radix-ui/react-slot';
10
10
  import { cva } from 'class-variance-authority';
@@ -6261,7 +6261,7 @@ function _unsupported_iterable_to_array$1(o, minLen) {
6261
6261
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
6262
6262
  }
6263
6263
  var CustomUpload = function(param) {
6264
- var className = param.className, children = param.children, file = param.file, setFile = param.setFile, imageUrl = param.imageUrl;
6264
+ var className = param.className, children = param.children, file = param.file, setFile = param.setFile, imageUrl = param.imageUrl, setImageUrl = param.setImageUrl;
6265
6265
  var imageMimeType = /image\/(png|jpg|jpeg)/i;
6266
6266
  var DEFAULT_IMAGE_SIZE_LIMIT_IN_BYTES = 5120000; // 5000 KB
6267
6267
  var _useState = _sliced_to_array$1(useState(null), 2), modal = _useState[0], setModal = _useState[1];
@@ -6270,6 +6270,10 @@ var CustomUpload = function(param) {
6270
6270
  var _hiddenFileInput_current;
6271
6271
  (_hiddenFileInput_current = hiddenFileInput.current) === null || _hiddenFileInput_current === void 0 ? void 0 : _hiddenFileInput_current.click();
6272
6272
  };
6273
+ var handleRemove = function() {
6274
+ setFile(null);
6275
+ setImageUrl(null);
6276
+ };
6273
6277
  var handleImageChange = function(event) {
6274
6278
  var _event_target_files, _currentFile_type;
6275
6279
  var currentFile = (_event_target_files = event.target.files) === null || _event_target_files === void 0 ? void 0 : _event_target_files[0];
@@ -6304,27 +6308,44 @@ var CustomUpload = function(param) {
6304
6308
  }
6305
6309
  setFile(currentFile);
6306
6310
  };
6307
- return /*#__PURE__*/ jsxs(Fragment$1, {
6311
+ return /*#__PURE__*/ jsxs("div", {
6312
+ className: [
6313
+ "w-fit",
6314
+ className
6315
+ ].join(" "),
6308
6316
  children: [
6309
- /*#__PURE__*/ jsxs("button", {
6310
- className: className ? [
6311
- className
6312
- ].join(" ") : "",
6317
+ /*#__PURE__*/ jsx("div", {
6318
+ className: "mb-2",
6319
+ children: /*#__PURE__*/ jsxs("button", {
6320
+ type: "button",
6321
+ onClick: handleImageClick,
6322
+ children: [
6323
+ children || /*#__PURE__*/ jsx(BaseTemplate, {
6324
+ file: file,
6325
+ imageUrl: imageUrl
6326
+ }),
6327
+ /*#__PURE__*/ jsx("input", {
6328
+ type: "file",
6329
+ ref: hiddenFileInput,
6330
+ accept: ".png, .jpg, .jpeg",
6331
+ onChange: handleImageChange,
6332
+ className: "hidden"
6333
+ })
6334
+ ]
6335
+ })
6336
+ }),
6337
+ /*#__PURE__*/ jsx("button", {
6313
6338
  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
- ]
6339
+ className: [
6340
+ "w-6 h-6 text-[#000]",
6341
+ file || imageUrl ? "visible" : "invisible"
6342
+ ].join(" "),
6343
+ onClick: handleRemove,
6344
+ children: /*#__PURE__*/ jsx(Icon, {
6345
+ icon: "mingcute:delete-2-line",
6346
+ width: "100%",
6347
+ height: "100%"
6348
+ })
6328
6349
  }),
6329
6350
  modal && /*#__PURE__*/ jsx(Modal, {
6330
6351
  modal: modal,
@@ -6810,10 +6831,10 @@ function _unsupported_iterable_to_array(o, minLen) {
6810
6831
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
6811
6832
  }
6812
6833
  function DateRangePicker(param) {
6813
- var className = param.className, disable = param.disable, onChange = param.onChange;
6834
+ var className = param.className, disable = param.disable, onChange = param.onChange, dates = param.dates;
6814
6835
  var _useState = _sliced_to_array(useState({
6815
- from: new Date(2024, 0, 20),
6816
- to: addDays(new Date(2024, 0, 20), 20)
6836
+ from: (dates === null || dates === void 0 ? void 0 : dates.from) || undefined,
6837
+ to: (dates === null || dates === void 0 ? void 0 : dates.to) || undefined
6817
6838
  }), 2), date = _useState[0], setDate = _useState[1];
6818
6839
  var handleDateChange = function(newDate) {
6819
6840
  if (newDate) {
@@ -6843,7 +6864,7 @@ function DateRangePicker(param) {
6843
6864
  format(date.to, "yyyy-MM-dd")
6844
6865
  ]
6845
6866
  }) : format(date.from, "yyyy-MM-dd") : /*#__PURE__*/ jsx("span", {
6846
- children: "Pick a date"
6867
+ children: "請選擇日期"
6847
6868
  })
6848
6869
  ]
6849
6870
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunggang/ui-lib",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
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,10 +1,15 @@
1
1
  import { DateRange } from 'react-day-picker';
2
+ interface DateRangeType {
3
+ from: Date | undefined;
4
+ to: Date | undefined;
5
+ }
2
6
  interface DateRangePickerProps {
3
7
  className?: string;
4
8
  disable?: boolean;
5
9
  onChange?: (date: DateRange) => void;
10
+ dates?: DateRangeType;
6
11
  }
7
- declare function DateRangePicker({ className, disable, onChange, }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
12
+ declare function DateRangePicker({ className, disable, onChange, dates, }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
8
13
  declare namespace DateRangePicker {
9
14
  var displayName: string;
10
15
  }
@@ -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;