@solibo/solibo-ui 0.5.5 → 0.5.7

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 +1 @@
1
- ._file_tncrs_1{align-items:center;background-color:var(--colors-semantic-bg-surface);border-radius:var(--utils-tokens-unit);border:var(--scale-2) solid var(--colors-semantic-bg-surface);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color);display:inline-flex;gap:calc(3 * var(--scale-1));max-width:100%;min-width:0}._file_tncrs_1 a{color:var(--colors-semantic-primary-primary);padding:var(--utils-tokens-unit);transition:background-color var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function) var(--utils-tokens-transition-delay)}._file_tncrs_1 a:first-of-type{border-radius:var(--utils-tokens-unit);cursor:default;display:inline-block;flex:1 1 auto;font-weight:var(--font-font-weight-semibold);max-width:100%;min-width:0;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}._file_tncrs_1 a:first-of-type[role=document]:hover{background-color:var(--colors-semantic-bg-overlay);cursor:pointer}._file_tncrs_1 a:first-of-type:has(+a){border-radius:var(--utils-tokens-unit) 0 0 var(--utils-tokens-unit)}._file_tncrs_1 a:first-of-type:visited{opacity:var(--utils-tokens-opacity-minimal)}._file_tncrs_1 a:first-of-type span{margin-right:var(--scale-8)}._file_tncrs_1 ._delete_tncrs_52{border-radius:0 var(--utils-tokens-unit) var(--utils-tokens-unit) 0;cursor:pointer;flex:0 0 auto;position:relative}._file_tncrs_1 ._delete_tncrs_52:before{content:"";position:absolute;left:calc(-1 * var(--scale-2));top:0;width:var(--scale-1);height:100%;background-color:var(--colors-semantic-border-default)}._file_tncrs_1 ._delete_tncrs_52:hover{background-color:var(--colors-semantic-status-error-bg)}
1
+ ._file_1ik2m_1{align-items:center;background-color:var(--colors-semantic-bg-surface);border-radius:var(--utils-tokens-unit);border:var(--scale-2) solid var(--colors-semantic-bg-surface);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color);display:inline-flex;gap:calc(3 * var(--scale-1));max-width:100%;min-width:0}._file_1ik2m_1 a{color:var(--colors-semantic-primary-primary);padding:var(--utils-tokens-unit);transition:background-color var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function) var(--utils-tokens-transition-delay)}._file_1ik2m_1 a:first-of-type{border-radius:var(--utils-tokens-unit);cursor:default;display:inline-block;flex:1 1 auto;font-weight:var(--font-font-weight-semibold);max-width:100%;min-width:0;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}._file_1ik2m_1 a:first-of-type[role=document]:hover{background-color:var(--colors-semantic-bg-overlay);cursor:pointer}._file_1ik2m_1 a:first-of-type:has(+a){border-radius:var(--utils-tokens-unit) 0 0 var(--utils-tokens-unit)}._file_1ik2m_1 a:first-of-type:visited{opacity:var(--utils-tokens-opacity-minimal)}._file_1ik2m_1 a:first-of-type span{margin-right:var(--scale-8)}._file_1ik2m_1 ._delete_1ik2m_52{border-radius:0 var(--utils-tokens-unit) var(--utils-tokens-unit) 0;cursor:pointer;flex:0 0 auto;position:relative}._file_1ik2m_1 ._delete_1ik2m_52:before{content:"";position:absolute;left:calc(-1 * var(--scale-2));top:0;width:var(--scale-1);height:100%;background-color:var(--colors-semantic-border-default)}._file_1ik2m_1 ._delete_1ik2m_52:hover{background-color:var(--colors-red-50)}
@@ -1 +1 @@
1
- ._card_i3kzm_1{background-color:var(--colors-semantic-bg-surface);border-radius:var(--shape-border-radius-radius-lg);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color);display:flex;flex-direction:column;gap:var(--shape-spacing-md);max-width:calc(100vw - calc(3 * var(--utils-tokens-unit)))!important;min-width:0;overflow:hidden!important;padding:var(--shape-spacing-md);position:relative;text-overflow:ellipsis;transition:background-color var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function),box-shadow var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function),width var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function);width:100%}._card_i3kzm_1 section{display:inline-block;flex:1 1 auto;min-width:0;width:100%}._card_i3kzm_1 ._head_i3kzm_31{align-items:start;display:flex;gap:var(--shape-spacing-xs);max-width:100%}._card_i3kzm_1 ._head_i3kzm_31 header{display:inline-block;flex:1 1 auto;margin:0;min-width:0}._card_i3kzm_1 ._head_i3kzm_31._center_i3kzm_44{align-items:center}._card_i3kzm_1 ._head_i3kzm_31 :is(h1,h2,h3,h4,h5,h6):first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._card_i3kzm_1 ._content_i3kzm_56>:last-child{margin-bottom:0}._card_i3kzm_1:has(select){overflow:visible!important}._card_i3kzm_1 [data-component=croppable]{width:100%}._card_i3kzm_1 [data-component=list]{min-width:0}._card_i3kzm_1 [data-component=list] li{max-width:100%;min-width:0}._card_i3kzm_1 [data-component=list] li>a{display:block;max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._card_i3kzm_1 [data-component=list] li>[data-component=file]{width:100%}._clickable_i3kzm_93{cursor:pointer}._clickable_i3kzm_93:hover{background-color:var(--colors-semantic-interactive-hover-subtle);box-shadow:var(--shape-box-shadow-sm-position-x) var(--shape-box-shadow-sm-position-y) var(--shape-box-shadow-sm-blur) var(--shape-box-shadow-sm-spread) var(--shape-box-shadow-sm-color)}._clickable_i3kzm_93:focus-visible{outline:var(--scale-2) solid var(--colors-semantic-border-focus)}._image-top_i3kzm_108{width:100%}._image-top_i3kzm_108 img{width:100%;max-height:calc(12.5 * var(--utils-tokens-unit))}._image-left_i3kzm_117 ._image_i3kzm_108 img,._image-right_i3kzm_118 ._image_i3kzm_108 img{aspect-ratio:1 / 1;max-height:calc(8.75 * var(--utils-tokens-unit));min-height:var(--scale-56);width:auto}._image-left_i3kzm_117{flex-direction:row}._image-right_i3kzm_118{flex-direction:row-reverse}._selected_i3kzm_135{background-color:var(--colors-semantic-interactive-selected);outline:var(--scale-2) solid var(--colors-semantic-primary-primary-subtle-border)}
1
+ ._card_1tbdx_1{background-color:var(--colors-semantic-bg-surface);border-radius:var(--shape-border-radius-radius-lg);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color);display:flex;flex-direction:column;gap:var(--shape-spacing-md);max-width:calc(100vw - calc(3 * var(--utils-tokens-unit)))!important;min-width:0;overflow:hidden!important;padding:var(--shape-spacing-md);position:relative;text-overflow:ellipsis;transition:background-color var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function),box-shadow var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function),width var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function);width:100%}._card_1tbdx_1 section{display:inline-block;flex:1 1 auto;min-width:0;width:100%}._card_1tbdx_1 ._head_1tbdx_31{align-items:start;display:flex;gap:var(--shape-spacing-xs);max-width:100%}._card_1tbdx_1 ._head_1tbdx_31 header{display:inline-block;flex:1 1 auto;margin:0;min-width:0}._card_1tbdx_1 ._head_1tbdx_31._center_1tbdx_44{align-items:center}._card_1tbdx_1 ._head_1tbdx_31 :is(h1,h2,h3,h4,h5,h6):first-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._card_1tbdx_1 ._content_1tbdx_56>:last-child{margin-bottom:0}._card_1tbdx_1:has(select){overflow:visible!important}._card_1tbdx_1 [data-component=croppable]{width:100%}._card_1tbdx_1 [data-component=list]{min-width:0}._card_1tbdx_1 [data-component=list] li{max-width:100%;min-width:0}._card_1tbdx_1 [data-component=list] li>a{display:block;max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._card_1tbdx_1 [data-component=list] li>[data-component=file]{width:100%}._clickable_1tbdx_93{cursor:pointer}._clickable_1tbdx_93:hover{background-color:var(--colors-semantic-interactive-hover-subtle);box-shadow:var(--shape-box-shadow-sm-position-x) var(--shape-box-shadow-sm-position-y) var(--shape-box-shadow-sm-blur) var(--shape-box-shadow-sm-spread) var(--shape-box-shadow-sm-color)}._clickable_1tbdx_93:focus-visible{outline:var(--scale-2) solid var(--colors-semantic-border-focus)}._image-top_1tbdx_108{width:100%}._image-top_1tbdx_108 img{width:100%;height:calc(12.5 * var(--utils-tokens-unit));-o-object-fit:cover;object-fit:cover}._image-left_1tbdx_118 ._image_1tbdx_108 img,._image-right_1tbdx_119 ._image_1tbdx_108 img{aspect-ratio:1 / 1;max-height:calc(8.75 * var(--utils-tokens-unit));min-height:var(--scale-56);width:auto}._image-left_1tbdx_118{flex-direction:row}._image-right_1tbdx_119{flex-direction:row-reverse}._selected_1tbdx_136{background-color:var(--colors-semantic-interactive-selected);outline:var(--scale-2) solid var(--colors-semantic-primary-primary-subtle-border)}
@@ -1 +1 @@
1
- ._editor_nvulc_1{background-color:var(--colors-semantic-bg-surface);border:var(--scale-1) solid var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-md);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color)}._editor_nvulc_1 [role=textbox]{border-radius:0 0 var(--shape-border-radius-radius-md) var(--shape-border-radius-radius-md);padding:var(--scale-8) var(--utils-tokens-unit)}._editor_nvulc_1 img{max-width:100%}._meta_nvulc_19{align-items:center;display:grid;grid-template-columns:1fr auto auto;opacity:0;transition:all var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._meta_nvulc_19._active_nvulc_27{border-top:var(--scale-1) solid var(--colors-semantic-border-default);height:auto;opacity:1}._meta_nvulc_19 input{border-radius:0;width:100%}._bold_nvulc_39{font-weight:700}._italic_nvulc_43{font-style:italic}._link_nvulc_47{color:var(--colors-semantic-primary-primary);cursor:pointer;text-decoration:underline}._list_nvulc_53,._paragraph_nvulc_54{margin:var(--scale-8) 0}._list_nvulc_53{list-style-type:disc!important;padding-left:var(--scale-32)!important}
1
+ ._editor_11hrr_1{background-color:var(--colors-semantic-bg-surface);border:var(--scale-1) solid var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-md);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color)}._editor_11hrr_1 [role=textbox]{border-radius:0 0 var(--shape-border-radius-radius-md) var(--shape-border-radius-radius-md);padding:var(--scale-8) var(--utils-tokens-unit)}._editor_11hrr_1 img{max-width:100%}._meta_11hrr_19{align-items:center;display:grid;grid-template-columns:1fr auto auto;opacity:0;transition:all var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._meta_11hrr_19._active_11hrr_27{border-top:var(--scale-1) solid var(--colors-semantic-border-default);height:auto;opacity:1}._meta_11hrr_19 input{border-radius:0;width:100%}._bold_11hrr_39{font-weight:700}._italic_11hrr_43{font-style:italic}._link_11hrr_47{color:var(--colors-semantic-primary-primary);cursor:pointer;text-decoration:underline}._list_11hrr_53,._paragraph_11hrr_54{margin:var(--scale-8) 0}._list_11hrr_53{list-style-type:disc!important}._list_11hrr_53 li{list-style:inherit;margin-left:var(--scale-16);margin-bottom:var(--scale-8)}
@@ -1 +1 @@
1
- ol{margin-block:var(--scale-8)!important}._sortable_scp0q_5 li{margin-bottom:0;padding-block:var(--scale-8);position:relative}@media (width > 960px){._sortable_scp0q_5 li [data-component=card]{background-color:var(--colors-semantic-bg-surface);padding-right:var(--scale-56);position:relative}._sortable_scp0q_5 li [data-component=card]:after{background-color:var(--colors-semantic-content-tertiary);content:"";cursor:grab;height:var(--scale-24);-webkit-mask-image:var(--icon-svg);mask-image:var(--icon-svg);position:absolute;right:var(--scale-16);top:var(--scale-16);width:var(--scale-24)}._sortable_scp0q_5 li [data-component=card][data-minimal=true]:after{top:calc(50% - var(--scale-12))}}._sortable_scp0q_5 li._dragging_scp0q_35{cursor:grabbing;margin-block:var(--scale-8);opacity:var(--utils-tokens-opacity-minimal);padding:0}._sortable_scp0q_5 li._dragging_scp0q_35 :focus{outline:none}._sortable_scp0q_5 li._dragging_scp0q_35 :focus [data-component=card],._sortable_scp0q_5 li._dragging_scp0q_35 :focus [data-component=card]:after{cursor:grabbing}._sortable_scp0q_5 li._dragging_scp0q_35._dropping_scp0q_50{opacity:var(--utils-tokens-opacity-minimal)}._sortable_scp0q_5 li._dragging_scp0q_35:first-of-type._dragging_scp0q_35{margin-top:var(--utils-tokens-unit)}._sortable_scp0q_5 li._dragging_scp0q_35:last-of-type._dragging_scp0q_35{padding-bottom:var(--scale-8)}._sortable_scp0q_5 li._columns_scp0q_63{-moz-column-gap:0;column-gap:0;margin-right:var(--utils-tokens-negative-unit)}._sortable_scp0q_5 li._columns_scp0q_63 li{padding-right:var(--utils-tokens-unit)}._sortable_scp0q_5 li ._pseudo_scp0q_72:before,._sortable_scp0q_5 li ._pseudo_scp0q_72:after{background:var(--colors-semantic-primary-primary-subtle);border-radius:var(--shape-border-radius-radius-md);border:0 dotted var(--colors-semantic-primary-primary-subtle-border);content:"";display:block;height:0;margin-block:0;opacity:0;pointer-events:none;transition:all var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._sortable_scp0q_5 li ._target-above_scp0q_87:before,._sortable_scp0q_5 li ._target-below_scp0q_88:after{border-width:var(--scale-1);height:calc(var(--height) - var(--utils-tokens-unit));opacity:1;width:var(--width)}._sortable_scp0q_5 li ._target-above_scp0q_87:before{margin-bottom:var(--utils-tokens-unit)}._sortable_scp0q_5 li ._target-below_scp0q_88:after{margin-top:var(--utils-tokens-unit)}
1
+ ol{margin-block:var(--scale-8)!important}._sortable_c1ptl_5 li{margin-bottom:0;padding-block:var(--scale-8);position:relative}@media (width > 960px){._sortable_c1ptl_5 li [data-component=card]{background-color:var(--colors-semantic-bg-surface);padding-right:var(--scale-56);position:relative}._sortable_c1ptl_5 li [data-component=card]:after{background-color:var(--colors-semantic-content-tertiary);content:"";cursor:grab;height:var(--scale-24);-webkit-mask-image:var(--icon-svg);mask-image:var(--icon-svg);position:absolute;right:var(--scale-16);top:var(--scale-16);width:var(--scale-24)}._sortable_c1ptl_5 li [data-component=card][data-minimal=true]:after{top:calc(50% - var(--scale-12))}}._sortable_c1ptl_5 li._dragging_c1ptl_35{cursor:grabbing;margin-block:var(--scale-8);opacity:var(--utils-tokens-opacity-minimal);padding:0}._sortable_c1ptl_5 li._dragging_c1ptl_35 :focus{outline:none}._sortable_c1ptl_5 li._dragging_c1ptl_35 :focus [data-component=card],._sortable_c1ptl_5 li._dragging_c1ptl_35 :focus [data-component=card]:after{cursor:grabbing}._sortable_c1ptl_5 li._dragging_c1ptl_35._dropping_c1ptl_50{opacity:var(--utils-tokens-opacity-minimal)}._sortable_c1ptl_5 li._dragging_c1ptl_35:first-of-type._dragging_c1ptl_35{margin-top:var(--utils-tokens-unit)}._sortable_c1ptl_5 li._dragging_c1ptl_35:last-of-type._dragging_c1ptl_35{padding-bottom:var(--scale-8)}._sortable_c1ptl_5 li._columns_c1ptl_63{-moz-column-gap:0;column-gap:0;margin-right:var(--utils-tokens-negative-unit)}._sortable_c1ptl_5 li._columns_c1ptl_63 li{padding-right:var(--utils-tokens-unit)}._sortable_c1ptl_5 ._pseudo_c1ptl_73:before,._sortable_c1ptl_5 ._pseudo_c1ptl_73:after{background:var(--colors-semantic-primary-primary-subtle);border-radius:var(--shape-border-radius-radius-lg);border:0 dotted var(--colors-semantic-primary-primary-subtle-border);content:"";display:block;height:0;margin-block:0;opacity:0;pointer-events:none;transition:all var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._sortable_c1ptl_5 ._target-above_c1ptl_88:before,._sortable_c1ptl_5 ._target-below_c1ptl_89:after{border-width:var(--scale-1);height:var(--height);opacity:1;width:var(--width)}._sortable_c1ptl_5 ._target-above_c1ptl_88:before{margin-bottom:var(--utils-tokens-unit)}._sortable_c1ptl_5 ._target-below_c1ptl_89:after{margin-top:var(--utils-tokens-unit)}
@@ -1 +1 @@
1
- ._button_l8m83_1{align-items:center;background-color:var(--colors-semantic-bg-page);border-radius:var(--shape-border-radius-radius-md);border:none;box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color);color:var(--colors-semantic-content-secondary);display:inline;font-weight:var(--font-font-weight-semibold);padding:calc(var(--utils-tokens-unit) - var(--scale-2));transition:all var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._button_l8m83_1:disabled{cursor:not-allowed;opacity:var(--utils-tokens-opacity-minimal)}._danger_l8m83_22{background-color:var(--colors-semantic-status-error-bg);color:var(--colors-semantic-bg-surface)}._danger_l8m83_22:not([disabled]):hover{background-color:var(--colors-semantic-status-error-content)}._danger_l8m83_22 span{margin-left:var(--scale-8)}._minimal_l8m83_35{background-color:transparent;border-radius:var(--shape-border-radius-radius-md);border:none;box-shadow:none}._primary_l8m83_42{background-color:var(--colors-semantic-primary-primary);color:var(--colors-semantic-bg-surface)}._primary_l8m83_42:not([disabled]):hover{background-color:var(--colors-semantic-primary-primary-active)}
1
+ ._button_1scj6_1{align-items:center;background-color:var(--colors-semantic-bg-page);border-radius:var(--shape-border-radius-radius-md);border:none;box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color);color:var(--colors-semantic-content-secondary);display:inline;font-weight:var(--font-font-weight-semibold);padding:calc(var(--utils-tokens-unit) - var(--scale-2));transition:all var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._button_1scj6_1:disabled{cursor:not-allowed;opacity:var(--utils-tokens-opacity-minimal)}._danger_1scj6_22{background-color:var(--colors-semantic-interactive-destructive-bg);color:var(--colors-semantic-bg-surface)}._danger_1scj6_22:not([disabled]):hover{background-color:var(--colors-semantic-interactive-destructive-hover)}._danger_1scj6_22 span{margin-left:var(--scale-8)}._minimal_1scj6_35{background-color:transparent;border-radius:var(--shape-border-radius-radius-md);border:none;box-shadow:none}._primary_1scj6_42{background-color:var(--colors-semantic-primary-primary);color:var(--colors-semantic-bg-surface)}._primary_1scj6_42:not([disabled]):hover{background-color:var(--colors-semantic-primary-primary-active)}
@@ -1 +1 @@
1
- ._icon_1034p_1{display:inline-block;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;flex-shrink:0;vertical-align:middle}._small_1034p_9{height:var(--utils-tokens-unit);width:var(--utils-tokens-unit)}._medium_1034p_14{height:calc(var(--utils-tokens-unit) * 1.5);width:calc(var(--utils-tokens-unit) * 1.5)}._large_1034p_19{height:calc(var(--utils-tokens-unit) * 2);width:calc(var(--utils-tokens-unit) * 2)}._danger_1034p_24{background-color:var(--colors-semantic-status-error-bg)}._default_1034p_28{background-color:var(--colors-semantic-content-secondary)}._primary_1034p_32{background-color:var(--colors-semantic-primary-primary)}._white_1034p_36{background-color:var(--colors-semantic-bg-surface)}._gap-right_1034p_40{margin-right:var(--scale-8)}._gap-left_1034p_44{margin-left:var(--scale-8)}
1
+ ._icon_1uucz_1{display:inline-block;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain;flex-shrink:0;vertical-align:middle}._small_1uucz_9{height:var(--utils-tokens-unit);width:var(--utils-tokens-unit)}._medium_1uucz_14{height:calc(var(--utils-tokens-unit) * 1.5);width:calc(var(--utils-tokens-unit) * 1.5)}._large_1uucz_19{height:calc(var(--utils-tokens-unit) * 2);width:calc(var(--utils-tokens-unit) * 2)}._danger_1uucz_24{background-color:var(--colors-semantic-interactive-destructive-bg)}._default_1uucz_28{background-color:var(--colors-semantic-content-secondary)}._primary_1uucz_32{background-color:var(--colors-semantic-primary-primary)}._white_1uucz_36{background-color:var(--colors-semantic-bg-surface)}._gap-right_1uucz_40{margin-right:var(--scale-8)}._gap-left_1uucz_44{margin-left:var(--scale-8)}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index16.css');const e=require("react/jsx-runtime"),d=require("../../classix-5H4IWnMA.cjs"),g=require("../badge/index.cjs"),u=require("../checkbox/index.cjs"),k=require("../figure/index.cjs"),p=require("../icon/index.cjs"),x="_card_i3kzm_1",j="_head_i3kzm_31",z="_center_i3kzm_44",f="_content_i3kzm_56",h="_clickable_i3kzm_93",q="_image_i3kzm_108",y="_selected_i3kzm_135",t={card:x,head:j,center:z,content:f,clickable:h,"image-top":"_image-top_i3kzm_108","image-left":"_image-left_i3kzm_117","image-right":"_image-right_i3kzm_118",image:q,selected:y},N=({badge:a,checkbox:i,children:r,header:l,icon:m,image:_,imagePosition:o="top",onClick:c,variant:s="default"})=>e.jsxs("article",{className:d.t(t.card,o&&t[`image-${o}`],c&&t.clickable,(i==null?void 0:i.checked)&&t.selected),"data-minimal":s==="minimal",onClick:c,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),n.currentTarget.click())},tabIndex:c?0:-1,"data-component":"card",children:[_&&s!=="minimal"&&e.jsx(k.Figure,{className:t.image,children:_}),e.jsxs("section",{children:[e.jsxs("div",{className:d.t(t.head,s==="minimal"&&t.center),children:[i&&e.jsx("span",{onClick:n=>n.stopPropagation(),children:e.jsx(u.Checkbox,{...i})}),l,a&&e.jsx(g.Badge,{...a}),m&&e.jsx(p.Icon,{name:m,size:"medium"})]}),r&&e.jsx("div",{className:t.content,children:r})]})]});exports.Card=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index16.css');const e=require("react/jsx-runtime"),l=require("../../classix-5H4IWnMA.cjs"),x=require("../badge/index.cjs"),u=require("../checkbox/index.cjs"),g=require("../figure/index.cjs"),b=require("../icon/index.cjs"),p="_card_1tbdx_1",j="_head_1tbdx_31",f="_center_1tbdx_44",h="_content_1tbdx_56",q="_clickable_1tbdx_93",y="_image_1tbdx_108",N="_selected_1tbdx_136",t={card:p,head:j,center:f,content:h,clickable:q,"image-top":"_image-top_1tbdx_108","image-left":"_image-left_1tbdx_118","image-right":"_image-right_1tbdx_119",image:y,selected:N},v=({badge:i,checkbox:c,children:r,header:m,icon:d,image:_,imagePosition:o="top",onClick:s,variant:a="default"})=>e.jsxs("article",{className:l.t(t.card,o&&t[`image-${o}`],s&&t.clickable,(c==null?void 0:c.checked)&&t.selected),"data-minimal":a==="minimal",onClick:s,onKeyDown:n=>{s&&n.currentTarget===document.activeElement&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),n.currentTarget.click())},tabIndex:s?0:-1,"data-component":"card",children:[_&&a!=="minimal"&&e.jsx(g.Figure,{className:t.image,children:_}),e.jsxs("section",{children:[e.jsxs("div",{className:l.t(t.head,a==="minimal"&&t.center),children:[c&&e.jsx("span",{onClick:n=>n.stopPropagation(),children:e.jsx(u.Checkbox,{...c})}),m,i&&e.jsx(x.Badge,{...i}),d&&e.jsx(b.Icon,{name:d,size:"medium"})]}),r&&e.jsx("div",{className:t.content,children:r})]})]});exports.Card=v;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/_card/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { Badge, BadgeProps } from '@/components/badge';\nimport { Checkbox, CheckboxProps } from '@/components/checkbox';\nimport { Figure } from '@/components/figure';\nimport { Icon } from '@/components/icon';\nimport { IconName } from '@/components/icon/icons.ts';\n\nimport styles from './styles.module.css';\n\ntype BaseCardProps = {\n badge?: BadgeProps;\n checkbox?: CheckboxProps;\n icon?: IconName;\n onClick?: React.MouseEventHandler<HTMLElement>;\n};\n\ntype DefaultCardProps = BaseCardProps & {\n children?: React.ReactNode;\n header?: React.ReactNode;\n image?: React.ReactNode;\n imagePosition?: 'top' | 'left' | 'right';\n variant?: 'default';\n};\n\ntype MinimalCardProps = BaseCardProps & {\n children?: never;\n header: React.ReactNode;\n image?: never;\n imagePosition?: never;\n variant: 'minimal';\n};\n\nexport type CardProps = DefaultCardProps | MinimalCardProps;\n\nexport const Card = ({\n badge,\n checkbox,\n children,\n header,\n icon,\n image,\n imagePosition = 'top',\n onClick,\n variant = 'default',\n}: CardProps) => {\n return (\n <article\n className={cx(\n styles.card,\n imagePosition && styles[`image-${imagePosition}`],\n onClick && styles.clickable,\n checkbox?.checked && styles.selected\n )}\n data-minimal={variant === 'minimal'}\n onClick={onClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.currentTarget.click();\n }\n }}\n tabIndex={onClick ? 0 : -1}\n >\n {image && variant !== 'minimal' && <Figure className={styles.image}>{image}</Figure>}\n <section>\n <div className={cx(styles.head, variant === 'minimal' && styles.center)}>\n {checkbox && (\n <span onClick={(e) => e.stopPropagation()}>\n <Checkbox {...checkbox} />\n </span>\n )}\n {header}\n {badge && <Badge {...badge} />}\n {icon && (\n <Icon\n name={icon}\n size='medium'\n />\n )}\n </div>\n {children && <div className={styles.content}>{children}</div>}\n </section>\n </article>\n );\n};\n"],"names":["Card","badge","checkbox","children","header","icon","image","imagePosition","onClick","variant","jsxs","cx","styles","card","clickable","checked","selected","e","key","preventDefault","currentTarget","click","jsx","Figure","head","center","stopPropagation","Checkbox","Badge","Icon","content"],"mappings":"wmBAmCaA,EAAOA,CAAC,CACnBC,MAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,OAAAA,EACAC,KAAAA,EACAC,MAAAA,EACAC,cAAAA,EAAgB,MAChBC,QAAAA,EACAC,QAAAA,EAAU,SACD,IAEPC,EAAAA,KAAC,UAAA,CACC,UAAWC,EAAAA,EACTC,EAAOC,KACPN,GAAiBK,EAAO,SAASL,CAAa,EAAE,EAChDC,GAAWI,EAAOE,WAClBZ,GAAAA,YAAAA,EAAUa,UAAWH,EAAOI,QAC9B,EACA,eAAcP,IAAY,UAC1B,QAAAD,EACA,UAAYS,GAAM,EACZA,EAAEC,MAAQ,SAAWD,EAAEC,MAAQ,OACjCD,EAAEE,eAAAA,EACFF,EAAEG,cAAcC,MAAAA,EAEpB,EACA,SAAUb,EAAU,EAAI,GAAG,iBAAA,OAE1BF,SAAAA,CAAAA,GAASG,IAAY,WAAaa,EAAAA,IAACC,EAAAA,QAAO,UAAWX,EAAON,MAAQA,SAAAA,CAAAA,CAAM,SAC1E,UAAA,CACC,SAAA,CAAAI,EAAAA,KAAC,MAAA,CAAI,UAAWC,EAAAA,EAAGC,EAAOY,KAAMf,IAAY,WAAaG,EAAOa,MAAM,EACnEvB,SAAAA,CAAAA,GACCoB,EAAAA,IAAC,OAAA,CAAK,QAAUL,GAAMA,EAAES,gBAAAA,EACtB,SAAAJ,EAAAA,IAACK,EAAAA,SAAA,CAAS,GAAIzB,CAAAA,CAAS,EACzB,EAEDE,EACAH,GAASqB,EAAAA,IAACM,EAAAA,MAAA,CAAM,GAAI3B,CAAAA,CAAM,EAC1BI,GACCiB,EAAAA,IAACO,OAAA,CACC,KAAMxB,EACN,KAAK,QAAA,CAAQ,CAAA,EAGnB,EACCF,GAAYmB,EAAAA,IAAC,MAAA,CAAI,UAAWV,EAAOkB,QAAU3B,SAAAA,CAAAA,CAAS,CAAA,CAAA,CACzD,CAAA,EACF"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/_card/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { Badge, BadgeProps } from '@/components/badge';\nimport { Checkbox, CheckboxProps } from '@/components/checkbox';\nimport { Figure } from '@/components/figure';\nimport { Icon } from '@/components/icon';\nimport { IconName } from '@/components/icon/icons.ts';\n\nimport styles from './styles.module.css';\n\ntype BaseCardProps = {\n badge?: BadgeProps;\n checkbox?: CheckboxProps;\n icon?: IconName;\n onClick?: React.MouseEventHandler<HTMLElement>;\n};\n\ntype DefaultCardProps = BaseCardProps & {\n children?: React.ReactNode;\n header?: React.ReactNode;\n image?: React.ReactNode;\n imagePosition?: 'top' | 'left' | 'right';\n variant?: 'default';\n};\n\ntype MinimalCardProps = BaseCardProps & {\n children?: never;\n header: React.ReactNode;\n image?: never;\n imagePosition?: never;\n variant: 'minimal';\n};\n\nexport type CardProps = DefaultCardProps | MinimalCardProps;\n\nexport const Card = ({\n badge,\n checkbox,\n children,\n header,\n icon,\n image,\n imagePosition = 'top',\n onClick,\n variant = 'default',\n}: CardProps) => {\n return (\n <article\n className={cx(\n styles.card,\n imagePosition && styles[`image-${imagePosition}`],\n onClick && styles.clickable,\n checkbox?.checked && styles.selected\n )}\n data-minimal={variant === 'minimal'}\n onClick={onClick}\n onKeyDown={(e) => {\n if (!onClick) return;\n\n if (e.currentTarget !== document.activeElement) {\n return;\n }\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.currentTarget.click();\n }\n }}\n tabIndex={onClick ? 0 : -1}\n >\n {image && variant !== 'minimal' && <Figure className={styles.image}>{image}</Figure>}\n <section>\n <div className={cx(styles.head, variant === 'minimal' && styles.center)}>\n {checkbox && (\n <span onClick={(e) => e.stopPropagation()}>\n <Checkbox {...checkbox} />\n </span>\n )}\n {header}\n {badge && <Badge {...badge} />}\n {icon && (\n <Icon\n name={icon}\n size='medium'\n />\n )}\n </div>\n {children && <div className={styles.content}>{children}</div>}\n </section>\n </article>\n );\n};\n"],"names":["Card","badge","checkbox","children","header","icon","image","imagePosition","onClick","variant","jsxs","cx","styles","card","clickable","checked","selected","e","currentTarget","document","activeElement","key","preventDefault","click","jsx","Figure","head","center","stopPropagation","Checkbox","Badge","Icon","content"],"mappings":"wmBAmCaA,EAAOA,CAAC,CACnBC,MAAAA,EACAC,SAAAA,EACAC,SAAAA,EACAC,OAAAA,EACAC,KAAAA,EACAC,MAAAA,EACAC,cAAAA,EAAgB,MAChBC,QAAAA,EACAC,QAAAA,EAAU,SACD,IAEPC,EAAAA,KAAC,UAAA,CACC,UAAWC,EAAAA,EACTC,EAAOC,KACPN,GAAiBK,EAAO,SAASL,CAAa,EAAE,EAChDC,GAAWI,EAAOE,WAClBZ,GAAAA,YAAAA,EAAUa,UAAWH,EAAOI,QAC9B,EACA,eAAcP,IAAY,UAC1B,QAAAD,EACA,UAAYS,GAAM,CACXT,GAEDS,EAAEC,gBAAkBC,SAASC,gBAI7BH,EAAEI,MAAQ,SAAWJ,EAAEI,MAAQ,OACjCJ,EAAEK,eAAAA,EACFL,EAAEC,cAAcK,MAAAA,EAEpB,EACA,SAAUf,EAAU,EAAI,GAAG,iBAAA,OAE1BF,SAAAA,CAAAA,GAASG,IAAY,WAAae,EAAAA,IAACC,EAAAA,QAAO,UAAWb,EAAON,MAAQA,SAAAA,CAAAA,CAAM,SAC1E,UAAA,CACC,SAAA,CAAAI,EAAAA,KAAC,MAAA,CAAI,UAAWC,EAAAA,EAAGC,EAAOc,KAAMjB,IAAY,WAAaG,EAAOe,MAAM,EACnEzB,SAAAA,CAAAA,GACCsB,EAAAA,IAAC,OAAA,CAAK,QAAUP,GAAMA,EAAEW,gBAAAA,EACtB,SAAAJ,EAAAA,IAACK,EAAAA,SAAA,CAAS,GAAI3B,CAAAA,CAAS,EACzB,EAEDE,EACAH,GAASuB,EAAAA,IAACM,EAAAA,MAAA,CAAM,GAAI7B,CAAAA,CAAM,EAC1BI,GACCmB,EAAAA,IAACO,OAAA,CACC,KAAM1B,EACN,KAAK,QAAA,CAAQ,CAAA,EAGnB,EACCF,GAAYqB,EAAAA,IAAC,MAAA,CAAI,UAAWZ,EAAOoB,QAAU7B,SAAAA,CAAAA,CAAS,CAAA,CAAA,CACzD,CAAA,EACF"}
@@ -1,45 +1,45 @@
1
- import { jsxs as n, jsx as i } from "react/jsx-runtime";
2
- import { t as d } from "../../classix-DG18itHa.js";
3
- import { Badge as g } from "../badge/index.js";
4
- import { Checkbox as k } from "../checkbox/index.js";
5
- import { Figure as f } from "../figure/index.js";
6
- import { Icon as z } from "../icon/index.js";
7
- import '../../assets/index16.css';const h = "_card_i3kzm_1", u = "_head_i3kzm_31", y = "_center_i3kzm_44", N = "_content_i3kzm_56", j = "_clickable_i3kzm_93", D = "_image_i3kzm_108", I = "_selected_i3kzm_135", e = {
8
- card: h,
9
- head: u,
1
+ import { jsxs as i, jsx as a } from "react/jsx-runtime";
2
+ import { t as s } from "../../classix-DG18itHa.js";
3
+ import { Badge as p } from "../badge/index.js";
4
+ import { Checkbox as f } from "../checkbox/index.js";
5
+ import { Figure as u } from "../figure/index.js";
6
+ import { Icon as b } from "../icon/index.js";
7
+ import '../../assets/index16.css';const x = "_card_1tbdx_1", h = "_head_1tbdx_31", y = "_center_1tbdx_44", N = "_content_1tbdx_56", j = "_clickable_1tbdx_93", v = "_image_1tbdx_108", D = "_selected_1tbdx_136", e = {
8
+ card: x,
9
+ head: h,
10
10
  center: y,
11
11
  content: N,
12
12
  clickable: j,
13
- "image-top": "_image-top_i3kzm_108",
14
- "image-left": "_image-left_i3kzm_117",
15
- "image-right": "_image-right_i3kzm_118",
16
- image: D,
17
- selected: I
18
- }, K = ({
19
- badge: r,
20
- checkbox: m,
21
- children: l,
22
- header: p,
23
- icon: _,
24
- image: o,
25
- imagePosition: s = "top",
26
- onClick: a,
13
+ "image-top": "_image-top_1tbdx_108",
14
+ "image-left": "_image-left_1tbdx_118",
15
+ "image-right": "_image-right_1tbdx_119",
16
+ image: v,
17
+ selected: D
18
+ }, B = ({
19
+ badge: m,
20
+ checkbox: r,
21
+ children: d,
22
+ header: g,
23
+ icon: l,
24
+ image: _,
25
+ imagePosition: o = "top",
26
+ onClick: n,
27
27
  variant: c = "default"
28
- }) => /* @__PURE__ */ n("article", { className: d(e.card, s && e[`image-${s}`], a && e.clickable, (m == null ? void 0 : m.checked) && e.selected), "data-minimal": c === "minimal", onClick: a, onKeyDown: (t) => {
29
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.currentTarget.click());
30
- }, tabIndex: a ? 0 : -1, "data-component": "card", children: [
31
- o && c !== "minimal" && /* @__PURE__ */ i(f, { className: e.image, children: o }),
32
- /* @__PURE__ */ n("section", { children: [
33
- /* @__PURE__ */ n("div", { className: d(e.head, c === "minimal" && e.center), children: [
34
- m && /* @__PURE__ */ i("span", { onClick: (t) => t.stopPropagation(), children: /* @__PURE__ */ i(k, { ...m }) }),
35
- p,
36
- r && /* @__PURE__ */ i(g, { ...r }),
37
- _ && /* @__PURE__ */ i(z, { name: _, size: "medium" })
28
+ }) => /* @__PURE__ */ i("article", { className: s(e.card, o && e[`image-${o}`], n && e.clickable, (r == null ? void 0 : r.checked) && e.selected), "data-minimal": c === "minimal", onClick: n, onKeyDown: (t) => {
29
+ n && t.currentTarget === document.activeElement && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), t.currentTarget.click());
30
+ }, tabIndex: n ? 0 : -1, "data-component": "card", children: [
31
+ _ && c !== "minimal" && /* @__PURE__ */ a(u, { className: e.image, children: _ }),
32
+ /* @__PURE__ */ i("section", { children: [
33
+ /* @__PURE__ */ i("div", { className: s(e.head, c === "minimal" && e.center), children: [
34
+ r && /* @__PURE__ */ a("span", { onClick: (t) => t.stopPropagation(), children: /* @__PURE__ */ a(f, { ...r }) }),
35
+ g,
36
+ m && /* @__PURE__ */ a(p, { ...m }),
37
+ l && /* @__PURE__ */ a(b, { name: l, size: "medium" })
38
38
  ] }),
39
- l && /* @__PURE__ */ i("div", { className: e.content, children: l })
39
+ d && /* @__PURE__ */ a("div", { className: e.content, children: d })
40
40
  ] })
41
41
  ] });
42
42
  export {
43
- K as Card
43
+ B as Card
44
44
  };
45
45
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/_card/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { Badge, BadgeProps } from '@/components/badge';\nimport { Checkbox, CheckboxProps } from '@/components/checkbox';\nimport { Figure } from '@/components/figure';\nimport { Icon } from '@/components/icon';\nimport { IconName } from '@/components/icon/icons.ts';\n\nimport styles from './styles.module.css';\n\ntype BaseCardProps = {\n badge?: BadgeProps;\n checkbox?: CheckboxProps;\n icon?: IconName;\n onClick?: React.MouseEventHandler<HTMLElement>;\n};\n\ntype DefaultCardProps = BaseCardProps & {\n children?: React.ReactNode;\n header?: React.ReactNode;\n image?: React.ReactNode;\n imagePosition?: 'top' | 'left' | 'right';\n variant?: 'default';\n};\n\ntype MinimalCardProps = BaseCardProps & {\n children?: never;\n header: React.ReactNode;\n image?: never;\n imagePosition?: never;\n variant: 'minimal';\n};\n\nexport type CardProps = DefaultCardProps | MinimalCardProps;\n\nexport const Card = ({\n badge,\n checkbox,\n children,\n header,\n icon,\n image,\n imagePosition = 'top',\n onClick,\n variant = 'default',\n}: CardProps) => {\n return (\n <article\n className={cx(\n styles.card,\n imagePosition && styles[`image-${imagePosition}`],\n onClick && styles.clickable,\n checkbox?.checked && styles.selected\n )}\n data-minimal={variant === 'minimal'}\n onClick={onClick}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.currentTarget.click();\n }\n }}\n tabIndex={onClick ? 0 : -1}\n >\n {image && variant !== 'minimal' && <Figure className={styles.image}>{image}</Figure>}\n <section>\n <div className={cx(styles.head, variant === 'minimal' && styles.center)}>\n {checkbox && (\n <span onClick={(e) => e.stopPropagation()}>\n <Checkbox {...checkbox} />\n </span>\n )}\n {header}\n {badge && <Badge {...badge} />}\n {icon && (\n <Icon\n name={icon}\n size='medium'\n />\n )}\n </div>\n {children && <div className={styles.content}>{children}</div>}\n </section>\n </article>\n );\n};\n"],"names":["Card","badge","checkbox","children","header","icon","image","imagePosition","onClick","variant","jsxs","cx","styles","card","clickable","checked","selected","e","key","preventDefault","currentTarget","click","jsx","Figure","head","center","stopPropagation","Checkbox","Badge","Icon","content"],"mappings":";;;;;;;;;;;;;;;;;G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AAU3B,UAAAA,EAAAA,CAAS;AAAA,EAAA,EAAA,CACzD;AAAA,GACF;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/_card/index.tsx"],"sourcesContent":["import cx from 'classix';\n\nimport { Badge, BadgeProps } from '@/components/badge';\nimport { Checkbox, CheckboxProps } from '@/components/checkbox';\nimport { Figure } from '@/components/figure';\nimport { Icon } from '@/components/icon';\nimport { IconName } from '@/components/icon/icons.ts';\n\nimport styles from './styles.module.css';\n\ntype BaseCardProps = {\n badge?: BadgeProps;\n checkbox?: CheckboxProps;\n icon?: IconName;\n onClick?: React.MouseEventHandler<HTMLElement>;\n};\n\ntype DefaultCardProps = BaseCardProps & {\n children?: React.ReactNode;\n header?: React.ReactNode;\n image?: React.ReactNode;\n imagePosition?: 'top' | 'left' | 'right';\n variant?: 'default';\n};\n\ntype MinimalCardProps = BaseCardProps & {\n children?: never;\n header: React.ReactNode;\n image?: never;\n imagePosition?: never;\n variant: 'minimal';\n};\n\nexport type CardProps = DefaultCardProps | MinimalCardProps;\n\nexport const Card = ({\n badge,\n checkbox,\n children,\n header,\n icon,\n image,\n imagePosition = 'top',\n onClick,\n variant = 'default',\n}: CardProps) => {\n return (\n <article\n className={cx(\n styles.card,\n imagePosition && styles[`image-${imagePosition}`],\n onClick && styles.clickable,\n checkbox?.checked && styles.selected\n )}\n data-minimal={variant === 'minimal'}\n onClick={onClick}\n onKeyDown={(e) => {\n if (!onClick) return;\n\n if (e.currentTarget !== document.activeElement) {\n return;\n }\n\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n e.currentTarget.click();\n }\n }}\n tabIndex={onClick ? 0 : -1}\n >\n {image && variant !== 'minimal' && <Figure className={styles.image}>{image}</Figure>}\n <section>\n <div className={cx(styles.head, variant === 'minimal' && styles.center)}>\n {checkbox && (\n <span onClick={(e) => e.stopPropagation()}>\n <Checkbox {...checkbox} />\n </span>\n )}\n {header}\n {badge && <Badge {...badge} />}\n {icon && (\n <Icon\n name={icon}\n size='medium'\n />\n )}\n </div>\n {children && <div className={styles.content}>{children}</div>}\n </section>\n </article>\n );\n};\n"],"names":["Card","badge","checkbox","children","header","icon","image","imagePosition","onClick","variant","jsxs","cx","styles","card","clickable","checked","selected","e","currentTarget","document","activeElement","key","preventDefault","click","jsx","Figure","head","center","stopPropagation","Checkbox","Badge","Icon","content"],"mappings":";;;;;;;;;;;;;;;;;GAmCaA,IAAOA,CAAC;AAAA,EACnBC,OAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,UAAAA;AAAAA,EACAC,QAAAA;AAAAA,EACAC,MAAAA;AAAAA,EACAC,OAAAA;AAAAA,EACAC,eAAAA,IAAgB;AAAA,EAChBC,SAAAA;AAAAA,EACAC,SAAAA,IAAU;AACD,MAEP,gBAAAC,EAAC,WAAA,EACC,WAAWC,EACTC,EAAOC,MACPN,KAAiBK,EAAO,SAASL,CAAa,EAAE,GAChDC,KAAWI,EAAOE,YAClBZ,KAAAA,gBAAAA,EAAUa,YAAWH,EAAOI,QAC9B,GACA,gBAAcP,MAAY,WAC1B,SAAAD,GACA,WAAYS,CAAAA,MAAM;AAChB,EAAKT,KAEDS,EAAEC,kBAAkBC,SAASC,kBAI7BH,EAAEI,QAAQ,WAAWJ,EAAEI,QAAQ,SACjCJ,EAAEK,eAAAA,GACFL,EAAEC,cAAcK,MAAAA;AAEpB,GACA,UAAUf,IAAU,IAAI,IAAG,kBAAA,QAE1BF,UAAAA;AAAAA,EAAAA,KAASG,MAAY,aAAa,gBAAAe,EAACC,KAAO,WAAWb,EAAON,OAAQA,UAAAA,EAAAA,CAAM;AAAA,oBAC1E,WAAA,EACC,UAAA;AAAA,IAAA,gBAAAI,EAAC,OAAA,EAAI,WAAWC,EAAGC,EAAOc,MAAMjB,MAAY,aAAaG,EAAOe,MAAM,GACnEzB,UAAAA;AAAAA,MAAAA,KACC,gBAAAsB,EAAC,QAAA,EAAK,SAAUP,CAAAA,MAAMA,EAAEW,gBAAAA,GACtB,UAAA,gBAAAJ,EAACK,GAAA,EAAS,GAAI3B,EAAAA,CAAS,GACzB;AAAA,MAEDE;AAAAA,MACAH,KAAS,gBAAAuB,EAACM,GAAA,EAAM,GAAI7B,EAAAA,CAAM;AAAA,MAC1BI,KACC,gBAAAmB,EAACO,GAAA,EACC,MAAM1B,GACN,MAAK,SAAA,CAAQ;AAAA,IAAA,GAGnB;AAAA,IACCF,KAAY,gBAAAqB,EAAC,OAAA,EAAI,WAAWZ,EAAOoB,SAAU7B,UAAAA,EAAAA,CAAS;AAAA,EAAA,EAAA,CACzD;AAAA,GACF;"}
@@ -54,5 +54,5 @@ vulnerable to XSS attacks. Please remove it from \`allowedTags\`.
54
54
  Or, to disable this warning, add the \`allowVulnerableTags\` option
55
55
  and ensure you are accounting for this risk.
56
56
 
57
- `)});const o=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},Xt(e.allowedAttributes,function(_,O){a[O]=[];const N=[];_.forEach(function(q){typeof q=="string"&&q.indexOf("*")>=0?N.push(Sa(q).replace(/\\\*/g,".*")):a[O].push(q)}),N.length&&(l[O]=new RegExp("^("+N.join("|")+")$"))}));const f={},h={},c={};Xt(e.allowedClasses,function(_,O){if(a&&(Ye(a,O)||(a[O]=[]),a[O].push("class")),f[O]=_,Array.isArray(_)){const N=[];f[O]=[],c[O]=[],_.forEach(function(q){typeof q=="string"&&q.indexOf("*")>=0?N.push(Sa(q).replace(/\\\*/g,".*")):q instanceof RegExp?c[O].push(q):f[O].push(q)}),N.length&&(h[O]=new RegExp("^("+N.join("|")+")$"))}});const d={};let p;Xt(e.transformTags,function(_,O){let N;typeof _=="function"?N=_:typeof _=="string"&&(N=Gn.simpleTransform(_)),O==="*"?p=N:d[O]=N});let m,g,y,b,x,w,T=!1;I();const S=new w1.Parser({onopentag:function(_,O){if(e.onOpenTag&&e.onOpenTag(_,O),e.enforceHtmlBoundary&&_==="html"&&I(),x){w++;return}const N=new i(_,O);g.push(N);let q=!1;const R=!!N.text;let V;if(Ye(d,_)&&(V=d[_](_,O),N.attribs=O=V.attribs,V.text!==void 0&&(N.innerText=V.text),_!==V.tagName&&(N.name=_=V.tagName,b[m]=V.tagName)),p&&(V=p(_,O),N.attribs=O=V.attribs,_!==V.tagName&&(N.name=_=V.tagName,b[m]=V.tagName)),(!s(_)||e.disallowedTagsMode==="recursiveEscape"&&!N1(y)||e.nestingLimit!=null&&m>=e.nestingLimit)&&(q=!0,y[m]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&o.indexOf(_)!==-1&&(x=!0,w=1)),m++,q){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(N.innerText&&!R){const K=C(N.innerText);e.textFilter?r+=e.textFilter(K,_):r+=K,T=!0}return}u=r,r=""}r+="<"+_,_==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(N.innerText=""),q&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?Xt(O,function(K,J){r+=" "+J+'="'+C(K||"",!0)+'"'}):(!a||Ye(a,_)||a["*"])&&Xt(O,function(K,J){if(!I1.test(J)){delete N.attribs[J];return}if(K===""&&!e.allowedEmptyAttributes.includes(J)&&(e.nonBooleanAttributes.includes(J)||e.nonBooleanAttributes.includes("*"))){delete N.attribs[J];return}let Ie=!1;if(!a||Ye(a,_)&&a[_].indexOf(J)!==-1||a["*"]&&a["*"].indexOf(J)!==-1||Ye(l,_)&&l[_].test(J)||l["*"]&&l["*"].test(J))Ie=!0;else if(a&&a[_]){for(const H of a[_])if(S1(H)&&H.name&&H.name===J){Ie=!0;let Q="";if(H.multiple===!0){const we=K.split(" ");for(const ge of we)H.values.indexOf(ge)!==-1&&(Q===""?Q=ge:Q+=" "+ge)}else H.values.indexOf(K)>=0&&(Q=K);K=Q}}if(Ie){if(e.allowedSchemesAppliedToAttributes.indexOf(J)!==-1&&L(_,K)){delete N.attribs[J];return}if(_==="script"&&J==="src"){let H=!0;try{const Q=U(K);if(e.allowedScriptHostnames||e.allowedScriptDomains){const we=(e.allowedScriptHostnames||[]).find(function(me){return me===Q.url.hostname}),ge=(e.allowedScriptDomains||[]).find(function(me){return Q.url.hostname===me||Q.url.hostname.endsWith(`.${me}`)});H=we||ge}}catch{H=!1}if(!H){delete N.attribs[J];return}}if(_==="iframe"&&J==="src"){let H=!0;try{const Q=U(K);if(Q.isRelativeUrl)H=Ye(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const we=(e.allowedIframeHostnames||[]).find(function(me){return me===Q.url.hostname}),ge=(e.allowedIframeDomains||[]).find(function(me){return Q.url.hostname===me||Q.url.hostname.endsWith(`.${me}`)});H=we||ge}}catch{H=!1}if(!H){delete N.attribs[J];return}}if(J==="srcset")try{let H=T1(K);if(H.forEach(function(Q){L("srcset",Q.url)&&(Q.evil=!0)}),H=Ca(H,function(Q){return!Q.evil}),H.length)K=A1(Ca(H,function(Q){return!Q.evil})),N.attribs[J]=K;else{delete N.attribs[J];return}}catch{delete N.attribs[J];return}if(J==="class"){const H=f[_],Q=f["*"],we=h[_],ge=c[_],me=c["*"],d0=h["*"],Bs=[we,d0].concat(ge,me).filter(function(h0){return h0});if(H&&Q?K=B(K,Ta(H,Q),Bs):K=B(K,H||Q,Bs),!K.length){delete N.attribs[J];return}}if(J==="style"){if(e.parseStyleAttributes)try{const H=C1(_+" {"+K+"}",{map:!1}),Q=v(H,e.allowedStyles);if(K=k(Q),K.length===0){delete N.attribs[J];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+_+" {"+K+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete N.attribs[J];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+J,K&&K.length?r+='="'+C(K,!0)+'"':e.allowedEmptyAttributes.includes(J)&&(r+='=""')}else delete N.attribs[J]}),e.selfClosing.indexOf(_)!==-1?r+=" />":(r+=">",N.innerText&&!R&&!e.textFilter&&(r+=C(N.innerText),T=!0)),q&&(r=u+C(r),u=""),N.openingTagLength=r.length-N.tagPosition},ontext:function(_){if(x)return;const O=g[g.length-1];let N;if(O&&(N=O.tag,_=O.innerText!==void 0?O.innerText:_),e.disallowedTagsMode==="completelyDiscard"&&!s(N))_="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(N==="script"||N==="style"))r+=_;else if(!T){const q=C(_,!1);e.textFilter?r+=e.textFilter(q,N):r+=q}if(g.length){const q=g[g.length-1];q.text+=_}},onclosetag:function(_,O){if(e.onCloseTag&&e.onCloseTag(_,O),x)if(w--,!w)x=!1;else return;const N=g.pop();if(!N)return;if(N.tag!==_){g.push(N);return}x=e.enforceHtmlBoundary?_==="html":!1,m--;const q=y[m];if(q){if(delete y[m],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){N.updateParentNodeText();return}u=r,r=""}if(b[m]&&(_=b[m],delete b[m]),e.exclusiveFilter){const R=e.exclusiveFilter(N);if(R==="excludeTag"){q&&(r=u,u=""),r=r.substring(0,N.tagPosition)+r.substring(N.tagPosition+N.openingTagLength);return}else if(R){r=r.substring(0,N.tagPosition);return}}if(N.updateParentNodeMediaChildren(),N.updateParentNodeText(),e.selfClosing.indexOf(_)!==-1||O&&!s(_)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){q&&(r=u,u="");return}r+="</"+_+">",q&&(r=u+C(r),u=""),T=!1}},e.parser);if(S.write(n),S.end(),e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape"){const _=S.endIndex;if(_!=null&&_>=0&&_<n.length){const O=n.substring(_);r+=C(O)}else(_==null||_<0)&&n.length>0&&r===""&&(r=C(n))}return r;function I(){r="",m=0,g=[],y={},b={},x=!1,w=0}function C(_,O){return typeof _!="string"&&(_=_+""),e.parser.decodeEntities&&(_=_.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),O&&(_=_.replace(/"/g,"&quot;"))),_=_.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),O&&(_=_.replace(/"/g,"&quot;")),_}function L(_,O){for(O=O.replace(/[\x00-\x20]+/g,"");;){const R=O.indexOf("<!--");if(R===-1)break;const V=O.indexOf("-->",R+4);if(V===-1)break;O=O.substring(0,R)+O.substring(V+3)}const N=O.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!N)return O.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const q=N[1].toLowerCase();return Ye(e.allowedSchemesByTag,_)?e.allowedSchemesByTag[_].indexOf(q)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(q)===-1}function U(_){if(_=_.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),_.startsWith("relative:"))throw new Error("relative: exploit attempt");let O="relative://relative-site";for(let R=0;R<100;R++)O+=`/${R}`;const N=new URL(_,O);return{isRelativeUrl:N&&N.hostname==="relative-site"&&N.protocol==="relative:",url:N}}function v(_,O){if(!O)return _;const N=_.nodes[0];let q;return O[N.selector]&&O["*"]?q=Ta(O[N.selector],O["*"]):q=O[N.selector]||O["*"],q&&(_.nodes[0].nodes=N.nodes.reduce(A(q),[])),_}function k(_){return _.nodes[0].nodes.reduce(function(O,N){return O.push(`${N.prop}:${N.value}${N.important?" !important":""}`),O},[]).join(";")}function A(_){return function(O,N){return Ye(_,N.prop)&&_[N.prop].some(function(R){return R.test(N.value)})&&O.push(N),O}}function B(_,O,N){return O?(_=_.split(/\s+/),_.filter(function(q){return O.indexOf(q)!==-1||N.some(function(R){return R.test(q)})}).join(" ")):_}}const P1={decodeEntities:!0};Gn.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};Gn.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,u){let i;if(t)for(i in e)u[i]=e[i];else u=e;return{tagName:n,attribs:u}}};const L1=ah(O1),f0=fn();class dr extends Cl{constructor(t,r,u,i,s){super(s);mn(this,"__src");mn(this,"__alt");mn(this,"__width");mn(this,"__height");this.__src=t,this.__alt=r,this.__width=u,this.__height=i}static getType(){return"image"}static clone(t){return new dr(t.__src,t.__alt,t.__width,t.__height,t.__key)}static importJSON(t){return zi({alt:t.alt,height:t.height,src:t.src,width:t.width})}exportJSON(){return{alt:this.__alt,height:this.__height,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:t=>({conversion:r=>{if(!(r instanceof HTMLImageElement))return null;const u=r.getAttribute("src")??"";if(!u)return null;const i=r.getAttribute("width"),s=r.getAttribute("height");return{node:zi({alt:r.getAttribute("alt")??"",height:s?Number(s):void 0,src:u,width:i?Number(i):void 0})}},priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__alt&&t.setAttribute("alt",this.__alt),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),{element:t}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(t){const r=this.getWritable();return r.__src=t,r}decorate(t){return W.jsx("img",{alt:this.__alt,height:this.__height,onClick:r=>{r.preventDefault(),t.dispatchCommand(f0,{key:this.getKey(),src:this.__src})},src:this.__src,width:this.__width})}}function zi({alt:n="",height:e,src:t,width:r}){return new dr(t,n,r,e)}function Ea(n){return n instanceof dr}const D1="_editor_nvulc_1",M1="_meta_nvulc_19",R1="_active_nvulc_27",B1="_bold_nvulc_39",F1="_italic_nvulc_43",j1="_link_nvulc_47",q1="_list_nvulc_53",U1="_paragraph_nvulc_54",Ue={editor:D1,meta:M1,active:R1,bold:B1,italic:F1,link:j1,list:q1,paragraph:U1},z1=()=>{const[n]=Ae(),[e,t]=z.useState(!1),[r,u]=z.useState(!1),[i,s]=z.useState(!1),[o,a]=z.useState(!1),[l,f]=z.useState(!1),[h,c]=z.useState(""),[d,p]=z.useState(null),[m,g]=z.useState(""),y=z.useRef(null),b=z.useRef(null),x=z.useRef(null),w=z.useRef(!1),T=R=>R.preventDefault(),S=z.useCallback(R=>{x.current=P(R)?R.clone():null},[]),I=z.useCallback(R=>{n.update(()=>{x.current&&ke(x.current)}),R(),x.current=null},[n]),C=R=>{w.current=!0,R.preventDefault()},L=()=>{if(w.current){w.current=!1;return}_()},U=z.useCallback(()=>{u(!1),c(""),p(null)},[]),v=z.useCallback(()=>{a(!1),g("")},[]),k=z.useCallback(R=>{u(!0),c((R==null?void 0:R.src)??""),p((R==null?void 0:R.key)??null),v(),setTimeout(()=>{var V;return(V=y.current)==null?void 0:V.focus()},0)},[v]),A=z.useCallback(R=>{n.getEditorState().read(()=>{S(j())}),a(!0),g(R),U(),setTimeout(()=>{var V;return(V=b.current)==null?void 0:V.focus()},0)},[U,n,S]),B=z.useCallback(()=>{I(()=>{n.dispatchCommand(nn,{url:m,target:"_blank"})}),v()},[v,n,m,I]),_=z.useCallback(()=>{const R=h.trim();if(!R){U();return}n.update(()=>{if(d){const V=ae(d);Ea(V)&&V.setSrc(R);return}fs([zi({src:R})])}),U()},[U,n,d,h]),O=z.useCallback(()=>{if(!d){U();return}n.update(()=>{const R=ae(d);if(Ea(R)){const V=R.getParent();Bt(V)&&V.getChildrenSize()===1?V.remove():R.remove()}}),U()},[U,n,d]),N=z.useCallback(()=>{I(()=>{n.dispatchCommand(nn,null)}),v()},[v,n,I]),q=z.useCallback(()=>{const R=j();if(!P(R)){if(Ee(R)){const ft=R.getNodes(),K=ft[0]??null,J=(K==null?void 0:K.getParent())??null;t(ft.some(H=>D(H)&&H.hasFormat("bold"))),s(ft.some(H=>D(H)&&H.hasFormat("italic"))),f(Z(J)||re(J)||Z(K)||re(K));const Ie=tt(K)?K:tt(J)?J:null;if(Ie){a(!0),g(Ie.getURL());return}a(!1),g(""),x.current=null;return}t(!1),s(!1),f(!1),a(!1),g(""),x.current=null;return}const[V]=R.getNodes(),Oe=(V==null?void 0:V.getParent())??null;if(t(R.hasFormat("bold")),s(R.hasFormat("italic")),f(Z(Oe)||re(Oe)),tt(Oe)){a(!0),g(Oe.getURL()),S(R);return}a(!1),g(""),x.current=null},[S]);return z.useEffect(()=>at(n.registerUpdateListener(({editorState:R})=>{R.read(()=>{q()})}),n.registerCommand(f0,R=>(k(R),!0),nt),n.registerCommand(du,()=>(n.getEditorState().read(()=>{q()}),!1),nt)),[n,k,q]),W.jsxs(m0.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[W.jsx(Ke.Button,{"aria-label":"Bold","data-active":e,onClick:()=>{n.dispatchCommand($e,"bold")},title:"Bold",variant:"minimal",children:W.jsx(Je.Icon,{name:"bold"})}),W.jsx(Ke.Button,{"aria-label":"Italic","data-active":i,onClick:()=>{n.dispatchCommand($e,"italic")},title:"Italic",variant:"minimal",children:W.jsx(Je.Icon,{name:"italic"})}),W.jsx(Ke.Button,{"aria-label":"List","data-active":l,onClick:()=>{l?n.dispatchCommand($l,void 0):n.dispatchCommand(Wl,void 0)},title:"List",variant:"minimal",children:W.jsx(Je.Icon,{name:"list"})}),W.jsx(Ke.Button,{"aria-label":"Link","data-active":o,onClick:()=>{o?N():(n.dispatchCommand(nn,{url:"https://"}),A("https://"))},title:"Link",variant:"minimal",children:W.jsx(Je.Icon,{name:"link"})}),W.jsx(Ke.Button,{"aria-label":"Image","data-active":r,onClick:()=>{r?U():k()},title:"Image",variant:"minimal",children:W.jsx(Je.Icon,{name:"image"})}),W.jsxs("div",{className:js.t(Ue.meta,o||r?Ue.active:""),children:[o&&W.jsxs(W.Fragment,{children:[W.jsx(qs.Input,{onBlur:()=>B(),onChange:R=>g(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),B())},ref:b,value:m}),W.jsx(Ke.Button,{"aria-label":"Apply link",onClick:()=>{B()},onMouseDown:T,variant:"minimal",children:W.jsx(Je.Icon,{name:"check",variant:"primary"})}),W.jsx(Ke.Button,{"aria-label":"Remove link",onClick:()=>N(),onMouseDown:T,variant:"minimal",children:W.jsx(Je.Icon,{name:"trash",variant:"danger"})})]}),r&&W.jsxs(W.Fragment,{children:[W.jsx(qs.Input,{className:js.t(Ue.active),onBlur:L,onChange:R=>c(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),w.current=!0,_())},ref:y,value:h}),W.jsx(Ke.Button,{"aria-label":"Apply image",onClick:()=>_(),onMouseDown:C,variant:"minimal",children:W.jsx(Je.Icon,{name:"check",variant:"primary"})}),W.jsx(Ke.Button,{"aria-label":"Remove image",onClick:()=>O(),onMouseDown:C,variant:"minimal",children:W.jsx(Je.Icon,{name:"trash",variant:"danger"})})]})]})]})},W1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,$1=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,H1=[n=>{const e=W1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=$1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function V1(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function G1({content:n=""}){const[e]=Ae();return z.useEffect(()=>{e.update(()=>{const r=new DOMParser().parseFromString(n,"text/html"),u=Ll(e,r);ie().clear().select(),fs(u),ke(null)})},[e,n]),null}const K1=({autofocus:n=!1,autolink:e=!1,content:t,inline:r=!1,onChange:u})=>{const i={namespace:"Editor",theme:{link:Ue.link,list:{ol:Ue.list,ul:Ue.list},paragraph:Ue.paragraph,text:{bold:Ue.bold,italic:Ue.italic}},onError(s){throw s},nodes:[ku,ur,hn,ir,dr]};return W.jsx("div",{className:Ue.editor,"data-component":"editor",children:W.jsxs(yd,{initialConfig:i,children:[!r&&W.jsx(z1,{}),W.jsx(sh,{contentEditable:W.jsx(Cd,{}),ErrorBoundary:Ad}),n&&W.jsx(ad,{}),e&&W.jsx(md,{matchers:H1}),W.jsx(Bd,{}),t&&W.jsx(G1,{content:t}),W.jsx(Fd,{validateUrl:V1}),W.jsx(jd,{}),u&&W.jsx(Ud,{onChange:(s,o)=>{s.read(()=>{const a=Dl(o,null),l=L1(a,{allowedTags:["a","b","br","i","img","li","ol","p","ul"]});u(l)})}})]})})};exports.Editor=K1;
57
+ `)});const o=e.nonTextTags||["script","style","textarea","option"];let a,l;e.allowedAttributes&&(a={},l={},Xt(e.allowedAttributes,function(_,O){a[O]=[];const N=[];_.forEach(function(q){typeof q=="string"&&q.indexOf("*")>=0?N.push(Sa(q).replace(/\\\*/g,".*")):a[O].push(q)}),N.length&&(l[O]=new RegExp("^("+N.join("|")+")$"))}));const f={},h={},c={};Xt(e.allowedClasses,function(_,O){if(a&&(Ye(a,O)||(a[O]=[]),a[O].push("class")),f[O]=_,Array.isArray(_)){const N=[];f[O]=[],c[O]=[],_.forEach(function(q){typeof q=="string"&&q.indexOf("*")>=0?N.push(Sa(q).replace(/\\\*/g,".*")):q instanceof RegExp?c[O].push(q):f[O].push(q)}),N.length&&(h[O]=new RegExp("^("+N.join("|")+")$"))}});const d={};let p;Xt(e.transformTags,function(_,O){let N;typeof _=="function"?N=_:typeof _=="string"&&(N=Gn.simpleTransform(_)),O==="*"?p=N:d[O]=N});let m,g,y,b,x,w,T=!1;I();const S=new w1.Parser({onopentag:function(_,O){if(e.onOpenTag&&e.onOpenTag(_,O),e.enforceHtmlBoundary&&_==="html"&&I(),x){w++;return}const N=new i(_,O);g.push(N);let q=!1;const R=!!N.text;let V;if(Ye(d,_)&&(V=d[_](_,O),N.attribs=O=V.attribs,V.text!==void 0&&(N.innerText=V.text),_!==V.tagName&&(N.name=_=V.tagName,b[m]=V.tagName)),p&&(V=p(_,O),N.attribs=O=V.attribs,_!==V.tagName&&(N.name=_=V.tagName,b[m]=V.tagName)),(!s(_)||e.disallowedTagsMode==="recursiveEscape"&&!N1(y)||e.nestingLimit!=null&&m>=e.nestingLimit)&&(q=!0,y[m]=!0,(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&o.indexOf(_)!==-1&&(x=!0,w=1)),m++,q){if(e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){if(N.innerText&&!R){const K=C(N.innerText);e.textFilter?r+=e.textFilter(K,_):r+=K,T=!0}return}u=r,r=""}r+="<"+_,_==="script"&&(e.allowedScriptHostnames||e.allowedScriptDomains)&&(N.innerText=""),q&&(e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape")&&e.preserveEscapedAttributes?Xt(O,function(K,J){r+=" "+J+'="'+C(K||"",!0)+'"'}):(!a||Ye(a,_)||a["*"])&&Xt(O,function(K,J){if(!I1.test(J)){delete N.attribs[J];return}if(K===""&&!e.allowedEmptyAttributes.includes(J)&&(e.nonBooleanAttributes.includes(J)||e.nonBooleanAttributes.includes("*"))){delete N.attribs[J];return}let Ie=!1;if(!a||Ye(a,_)&&a[_].indexOf(J)!==-1||a["*"]&&a["*"].indexOf(J)!==-1||Ye(l,_)&&l[_].test(J)||l["*"]&&l["*"].test(J))Ie=!0;else if(a&&a[_]){for(const H of a[_])if(S1(H)&&H.name&&H.name===J){Ie=!0;let Q="";if(H.multiple===!0){const we=K.split(" ");for(const ge of we)H.values.indexOf(ge)!==-1&&(Q===""?Q=ge:Q+=" "+ge)}else H.values.indexOf(K)>=0&&(Q=K);K=Q}}if(Ie){if(e.allowedSchemesAppliedToAttributes.indexOf(J)!==-1&&L(_,K)){delete N.attribs[J];return}if(_==="script"&&J==="src"){let H=!0;try{const Q=U(K);if(e.allowedScriptHostnames||e.allowedScriptDomains){const we=(e.allowedScriptHostnames||[]).find(function(me){return me===Q.url.hostname}),ge=(e.allowedScriptDomains||[]).find(function(me){return Q.url.hostname===me||Q.url.hostname.endsWith(`.${me}`)});H=we||ge}}catch{H=!1}if(!H){delete N.attribs[J];return}}if(_==="iframe"&&J==="src"){let H=!0;try{const Q=U(K);if(Q.isRelativeUrl)H=Ye(e,"allowIframeRelativeUrls")?e.allowIframeRelativeUrls:!e.allowedIframeHostnames&&!e.allowedIframeDomains;else if(e.allowedIframeHostnames||e.allowedIframeDomains){const we=(e.allowedIframeHostnames||[]).find(function(me){return me===Q.url.hostname}),ge=(e.allowedIframeDomains||[]).find(function(me){return Q.url.hostname===me||Q.url.hostname.endsWith(`.${me}`)});H=we||ge}}catch{H=!1}if(!H){delete N.attribs[J];return}}if(J==="srcset")try{let H=T1(K);if(H.forEach(function(Q){L("srcset",Q.url)&&(Q.evil=!0)}),H=Ca(H,function(Q){return!Q.evil}),H.length)K=A1(Ca(H,function(Q){return!Q.evil})),N.attribs[J]=K;else{delete N.attribs[J];return}}catch{delete N.attribs[J];return}if(J==="class"){const H=f[_],Q=f["*"],we=h[_],ge=c[_],me=c["*"],d0=h["*"],Bs=[we,d0].concat(ge,me).filter(function(h0){return h0});if(H&&Q?K=B(K,Ta(H,Q),Bs):K=B(K,H||Q,Bs),!K.length){delete N.attribs[J];return}}if(J==="style"){if(e.parseStyleAttributes)try{const H=C1(_+" {"+K+"}",{map:!1}),Q=v(H,e.allowedStyles);if(K=k(Q),K.length===0){delete N.attribs[J];return}}catch{typeof window<"u"&&console.warn('Failed to parse "'+_+" {"+K+`}", If you're running this in a browser, we recommend to disable style parsing: options.parseStyleAttributes: false, since this only works in a node environment due to a postcss dependency, More info: https://github.com/apostrophecms/sanitize-html/issues/547`),delete N.attribs[J];return}else if(e.allowedStyles)throw new Error("allowedStyles option cannot be used together with parseStyleAttributes: false.")}r+=" "+J,K&&K.length?r+='="'+C(K,!0)+'"':e.allowedEmptyAttributes.includes(J)&&(r+='=""')}else delete N.attribs[J]}),e.selfClosing.indexOf(_)!==-1?r+=" />":(r+=">",N.innerText&&!R&&!e.textFilter&&(r+=C(N.innerText),T=!0)),q&&(r=u+C(r),u=""),N.openingTagLength=r.length-N.tagPosition},ontext:function(_){if(x)return;const O=g[g.length-1];let N;if(O&&(N=O.tag,_=O.innerText!==void 0?O.innerText:_),e.disallowedTagsMode==="completelyDiscard"&&!s(N))_="";else if((e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard")&&(N==="script"||N==="style"))r+=_;else if(!T){const q=C(_,!1);e.textFilter?r+=e.textFilter(q,N):r+=q}if(g.length){const q=g[g.length-1];q.text+=_}},onclosetag:function(_,O){if(e.onCloseTag&&e.onCloseTag(_,O),x)if(w--,!w)x=!1;else return;const N=g.pop();if(!N)return;if(N.tag!==_){g.push(N);return}x=e.enforceHtmlBoundary?_==="html":!1,m--;const q=y[m];if(q){if(delete y[m],e.disallowedTagsMode==="discard"||e.disallowedTagsMode==="completelyDiscard"){N.updateParentNodeText();return}u=r,r=""}if(b[m]&&(_=b[m],delete b[m]),e.exclusiveFilter){const R=e.exclusiveFilter(N);if(R==="excludeTag"){q&&(r=u,u=""),r=r.substring(0,N.tagPosition)+r.substring(N.tagPosition+N.openingTagLength);return}else if(R){r=r.substring(0,N.tagPosition);return}}if(N.updateParentNodeMediaChildren(),N.updateParentNodeText(),e.selfClosing.indexOf(_)!==-1||O&&!s(_)&&["escape","recursiveEscape"].indexOf(e.disallowedTagsMode)>=0){q&&(r=u,u="");return}r+="</"+_+">",q&&(r=u+C(r),u=""),T=!1}},e.parser);if(S.write(n),S.end(),e.disallowedTagsMode==="escape"||e.disallowedTagsMode==="recursiveEscape"){const _=S.endIndex;if(_!=null&&_>=0&&_<n.length){const O=n.substring(_);r+=C(O)}else(_==null||_<0)&&n.length>0&&r===""&&(r=C(n))}return r;function I(){r="",m=0,g=[],y={},b={},x=!1,w=0}function C(_,O){return typeof _!="string"&&(_=_+""),e.parser.decodeEntities&&(_=_.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),O&&(_=_.replace(/"/g,"&quot;"))),_=_.replace(/&(?![a-zA-Z0-9#]{1,20};)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),O&&(_=_.replace(/"/g,"&quot;")),_}function L(_,O){for(O=O.replace(/[\x00-\x20]+/g,"");;){const R=O.indexOf("<!--");if(R===-1)break;const V=O.indexOf("-->",R+4);if(V===-1)break;O=O.substring(0,R)+O.substring(V+3)}const N=O.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);if(!N)return O.match(/^[/\\]{2}/)?!e.allowProtocolRelative:!1;const q=N[1].toLowerCase();return Ye(e.allowedSchemesByTag,_)?e.allowedSchemesByTag[_].indexOf(q)===-1:!e.allowedSchemes||e.allowedSchemes.indexOf(q)===-1}function U(_){if(_=_.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/,"$1//"),_.startsWith("relative:"))throw new Error("relative: exploit attempt");let O="relative://relative-site";for(let R=0;R<100;R++)O+=`/${R}`;const N=new URL(_,O);return{isRelativeUrl:N&&N.hostname==="relative-site"&&N.protocol==="relative:",url:N}}function v(_,O){if(!O)return _;const N=_.nodes[0];let q;return O[N.selector]&&O["*"]?q=Ta(O[N.selector],O["*"]):q=O[N.selector]||O["*"],q&&(_.nodes[0].nodes=N.nodes.reduce(A(q),[])),_}function k(_){return _.nodes[0].nodes.reduce(function(O,N){return O.push(`${N.prop}:${N.value}${N.important?" !important":""}`),O},[]).join(";")}function A(_){return function(O,N){return Ye(_,N.prop)&&_[N.prop].some(function(R){return R.test(N.value)})&&O.push(N),O}}function B(_,O,N){return O?(_=_.split(/\s+/),_.filter(function(q){return O.indexOf(q)!==-1||N.some(function(R){return R.test(q)})}).join(" ")):_}}const P1={decodeEntities:!0};Gn.defaults={allowedTags:["address","article","aside","footer","header","h1","h2","h3","h4","h5","h6","hgroup","main","nav","section","blockquote","dd","div","dl","dt","figcaption","figure","hr","li","menu","ol","p","pre","ul","a","abbr","b","bdi","bdo","br","cite","code","data","dfn","em","i","kbd","mark","q","rb","rp","rt","rtc","ruby","s","samp","small","span","strong","sub","sup","time","u","var","wbr","caption","col","colgroup","table","tbody","td","tfoot","th","thead","tr"],nonBooleanAttributes:["abbr","accept","accept-charset","accesskey","action","allow","alt","as","autocapitalize","autocomplete","blocking","charset","cite","class","color","cols","colspan","content","contenteditable","coords","crossorigin","data","datetime","decoding","dir","dirname","download","draggable","enctype","enterkeyhint","fetchpriority","for","form","formaction","formenctype","formmethod","formtarget","headers","height","hidden","high","href","hreflang","http-equiv","id","imagesizes","imagesrcset","inputmode","integrity","is","itemid","itemprop","itemref","itemtype","kind","label","lang","list","loading","low","max","maxlength","media","method","min","minlength","name","nonce","optimum","pattern","ping","placeholder","popover","popovertarget","popovertargetaction","poster","preload","referrerpolicy","rel","rows","rowspan","sandbox","scope","shape","size","sizes","slot","span","spellcheck","src","srcdoc","srclang","srcset","start","step","style","tabindex","target","title","translate","type","usemap","value","width","wrap","onauxclick","onafterprint","onbeforematch","onbeforeprint","onbeforeunload","onbeforetoggle","onblur","oncancel","oncanplay","oncanplaythrough","onchange","onclick","onclose","oncontextlost","oncontextmenu","oncontextrestored","oncopy","oncuechange","oncut","ondblclick","ondrag","ondragend","ondragenter","ondragleave","ondragover","ondragstart","ondrop","ondurationchange","onemptied","onended","onerror","onfocus","onformdata","onhashchange","oninput","oninvalid","onkeydown","onkeypress","onkeyup","onlanguagechange","onload","onloadeddata","onloadedmetadata","onloadstart","onmessage","onmessageerror","onmousedown","onmouseenter","onmouseleave","onmousemove","onmouseout","onmouseover","onmouseup","onoffline","ononline","onpagehide","onpageshow","onpaste","onpause","onplay","onplaying","onpopstate","onprogress","onratechange","onreset","onresize","onrejectionhandled","onscroll","onscrollend","onsecuritypolicyviolation","onseeked","onseeking","onselect","onslotchange","onstalled","onstorage","onsubmit","onsuspend","ontimeupdate","ontoggle","onunhandledrejection","onunload","onvolumechange","onwaiting","onwheel"],disallowedTagsMode:"discard",allowedAttributes:{a:["href","name","target"],img:["src","srcset","alt","title","width","height","loading"]},allowedEmptyAttributes:["alt"],selfClosing:["img","br","hr","area","base","basefont","input","link","meta"],allowedSchemes:["http","https","ftp","mailto","tel"],allowedSchemesByTag:{},allowedSchemesAppliedToAttributes:["href","src","cite"],allowProtocolRelative:!0,enforceHtmlBoundary:!1,parseStyleAttributes:!0,preserveEscapedAttributes:!1};Gn.simpleTransform=function(n,e,t){return t=t===void 0?!0:t,e=e||{},function(r,u){let i;if(t)for(i in e)u[i]=e[i];else u=e;return{tagName:n,attribs:u}}};const L1=ah(O1),f0=fn();class dr extends Cl{constructor(t,r,u,i,s){super(s);mn(this,"__src");mn(this,"__alt");mn(this,"__width");mn(this,"__height");this.__src=t,this.__alt=r,this.__width=u,this.__height=i}static getType(){return"image"}static clone(t){return new dr(t.__src,t.__alt,t.__width,t.__height,t.__key)}static importJSON(t){return zi({alt:t.alt,height:t.height,src:t.src,width:t.width})}exportJSON(){return{alt:this.__alt,height:this.__height,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:t=>({conversion:r=>{if(!(r instanceof HTMLImageElement))return null;const u=r.getAttribute("src")??"";if(!u)return null;const i=r.getAttribute("width"),s=r.getAttribute("height");return{node:zi({alt:r.getAttribute("alt")??"",height:s?Number(s):void 0,src:u,width:i?Number(i):void 0})}},priority:0})}}exportDOM(){const t=document.createElement("img");return t.setAttribute("src",this.__src),this.__alt&&t.setAttribute("alt",this.__alt),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),{element:t}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(t){const r=this.getWritable();return r.__src=t,r}decorate(t){return W.jsx("img",{alt:this.__alt,height:this.__height,onClick:r=>{r.preventDefault(),t.dispatchCommand(f0,{key:this.getKey(),src:this.__src})},src:this.__src,width:this.__width})}}function zi({alt:n="",height:e,src:t,width:r}){return new dr(t,n,r,e)}function Ea(n){return n instanceof dr}const D1="_editor_11hrr_1",M1="_meta_11hrr_19",R1="_active_11hrr_27",B1="_bold_11hrr_39",F1="_italic_11hrr_43",j1="_link_11hrr_47",q1="_list_11hrr_53",U1="_paragraph_11hrr_54",Ue={editor:D1,meta:M1,active:R1,bold:B1,italic:F1,link:j1,list:q1,paragraph:U1},z1=()=>{const[n]=Ae(),[e,t]=z.useState(!1),[r,u]=z.useState(!1),[i,s]=z.useState(!1),[o,a]=z.useState(!1),[l,f]=z.useState(!1),[h,c]=z.useState(""),[d,p]=z.useState(null),[m,g]=z.useState(""),y=z.useRef(null),b=z.useRef(null),x=z.useRef(null),w=z.useRef(!1),T=R=>R.preventDefault(),S=z.useCallback(R=>{x.current=P(R)?R.clone():null},[]),I=z.useCallback(R=>{n.update(()=>{x.current&&ke(x.current)}),R(),x.current=null},[n]),C=R=>{w.current=!0,R.preventDefault()},L=()=>{if(w.current){w.current=!1;return}_()},U=z.useCallback(()=>{u(!1),c(""),p(null)},[]),v=z.useCallback(()=>{a(!1),g("")},[]),k=z.useCallback(R=>{u(!0),c((R==null?void 0:R.src)??""),p((R==null?void 0:R.key)??null),v(),setTimeout(()=>{var V;return(V=y.current)==null?void 0:V.focus()},0)},[v]),A=z.useCallback(R=>{n.getEditorState().read(()=>{S(j())}),a(!0),g(R),U(),setTimeout(()=>{var V;return(V=b.current)==null?void 0:V.focus()},0)},[U,n,S]),B=z.useCallback(()=>{I(()=>{n.dispatchCommand(nn,{url:m,target:"_blank"})}),v()},[v,n,m,I]),_=z.useCallback(()=>{const R=h.trim();if(!R){U();return}n.update(()=>{if(d){const V=ae(d);Ea(V)&&V.setSrc(R);return}fs([zi({src:R})])}),U()},[U,n,d,h]),O=z.useCallback(()=>{if(!d){U();return}n.update(()=>{const R=ae(d);if(Ea(R)){const V=R.getParent();Bt(V)&&V.getChildrenSize()===1?V.remove():R.remove()}}),U()},[U,n,d]),N=z.useCallback(()=>{I(()=>{n.dispatchCommand(nn,null)}),v()},[v,n,I]),q=z.useCallback(()=>{const R=j();if(!P(R)){if(Ee(R)){const ft=R.getNodes(),K=ft[0]??null,J=(K==null?void 0:K.getParent())??null;t(ft.some(H=>D(H)&&H.hasFormat("bold"))),s(ft.some(H=>D(H)&&H.hasFormat("italic"))),f(Z(J)||re(J)||Z(K)||re(K));const Ie=tt(K)?K:tt(J)?J:null;if(Ie){a(!0),g(Ie.getURL());return}a(!1),g(""),x.current=null;return}t(!1),s(!1),f(!1),a(!1),g(""),x.current=null;return}const[V]=R.getNodes(),Oe=(V==null?void 0:V.getParent())??null;if(t(R.hasFormat("bold")),s(R.hasFormat("italic")),f(Z(Oe)||re(Oe)),tt(Oe)){a(!0),g(Oe.getURL()),S(R);return}a(!1),g(""),x.current=null},[S]);return z.useEffect(()=>at(n.registerUpdateListener(({editorState:R})=>{R.read(()=>{q()})}),n.registerCommand(f0,R=>(k(R),!0),nt),n.registerCommand(du,()=>(n.getEditorState().read(()=>{q()}),!1),nt)),[n,k,q]),W.jsxs(m0.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[W.jsx(Ke.Button,{"aria-label":"Bold","data-active":e,onClick:()=>{n.dispatchCommand($e,"bold")},title:"Bold",variant:"minimal",children:W.jsx(Je.Icon,{name:"bold"})}),W.jsx(Ke.Button,{"aria-label":"Italic","data-active":i,onClick:()=>{n.dispatchCommand($e,"italic")},title:"Italic",variant:"minimal",children:W.jsx(Je.Icon,{name:"italic"})}),W.jsx(Ke.Button,{"aria-label":"List","data-active":l,onClick:()=>{l?n.dispatchCommand($l,void 0):n.dispatchCommand(Wl,void 0)},title:"List",variant:"minimal",children:W.jsx(Je.Icon,{name:"list"})}),W.jsx(Ke.Button,{"aria-label":"Link","data-active":o,onClick:()=>{o?N():(n.dispatchCommand(nn,{url:"https://"}),A("https://"))},title:"Link",variant:"minimal",children:W.jsx(Je.Icon,{name:"link"})}),W.jsx(Ke.Button,{"aria-label":"Image","data-active":r,onClick:()=>{r?U():k()},title:"Image",variant:"minimal",children:W.jsx(Je.Icon,{name:"image"})}),W.jsxs("div",{className:js.t(Ue.meta,o||r?Ue.active:""),children:[o&&W.jsxs(W.Fragment,{children:[W.jsx(qs.Input,{onBlur:()=>B(),onChange:R=>g(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),B())},ref:b,value:m}),W.jsx(Ke.Button,{"aria-label":"Apply link",onClick:()=>{B()},onMouseDown:T,variant:"minimal",children:W.jsx(Je.Icon,{name:"check",variant:"primary"})}),W.jsx(Ke.Button,{"aria-label":"Remove link",onClick:()=>N(),onMouseDown:T,variant:"minimal",children:W.jsx(Je.Icon,{name:"trash",variant:"danger"})})]}),r&&W.jsxs(W.Fragment,{children:[W.jsx(qs.Input,{className:js.t(Ue.active),onBlur:L,onChange:R=>c(R.target.value),onKeyDown:R=>{R.key==="Enter"&&(R.preventDefault(),w.current=!0,_())},ref:y,value:h}),W.jsx(Ke.Button,{"aria-label":"Apply image",onClick:()=>_(),onMouseDown:C,variant:"minimal",children:W.jsx(Je.Icon,{name:"check",variant:"primary"})}),W.jsx(Ke.Button,{"aria-label":"Remove image",onClick:()=>O(),onMouseDown:C,variant:"minimal",children:W.jsx(Je.Icon,{name:"trash",variant:"danger"})})]})]})]})},W1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,$1=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,H1=[n=>{const e=W1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:`mailto:${e[0]}`}:null},n=>{const e=$1.exec(n);return e!=null&&e.length?{index:e.index,length:e[0].length,text:e[0],url:e[0].startsWith("http")?e[0]:`https://${e[0]}`}:null}];function V1(n){try{const e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function G1({content:n=""}){const[e]=Ae();return z.useEffect(()=>{e.update(()=>{const r=new DOMParser().parseFromString(n,"text/html"),u=Ll(e,r);ie().clear().select(),fs(u),ke(null)})},[e,n]),null}const K1=({autofocus:n=!1,autolink:e=!1,content:t,inline:r=!1,onChange:u})=>{const i={namespace:"Editor",theme:{link:Ue.link,list:{ol:Ue.list,ul:Ue.list},paragraph:Ue.paragraph,text:{bold:Ue.bold,italic:Ue.italic}},onError(s){throw s},nodes:[ku,ur,hn,ir,dr]};return W.jsx("div",{className:Ue.editor,"data-component":"editor",children:W.jsxs(yd,{initialConfig:i,children:[!r&&W.jsx(z1,{}),W.jsx(sh,{contentEditable:W.jsx(Cd,{}),ErrorBoundary:Ad}),n&&W.jsx(ad,{}),e&&W.jsx(md,{matchers:H1}),W.jsx(Bd,{}),t&&W.jsx(G1,{content:t}),W.jsx(Fd,{validateUrl:V1}),W.jsx(jd,{}),u&&W.jsx(Ud,{onChange:(s,o)=>{s.read(()=>{const a=Dl(o,null),l=L1(a,{allowedTags:["a","b","br","i","img","li","ol","p","ul"]});u(l)})}})]})})};exports.Editor=K1;
58
58
  //# sourceMappingURL=index.cjs.map
@@ -11371,7 +11371,7 @@ function Ji({
11371
11371
  function Pa(n) {
11372
11372
  return n instanceof yr;
11373
11373
  }
11374
- const H1 = "_editor_nvulc_1", V1 = "_meta_nvulc_19", G1 = "_active_nvulc_27", K1 = "_bold_nvulc_39", J1 = "_italic_nvulc_43", X1 = "_link_nvulc_47", Z1 = "_list_nvulc_53", Q1 = "_paragraph_nvulc_54", $e = {
11374
+ const H1 = "_editor_11hrr_1", V1 = "_meta_11hrr_19", G1 = "_active_11hrr_27", K1 = "_bold_11hrr_39", J1 = "_italic_11hrr_43", X1 = "_link_11hrr_47", Z1 = "_list_11hrr_53", Q1 = "_paragraph_11hrr_54", $e = {
11375
11375
  editor: H1,
11376
11376
  meta: V1,
11377
11377
  active: G1,
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index24.css');const D=require("react/jsx-runtime"),y=require("../../classix-5H4IWnMA.cjs"),o=require("react"),A=require("../../icons-vqS7W0cD.cjs"),H=require("../list/index.cjs"),M="_sortable_scp0q_5",V="_dragging_scp0q_35",k="_dropping_scp0q_50",z="_columns_scp0q_63",B="_pseudo_scp0q_72",c={sortable:M,dragging:V,dropping:k,columns:z,pseudo:B,"target-above":"_target-above_scp0q_87","target-below":"_target-below_scp0q_88"};function N({children:h,className:T,columns:g=1,isRearranging:d=!1,onChangeOrder:f,...b}){const x=Number.isFinite(g)?Math.max(1,Math.floor(g)):1,S=o.useMemo(()=>o.Children.toArray(h),[h]),n=o.useRef(-1),[p,I]=o.useState({height:0,width:0}),[a,m]=o.useState(null),[E,q]=o.useState(null),$={...b.style,"--icon-svg":A.iconSVG("sort",!0),"--height":`${p.height}px`,"--width":x>1?`calc(${p.width}px - var(--utils-tokens-unit))`:`${p.width}px`},v=()=>{n.current=-1,m(null)};return o.useEffect(()=>{d||q(null)},[d]),D.jsx(H.List,{className:y.t(T,c.sortable,x>1&&c.columns),columns:g,ordered:!0,style:$,...b,"data-component":"sortable",children:S.map((_,t)=>{const j=o.isValidElement(_)?_.key:null;return D.jsx("li",{className:y.t(a!==null&&a>t-10&&a<t+10&&c.pseudo,a===t&&n.current<t&&c["target-below"],a===t&&n.current>t&&c["target-above"],n.current===t&&c.dragging,E===t&&d&&c.dropping),draggable:!d,onDragEnd:()=>v(),onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move";const r=n.current;if(r<0||r===t)return;const s=e.currentTarget.getBoundingClientRect(),l=t===r+1?p.height:s.height,u=e.clientY>s.top+l/2?t+1:t,i=u>r?u-1:u;m(i)},onDragStart:e=>{n.current=t,I({height:e.currentTarget.offsetHeight,width:e.currentTarget.offsetWidth}),e.dataTransfer.setData("text/plain",""),e.dataTransfer.effectAllowed="move",m(t)},onDrop:e=>{e.preventDefault();const r=n.current,s=a;if(r<0||s===null||r===s)return;q(s);const l=S.slice(),[w]=l.splice(r,1);l.splice(s,0,w),f==null||f(l.map((u,i)=>({id:String(o.isValidElement(u)?u.props["data-id"]??`idx-${i}`:`idx-${i}`),weight:l.length-1-i}))),v()},"data-component":"sortable",children:_},j??t)})})}exports.Sortable=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index24.css');const y=require("react/jsx-runtime"),T=require("../../classix-5H4IWnMA.cjs"),o=require("react"),A=require("../../icons-vqS7W0cD.cjs"),H=require("../list/index.cjs"),M="_sortable_c1ptl_5",V="_dragging_c1ptl_35",z="_dropping_c1ptl_50",B="_columns_c1ptl_63",N="_pseudo_c1ptl_73",c={sortable:M,dragging:V,dropping:z,columns:B,pseudo:N,"target-above":"_target-above_c1ptl_88","target-below":"_target-below_c1ptl_89"};function k({children:h,className:I,columns:g=1,isRearranging:d=!1,onChangeOrder:f,...b}){const x=Number.isFinite(g)?Math.max(1,Math.floor(g)):1,v=o.useMemo(()=>o.Children.toArray(h),[h]),n=o.useRef(-1),[p,q]=o.useState({height:0,width:0}),[a,m]=o.useState(null),[E,S]=o.useState(null),$={...b.style,"--icon-svg":A.iconSVG("sort",!0),"--height":`calc(${p.height}px - var(--scale-16))`,"--width":x>1?`calc(${p.width}px - var(--scale-16))`:`${p.width}px`},w=()=>{n.current=-1,m(null)};return o.useEffect(()=>{d||S(null)},[d]),y.jsx(H.List,{className:T.t(I,c.sortable,x>1&&c.columns),columns:g,ordered:!0,style:$,...b,"data-component":"sortable",children:v.map((_,t)=>{const j=o.isValidElement(_)?_.key:null;return y.jsx("li",{className:T.t(a!==null&&a>t-10&&a<t+10&&c.pseudo,a===t&&n.current<t&&c["target-below"],a===t&&n.current>t&&c["target-above"],n.current===t&&c.dragging,E===t&&d&&c.dropping),draggable:!d,onDragEnd:()=>w(),onDragOver:e=>{e.preventDefault(),e.dataTransfer.dropEffect="move";const r=n.current;if(r<0||r===t)return;const s=e.currentTarget.getBoundingClientRect(),l=t===r+1?p.height:s.height,u=e.clientY>s.top+l/2?t+1:t,i=u>r?u-1:u;m(i)},onDragStart:e=>{n.current=t,q({height:e.currentTarget.offsetHeight,width:e.currentTarget.offsetWidth}),e.dataTransfer.setData("text/plain",""),e.dataTransfer.effectAllowed="move",m(t)},onDrop:e=>{e.preventDefault();const r=n.current,s=a;if(r<0||s===null||r===s)return;S(s);const l=v.slice(),[D]=l.splice(r,1);l.splice(s,0,D),f==null||f(l.map((u,i)=>({id:String(o.isValidElement(u)?u.props["data-id"]??`idx-${i}`:`idx-${i}`),weight:l.length-1-i}))),w()},"data-component":"sortable",children:_},j??t)})})}exports.Sortable=k;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/_sortable/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { List } from '@/components/list';\n\nimport styles from './styles.module.css';\n\ntype SortItem = { id: string; weight: number };\n\ntype SortableProps = React.ComponentPropsWithoutRef<'ol'> & {\n columns?: number;\n isRearranging?: boolean;\n onChangeOrder: (order: SortItem[]) => void;\n};\n\ntype withVars = React.CSSProperties & {\n '--height'?: string;\n '--width'?: string;\n '--icon-svg'?: string;\n};\n\n/**\n * Children must provide a stable `data-id` for emits `{ id, weight }` and `key` (reconciliation).\n */\n\nexport function Sortable({\n children,\n className,\n columns = 1,\n isRearranging = false,\n onChangeOrder,\n ...props\n}: SortableProps) {\n const cols = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;\n const arr = useMemo(() => React.Children.toArray(children), [children]);\n const drag = useRef(-1);\n const [zoneSize, setZoneSize] = useState({\n height: 0,\n width: 0,\n });\n const [dropIndex, setDropIndex] = useState<number | null>(null);\n const [droppedAtIndex, setDroppedAtIndex] = useState<number | null>(null);\n const withVars: withVars = {\n ...props.style,\n '--icon-svg': iconSVG('sort', true),\n '--height': `${zoneSize.height}px`,\n '--width':\n cols > 1 ? `calc(${zoneSize.width}px - var(--utils-tokens-unit))` : `${zoneSize.width}px`,\n };\n\n const resetDragState = () => {\n drag.current = -1;\n setDropIndex(null);\n };\n\n useEffect(() => {\n if (!isRearranging) {\n setDroppedAtIndex(null);\n }\n }, [isRearranging]);\n\n return (\n <List\n className={cx(className, styles.sortable, cols > 1 && styles.columns)}\n columns={columns}\n ordered\n style={withVars}\n {...props}\n >\n {arr.map((child, i) => {\n const key = React.isValidElement(child) ? child.key : null;\n\n return (\n <li\n key={key ?? i}\n className={cx(\n dropIndex !== null && dropIndex > i - 10 && dropIndex < i + 10 && styles.pseudo,\n dropIndex === i && drag.current < i && styles['target-below'],\n dropIndex === i && drag.current > i && styles['target-above'],\n drag.current === i && styles.dragging,\n droppedAtIndex === i && isRearranging && styles.dropping\n )}\n draggable={!isRearranging}\n onDragEnd={() => resetDragState()}\n onDragOver={(e) => {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n const from = drag.current;\n if (from < 0 || from === i) return;\n\n const rect = e.currentTarget.getBoundingClientRect();\n const itemHeight = i === from + 1 ? zoneSize.height : rect.height;\n const isBottomHalf = e.clientY > rect.top + itemHeight / 2;\n const rawIndex = isBottomHalf ? i + 1 : i;\n const nextDropIndex = rawIndex > from ? rawIndex - 1 : rawIndex;\n\n setDropIndex(nextDropIndex);\n }}\n onDragStart={(e) => {\n drag.current = i;\n setZoneSize({\n height: e.currentTarget.offsetHeight,\n width: e.currentTarget.offsetWidth,\n });\n e.dataTransfer.setData('text/plain', '');\n e.dataTransfer.effectAllowed = 'move';\n setDropIndex(i);\n }}\n onDrop={(e) => {\n e.preventDefault();\n const from = drag.current;\n const to = dropIndex;\n if (from < 0 || to === null || from === to) return;\n\n setDroppedAtIndex(to);\n const next = arr.slice();\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n\n onChangeOrder?.(\n next.map((c, idx) => ({\n id: String(\n React.isValidElement(c)\n ? ((c.props as { 'data-id'?: string })['data-id'] ?? `idx-${idx}`)\n : `idx-${idx}`\n ),\n\n weight: next.length - 1 - idx,\n }))\n );\n\n resetDragState();\n }}\n >\n {child}\n </li>\n );\n })}\n </List>\n );\n}\n"],"names":["Sortable","children","className","columns","isRearranging","onChangeOrder","props","cols","Number","isFinite","Math","max","floor","arr","useMemo","React","Children","toArray","drag","useRef","zoneSize","setZoneSize","useState","height","width","dropIndex","setDropIndex","droppedAtIndex","setDroppedAtIndex","withVars","style","iconSVG","resetDragState","current","useEffect","jsx","List","cx","styles","sortable","map","child","i","key","isValidElement","pseudo","dragging","dropping","e","preventDefault","dataTransfer","dropEffect","from","rect","currentTarget","getBoundingClientRect","itemHeight","rawIndex","clientY","top","nextDropIndex","offsetHeight","offsetWidth","setData","effectAllowed","to","next","slice","moved","splice","c","idx","id","String","weight","length"],"mappings":"4eA0BO,SAASA,EAAS,CACvBC,SAAAA,EACAC,UAAAA,EACAC,QAAAA,EAAU,EACVC,cAAAA,EAAgB,GAChBC,cAAAA,EACA,GAAGC,CACU,EAAG,CAChB,MAAMC,EAAOC,OAAOC,SAASN,CAAO,EAAIO,KAAKC,IAAI,EAAGD,KAAKE,MAAMT,CAAO,CAAC,EAAI,EACrEU,EAA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iBAAA,WAEDS,SAAAA,CAAAA,EA5DIE,GAAOD,CA6Dd,CAEJ,CAAC,CAAA,CACH,CAEJ"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/_sortable/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { List } from '@/components/list';\n\nimport styles from './styles.module.css';\n\ntype SortItem = { id: string; weight: number };\n\ntype SortableProps = React.ComponentPropsWithoutRef<'ol'> & {\n columns?: number;\n isRearranging?: boolean;\n onChangeOrder: (order: SortItem[]) => void;\n};\n\ntype withVars = React.CSSProperties & {\n '--height'?: string;\n '--width'?: string;\n '--icon-svg'?: string;\n};\n\n/**\n * Children must provide a stable `data-id` for emits `{ id, weight }` and `key` (reconciliation).\n */\n\nexport function Sortable({\n children,\n className,\n columns = 1,\n isRearranging = false,\n onChangeOrder,\n ...props\n}: SortableProps) {\n const cols = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;\n const arr = useMemo(() => React.Children.toArray(children), [children]);\n const drag = useRef(-1);\n const [zoneSize, setZoneSize] = useState({\n height: 0,\n width: 0,\n });\n const [dropIndex, setDropIndex] = useState<number | null>(null);\n const [droppedAtIndex, setDroppedAtIndex] = useState<number | null>(null);\n const withVars: withVars = {\n ...props.style,\n '--icon-svg': iconSVG('sort', true),\n '--height': `calc(${zoneSize.height}px - var(--scale-16))`,\n '--width': cols > 1 ? `calc(${zoneSize.width}px - var(--scale-16))` : `${zoneSize.width}px`,\n };\n\n const resetDragState = () => {\n drag.current = -1;\n setDropIndex(null);\n };\n\n useEffect(() => {\n if (!isRearranging) {\n setDroppedAtIndex(null);\n }\n }, [isRearranging]);\n\n return (\n <List\n className={cx(className, styles.sortable, cols > 1 && styles.columns)}\n columns={columns}\n ordered\n style={withVars}\n {...props}\n >\n {arr.map((child, i) => {\n const key = React.isValidElement(child) ? child.key : null;\n\n return (\n <li\n key={key ?? i}\n className={cx(\n dropIndex !== null && dropIndex > i - 10 && dropIndex < i + 10 && styles.pseudo,\n dropIndex === i && drag.current < i && styles['target-below'],\n dropIndex === i && drag.current > i && styles['target-above'],\n drag.current === i && styles.dragging,\n droppedAtIndex === i && isRearranging && styles.dropping\n )}\n draggable={!isRearranging}\n onDragEnd={() => resetDragState()}\n onDragOver={(e) => {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n const from = drag.current;\n if (from < 0 || from === i) return;\n\n const rect = e.currentTarget.getBoundingClientRect();\n const itemHeight = i === from + 1 ? zoneSize.height : rect.height;\n const isBottomHalf = e.clientY > rect.top + itemHeight / 2;\n const rawIndex = isBottomHalf ? i + 1 : i;\n const nextDropIndex = rawIndex > from ? rawIndex - 1 : rawIndex;\n\n setDropIndex(nextDropIndex);\n }}\n onDragStart={(e) => {\n drag.current = i;\n setZoneSize({\n height: e.currentTarget.offsetHeight,\n width: e.currentTarget.offsetWidth,\n });\n e.dataTransfer.setData('text/plain', '');\n e.dataTransfer.effectAllowed = 'move';\n setDropIndex(i);\n }}\n onDrop={(e) => {\n e.preventDefault();\n const from = drag.current;\n const to = dropIndex;\n if (from < 0 || to === null || from === to) return;\n\n setDroppedAtIndex(to);\n const next = arr.slice();\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n\n onChangeOrder?.(\n next.map((c, idx) => ({\n id: String(\n React.isValidElement(c)\n ? ((c.props as { 'data-id'?: string })['data-id'] ?? `idx-${idx}`)\n : `idx-${idx}`\n ),\n\n weight: next.length - 1 - idx,\n }))\n );\n\n resetDragState();\n }}\n >\n {child}\n </li>\n );\n })}\n </List>\n );\n}\n"],"names":["Sortable","children","className","columns","isRearranging","onChangeOrder","props","cols","Number","isFinite","Math","max","floor","arr","useMemo","React","Children","toArray","drag","useRef","zoneSize","setZoneSize","useState","height","width","dropIndex","setDropIndex","droppedAtIndex","setDroppedAtIndex","withVars","style","iconSVG","resetDragState","current","useEffect","jsx","List","cx","styles","sortable","map","child","i","key","isValidElement","pseudo","dragging","dropping","e","preventDefault","dataTransfer","dropEffect","from","rect","currentTarget","getBoundingClientRect","itemHeight","rawIndex","clientY","top","nextDropIndex","offsetHeight","offsetWidth","setData","effectAllowed","to","next","slice","moved","splice","c","idx","id","String","weight","length"],"mappings":"4eA0BO,SAASA,EAAS,CACvBC,SAAAA,EACAC,UAAAA,EACAC,QAAAA,EAAU,EACVC,cAAAA,EAAgB,GAChBC,cAAAA,EACA,GAAGC,CACU,EAAG,CAChB,MAAMC,EAAOC,OAAOC,SAASN,CAAO,EAAIO,KAAKC,IAAI,EAAGD,KAAKE,MAAMT,CAAO,CAAC,EAAI,EACrEU,EAAMC,UAAQ,IAAMC,EAAMC,SAASC,QAAQhB,CAAQ,EAAG,CAACA,CAAQ,CAAC,EAChEiB,EAAOC,EAAAA,OAAO,EAAE,EAChB,CAACC,EAAUC,CAAW,EAAIC,WAAS,CACvCC,OAAQ,EACRC,MAAO,CAAA,CACR,EACK,CAACC,EAAWC,CAAY,EAAIJ,EAAAA,SAAwB,IAAI,EACxD,CAACK,EAAgBC,CAAiB,EAAIN,EAAAA,SAAwB,IAAI,EAClEO,EAAqB,CACzB,GAAGvB,EAAMwB,MACT,aAAcC,EAAAA,QAAQ,OAAQ,EAAI,EAClC,WAAY,QAAQX,EAASG,MAAM,wBACnC,UAAWhB,EAAO,EAAI,QAAQa,EAASI,KAAK,wBAA0B,GAAGJ,EAASI,KAAK,IAAA,EAGnFQ,EAAiBA,IAAM,CAC3Bd,EAAKe,QAAU,GACfP,EAAa,IAAI,CACnB,EAEAQ,OAAAA,EAAAA,UAAU,IAAM,CACT9B,GACHwB,EAAkB,IAAI,CAE1B,EAAG,CAACxB,CAAa,CAAC,EAGhB+B,EAAAA,IAACC,EAAAA,KAAA,CACC,UAAWC,EAAAA,EAAGnC,EAAWoC,EAAOC,SAAUhC,EAAO,GAAK+B,EAAOnC,OAAO,EACpE,QAAAA,EACA,QAAO,GACP,MAAO0B,EACP,GAAIvB,EAAM,i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,EAAkBqC,CAAE,EACpB,MAAMC,EAAOrD,EAAIsD,MAAAA,EACX,CAACC,CAAK,EAAIF,EAAKG,OAAOjB,EAAM,CAAC,EACnCc,EAAKG,OAAOJ,EAAI,EAAGG,CAAK,EAExB/D,GAAAA,MAAAA,EACE6D,EAAK1B,IAAI,CAAC8B,EAAGC,KAAS,CACpBC,GAAIC,OACF1D,EAAM6B,eAAe0B,CAAC,EAChBA,EAAEhE,MAAiC,SAAS,GAAK,OAAOiE,CAAG,GAC7D,OAAOA,CAAG,EAChB,EAEAG,OAAQR,EAAKS,OAAS,EAAIJ,CAAAA,EAC1B,GAGJvC,EAAAA,CACF,EAAE,iBAAA,WAEDS,SAAAA,CAAAA,EA5DIE,GAAOD,CA6Dd,CAEJ,CAAC,CAAA,CACH,CAEJ"}
@@ -1,48 +1,48 @@
1
- import { jsx as y } from "react/jsx-runtime";
2
- import { t as I } from "../../classix-DG18itHa.js";
3
- import _, { useMemo as V, useRef as k, useState as h, useEffect as z } from "react";
4
- import { i as B } from "../../icons-DkF2p6NO.js";
5
- import { List as M } from "../list/index.js";
6
- import '../../assets/index24.css';const N = "_sortable_scp0q_5", j = "_dragging_scp0q_35", F = "_dropping_scp0q_50", G = "_columns_scp0q_63", L = "_pseudo_scp0q_72", s = {
7
- sortable: N,
8
- dragging: j,
9
- dropping: F,
10
- columns: G,
11
- pseudo: L,
12
- "target-above": "_target-above_scp0q_87",
13
- "target-below": "_target-below_scp0q_88"
1
+ import { jsx as I } from "react/jsx-runtime";
2
+ import { t as T } from "../../classix-DG18itHa.js";
3
+ import _, { useMemo as z, useRef as B, useState as h, useEffect as M } from "react";
4
+ import { i as N } from "../../icons-DkF2p6NO.js";
5
+ import { List as k } from "../list/index.js";
6
+ import '../../assets/index24.css';const j = "_sortable_c1ptl_5", F = "_dragging_c1ptl_35", G = "_dropping_c1ptl_50", L = "_columns_c1ptl_63", W = "_pseudo_c1ptl_73", s = {
7
+ sortable: j,
8
+ dragging: F,
9
+ dropping: G,
10
+ columns: L,
11
+ pseudo: W,
12
+ "target-above": "_target-above_c1ptl_88",
13
+ "target-below": "_target-below_c1ptl_89"
14
14
  };
15
15
  function P({
16
16
  children: b,
17
- className: T,
17
+ className: E,
18
18
  columns: u = 1,
19
19
  isRearranging: d = !1,
20
20
  onChangeOrder: g,
21
21
  ...x
22
22
  }) {
23
- const w = Number.isFinite(u) ? Math.max(1, Math.floor(u)) : 1, v = V(() => _.Children.toArray(b), [b]), r = k(-1), [i, E] = h({
23
+ const v = Number.isFinite(u) ? Math.max(1, Math.floor(u)) : 1, w = z(() => _.Children.toArray(b), [b]), r = B(-1), [i, $] = h({
24
24
  height: 0,
25
25
  width: 0
26
- }), [a, f] = h(null), [$, D] = h(null), A = {
26
+ }), [a, f] = h(null), [A, D] = h(null), H = {
27
27
  ...x.style,
28
- "--icon-svg": B("sort", !0),
29
- "--height": `${i.height}px`,
30
- "--width": w > 1 ? `calc(${i.width}px - var(--utils-tokens-unit))` : `${i.width}px`
28
+ "--icon-svg": N("sort", !0),
29
+ "--height": `calc(${i.height}px - var(--scale-16))`,
30
+ "--width": v > 1 ? `calc(${i.width}px - var(--scale-16))` : `${i.width}px`
31
31
  }, S = () => {
32
32
  r.current = -1, f(null);
33
33
  };
34
- return z(() => {
34
+ return M(() => {
35
35
  d || D(null);
36
- }, [d]), /* @__PURE__ */ y(M, { className: I(T, s.sortable, w > 1 && s.columns), columns: u, ordered: !0, style: A, ...x, "data-component": "sortable", children: v.map((m, t) => {
37
- const H = _.isValidElement(m) ? m.key : null;
38
- return /* @__PURE__ */ y("li", { className: I(a !== null && a > t - 10 && a < t + 10 && s.pseudo, a === t && r.current < t && s["target-below"], a === t && r.current > t && s["target-above"], r.current === t && s.dragging, $ === t && d && s.dropping), draggable: !d, onDragEnd: () => S(), onDragOver: (e) => {
36
+ }, [d]), /* @__PURE__ */ I(k, { className: T(E, s.sortable, v > 1 && s.columns), columns: u, ordered: !0, style: H, ...x, "data-component": "sortable", children: w.map((m, t) => {
37
+ const V = _.isValidElement(m) ? m.key : null;
38
+ return /* @__PURE__ */ I("li", { className: T(a !== null && a > t - 10 && a < t + 10 && s.pseudo, a === t && r.current < t && s["target-below"], a === t && r.current > t && s["target-above"], r.current === t && s.dragging, A === t && d && s.dropping), draggable: !d, onDragEnd: () => S(), onDragOver: (e) => {
39
39
  e.preventDefault(), e.dataTransfer.dropEffect = "move";
40
40
  const o = r.current;
41
41
  if (o < 0 || o === t) return;
42
42
  const n = e.currentTarget.getBoundingClientRect(), c = t === o + 1 ? i.height : n.height, l = e.clientY > n.top + c / 2 ? t + 1 : t, p = l > o ? l - 1 : l;
43
43
  f(p);
44
44
  }, onDragStart: (e) => {
45
- r.current = t, E({
45
+ r.current = t, $({
46
46
  height: e.currentTarget.offsetHeight,
47
47
  width: e.currentTarget.offsetWidth
48
48
  }), e.dataTransfer.setData("text/plain", ""), e.dataTransfer.effectAllowed = "move", f(t);
@@ -51,12 +51,12 @@ function P({
51
51
  const o = r.current, n = a;
52
52
  if (o < 0 || n === null || o === n) return;
53
53
  D(n);
54
- const c = v.slice(), [q] = c.splice(o, 1);
55
- c.splice(n, 0, q), g == null || g(c.map((l, p) => ({
54
+ const c = w.slice(), [y] = c.splice(o, 1);
55
+ c.splice(n, 0, y), g == null || g(c.map((l, p) => ({
56
56
  id: String(_.isValidElement(l) ? l.props["data-id"] ?? `idx-${p}` : `idx-${p}`),
57
57
  weight: c.length - 1 - p
58
58
  }))), S();
59
- }, "data-component": "sortable", children: m }, H ?? t);
59
+ }, "data-component": "sortable", children: m }, V ?? t);
60
60
  }) });
61
61
  }
62
62
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/_sortable/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { List } from '@/components/list';\n\nimport styles from './styles.module.css';\n\ntype SortItem = { id: string; weight: number };\n\ntype SortableProps = React.ComponentPropsWithoutRef<'ol'> & {\n columns?: number;\n isRearranging?: boolean;\n onChangeOrder: (order: SortItem[]) => void;\n};\n\ntype withVars = React.CSSProperties & {\n '--height'?: string;\n '--width'?: string;\n '--icon-svg'?: string;\n};\n\n/**\n * Children must provide a stable `data-id` for emits `{ id, weight }` and `key` (reconciliation).\n */\n\nexport function Sortable({\n children,\n className,\n columns = 1,\n isRearranging = false,\n onChangeOrder,\n ...props\n}: SortableProps) {\n const cols = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;\n const arr = useMemo(() => React.Children.toArray(children), [children]);\n const drag = useRef(-1);\n const [zoneSize, setZoneSize] = useState({\n height: 0,\n width: 0,\n });\n const [dropIndex, setDropIndex] = useState<number | null>(null);\n const [droppedAtIndex, setDroppedAtIndex] = useState<number | null>(null);\n const withVars: withVars = {\n ...props.style,\n '--icon-svg': iconSVG('sort', true),\n '--height': `${zoneSize.height}px`,\n '--width':\n cols > 1 ? `calc(${zoneSize.width}px - var(--utils-tokens-unit))` : `${zoneSize.width}px`,\n };\n\n const resetDragState = () => {\n drag.current = -1;\n setDropIndex(null);\n };\n\n useEffect(() => {\n if (!isRearranging) {\n setDroppedAtIndex(null);\n }\n }, [isRearranging]);\n\n return (\n <List\n className={cx(className, styles.sortable, cols > 1 && styles.columns)}\n columns={columns}\n ordered\n style={withVars}\n {...props}\n >\n {arr.map((child, i) => {\n const key = React.isValidElement(child) ? child.key : null;\n\n return (\n <li\n key={key ?? i}\n className={cx(\n dropIndex !== null && dropIndex > i - 10 && dropIndex < i + 10 && styles.pseudo,\n dropIndex === i && drag.current < i && styles['target-below'],\n dropIndex === i && drag.current > i && styles['target-above'],\n drag.current === i && styles.dragging,\n droppedAtIndex === i && isRearranging && styles.dropping\n )}\n draggable={!isRearranging}\n onDragEnd={() => resetDragState()}\n onDragOver={(e) => {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n const from = drag.current;\n if (from < 0 || from === i) return;\n\n const rect = e.currentTarget.getBoundingClientRect();\n const itemHeight = i === from + 1 ? zoneSize.height : rect.height;\n const isBottomHalf = e.clientY > rect.top + itemHeight / 2;\n const rawIndex = isBottomHalf ? i + 1 : i;\n const nextDropIndex = rawIndex > from ? rawIndex - 1 : rawIndex;\n\n setDropIndex(nextDropIndex);\n }}\n onDragStart={(e) => {\n drag.current = i;\n setZoneSize({\n height: e.currentTarget.offsetHeight,\n width: e.currentTarget.offsetWidth,\n });\n e.dataTransfer.setData('text/plain', '');\n e.dataTransfer.effectAllowed = 'move';\n setDropIndex(i);\n }}\n onDrop={(e) => {\n e.preventDefault();\n const from = drag.current;\n const to = dropIndex;\n if (from < 0 || to === null || from === to) return;\n\n setDroppedAtIndex(to);\n const next = arr.slice();\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n\n onChangeOrder?.(\n next.map((c, idx) => ({\n id: String(\n React.isValidElement(c)\n ? ((c.props as { 'data-id'?: string })['data-id'] ?? `idx-${idx}`)\n : `idx-${idx}`\n ),\n\n weight: next.length - 1 - idx,\n }))\n );\n\n resetDragState();\n }}\n >\n {child}\n </li>\n );\n })}\n </List>\n );\n}\n"],"names":["Sortable","children","className","columns","isRearranging","onChangeOrder","props","cols","Number","isFinite","Math","max","floor","arr","useMemo","React","Children","toArray","drag","useRef","zoneSize","setZoneSize","useState","height","width","dropIndex","setDropIndex","droppedAtIndex","setDroppedAtIndex","withVars","style","iconSVG","resetDragState","current","useEffect","jsx","List","cx","styles","sortable","map","child","i","key","isValidElement","pseudo","dragging","dropping","e","preventDefault","dataTransfer","dropEffect","from","rect","currentTarget","getBoundingClientRect","itemHeight","rawIndex","clientY","top","nextDropIndex","offsetHeight","offsetWidth","setData","effectAllowed","to","next","slice","moved","splice","c","idx","id","String","weight","length"],"mappings":";;;;;;;;;;;;;;AA0BO,SAASA,EAAS;AAAA,EACvBC,UAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,SAAAA,IAAU;AAAA,EACVC,eAAAA,IAAgB;AAAA,EAChBC,eA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KAAAA,QAAAA,EACE6D,EAAK1B,IAAI,CAAC8B,GAAGC,OAAS;AAAA,QACpBC,IAAIC,OACF1D,EAAM6B,eAAe0B,CAAC,IAChBA,EAAEhE,MAAiC,SAAS,KAAK,OAAOiE,CAAG,KAC7D,OAAOA,CAAG,EAChB;AAAA,QAEAG,QAAQR,EAAKS,SAAS,IAAIJ;AAAAA,MAAAA,EAC1B,IAGJvC,EAAAA;AAAAA,IACF,GAAE,kBAAA,YAEDS,UAAAA,EAAAA,GA5DIE,KAAOD,CA6Dd;AAAA,EAEJ,CAAC,EAAA,CACH;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/_sortable/index.tsx"],"sourcesContent":["import cx from 'classix';\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { iconSVG } from '@/components/icon/icons.ts';\nimport { List } from '@/components/list';\n\nimport styles from './styles.module.css';\n\ntype SortItem = { id: string; weight: number };\n\ntype SortableProps = React.ComponentPropsWithoutRef<'ol'> & {\n columns?: number;\n isRearranging?: boolean;\n onChangeOrder: (order: SortItem[]) => void;\n};\n\ntype withVars = React.CSSProperties & {\n '--height'?: string;\n '--width'?: string;\n '--icon-svg'?: string;\n};\n\n/**\n * Children must provide a stable `data-id` for emits `{ id, weight }` and `key` (reconciliation).\n */\n\nexport function Sortable({\n children,\n className,\n columns = 1,\n isRearranging = false,\n onChangeOrder,\n ...props\n}: SortableProps) {\n const cols = Number.isFinite(columns) ? Math.max(1, Math.floor(columns)) : 1;\n const arr = useMemo(() => React.Children.toArray(children), [children]);\n const drag = useRef(-1);\n const [zoneSize, setZoneSize] = useState({\n height: 0,\n width: 0,\n });\n const [dropIndex, setDropIndex] = useState<number | null>(null);\n const [droppedAtIndex, setDroppedAtIndex] = useState<number | null>(null);\n const withVars: withVars = {\n ...props.style,\n '--icon-svg': iconSVG('sort', true),\n '--height': `calc(${zoneSize.height}px - var(--scale-16))`,\n '--width': cols > 1 ? `calc(${zoneSize.width}px - var(--scale-16))` : `${zoneSize.width}px`,\n };\n\n const resetDragState = () => {\n drag.current = -1;\n setDropIndex(null);\n };\n\n useEffect(() => {\n if (!isRearranging) {\n setDroppedAtIndex(null);\n }\n }, [isRearranging]);\n\n return (\n <List\n className={cx(className, styles.sortable, cols > 1 && styles.columns)}\n columns={columns}\n ordered\n style={withVars}\n {...props}\n >\n {arr.map((child, i) => {\n const key = React.isValidElement(child) ? child.key : null;\n\n return (\n <li\n key={key ?? i}\n className={cx(\n dropIndex !== null && dropIndex > i - 10 && dropIndex < i + 10 && styles.pseudo,\n dropIndex === i && drag.current < i && styles['target-below'],\n dropIndex === i && drag.current > i && styles['target-above'],\n drag.current === i && styles.dragging,\n droppedAtIndex === i && isRearranging && styles.dropping\n )}\n draggable={!isRearranging}\n onDragEnd={() => resetDragState()}\n onDragOver={(e) => {\n e.preventDefault();\n e.dataTransfer.dropEffect = 'move';\n const from = drag.current;\n if (from < 0 || from === i) return;\n\n const rect = e.currentTarget.getBoundingClientRect();\n const itemHeight = i === from + 1 ? zoneSize.height : rect.height;\n const isBottomHalf = e.clientY > rect.top + itemHeight / 2;\n const rawIndex = isBottomHalf ? i + 1 : i;\n const nextDropIndex = rawIndex > from ? rawIndex - 1 : rawIndex;\n\n setDropIndex(nextDropIndex);\n }}\n onDragStart={(e) => {\n drag.current = i;\n setZoneSize({\n height: e.currentTarget.offsetHeight,\n width: e.currentTarget.offsetWidth,\n });\n e.dataTransfer.setData('text/plain', '');\n e.dataTransfer.effectAllowed = 'move';\n setDropIndex(i);\n }}\n onDrop={(e) => {\n e.preventDefault();\n const from = drag.current;\n const to = dropIndex;\n if (from < 0 || to === null || from === to) return;\n\n setDroppedAtIndex(to);\n const next = arr.slice();\n const [moved] = next.splice(from, 1);\n next.splice(to, 0, moved);\n\n onChangeOrder?.(\n next.map((c, idx) => ({\n id: String(\n React.isValidElement(c)\n ? ((c.props as { 'data-id'?: string })['data-id'] ?? `idx-${idx}`)\n : `idx-${idx}`\n ),\n\n weight: next.length - 1 - idx,\n }))\n );\n\n resetDragState();\n }}\n >\n {child}\n </li>\n );\n })}\n </List>\n );\n}\n"],"names":["Sortable","children","className","columns","isRearranging","onChangeOrder","props","cols","Number","isFinite","Math","max","floor","arr","useMemo","React","Children","toArray","drag","useRef","zoneSize","setZoneSize","useState","height","width","dropIndex","setDropIndex","droppedAtIndex","setDroppedAtIndex","withVars","style","iconSVG","resetDragState","current","useEffect","jsx","List","cx","styles","sortable","map","child","i","key","isValidElement","pseudo","dragging","dropping","e","preventDefault","dataTransfer","dropEffect","from","rect","currentTarget","getBoundingClientRect","itemHeight","rawIndex","clientY","top","nextDropIndex","offsetHeight","offsetWidth","setData","effectAllowed","to","next","slice","moved","splice","c","idx","id","String","weight","length"],"mappings":";;;;;;;;;;;;;;AA0BO,SAASA,EAAS;AAAA,EACvBC,UAAAA;AAAAA,EACAC,WAAAA;AAAAA,EACAC,SAAAA,IAAU;AAAA,EACVC,eAAAA,IAAgB;AAAA,EAChBC,eAAAA;AAAAA,EACA,GAAGC;AACU,GAAG;AAChB,QAAMC,IAAOC,OAAOC,SAASN,CAAO,IAAIO,KAAKC,IAAI,GAAGD,KAAKE,MAAMT,CAAO,CAAC,IAAI,GACrEU,IAAMC,EAAQ,MAAMC,EAAMC,SAASC,QAAQhB,CAAQ,GAAG,CAACA,CAAQ,CAAC,GAChEiB,IAAOC,EAAO,EAAE,GAChB,CAACC,GAAUC,CAAW,IAAIC,EAAS;AAAA,IACvCC,QAAQ;AAAA,IACRC,OAAO;AAAA,EAAA,CACR,GACK,CAACC,GAAWC,CAAY,IAAIJ,EAAwB,IAAI,GACxD,CAACK,GAAgBC,CAAiB,IAAIN,EAAwB,IAAI,GAClEO,IAAqB;AAAA,IACzB,GAAGvB,EAAMwB;AAAAA,IACT,cAAcC,EAAQ,QAAQ,EAAI;AAAA,IAClC,YAAY,QAAQX,EAASG,MAAM;AAAA,IACnC,WAAWhB,IAAO,IAAI,QAAQa,EAASI,KAAK,0BAA0B,GAAGJ,EAASI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AAa;AAAA,IAC5B,GACA,aAAcZ,CAAAA,MAAM;AAClB9B,MAAAA,EAAKe,UAAUS,GACfrB,EAAY;AAAA,QACVE,QAAQyB,EAAEM,cAAcO;AAAAA,QACxBrC,OAAOwB,EAAEM,cAAcQ;AAAAA,MAAAA,CACxB,GACDd,EAAEE,aAAaa,QAAQ,cAAc,EAAE,GACvCf,EAAEE,aAAac,gBAAgB,QAC/BtC,EAAagB,CAAC;AAAA,IAChB,GACA,QAASM,CAAAA,MAAM;AACbA,QAAEC,eAAAA;AACF,YAAMG,IAAOlC,EAAKe,SACZgC,IAAKxC;AACX,UAAI2B,IAAO,KAAKa,MAAO,QAAQb,MAASa,EAAI;AAE5CrC,MAAAA,EAAkBqC,CAAE;AACpB,YAAMC,IAAOrD,EAAIsD,MAAAA,GACX,CAACC,CAAK,IAAIF,EAAKG,OAAOjB,GAAM,CAAC;AACnCc,MAAAA,EAAKG,OAAOJ,GAAI,GAAGG,CAAK,GAExB/D,KAAAA,QAAAA,EACE6D,EAAK1B,IAAI,CAAC8B,GAAGC,OAAS;AAAA,QACpBC,IAAIC,OACF1D,EAAM6B,eAAe0B,CAAC,IAChBA,EAAEhE,MAAiC,SAAS,KAAK,OAAOiE,CAAG,KAC7D,OAAOA,CAAG,EAChB;AAAA,QAEAG,QAAQR,EAAKS,SAAS,IAAIJ;AAAAA,MAAAA,EAC1B,IAGJvC,EAAAA;AAAAA,IACF,GAAE,kBAAA,YAEDS,UAAAA,EAAAA,GA5DIE,KAAOD,CA6Dd;AAAA,EAEJ,CAAC,EAAA,CACH;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index31.css');const a=require("react/jsx-runtime"),u=require("../../classix-5H4IWnMA.cjs"),c=require("../icon/index.cjs"),d="_button_l8m83_1",_="_danger_l8m83_22",p="_minimal_l8m83_35",b="_primary_l8m83_42",t={button:d,danger:_,minimal:p,primary:b},g={danger:t.danger,default:t.default,minimal:t.minimal,primary:t.primary};function y({children:i,className:r,disabled:m=!1,icon:e,onClick:o,ref:s,variant:n="default",...l}){return a.jsxs("button",{className:u.t(t.button,g[n],r),disabled:m,onClick:o,ref:s,type:"button",...l,"data-component":"button",children:[e&&a.jsx(c.Icon,{gap:"right",name:e,size:"small",variant:n==="minimal"||n==="default"?"default":"white"}),i]})}exports.Button=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index31.css');const a=require("react/jsx-runtime"),c=require("../../classix-5H4IWnMA.cjs"),l=require("../icon/index.cjs"),d="_button_1scj6_1",_="_danger_1scj6_22",p="_minimal_1scj6_35",b="_primary_1scj6_42",t={button:d,danger:_,minimal:p,primary:b},g={danger:t.danger,default:t.default,minimal:t.minimal,primary:t.primary};function y({children:i,className:s,disabled:r=!1,icon:e,onClick:o,ref:m,variant:n="default",...u}){return a.jsxs("button",{className:c.t(t.button,g[n],s),disabled:r,onClick:o,ref:m,type:"button",...u,"data-component":"button",children:[e&&a.jsx(l.Icon,{gap:"right",name:e,size:"small",variant:n==="minimal"||n==="default"?"default":"white"}),i]})}exports.Button=y;
2
2
  //# sourceMappingURL=index.cjs.map