Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controls: Remove ArrayControl #15788

Merged
merged 3 commits into from Aug 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions app/server/src/client/preview/render.ts
Expand Up @@ -28,12 +28,6 @@ const buildStoryArgs = (args: Args, argTypes: ArgTypes) => {
// For cross framework & language support we pick a consistent representation of Dates as strings
storyArgs[key] = new Date(argValue).toISOString();
break;
case 'array': {
// use the supplied separator when serializing an array as a string
const separator = control.separator || ',';
storyArgs[key] = argValue.join(separator);
break;
}
case 'object':
// send objects as JSON strings
storyArgs[key] = JSON.stringify(argValue);
Expand Down
4 changes: 2 additions & 2 deletions examples/server-kitchen-sink/views/addons/controls/all.pug
Expand Up @@ -5,8 +5,8 @@
- dateOptions = { year: 'numeric', month: 'long', day: 'numeric', timeZone: 'UTC' };
- style = `border: 2px dotted ${colour}; padding: 8px 22px; border-radius: 8px`;
- today = new Date(today);
- items = items.split(',');
- other = JSON.parse(other)
- items = JSON.parse(tems);
- other = JSON.parse(other);

div(style=`${style}`)
h1 My name is #{name},
Expand Down
28 changes: 0 additions & 28 deletions lib/components/src/controls/Array.stories.tsx

This file was deleted.

60 changes: 0 additions & 60 deletions lib/components/src/controls/Array.tsx

This file was deleted.

1 change: 0 additions & 1 deletion lib/components/src/controls/index.tsx
Expand Up @@ -2,7 +2,6 @@ import React, { Suspense } from 'react';

export * from './types';

export * from './Array';
export * from './Boolean';
export type { ColorProps } from './Color';

Expand Down
6 changes: 0 additions & 6 deletions lib/components/src/controls/types.ts
Expand Up @@ -11,11 +11,6 @@ export interface ControlProps<T> {
onBlur?: (evt: any) => void;
}

export type ArrayValue = string[] | readonly string[];
export interface ArrayConfig {
separator?: string;
}

export type BooleanValue = boolean;
export interface BooleanConfig {}

Expand Down Expand Up @@ -80,7 +75,6 @@ export type ControlType =
| 'text';

export type Control =
| ArrayConfig
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that technically this is a breaking change. Consumers could have been passing a separator param which has been ignored since we switched to ObjectControl. Do we want a deprecation warning around this or just do it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

KISS

| BooleanConfig
| ColorConfig
| DateConfig
Expand Down