@uniformdev/mesh-sdk-react 19.142.0 → 19.142.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +61 -44
- package/dist/index.d.ts +61 -44
- package/dist/index.esm.js +492 -68
- package/dist/index.js +518 -93
- package/dist/index.mjs +492 -68
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -4728,7 +4728,7 @@ import {
|
|
|
4728
4728
|
import { useEffect as useEffect14 } from "react";
|
|
4729
4729
|
import { Fragment as Fragment9, jsx as jsx39, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
|
|
4730
4730
|
function VariablesComposerInput({
|
|
4731
|
-
css:
|
|
4731
|
+
css: css40,
|
|
4732
4732
|
placeholder,
|
|
4733
4733
|
...contentEditableProps
|
|
4734
4734
|
}) {
|
|
@@ -7627,6 +7627,33 @@ var SearchInput = css38`
|
|
|
7627
7627
|
max-height: 40px;
|
|
7628
7628
|
min-height: unset;
|
|
7629
7629
|
`;
|
|
7630
|
+
var BindableKeywordSearchInputStyles = css38`
|
|
7631
|
+
position: relative;
|
|
7632
|
+
width: 100%;
|
|
7633
|
+
|
|
7634
|
+
& [data-lexical-editor='true'] {
|
|
7635
|
+
padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
|
|
7636
|
+
font-size: var(--fs-sm);
|
|
7637
|
+
border-radius: var(--rounded-full);
|
|
7638
|
+
max-height: 40px;
|
|
7639
|
+
min-height: unset;
|
|
7640
|
+
width: 100%;
|
|
7641
|
+
position: relative;
|
|
7642
|
+
white-space: nowrap;
|
|
7643
|
+
}
|
|
7644
|
+
`;
|
|
7645
|
+
var ClearSearchButtonContainer = css38`
|
|
7646
|
+
align-items: center;
|
|
7647
|
+
display: flex;
|
|
7648
|
+
position: absolute;
|
|
7649
|
+
inset: 0 var(--spacing-lg) 0 auto;
|
|
7650
|
+
`;
|
|
7651
|
+
var ClearSearchButtonStyles = css38`
|
|
7652
|
+
background: none;
|
|
7653
|
+
border: none;
|
|
7654
|
+
padding: 0;
|
|
7655
|
+
pointer-events: all;
|
|
7656
|
+
`;
|
|
7630
7657
|
var FilterButton = css38`
|
|
7631
7658
|
align-items: center;
|
|
7632
7659
|
background: var(--white);
|
|
@@ -7794,9 +7821,12 @@ var FilterButton2 = ({
|
|
|
7794
7821
|
};
|
|
7795
7822
|
|
|
7796
7823
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
7797
|
-
import {
|
|
7798
|
-
import {
|
|
7824
|
+
import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
|
|
7825
|
+
import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
|
|
7826
|
+
import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
|
|
7827
|
+
import { useEffect as useEffect21, useRef as useRef16, useState as useState21 } from "react";
|
|
7799
7828
|
import { useDebounce as useDebounce5 } from "react-use";
|
|
7829
|
+
import { v4 as v43 } from "uuid";
|
|
7800
7830
|
|
|
7801
7831
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
7802
7832
|
import { VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
|
|
@@ -8226,6 +8256,52 @@ var filterMapper = {
|
|
|
8226
8256
|
statusSingleChoice: StatusSingleEditor,
|
|
8227
8257
|
empty: null
|
|
8228
8258
|
};
|
|
8259
|
+
function withInputVariables(WrappedComponent) {
|
|
8260
|
+
const WithInputVariables = (props) => {
|
|
8261
|
+
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8262
|
+
return /* @__PURE__ */ jsx70(WrappedComponent, { ...props });
|
|
8263
|
+
}
|
|
8264
|
+
return /* @__PURE__ */ jsx70(
|
|
8265
|
+
InputVariables,
|
|
8266
|
+
{
|
|
8267
|
+
disableInlineMenu: true,
|
|
8268
|
+
showMenuPosition: "inline-right",
|
|
8269
|
+
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8270
|
+
value: props.value,
|
|
8271
|
+
disabled: props.disabled,
|
|
8272
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx70(WrappedComponent, { ...props })
|
|
8273
|
+
}
|
|
8274
|
+
);
|
|
8275
|
+
};
|
|
8276
|
+
return WithInputVariables;
|
|
8277
|
+
}
|
|
8278
|
+
function withInputVariablesForMultiValue(WrappedComponent) {
|
|
8279
|
+
const WithInputVariables = (props) => {
|
|
8280
|
+
var _a;
|
|
8281
|
+
if (!props.bindable || props.disabled || props.readOnly) {
|
|
8282
|
+
return /* @__PURE__ */ jsx70(WrappedComponent, { ...props });
|
|
8283
|
+
}
|
|
8284
|
+
return /* @__PURE__ */ jsx70(
|
|
8285
|
+
InputVariables,
|
|
8286
|
+
{
|
|
8287
|
+
disableInlineMenu: true,
|
|
8288
|
+
showMenuPosition: "inline-right",
|
|
8289
|
+
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
8290
|
+
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
8291
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx70(WrappedComponent, { ...props })
|
|
8292
|
+
}
|
|
8293
|
+
);
|
|
8294
|
+
};
|
|
8295
|
+
return WithInputVariables;
|
|
8296
|
+
}
|
|
8297
|
+
var bindableFiltersMapper = {
|
|
8298
|
+
...filterMapper,
|
|
8299
|
+
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
8300
|
+
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
8301
|
+
date: withInputVariables(DateEditor),
|
|
8302
|
+
text: withInputVariables(TextEditor),
|
|
8303
|
+
number: withInputVariables(NumberEditor)
|
|
8304
|
+
};
|
|
8229
8305
|
var ErrorContainer = ({ errorMessage }) => {
|
|
8230
8306
|
return /* @__PURE__ */ jsx70(
|
|
8231
8307
|
"div",
|
|
@@ -8359,17 +8435,21 @@ var FilterControls = ({
|
|
|
8359
8435
|
hideSearchInput
|
|
8360
8436
|
}) => {
|
|
8361
8437
|
const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
|
|
8362
|
-
const
|
|
8438
|
+
const editorRef = useRef16(null);
|
|
8439
|
+
const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
|
|
8440
|
+
const [idToResetInputVariables, setIdToResetInputVariables] = useState21("data-resource-search-term-input");
|
|
8441
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState21(searchTerm);
|
|
8363
8442
|
useDebounce5(
|
|
8364
8443
|
() => {
|
|
8365
8444
|
setSearchTerm(localeSearchTerm);
|
|
8366
8445
|
},
|
|
8367
8446
|
300,
|
|
8368
|
-
[localeSearchTerm
|
|
8447
|
+
[localeSearchTerm]
|
|
8369
8448
|
);
|
|
8370
8449
|
useEffect21(() => {
|
|
8371
8450
|
if (searchTerm === "") {
|
|
8372
8451
|
setLocaleSearchTerm("");
|
|
8452
|
+
setIdToResetInputVariables(`data-resource-search-term-input-${v43()}`);
|
|
8373
8453
|
}
|
|
8374
8454
|
}, [searchTerm]);
|
|
8375
8455
|
return /* @__PURE__ */ jsxs44(Fragment15, { children: [
|
|
@@ -8386,28 +8466,58 @@ var FilterControls = ({
|
|
|
8386
8466
|
dataTestId: "filters-button"
|
|
8387
8467
|
}
|
|
8388
8468
|
),
|
|
8389
|
-
hideSearchInput ? null : /* @__PURE__ */
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8469
|
+
hideSearchInput ? null : /* @__PURE__ */ jsxs44("div", { css: BindableKeywordSearchInputStyles, children: [
|
|
8470
|
+
/* @__PURE__ */ jsx72(
|
|
8471
|
+
InputVariables,
|
|
8472
|
+
{
|
|
8473
|
+
label: "",
|
|
8474
|
+
id: idToResetInputVariables,
|
|
8475
|
+
showMenuPosition: "inline-right",
|
|
8476
|
+
editorRef,
|
|
8477
|
+
value: localeSearchTerm,
|
|
8478
|
+
onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
|
|
8479
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx72(
|
|
8480
|
+
InputKeywordSearch2,
|
|
8481
|
+
{
|
|
8482
|
+
placeholder: "Search...",
|
|
8483
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
8484
|
+
value: localeSearchTerm,
|
|
8485
|
+
compact: true,
|
|
8486
|
+
rounded: true,
|
|
8487
|
+
css: SearchInput
|
|
8488
|
+
}
|
|
8489
|
+
)
|
|
8490
|
+
}
|
|
8491
|
+
),
|
|
8492
|
+
hasVariableInSearchTerm ? /* @__PURE__ */ jsx72("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx72(
|
|
8493
|
+
"button",
|
|
8494
|
+
{
|
|
8495
|
+
css: ClearSearchButtonStyles,
|
|
8496
|
+
onClick: () => {
|
|
8497
|
+
setLocaleSearchTerm("");
|
|
8498
|
+
if (editorRef.current) {
|
|
8499
|
+
if (editorRef.current.getRootElement() !== document.activeElement) {
|
|
8500
|
+
editorRef.current.dispatchCommand(CLEAR_EDITOR_COMMAND2, void 0);
|
|
8501
|
+
}
|
|
8502
|
+
}
|
|
8503
|
+
},
|
|
8504
|
+
type: "button",
|
|
8505
|
+
"data-testid": "keyword-search-clear-button",
|
|
8506
|
+
children: /* @__PURE__ */ jsx72(Icon7, { icon: CgClose5, iconColor: "red", size: "1rem" })
|
|
8507
|
+
}
|
|
8508
|
+
) }) : null
|
|
8509
|
+
] }),
|
|
8400
8510
|
children
|
|
8401
8511
|
] });
|
|
8402
8512
|
};
|
|
8403
8513
|
|
|
8404
8514
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8405
|
-
import { Icon as
|
|
8515
|
+
import { Icon as Icon8, InputComboBox as InputComboBox2 } from "@uniformdev/design-system";
|
|
8406
8516
|
import { useMemo as useMemo18 } from "react";
|
|
8407
8517
|
|
|
8408
8518
|
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
8409
8519
|
import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
|
|
8410
|
-
import
|
|
8520
|
+
import React13, { useEffect as useEffect22 } from "react";
|
|
8411
8521
|
import { jsx as jsx73, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
|
|
8412
8522
|
var SearchAndFilterOptionsContainer2 = ({
|
|
8413
8523
|
buttonRow,
|
|
@@ -8439,7 +8549,7 @@ var FilterMenu = ({
|
|
|
8439
8549
|
resetButtonText = "reset"
|
|
8440
8550
|
}) => {
|
|
8441
8551
|
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
8442
|
-
const innerMenuRef =
|
|
8552
|
+
const innerMenuRef = React13.useRef(null);
|
|
8443
8553
|
useEffect22(() => {
|
|
8444
8554
|
var _a;
|
|
8445
8555
|
if (filterVisibility) {
|
|
@@ -8594,7 +8704,7 @@ var FilterItem = ({
|
|
|
8594
8704
|
"aria-label": "delete filter",
|
|
8595
8705
|
css: IconBtn,
|
|
8596
8706
|
"data-testid": "delete-filter",
|
|
8597
|
-
children: /* @__PURE__ */ jsx74(
|
|
8707
|
+
children: /* @__PURE__ */ jsx74(Icon8, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
8598
8708
|
}
|
|
8599
8709
|
)
|
|
8600
8710
|
] })
|
|
@@ -8649,7 +8759,7 @@ var FilterItems = ({
|
|
|
8649
8759
|
onClick: handleAddFilter,
|
|
8650
8760
|
"data-testid": "add-filter",
|
|
8651
8761
|
children: [
|
|
8652
|
-
/* @__PURE__ */ jsx74(
|
|
8762
|
+
/* @__PURE__ */ jsx74(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
8653
8763
|
addButtonText
|
|
8654
8764
|
]
|
|
8655
8765
|
}
|
|
@@ -8826,53 +8936,366 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
8826
8936
|
);
|
|
8827
8937
|
};
|
|
8828
8938
|
|
|
8829
|
-
// src/components/
|
|
8830
|
-
import {
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8939
|
+
// src/components/SearchAndFilter/SortItems.tsx
|
|
8940
|
+
import { InputComboBox as InputComboBox3, InputSelect as InputSelect8, SegmentedControl, VerticalRhythm as VerticalRhythm8 } from "@uniformdev/design-system";
|
|
8941
|
+
|
|
8942
|
+
// src/components/SearchAndFilter/styles/SortItems.styles.ts
|
|
8943
|
+
import { css as css39 } from "@emotion/react";
|
|
8944
|
+
import { cq as cq2, fadeInLtr as fadeInLtr2 } from "@uniformdev/design-system";
|
|
8945
|
+
var ConditionalFilterRow2 = css39`
|
|
8946
|
+
display: grid;
|
|
8947
|
+
grid-template-columns: 35px 1fr;
|
|
8948
|
+
gap: var(--spacing-sm);
|
|
8949
|
+
margin-left: var(--spacing-base);
|
|
8950
|
+
|
|
8951
|
+
${cq2("380px")} {
|
|
8952
|
+
align-items: center;
|
|
8953
|
+
|
|
8954
|
+
&:after {
|
|
8955
|
+
content: '';
|
|
8956
|
+
display: block;
|
|
8957
|
+
height: 1px;
|
|
8958
|
+
background: var(--gray-300);
|
|
8959
|
+
width: calc(100% - var(--spacing-base));
|
|
8960
|
+
margin-left: var(--spacing-base);
|
|
8835
8961
|
}
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
{
|
|
8839
|
-
disableInlineMenu: true,
|
|
8840
|
-
showMenuPosition: "inline-right",
|
|
8841
|
-
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8842
|
-
value: props.value,
|
|
8843
|
-
disabled: props.disabled,
|
|
8844
|
-
inputWhenNoVariables: /* @__PURE__ */ jsx78(WrappedComponent, { ...props })
|
|
8845
|
-
}
|
|
8846
|
-
);
|
|
8847
|
-
};
|
|
8848
|
-
return WithInputVariables;
|
|
8849
|
-
}
|
|
8850
|
-
function withInputVariablesForMultiValue(WrappedComponent) {
|
|
8851
|
-
const WithInputVariables = (props) => {
|
|
8852
|
-
var _a;
|
|
8853
|
-
if (!props.bindable || props.disabled || props.readOnly) {
|
|
8854
|
-
return /* @__PURE__ */ jsx78(WrappedComponent, { ...props });
|
|
8962
|
+
&:last-of-type:after {
|
|
8963
|
+
display: none;
|
|
8855
8964
|
}
|
|
8856
|
-
|
|
8965
|
+
}
|
|
8966
|
+
|
|
8967
|
+
&:nth-of-type(2) {
|
|
8968
|
+
margin-left: 0;
|
|
8969
|
+
grid-template-columns: 50px 1fr;
|
|
8970
|
+
}
|
|
8971
|
+
|
|
8972
|
+
${cq2("580px")} {
|
|
8973
|
+
&:after {
|
|
8974
|
+
display: none;
|
|
8975
|
+
}
|
|
8976
|
+
}
|
|
8977
|
+
|
|
8978
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
8979
|
+
animation: ${fadeInLtr2} var(--duration-fast) var(--timing-ease-out);
|
|
8980
|
+
}
|
|
8981
|
+
`;
|
|
8982
|
+
var ConditionalInputRow2 = css39`
|
|
8983
|
+
display: flex;
|
|
8984
|
+
gap: var(--spacing-sm);
|
|
8985
|
+
flex-wrap: wrap;
|
|
8986
|
+
|
|
8987
|
+
${cq2("380px")} {
|
|
8988
|
+
& > div:nth-child(-n + 2) {
|
|
8989
|
+
width: calc(50% - var(--spacing-sm));
|
|
8990
|
+
}
|
|
8991
|
+
|
|
8992
|
+
& > div:nth-child(n + 3) {
|
|
8993
|
+
width: calc(100% - 48px);
|
|
8994
|
+
}
|
|
8995
|
+
}
|
|
8996
|
+
${cq2("580px")} {
|
|
8997
|
+
display: grid;
|
|
8998
|
+
grid-template-columns: 200px 160px 1fr 32px;
|
|
8999
|
+
|
|
9000
|
+
& > div:nth-child(n) {
|
|
9001
|
+
width: auto;
|
|
9002
|
+
}
|
|
9003
|
+
}
|
|
9004
|
+
`;
|
|
9005
|
+
var SearchInput2 = css39`
|
|
9006
|
+
max-height: 40px;
|
|
9007
|
+
min-height: unset;
|
|
9008
|
+
`;
|
|
9009
|
+
var FilterButton3 = css39`
|
|
9010
|
+
align-items: center;
|
|
9011
|
+
background: var(--white);
|
|
9012
|
+
border: 1px solid var(--gray-300);
|
|
9013
|
+
border-radius: var(--rounded-full);
|
|
9014
|
+
color: var(--typography-base);
|
|
9015
|
+
display: flex;
|
|
9016
|
+
font-size: var(--fs-sm);
|
|
9017
|
+
gap: var(--spacing-sm);
|
|
9018
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
9019
|
+
max-height: 40px;
|
|
9020
|
+
transition: color var(--duration-fast) var(--timing-ease-out),
|
|
9021
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
9022
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
9023
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
9024
|
+
|
|
9025
|
+
svg {
|
|
9026
|
+
color: var(--gray-300);
|
|
9027
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9028
|
+
}
|
|
9029
|
+
|
|
9030
|
+
&:hover,
|
|
9031
|
+
:where([aria-expanded='true']) {
|
|
9032
|
+
outline: none;
|
|
9033
|
+
background: var(--gray-200);
|
|
9034
|
+
border-color: var(--gray-300);
|
|
9035
|
+
|
|
9036
|
+
svg {
|
|
9037
|
+
color: var(--typography-base);
|
|
9038
|
+
}
|
|
9039
|
+
}
|
|
9040
|
+
|
|
9041
|
+
&:disabled {
|
|
9042
|
+
opacity: var(--opacity-50);
|
|
9043
|
+
}
|
|
9044
|
+
`;
|
|
9045
|
+
var FilterButtonText2 = css39`
|
|
9046
|
+
overflow: hidden;
|
|
9047
|
+
text-overflow: ellipsis;
|
|
9048
|
+
white-space: nowrap;
|
|
9049
|
+
max-width: 14ch;
|
|
9050
|
+
`;
|
|
9051
|
+
var FilterButtonSelected2 = css39`
|
|
9052
|
+
background: var(--gray-100);
|
|
9053
|
+
border-color: var(--gray-300);
|
|
9054
|
+
|
|
9055
|
+
svg {
|
|
9056
|
+
color: var(--accent-dark);
|
|
9057
|
+
}
|
|
9058
|
+
`;
|
|
9059
|
+
var FilterButtonWithOptions2 = css39`
|
|
9060
|
+
:where([aria-expanded='true']) {
|
|
9061
|
+
background: var(--purple-rain-100);
|
|
9062
|
+
border-color: var(--accent-light);
|
|
9063
|
+
color: var(--typography-base);
|
|
9064
|
+
box-shadow: var(--elevation-100);
|
|
9065
|
+
|
|
9066
|
+
svg {
|
|
9067
|
+
color: var(--accent-dark);
|
|
9068
|
+
}
|
|
9069
|
+
}
|
|
9070
|
+
`;
|
|
9071
|
+
var SearchIcon2 = css39`
|
|
9072
|
+
color: var(--icon-color);
|
|
9073
|
+
position: absolute;
|
|
9074
|
+
inset: 0 var(--spacing-base) 0 auto;
|
|
9075
|
+
margin: auto;
|
|
9076
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9077
|
+
`;
|
|
9078
|
+
var AddConditionalBtn2 = css39`
|
|
9079
|
+
align-items: center;
|
|
9080
|
+
background: transparent;
|
|
9081
|
+
border: none;
|
|
9082
|
+
color: var(--primary-action-default);
|
|
9083
|
+
display: flex;
|
|
9084
|
+
gap: var(--spacing-sm);
|
|
9085
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9086
|
+
padding: 0;
|
|
9087
|
+
|
|
9088
|
+
&:hover,
|
|
9089
|
+
&:focus {
|
|
9090
|
+
color: var(--primary-action-hover);
|
|
9091
|
+
}
|
|
9092
|
+
|
|
9093
|
+
&:disabled {
|
|
9094
|
+
color: var(--gray-400);
|
|
9095
|
+
}
|
|
9096
|
+
`;
|
|
9097
|
+
var Title2 = css39`
|
|
9098
|
+
color: var(--typography-light);
|
|
9099
|
+
|
|
9100
|
+
&:focus {
|
|
9101
|
+
outline: none;
|
|
9102
|
+
}
|
|
9103
|
+
`;
|
|
9104
|
+
var ResetConditionsBtn2 = css39`
|
|
9105
|
+
background: transparent;
|
|
9106
|
+
border: none;
|
|
9107
|
+
color: var(--action-destructive-default);
|
|
9108
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
9109
|
+
padding: 0;
|
|
9110
|
+
|
|
9111
|
+
&:hover,
|
|
9112
|
+
&:focus {
|
|
9113
|
+
color: var(--action-destructive-hover);
|
|
9114
|
+
}
|
|
9115
|
+
`;
|
|
9116
|
+
var IconBtn2 = css39`
|
|
9117
|
+
background: transparent;
|
|
9118
|
+
border: none;
|
|
9119
|
+
padding: var(--spacing-sm);
|
|
9120
|
+
`;
|
|
9121
|
+
var SearchAndFilterOptionsContainer3 = css39`
|
|
9122
|
+
background: var(--gray-50);
|
|
9123
|
+
border: 1px solid var(--gray-300);
|
|
9124
|
+
border-radius: var(--rounded-base);
|
|
9125
|
+
container-type: inline-size;
|
|
9126
|
+
display: flex;
|
|
9127
|
+
flex-direction: column;
|
|
9128
|
+
gap: var(--spacing-sm);
|
|
9129
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
9130
|
+
will-change: height;
|
|
9131
|
+
position: relative;
|
|
9132
|
+
z-index: 1;
|
|
9133
|
+
`;
|
|
9134
|
+
var SearchAndFilterOptionsInnerContainer2 = css39`
|
|
9135
|
+
display: flex;
|
|
9136
|
+
flex-direction: column;
|
|
9137
|
+
gap: var(--spacing-sm);
|
|
9138
|
+
padding-inline: var(--spacing-md);
|
|
9139
|
+
`;
|
|
9140
|
+
var SearchAndFilterButtonGroup2 = css39`
|
|
9141
|
+
margin-top: var(--spacing-xs);
|
|
9142
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
9143
|
+
`;
|
|
9144
|
+
var SortFilterWrapper = (hiddenLocaleInput) => css39`
|
|
9145
|
+
align-items: center;
|
|
9146
|
+
border-top: 1px solid var(--gray-300);
|
|
9147
|
+
display: flex;
|
|
9148
|
+
flex-wrap: wrap;
|
|
9149
|
+
gap: var(--spacing-base);
|
|
9150
|
+
padding: var(--spacing-base) var(--spacing-md) 0;
|
|
9151
|
+
position: relative;
|
|
9152
|
+
z-index: 0;
|
|
9153
|
+
|
|
9154
|
+
${cq2("420px")} {
|
|
9155
|
+
display: grid;
|
|
9156
|
+
grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr minmax(140px, 0.25fr)"};
|
|
9157
|
+
}
|
|
9158
|
+
`;
|
|
9159
|
+
var SortFilterInputRow = css39`
|
|
9160
|
+
align-items: center;
|
|
9161
|
+
display: grid;
|
|
9162
|
+
grid-template-columns: 1fr auto;
|
|
9163
|
+
gap: var(--spacing-base);
|
|
9164
|
+
`;
|
|
9165
|
+
var InputVariableWrapper = css39`
|
|
9166
|
+
flex-grow: 1;
|
|
9167
|
+
|
|
9168
|
+
// we need to override label styles nested within the input variable
|
|
9169
|
+
// as these are slightly different from the default label styles
|
|
9170
|
+
label > span {
|
|
9171
|
+
color: var(--typography-light);
|
|
9172
|
+
}
|
|
9173
|
+
`;
|
|
9174
|
+
|
|
9175
|
+
// src/components/SearchAndFilter/SortItems.tsx
|
|
9176
|
+
import { jsx as jsx78, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
|
|
9177
|
+
var SortItems = ({
|
|
9178
|
+
sortByLabel = "Sort by",
|
|
9179
|
+
localeLabel = "Show locale",
|
|
9180
|
+
sortOptions,
|
|
9181
|
+
sortByValue,
|
|
9182
|
+
onSortChange,
|
|
9183
|
+
localeValue,
|
|
9184
|
+
localeOptions,
|
|
9185
|
+
onLocaleChange,
|
|
9186
|
+
disableSortBinding
|
|
9187
|
+
}) => {
|
|
9188
|
+
var _a, _b;
|
|
9189
|
+
const hideLocaleOptions = !localeOptions || !onLocaleChange;
|
|
9190
|
+
const values = sortByValue == null ? void 0 : sortByValue.split("_");
|
|
9191
|
+
const sortDirection = values == null ? void 0 : values.pop();
|
|
9192
|
+
const sortField = values == null ? void 0 : values.join("_");
|
|
9193
|
+
const currentSelectedOption = (_b = (_a = sortOptions.find((item) => {
|
|
9194
|
+
var _a2;
|
|
9195
|
+
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
9196
|
+
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
9197
|
+
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
9198
|
+
return /* @__PURE__ */ jsxs49("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
9199
|
+
/* @__PURE__ */ jsxs49(VerticalRhythm8, { gap: "xs", children: [
|
|
9200
|
+
/* @__PURE__ */ jsx78("span", { css: Title2, children: sortByLabel }),
|
|
9201
|
+
/* @__PURE__ */ jsxs49("div", { css: SortFilterInputRow, children: [
|
|
9202
|
+
/* @__PURE__ */ jsx78(
|
|
9203
|
+
InputVariables,
|
|
9204
|
+
{
|
|
9205
|
+
disableInlineMenu: disableSortBinding,
|
|
9206
|
+
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9207
|
+
value: sortField,
|
|
9208
|
+
valueToResetTo: "created_at",
|
|
9209
|
+
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
9210
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx78(
|
|
9211
|
+
InputComboBox3,
|
|
9212
|
+
{
|
|
9213
|
+
id: "sort-by-field",
|
|
9214
|
+
"aria-label": "Sort by",
|
|
9215
|
+
options: sortOptions,
|
|
9216
|
+
onChange: (e) => {
|
|
9217
|
+
const fieldName = e == null ? void 0 : e.value;
|
|
9218
|
+
onSortChange(`${fieldName}_${sortDirection}`);
|
|
9219
|
+
},
|
|
9220
|
+
styles: {
|
|
9221
|
+
menu(base) {
|
|
9222
|
+
return {
|
|
9223
|
+
...base,
|
|
9224
|
+
minWidth: "max-content"
|
|
9225
|
+
};
|
|
9226
|
+
}
|
|
9227
|
+
},
|
|
9228
|
+
value: currentSelectedOption
|
|
9229
|
+
}
|
|
9230
|
+
)
|
|
9231
|
+
}
|
|
9232
|
+
),
|
|
9233
|
+
/* @__PURE__ */ jsx78(
|
|
9234
|
+
InputVariables,
|
|
9235
|
+
{
|
|
9236
|
+
disableInlineMenu: disableSortBinding,
|
|
9237
|
+
value: sortDirection,
|
|
9238
|
+
valueToResetTo: "DESC",
|
|
9239
|
+
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9240
|
+
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9241
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx78(
|
|
9242
|
+
SegmentedControl,
|
|
9243
|
+
{
|
|
9244
|
+
noCheckmark: true,
|
|
9245
|
+
name: "sortBy",
|
|
9246
|
+
hideOptionText: true,
|
|
9247
|
+
iconSize: "1rem",
|
|
9248
|
+
size: "xl",
|
|
9249
|
+
options: [
|
|
9250
|
+
{
|
|
9251
|
+
label: "Ascending",
|
|
9252
|
+
icon: "arrow-up",
|
|
9253
|
+
value: `ASC`,
|
|
9254
|
+
tooltip: "Ascending (e.g. A-Z, oldest to newest)",
|
|
9255
|
+
"data-testid": "sort-ascending"
|
|
9256
|
+
},
|
|
9257
|
+
{
|
|
9258
|
+
label: "Descending",
|
|
9259
|
+
icon: "arrow-down",
|
|
9260
|
+
value: `DESC`,
|
|
9261
|
+
tooltip: "Descending (e.g. Z-A, newest to oldest)",
|
|
9262
|
+
"data-testid": "sort-descending"
|
|
9263
|
+
}
|
|
9264
|
+
],
|
|
9265
|
+
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9266
|
+
value: sortDirection
|
|
9267
|
+
}
|
|
9268
|
+
)
|
|
9269
|
+
}
|
|
9270
|
+
)
|
|
9271
|
+
] })
|
|
9272
|
+
] }),
|
|
9273
|
+
hideLocaleOptions ? null : /* @__PURE__ */ jsx78(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx78(
|
|
8857
9274
|
InputVariables,
|
|
8858
9275
|
{
|
|
8859
|
-
|
|
9276
|
+
label: localeLabelValue,
|
|
9277
|
+
value: localeValue,
|
|
8860
9278
|
showMenuPosition: "inline-right",
|
|
8861
|
-
onChange: (
|
|
8862
|
-
|
|
8863
|
-
|
|
9279
|
+
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
9280
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx78(
|
|
9281
|
+
InputSelect8,
|
|
9282
|
+
{
|
|
9283
|
+
name: "localeReturned",
|
|
9284
|
+
"aria-label": localeLabelValue,
|
|
9285
|
+
label: localeLabelValue,
|
|
9286
|
+
showLabel: false,
|
|
9287
|
+
"data-testid": "context-locale",
|
|
9288
|
+
onChange: (e) => {
|
|
9289
|
+
var _a2;
|
|
9290
|
+
return onLocaleChange((_a2 = e.currentTarget.value) != null ? _a2 : "");
|
|
9291
|
+
},
|
|
9292
|
+
options: localeOptions,
|
|
9293
|
+
value: localeValue
|
|
9294
|
+
}
|
|
9295
|
+
)
|
|
8864
9296
|
}
|
|
8865
|
-
)
|
|
8866
|
-
};
|
|
8867
|
-
return WithInputVariables;
|
|
8868
|
-
}
|
|
8869
|
-
var bindableFiltersMapper = {
|
|
8870
|
-
...filterMapper,
|
|
8871
|
-
multiChoice: withInputVariablesForMultiValue(FilterMultiChoiceEditor),
|
|
8872
|
-
singleChoice: withInputVariables(FilterSingleChoiceEditor),
|
|
8873
|
-
date: withInputVariables(DateEditor),
|
|
8874
|
-
text: withInputVariables(TextEditor),
|
|
8875
|
-
number: withInputVariables(NumberEditor)
|
|
9297
|
+
) })
|
|
9298
|
+
] });
|
|
8876
9299
|
};
|
|
8877
9300
|
|
|
8878
9301
|
// src/utils/createLocationValidator.ts
|
|
@@ -8885,14 +9308,14 @@ function createLocationValidator(setValue, validate) {
|
|
|
8885
9308
|
|
|
8886
9309
|
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
8887
9310
|
import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
|
|
8888
|
-
import { useEffect as useEffect23, useRef as
|
|
9311
|
+
import { useEffect as useEffect23, useRef as useRef17 } from "react";
|
|
8889
9312
|
function useContentDataResourceLocaleInfo({
|
|
8890
9313
|
locale,
|
|
8891
9314
|
setLocale,
|
|
8892
9315
|
dynamicInputs
|
|
8893
9316
|
}) {
|
|
8894
9317
|
var _a;
|
|
8895
|
-
const setLocaleRef =
|
|
9318
|
+
const setLocaleRef = useRef17(setLocale);
|
|
8896
9319
|
setLocaleRef.current = setLocale;
|
|
8897
9320
|
const { flatVariables } = useVariables();
|
|
8898
9321
|
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
|
|
@@ -8913,9 +9336,9 @@ import {
|
|
|
8913
9336
|
DrawerContent,
|
|
8914
9337
|
Heading,
|
|
8915
9338
|
Input as Input7,
|
|
8916
|
-
InputComboBox as
|
|
9339
|
+
InputComboBox as InputComboBox4,
|
|
8917
9340
|
InputKeywordSearch as InputKeywordSearch4,
|
|
8918
|
-
InputSelect as
|
|
9341
|
+
InputSelect as InputSelect9,
|
|
8919
9342
|
InputToggle,
|
|
8920
9343
|
Label,
|
|
8921
9344
|
LoadingIndicator as LoadingIndicator5,
|
|
@@ -8979,9 +9402,9 @@ export {
|
|
|
8979
9402
|
INSERT_VARIABLE_COMMAND,
|
|
8980
9403
|
icons_exports as Icons,
|
|
8981
9404
|
Input7 as Input,
|
|
8982
|
-
|
|
9405
|
+
InputComboBox4 as InputComboBox,
|
|
8983
9406
|
InputKeywordSearch4 as InputKeywordSearch,
|
|
8984
|
-
|
|
9407
|
+
InputSelect9 as InputSelect,
|
|
8985
9408
|
InputToggle,
|
|
8986
9409
|
InputVariables,
|
|
8987
9410
|
Label,
|
|
@@ -9054,6 +9477,7 @@ export {
|
|
|
9054
9477
|
SearchOnlyContext,
|
|
9055
9478
|
SearchOnlyFilter,
|
|
9056
9479
|
SelectionField,
|
|
9480
|
+
SortItems,
|
|
9057
9481
|
StatusMultiEditor,
|
|
9058
9482
|
StatusSingleEditor,
|
|
9059
9483
|
Switch,
|