@servicetitan/dte-unlayer 0.96.0 → 0.98.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/dte-unlayer",
3
- "version": "0.96.0",
3
+ "version": "0.98.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "typings": "./dist/index.d.ts",
@@ -13,7 +13,6 @@ const BEHAVIOR_OPTIONS = [
13
13
  { label: 'Hide', value: 'hide' },
14
14
  ] as const;
15
15
  const NUMERIC_VALUE_RE = /^-?(?:\d+\.?\d*|\.\d+)$/;
16
-
17
16
  type BehaviorOption = (typeof BEHAVIOR_OPTIONS)[number];
18
17
 
19
18
  export interface DisplayConditionModalProps {
@@ -45,12 +44,9 @@ export const DisplayConditionModal = (props: DisplayConditionModalProps) => {
45
44
  }, []);
46
45
 
47
46
  const handleClose = useCallback(() => {
48
- if (request) {
49
- request.done(request.data ?? null);
50
- setRequest(null);
51
- }
47
+ setRequest(null);
52
48
  setIsOpen(false);
53
- }, [request]);
49
+ }, []);
54
50
 
55
51
  const handleSave = useCallback(() => {
56
52
  if (!request) {
@@ -147,6 +143,7 @@ export const DisplayConditionModal = (props: DisplayConditionModalProps) => {
147
143
  style={{
148
144
  maxHeight: MODAL_CONTENT_MAX_HEIGHT,
149
145
  overflowY: 'auto',
146
+ paddingRight: 8,
150
147
  width: '100%',
151
148
  }}
152
149
  >
@@ -163,15 +160,15 @@ export const DisplayConditionModal = (props: DisplayConditionModalProps) => {
163
160
  </Text>
164
161
  <Flex
165
162
  direction="row"
166
- alignItems="center"
163
+ alignItems="flex-end"
167
164
  gap="3"
168
165
  style={{ flexWrap: 'wrap' }}
169
166
  >
170
- <Text size="small" subdued variant="body">
167
+ <Text size="small" subdued variant="body" style={{ paddingBottom: 10 }}>
171
168
  Select to show or hide selected component.
172
169
  </Text>
173
170
  <div style={{ width: 160 }}>
174
- <Combobox
171
+ <Combobox.Select
175
172
  {...({ disableClearSelection: true } as object)}
176
173
  itemToKey={(item: BehaviorOption | null) => item?.value ?? ''}
177
174
  itemToString={(item: BehaviorOption | null) =>
@@ -181,10 +178,7 @@ export const DisplayConditionModal = (props: DisplayConditionModalProps) => {
181
178
  selectedItem={selectedBehavior}
182
179
  onChange={handleBehaviorChange}
183
180
  >
184
- <Combobox.SelectTrigger
185
- label="Behavior"
186
- placeholder="Select..."
187
- />
181
+ <Combobox.SelectTrigger label="" placeholder="Select..." />
188
182
  <Combobox.Content>
189
183
  {({ items }: { items: BehaviorOption[] }) => (
190
184
  <Combobox.List>
@@ -200,30 +194,35 @@ export const DisplayConditionModal = (props: DisplayConditionModalProps) => {
200
194
  </Combobox.List>
201
195
  )}
202
196
  </Combobox.Content>
203
- </Combobox>
197
+ </Combobox.Select>
204
198
  </div>
205
199
  </Flex>
206
200
  </Flex>
207
- <ConditionGroupsSection
208
- dataPointOptions={dataPointOptions}
209
- groups={state.groups}
210
- onAddGroup={addGroup}
211
- onRemoveGroup={removeGroup}
212
- onUpdateGroup={updateGroup}
213
- />
214
- {!canSave && (
215
- <Text size="small" subdued variant="body">
216
- Complete each condition before saving. Data point and value are
217
- required, and numeric fields must contain a valid number.
218
- </Text>
219
- )}
201
+ <div style={{ padding: 8 }}>
202
+ <ConditionGroupsSection
203
+ dataPointOptions={dataPointOptions}
204
+ groups={state.groups}
205
+ onAddGroup={addGroup}
206
+ onRemoveGroup={removeGroup}
207
+ onUpdateGroup={updateGroup}
208
+ />
209
+ </div>
220
210
  </Flex>
221
211
  </Dialog.Content>
222
212
  <Dialog.Footer sticky>
223
- <Dialog.CancelButton onClick={handleClose}>Cancel</Dialog.CancelButton>
224
- <Button appearance="primary" disabled={!canSave} onClick={handleSave}>
225
- Save Changes
226
- </Button>
213
+ <Flex
214
+ justifyContent="flex-end"
215
+ alignItems="center"
216
+ gap="3"
217
+ style={{ width: '100%' }}
218
+ >
219
+ <Button appearance="secondary" onClick={handleClose}>
220
+ Cancel
221
+ </Button>
222
+ <Button appearance="primary" disabled={!canSave} onClick={handleSave}>
223
+ Save Changes
224
+ </Button>
225
+ </Flex>
227
226
  </Dialog.Footer>
228
227
  </Dialog>,
229
228
  portalTarget,