@1d1s/design-system 1.4.0 → 1.4.1

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,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { DateRange } from 'react-day-picker';
3
+ import { Calendar as CalendarView } from '../Calendar';
3
4
  interface BasePickerProps {
4
5
  className?: string;
5
6
  placeholder?: string;
@@ -13,7 +14,18 @@ interface BasePickerProps {
13
14
  mobileSheet?: boolean;
14
15
  /** 바텀시트 상단 제목 (모바일에서만 표시). 기본값은 placeholder. */
15
16
  sheetTitle?: string;
17
+ /**
18
+ * 내부 Calendar(react-day-picker)로 그대로 전달되는 옵션.
19
+ * 비활성 날짜(`disabled` 매처), 선택 가능 범위(`fromDate`/`toDate`),
20
+ * 초기 표시 월(`defaultMonth`) 등을 지정할 수 있다.
21
+ * `mode`/`selected`/`onSelect`는 내부에서 제어하므로 무시된다.
22
+ *
23
+ * @example calendarProps={{ disabled: { before: new Date() } }}
24
+ */
25
+ calendarProps?: CalendarPassthroughProps;
16
26
  }
27
+ /** DatePicker가 내부 Calendar로 넘기는 옵션 (제어 prop 제외) */
28
+ export type CalendarPassthroughProps = Omit<React.ComponentProps<typeof CalendarView>, "mode" | "selected" | "onSelect" | "className">;
17
29
  export interface DatePickerProps extends BasePickerProps {
18
30
  value: Date | undefined;
19
31
  onChange(date: Date | undefined): void;
@@ -26,10 +38,10 @@ export interface RangeDatePickerProps extends BasePickerProps {
26
38
  * DatePicker
27
39
  * 단일 날짜를 선택하는 시안형 Date Picker 컴포넌트.
28
40
  */
29
- export declare function DatePicker({ value, onChange, className, placeholder, disabled, disableClickPropagation, mobileSheet, sheetTitle, }: DatePickerProps): React.ReactElement;
41
+ export declare function DatePicker({ value, onChange, className, placeholder, disabled, disableClickPropagation, mobileSheet, sheetTitle, calendarProps, }: DatePickerProps): React.ReactElement;
30
42
  /**
31
43
  * RangeDatePicker
32
44
  * 시작일/종료일 범위를 선택하는 시안형 Date Range Picker 컴포넌트.
33
45
  */
34
- export declare function RangeDatePicker({ value, onChange, className, placeholder, disabled, disableClickPropagation, mobileSheet, sheetTitle, }: RangeDatePickerProps): React.ReactElement;
46
+ export declare function RangeDatePicker({ value, onChange, className, placeholder, disabled, disableClickPropagation, mobileSheet, sheetTitle, calendarProps, }: RangeDatePickerProps): React.ReactElement;
35
47
  export {};
package/dist/index.es.js CHANGED
@@ -169,19 +169,19 @@ return e("li",{children:/* @__PURE__ */n("div",{className:pn("flex items-start g
169
169
  /* @__PURE__ */e("button",{type:"button",className:pn("rounded-2 bg-brand px-2.5 py-1.5 text-white transition-colors hover:bg-main-700",!l.trim()&&"cursor-not-allowed bg-main-400 hover:bg-main-400"),onClick(){return h(t)},disabled:!l.trim(),children:/* @__PURE__ */e(On,{size:"caption2",weight:"bold",children:c})})]})}),A&&!k||C?/* @__PURE__ */n("div",{className:"mt-1.5 flex items-center gap-1",children:[A&&!k?/* @__PURE__ */e("button",{type:"button",className:"inline-flex rounded-2 px-1.5 py-0.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700",onClick(){return p(t)},children:/* @__PURE__ */e(On,{size:"caption2",weight:"medium",children:u})}):null,C?/* @__PURE__ */e("button",{type:"button",className:"inline-flex rounded-2 px-1.5 py-0.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700",onClick(){return b?.(t)},disabled:t.isLoadingReplies,children:/* @__PURE__ */e(On,{size:"caption2",weight:"medium",children:t.isLoadingReplies?"불러오는 중...":`${f}${"number"==typeof t.remainingReplyCount?` (${t.remainingReplyCount})`:""}`})}):null]}):null]})]})})}function lu({comments:t,currentUserId:n,className:r,replyPlaceholder:o="댓글을 입력하세요.",replySubmitLabel:a="등록",replyCancelLabel:i="취소",replyButtonLabel:l="답글 달기",loadMoreRepliesLabel:s="대댓글 더보기",onReplySubmit:c,onLoadMoreReplies:d,onDelete:u,onReport:f}){const[p,m]=k.useState(null),[h,g]=k.useState(""),b=e=>{m(e.id),g("")},v=()=>{m(null),g("")},y=e=>{const t=h.trim();t&&(c?.(e,t),g(""),m(null))};return t.length?/* @__PURE__ */e("ul",{className:pn("flex flex-col",r),children:t.map((r,c)=>/* @__PURE__ */e(iu,{comment:r,depth:0,isLast:c===t.length-1,currentUserId:n,activeReplyTargetId:p,draftReplyContent:h,replyPlaceholder:o,replySubmitLabel:a,replyCancelLabel:i,replyButtonLabel:l,loadMoreRepliesLabel:s,onReplyOpen:b,onReplyChange:g,onReplySubmit:y,onReplyCancel:v,onLoadMoreReplies:d,onDelete:u,onReport:f},r.id))}):/* @__PURE__ */e(On,{size:"caption1",weight:"regular",className:pn("block py-2 text-gray-500",r),children:"아직 댓글이 없습니다."})}function su(e){const t=x.useCallback(t=>{if("undefined"==typeof window||!window.matchMedia)return()=>{};const n=window.matchMedia(e);return n.addEventListener("change",t),()=>n.removeEventListener("change",t)},[e]),n=x.useCallback(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia(e).matches,[e]),r=x.useCallback(()=>!1,[]);return x.useSyncExternalStore(t,n,r)}function cu(e=640){return su(`(max-width: ${e}px)`)}ou.displayName="TextArea";const du=pn("z-50 w-auto text-gray-900 outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2"),uu="border-0 p-0 shadow-none",fu=k.forwardRef(({label:t,placeholder:r,className:o,type:a="button",...i},l)=>/* @__PURE__ */n("button",{ref:l,type:a,className:pn("group flex h-10 w-full items-center justify-between gap-3 rounded-3 border border-gray-200 bg-white px-4","outline-none transition-all duration-200","data-[state=open]:border-brand hover:border-gray-400 focus-visible:ring-2 focus-visible:ring-brand/30 focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:border-gray-200 disabled:bg-gray-100 disabled:hover:border-gray-200",o),...i,children:[
170
170
  /* @__PURE__ */e(On,{size:"body2",weight:"medium",className:pn(t?"text-gray-900":"text-gray-500","group-disabled:text-gray-400"),children:t??r}),
171
171
  /* @__PURE__ */e(Fn,{className:"size-4 text-gray-600 group-disabled:text-gray-400",strokeWidth:2.2})]}));function pu(e){return e?{onMouseDownCapture(e){return e.stopPropagation()}}:{}}function mu({children:t}){/* @__PURE__ */
172
- return e(ca,{className:"mb-3 text-center",children:t})}function hu({value:t,onChange:r,className:o,placeholder:a="YYYY/MM/DD",disabled:i=!1,disableClickPropagation:l=!1,mobileSheet:s=!0,sheetTitle:c}){const[d,u]=k.useState(!1),f=cu(),p=s&&f,m=t?fi(t,"yyyy/MM/dd"):void 0,h=/* @__PURE__ */e(ql,{mode:"single",selected:t,onSelect(e){r(e),e&&u(!1)},className:p?uu:void 0,initialFocus:!0});return p?/* @__PURE__ */n(ta,{open:d,onOpenChange:u,children:[
173
- /* @__PURE__ */e(na,{asChild:!0,children:/* @__PURE__ */e(fu,{label:m,placeholder:a,className:o,disabled:i})}),
174
- /* @__PURE__ */n(ia,{showHandle:!1,showClose:!0,children:[
175
- /* @__PURE__ */e(mu,{children:c??a}),
176
- /* @__PURE__ */e("div",{className:"flex justify-center",children:h})]})]}):/* @__PURE__ */n(Kd,{open:d,onOpenChange:u,children:[
177
- /* @__PURE__ */e(Xd,{asChild:!0,children:/* @__PURE__ */e(fu,{label:m,placeholder:a,className:o,disabled:i})}),
178
- /* @__PURE__ */e(Zd,{children:/* @__PURE__ */e(Jd,{className:du,align:"start",sideOffset:8,...pu(l),children:h})})]})}function gu({value:t,onChange:r,className:o,placeholder:a="기간을 선택해주세요",disabled:i=!1,disableClickPropagation:l=!1,mobileSheet:s=!0,sheetTitle:c}){const[d,u]=k.useState(!1),f=cu(),p=s&&f,m=k.useRef(!1),h=t?.from&&t?.to?`${fi(t.from,"yyyy/MM/dd")} - ${fi(t.to,"yyyy/MM/dd")}`:t?.from?`${fi(t.from,"yyyy/MM/dd")} -`:void 0,g=e=>{u(e),m.current=!!e&&Boolean(t?.from&&t?.to)},b=/* @__PURE__ */e(ql,{mode:"range",selected:t,onSelect(e,t){if(m.current&&t)return r({from:t,to:void 0}),void(m.current=!1);r(e),e?.from&&e?.to&&(u(!1),m.current=!1)},className:p?uu:void 0,initialFocus:!0});return p?/* @__PURE__ */n(ta,{open:d,onOpenChange:g,children:[
172
+ return e(ca,{className:"mb-3 text-center",children:t})}function hu({value:t,onChange:r,className:o,placeholder:a="YYYY/MM/DD",disabled:i=!1,disableClickPropagation:l=!1,mobileSheet:s=!0,sheetTitle:c,calendarProps:d}){const[u,f]=k.useState(!1),p=cu(),m=s&&p,h=t?fi(t,"yyyy/MM/dd"):void 0,g=/* @__PURE__ */e(ql,{...d,mode:"single",selected:t,onSelect(e){r(e),e&&f(!1)},className:m?uu:void 0,initialFocus:!0});return m?/* @__PURE__ */n(ta,{open:u,onOpenChange:f,children:[
179
173
  /* @__PURE__ */e(na,{asChild:!0,children:/* @__PURE__ */e(fu,{label:h,placeholder:a,className:o,disabled:i})}),
180
174
  /* @__PURE__ */n(ia,{showHandle:!1,showClose:!0,children:[
181
175
  /* @__PURE__ */e(mu,{children:c??a}),
182
- /* @__PURE__ */e("div",{className:"flex justify-center",children:b})]})]}):/* @__PURE__ */n(Kd,{open:d,onOpenChange:g,children:[
176
+ /* @__PURE__ */e("div",{className:"flex justify-center",children:g})]})]}):/* @__PURE__ */n(Kd,{open:u,onOpenChange:f,children:[
183
177
  /* @__PURE__ */e(Xd,{asChild:!0,children:/* @__PURE__ */e(fu,{label:h,placeholder:a,className:o,disabled:i})}),
184
- /* @__PURE__ */e(Zd,{children:/* @__PURE__ */e(Jd,{className:du,align:"start",sideOffset:8,...pu(l),children:b})})]})}fu.displayName="PickerTrigger";const bu=qo,vu=Qo,yu=Uo,wu=ea;function xu({className:t,...n}){/* @__PURE__ */
178
+ /* @__PURE__ */e(Zd,{children:/* @__PURE__ */e(Jd,{className:du,align:"start",sideOffset:8,...pu(l),children:g})})]})}function gu({value:t,onChange:r,className:o,placeholder:a="기간을 선택해주세요",disabled:i=!1,disableClickPropagation:l=!1,mobileSheet:s=!0,sheetTitle:c,calendarProps:d}){const[u,f]=k.useState(!1),p=cu(),m=s&&p,h=k.useRef(!1),g=t?.from&&t?.to?`${fi(t.from,"yyyy/MM/dd")} - ${fi(t.to,"yyyy/MM/dd")}`:t?.from?`${fi(t.from,"yyyy/MM/dd")} -`:void 0,b=e=>{f(e),h.current=!!e&&Boolean(t?.from&&t?.to)},v=/* @__PURE__ */e(ql,{...d,mode:"range",selected:t,onSelect(e,t){if(h.current&&t)return r({from:t,to:void 0}),void(h.current=!1);r(e),e?.from&&e?.to&&(f(!1),h.current=!1)},className:m?uu:void 0,initialFocus:!0});return m?/* @__PURE__ */n(ta,{open:u,onOpenChange:b,children:[
179
+ /* @__PURE__ */e(na,{asChild:!0,children:/* @__PURE__ */e(fu,{label:g,placeholder:a,className:o,disabled:i})}),
180
+ /* @__PURE__ */n(ia,{showHandle:!1,showClose:!0,children:[
181
+ /* @__PURE__ */e(mu,{children:c??a}),
182
+ /* @__PURE__ */e("div",{className:"flex justify-center",children:v})]})]}):/* @__PURE__ */n(Kd,{open:u,onOpenChange:b,children:[
183
+ /* @__PURE__ */e(Xd,{asChild:!0,children:/* @__PURE__ */e(fu,{label:g,placeholder:a,className:o,disabled:i})}),
184
+ /* @__PURE__ */e(Zd,{children:/* @__PURE__ */e(Jd,{className:du,align:"start",sideOffset:8,...pu(l),children:v})})]})}fu.displayName="PickerTrigger";const bu=qo,vu=Qo,yu=Uo,wu=ea;function xu({className:t,...n}){/* @__PURE__ */
185
185
  return e(Ko,{className:pn("fixed inset-0 z-50 bg-black/45 backdrop-blur-[2px]","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...n})}const ku=xn(pn("fixed top-[50%] left-[50%] z-50 flex flex-col","w-[calc(100%-2rem)] max-w-[92vw] -translate-x-1/2 -translate-y-1/2","rounded-4 bg-white shadow-xl","overflow-hidden","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","duration-200"),{variants:{size:{sm:"sm:w-[360px]",md:"sm:w-[480px]",lg:"sm:w-[600px]",xl:"sm:w-[760px]"}},defaultVariants:{size:"md"}});function Cu({className:t,children:r,size:o,showClose:a=!0,...i}){/* @__PURE__ */
186
186
  return n(yu,{children:[
187
187
  /* @__PURE__ */e(xu,{}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1d1s/design-system",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",